@gbasin/agentboard-linux-arm64 0.2.15 → 0.2.16
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.
|
@@ -49,13 +49,13 @@ Error generating stack: `+a.message+`
|
|
|
49
49
|
To pick up a draggable item, press the space bar.
|
|
50
50
|
While dragging, use the arrow keys to move the item.
|
|
51
51
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
52
|
-
`},PL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function IL(e){let{announcements:t=PL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=AL}=e;const{announce:a,announcement:l}=RL(),s=oa("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),DL(k.useMemo(()=>({onDragStart(u){let{active:f}=u;a(t.onDragStart({active:f}))},onDragMove(u){let{active:f,over:_}=u;t.onDragMove&&a(t.onDragMove({active:f,over:_}))},onDragOver(u){let{active:f,over:_}=u;a(t.onDragOver({active:f,over:_}))},onDragEnd(u){let{active:f,over:_}=u;a(t.onDragEnd({active:f,over:_}))},onDragCancel(u){let{active:f,over:_}=u;a(t.onDragCancel({active:f,over:_}))}}),[a,t])),!o)return null;const p=gt.createElement(gt.Fragment,null,gt.createElement(LL,{id:n,value:i.draggable}),gt.createElement(TL,{id:s,announcement:l}));return r?hn.createPortal(p,r):p}var xt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(xt||(xt={}));function Wl(){}function BL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function OL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const jr=Object.freeze({x:0,y:0});function NL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function FL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function $L(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Zg(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const HL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=Zg(t,t.left,t.top),a=[];for(const l of n){const{id:s}=l,o=r.get(s);if(o){const c=NL(Zg(o),i);a.push({id:s,data:{droppableContainer:l,value:c}})}}return a.sort(jL)};function zL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=i-n,s=a-r;if(n<i&&r<a){const o=t.width*t.height,c=e.width*e.height,p=l*s,u=p/(o+c-p);return Number(u.toFixed(4))}return 0}const UL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=[];for(const a of n){const{id:l}=a,s=r.get(l);if(s){const o=zL(s,t);o>0&&i.push({id:l,data:{droppableContainer:a,value:o}})}}return i.sort(FL)};function WL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function W1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:jr}function VL(e){return function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return i.reduce((l,s)=>({...l,top:l.top+e*s.y,bottom:l.bottom+e*s.y,left:l.left+e*s.x,right:l.right+e*s.x}),{...r})}}const KL=VL(1);function GL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qL(e,t,r){const n=GL(t);if(!n)return e;const{scaleX:i,scaleY:a,x:l,y:s}=n,o=e.left-l-(1-i)*parseFloat(r),c=e.top-s-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),p=i?e.width/i:e.width,u=a?e.height/a:e.height;return{width:p,height:u,top:c,right:o+p,bottom:c+u,left:o}}const XL={ignoreTransform:!1};function Ti(e,t){t===void 0&&(t=XL);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=lr(e).getComputedStyle(e);c&&(r=qL(r,c,p))}const{top:n,left:i,width:a,height:l,bottom:s,right:o}=r;return{top:n,left:i,width:a,height:l,bottom:s,right:o}}function ev(e){return Ti(e,{ignoreTransform:!0})}function YL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function JL(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function QL(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const a=t[i];return typeof a=="string"?r.test(a):!1})}function Qf(e,t){const r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(Xf(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!sa(i)||H1(i)||r.includes(i))return r;const a=lr(e).getComputedStyle(i);return i!==e&&QL(i,a)&&r.push(i),JL(i,a)?r:n(i.parentNode)}return e?n(e):r}function V1(e){const[t]=Qf(e,1);return t??null}function gu(e){return!wc||!e?null:ki(e)?e:qf(e)?Xf(e)||e===Li(e).scrollingElement?window:sa(e)?e:null:null}function K1(e){return ki(e)?e.scrollX:e.scrollLeft}function G1(e){return ki(e)?e.scrollY:e.scrollTop}function Zh(e){return{x:K1(e),y:G1(e)}}var Tt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Tt||(Tt={}));function q1(e){return!wc||!e?!1:e===document.scrollingElement}function X1(e){const t={x:0,y:0},r=q1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:i,isLeft:a,isBottom:l,isRight:s,maxScroll:n,minScroll:t}}const ZL={x:.2,y:.2};function eT(e,t,r,n,i){let{top:a,left:l,right:s,bottom:o}=r;n===void 0&&(n=10),i===void 0&&(i=ZL);const{isTop:c,isBottom:p,isLeft:u,isRight:f}=X1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*i.y,width:t.width*i.x};return!c&&a<=t.top+v.height?(_.y=Tt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!p&&o>=t.bottom-v.height&&(_.y=Tt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!f&&s>=t.right-v.width?(_.x=Tt.Forward,y.x=n*Math.abs((t.right-v.width-s)/v.width)):!u&&l<=t.left+v.width&&(_.x=Tt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function tT(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Y1(e){return e.reduce((t,r)=>ai(t,Zh(r)),jr)}function rT(e){return e.reduce((t,r)=>t+K1(r),0)}function nT(e){return e.reduce((t,r)=>t+G1(r),0)}function sT(e,t){if(t===void 0&&(t=Ti),!e)return;const{top:r,left:n,bottom:i,right:a}=t(e);V1(e)&&(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const iT=[["x",["left","right"],rT],["y",["top","bottom"],nT]];class Zf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Qf(r),i=Y1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,s]of iT)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=s(n),p=i[a]-c;return this.rect[o]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fo{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var i;(i=this.target)==null||i.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function oT(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Li(e)}function vu(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var vr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(vr||(vr={}));function tv(e){e.preventDefault()}function aT(e){e.stopPropagation()}var Ye;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ye||(Ye={}));const J1={start:[Ye.Space,Ye.Enter],cancel:[Ye.Esc],end:[Ye.Space,Ye.Enter,Ye.Tab]},lT=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ye.Right:return{...r,x:r.x+25};case Ye.Left:return{...r,x:r.x-25};case Ye.Down:return{...r,y:r.y+25};case Ye.Up:return{...r,y:r.y-25}}};class Q1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new fo(Li(r)),this.windowListeners=new fo(lr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(vr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&sT(n),r(jr)}handleKeyDown(t){if(Jf(t)){const{active:r,context:n,options:i}=this.props,{keyboardCodes:a=J1,coordinateGetter:l=lT,scrollBehavior:s="smooth"}=i,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,p=c?{x:c.left,y:c.top}:jr;this.referenceCoordinates||(this.referenceCoordinates=p);const u=l(t,{active:r,context:n.current,currentCoordinates:p});if(u){const f=Ul(u,p),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:m,isRight:d,isLeft:g,isBottom:w,maxScroll:b,minScroll:x}=X1(v),C=tT(v),S={x:Math.min(h===Ye.Right?C.right-C.width/2:C.right,Math.max(h===Ye.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===Ye.Down?C.bottom-C.height/2:C.bottom,Math.max(h===Ye.Down?C.top:C.top+C.height/2,u.y))},E=h===Ye.Right&&!d||h===Ye.Left&&!g,L=h===Ye.Down&&!w||h===Ye.Up&&!m;if(E&&S.x!==u.x){const A=v.scrollLeft+f.x,M=h===Ye.Right&&A<=b.x||h===Ye.Left&&A>=x.x;if(M&&!f.y){v.scrollTo({left:A,behavior:s});return}M?_.x=v.scrollLeft-A:_.x=h===Ye.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:s});break}else if(L&&S.y!==u.y){const A=v.scrollTop+f.y,M=h===Ye.Down&&A<=b.y||h===Ye.Up&&A>=x.y;if(M&&!f.x){v.scrollTo({top:A,behavior:s});return}M?_.y=v.scrollTop-A:_.y=h===Ye.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:s});break}}this.handleMove(t,ai(Ul(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Q1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=J1,onActivation:i}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function rv(e){return!!(e&&"distance"in e)}function nv(e){return!!(e&&"delay"in e)}class ep{constructor(t,r,n){var i;n===void 0&&(n=oT(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=Li(l),this.documentListeners=new fo(this.document),this.listeners=new fo(n),this.windowListeners=new fo(lr(l)),this.initialCoordinates=(i=Qh(a))!=null?i:jr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.DragStart,tv),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),this.windowListeners.add(vr.ContextMenu,tv),this.documentListeners.add(vr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nv(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(rv(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:i}=this.props;i(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(vr.Click,aT,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(vr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:i,props:a}=this,{onMove:l,options:{activationConstraint:s}}=a;if(!i)return;const o=(r=Qh(t))!=null?r:jr,c=Ul(i,o);if(!n&&s){if(rv(s)){if(s.tolerance!=null&&vu(c,s.tolerance))return this.handleCancel();if(vu(c,s.distance))return this.handleStart()}if(nv(s)&&vu(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ye.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const cT={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tp extends ep{constructor(t){const{event:r}=t,n=Li(r.target);super(t,cT,n)}}tp.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const uT={move:{name:"mousemove"},end:{name:"mouseup"}};var ed;(function(e){e[e.RightClick=2]="RightClick"})(ed||(ed={}));class hT extends ep{constructor(t){super(t,uT,Li(t.event.target))}}hT.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===ed.RightClick?!1:(n==null||n({event:r}),!0)}}];const _u={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dT extends ep{constructor(t){super(t,_u)}static setup(){return window.addEventListener(_u.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_u.move.name,t)};function t(){}}}dT.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:i}=r;return i.length>1?!1:(n==null||n({event:r}),!0)}}];var po;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(po||(po={}));var Vl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Vl||(Vl={}));function fT(e){let{acceleration:t,activator:r=po.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:l=5,order:s=Vl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:p,delta:u,threshold:f}=e;const _=mT({delta:u,disabled:!a}),[y,v]=xL(),h=k.useRef({x:0,y:0}),m=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case po.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case po.DraggableRect:return i}},[r,i,o]),g=k.useRef(null),w=k.useCallback(()=>{const x=g.current;if(!x)return;const C=h.current.x*m.current.x,S=h.current.y*m.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>s===Vl.TreeOrder?[...c].reverse():c,[s,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=p[C];if(!S)continue;const{direction:E,speed:L}=eT(x,S,d,t,f);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),g.current=x,y(w,l),h.current=L,m.current=E;return}}h.current={x:0,y:0},m.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,p,JSON.stringify(f)])}const pT={x:{[Tt.Backward]:!1,[Tt.Forward]:!1},y:{[Tt.Backward]:!1,[Tt.Forward]:!1}};function mT(e){let{delta:t,disabled:r}=e;const n=Jh(t);return ia(i=>{if(r||!n||!i)return pT;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Tt.Backward]:i.x[Tt.Backward]||a.x===-1,[Tt.Forward]:i.x[Tt.Forward]||a.x===1},y:{[Tt.Backward]:i.y[Tt.Backward]||a.y===-1,[Tt.Forward]:i.y[Tt.Forward]||a.y===1}}},[r,t,n])}function gT(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ia(i=>{var a;return t==null?null:(a=n??i)!=null?a:null},[n,t])}function vT(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:i}=n,a=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var zo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zo||(zo={}));var td;(function(e){e.Optimized="optimized"})(td||(td={}));const sv=new Map;function _T(e,t){let{dragging:r,dependencies:n,config:i}=t;const[a,l]=k.useState(null),{frequency:s,measure:o,strategy:c}=i,p=k.useRef(e),u=h(),f=$o(u),_=k.useCallback(function(m){m===void 0&&(m=[]),!f.current&&l(d=>d===null?m:d.concat(m.filter(g=>!d.includes(g))))},[f]),y=k.useRef(null),v=ia(m=>{if(u&&!r)return sv;if(!m||m===sv||p.current!==e||a!=null){const d=new Map;for(let g of e){if(!g)continue;if(a&&a.length>0&&!a.includes(g.id)&&g.rect.current){d.set(g.id,g.rect.current);continue}const w=g.node.current,b=w?new Zf(o(w),w):null;g.rect.current=b,b&&d.set(g.id,b)}return d}return m},[e,a,r,u,o]);return k.useEffect(()=>{p.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof s!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},s))},[s,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case zo.Always:return!1;case zo.BeforeDragging:return r;default:return!r}}}function Z1(e,t){return ia(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function yT(e,t){return Z1(e,t)}function wT(e){let{callback:t,disabled:r}=e;const n=Yf(t),i=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Sc(e){let{callback:t,disabled:r}=e;const n=Yf(t),i=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function ST(e){return new Zf(Ti(e),e)}function iv(e,t,r){t===void 0&&(t=ST);const[n,i]=k.useState(null);function a(){i(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const p=t(e);return JSON.stringify(o)===JSON.stringify(p)?o:p})}const l=wT({callback(o){if(e)for(const c of o){const{type:p,target:u}=c;if(p==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),s=Sc({callback:a});return Gr(()=>{a(),e?(s==null||s.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),l==null||l.disconnect())},[e]),n}function xT(e){const t=Z1(e);return W1(e,t)}const ov=[];function bT(e){const t=k.useRef(e),r=ia(n=>e?n&&n!==ov&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qf(e):ov,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function CT(e){const[t,r]=k.useState(null),n=k.useRef(e),i=k.useCallback(a=>{const l=gu(a.target);l&&r(s=>s?(s.set(l,Zh(l)),new Map(s)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const s=e.map(o=>{const c=gu(o);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Zh(c)]):null}).filter(o=>o!=null);r(s.length?new Map(s):null),n.current=e}return()=>{l(e),l(a)};function l(s){s.forEach(o=>{const c=gu(o);c==null||c.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>ai(a,l),jr):Y1(e):jr,[e,t])}function av(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==jr;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Ul(e,r.current):jr}function ET(e){k.useEffect(()=>{if(!wc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function kT(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:i,handler:a}=n;return r[i]=l=>{a(l,t)},r},{}),[e,t])}function ew(e){return k.useMemo(()=>e?YL(e):null,[e])}const lv=[];function LT(e,t){t===void 0&&(t=Ti);const[r]=e,n=ew(r?lr(r):null),[i,a]=k.useState(lv);function l(){a(()=>e.length?e.map(o=>q1(o)?n:new Zf(t(o),o)):lv)}const s=Sc({callback:l});return Gr(()=>{s==null||s.disconnect(),l(),e.forEach(o=>s==null?void 0:s.observe(o))},[e]),i}function TT(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return sa(t)?t:e}function RT(e){let{measure:t}=e;const[r,n]=k.useState(null),i=k.useCallback(c=>{for(const{target:p}of c)if(sa(p)){n(u=>{const f=t(p);return u?{...u,width:f.width,height:f.height}:f});break}},[t]),a=Sc({callback:i}),l=k.useCallback(c=>{const p=TT(c);a==null||a.disconnect(),p&&(a==null||a.observe(p)),n(p?t(p):null)},[t,a]),[s,o]=zl(l);return k.useMemo(()=>({nodeRef:s,rect:r,setRef:o}),[r,s,o])}const DT=[{sensor:tp,options:{}},{sensor:Q1,options:{}}],MT={current:{}},il={draggable:{measure:ev},droppable:{measure:ev,strategy:zo.WhileDragging,frequency:td.Optimized},dragOverlay:{measure:Ti}};class mo extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const AT={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:il,measureDroppableContainers:Wl,windowRect:null,measuringScheduled:!1},PT={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wl,draggableNodes:new Map,over:null,measureDroppableContainers:Wl},xc=k.createContext(PT),tw=k.createContext(AT);function IT(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mo}}}function BT(e,t){switch(t.type){case xt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case xt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case xt.DragEnd:case xt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xt.RegisterDroppable:{const{element:r}=t,{id:n}=r,i=new mo(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case xt.SetDroppableDisabled:{const{id:r,key:n,disabled:i}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new mo(e.droppable.containers);return l.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case xt.UnregisterDroppable:{const{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const a=new mo(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function OT(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:i}=k.useContext(xc),a=Jh(n),l=Jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!Jf(a)||document.activeElement===a.target)return;const s=i.get(l);if(!s)return;const{activatorNode:o,node:c}=s;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const p of[o.current,c.current]){if(!p)continue;const u=EL(p);if(u){u.focus();break}}})}},[n,t,i,l,a]),null}function NT(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function jT(e){return k.useMemo(()=>({draggable:{...il.draggable,...e==null?void 0:e.draggable},droppable:{...il.droppable,...e==null?void 0:e.droppable},dragOverlay:{...il.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function FT(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e;const a=k.useRef(!1),{x:l,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Gr(()=>{if(!l&&!s||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const p=r(c),u=W1(p,n);if(l||(u.x=0),s||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=V1(c);f&&f.scrollBy({top:u.y,left:u.x})}},[t,l,s,n,r])}const rw=k.createContext({...jr,scaleX:1,scaleY:1});var Rn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Rn||(Rn={}));const $T=k.memo(function(t){var r,n,i,a;let{id:l,accessibility:s,autoScroll:o=!0,children:c,sensors:p=DT,collisionDetection:u=UL,measuring:f,modifiers:_,...y}=t;const v=k.useReducer(BT,void 0,IT),[h,m]=v,[d,g]=ML(),[w,b]=k.useState(Rn.Uninitialized),x=w===Rn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var fe;return C!=null?{id:C,data:(fe=A==null?void 0:A.data)!=null?fe:MT,rect:M}:null},[C,A]),B=k.useRef(null),[H,F]=k.useState(null),[$,I]=k.useState(null),R=$o(y,Object.values(y)),P=oa("DndDescribedBy",l),N=k.useMemo(()=>L.getEnabled(),[L]),j=jT(f),{droppableRects:U,measureDroppableContainers:V,measuringScheduled:ee}=_T(N,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),Q=gT(S,C),z=k.useMemo(()=>$?Qh($):null,[$]),O=de(),K=yT(Q,j.draggable.measure);FT({activeNode:C!=null?S.get(C):null,config:O.layoutShiftCompensation,initialRect:K,measure:j.draggable.measure});const W=iv(Q,j.draggable.measure,K),te=iv(Q?Q.parentElement:null),Y=k.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=L.getNodeFor((r=Y.current.over)==null?void 0:r.id),ue=RT({measure:j.dragOverlay.measure}),se=(n=ue.nodeRef.current)!=null?n:Q,re=x?(i=ue.rect)!=null?i:W:null,ae=!!(ue.nodeRef.current&&ue.rect),ye=xT(ae?null:W),ve=ew(se?lr(se):null),ne=bT(x?_e??Q:null),ie=LT(ne),he=NT(_,{transform:{x:E.x-ye.x,y:E.y-ye.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:W,containerNodeRect:te,draggingNodeRect:re,over:Y.current.over,overlayNodeRect:ue.rect,scrollableAncestors:ne,scrollableAncestorRects:ie,windowRect:ve}),oe=z?ai(z,E):null,me=CT(ne),xe=av(me),ke=av(me,[W]),Ne=ai(he,xe),Ke=re?KL(re,he):null,Ae=D&&Ke?u({active:D,collisionRect:Ke,droppableRects:U,droppableContainers:N,pointerCoordinates:oe}):null,Pe=$L(Ae,"id"),[G,J]=k.useState(null),Oe=ae?he:ai(he,ke),$e=WL(Oe,(a=G==null?void 0:G.rect)!=null?a:null,W),X=k.useRef(null),le=k.useCallback((fe,Ee)=>{let{sensor:Re,options:je}=Ee;if(B.current==null)return;const Me=S.get(B.current);if(!Me)return;const Ie=fe.nativeEvent,Ve=new Re({active:B.current,activeNode:Me,event:Ie,options:je,context:Y,onAbort(He){if(!S.get(He))return;const{onDragAbort:De}=R.current,ze={id:He};De==null||De(ze),d({type:"onDragAbort",event:ze})},onPending(He,Te,De,ze){if(!S.get(He))return;const{onDragPending:Ht}=R.current,_t={id:He,constraint:Te,initialCoordinates:De,offset:ze};Ht==null||Ht(_t),d({type:"onDragPending",event:_t})},onStart(He){const Te=B.current;if(Te==null)return;const De=S.get(Te);if(!De)return;const{onDragStart:ze}=R.current,Xe={activatorEvent:Ie,active:{id:Te,data:De.data,rect:M}};hn.unstable_batchedUpdates(()=>{ze==null||ze(Xe),b(Rn.Initializing),m({type:xt.DragStart,initialCoordinates:He,active:Te}),d({type:"onDragStart",event:Xe}),F(X.current),I(Ie)})},onMove(He){m({type:xt.DragMove,coordinates:He})},onEnd:ot(xt.DragEnd),onCancel:ot(xt.DragCancel)});X.current=Ve;function ot(He){return async function(){const{active:De,collisions:ze,over:Xe,scrollAdjustedTranslate:Ht}=Y.current;let _t=null;if(De&&Ht){const{cancelDrop:zt}=R.current;_t={activatorEvent:Ie,active:De,collisions:ze,delta:Ht,over:Xe},He===xt.DragEnd&&typeof zt=="function"&&await Promise.resolve(zt(_t))&&(He=xt.DragCancel)}B.current=null,hn.unstable_batchedUpdates(()=>{m({type:He}),b(Rn.Uninitialized),J(null),F(null),I(null),X.current=null;const zt=He===xt.DragEnd?"onDragEnd":"onDragCancel";if(_t){const It=R.current[zt];It==null||It(_t),d({type:zt,event:_t})}})}}},[S]),ge=k.useCallback((fe,Ee)=>(Re,je)=>{const Me=Re.nativeEvent,Ie=S.get(je);if(B.current!==null||!Ie||Me.dndKit||Me.defaultPrevented)return;const Ve={active:Ie};fe(Re,Ee.options,Ve)===!0&&(Me.dndKit={capturedBy:Ee.sensor},B.current=je,le(Re,Ee))},[S,le]),We=vT(p,ge);ET(p),Gr(()=>{W&&w===Rn.Initializing&&b(Rn.Initialized)},[W,w]),k.useEffect(()=>{const{onDragMove:fe}=R.current,{active:Ee,activatorEvent:Re,collisions:je,over:Me}=Y.current;if(!Ee||!Re)return;const Ie={active:Ee,activatorEvent:Re,collisions:je,delta:{x:Ne.x,y:Ne.y},over:Me};hn.unstable_batchedUpdates(()=>{fe==null||fe(Ie),d({type:"onDragMove",event:Ie})})},[Ne.x,Ne.y]),k.useEffect(()=>{const{active:fe,activatorEvent:Ee,collisions:Re,droppableContainers:je,scrollAdjustedTranslate:Me}=Y.current;if(!fe||B.current==null||!Ee||!Me)return;const{onDragOver:Ie}=R.current,Ve=je.get(Pe),ot=Ve&&Ve.rect.current?{id:Ve.id,rect:Ve.rect.current,data:Ve.data,disabled:Ve.disabled}:null,He={active:fe,activatorEvent:Ee,collisions:Re,delta:{x:Me.x,y:Me.y},over:ot};hn.unstable_batchedUpdates(()=>{J(ot),Ie==null||Ie(He),d({type:"onDragOver",event:He})})},[Pe]),Gr(()=>{Y.current={activatorEvent:$,active:D,activeNode:Q,collisionRect:Ke,collisions:Ae,droppableRects:U,draggableNodes:S,draggingNode:se,draggingNodeRect:re,droppableContainers:L,over:G,scrollableAncestors:ne,scrollAdjustedTranslate:Ne},M.current={initial:re,translated:Ke}},[D,Q,Ae,Ke,S,se,re,U,L,G,ne,Ne]),fT({...O,delta:E,draggingRect:Ke,pointerCoordinates:oe,scrollableAncestors:ne,scrollableAncestorRects:ie});const Z=k.useMemo(()=>({active:D,activeNode:Q,activeNodeRect:W,activatorEvent:$,collisions:Ae,containerNodeRect:te,dragOverlay:ue,draggableNodes:S,droppableContainers:L,droppableRects:U,over:G,measureDroppableContainers:V,scrollableAncestors:ne,scrollableAncestorRects:ie,measuringConfiguration:j,measuringScheduled:ee,windowRect:ve}),[D,Q,W,$,Ae,te,ue,S,L,U,G,V,ne,ie,j,ee,ve]),Le=k.useMemo(()=>({activatorEvent:$,activators:We,active:D,activeNodeRect:W,ariaDescribedById:{draggable:P},dispatch:m,draggableNodes:S,over:G,measureDroppableContainers:V}),[$,We,D,W,m,P,S,G,V]);return gt.createElement(U1.Provider,{value:g},gt.createElement(xc.Provider,{value:Le},gt.createElement(tw.Provider,{value:Z},gt.createElement(rw.Provider,{value:$e},c)),gt.createElement(OT,{disabled:(s==null?void 0:s.restoreFocus)===!1})),gt.createElement(IL,{...s,hiddenTextDescribedById:P}));function de(){const fe=(H==null?void 0:H.autoScrollEnabled)===!1,Ee=typeof o=="object"?o.enabled===!1:o===!1,Re=x&&!fe&&!Ee;return typeof o=="object"?{...o,enabled:Re}:{enabled:Re}}}),HT=k.createContext(null),cv="button",zT="Draggable";function UT(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e;const a=oa(zT),{activators:l,activatorEvent:s,active:o,activeNodeRect:c,ariaDescribedById:p,draggableNodes:u,over:f}=k.useContext(xc),{role:_=cv,roleDescription:y="draggable",tabIndex:v=0}=i??{},h=(o==null?void 0:o.id)===t,m=k.useContext(h?rw:HT),[d,g]=zl(),[w,b]=zl(),x=kT(l,t),C=$o(r);Gr(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===cv?!0:void 0,"aria-roledescription":y,"aria-describedby":p.draggable}),[n,_,v,h,y,p.draggable]);return{active:o,activatorEvent:s,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:f,setNodeRef:g,setActivatorNodeRef:b,transform:m}}function WT(){return k.useContext(tw)}const VT="Droppable",KT={timeout:25};function GT(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e;const a=oa(VT),{active:l,dispatch:s,over:o,measureDroppableContainers:c}=k.useContext(xc),p=k.useRef({disabled:r}),u=k.useRef(!1),f=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...KT,...i},m=$o(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(m.current)?m.current:[m.current]),_.current=null},h)},[h]),g=Sc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{g&&(E&&(g.unobserve(E),u.current=!1),S&&g.observe(S))},[g]),[b,x]=zl(w),C=$o(t);return k.useEffect(()=>{!g||!b.current||(g.disconnect(),u.current=!1,g.observe(b.current))},[b,g]),k.useEffect(()=>(s({type:xt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:f,data:C}}),()=>s({type:xt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==p.current.disabled&&(s({type:xt.SetDroppableDisabled,id:n,key:a,disabled:r}),p.current.disabled=r)},[n,a,r,s]),{active:l,rect:f,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function nw(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function qT(e,t){return e.reduce((r,n,i)=>{const a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function Ma(e){return e!==null&&e>=0}function XT(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function YT(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const sw=e=>{let{rects:t,activeIndex:r,overIndex:n,index:i}=e;const a=nw(t,n,r),l=t[i],s=a[i];return!s||!l?null:{x:s.left-l.left,y:s.top-l.top,scaleX:s.width/l.width,scaleY:s.height/l.height}},Aa={scaleX:1,scaleY:1},JT=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:i,rects:a,overIndex:l}=e;const s=(t=a[r])!=null?t:n;if(!s)return null;if(i===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(s.top+s.height):c.top-s.top,...Aa}:null}const o=QT(a,i,r);return i>r&&i<=l?{x:0,y:-s.height-o,...Aa}:i<r&&i>=l?{x:0,y:s.height+o,...Aa}:{x:0,y:0,...Aa}};function QT(e,t,r){const n=e[t],i=e[t-1],a=e[t+1];return n?r<t?i?n.top-(i.top+i.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}const iw="Sortable",ow=gt.createContext({activeIndex:-1,containerId:iw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:sw,disabled:{draggable:!1,droppable:!1}});function ZT(e){let{children:t,id:r,items:n,strategy:i=sw,disabled:a=!1}=e;const{active:l,dragOverlay:s,droppableRects:o,over:c,measureDroppableContainers:p}=WT(),u=oa(iw,r),f=s.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,m=k.useRef(_),d=!XT(_,m.current),g=h!==-1&&v===-1||d,w=YT(a);Gr(()=>{d&&y&&p(_)},[d,_,y,p]),k.useEffect(()=>{m.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:g,items:_,overIndex:h,useDragOverlay:f,sortedRects:qT(_,o),strategy:i}),[v,u,w.draggable,w.droppable,g,_,h,o,f,i]);return gt.createElement(ow.Provider,{value:b},t)}const eR=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return nw(r,n,i).indexOf(t)},tR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:a,newIndex:l,previousItems:s,previousContainerId:o,transition:c}=e;return!c||!n||s!==a&&i===l?!1:r?!0:l!==i&&t===o},rR={duration:200,easing:"ease"},aw="transform",nR=Ho.Transition.toString({property:aw,duration:0,easing:"linear"}),sR={roleDescription:"sortable"};function iR(e){let{disabled:t,index:r,node:n,rect:i}=e;const[a,l]=k.useState(null),s=k.useRef(r);return Gr(()=>{if(!t&&r!==s.current&&n.current){const o=i.current;if(o){const c=Ti(n.current,{ignoreTransform:!0}),p={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(p.x||p.y)&&l(p)}}r!==s.current&&(s.current=r)},[t,r,n,i]),k.useEffect(()=>{a&&l(null)},[a]),a}function oR(e){let{animateLayoutChanges:t=tR,attributes:r,disabled:n,data:i,getNewIndex:a=eR,id:l,strategy:s,resizeObserverConfig:o,transition:c=rR}=e;const{items:p,containerId:u,activeIndex:f,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:m,strategy:d}=k.useContext(ow),g=aR(n,_),w=p.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:p},...i}),[u,i,w,p]),x=k.useMemo(()=>p.slice(p.indexOf(l)),[p,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=GT({id:l,data:b,disabled:g.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:B,setNodeRef:H,listeners:F,isDragging:$,over:I,setActivatorNodeRef:R,transform:P}=UT({id:l,data:b,attributes:{...sR,...r},disabled:g.draggable}),N=SL(L,H),j=!!A,U=j&&!y&&Ma(f)&&Ma(h),V=!m&&$,ee=V&&U?P:null,z=U?ee??(s??d)({rects:v,activeNodeRect:D,activeIndex:f,overIndex:h,index:w}):null,O=Ma(f)&&Ma(h)?a({id:l,items:p,activeIndex:f,overIndex:h}):w,K=A==null?void 0:A.id,W=k.useRef({activeId:K,items:p,newIndex:O,containerId:u}),te=p!==W.current.items,Y=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:p,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:c,wasDragging:W.current.activeId!=null}),_e=iR({disabled:!Y,index:w,node:S,rect:C});return k.useEffect(()=>{j&&W.current.newIndex!==O&&(W.current.newIndex=O),u!==W.current.containerId&&(W.current.containerId=u),p!==W.current.items&&(W.current.items=p)},[j,O,u,p]),k.useEffect(()=>{if(K===W.current.activeId)return;if(K!=null&&W.current.activeId==null){W.current.activeId=K;return}const se=setTimeout(()=>{W.current.activeId=K},50);return()=>clearTimeout(se)},[K]),{active:A,activeIndex:f,attributes:B,data:b,rect:C,index:w,newIndex:O,items:p,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:I,setNodeRef:N,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:_e??z,transition:ue()};function ue(){if(_e||te&&W.current.newIndex===w)return nR;if(!(V&&!Jf(M)||!c)&&(j||Y))return Ho.Transition.toString({...c,property:aw})}}function aR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}Ye.Down,Ye.Right,Ye.Up,Ye.Left;const Pa={permission:0,waiting:1,working:2,unknown:3};function go(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const lR={mode:"created",direction:"desc"};function rp(e,t=lR){const{mode:r,direction:n,manualOrder:i}=t;if(r==="manual"&&i&&i.length>0){const a=new Map(i.map((l,s)=>[l,s]));return e.toSorted((l,s)=>{const o=go(l),c=go(s),p=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(s.id)??1/0;return p===1/0&&u===1/0?Date.parse(s.createdAt)-Date.parse(l.createdAt):p-u})}return e.toSorted((a,l)=>{if(r==="status"){const c=Pa[a.status]??Pa.unknown,p=Pa[l.status]??Pa.unknown;return c!==p?c-p:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const s=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-s:s-o})}function cR(e,t){var n,i;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const s=Date.parse(a.lastActivity)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}for(const a of t){const l=(i=a.projectPath)==null?void 0:i.trim();if(l){const s=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}return Array.from(r.keys()).toSorted((a,l)=>{const s=r.get(a)||0;return(r.get(l)||0)-s})}function uR(e,t){var n,i;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const s=Date.parse(a.lastActivity)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}for(const a of t){const l=(i=a.host)==null?void 0:i.trim();if(l){const s=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}return Array.from(r.keys()).toSorted((a,l)=>{const s=r.get(a)||0;return(r.get(l)||0)-s})}function np(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const i=Math.floor(n/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function _s(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function hR(e){const t=e.map(s=>{const o=s.trim(),c=o.replace(/[\\/]+$/,""),p=c.split(/[\\/]/).filter(Boolean);return{path:s,parts:p,fallback:c||o||s}}),r=new Map;for(const s of t)r.set(s.path,1);let n=!0;for(;n;){n=!1;const s=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,p=o.parts.slice(-c).join("/");s.set(p,(s.get(p)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,p=o.parts.slice(-c).join("/");(s.get(p)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const i=new Map,a=new Map;for(const s of t){let o=s.fallback;if(s.parts.length>0){const c=r.get(s.path)??1;o=s.parts.slice(-c).join("/")}i.set(s.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const s of t){let o=i.get(s.path)??s.fallback;(a.get(o)??0)>1&&(o=s.fallback),l.set(s.path,o)}return l}function lw(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const Ge=uf()(hf((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var p;const n=t(),i=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,s=new Set(r.map(u=>u.id)),o=a.filter(u=>!s.has(u.id)&&!l.has(u.id));let c=i;if(i!==null&&!r.some(u=>u.id===i)){const{sessionSortMode:u,sessionSortDirection:f}=pe.getState();c=((p=rp(r,{mode:u,direction:f})[0])==null?void 0:p.id)??null}if(o.length>0){const u=new Map(l);for(const f of o)u.set(f.id,f);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(i=>i.id===r.id?r:i)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(i=>i.id===r);if(n){const i=new Map(t().exitingSessions);i.set(r,n),e({exitingSessions:i})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:mc(()=>df),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function uv(e,t,r=!1){const[n,i]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const p=setTimeout(()=>{l.current&&(i(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(p)}a.current=e},[e,t,r]),[n,()=>i(!1)]}function dR(e,t,r,n){const i=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const s=i.current.get(l);s&&(clearTimeout(s),i.current.delete(l)),r(l)}else if(!i.current.has(l)){const s=setTimeout(()=>{i.current.delete(l),r(l)},n+100);i.current.set(l,s)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of i.current.values())clearTimeout(a);i.current.clear()},[])}function fR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function pR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function mR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const gR=[["claude",fR],["codex",pR],["pi",mR]];function bc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[i,a]of gR)if(n.startsWith(i))return T.jsx(a,{className:r});return T.jsx(BC,{className:r})}const vR=360;function _R(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function cw(e){return{"--badge-hue":`${_R(e)%vR}`}}function uw({name:e,fullPath:t,className:r=""}){const n=cw(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const yR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:i,onResume:a,onPreview:l,onSetPinned:s}){const o=np(t.lastActivityAt),c=_s(t.projectPath),p=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,f=i&&!!t.lastUserMessage,_=r?lw(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},g=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",g)}},[v]);const m=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:m,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(bc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:p}),t.lastResumeError&&T.jsx(cC,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Il,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||f)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(uw,{name:c,fullPath:t.projectPath}),f&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[s&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),s(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Il,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(sy,{width:14,height:14}),"Copy Log Path"]})]})]})});function wR({name:e,className:t=""}){const r=cw(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function SR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[i,a]=k.useState(!1),l=k.useId(),s=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),p=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!i||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var m;const h=v.target;h&&((m=s.current)!=null&&m.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[i]);const f=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:s,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:p,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(ff,{className:"h-3 w-3 shrink-0 text-muted"})]}),i&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>f(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function xR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[i,a]=k.useState(!1),l=k.useId(),s=k.useRef(null),o=k.useMemo(()=>hR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),p=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??_s(y)??y).join(", "),[o,t]),f=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??_s(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!i||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const m=h.target;m&&((d=s.current)!=null&&d.contains(m))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[i]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(m=>v.has(m));r(h)};return T.jsxs("div",{ref:s,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:f}),T.jsx(ff,{className:"h-3 w-3 shrink-0 text-muted"})]}),i&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??_s(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),p&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}const Kl=new Set(["tool_result","custom_tool_call_output"]),bR=new Set(["text","input_text","output_text"]);function qr(e){return!e||typeof e!="object"?null:e}function At(e){return typeof e=="string"?e:null}function Uo(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"||e==="developer"?"system":e==="tool"?"tool":"other"}function CR(e){const t=At(e.type)??"",r=qr(e.payload),n=At(r==null?void 0:r.type)??"",i=At(e.source)??At(r==null?void 0:r.source)??"",a=At(e.agent)??"";return i.toLowerCase()==="pi"||a.toLowerCase()==="pi"?"pi":t==="response_item"||t==="event_msg"?"codex":t==="tool_use"||t==="result"||t==="user"||t==="assistant"||t==="system"?"claude":n==="user_message"||n==="assistant_message"?"codex":"unknown"}function ER(e){const t=qr(e.payload),r=At(t==null?void 0:t.type);return{family:CR(e),rawType:At(e.type)??"unknown",...r?{payloadType:r}:{}}}function bt(e){if(!e)return[];if(typeof e=="string")return e.trim()?[e]:[];if(Array.isArray(e)){const r=[];for(const n of e){if(typeof n=="string"){n.trim()&&r.push(n);continue}const i=qr(n);if(!i)continue;const a=At(i.type);if(a&&Kl.has(a)||a&&!bR.has(a))continue;const l=At(i.text);l&&l.trim()&&r.push(l)}return r}const t=qr(e);if(t){const r=At(t.type);if(r&&Kl.has(r))return[];const n=At(t.text);return n&&n.trim()?[n]:[...bt(t.content),...bt(t.message)]}return[]}function kR(e,t){if(e.type!=="response_item")return[];const r=qr(e.payload);if(!r||r.type!=="message")return[];const n=Uo(r.role);return bt(r.content).map(i=>({kind:"message",role:n,text:i,source:t}))}function LR(e,t){if(e.type!=="event_msg")return[];const r=qr(e.payload);if(!r)return[];const n=At(r.type);let i=null;if(n==="user_message"?i="user":n==="assistant_message"?i="assistant":n==="system_message"?i="system":n==="message"&&(i=Uo(r.role)),!i||!["user","assistant","system"].includes(i))return[];const a=Array.from(new Set([...bt(r.message),...bt(r.content),...bt(r.text)]));return a.length===0?[]:a.map(l=>({kind:"message",role:i,text:l,source:t}))}function TR(e,t){const r=Uo(e.type),n=qr(e.message);if(n){const a=Uo(n.role??e.type);return[...bt(n.content),...bt(n.text),...bt(n.message)].map(s=>({kind:"message",role:a,text:s,source:t}))}return["user","assistant","system"].includes(r)?[...bt(e.content),...bt(e.text)].map(a=>({kind:"message",role:r,text:a,source:t})):[]}function RR(e,t){const r=Uo(e.role);return["user","assistant","system"].includes(r)?[...bt(e.content),...bt(e.message),...bt(e.text)].map(i=>({kind:"message",role:r,text:i,source:t})):[]}function DR(e,t){const r=At(e.type),n=At(e.event);return r!=="tool_use"&&n!=="tool_use"?[]:[{kind:"tool_call",role:"assistant",text:`[Tool: ${At(e.name)??"tool"}]`,source:t}]}function MR(e,t){if(e.type!=="result")return[];const r=At(e.result);return!r||!r.trim()?[]:[{kind:"result",role:"system",text:r,source:t}]}function AR(e,t){const r=qr(e.payload),n=[...bt(e.message),...bt(e.content),...bt(e.text),...bt(r==null?void 0:r.message),...bt(r==null?void 0:r.content)];return n.length===0?[]:n.map(i=>({kind:"unknown",role:"other",text:i,source:t}))}function PR(e,t){const r=At(e.type),n=qr(e.payload),i=At(n==null?void 0:n.type);return r&&Kl.has(r)||i&&Kl.has(i)?[{kind:"tool_result",role:"tool",text:"",source:t}]:[]}function IR(e){const t=qr(e);if(!t)return[];const r=ER(t),n=[...kR(t,r),...LR(t,r),...TR(t,r),...DR(t,r),...MR(t,r),...PR(t,r)];if(n.length>0)return n;const i=RR(t,r);return i.length>0?i:AR(t,r)}function BR(e){const t=e.trim();if(!t)return null;try{const r=JSON.parse(t);return{parsed:!0,events:IR(r),raw:r}}catch{return{parsed:!1,events:[{kind:"unknown",role:"other",text:t,source:{family:"unknown",rawType:"raw_text"}}],raw:e}}}function OR(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"?"system":"other"}function NR(e){const t=BR(e);if(!t)return[];const r=t.events.map(n=>({type:OR(n.role),content:n.text.trim(),raw:e})).filter(n=>n.content.length>0);return r.length>0?r:!t.parsed&&e.trim()?[{type:"other",content:e.trim(),raw:e}]:[]}function jR({session:e,onClose:t,onResume:r}){const[n,i]=k.useState(!0),[a,l]=k.useState(null),[s,o]=k.useState(null),[c,p]=k.useState(!1),u=k.useRef(null),f=k.useRef(null);k.useEffect(()=>{(async()=>{try{const m=await fetch(`/api/session-preview/${e.sessionId}`);if(!m.ok){const g=await m.json();throw new Error(g.error||"Failed to load preview")}const d=await m.json();o(d)}catch(m){l(m instanceof Error?m.message:"Failed to load preview")}finally{i(!1)}})()},[e.sessionId]),k.useEffect(()=>{u.current&&s&&(u.current.scrollTop=u.current.scrollHeight)},[s,c]),k.useEffect(()=>{const h=m=>{m.key==="Escape"?(m.stopPropagation(),t()):m.key==="Enter"&&!n&&!a&&(m.preventDefault(),r(e.sessionId))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,r,e.sessionId,n,a]),k.useEffect(()=>{var h;(h=f.current)==null||h.focus()},[]);const _=e.displayName||_s(e.projectPath)||e.sessionId.slice(0,8),y=np(e.lastActivityAt),v=(s==null?void 0:s.lines.flatMap(NR).slice(-30))??[];return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"preview-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&t()},children:T.jsxs("div",{ref:f,tabIndex:-1,className:"flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[T.jsx(bc,{agentType:e.agentType,className:"h-5 w-5 shrink-0 text-muted"}),T.jsxs("div",{className:"min-w-0 flex-1",children:[T.jsx("h2",{id:"preview-title",className:"truncate text-sm font-semibold text-primary",children:_}),T.jsxs("p",{className:"truncate text-xs text-muted",title:e.projectPath,children:[_s(e.projectPath)," · ",y]})]}),T.jsx("button",{type:"button",onClick:()=>p(h=>!h),className:`btn text-xs ${c?"btn-primary":""}`,children:c?"Parsed":"Raw"})]}),T.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 font-mono text-xs",children:[n&&T.jsx("div",{className:"flex items-center justify-center py-8 text-muted",children:"Loading preview..."}),a&&T.jsx("div",{className:"flex items-center justify-center py-8 text-danger",children:a}),s&&!c&&T.jsx("div",{className:"space-y-2",children:v.length===0?T.jsx("div",{className:"py-8 text-center text-muted",children:"No readable content found. Try raw view."}):v.map((h,m)=>T.jsx("div",{className:`rounded px-2 py-1 ${h.type==="user"?"bg-blue-500/10 text-blue-400":h.type==="assistant"?"bg-emerald-500/10 text-emerald-400":h.type==="system"?"bg-yellow-500/10 text-yellow-400":"text-muted"}`,children:T.jsx("span",{className:"whitespace-pre-wrap break-words",children:h.content.length>500?`${h.content.slice(0,500)}...`:h.content})},m))}),s&&c&&T.jsx("div",{className:"space-y-1",children:s.lines.slice(-50).map((h,m)=>T.jsx("div",{className:"whitespace-pre-wrap break-all text-muted",children:h||" "},m))})]}),T.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>r(e.sessionId),disabled:n||!!a,className:"btn btn-primary",children:"Resume"})]})]})})}const hv={working:"bg-green-500/20 text-green-600",waiting:"bg-zinc-500/20 text-zinc-400",permission:"bg-amber-500/20 text-amber-600",unknown:"bg-zinc-500/20 text-zinc-400"};function FR(){const[,e]=k.useState(0);k.useEffect(()=>{const t=setInterval(()=>e(r=>r+1),3e4);return()=>clearInterval(t)},[])}function hw({sessions:e,inactiveSessions:t=[],selectedSessionId:r,loading:n,error:i,onSelect:a,onRename:l,onResume:s,onKill:o,onDuplicate:c,onSetPinned:p}){FR();const[u,f]=k.useState(null),_=pe(X=>X.inactiveSessionsExpanded),y=pe(X=>X.setInactiveSessionsExpanded),[v,h]=k.useState(null),[m,d]=k.useState(20),g=$1();k.useEffect(()=>{_||d(20)},[_]);const w=200,[b,x]=uv(e.length,w),[C,S]=uv(t.length,w,!0),E=k.useRef(new Set(e.map(X=>X.id))),L=k.useRef(new Set(t.map(X=>X.sessionId))),[A,M]=k.useState(new Set);k.useEffect(()=>{var We;const X=new Set(e.map(Z=>Z.id)),le=new Set(t.map(Z=>Z.sessionId)),ge=new Set;for(const Z of X)E.current.has(Z)||ge.add(Z);for(const Z of e){const Le=(We=Z.agentSessionId)==null?void 0:We.trim();Le&&L.current.has(Le)&&!le.has(Le)&&ge.add(Z.id)}E.current=X,L.current=le,ge.size>0&&M(ge)},[e,t]),k.useEffect(()=>{if(A.size===0)return;const X=setTimeout(()=>M(new Set),500);return()=>clearTimeout(X)},[A]);const D=pe(X=>X.shortcutModifier),B=ii(Zo(D)),H=pe(X=>X.sessionSortMode),F=pe(X=>X.setSessionSortMode),$=pe(X=>X.sessionSortDirection),I=pe(X=>X.manualSessionOrder),R=pe(X=>X.setManualSessionOrder),P=pe(X=>X.showProjectName),N=pe(X=>X.showLastUserMessage),j=pe(X=>X.showSessionIdPrefix),U=pe(X=>X.projectFilters),V=pe(X=>X.setProjectFilters),ee=pe(X=>X.hostFilters),Q=pe(X=>X.setHostFilters),z=Ge(X=>X.exitingSessions),O=Ge(X=>X.clearExitingSession),K=Ge(X=>X.hostStatuses),W=Ge(X=>X.remoteAllowControl);dR(e,z,O,w),k.useEffect(()=>{if(I.length===0)return;const X=new Set;for(const ge of e)X.add(go(ge)),X.add(ge.id);for(const ge of t)X.add(ge.sessionId);const le=I.filter(ge=>X.has(ge));le.length!==I.length&&R(le)},[e,t,I,R]);const Y=k.useMemo(()=>rp(e,{mode:H,direction:$,manualOrder:I}),[e,H,$,I]),_e=k.useMemo(()=>cR(e,t),[e,t]),ue=k.useMemo(()=>{const X=uR(e,t),le=K.map(Z=>Z.host),ge=new Set,We=[];for(const Z of le)!Z||ge.has(Z)||(ge.add(Z),We.push(Z));for(const Z of X)!Z||ge.has(Z)||(ge.add(Z),We.push(Z));return We},[e,t,K]),se=k.useMemo(()=>ue.length>1,[ue]),re=k.useMemo(()=>{let X=Y;return U.length>0&&(X=X.filter(le=>U.includes(le.projectPath))),ee.length>0&&(X=X.filter(le=>ee.includes(le.host??""))),X},[Y,U,ee]),ae=k.useMemo(()=>{const X=U.length===0?"all-projects":U.join("|"),le=ee.length===0?"all-hosts":ee.join("|");return`${X}::${le}`},[U,ee]),ye=k.useRef(new Set(re.map(X=>X.id))),[ve,ne]=k.useState(new Set);k.useEffect(()=>{const X=new Set(re.map(ge=>ge.id)),le=new Set;for(const ge of X)ye.current.has(ge)||A.has(ge)||le.add(ge);ye.current=X,le.size>0&&ne(le)},[re,A]),k.useEffect(()=>{if(ve.size===0)return;const X=setTimeout(()=>ne(new Set),500);return()=>clearTimeout(X)},[ve]);const ie=k.useMemo(()=>{let X=t;return U.length>0&&(X=X.filter(le=>U.includes(le.projectPath))),ee.length>0&&(X=X.filter(le=>ee.includes(le.host??""))),X},[t,U,ee]),he=k.useMemo(()=>{if(U.length===0)return 0;const X=new Set(U);return e.filter(le=>!X.has(le.projectPath)&&le.status==="permission").length},[e,U]);k.useEffect(()=>{if(U.length===0||_e.length===0)return;const X=new Set(_e),le=U.filter(ge=>X.has(ge));le.length!==U.length&&V(le)},[U,_e,V]),k.useEffect(()=>{if(ee.length===0||ue.length===0)return;const X=new Set(ue),le=ee.filter(ge=>X.has(ge));le.length!==ee.length&&Q(le)},[ee,ue,Q]);const oe=OL(BL(tp,{activationConstraint:{distance:8}})),[me,xe]=k.useState(null),[ke,Ne]=k.useState(null),[Ke,Ae]=k.useState(!1),Pe=k.useCallback(X=>{xe(X.active.id),Ae(!0)},[]),G=k.useCallback(X=>{var le;Ne((le=X.over)==null?void 0:le.id)},[]),J=k.useCallback(X=>{const{active:le,over:ge}=X;if(xe(null),Ne(null),!ge||le.id===ge.id){setTimeout(()=>Ae(!1),100);return}const We=re.findIndex(Me=>Me.id===le.id),Z=re.findIndex(Me=>Me.id===ge.id);if(We===-1||Z===-1){setTimeout(()=>Ae(!1),100);return}const Le=re.map(Me=>go(Me)),[de]=Le.splice(We,1);Le.splice(Z,0,de);const fe=Y.map(Me=>go(Me)),Ee=new Set(Le);let Re=0;const je=fe.map(Me=>{if(!Ee.has(Me))return Me;const Ie=Le[Re];return Re+=1,Ie});H!=="manual"&&F("manual"),R(je),setTimeout(()=>Ae(!1),100)},[re,Y,H,F,R]),Oe=k.useCallback(()=>{xe(null),Ne(null),setTimeout(()=>Ae(!1),100)},[]);k.useEffect(()=>{if(!me&&!ke)return;const X=new Set(re.map(ge=>ge.id));let le=!1;me&&!X.has(me)&&(xe(null),le=!0),ke&&!X.has(ke)&&(Ne(null),le=!0),le&&Ae(!1)},[re,me,ke]);const $e=(X,le)=>{l(X,le),f(null)};return T.jsxs("aside",{className:"flex min-h-0 flex-1 flex-col border-r border-border bg-elevated",children:[i&&T.jsx("div",{className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:i}),T.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"sticky top-0 z-10 flex h-10 items-center justify-between border-b border-border bg-elevated px-3",children:[T.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted",children:"Sessions"}),T.jsxs("div",{className:"flex items-center gap-4",children:[se&&T.jsx(SR,{hosts:ue,selectedHosts:ee,onSelect:Q,statuses:K}),T.jsx(xR,{projects:_e,selectedProjects:U,onSelect:V,hasHiddenPermissions:he>0}),T.jsx(Yh.span,{className:"w-8 text-right text-xs text-muted",animate:b&&!g?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:x,children:re.length})]})]}),n?T.jsx("div",{className:"space-y-1 p-2",children:[0,1,2].map(X=>T.jsx("div",{className:"h-14 animate-pulse rounded bg-surface"},X))}):re.length===0?T.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted",children:"No sessions"}):T.jsx($T,{sensors:oe,collisionDetection:HL,onDragStart:Pe,onDragOver:G,onDragEnd:J,onDragCancel:Oe,children:T.jsx(ZT,{items:re.map(X=>X.id),strategy:JT,children:T.jsx("div",{children:T.jsx(W5,{initial:!1,children:re.map((X,le)=>{const ge=A.has(X.id),We=ve.has(X.id),Z=X.remote===!0,Le=X.source==="managed",de=!Z||W&&Le,fe=me?re.findIndex(Me=>Me.id===me):-1,Re=ke===X.id&&me!==X.id?fe>le?"above":"below":null,je=ge||We;return T.jsx(dw,{session:X,isNew:je,exitDuration:w,prefersReducedMotion:g,layoutAnimationsDisabled:Ke,isSelected:X.id===r,isEditing:X.id===u,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:N,showHostInfo:se,dropIndicator:Re,onSelect:()=>a(X.id),onStartEdit:de?()=>f(X.id):void 0,onCancelEdit:()=>f(null),onRename:Me=>$e(X.id,Me),onKill:o&&de?()=>o(X.id):void 0,onDuplicate:c&&de?()=>c(X.id):void 0,onSetPinned:p&&X.agentSessionId?Me=>p(X.agentSessionId.trim(),Me):void 0},X.id)})})},ae)})}),ie.length>0&&T.jsxs("div",{className:"border-t border-border",children:[T.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary",children:[T.jsxs("span",{className:"flex items-center gap-2",children:[_?T.jsx(ff,{className:"h-4 w-4"}):T.jsx(dC,{className:"h-4 w-4"}),"Inactive Sessions"]}),T.jsx(Yh.span,{className:"w-8 text-right text-xs",animate:C&&!g?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:S,children:ie.length})]}),_&&T.jsxs("div",{className:"py-1",children:[ie.slice(0,m).map(X=>T.jsx(yR,{session:X,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:N,onResume:le=>s==null?void 0:s(le),onPreview:h,onSetPinned:p},X.sessionId)),ie.length>m&&T.jsxs("button",{type:"button",onClick:()=>d(X=>X+20),className:"w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover",children:["Show more (",ie.length-m," remaining)"]})]})]})]}),T.jsx("div",{className:"hidden shrink-0 border-t border-border px-3 py-2 md:block",children:T.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted",children:[T.jsxs("span",{children:[B,"[ ] nav"]}),T.jsxs("span",{children:[B,"N new"]}),T.jsxs("span",{children:[B,"X kill"]})]})}),v&&T.jsx(jR,{session:v,onClose:()=>h(null),onResume:X=>{h(null),s==null||s(X)}})]})}const dw=k.forwardRef(function({session:t,isNew:r,exitDuration:n,prefersReducedMotion:i,layoutAnimationsDisabled:a,isSelected:l,isEditing:s,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:p,showHostInfo:u,dropIndicator:f,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:m,onDuplicate:d,onSetPinned:g},w){const{attributes:b,listeners:x,setNodeRef:C,transform:S,transition:E,isDragging:L}=oR({id:t.id,animateLayoutChanges:({isSorting:H,wasDragging:F})=>H||F}),A=Ho.Transform.toString(S),D={...!!(i&&A)?{transform:A,transition:E}:{},zIndex:L?10:void 0,opacity:L?.9:void 0},B=k.useCallback(H=>{C(H),typeof w=="function"?w(H):w&&(w.current=H)},[C,w]);return T.jsxs(Yh.div,{ref:B,style:{...D,overflow:"hidden"},className:"relative",layout:!i&&!L&&!a&&!r,transformTemplate:(H,F)=>A?!F||F==="none"?A:`${A} ${F}`:F,initial:i||!r?!1:{opacity:0,scale:.97},animate:i?{opacity:1}:r?{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:i?{opacity:0}:{opacity:0,height:0,scale:.97},transition:i?{duration:0}:{layout:{type:"spring",stiffness:500,damping:35},opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:"easeOut"}},...b,...x,children:[f==="above"&&T.jsx("div",{className:"absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"}),T.jsx($R,{session:t,isSelected:l,isEditing:s,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:p,showHostInfo:u,isDragging:L,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:m,onDuplicate:d,onSetPinned:g}),f==="below"&&T.jsx("div",{className:"absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"})]})});dw.displayName="SortableSessionItem";function $R({session:e,isSelected:t,isEditing:r,showSessionIdPrefix:n,showProjectName:i,showLastUserMessage:a,showHostInfo:l,isDragging:s=!1,onSelect:o,onStartEdit:c,onCancelEdit:p,onRename:u,onKill:f,onDuplicate:_,onSetPinned:y}){var Q,z,O,K;const v=np(e.lastActivity),h=k.useRef(null),m=k.useRef(null),d=((Q=e.agentSessionName)==null?void 0:Q.trim())||((z=e.name)==null?void 0:z.trim())||e.id,[g,w]=k.useState(d),b=k.useRef(null),[x,C]=k.useState(null),S=_s(e.projectPath),E=(O=e.host)==null?void 0:O.trim(),L=e.status==="permission",A=(K=e.agentSessionId)==null?void 0:K.trim(),M=n&&A?lw(A):"",D=i&&!!S,B=l&&!!E,H=a&&!!e.lastUserMessage,F=k.useRef(e.status),[$,I]=k.useState(!1);k.useEffect(()=>{const W=F.current,te=e.status;W==="working"&&te==="waiting"?I(!0):F.current=te},[e.status]);const R=()=>{I(!1),F.current=e.status};k.useEffect(()=>{r&&h.current&&(h.current.focus(),h.current.select())},[r]),k.useEffect(()=>{w(d)},[d]);const P=()=>{const W=g.trim();W&&W!==d?u(W):p()},N=W=>{W.key==="Enter"?(W.preventDefault(),P()):W.key==="Escape"&&(W.preventDefault(),w(d),p())},j=k.useRef(null),U=W=>{if(s)return;const te=W.touches[0];j.current={x:te.clientX,y:te.clientY},b.current=setTimeout(()=>{j.current&&C(j.current)},500)},V=()=>{b.current&&(clearTimeout(b.current),b.current=null)};k.useEffect(()=>{if(!x)return;const W=Y=>{m.current&&!m.current.contains(Y.target)&&C(null)},te=Y=>{Y.key==="Escape"&&C(null)};return document.addEventListener("mousedown",W),document.addEventListener("touchstart",W),document.addEventListener("keydown",te),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("touchstart",W),document.removeEventListener("keydown",te)}},[x]);const ee=W=>{W.preventDefault(),W.stopPropagation(),C({x:W.clientX,y:W.clientY})};return T.jsxs("div",{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?"selected":""} ${s?"cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated":"cursor-grab"}`,role:"button",tabIndex:0,"data-testid":"session-card","data-session-id":e.id,onClick:s?void 0:o,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&o()},onContextMenu:ee,onTouchStart:U,onTouchEnd:V,onTouchCancel:V,children:[T.jsxs("div",{className:"flex flex-col gap-0.5 pl-0.5",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(bc,{agentType:e.agentType,command:e.command,className:"h-3.5 w-3.5 shrink-0 text-muted"}),r?T.jsx("input",{ref:h,type:"text",value:g,onChange:W=>w(W.target.value),onBlur:P,onKeyDown:N,onClick:W=>W.stopPropagation(),className:"min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:d}),e.isPinned&&T.jsx(Il,{className:"h-3 w-3 shrink-0 text-primary","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),M&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:A,children:M}),L?T.jsx("span",{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${hv[e.status]} pulse-approval`,onAnimationEnd:R,children:T.jsx(bC,{className:"h-3 w-3","aria-label":"Needs input"})}):T.jsx("span",{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${hv[e.status]}${$?" pulse-complete":""}`,onAnimationEnd:R,children:v})]}),(D||B||H)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[B&&T.jsx(wR,{name:E}),D&&T.jsx(uw,{name:S,fullPath:e.projectPath}),H&&T.jsxs("span",{className:"line-clamp-2 text-xs italic text-muted",children:['"',e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+"…":e.lastUserMessage,'"']})]})]}),x&&T.jsxs("div",{ref:m,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:x.x,top:x.y},role:"menu",children:[c&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),c()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",children:[T.jsx(ny,{width:14,height:14}),"Rename"]}),_&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),_()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:"Create a copy in a new tmux window",children:[T.jsx(ry,{width:14,height:14}),"Duplicate"]}),y&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),y(!e.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Il,{width:14,height:14}),e.isPinned?"Unpin":"Pin"]}),e.logFilePath&&T.jsxs("button",{onClick:W=>{W.stopPropagation();const te=e.logFilePath;if(C(null),te){const Y=document.createElement("textarea");Y.value=te,Y.style.position="fixed",Y.style.left="-9999px",document.body.appendChild(Y),Y.focus(),Y.select();try{document.execCommand("copy")}catch{navigator.clipboard.writeText(te).catch(()=>{})}document.body.removeChild(Y)}},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.logFilePath,children:[T.jsx(sy,{width:14,height:14}),"Copy Log Path"]}),f&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"my-1 border-t border-border"}),T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),f()},className:"w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2",role:"menuitem",children:[T.jsx(Th,{width:14,height:14}),"Kill Session"]})]})]})]})}const rd={debug:0,info:1,warn:2,error:3};let fw="info";function HR(e){const t=e.toLowerCase();t in rd&&(fw=t)}function Qe(e,t,r="debug"){if(!(rd[r]<rd[fw]))try{fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:e,data:t,level:r})}).catch(()=>{})}catch{}}var pw={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(globalThis,()=>(()=>{var r={4567:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const u=o(9042),f=o(9924),_=o(844),y=o(4725),v=o(2585),h=o(3656);let m=s.AccessibilityManager=class extends _.Disposable{constructor(d,g,w,b){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=b,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 x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,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 f.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(x=>this._handleResize(x.rows))),this.register(this._terminal.onRender(x=>this._refreshRows(x.start,x.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(x=>this._handleChar(x))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
52
|
+
`},PL={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function IL(e){let{announcements:t=PL,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=AL}=e;const{announce:a,announcement:l}=RL(),s=oa("DndLiveRegion"),[o,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),DL(k.useMemo(()=>({onDragStart(u){let{active:f}=u;a(t.onDragStart({active:f}))},onDragMove(u){let{active:f,over:_}=u;t.onDragMove&&a(t.onDragMove({active:f,over:_}))},onDragOver(u){let{active:f,over:_}=u;a(t.onDragOver({active:f,over:_}))},onDragEnd(u){let{active:f,over:_}=u;a(t.onDragEnd({active:f,over:_}))},onDragCancel(u){let{active:f,over:_}=u;a(t.onDragCancel({active:f,over:_}))}}),[a,t])),!o)return null;const p=gt.createElement(gt.Fragment,null,gt.createElement(LL,{id:n,value:i.draggable}),gt.createElement(TL,{id:s,announcement:l}));return r?hn.createPortal(p,r):p}var xt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(xt||(xt={}));function Wl(){}function BL(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function OL(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return k.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const jr=Object.freeze({x:0,y:0});function NL(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function FL(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function $L(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function Zg(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const HL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=Zg(t,t.left,t.top),a=[];for(const l of n){const{id:s}=l,o=r.get(s);if(o){const c=NL(Zg(o),i);a.push({id:s,data:{droppableContainer:l,value:c}})}}return a.sort(jL)};function zL(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=i-n,s=a-r;if(n<i&&r<a){const o=t.width*t.height,c=e.width*e.height,p=l*s,u=p/(o+c-p);return Number(u.toFixed(4))}return 0}const UL=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const i=[];for(const a of n){const{id:l}=a,s=r.get(l);if(s){const o=zL(s,t);o>0&&i.push({id:l,data:{droppableContainer:a,value:o}})}}return i.sort(FL)};function WL(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function W1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:jr}function VL(e){return function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return i.reduce((l,s)=>({...l,top:l.top+e*s.y,bottom:l.bottom+e*s.y,left:l.left+e*s.x,right:l.right+e*s.x}),{...r})}}const KL=VL(1);function GL(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qL(e,t,r){const n=GL(t);if(!n)return e;const{scaleX:i,scaleY:a,x:l,y:s}=n,o=e.left-l-(1-i)*parseFloat(r),c=e.top-s-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),p=i?e.width/i:e.width,u=a?e.height/a:e.height;return{width:p,height:u,top:c,right:o+p,bottom:c+u,left:o}}const XL={ignoreTransform:!1};function Ti(e,t){t===void 0&&(t=XL);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:p}=lr(e).getComputedStyle(e);c&&(r=qL(r,c,p))}const{top:n,left:i,width:a,height:l,bottom:s,right:o}=r;return{top:n,left:i,width:a,height:l,bottom:s,right:o}}function ev(e){return Ti(e,{ignoreTransform:!0})}function YL(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function JL(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function QL(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const a=t[i];return typeof a=="string"?r.test(a):!1})}function Qf(e,t){const r=[];function n(i){if(t!=null&&r.length>=t||!i)return r;if(Xf(i)&&i.scrollingElement!=null&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!sa(i)||H1(i)||r.includes(i))return r;const a=lr(e).getComputedStyle(i);return i!==e&&QL(i,a)&&r.push(i),JL(i,a)?r:n(i.parentNode)}return e?n(e):r}function V1(e){const[t]=Qf(e,1);return t??null}function gu(e){return!wc||!e?null:ki(e)?e:qf(e)?Xf(e)||e===Li(e).scrollingElement?window:sa(e)?e:null:null}function K1(e){return ki(e)?e.scrollX:e.scrollLeft}function G1(e){return ki(e)?e.scrollY:e.scrollTop}function Zh(e){return{x:K1(e),y:G1(e)}}var Tt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Tt||(Tt={}));function q1(e){return!wc||!e?!1:e===document.scrollingElement}function X1(e){const t={x:0,y:0},r=q1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,l=e.scrollTop>=n.y,s=e.scrollLeft>=n.x;return{isTop:i,isLeft:a,isBottom:l,isRight:s,maxScroll:n,minScroll:t}}const ZL={x:.2,y:.2};function eT(e,t,r,n,i){let{top:a,left:l,right:s,bottom:o}=r;n===void 0&&(n=10),i===void 0&&(i=ZL);const{isTop:c,isBottom:p,isLeft:u,isRight:f}=X1(e),_={x:0,y:0},y={x:0,y:0},v={height:t.height*i.y,width:t.width*i.x};return!c&&a<=t.top+v.height?(_.y=Tt.Backward,y.y=n*Math.abs((t.top+v.height-a)/v.height)):!p&&o>=t.bottom-v.height&&(_.y=Tt.Forward,y.y=n*Math.abs((t.bottom-v.height-o)/v.height)),!f&&s>=t.right-v.width?(_.x=Tt.Forward,y.x=n*Math.abs((t.right-v.width-s)/v.width)):!u&&l<=t.left+v.width&&(_.x=Tt.Backward,y.x=n*Math.abs((t.left+v.width-l)/v.width)),{direction:_,speed:y}}function tT(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:l}=window;return{top:0,left:0,right:a,bottom:l,width:a,height:l}}const{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Y1(e){return e.reduce((t,r)=>ai(t,Zh(r)),jr)}function rT(e){return e.reduce((t,r)=>t+K1(r),0)}function nT(e){return e.reduce((t,r)=>t+G1(r),0)}function sT(e,t){if(t===void 0&&(t=Ti),!e)return;const{top:r,left:n,bottom:i,right:a}=t(e);V1(e)&&(i<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const iT=[["x",["left","right"],rT],["y",["top","bottom"],nT]];class Zf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Qf(r),i=Y1(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,l,s]of iT)for(const o of l)Object.defineProperty(this,o,{get:()=>{const c=s(n),p=i[a]-c;return this.rect[o]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fo{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var i;(i=this.target)==null||i.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function oT(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Li(e)}function vu(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var vr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(vr||(vr={}));function tv(e){e.preventDefault()}function aT(e){e.stopPropagation()}var Ye;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ye||(Ye={}));const J1={start:[Ye.Space,Ye.Enter],cancel:[Ye.Esc],end:[Ye.Space,Ye.Enter,Ye.Tab]},lT=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ye.Right:return{...r,x:r.x+25};case Ye.Left:return{...r,x:r.x-25};case Ye.Down:return{...r,y:r.y+25};case Ye.Up:return{...r,y:r.y-25}}};class Q1{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new fo(Li(r)),this.windowListeners=new fo(lr(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(vr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&sT(n),r(jr)}handleKeyDown(t){if(Jf(t)){const{active:r,context:n,options:i}=this.props,{keyboardCodes:a=J1,coordinateGetter:l=lT,scrollBehavior:s="smooth"}=i,{code:o}=t;if(a.end.includes(o)){this.handleEnd(t);return}if(a.cancel.includes(o)){this.handleCancel(t);return}const{collisionRect:c}=n.current,p=c?{x:c.left,y:c.top}:jr;this.referenceCoordinates||(this.referenceCoordinates=p);const u=l(t,{active:r,context:n.current,currentCoordinates:p});if(u){const f=Ul(u,p),_={x:0,y:0},{scrollableAncestors:y}=n.current;for(const v of y){const h=t.code,{isTop:m,isRight:d,isLeft:g,isBottom:w,maxScroll:b,minScroll:x}=X1(v),C=tT(v),S={x:Math.min(h===Ye.Right?C.right-C.width/2:C.right,Math.max(h===Ye.Right?C.left:C.left+C.width/2,u.x)),y:Math.min(h===Ye.Down?C.bottom-C.height/2:C.bottom,Math.max(h===Ye.Down?C.top:C.top+C.height/2,u.y))},E=h===Ye.Right&&!d||h===Ye.Left&&!g,L=h===Ye.Down&&!w||h===Ye.Up&&!m;if(E&&S.x!==u.x){const A=v.scrollLeft+f.x,M=h===Ye.Right&&A<=b.x||h===Ye.Left&&A>=x.x;if(M&&!f.y){v.scrollTo({left:A,behavior:s});return}M?_.x=v.scrollLeft-A:_.x=h===Ye.Right?v.scrollLeft-b.x:v.scrollLeft-x.x,_.x&&v.scrollBy({left:-_.x,behavior:s});break}else if(L&&S.y!==u.y){const A=v.scrollTop+f.y,M=h===Ye.Down&&A<=b.y||h===Ye.Up&&A>=x.y;if(M&&!f.x){v.scrollTo({top:A,behavior:s});return}M?_.y=v.scrollTop-A:_.y=h===Ye.Down?v.scrollTop-b.y:v.scrollTop-x.y,_.y&&v.scrollBy({top:-_.y,behavior:s});break}}this.handleMove(t,ai(Ul(u,this.referenceCoordinates),_))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Q1.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=J1,onActivation:i}=t,{active:a}=r;const{code:l}=e.nativeEvent;if(n.start.includes(l)){const s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function rv(e){return!!(e&&"distance"in e)}function nv(e){return!!(e&&"delay"in e)}class ep{constructor(t,r,n){var i;n===void 0&&(n=oT(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:l}=a;this.props=t,this.events=r,this.document=Li(l),this.documentListeners=new fo(this.document),this.listeners=new fo(n),this.windowListeners=new fo(lr(l)),this.initialCoordinates=(i=Qh(a))!=null?i:jr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(vr.Resize,this.handleCancel),this.windowListeners.add(vr.DragStart,tv),this.windowListeners.add(vr.VisibilityChange,this.handleCancel),this.windowListeners.add(vr.ContextMenu,tv),this.documentListeners.add(vr.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nv(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(rv(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:i}=this.props;i(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(vr.Click,aT,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(vr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:i,props:a}=this,{onMove:l,options:{activationConstraint:s}}=a;if(!i)return;const o=(r=Qh(t))!=null?r:jr,c=Ul(i,o);if(!n&&s){if(rv(s)){if(s.tolerance!=null&&vu(c,s.tolerance))return this.handleCancel();if(vu(c,s.distance))return this.handleStart()}if(nv(s)&&vu(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}t.cancelable&&t.preventDefault(),l(o)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ye.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const cT={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tp extends ep{constructor(t){const{event:r}=t,n=Li(r.target);super(t,cT,n)}}tp.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const uT={move:{name:"mousemove"},end:{name:"mouseup"}};var ed;(function(e){e[e.RightClick=2]="RightClick"})(ed||(ed={}));class hT extends ep{constructor(t){super(t,uT,Li(t.event.target))}}hT.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===ed.RightClick?!1:(n==null||n({event:r}),!0)}}];const _u={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dT extends ep{constructor(t){super(t,_u)}static setup(){return window.addEventListener(_u.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(_u.move.name,t)};function t(){}}}dT.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:i}=r;return i.length>1?!1:(n==null||n({event:r}),!0)}}];var po;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(po||(po={}));var Vl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Vl||(Vl={}));function fT(e){let{acceleration:t,activator:r=po.Pointer,canScroll:n,draggingRect:i,enabled:a,interval:l=5,order:s=Vl.TreeOrder,pointerCoordinates:o,scrollableAncestors:c,scrollableAncestorRects:p,delta:u,threshold:f}=e;const _=mT({delta:u,disabled:!a}),[y,v]=xL(),h=k.useRef({x:0,y:0}),m=k.useRef({x:0,y:0}),d=k.useMemo(()=>{switch(r){case po.Pointer:return o?{top:o.y,bottom:o.y,left:o.x,right:o.x}:null;case po.DraggableRect:return i}},[r,i,o]),g=k.useRef(null),w=k.useCallback(()=>{const x=g.current;if(!x)return;const C=h.current.x*m.current.x,S=h.current.y*m.current.y;x.scrollBy(C,S)},[]),b=k.useMemo(()=>s===Vl.TreeOrder?[...c].reverse():c,[s,c]);k.useEffect(()=>{if(!a||!c.length||!d){v();return}for(const x of b){if((n==null?void 0:n(x))===!1)continue;const C=c.indexOf(x),S=p[C];if(!S)continue;const{direction:E,speed:L}=eT(x,S,d,t,f);for(const A of["x","y"])_[A][E[A]]||(L[A]=0,E[A]=0);if(L.x>0||L.y>0){v(),g.current=x,y(w,l),h.current=L,m.current=E;return}}h.current={x:0,y:0},m.current={x:0,y:0},v()},[t,w,n,v,a,l,JSON.stringify(d),JSON.stringify(_),y,c,b,p,JSON.stringify(f)])}const pT={x:{[Tt.Backward]:!1,[Tt.Forward]:!1},y:{[Tt.Backward]:!1,[Tt.Forward]:!1}};function mT(e){let{delta:t,disabled:r}=e;const n=Jh(t);return ia(i=>{if(r||!n||!i)return pT;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[Tt.Backward]:i.x[Tt.Backward]||a.x===-1,[Tt.Forward]:i.x[Tt.Forward]||a.x===1},y:{[Tt.Backward]:i.y[Tt.Backward]||a.y===-1,[Tt.Forward]:i.y[Tt.Forward]||a.y===1}}},[r,t,n])}function gT(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ia(i=>{var a;return t==null?null:(a=n??i)!=null?a:null},[n,t])}function vT(e,t){return k.useMemo(()=>e.reduce((r,n)=>{const{sensor:i}=n,a=i.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,n)}));return[...r,...a]},[]),[e,t])}var zo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zo||(zo={}));var td;(function(e){e.Optimized="optimized"})(td||(td={}));const sv=new Map;function _T(e,t){let{dragging:r,dependencies:n,config:i}=t;const[a,l]=k.useState(null),{frequency:s,measure:o,strategy:c}=i,p=k.useRef(e),u=h(),f=$o(u),_=k.useCallback(function(m){m===void 0&&(m=[]),!f.current&&l(d=>d===null?m:d.concat(m.filter(g=>!d.includes(g))))},[f]),y=k.useRef(null),v=ia(m=>{if(u&&!r)return sv;if(!m||m===sv||p.current!==e||a!=null){const d=new Map;for(let g of e){if(!g)continue;if(a&&a.length>0&&!a.includes(g.id)&&g.rect.current){d.set(g.id,g.rect.current);continue}const w=g.node.current,b=w?new Zf(o(w),w):null;g.rect.current=b,b&&d.set(g.id,b)}return d}return m},[e,a,r,u,o]);return k.useEffect(()=>{p.current=e},[e]),k.useEffect(()=>{u||_()},[r,u]),k.useEffect(()=>{a&&a.length>0&&l(null)},[JSON.stringify(a)]),k.useEffect(()=>{u||typeof s!="number"||y.current!==null||(y.current=setTimeout(()=>{_(),y.current=null},s))},[s,u,_,...n]),{droppableRects:v,measureDroppableContainers:_,measuringScheduled:a!=null};function h(){switch(c){case zo.Always:return!1;case zo.BeforeDragging:return r;default:return!r}}}function Z1(e,t){return ia(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function yT(e,t){return Z1(e,t)}function wT(e){let{callback:t,disabled:r}=e;const n=Yf(t),i=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Sc(e){let{callback:t,disabled:r}=e;const n=Yf(t),i=k.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return k.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function ST(e){return new Zf(Ti(e),e)}function iv(e,t,r){t===void 0&&(t=ST);const[n,i]=k.useState(null);function a(){i(o=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=o??r)!=null?c:null}const p=t(e);return JSON.stringify(o)===JSON.stringify(p)?o:p})}const l=wT({callback(o){if(e)for(const c of o){const{type:p,target:u}=c;if(p==="childList"&&u instanceof HTMLElement&&u.contains(e)){a();break}}}}),s=Sc({callback:a});return Gr(()=>{a(),e?(s==null||s.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),l==null||l.disconnect())},[e]),n}function xT(e){const t=Z1(e);return W1(e,t)}const ov=[];function bT(e){const t=k.useRef(e),r=ia(n=>e?n&&n!==ov&&e&&t.current&&e.parentNode===t.current.parentNode?n:Qf(e):ov,[e]);return k.useEffect(()=>{t.current=e},[e]),r}function CT(e){const[t,r]=k.useState(null),n=k.useRef(e),i=k.useCallback(a=>{const l=gu(a.target);l&&r(s=>s?(s.set(l,Zh(l)),new Map(s)):null)},[]);return k.useEffect(()=>{const a=n.current;if(e!==a){l(a);const s=e.map(o=>{const c=gu(o);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Zh(c)]):null}).filter(o=>o!=null);r(s.length?new Map(s):null),n.current=e}return()=>{l(e),l(a)};function l(s){s.forEach(o=>{const c=gu(o);c==null||c.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,l)=>ai(a,l),jr):Y1(e):jr,[e,t])}function av(e,t){t===void 0&&(t=[]);const r=k.useRef(null);return k.useEffect(()=>{r.current=null},t),k.useEffect(()=>{const n=e!==jr;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Ul(e,r.current):jr}function ET(e){k.useEffect(()=>{if(!wc)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function kT(e,t){return k.useMemo(()=>e.reduce((r,n)=>{let{eventName:i,handler:a}=n;return r[i]=l=>{a(l,t)},r},{}),[e,t])}function ew(e){return k.useMemo(()=>e?YL(e):null,[e])}const lv=[];function LT(e,t){t===void 0&&(t=Ti);const[r]=e,n=ew(r?lr(r):null),[i,a]=k.useState(lv);function l(){a(()=>e.length?e.map(o=>q1(o)?n:new Zf(t(o),o)):lv)}const s=Sc({callback:l});return Gr(()=>{s==null||s.disconnect(),l(),e.forEach(o=>s==null?void 0:s.observe(o))},[e]),i}function TT(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return sa(t)?t:e}function RT(e){let{measure:t}=e;const[r,n]=k.useState(null),i=k.useCallback(c=>{for(const{target:p}of c)if(sa(p)){n(u=>{const f=t(p);return u?{...u,width:f.width,height:f.height}:f});break}},[t]),a=Sc({callback:i}),l=k.useCallback(c=>{const p=TT(c);a==null||a.disconnect(),p&&(a==null||a.observe(p)),n(p?t(p):null)},[t,a]),[s,o]=zl(l);return k.useMemo(()=>({nodeRef:s,rect:r,setRef:o}),[r,s,o])}const DT=[{sensor:tp,options:{}},{sensor:Q1,options:{}}],MT={current:{}},il={draggable:{measure:ev},droppable:{measure:ev,strategy:zo.WhileDragging,frequency:td.Optimized},dragOverlay:{measure:Ti}};class mo extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const AT={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Wl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:il,measureDroppableContainers:Wl,windowRect:null,measuringScheduled:!1},PT={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Wl,draggableNodes:new Map,over:null,measureDroppableContainers:Wl},xc=k.createContext(PT),tw=k.createContext(AT);function IT(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mo}}}function BT(e,t){switch(t.type){case xt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case xt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case xt.DragEnd:case xt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xt.RegisterDroppable:{const{element:r}=t,{id:n}=r,i=new mo(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case xt.SetDroppableDisabled:{const{id:r,key:n,disabled:i}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const l=new mo(e.droppable.containers);return l.set(r,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:l}}}case xt.UnregisterDroppable:{const{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const a=new mo(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function OT(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:i}=k.useContext(xc),a=Jh(n),l=Jh(r==null?void 0:r.id);return k.useEffect(()=>{if(!t&&!n&&a&&l!=null){if(!Jf(a)||document.activeElement===a.target)return;const s=i.get(l);if(!s)return;const{activatorNode:o,node:c}=s;if(!o.current&&!c.current)return;requestAnimationFrame(()=>{for(const p of[o.current,c.current]){if(!p)continue;const u=EL(p);if(u){u.focus();break}}})}},[n,t,i,l,a]),null}function NT(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((i,a)=>a({transform:i,...n}),r):r}function jT(e){return k.useMemo(()=>({draggable:{...il.draggable,...e==null?void 0:e.draggable},droppable:{...il.droppable,...e==null?void 0:e.droppable},dragOverlay:{...il.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function FT(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e;const a=k.useRef(!1),{x:l,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Gr(()=>{if(!l&&!s||!t){a.current=!1;return}if(a.current||!n)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const p=r(c),u=W1(p,n);if(l||(u.x=0),s||(u.y=0),a.current=!0,Math.abs(u.x)>0||Math.abs(u.y)>0){const f=V1(c);f&&f.scrollBy({top:u.y,left:u.x})}},[t,l,s,n,r])}const rw=k.createContext({...jr,scaleX:1,scaleY:1});var Rn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Rn||(Rn={}));const $T=k.memo(function(t){var r,n,i,a;let{id:l,accessibility:s,autoScroll:o=!0,children:c,sensors:p=DT,collisionDetection:u=UL,measuring:f,modifiers:_,...y}=t;const v=k.useReducer(BT,void 0,IT),[h,m]=v,[d,g]=ML(),[w,b]=k.useState(Rn.Uninitialized),x=w===Rn.Initialized,{draggable:{active:C,nodes:S,translate:E},droppable:{containers:L}}=h,A=C!=null?S.get(C):null,M=k.useRef({initial:null,translated:null}),D=k.useMemo(()=>{var fe;return C!=null?{id:C,data:(fe=A==null?void 0:A.data)!=null?fe:MT,rect:M}:null},[C,A]),B=k.useRef(null),[H,F]=k.useState(null),[$,I]=k.useState(null),R=$o(y,Object.values(y)),P=oa("DndDescribedBy",l),N=k.useMemo(()=>L.getEnabled(),[L]),j=jT(f),{droppableRects:U,measureDroppableContainers:V,measuringScheduled:ee}=_T(N,{dragging:x,dependencies:[E.x,E.y],config:j.droppable}),Q=gT(S,C),z=k.useMemo(()=>$?Qh($):null,[$]),O=de(),K=yT(Q,j.draggable.measure);FT({activeNode:C!=null?S.get(C):null,config:O.layoutShiftCompensation,initialRect:K,measure:j.draggable.measure});const W=iv(Q,j.draggable.measure,K),te=iv(Q?Q.parentElement:null),J=k.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_e=L.getNodeFor((r=J.current.over)==null?void 0:r.id),ue=RT({measure:j.dragOverlay.measure}),se=(n=ue.nodeRef.current)!=null?n:Q,re=x?(i=ue.rect)!=null?i:W:null,ae=!!(ue.nodeRef.current&&ue.rect),ye=xT(ae?null:W),ve=ew(se?lr(se):null),ne=bT(x?_e??Q:null),ie=LT(ne),he=NT(_,{transform:{x:E.x-ye.x,y:E.y-ye.y,scaleX:1,scaleY:1},activatorEvent:$,active:D,activeNodeRect:W,containerNodeRect:te,draggingNodeRect:re,over:J.current.over,overlayNodeRect:ue.rect,scrollableAncestors:ne,scrollableAncestorRects:ie,windowRect:ve}),oe=z?ai(z,E):null,me=CT(ne),xe=av(me),ke=av(me,[W]),Ne=ai(he,xe),Ke=re?KL(re,he):null,Ae=D&&Ke?u({active:D,collisionRect:Ke,droppableRects:U,droppableContainers:N,pointerCoordinates:oe}):null,Pe=$L(Ae,"id"),[G,Y]=k.useState(null),Oe=ae?he:ai(he,ke),$e=WL(Oe,(a=G==null?void 0:G.rect)!=null?a:null,W),X=k.useRef(null),le=k.useCallback((fe,Ee)=>{let{sensor:Re,options:je}=Ee;if(B.current==null)return;const Me=S.get(B.current);if(!Me)return;const Ie=fe.nativeEvent,Ve=new Re({active:B.current,activeNode:Me,event:Ie,options:je,context:J,onAbort(He){if(!S.get(He))return;const{onDragAbort:De}=R.current,ze={id:He};De==null||De(ze),d({type:"onDragAbort",event:ze})},onPending(He,Te,De,ze){if(!S.get(He))return;const{onDragPending:Ht}=R.current,_t={id:He,constraint:Te,initialCoordinates:De,offset:ze};Ht==null||Ht(_t),d({type:"onDragPending",event:_t})},onStart(He){const Te=B.current;if(Te==null)return;const De=S.get(Te);if(!De)return;const{onDragStart:ze}=R.current,Xe={activatorEvent:Ie,active:{id:Te,data:De.data,rect:M}};hn.unstable_batchedUpdates(()=>{ze==null||ze(Xe),b(Rn.Initializing),m({type:xt.DragStart,initialCoordinates:He,active:Te}),d({type:"onDragStart",event:Xe}),F(X.current),I(Ie)})},onMove(He){m({type:xt.DragMove,coordinates:He})},onEnd:ot(xt.DragEnd),onCancel:ot(xt.DragCancel)});X.current=Ve;function ot(He){return async function(){const{active:De,collisions:ze,over:Xe,scrollAdjustedTranslate:Ht}=J.current;let _t=null;if(De&&Ht){const{cancelDrop:zt}=R.current;_t={activatorEvent:Ie,active:De,collisions:ze,delta:Ht,over:Xe},He===xt.DragEnd&&typeof zt=="function"&&await Promise.resolve(zt(_t))&&(He=xt.DragCancel)}B.current=null,hn.unstable_batchedUpdates(()=>{m({type:He}),b(Rn.Uninitialized),Y(null),F(null),I(null),X.current=null;const zt=He===xt.DragEnd?"onDragEnd":"onDragCancel";if(_t){const It=R.current[zt];It==null||It(_t),d({type:zt,event:_t})}})}}},[S]),ge=k.useCallback((fe,Ee)=>(Re,je)=>{const Me=Re.nativeEvent,Ie=S.get(je);if(B.current!==null||!Ie||Me.dndKit||Me.defaultPrevented)return;const Ve={active:Ie};fe(Re,Ee.options,Ve)===!0&&(Me.dndKit={capturedBy:Ee.sensor},B.current=je,le(Re,Ee))},[S,le]),We=vT(p,ge);ET(p),Gr(()=>{W&&w===Rn.Initializing&&b(Rn.Initialized)},[W,w]),k.useEffect(()=>{const{onDragMove:fe}=R.current,{active:Ee,activatorEvent:Re,collisions:je,over:Me}=J.current;if(!Ee||!Re)return;const Ie={active:Ee,activatorEvent:Re,collisions:je,delta:{x:Ne.x,y:Ne.y},over:Me};hn.unstable_batchedUpdates(()=>{fe==null||fe(Ie),d({type:"onDragMove",event:Ie})})},[Ne.x,Ne.y]),k.useEffect(()=>{const{active:fe,activatorEvent:Ee,collisions:Re,droppableContainers:je,scrollAdjustedTranslate:Me}=J.current;if(!fe||B.current==null||!Ee||!Me)return;const{onDragOver:Ie}=R.current,Ve=je.get(Pe),ot=Ve&&Ve.rect.current?{id:Ve.id,rect:Ve.rect.current,data:Ve.data,disabled:Ve.disabled}:null,He={active:fe,activatorEvent:Ee,collisions:Re,delta:{x:Me.x,y:Me.y},over:ot};hn.unstable_batchedUpdates(()=>{Y(ot),Ie==null||Ie(He),d({type:"onDragOver",event:He})})},[Pe]),Gr(()=>{J.current={activatorEvent:$,active:D,activeNode:Q,collisionRect:Ke,collisions:Ae,droppableRects:U,draggableNodes:S,draggingNode:se,draggingNodeRect:re,droppableContainers:L,over:G,scrollableAncestors:ne,scrollAdjustedTranslate:Ne},M.current={initial:re,translated:Ke}},[D,Q,Ae,Ke,S,se,re,U,L,G,ne,Ne]),fT({...O,delta:E,draggingRect:Ke,pointerCoordinates:oe,scrollableAncestors:ne,scrollableAncestorRects:ie});const Z=k.useMemo(()=>({active:D,activeNode:Q,activeNodeRect:W,activatorEvent:$,collisions:Ae,containerNodeRect:te,dragOverlay:ue,draggableNodes:S,droppableContainers:L,droppableRects:U,over:G,measureDroppableContainers:V,scrollableAncestors:ne,scrollableAncestorRects:ie,measuringConfiguration:j,measuringScheduled:ee,windowRect:ve}),[D,Q,W,$,Ae,te,ue,S,L,U,G,V,ne,ie,j,ee,ve]),Le=k.useMemo(()=>({activatorEvent:$,activators:We,active:D,activeNodeRect:W,ariaDescribedById:{draggable:P},dispatch:m,draggableNodes:S,over:G,measureDroppableContainers:V}),[$,We,D,W,m,P,S,G,V]);return gt.createElement(U1.Provider,{value:g},gt.createElement(xc.Provider,{value:Le},gt.createElement(tw.Provider,{value:Z},gt.createElement(rw.Provider,{value:$e},c)),gt.createElement(OT,{disabled:(s==null?void 0:s.restoreFocus)===!1})),gt.createElement(IL,{...s,hiddenTextDescribedById:P}));function de(){const fe=(H==null?void 0:H.autoScrollEnabled)===!1,Ee=typeof o=="object"?o.enabled===!1:o===!1,Re=x&&!fe&&!Ee;return typeof o=="object"?{...o,enabled:Re}:{enabled:Re}}}),HT=k.createContext(null),cv="button",zT="Draggable";function UT(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e;const a=oa(zT),{activators:l,activatorEvent:s,active:o,activeNodeRect:c,ariaDescribedById:p,draggableNodes:u,over:f}=k.useContext(xc),{role:_=cv,roleDescription:y="draggable",tabIndex:v=0}=i??{},h=(o==null?void 0:o.id)===t,m=k.useContext(h?rw:HT),[d,g]=zl(),[w,b]=zl(),x=kT(l,t),C=$o(r);Gr(()=>(u.set(t,{id:t,key:a,node:d,activatorNode:w,data:C}),()=>{const E=u.get(t);E&&E.key===a&&u.delete(t)}),[u,t]);const S=k.useMemo(()=>({role:_,tabIndex:v,"aria-disabled":n,"aria-pressed":h&&_===cv?!0:void 0,"aria-roledescription":y,"aria-describedby":p.draggable}),[n,_,v,h,y,p.draggable]);return{active:o,activatorEvent:s,activeNodeRect:c,attributes:S,isDragging:h,listeners:n?void 0:x,node:d,over:f,setNodeRef:g,setActivatorNodeRef:b,transform:m}}function WT(){return k.useContext(tw)}const VT="Droppable",KT={timeout:25};function GT(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e;const a=oa(VT),{active:l,dispatch:s,over:o,measureDroppableContainers:c}=k.useContext(xc),p=k.useRef({disabled:r}),u=k.useRef(!1),f=k.useRef(null),_=k.useRef(null),{disabled:y,updateMeasurementsFor:v,timeout:h}={...KT,...i},m=$o(v??n),d=k.useCallback(()=>{if(!u.current){u.current=!0;return}_.current!=null&&clearTimeout(_.current),_.current=setTimeout(()=>{c(Array.isArray(m.current)?m.current:[m.current]),_.current=null},h)},[h]),g=Sc({callback:d,disabled:y||!l}),w=k.useCallback((S,E)=>{g&&(E&&(g.unobserve(E),u.current=!1),S&&g.observe(S))},[g]),[b,x]=zl(w),C=$o(t);return k.useEffect(()=>{!g||!b.current||(g.disconnect(),u.current=!1,g.observe(b.current))},[b,g]),k.useEffect(()=>(s({type:xt.RegisterDroppable,element:{id:n,key:a,disabled:r,node:b,rect:f,data:C}}),()=>s({type:xt.UnregisterDroppable,key:a,id:n})),[n]),k.useEffect(()=>{r!==p.current.disabled&&(s({type:xt.SetDroppableDisabled,id:n,key:a,disabled:r}),p.current.disabled=r)},[n,a,r,s]),{active:l,rect:f,isOver:(o==null?void 0:o.id)===n,node:b,over:o,setNodeRef:x}}function nw(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function qT(e,t){return e.reduce((r,n,i)=>{const a=t.get(n);return a&&(r[i]=a),r},Array(e.length))}function Ma(e){return e!==null&&e>=0}function XT(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function YT(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const sw=e=>{let{rects:t,activeIndex:r,overIndex:n,index:i}=e;const a=nw(t,n,r),l=t[i],s=a[i];return!s||!l?null:{x:s.left-l.left,y:s.top-l.top,scaleX:s.width/l.width,scaleY:s.height/l.height}},Aa={scaleX:1,scaleY:1},JT=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:i,rects:a,overIndex:l}=e;const s=(t=a[r])!=null?t:n;if(!s)return null;if(i===r){const c=a[l];return c?{x:0,y:r<l?c.top+c.height-(s.top+s.height):c.top-s.top,...Aa}:null}const o=QT(a,i,r);return i>r&&i<=l?{x:0,y:-s.height-o,...Aa}:i<r&&i>=l?{x:0,y:s.height+o,...Aa}:{x:0,y:0,...Aa}};function QT(e,t,r){const n=e[t],i=e[t-1],a=e[t+1];return n?r<t?i?n.top-(i.top+i.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}const iw="Sortable",ow=gt.createContext({activeIndex:-1,containerId:iw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:sw,disabled:{draggable:!1,droppable:!1}});function ZT(e){let{children:t,id:r,items:n,strategy:i=sw,disabled:a=!1}=e;const{active:l,dragOverlay:s,droppableRects:o,over:c,measureDroppableContainers:p}=WT(),u=oa(iw,r),f=s.rect!==null,_=k.useMemo(()=>n.map(x=>typeof x=="object"&&"id"in x?x.id:x),[n]),y=l!=null,v=l?_.indexOf(l.id):-1,h=c?_.indexOf(c.id):-1,m=k.useRef(_),d=!XT(_,m.current),g=h!==-1&&v===-1||d,w=YT(a);Gr(()=>{d&&y&&p(_)},[d,_,y,p]),k.useEffect(()=>{m.current=_},[_]);const b=k.useMemo(()=>({activeIndex:v,containerId:u,disabled:w,disableTransforms:g,items:_,overIndex:h,useDragOverlay:f,sortedRects:qT(_,o),strategy:i}),[v,u,w.draggable,w.droppable,g,_,h,o,f,i]);return gt.createElement(ow.Provider,{value:b},t)}const eR=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return nw(r,n,i).indexOf(t)},tR=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:a,newIndex:l,previousItems:s,previousContainerId:o,transition:c}=e;return!c||!n||s!==a&&i===l?!1:r?!0:l!==i&&t===o},rR={duration:200,easing:"ease"},aw="transform",nR=Ho.Transition.toString({property:aw,duration:0,easing:"linear"}),sR={roleDescription:"sortable"};function iR(e){let{disabled:t,index:r,node:n,rect:i}=e;const[a,l]=k.useState(null),s=k.useRef(r);return Gr(()=>{if(!t&&r!==s.current&&n.current){const o=i.current;if(o){const c=Ti(n.current,{ignoreTransform:!0}),p={x:o.left-c.left,y:o.top-c.top,scaleX:o.width/c.width,scaleY:o.height/c.height};(p.x||p.y)&&l(p)}}r!==s.current&&(s.current=r)},[t,r,n,i]),k.useEffect(()=>{a&&l(null)},[a]),a}function oR(e){let{animateLayoutChanges:t=tR,attributes:r,disabled:n,data:i,getNewIndex:a=eR,id:l,strategy:s,resizeObserverConfig:o,transition:c=rR}=e;const{items:p,containerId:u,activeIndex:f,disabled:_,disableTransforms:y,sortedRects:v,overIndex:h,useDragOverlay:m,strategy:d}=k.useContext(ow),g=aR(n,_),w=p.indexOf(l),b=k.useMemo(()=>({sortable:{containerId:u,index:w,items:p},...i}),[u,i,w,p]),x=k.useMemo(()=>p.slice(p.indexOf(l)),[p,l]),{rect:C,node:S,isOver:E,setNodeRef:L}=GT({id:l,data:b,disabled:g.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...o}}),{active:A,activatorEvent:M,activeNodeRect:D,attributes:B,setNodeRef:H,listeners:F,isDragging:$,over:I,setActivatorNodeRef:R,transform:P}=UT({id:l,data:b,attributes:{...sR,...r},disabled:g.draggable}),N=SL(L,H),j=!!A,U=j&&!y&&Ma(f)&&Ma(h),V=!m&&$,ee=V&&U?P:null,z=U?ee??(s??d)({rects:v,activeNodeRect:D,activeIndex:f,overIndex:h,index:w}):null,O=Ma(f)&&Ma(h)?a({id:l,items:p,activeIndex:f,overIndex:h}):w,K=A==null?void 0:A.id,W=k.useRef({activeId:K,items:p,newIndex:O,containerId:u}),te=p!==W.current.items,J=t({active:A,containerId:u,isDragging:$,isSorting:j,id:l,index:w,items:p,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:c,wasDragging:W.current.activeId!=null}),_e=iR({disabled:!J,index:w,node:S,rect:C});return k.useEffect(()=>{j&&W.current.newIndex!==O&&(W.current.newIndex=O),u!==W.current.containerId&&(W.current.containerId=u),p!==W.current.items&&(W.current.items=p)},[j,O,u,p]),k.useEffect(()=>{if(K===W.current.activeId)return;if(K!=null&&W.current.activeId==null){W.current.activeId=K;return}const se=setTimeout(()=>{W.current.activeId=K},50);return()=>clearTimeout(se)},[K]),{active:A,activeIndex:f,attributes:B,data:b,rect:C,index:w,newIndex:O,items:p,isOver:E,isSorting:j,isDragging:$,listeners:F,node:S,overIndex:h,over:I,setNodeRef:N,setActivatorNodeRef:R,setDroppableNodeRef:L,setDraggableNodeRef:H,transform:_e??z,transition:ue()};function ue(){if(_e||te&&W.current.newIndex===w)return nR;if(!(V&&!Jf(M)||!c)&&(j||J))return Ho.Transition.toString({...c,property:aw})}}function aR(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}Ye.Down,Ye.Right,Ye.Up,Ye.Left;const Pa={permission:0,waiting:1,working:2,unknown:3};function go(e){var r;const t=(r=e.agentSessionId)==null?void 0:r.trim();return t&&t.length>0?t:e.id}const lR={mode:"created",direction:"desc"};function rp(e,t=lR){const{mode:r,direction:n,manualOrder:i}=t;if(r==="manual"&&i&&i.length>0){const a=new Map(i.map((l,s)=>[l,s]));return e.toSorted((l,s)=>{const o=go(l),c=go(s),p=a.get(o)??a.get(l.id)??1/0,u=a.get(c)??a.get(s.id)??1/0;return p===1/0&&u===1/0?Date.parse(s.createdAt)-Date.parse(l.createdAt):p-u})}return e.toSorted((a,l)=>{if(r==="status"){const c=Pa[a.status]??Pa.unknown,p=Pa[l.status]??Pa.unknown;return c!==p?c-p:Date.parse(l.lastActivity)-Date.parse(a.lastActivity)}const s=Date.parse(a.createdAt),o=Date.parse(l.createdAt);return n==="desc"?o-s:s-o})}function cR(e,t){var n,i;const r=new Map;for(const a of e){const l=(n=a.projectPath)==null?void 0:n.trim();if(l){const s=Date.parse(a.lastActivity)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}for(const a of t){const l=(i=a.projectPath)==null?void 0:i.trim();if(l){const s=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}return Array.from(r.keys()).toSorted((a,l)=>{const s=r.get(a)||0;return(r.get(l)||0)-s})}function uR(e,t){var n,i;const r=new Map;for(const a of e){const l=(n=a.host)==null?void 0:n.trim();if(l){const s=Date.parse(a.lastActivity)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}for(const a of t){const l=(i=a.host)==null?void 0:i.trim();if(l){const s=Date.parse(a.lastActivityAt)||0,o=r.get(l)||0;s>o&&r.set(l,s)}}return Array.from(r.keys()).toSorted((a,l)=>{const s=r.get(a)||0;return(r.get(l)||0)-s})}function np(e){const t=Date.parse(e);if(Number.isNaN(t))return"";const r=Date.now()-t,n=Math.floor(r/6e4);if(n<1)return"now";if(n<60)return`${n}m`;const i=Math.floor(n/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function _s(e){const t=e.trim();if(!t)return null;const r=t.replace(/[\\/]+$/,"");if(!r)return null;const n=r.split(/[\\/]/);return n[n.length-1]||null}function hR(e){const t=e.map(s=>{const o=s.trim(),c=o.replace(/[\\/]+$/,""),p=c.split(/[\\/]/).filter(Boolean);return{path:s,parts:p,fallback:c||o||s}}),r=new Map;for(const s of t)r.set(s.path,1);let n=!0;for(;n;){n=!1;const s=new Map;for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,p=o.parts.slice(-c).join("/");s.set(p,(s.get(p)??0)+1)}for(const o of t){if(o.parts.length===0)continue;const c=r.get(o.path)??1,p=o.parts.slice(-c).join("/");(s.get(p)??0)>1&&c<o.parts.length&&(r.set(o.path,c+1),n=!0)}}const i=new Map,a=new Map;for(const s of t){let o=s.fallback;if(s.parts.length>0){const c=r.get(s.path)??1;o=s.parts.slice(-c).join("/")}i.set(s.path,o),a.set(o,(a.get(o)??0)+1)}const l=new Map;for(const s of t){let o=i.get(s.path)??s.fallback;(a.get(o)??0)>1&&(o=s.fallback),l.set(s.path,o)}return l}function lw(e){const t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}const Ge=uf()(hf((e,t)=>({sessions:[],agentSessions:{active:[],inactive:[]},hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,hasLoaded:!1,connectionStatus:"connecting",connectionError:null,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,setSessions:r=>{var p;const n=t(),i=n.selectedSessionId,a=n.sessions,l=n.exitingSessions,s=new Set(r.map(u=>u.id)),o=a.filter(u=>!s.has(u.id)&&!l.has(u.id));let c=i;if(i!==null&&!r.some(u=>u.id===i)){const{sessionSortMode:u,sessionSortDirection:f}=pe.getState();c=((p=rp(r,{mode:u,direction:f})[0])==null?void 0:p.id)??null}if(o.length>0){const u=new Map(l);for(const f of o)u.set(f.id,f);e({sessions:r,hasLoaded:!0,selectedSessionId:c,exitingSessions:u})}else e({sessions:r,hasLoaded:!0,selectedSessionId:c})},setAgentSessions:(r,n)=>e({agentSessions:{active:r,inactive:n}}),setHostStatuses:r=>e({hostStatuses:r}),updateSession:r=>e(n=>({sessions:n.sessions.map(i=>i.id===r.id?r:i)})),setSelectedSessionId:r=>e({selectedSessionId:r}),setConnectionStatus:r=>e({connectionStatus:r}),setConnectionError:r=>e({connectionError:r}),setRemoteAllowControl:r=>e({remoteAllowControl:r}),setRemoteAllowAttach:r=>e({remoteAllowAttach:r}),setHostLabel:r=>e({hostLabel:r}),markSessionExiting:r=>{const n=t().sessions.find(i=>i.id===r);if(n){const i=new Map(t().exitingSessions);i.set(r,n),e({exitingSessions:i})}},clearExitingSession:r=>{const n=new Map(t().exitingSessions);n.delete(r),e({exitingSessions:n})}}),{name:"agentboard-session",storage:mc(()=>df),partialize:e=>({selectedSessionId:e.selectedSessionId})}));function uv(e,t,r=!1){const[n,i]=k.useState(!1),a=k.useRef(e),l=k.useRef(!1);return k.useEffect(()=>{const o=a.current;if(r?e>o:e!==o){l.current=!0;const p=setTimeout(()=>{l.current&&(i(!0),l.current=!1)},t);return a.current=e,()=>clearTimeout(p)}a.current=e},[e,t,r]),[n,()=>i(!1)]}function dR(e,t,r,n){const i=k.useRef(new Map);k.useEffect(()=>{const a=new Set(e.map(l=>l.id));for(const l of t.keys())if(a.has(l)){const s=i.current.get(l);s&&(clearTimeout(s),i.current.delete(l)),r(l)}else if(!i.current.has(l)){const s=setTimeout(()=>{i.current.delete(l),r(l)},n+100);i.current.set(l,s)}},[e,t,r,n]),k.useEffect(()=>()=>{for(const a of i.current.values())clearTimeout(a);i.current.clear()},[])}function fR({className:e}){return T.jsx("svg",{viewBox:"0 0 92.2 92.2",fill:"currentColor",className:e,"aria-label":"Anthropic",children:T.jsx("path",{d:"M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z",transform:"translate(0, 13.6)"})})}function pR({className:e}){return T.jsx("svg",{viewBox:"-1 -1 26 26",fill:"currentColor",className:e,"aria-label":"OpenAI",children:T.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})})}function mR({className:e}){return T.jsx("svg",{viewBox:"0 0 588.42 568.88",fill:"currentColor",className:e,"aria-label":"Pi",children:T.jsx("path",{d:"M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z"})})}const gR=[["claude",fR],["codex",pR],["pi",mR]];function bc({agentType:e,command:t,className:r=""}){const n=(e||(t==null?void 0:t.split(" ")[0])||"").toLowerCase();for(const[i,a]of gR)if(n.startsWith(i))return T.jsx(a,{className:r});return T.jsx(BC,{className:r})}const vR=360;function _R(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t)}function cw(e){return{"--badge-hue":`${_R(e)%vR}`}}function uw({name:e,fullPath:t,className:r=""}){const n=cw(e);return T.jsx("span",{className:`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none ${r}`,style:n,title:t,children:e})}const yR=k.memo(function({session:t,showSessionIdPrefix:r,showProjectName:n,showLastUserMessage:i,onResume:a,onPreview:l,onSetPinned:s}){const o=np(t.lastActivityAt),c=_s(t.projectPath),p=t.displayName||c||t.sessionId.slice(0,8),u=n&&!!c,f=i&&!!t.lastUserMessage,_=r?lw(t.sessionId):"",y=k.useRef(null),[v,h]=k.useState(null);k.useEffect(()=>{if(!v)return;const d=w=>{y.current&&!y.current.contains(w.target)&&h(null)},g=w=>{w.key==="Escape"&&h(null)};return document.addEventListener("mousedown",d),document.addEventListener("touchstart",d),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("touchstart",d),document.removeEventListener("keydown",g)}},[v]);const m=d=>{d.preventDefault(),d.stopPropagation(),h({x:d.clientX,y:d.clientY})};return T.jsxs("div",{className:"group relative cursor-pointer px-3 py-2 hover:bg-hover",role:"button",tabIndex:0,title:"Click to preview",onClick:()=>l(t),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l(t))},onContextMenu:m,children:[T.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100",title:"Resume directly",onClick:d=>{d.stopPropagation(),a(t.sessionId)},children:"▶"}),T.jsxs("div",{className:"flex flex-col gap-0.5 pl-2.5 group-hover:pr-4",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(bc,{agentType:t.agentType,className:"h-3.5 w-3.5 shrink-0 text-muted"}),T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:p}),t.lastResumeError&&T.jsx(cC,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Resume failed",title:`Last resume failed: ${t.lastResumeError}`}),t.isPinned&&T.jsx(Il,{className:"h-3 w-3 shrink-0 text-muted","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),_&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:t.sessionId,children:_}),T.jsx("span",{className:"ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted",children:o})]}),(u||f)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[u&&T.jsx(uw,{name:c,fullPath:t.projectPath}),f&&T.jsxs("span",{className:"truncate text-xs italic text-muted",children:['"',t.lastUserMessage.length>200?t.lastUserMessage.slice(0,200)+"…":t.lastUserMessage,'"']})]})]}),v&&T.jsxs("div",{ref:y,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:v.x,top:v.y},role:"menu",children:[s&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),h(null),s(t.sessionId,!t.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Il,{width:14,height:14}),t.isPinned?"Unpin":"Pin"]}),t.logFilePath&&T.jsxs("button",{onClick:d=>{d.stopPropagation(),navigator.clipboard.writeText(t.logFilePath).catch(()=>{}),h(null)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:t.logFilePath,children:[T.jsx(sy,{width:14,height:14}),"Copy Log Path"]})]})]})});function wR({name:e,className:t=""}){const r=cw(`host:${e}`);return T.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide ${t}`,style:r,title:e,children:e})}function SR({hosts:e,selectedHosts:t,onSelect:r,statuses:n=[]}){const[i,a]=k.useState(!1),l=k.useId(),s=k.useRef(null),o=k.useMemo(()=>new Set(t),[t]),c=k.useMemo(()=>new Map(n.map(_=>[_.host,_])),[n]),p=k.useMemo(()=>t.length===0?"All Hosts":t.join(", "),[t]),u=k.useMemo(()=>t.length===0?"All Hosts":t.length===1?t[0]:`${t.length} hosts`,[t]);k.useEffect(()=>{if(!i||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const _=v=>{var m;const h=v.target;h&&((m=s.current)!=null&&m.contains(h))||a(!1)},y=v=>{v.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",_),document.addEventListener("touchstart",_,{passive:!0}),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",_),document.removeEventListener("touchstart",_),document.removeEventListener("keydown",y)}},[i]);const f=_=>{const y=new Set(o);y.has(_)?y.delete(_):y.add(_);const v=e.filter(h=>y.has(h));r(v)};return T.jsxs("div",{ref:s,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":l,"aria-label":"Filter by host",onClick:()=>a(_=>!_),className:"flex h-6 max-w-[9rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:p,children:[T.jsx("span",{className:"truncate",children:u}),T.jsx(ff,{className:"h-3 w-3 shrink-0 text-muted"})]}),i&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-48 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{role:"menuitemcheckbox","aria-checked":t.length===0,className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Hosts"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No hosts"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(_=>{const y=c.get(_),v=y?!y.ok:!1;return T.jsxs("label",{role:"menuitemcheckbox","aria-checked":o.has(_),className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y!=null&&y.error?`${_}: ${y.error}`:_,children:[T.jsx("input",{type:"checkbox",checked:o.has(_),onChange:()=>f(_),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:_}),v&&T.jsx("span",{className:"ml-auto text-[10px] uppercase text-danger",children:"offline"})]},_)})})]})]})}function xR({projects:e,selectedProjects:t,onSelect:r,hasHiddenPermissions:n}){const[i,a]=k.useState(!1),l=k.useId(),s=k.useRef(null),o=k.useMemo(()=>hR(e),[e]),c=k.useMemo(()=>new Set(t),[t]),p=n&&t.length>0,u=k.useMemo(()=>t.length===0?"All Projects":t.map(y=>o.get(y)??_s(y)??y).join(", "),[o,t]),f=k.useMemo(()=>{if(t.length===0)return"All Projects";if(t.length===1){const y=t[0];return o.get(y)??_s(y)??y}return`${t.length} projects`},[o,t]);k.useEffect(()=>{if(!i||typeof document>"u"||!document.addEventListener||!document.removeEventListener)return;const y=h=>{var d;const m=h.target;m&&((d=s.current)!=null&&d.contains(m))||a(!1)},v=h=>{h.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",y),document.addEventListener("touchstart",y,{passive:!0}),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("touchstart",y),document.removeEventListener("keydown",v)}},[i]);const _=y=>{const v=new Set(c);v.has(y)?v.delete(y):v.add(y);const h=e.filter(m=>v.has(m));r(h)};return T.jsxs("div",{ref:s,className:"relative",children:[T.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":i,"aria-controls":l,"aria-label":"Filter by project",onClick:()=>a(y=>!y),className:"flex h-6 max-w-[11rem] items-center gap-1 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none",title:u,children:[T.jsx("span",{className:"truncate",children:f}),T.jsx(ff,{className:"h-3 w-3 shrink-0 text-muted"})]}),i&&T.jsxs("div",{id:l,role:"menu",className:"absolute right-0 z-20 mt-1 w-60 rounded border border-border bg-surface p-2 text-xs shadow-lg",children:[T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",children:[T.jsx("input",{type:"checkbox",checked:t.length===0,onChange:()=>r([]),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{children:"All Projects"})]}),T.jsx("div",{className:"my-2 h-px bg-border"}),e.length===0?T.jsx("div",{className:"px-2 py-1 text-muted",children:"No projects"}):T.jsx("div",{className:"max-h-48 overflow-y-auto pr-1",children:e.map(y=>{const v=o.get(y)??_s(y)??y;return T.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover",title:y,children:[T.jsx("input",{type:"checkbox",checked:c.has(y),onChange:()=>_(y),className:"h-3.5 w-3.5 accent-approval"}),T.jsx("span",{className:"truncate",children:v})]},y)})})]}),p&&T.jsx("button",{type:"button",className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated",title:"Hidden sessions need attention","aria-label":"Clear project filters",onClick:y=>{y.stopPropagation(),r([])},children:T.jsx("span",{className:"sr-only",children:"Clear project filters"})})]})}const Kl=new Set(["tool_result","custom_tool_call_output"]),bR=new Set(["text","input_text","output_text"]);function qr(e){return!e||typeof e!="object"?null:e}function At(e){return typeof e=="string"?e:null}function Uo(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"||e==="developer"?"system":e==="tool"?"tool":"other"}function CR(e){const t=At(e.type)??"",r=qr(e.payload),n=At(r==null?void 0:r.type)??"",i=At(e.source)??At(r==null?void 0:r.source)??"",a=At(e.agent)??"";return i.toLowerCase()==="pi"||a.toLowerCase()==="pi"?"pi":t==="response_item"||t==="event_msg"?"codex":t==="tool_use"||t==="result"||t==="user"||t==="assistant"||t==="system"?"claude":n==="user_message"||n==="assistant_message"?"codex":"unknown"}function ER(e){const t=qr(e.payload),r=At(t==null?void 0:t.type);return{family:CR(e),rawType:At(e.type)??"unknown",...r?{payloadType:r}:{}}}function bt(e){if(!e)return[];if(typeof e=="string")return e.trim()?[e]:[];if(Array.isArray(e)){const r=[];for(const n of e){if(typeof n=="string"){n.trim()&&r.push(n);continue}const i=qr(n);if(!i)continue;const a=At(i.type);if(a&&Kl.has(a)||a&&!bR.has(a))continue;const l=At(i.text);l&&l.trim()&&r.push(l)}return r}const t=qr(e);if(t){const r=At(t.type);if(r&&Kl.has(r))return[];const n=At(t.text);return n&&n.trim()?[n]:[...bt(t.content),...bt(t.message)]}return[]}function kR(e,t){if(e.type!=="response_item")return[];const r=qr(e.payload);if(!r||r.type!=="message")return[];const n=Uo(r.role);return bt(r.content).map(i=>({kind:"message",role:n,text:i,source:t}))}function LR(e,t){if(e.type!=="event_msg")return[];const r=qr(e.payload);if(!r)return[];const n=At(r.type);let i=null;if(n==="user_message"?i="user":n==="assistant_message"?i="assistant":n==="system_message"?i="system":n==="message"&&(i=Uo(r.role)),!i||!["user","assistant","system"].includes(i))return[];const a=Array.from(new Set([...bt(r.message),...bt(r.content),...bt(r.text)]));return a.length===0?[]:a.map(l=>({kind:"message",role:i,text:l,source:t}))}function TR(e,t){const r=Uo(e.type),n=qr(e.message);if(n){const a=Uo(n.role??e.type);return[...bt(n.content),...bt(n.text),...bt(n.message)].map(s=>({kind:"message",role:a,text:s,source:t}))}return["user","assistant","system"].includes(r)?[...bt(e.content),...bt(e.text)].map(a=>({kind:"message",role:r,text:a,source:t})):[]}function RR(e,t){const r=Uo(e.role);return["user","assistant","system"].includes(r)?[...bt(e.content),...bt(e.message),...bt(e.text)].map(i=>({kind:"message",role:r,text:i,source:t})):[]}function DR(e,t){const r=At(e.type),n=At(e.event);return r!=="tool_use"&&n!=="tool_use"?[]:[{kind:"tool_call",role:"assistant",text:`[Tool: ${At(e.name)??"tool"}]`,source:t}]}function MR(e,t){if(e.type!=="result")return[];const r=At(e.result);return!r||!r.trim()?[]:[{kind:"result",role:"system",text:r,source:t}]}function AR(e,t){const r=qr(e.payload),n=[...bt(e.message),...bt(e.content),...bt(e.text),...bt(r==null?void 0:r.message),...bt(r==null?void 0:r.content)];return n.length===0?[]:n.map(i=>({kind:"unknown",role:"other",text:i,source:t}))}function PR(e,t){const r=At(e.type),n=qr(e.payload),i=At(n==null?void 0:n.type);return r&&Kl.has(r)||i&&Kl.has(i)?[{kind:"tool_result",role:"tool",text:"",source:t}]:[]}function IR(e){const t=qr(e);if(!t)return[];const r=ER(t),n=[...kR(t,r),...LR(t,r),...TR(t,r),...DR(t,r),...MR(t,r),...PR(t,r)];if(n.length>0)return n;const i=RR(t,r);return i.length>0?i:AR(t,r)}function BR(e){const t=e.trim();if(!t)return null;try{const r=JSON.parse(t);return{parsed:!0,events:IR(r),raw:r}}catch{return{parsed:!1,events:[{kind:"unknown",role:"other",text:t,source:{family:"unknown",rawType:"raw_text"}}],raw:e}}}function OR(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"?"system":"other"}function NR(e){const t=BR(e);if(!t)return[];const r=t.events.map(n=>({type:OR(n.role),content:n.text.trim(),raw:e})).filter(n=>n.content.length>0);return r.length>0?r:!t.parsed&&e.trim()?[{type:"other",content:e.trim(),raw:e}]:[]}function jR({session:e,onClose:t,onResume:r}){const[n,i]=k.useState(!0),[a,l]=k.useState(null),[s,o]=k.useState(null),[c,p]=k.useState(!1),u=k.useRef(null),f=k.useRef(null);k.useEffect(()=>{(async()=>{try{const m=await fetch(`/api/session-preview/${e.sessionId}`);if(!m.ok){const g=await m.json();throw new Error(g.error||"Failed to load preview")}const d=await m.json();o(d)}catch(m){l(m instanceof Error?m.message:"Failed to load preview")}finally{i(!1)}})()},[e.sessionId]),k.useEffect(()=>{u.current&&s&&(u.current.scrollTop=u.current.scrollHeight)},[s,c]),k.useEffect(()=>{const h=m=>{m.key==="Escape"?(m.stopPropagation(),t()):m.key==="Enter"&&!n&&!a&&(m.preventDefault(),r(e.sessionId))};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,r,e.sessionId,n,a]),k.useEffect(()=>{var h;(h=f.current)==null||h.focus()},[]);const _=e.displayName||_s(e.projectPath)||e.sessionId.slice(0,8),y=np(e.lastActivityAt),v=(s==null?void 0:s.lines.flatMap(NR).slice(-30))??[];return T.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"preview-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:h=>{h.target===h.currentTarget&&t()},children:T.jsxs("div",{ref:f,tabIndex:-1,className:"flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[T.jsx(bc,{agentType:e.agentType,className:"h-5 w-5 shrink-0 text-muted"}),T.jsxs("div",{className:"min-w-0 flex-1",children:[T.jsx("h2",{id:"preview-title",className:"truncate text-sm font-semibold text-primary",children:_}),T.jsxs("p",{className:"truncate text-xs text-muted",title:e.projectPath,children:[_s(e.projectPath)," · ",y]})]}),T.jsx("button",{type:"button",onClick:()=>p(h=>!h),className:`btn text-xs ${c?"btn-primary":""}`,children:c?"Parsed":"Raw"})]}),T.jsxs("div",{ref:u,className:"flex-1 overflow-y-auto p-4 font-mono text-xs",children:[n&&T.jsx("div",{className:"flex items-center justify-center py-8 text-muted",children:"Loading preview..."}),a&&T.jsx("div",{className:"flex items-center justify-center py-8 text-danger",children:a}),s&&!c&&T.jsx("div",{className:"space-y-2",children:v.length===0?T.jsx("div",{className:"py-8 text-center text-muted",children:"No readable content found. Try raw view."}):v.map((h,m)=>T.jsx("div",{className:`rounded px-2 py-1 ${h.type==="user"?"bg-blue-500/10 text-blue-400":h.type==="assistant"?"bg-emerald-500/10 text-emerald-400":h.type==="system"?"bg-yellow-500/10 text-yellow-400":"text-muted"}`,children:T.jsx("span",{className:"whitespace-pre-wrap break-words",children:h.content.length>500?`${h.content.slice(0,500)}...`:h.content})},m))}),s&&c&&T.jsx("div",{className:"space-y-1",children:s.lines.slice(-50).map((h,m)=>T.jsx("div",{className:"whitespace-pre-wrap break-all text-muted",children:h||" "},m))})]}),T.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>r(e.sessionId),disabled:n||!!a,className:"btn btn-primary",children:"Resume"})]})]})})}const hv={working:"bg-green-500/20 text-green-600",waiting:"bg-zinc-500/20 text-zinc-400",permission:"bg-amber-500/20 text-amber-600",unknown:"bg-zinc-500/20 text-zinc-400"};function FR(){const[,e]=k.useState(0);k.useEffect(()=>{const t=setInterval(()=>e(r=>r+1),3e4);return()=>clearInterval(t)},[])}function hw({sessions:e,inactiveSessions:t=[],selectedSessionId:r,loading:n,error:i,onSelect:a,onRename:l,onResume:s,onKill:o,onDuplicate:c,onSetPinned:p}){FR();const[u,f]=k.useState(null),_=pe(X=>X.inactiveSessionsExpanded),y=pe(X=>X.setInactiveSessionsExpanded),[v,h]=k.useState(null),[m,d]=k.useState(20),g=$1();k.useEffect(()=>{_||d(20)},[_]);const w=200,[b,x]=uv(e.length,w),[C,S]=uv(t.length,w,!0),E=k.useRef(new Set(e.map(X=>X.id))),L=k.useRef(new Set(t.map(X=>X.sessionId))),[A,M]=k.useState(new Set);k.useEffect(()=>{var We;const X=new Set(e.map(Z=>Z.id)),le=new Set(t.map(Z=>Z.sessionId)),ge=new Set;for(const Z of X)E.current.has(Z)||ge.add(Z);for(const Z of e){const Le=(We=Z.agentSessionId)==null?void 0:We.trim();Le&&L.current.has(Le)&&!le.has(Le)&&ge.add(Z.id)}E.current=X,L.current=le,ge.size>0&&M(ge)},[e,t]),k.useEffect(()=>{if(A.size===0)return;const X=setTimeout(()=>M(new Set),500);return()=>clearTimeout(X)},[A]);const D=pe(X=>X.shortcutModifier),B=ii(Zo(D)),H=pe(X=>X.sessionSortMode),F=pe(X=>X.setSessionSortMode),$=pe(X=>X.sessionSortDirection),I=pe(X=>X.manualSessionOrder),R=pe(X=>X.setManualSessionOrder),P=pe(X=>X.showProjectName),N=pe(X=>X.showLastUserMessage),j=pe(X=>X.showSessionIdPrefix),U=pe(X=>X.projectFilters),V=pe(X=>X.setProjectFilters),ee=pe(X=>X.hostFilters),Q=pe(X=>X.setHostFilters),z=Ge(X=>X.exitingSessions),O=Ge(X=>X.clearExitingSession),K=Ge(X=>X.hostStatuses),W=Ge(X=>X.remoteAllowControl);dR(e,z,O,w),k.useEffect(()=>{if(I.length===0)return;const X=new Set;for(const ge of e)X.add(go(ge)),X.add(ge.id);for(const ge of t)X.add(ge.sessionId);const le=I.filter(ge=>X.has(ge));le.length!==I.length&&R(le)},[e,t,I,R]);const J=k.useMemo(()=>rp(e,{mode:H,direction:$,manualOrder:I}),[e,H,$,I]),_e=k.useMemo(()=>cR(e,t),[e,t]),ue=k.useMemo(()=>{const X=uR(e,t),le=K.map(Z=>Z.host),ge=new Set,We=[];for(const Z of le)!Z||ge.has(Z)||(ge.add(Z),We.push(Z));for(const Z of X)!Z||ge.has(Z)||(ge.add(Z),We.push(Z));return We},[e,t,K]),se=k.useMemo(()=>ue.length>1,[ue]),re=k.useMemo(()=>{let X=J;return U.length>0&&(X=X.filter(le=>U.includes(le.projectPath))),ee.length>0&&(X=X.filter(le=>ee.includes(le.host??""))),X},[J,U,ee]),ae=k.useMemo(()=>{const X=U.length===0?"all-projects":U.join("|"),le=ee.length===0?"all-hosts":ee.join("|");return`${X}::${le}`},[U,ee]),ye=k.useRef(new Set(re.map(X=>X.id))),[ve,ne]=k.useState(new Set);k.useEffect(()=>{const X=new Set(re.map(ge=>ge.id)),le=new Set;for(const ge of X)ye.current.has(ge)||A.has(ge)||le.add(ge);ye.current=X,le.size>0&&ne(le)},[re,A]),k.useEffect(()=>{if(ve.size===0)return;const X=setTimeout(()=>ne(new Set),500);return()=>clearTimeout(X)},[ve]);const ie=k.useMemo(()=>{let X=t;return U.length>0&&(X=X.filter(le=>U.includes(le.projectPath))),ee.length>0&&(X=X.filter(le=>ee.includes(le.host??""))),X},[t,U,ee]),he=k.useMemo(()=>{if(U.length===0)return 0;const X=new Set(U);return e.filter(le=>!X.has(le.projectPath)&&le.status==="permission").length},[e,U]);k.useEffect(()=>{if(U.length===0||_e.length===0)return;const X=new Set(_e),le=U.filter(ge=>X.has(ge));le.length!==U.length&&V(le)},[U,_e,V]),k.useEffect(()=>{if(ee.length===0||ue.length===0)return;const X=new Set(ue),le=ee.filter(ge=>X.has(ge));le.length!==ee.length&&Q(le)},[ee,ue,Q]);const oe=OL(BL(tp,{activationConstraint:{distance:8}})),[me,xe]=k.useState(null),[ke,Ne]=k.useState(null),[Ke,Ae]=k.useState(!1),Pe=k.useCallback(X=>{xe(X.active.id),Ae(!0)},[]),G=k.useCallback(X=>{var le;Ne((le=X.over)==null?void 0:le.id)},[]),Y=k.useCallback(X=>{const{active:le,over:ge}=X;if(xe(null),Ne(null),!ge||le.id===ge.id){setTimeout(()=>Ae(!1),100);return}const We=re.findIndex(Me=>Me.id===le.id),Z=re.findIndex(Me=>Me.id===ge.id);if(We===-1||Z===-1){setTimeout(()=>Ae(!1),100);return}const Le=re.map(Me=>go(Me)),[de]=Le.splice(We,1);Le.splice(Z,0,de);const fe=J.map(Me=>go(Me)),Ee=new Set(Le);let Re=0;const je=fe.map(Me=>{if(!Ee.has(Me))return Me;const Ie=Le[Re];return Re+=1,Ie});H!=="manual"&&F("manual"),R(je),setTimeout(()=>Ae(!1),100)},[re,J,H,F,R]),Oe=k.useCallback(()=>{xe(null),Ne(null),setTimeout(()=>Ae(!1),100)},[]);k.useEffect(()=>{if(!me&&!ke)return;const X=new Set(re.map(ge=>ge.id));let le=!1;me&&!X.has(me)&&(xe(null),le=!0),ke&&!X.has(ke)&&(Ne(null),le=!0),le&&Ae(!1)},[re,me,ke]);const $e=(X,le)=>{l(X,le),f(null)};return T.jsxs("aside",{className:"flex min-h-0 flex-1 flex-col border-r border-border bg-elevated",children:[i&&T.jsx("div",{className:"shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger",children:i}),T.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"sticky top-0 z-10 flex h-10 items-center justify-between border-b border-border bg-elevated px-3",children:[T.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted",children:"Sessions"}),T.jsxs("div",{className:"flex items-center gap-4",children:[se&&T.jsx(SR,{hosts:ue,selectedHosts:ee,onSelect:Q,statuses:K}),T.jsx(xR,{projects:_e,selectedProjects:U,onSelect:V,hasHiddenPermissions:he>0}),T.jsx(Yh.span,{className:"w-8 text-right text-xs text-muted",animate:b&&!g?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:x,children:re.length})]})]}),n?T.jsx("div",{className:"space-y-1 p-2",children:[0,1,2].map(X=>T.jsx("div",{className:"h-14 animate-pulse rounded bg-surface"},X))}):re.length===0?T.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted",children:"No sessions"}):T.jsx($T,{sensors:oe,collisionDetection:HL,onDragStart:Pe,onDragOver:G,onDragEnd:Y,onDragCancel:Oe,children:T.jsx(ZT,{items:re.map(X=>X.id),strategy:JT,children:T.jsx("div",{children:T.jsx(W5,{initial:!1,mode:"popLayout",children:re.map((X,le)=>{const ge=A.has(X.id),We=ve.has(X.id),Z=X.remote===!0,Le=X.source==="managed",de=!Z||W&&Le,fe=me?re.findIndex(Me=>Me.id===me):-1,Re=ke===X.id&&me!==X.id?fe>le?"above":"below":null,je=ge||We;return T.jsx(dw,{session:X,isNew:je,exitDuration:w,prefersReducedMotion:g,layoutAnimationsDisabled:Ke,isSelected:X.id===r,isEditing:X.id===u,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:N,showHostInfo:se,dropIndicator:Re,onSelect:()=>a(X.id),onStartEdit:de?()=>f(X.id):void 0,onCancelEdit:()=>f(null),onRename:Me=>$e(X.id,Me),onKill:o&&de?()=>o(X.id):void 0,onDuplicate:c&&de?()=>c(X.id):void 0,onSetPinned:p&&X.agentSessionId?Me=>p(X.agentSessionId.trim(),Me):void 0},X.id)})})},ae)})}),ie.length>0&&T.jsxs("div",{className:"border-t border-border",children:[T.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary",children:[T.jsxs("span",{className:"flex items-center gap-2",children:[_?T.jsx(ff,{className:"h-4 w-4"}):T.jsx(dC,{className:"h-4 w-4"}),"Inactive Sessions"]}),T.jsx(Yh.span,{className:"w-8 text-right text-xs",animate:C&&!g?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:S,children:ie.length})]}),_&&T.jsxs("div",{className:"py-1",children:[ie.slice(0,m).map(X=>T.jsx(yR,{session:X,showSessionIdPrefix:j,showProjectName:P,showLastUserMessage:N,onResume:le=>s==null?void 0:s(le),onPreview:h,onSetPinned:p},X.sessionId)),ie.length>m&&T.jsxs("button",{type:"button",onClick:()=>d(X=>X+20),className:"w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover",children:["Show more (",ie.length-m," remaining)"]})]})]})]}),T.jsx("div",{className:"hidden shrink-0 border-t border-border px-3 py-2 md:block",children:T.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted",children:[T.jsxs("span",{children:[B,"[ ] nav"]}),T.jsxs("span",{children:[B,"N new"]}),T.jsxs("span",{children:[B,"X kill"]})]})}),v&&T.jsx(jR,{session:v,onClose:()=>h(null),onResume:X=>{h(null),s==null||s(X)}})]})}const dw=k.forwardRef(function({session:t,isNew:r,exitDuration:n,prefersReducedMotion:i,layoutAnimationsDisabled:a,isSelected:l,isEditing:s,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:p,showHostInfo:u,dropIndicator:f,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:m,onDuplicate:d,onSetPinned:g},w){const{attributes:b,listeners:x,setNodeRef:C,transform:S,transition:E,isDragging:L}=oR({id:t.id,animateLayoutChanges:({isSorting:H,wasDragging:F})=>H||F}),A=Ho.Transform.toString(S),D={...!!(i&&A)?{transform:A,transition:E}:{},zIndex:L?10:void 0,opacity:L?.9:void 0},B=k.useCallback(H=>{C(H),typeof w=="function"?w(H):w&&(w.current=H)},[C,w]);return T.jsxs(Yh.div,{ref:B,style:{...D,overflow:"hidden"},className:"relative",layout:!i&&!L&&!a&&!r,transformTemplate:(H,F)=>A?!F||F==="none"?A:`${A} ${F}`:F,initial:i||!r?!1:{opacity:0,scale:.97},animate:i?{opacity:1}:r?{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:i?{opacity:0}:{opacity:0,height:0,scale:.97},transition:i?{duration:0}:{layout:{type:"spring",stiffness:500,damping:35},opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:"easeOut"}},...b,...x,children:[f==="above"&&T.jsx("div",{className:"absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"}),T.jsx($R,{session:t,isSelected:l,isEditing:s,showSessionIdPrefix:o,showProjectName:c,showLastUserMessage:p,showHostInfo:u,isDragging:L,onSelect:_,onStartEdit:y,onCancelEdit:v,onRename:h,onKill:m,onDuplicate:d,onSetPinned:g}),f==="below"&&T.jsx("div",{className:"absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent"})]})});dw.displayName="SortableSessionItem";function $R({session:e,isSelected:t,isEditing:r,showSessionIdPrefix:n,showProjectName:i,showLastUserMessage:a,showHostInfo:l,isDragging:s=!1,onSelect:o,onStartEdit:c,onCancelEdit:p,onRename:u,onKill:f,onDuplicate:_,onSetPinned:y}){var Q,z,O,K;const v=np(e.lastActivity),h=k.useRef(null),m=k.useRef(null),d=((Q=e.agentSessionName)==null?void 0:Q.trim())||((z=e.name)==null?void 0:z.trim())||e.id,[g,w]=k.useState(d),b=k.useRef(null),[x,C]=k.useState(null),S=_s(e.projectPath),E=(O=e.host)==null?void 0:O.trim(),L=e.status==="permission",A=(K=e.agentSessionId)==null?void 0:K.trim(),M=n&&A?lw(A):"",D=i&&!!S,B=l&&!!E,H=a&&!!e.lastUserMessage,F=k.useRef(e.status),[$,I]=k.useState(!1);k.useEffect(()=>{const W=F.current,te=e.status;W==="working"&&te==="waiting"?I(!0):F.current=te},[e.status]);const R=()=>{I(!1),F.current=e.status};k.useEffect(()=>{r&&h.current&&(h.current.focus(),h.current.select())},[r]),k.useEffect(()=>{w(d)},[d]);const P=()=>{const W=g.trim();W&&W!==d?u(W):p()},N=W=>{W.key==="Enter"?(W.preventDefault(),P()):W.key==="Escape"&&(W.preventDefault(),w(d),p())},j=k.useRef(null),U=W=>{if(s)return;const te=W.touches[0];j.current={x:te.clientX,y:te.clientY},b.current=setTimeout(()=>{j.current&&C(j.current)},500)},V=()=>{b.current&&(clearTimeout(b.current),b.current=null)};k.useEffect(()=>{if(!x)return;const W=J=>{m.current&&!m.current.contains(J.target)&&C(null)},te=J=>{J.key==="Escape"&&C(null)};return document.addEventListener("mousedown",W),document.addEventListener("touchstart",W),document.addEventListener("keydown",te),()=>{document.removeEventListener("mousedown",W),document.removeEventListener("touchstart",W),document.removeEventListener("keydown",te)}},[x]);const ee=W=>{W.preventDefault(),W.stopPropagation(),C({x:W.clientX,y:W.clientY})};return T.jsxs("div",{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?"selected":""} ${s?"cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated":"cursor-grab"}`,role:"button",tabIndex:0,"data-testid":"session-card","data-session-id":e.id,onClick:s?void 0:o,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&o()},onContextMenu:ee,onTouchStart:U,onTouchEnd:V,onTouchCancel:V,children:[T.jsxs("div",{className:"flex flex-col gap-0.5 pl-0.5",children:[T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx(bc,{agentType:e.agentType,command:e.command,className:"h-3.5 w-3.5 shrink-0 text-muted"}),r?T.jsx("input",{ref:h,type:"text",value:g,onChange:W=>w(W.target.value),onBlur:P,onKeyDown:N,onClick:W=>W.stopPropagation(),className:"min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-primary",children:d}),e.isPinned&&T.jsx(Il,{className:"h-3 w-3 shrink-0 text-primary","aria-label":"Pinned",title:"Pinned - will auto-resume on server restart"}),M&&T.jsx("span",{className:"shrink-0 text-[11px] font-mono text-muted",title:A,children:M}),L?T.jsx("span",{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${hv[e.status]} pulse-approval`,onAnimationEnd:R,children:T.jsx(bC,{className:"h-3 w-3","aria-label":"Needs input"})}):T.jsx("span",{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${hv[e.status]}${$?" pulse-complete":""}`,onAnimationEnd:R,children:v})]}),(D||B||H)&&T.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-[1.375rem]",children:[B&&T.jsx(wR,{name:E}),D&&T.jsx(uw,{name:S,fullPath:e.projectPath}),H&&T.jsxs("span",{className:"line-clamp-2 text-xs italic text-muted",children:['"',e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+"…":e.lastUserMessage,'"']})]})]}),x&&T.jsxs("div",{ref:m,className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1",style:{left:x.x,top:x.y},role:"menu",children:[c&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),c()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",children:[T.jsx(ny,{width:14,height:14}),"Rename"]}),_&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),_()},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:"Create a copy in a new tmux window",children:[T.jsx(ry,{width:14,height:14}),"Duplicate"]}),y&&T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),y(!e.isPinned)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.isPinned?"Remove from auto-resume list":"Auto-resume on server restart",children:[T.jsx(Il,{width:14,height:14}),e.isPinned?"Unpin":"Pin"]}),e.logFilePath&&T.jsxs("button",{onClick:W=>{W.stopPropagation();const te=e.logFilePath;if(C(null),te){const J=document.createElement("textarea");J.value=te,J.style.position="fixed",J.style.left="-9999px",document.body.appendChild(J),J.focus(),J.select();try{document.execCommand("copy")}catch{navigator.clipboard.writeText(te).catch(()=>{})}document.body.removeChild(J)}},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",role:"menuitem",title:e.logFilePath,children:[T.jsx(sy,{width:14,height:14}),"Copy Log Path"]}),f&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"my-1 border-t border-border"}),T.jsxs("button",{onClick:W=>{W.stopPropagation(),C(null),f()},className:"w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2",role:"menuitem",children:[T.jsx(Th,{width:14,height:14}),"Kill Session"]})]})]})]})}const rd={debug:0,info:1,warn:2,error:3};let fw="info";function HR(e){const t=e.toLowerCase();t in rd&&(fw=t)}function Qe(e,t,r="debug"){if(!(rd[r]<rd[fw]))try{fetch("/api/client-log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:e,data:t,level:r})}).catch(()=>{})}catch{}}var pw={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(globalThis,()=>(()=>{var r={4567:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const u=o(9042),f=o(9924),_=o(844),y=o(4725),v=o(2585),h=o(3656);let m=s.AccessibilityManager=class extends _.Disposable{constructor(d,g,w,b){super(),this._terminal=d,this._coreBrowserService=w,this._renderService=b,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 x=0;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);if(this._topBoundaryFocusListener=x=>this._handleBoundaryFocus(x,0),this._bottomBoundaryFocusListener=x=>this._handleBoundaryFocus(x,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 f.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(x=>this._handleResize(x.rows))),this.register(this._terminal.onRender(x=>this._refreshRows(x.start,x.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(x=>this._handleChar(x))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
53
53
|
`))),this.register(this._terminal.onA11yTab(x=>this._handleTab(x))),this.register(this._terminal.onKey(x=>this._handleKey(x.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,h.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,_.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(d){for(let g=0;g<d;g++)this._handleChar(" ")}_handleChar(d){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==d&&(this._charsToAnnounce+=d):this._charsToAnnounce+=d,d===`
|
|
54
54
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(d){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(d)||this._charsToConsume.push(d)}_refreshRows(d,g){this._liveRegionDebouncer.refresh(d,g,this._terminal.rows)}_renderRows(d,g){const w=this._terminal.buffer,b=w.lines.length.toString();for(let x=d;x<=g;x++){const C=w.lines.get(w.ydisp+x),S=[],E=(C==null?void 0:C.translateToString(!0,void 0,void 0,S))||"",L=(w.ydisp+x+1).toString(),A=this._rowElements[x];A&&(E.length===0?(A.innerText=" ",this._rowColumns.set(A,[0,1])):(A.textContent=E,this._rowColumns.set(A,S)),A.setAttribute("aria-posinset",L),A.setAttribute("aria-setsize",b))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(d,g){const w=d.target,b=this._rowElements[g===0?1:this._rowElements.length-2];if(w.getAttribute("aria-posinset")===(g===0?"1":`${this._terminal.buffer.lines.length}`)||d.relatedTarget!==b)return;let x,C;if(g===0?(x=w,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(x=this._rowElements.shift(),C=w,this._rowContainer.removeChild(x)),x.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),g===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(g===0?-1:1),this._rowElements[g===0?1:this._rowElements.length-2].focus(),d.preventDefault(),d.stopImmediatePropagation()}_handleSelectionChange(){var E;if(this._rowElements.length===0)return;const d=document.getSelection();if(!d)return;if(d.isCollapsed)return void(this._rowContainer.contains(d.anchorNode)&&this._terminal.clearSelection());if(!d.anchorNode||!d.focusNode)return void console.error("anchorNode and/or focusNode are null");let g={node:d.anchorNode,offset:d.anchorOffset},w={node:d.focusNode,offset:d.focusOffset};if((g.node.compareDocumentPosition(w.node)&Node.DOCUMENT_POSITION_PRECEDING||g.node===w.node&&g.offset>w.offset)&&([g,w]=[w,g]),g.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(g={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(g.node))return;const b=this._rowElements.slice(-1)[0];if(w.node.compareDocumentPosition(b)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(w={node:b,offset:((E=b.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(w.node))return;const x=({node:L,offset:A})=>{const M=L instanceof Text?L.parentNode:L;let D=parseInt(M==null?void 0:M.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const B=this._rowColumns.get(M);if(!B)return console.warn("columns is null. Race condition?"),null;let H=A<B.length?B[A]:B.slice(-1)[0]+1;return H>=this._terminal.cols&&(++D,H=0),{row:D,column:H}},C=x(g),S=x(w);if(C&&S){if(C.row>S.row||C.row===S.row&&C.column>=S.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(S.row-C.row)*this._terminal.cols-C.column+S.column)}}_handleResize(d){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let g=this._rowContainer.children.length;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);for(;this._rowElements.length>d;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const d=this._coreBrowserService.mainDocument.createElement("div");return d.setAttribute("role","listitem"),d.tabIndex=-1,this._refreshRowDimensions(d),d}_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 d=0;d<this._terminal.rows;d++)this._refreshRowDimensions(this._rowElements[d])}}_refreshRowDimensions(d){d.style.height=`${this._renderService.dimensions.css.cell.height}px`}};s.AccessibilityManager=m=c([p(1,v.IInstantiationService),p(2,y.ICoreBrowserService),p(3,y.IRenderService)],m)},3614:(l,s)=>{function o(f){return f.replace(/\r?\n/g,"\r")}function c(f,_){return _?"\x1B[200~"+f+"\x1B[201~":f}function p(f,_,y,v){f=c(f=o(f),y.decPrivateModes.bracketedPasteMode&&v.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(f,!0),_.value=""}function u(f,_,y){const v=y.getBoundingClientRect(),h=f.clientX-v.left-10,m=f.clientY-v.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${h}px`,_.style.top=`${m}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=c,s.copyHandler=function(f,_){f.clipboardData&&f.clipboardData.setData("text/plain",_.selectionText),f.preventDefault()},s.handlePasteEvent=function(f,_,y,v){f.stopPropagation(),f.clipboardData&&p(f.clipboardData.getData("text/plain"),_,y,v)},s.paste=p,s.moveTextAreaUnderMouseCursor=u,s.rightClickHandler=function(f,_,y,v,h){u(f,_,y),h&&v.rightClickSelect(f),_.value=v.selectionText,_.select()}},7239:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const c=o(1505);s.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(p,u,f){this._css.set(p,u,f)}getCss(p,u){return this._css.get(p,u)}setColor(p,u,f){this._color.set(p,u,f)}getColor(p,u){return this._color.get(p,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,p,u){o.addEventListener(c,p,u);let f=!1;return{dispose:()=>{f||(f=!0,o.removeEventListener(c,p,u))}}}},3551:function(l,s,o){var c=this&&this.__decorate||function(m,d,g,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,g):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(m,d,g,w);else for(var S=m.length-1;S>=0;S--)(b=m[S])&&(C=(x<3?b(C):x>3?b(d,g,C):b(d,g))||C);return x>3&&C&&Object.defineProperty(d,g,C),C},p=this&&this.__param||function(m,d){return function(g,w){d(g,w,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;const u=o(3656),f=o(8460),_=o(844),y=o(2585),v=o(4725);let h=s.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(m,d,g,w,b){super(),this._element=m,this._mouseService=d,this._renderService=g,this._bufferService=w,this._linkProviderService=b,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)(()=>{var x;this._lastMouseEvent=void 0,(x=this._activeProviderReplies)==null||x.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const d=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!d)return;this._isMouseOut=!1;const g=m.composedPath();for(let w=0;w<g.length;w++){const b=g[w];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._handleHover(d),this._lastBufferCell=d)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,d){var w,b;this._activeProviderReplies&&d||((w=this._activeProviderReplies)==null||w.forEach(x=>{x==null||x.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=m.y);let g=!1;for(const[x,C]of this._linkProviderService.linkProviders.entries())d?(b=this._activeProviderReplies)!=null&&b.get(x)&&(g=this._checkLinkProviderResult(x,m,g)):C.provideLinks(m.y,S=>{var L,A;if(this._isMouseOut)return;const E=S==null?void 0:S.map(M=>({link:M}));(L=this._activeProviderReplies)==null||L.set(x,E),g=this._checkLinkProviderResult(x,m,g),((A=this._activeProviderReplies)==null?void 0:A.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)})}_removeIntersectingLinks(m,d){const g=new Set;for(let w=0;w<d.size;w++){const b=d.get(w);if(b)for(let x=0;x<b.length;x++){const C=b[x],S=C.link.range.start.y<m?0:C.link.range.start.x,E=C.link.range.end.y>m?this._bufferService.cols:C.link.range.end.x;for(let L=S;L<=E;L++){if(g.has(L)){b.splice(x--,1);break}g.add(L)}}}}_checkLinkProviderResult(m,d,g){var x;if(!this._activeProviderReplies)return g;const w=this._activeProviderReplies.get(m);let b=!1;for(let C=0;C<m;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(b=!0);if(!b&&w){const C=w.find(S=>this._linkAtPosition(S.link,d));C&&(g=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!g)for(let C=0;C<this._activeProviderReplies.size;C++){const S=(x=this._activeProviderReplies.get(C))==null?void 0:x.find(E=>this._linkAtPosition(E.link,d));if(S){g=!0,this._handleNewLink(S);break}}return g}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const d=this._positionFromMouseEvent(m,this._element,this._mouseService);d&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,d){this._currentLink&&this._lastMouseEvent&&(!m||!d||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const d=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);d&&this._linkAtPosition(m.link,d)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var g,w;return(w=(g=this._currentLink)==null?void 0:g.state)==null?void 0:w.decorations.pointerCursor},set:g=>{var w;(w=this._currentLink)!=null&&w.state&&this._currentLink.state.decorations.pointerCursor!==g&&(this._currentLink.state.decorations.pointerCursor=g,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",g))}},underline:{get:()=>{var g,w;return(w=(g=this._currentLink)==null?void 0:g.state)==null?void 0:w.decorations.underline},set:g=>{var w,b,x;(w=this._currentLink)!=null&&w.state&&((x=(b=this._currentLink)==null?void 0:b.state)==null?void 0:x.decorations.underline)!==g&&(this._currentLink.state.decorations.underline=g,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,g))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(g=>{if(!this._currentLink)return;const w=g.start===0?0:g.start+1+this._bufferService.buffer.ydisp,b=this._bufferService.buffer.ydisp+1+g.end;if(this._currentLink.link.range.start.y>=w&&this._currentLink.link.range.end.y<=b&&(this._clearCurrentLink(w,b),this._lastMouseEvent)){const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._askForLink(x,!1)}})))}_linkHover(m,d,g){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),d.hover&&d.hover(g,d.text)}_fireUnderlineEvent(m,d){const g=m.range,w=this._bufferService.buffer.ydisp,b=this._createLinkUnderlineEvent(g.start.x-1,g.start.y-w-1,g.end.x,g.end.y-w-1,void 0);(d?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(b)}_linkLeave(m,d,g){var w;(w=this._currentLink)!=null&&w.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(d,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),d.leave&&d.leave(g,d.text)}_linkAtPosition(m,d){const g=m.range.start.y*this._bufferService.cols+m.range.start.x,w=m.range.end.y*this._bufferService.cols+m.range.end.x,b=d.y*this._bufferService.cols+d.x;return g<=b&&b<=w}_positionFromMouseEvent(m,d,g){const w=g.getCoords(m,d,this._bufferService.cols,this._bufferService.rows);if(w)return{x:w[0],y:w[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,d,g,w,b){return{x1:m,y1:d,x2:g,y2:w,cols:this._bufferService.cols,fg:b}}};s.Linkifier=h=c([p(1,v.IMouseService),p(2,v.IRenderService),p(3,y.IBufferService),p(4,v.ILinkProviderService)],h)},9042:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(l,s,o){var c=this&&this.__decorate||function(v,h,m,d){var g,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,m,d);else for(var x=v.length-1;x>=0;x--)(g=v[x])&&(b=(w<3?g(b):w>3?g(h,m,b):g(h,m))||b);return w>3&&b&&Object.defineProperty(h,m,b),b},p=this&&this.__param||function(v,h){return function(m,d){h(m,d,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const u=o(511),f=o(2585);let _=s.OscLinkProvider=class{constructor(v,h,m){this._bufferService=v,this._optionsService=h,this._oscLinkService=m}provideLinks(v,h){var E;const m=this._bufferService.buffer.lines.get(v-1);if(!m)return void h(void 0);const d=[],g=this._optionsService.rawOptions.linkHandler,w=new u.CellData,b=m.getTrimmedLength();let x=-1,C=-1,S=!1;for(let L=0;L<b;L++)if(C!==-1||m.hasContent(L)){if(m.loadCell(L,w),w.hasExtendedAttrs()&&w.extended.urlId){if(C===-1){C=L,x=w.extended.urlId;continue}S=w.extended.urlId!==x}else C!==-1&&(S=!0);if(S||C!==-1&&L===b-1){const A=(E=this._oscLinkService.getLinkData(x))==null?void 0:E.uri;if(A){const M={start:{x:C+1,y:v},end:{x:L+(S||L!==b-1?0:1),y:v}};let D=!1;if(!(g!=null&&g.allowNonHttpProtocols))try{const B=new URL(A);["http:","https:"].includes(B.protocol)||(D=!0)}catch{D=!0}D||d.push({text:A,range:M,activate:(B,H)=>g?g.activate(B,H,M):y(0,H),hover:(B,H)=>{var F;return(F=g==null?void 0:g.hover)==null?void 0:F.call(g,B,H,M)},leave:(B,H)=>{var F;return(F=g==null?void 0:g.leave)==null?void 0:F.call(g,B,H,M)}})}S=!1,w.hasExtendedAttrs()&&w.extended.urlId?(C=L,x=w.extended.urlId):(C=-1,x=-1)}}h(d)}};function y(v,h){if(confirm(`Do you want to navigate to ${h}?
|
|
55
55
|
|
|
56
|
-
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=_=c([p(0,f.IBufferService),p(1,f.IOptionsService),p(2,f.IOscLinkService)],_)},6193:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,p){this._rowCount=p,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const c=o(3614),p=o(3656),u=o(3551),f=o(9042),_=o(3730),y=o(1680),v=o(3107),h=o(5744),m=o(2950),d=o(1296),g=o(428),w=o(4269),b=o(5114),x=o(8934),C=o(3230),S=o(9312),E=o(4725),L=o(6731),A=o(8055),M=o(8969),D=o(8460),B=o(844),H=o(6114),F=o(8437),$=o(2584),I=o(7399),R=o(5941),P=o(9074),N=o(2585),j=o(5435),U=o(4567),V=o(779);class ee extends M.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(z={}){super(z),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(V.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((O,K)=>this.refresh(O,K))),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,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(O=>this._afterResize(O.cols,O.rows))),this.register((0,B.toDisposable)(()=>{var O,K;this._customKeyEventHandler=void 0,(K=(O=this.element)==null?void 0:O.parentNode)==null||K.removeChild(this.element)}))}_handleColorEvent(z){if(this._themeService)for(const O of z){let K,W="";switch(O.index){case 256:K="foreground",W="10";break;case 257:K="background",W="11";break;case 258:K="cursor",W="12";break;default:K="ansi",W="4;"+O.index}switch(O.type){case 0:const te=A.color.toColorRGB(K==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[K]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${W};${(0,R.toRgbString)(te)}${$.C1_ESCAPED.ST}`);break;case 1:if(K==="ansi")this._themeService.modifyColors(Y=>Y.ansi[O.index]=A.channels.toColor(...O.color));else{const Y=K;this._themeService.modifyColors(_e=>_e[Y]=A.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(z){z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var z;return(z=this.textarea)==null?void 0:z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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 z=this.buffer.ybase+this.buffer.y,O=this.buffer.lines.get(z);if(!O)return;const K=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,te=O.getWidth(K),Y=this._renderService.dimensions.css.cell.width*te,_e=this.buffer.y*this._renderService.dimensions.css.cell.height,ue=K*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ue+"px",this.textarea.style.top=_e+"px",this.textarea.style.width=Y+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",O=>{this.hasSelection()&&(0,c.copyHandler)(O,this._selectionService)}));const z=O=>(0,c.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",z)),H.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",O=>{O.button===2&&(0,c.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",O=>{(0,c.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",O=>{O.button===1&&(0,c.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",z=>this._keyUp(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",z=>this._keyDown(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",z=>this._keyPress(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",z=>this._compositionHelper.compositionupdate(z))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,p.addDisposableDomListener)(this.textarea,"input",z=>this._inputEvent(z),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(z){var K;if(!z)throw new Error("Terminal requires a parent element.");if(z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((K=this.element)==null?void 0:K.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=z.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"),z.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,p.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),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",f.promptLabel),H.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(b.CoreBrowserService,this.textarea,z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(g.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(v.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const z=this,O=this.element;function K(Y){const _e=z._mouseService.getMouseReportCoords(Y,z.screenElement);if(!_e)return!1;let ue,se;switch(Y.overrideType||Y.type){case"mousemove":se=32,Y.buttons===void 0?(ue=3,Y.button!==void 0&&(ue=Y.button<3?Y.button:3)):ue=1&Y.buttons?0:4&Y.buttons?1:2&Y.buttons?2:3;break;case"mouseup":se=0,ue=Y.button<3?Y.button:3;break;case"mousedown":se=1,ue=Y.button<3?Y.button:3;break;case"wheel":if(z._customWheelEventHandler&&z._customWheelEventHandler(Y)===!1||z.viewport.getLinesScrolled(Y)===0)return!1;se=Y.deltaY<0?0:1,ue=4;break;default:return!1}return!(se===void 0||ue===void 0||ue>4)&&z.coreMouseService.triggerMouseEvent({col:_e.col,row:_e.row,x:_e.x,y:_e.y,button:ue,action:se,ctrl:Y.ctrlKey,alt:Y.altKey,shift:Y.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:Y=>(K(Y),Y.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(Y)),wheel:Y=>(K(Y),this.cancel(Y,!0)),mousedrag:Y=>{Y.buttons&&K(Y)},mousemove:Y=>{Y.buttons||K(Y)}};this.register(this.coreMouseService.onProtocolChange(Y=>{Y?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Y)),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&Y?W.mousemove||(O.addEventListener("mousemove",te.mousemove),W.mousemove=te.mousemove):(O.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&Y?W.wheel||(O.addEventListener("wheel",te.wheel,{passive:!1}),W.wheel=te.wheel):(O.removeEventListener("wheel",W.wheel),W.wheel=null),2&Y?W.mouseup||(W.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&Y?W.mousedrag||(W.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(O,"mousedown",Y=>{if(Y.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Y))return K(Y),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(Y)})),this.register((0,p.addDisposableDomListener)(O,"wheel",Y=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Y)===!1)return!1;if(!this.buffer.hasScrollback){const _e=this.viewport.getLinesScrolled(Y);if(_e===0)return;const ue=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Y.deltaY<0?"A":"B");let se="";for(let re=0;re<Math.abs(_e);re++)se+=ue;return this.coreService.triggerDataEvent(se,!0),this.cancel(Y,!0)}return this.viewport.handleWheel(Y)?this.cancel(Y):void 0}},{passive:!1})),this.register((0,p.addDisposableDomListener)(O,"touchstart",Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Y),this.cancel(Y)},{passive:!0})),this.register((0,p.addDisposableDomListener)(O,"touchmove",Y=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Y)?void 0:this.cancel(Y)},{passive:!1}))}refresh(z,O){var K;(K=this._renderService)==null||K.refreshRows(z,O)}updateCursorStyle(z){var O;(O=this._selectionService)!=null&&O.shouldColumnSelect(z)?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(z,O,K=0){var W;K===1?(super.scrollLines(z,O,K),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(z)}paste(z){(0,c.paste)(z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(z){this._customKeyEventHandler=z}attachCustomWheelEventHandler(z){this._customWheelEventHandler=z}registerLinkProvider(z){return this._linkProviderService.registerLinkProvider(z)}registerCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const O=this._characterJoinerService.register(z);return this.refresh(0,this.rows-1),O}deregisterCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+z)}registerDecoration(z){return this._decorationService.registerDecoration(z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(z,O,K){this._selectionService.setSelection(z,O,K)}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 z;(z=this._selectionService)==null||z.clearSelection()}selectAll(){var z;(z=this._selectionService)==null||z.selectAll()}selectLines(z,O){var K;(K=this._selectionService)==null||K.selectLines(z,O)}_keyDown(z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&z.altKey;if(!O&&!this._compositionHelper.keydown(z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||z.key!=="Dead"&&z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const K=(0,I.evaluateKeyboardEvent)(z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(z),K.type===3||K.type===2){const W=this.rows-1;return this.scrollLines(K.type===2?-W:W),this.cancel(z,!0)}return K.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,z)||(K.cancel&&this.cancel(z,!0),!K.key||!!(z.key&&!z.ctrlKey&&!z.altKey&&!z.metaKey&&z.key.length===1&&z.key.charCodeAt(0)>=65&&z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(K.key!==$.C0.ETX&&K.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:K.key,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(K.key,!0),!this.optionsService.rawOptions.screenReaderMode||z.altKey||z.ctrlKey?this.cancel(z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(z,O){const K=z.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||z.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||z.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?K:K&&(!O.keyCode||O.keyCode>47)}_keyUp(z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1||(function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18}(z)||this.focus(),this.updateCursorStyle(z),this._keyPressHandled=!1)}_keyPress(z){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;if(this.cancel(z),z.charCode)O=z.charCode;else if(z.which===null||z.which===void 0)O=z.keyCode;else{if(z.which===0||z.charCode===0)return!1;O=z.which}return!(!O||(z.altKey||z.ctrlKey||z.metaKey)&&!this._isThirdLevelShift(this.browser,z)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(O,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(z){if(z.data&&z.inputType==="insertText"&&(!z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const O=z.data;return this.coreService.triggerDataEvent(O,!0),this.cancel(z),!0}return!1}resize(z,O){z!==this.cols||O!==this.rows?super.resize(z,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(z,O){var K,W;(K=this._charSizeService)==null||K.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var z;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(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(z=this.viewport)==null||z.reset(),this.refresh(0,this.rows-1)}}reset(){var O,K;this.options.rows=this.rows,this.options.cols=this.cols;const z=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(K=this.viewport)==null||K.reset(),this._customKeyEventHandler=z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var z;(z=this._renderService)==null||z.clearTextureAtlas()}_reportFocus(){var z;(z=this.element)!=null&&z.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(z){if(this._renderService)switch(z){case j.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),K=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${K};${O}t`);break;case j.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${te};${W}t`)}}cancel(z,O){if(this.options.cancelEvents||O)return z.preventDefault(),z.stopPropagation(),!1}}s.Terminal=ee},9924:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,p){this._rowCount=p,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const f=u-this._lastRefreshMs,_=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(l,s,o){var c=this&&this.__decorate||function(m,d,g,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,g):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(m,d,g,w);else for(var S=m.length-1;S>=0;S--)(b=m[S])&&(C=(x<3?b(C):x>3?b(d,g,C):b(d,g))||C);return x>3&&C&&Object.defineProperty(d,g,C),C},p=this&&this.__param||function(m,d){return function(g,w){d(g,w,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const u=o(3656),f=o(4725),_=o(8460),y=o(844),v=o(2585);let h=s.Viewport=class extends y.Disposable{constructor(m,d,g,w,b,x,C,S){super(),this._viewportElement=m,this._scrollArea=d,this._bufferService=g,this._optionsService=w,this._charSizeService=b,this._renderService=x,this._coreBrowserService=C,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 _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(S.colors),this.register(S.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(m){this._viewportElement.style.backgroundColor=m.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(m,d){const g=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&g<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const d=this._getPixelsScrolled(m);return d!==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+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(m,d))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let d=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(m,d){var S;let g,w="";const b=[],x=d??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=m;E<x;E++){const L=C.get(E);if(!L)continue;const A=(S=C.get(E+1))==null?void 0:S.isWrapped;if(w+=L.translateToString(!A),!A||E===C.length-1){const M=document.createElement("div");M.textContent=w,b.push(M),w.length>0&&(g=M),w=""}}return{bufferElements:b,cursorElement:g}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let d=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(m,d){const g=this._optionsService.rawOptions.fastScrollModifier;return g==="alt"&&d.altKey||g==="ctrl"&&d.ctrlKey||g==="shift"&&d.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const d=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(m,d))}};s.Viewport=h=c([p(2,v.IBufferService),p(3,v.IOptionsService),p(4,f.ICharSizeService),p(5,f.IRenderService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],h)},3107:function(l,s,o){var c=this&&this.__decorate||function(v,h,m,d){var g,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,m,d);else for(var x=v.length-1;x>=0;x--)(g=v[x])&&(b=(w<3?g(b):w>3?g(h,m,b):g(h,m))||b);return w>3&&b&&Object.defineProperty(h,m,b),b},p=this&&this.__param||function(v,h){return function(m,d){h(m,d,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const u=o(4725),f=o(844),_=o(2585);let y=s.BufferDecorationRenderer=class extends f.Disposable{constructor(v,h,m,d,g){super(),this._screenElement=v,this._bufferService=h,this._coreBrowserService=m,this._decorationService=d,this._renderService=g,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(w=>this._removeDecoration(w))),this.register((0,f.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 v of this._decorationService.decorations)this._renderDecoration(v);this._dimensionsChanged=!1}_renderDecoration(v){this._refreshStyle(v),this._dimensionsChanged&&this._refreshXPosition(v)}_createElement(v){var d;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((d=v==null?void 0:v.options)==null?void 0:d.layer)==="top"),h.style.width=`${Math.round((v.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(v.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(v.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=v.options.x??0;return m&&m>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(v,h),h}_refreshStyle(v){const h=v.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)v.element&&(v.element.style.display="none",v.onRenderEmitter.fire(v.element));else{let m=this._decorationElements.get(v);m||(m=this._createElement(v),v.element=m,this._decorationElements.set(v,m),this._container.appendChild(m),v.onDispose(()=>{this._decorationElements.delete(v),m.remove()})),m.style.top=h*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",v.onRenderEmitter.fire(m)}}_refreshXPosition(v,h=v.element){if(!h)return;const m=v.options.x??0;(v.options.anchor||"left")==="right"?h.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(v){var h;(h=this._decorationElements.get(v))==null||h.remove(),this._decorationElements.delete(v),v.dispose()}};s.BufferDecorationRenderer=y=c([p(1,_.IBufferService),p(2,u.ICoreBrowserService),p(3,_.IDecorationService),p(4,u.IRenderService)],y)},5871:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,p){return c>=o.startBufferLine-this._linePadding[p||"full"]&&c<=o.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(l,s,o){var c=this&&this.__decorate||function(g,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,w,b,x);else for(var L=g.length-1;L>=0;L--)(C=g[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},p=this&&this.__param||function(g,w){return function(b,x){w(b,x,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const u=o(5871),f=o(4725),_=o(844),y=o(2585),v={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let d=s.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(g,w,b,x,C,S,E){var A;super(),this._viewportElement=g,this._screenElement=w,this._bufferService=b,this._decorationService=x,this._renderService=C,this._optionsService=S,this._coreBrowserService=E,this._colorZoneStore=new u.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(),(A=this._viewportElement.parentElement)==null||A.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)(()=>{var M;(M=this._canvas)==null||M.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 g=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=g,h.center=w,h.right=g,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=h.left,m.right=h.left+h.center}_refreshDrawHeightConstants(){v.full=Math.round(2*this._coreBrowserService.dpr);const g=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(g,12),6)*this._coreBrowserService.dpr);v.left=w,v.center=w,v.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.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 w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const g=this._colorZoneStore.zones;for(const w of g)w.position!=="full"&&this._renderColorZone(w);for(const w of g)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(g){this._ctx.fillStyle=g.color,this._ctx.fillRect(m[g.position||"full"],Math.round((this._canvas.height-1)*(g.startBufferLine/this._bufferService.buffers.active.lines.length)-v[g.position||"full"]/2),h[g.position||"full"],Math.round((this._canvas.height-1)*((g.endBufferLine-g.startBufferLine)/this._bufferService.buffers.active.lines.length)+v[g.position||"full"]))}_queueRefresh(g,w){this._shouldUpdateDimensions=g||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};s.OverviewRulerRenderer=d=c([p(2,y.IBufferService),p(3,y.IDecorationService),p(4,f.IRenderService),p(5,y.IOptionsService),p(6,f.ICoreBrowserService)],d)},2950:function(l,s,o){var c=this&&this.__decorate||function(v,h,m,d){var g,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,m,d);else for(var x=v.length-1;x>=0;x--)(g=v[x])&&(b=(w<3?g(b):w>3?g(h,m,b):g(h,m))||b);return w>3&&b&&Object.defineProperty(h,m,b),b},p=this&&this.__param||function(v,h){return function(m,d){h(m,d,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const u=o(4725),f=o(2585),_=o(2584);let y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(v,h,m,d,g,w){this._textarea=v,this._compositionView=h,this._bufferService=m,this._optionsService=d,this._coreService=g,this._renderService=w,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(v){this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(v){if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){const h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}},0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const v=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const h=this._textarea.value,m=h.replace(v,"");this._dataAlreadySent=m,h.length>v.length?this._coreService.triggerDataEvent(m,!0):h.length<v.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):h.length===v.length&&h!==v&&this._coreService.triggerDataEvent(h,!0)}},0)}updateCompositionElements(v){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,g=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=g+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=g+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}v||setTimeout(()=>this.updateCompositionElements(!0),0)}}};s.CompositionHelper=y=c([p(2,f.IBufferService),p(3,f.IOptionsService),p(4,f.ICoreService),p(5,u.IRenderService)],y)},9806:(l,s)=>{function o(c,p,u){const f=u.getBoundingClientRect(),_=c.getComputedStyle(u),y=parseInt(_.getPropertyValue("padding-left")),v=parseInt(_.getPropertyValue("padding-top"));return[p.clientX-f.left-y,p.clientY-f.top-v]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(c,p,u,f,_,y,v,h,m){if(!y)return;const d=o(c,p,u);return d?(d[0]=Math.ceil((d[0]+(m?v/2:0))/v),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),f+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),_),d):void 0}},9504:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const c=o(2584);function p(h,m,d,g){const w=h-u(h,d),b=m-u(m,d),x=Math.abs(w-b)-function(C,S,E){let L=0;const A=C-u(C,E),M=S-u(S,E);for(let D=0;D<Math.abs(A-M);D++){const B=f(C,S)==="A"?-1:1,H=E.buffer.lines.get(A+B*D);H!=null&&H.isWrapped&&L++}return L}(h,m,d);return v(x,y(f(h,m),g))}function u(h,m){let d=0,g=m.buffer.lines.get(h),w=g==null?void 0:g.isWrapped;for(;w&&h>=0&&h<m.rows;)d++,g=m.buffer.lines.get(--h),w=g==null?void 0:g.isWrapped;return d}function f(h,m){return h>m?"A":"B"}function _(h,m,d,g,w,b){let x=h,C=m,S="";for(;x!==d||C!==g;)x+=w?1:-1,w&&x>b.cols-1?(S+=b.buffer.translateBufferLineToString(C,!1,h,x),x=0,h=0,C++):!w&&x<0&&(S+=b.buffer.translateBufferLineToString(C,!1,0,h+1),x=b.cols-1,h=x,C--);return S+b.buffer.translateBufferLineToString(C,!1,h,x)}function y(h,m){const d=m?"O":"[";return c.C0.ESC+d+h}function v(h,m){h=Math.floor(h);let d="";for(let g=0;g<h;g++)d+=m;return d}s.moveToCellSequence=function(h,m,d,g){const w=d.buffer.x,b=d.buffer.y;if(!d.buffer.hasScrollback)return function(S,E,L,A,M,D){return p(E,A,M,D).length===0?"":v(_(S,E,S,E-u(E,M),!1,M).length,y("D",D))}(w,b,0,m,d,g)+p(b,m,d,g)+function(S,E,L,A,M,D){let B;B=p(E,A,M,D).length>0?A-u(A,M):E;const H=A,F=function($,I,R,P,N,j){let U;return U=p(R,P,N,j).length>0?P-u(P,N):I,$<R&&U<=P||$>=R&&U<P?"C":"D"}(S,E,L,A,M,D);return v(_(S,B,L,H,F==="C",M).length,y(F,D))}(w,b,h,m,d,g);let x;if(b===m)return x=w>h?"D":"C",v(Math.abs(w-h),y(x,g));x=b>m?"D":"C";const C=Math.abs(b-m);return v(function(S,E){return E.cols-S}(b>m?h:w,d)+(C-1)*d.cols+1+((b>m?w:h)-1),y(x,g))}},1296:function(l,s,o){var c=this&&this.__decorate||function(D,B,H,F){var $,I=arguments.length,R=I<3?B:F===null?F=Object.getOwnPropertyDescriptor(B,H):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(D,B,H,F);else for(var P=D.length-1;P>=0;P--)($=D[P])&&(R=(I<3?$(R):I>3?$(B,H,R):$(B,H))||R);return I>3&&R&&Object.defineProperty(B,H,R),R},p=this&&this.__param||function(D,B){return function(H,F){B(H,F,D)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const u=o(3787),f=o(2550),_=o(2223),y=o(6171),v=o(6052),h=o(4725),m=o(8055),d=o(8460),g=o(844),w=o(2585),b="xterm-dom-renderer-owner-",x="xterm-rows",C="xterm-fg-",S="xterm-bg-",E="xterm-focus",L="xterm-selection";let A=1,M=s.DomRenderer=class extends g.Disposable{constructor(D,B,H,F,$,I,R,P,N,j,U,V,ee){super(),this._terminal=D,this._document=B,this._element=H,this._screenElement=F,this._viewportElement=$,this._helperContainer=I,this._linkifier2=R,this._charSizeService=N,this._optionsService=j,this._bufferService=U,this._coreBrowserService=V,this._themeService=ee,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,v.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(Q=>this._injectCss(Q))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(Q=>this._handleLinkHover(Q))),this.register(this._linkifier2.onHideLinkUnderline(Q=>this._handleLinkLeave(Q))),this.register((0,g.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new f.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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${x} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${x} .xterm-dim { color: ${m.color.multiplyOpacity(D.foreground,.5).css};}`,B+=`${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 H=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;B+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,B+=`@keyframes ${F} { 50% { box-shadow: none; }}`,B+=`@keyframes ${$} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,B+=`${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[I,R]of D.ansi.entries())B+=`${this._terminalSelector} .${C}${I} { color: ${R.css}; }${this._terminalSelector} .${C}${I}.xterm-dim { color: ${m.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${S}${I} { background-color: ${R.css}; }`;B+=`${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${S}${_.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,B){for(let H=this._rowElements.length;H<=B;H++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,B){this._refreshRowElements(D,B),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,B,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,B,H),this.renderRows(0,this._bufferService.rows-1),!D||!B)return;this._selectionRenderModel.update(this._terminal,D,B,H);const F=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||R<0)return;const P=this._document.createDocumentFragment();if(H){const N=D[0]>B[0];P.appendChild(this._createSelectionElement(I,N?B[0]:D[0],N?D[0]:B[0],R-I+1))}else{const N=F===I?D[0]:0,j=I===$?B[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(I,N,j));const U=R-I-1;if(P.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,U)),I!==R){const V=$===R?B[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(R,0,V))}}this._selectionContainer.appendChild(P)}_createSelectionElement(D,B,H,F=1){const $=this._document.createElement("div"),I=B*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(H-B);return I+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-I),$.style.height=F*this.dimensions.css.cell.height+"px",$.style.top=D*this.dimensions.css.cell.height+"px",$.style.left=`${I}px`,$.style.width=`${R}px`,$}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 D of this._rowElements)D.replaceChildren()}renderRows(D,B){const H=this._bufferService.buffer,F=H.ybase+H.y,$=Math.min(H.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=D;N<=B;N++){const j=N+H.ydisp,U=this._rowElements[N],V=H.lines.get(j);if(!U||!V)break;U.replaceChildren(...this._rowFactory.createRow(V,j,j===F,R,P,$,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,B,H,F,$,I){H<0&&(D=0),F<0&&(B=0);const R=this._bufferService.rows-1;H=Math.max(Math.min(H,R),0),F=Math.max(Math.min(F,R),0),$=Math.min($,this._bufferService.cols);const P=this._bufferService.buffer,N=P.ybase+P.y,j=Math.min(P.x,$-1),U=this._optionsService.rawOptions.cursorBlink,V=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=H;Q<=F;++Q){const z=Q+P.ydisp,O=this._rowElements[Q],K=P.lines.get(z);if(!O||!K)break;O.replaceChildren(...this._rowFactory.createRow(K,z,z===N,V,ee,j,U,this.dimensions.css.cell.width,this._widthCache,I?Q===H?D:0:-1,I?(Q===F?B:$)-1:-1))}}};s.DomRenderer=M=c([p(7,w.IInstantiationService),p(8,h.ICharSizeService),p(9,w.IOptionsService),p(10,w.IBufferService),p(11,h.ICoreBrowserService),p(12,h.IThemeService)],M)},3787:function(l,s,o){var c=this&&this.__decorate||function(x,C,S,E){var L,A=arguments.length,M=A<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,C,S,E);else for(var D=x.length-1;D>=0;D--)(L=x[D])&&(M=(A<3?L(M):A>3?L(C,S,M):L(C,S))||M);return A>3&&M&&Object.defineProperty(C,S,M),M},p=this&&this.__param||function(x,C){return function(S,E){C(S,E,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const u=o(2223),f=o(643),_=o(511),y=o(2585),v=o(8055),h=o(4725),m=o(4269),d=o(6171),g=o(3734);let w=s.DomRendererRowFactory=class{constructor(x,C,S,E,L,A,M){this._document=x,this._characterJoinerService=C,this._optionsService=S,this._coreBrowserService=E,this._coreService=L,this._decorationService=A,this._themeService=M,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,C,S){this._selectionStart=x,this._selectionEnd=C,this._columnSelectMode=S}createRow(x,C,S,E,L,A,M,D,B,H,F){const $=[],I=this._characterJoinerService.getJoinedCharacters(C),R=this._themeService.colors;let P,N=x.getNoBgTrimmedLength();S&&N<A+1&&(N=A+1);let j=0,U="",V=0,ee=0,Q=0,z=!1,O=0,K=!1,W=0;const te=[],Y=H!==-1&&F!==-1;for(let _e=0;_e<N;_e++){x.loadCell(_e,this._workCell);let ue=this._workCell.getWidth();if(ue===0)continue;let se=!1,re=_e,ae=this._workCell;if(I.length>0&&_e===I[0][0]){se=!0;const J=I.shift();ae=new m.JoinedCellData(this._workCell,x.translateToString(!0,J[0],J[1]),J[1]-J[0]),re=J[1]-1,ue=ae.getWidth()}const ye=this._isCellInSelection(_e,C),ve=S&&_e===A,ne=Y&&_e>=H&&_e<=F;let ie=!1;this._decorationService.forEachDecorationAtCell(_e,C,void 0,J=>{ie=!0});let he=ae.getChars()||f.WHITESPACE_CELL_CHAR;if(he===" "&&(ae.isUnderline()||ae.isOverline())&&(he=" "),W=ue*D-B.get(he,ae.isBold(),ae.isItalic()),P){if(j&&(ye&&K||!ye&&!K&&ae.bg===V)&&(ye&&K&&R.selectionForeground||ae.fg===ee)&&ae.extended.ext===Q&&ne===z&&W===O&&!ve&&!se&&!ie){ae.isInvisible()?U+=f.WHITESPACE_CELL_CHAR:U+=he,j++;continue}j&&(P.textContent=U),P=this._document.createElement("span"),j=0,U=""}else P=this._document.createElement("span");if(V=ae.bg,ee=ae.fg,Q=ae.extended.ext,z=ne,O=W,K=ye,se&&A>=_e&&A<=re&&(A=_e),!this._coreService.isCursorHidden&&ve&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&te.push("xterm-cursor-blink"),te.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(ae.isBold()&&te.push("xterm-bold"),ae.isItalic()&&te.push("xterm-italic"),ae.isDim()&&te.push("xterm-dim"),U=ae.isInvisible()?f.WHITESPACE_CELL_CHAR:ae.getChars()||f.WHITESPACE_CELL_CHAR,ae.isUnderline()&&(te.push(`xterm-underline-${ae.extended.underlineStyle}`),U===" "&&(U=" "),!ae.isUnderlineColorDefault()))if(ae.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${g.AttributeData.toColorRGB(ae.getUnderlineColor()).join(",")})`;else{let J=ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ae.isBold()&&J<8&&(J+=8),P.style.textDecorationColor=R.ansi[J].css}ae.isOverline()&&(te.push("xterm-overline"),U===" "&&(U=" ")),ae.isStrikethrough()&&te.push("xterm-strikethrough"),ne&&(P.style.textDecoration="underline");let oe=ae.getFgColor(),me=ae.getFgColorMode(),xe=ae.getBgColor(),ke=ae.getBgColorMode();const Ne=!!ae.isInverse();if(Ne){const J=oe;oe=xe,xe=J;const Oe=me;me=ke,ke=Oe}let Ke,Ae,Pe,G=!1;switch(this._decorationService.forEachDecorationAtCell(_e,C,void 0,J=>{J.options.layer!=="top"&&G||(J.backgroundColorRGB&&(ke=50331648,xe=J.backgroundColorRGB.rgba>>8&16777215,Ke=J.backgroundColorRGB),J.foregroundColorRGB&&(me=50331648,oe=J.foregroundColorRGB.rgba>>8&16777215,Ae=J.foregroundColorRGB),G=J.options.layer==="top")}),!G&&ye&&(Ke=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,xe=Ke.rgba>>8&16777215,ke=50331648,G=!0,R.selectionForeground&&(me=50331648,oe=R.selectionForeground.rgba>>8&16777215,Ae=R.selectionForeground)),G&&te.push("xterm-decoration-top"),ke){case 16777216:case 33554432:Pe=R.ansi[xe],te.push(`xterm-bg-${xe}`);break;case 50331648:Pe=v.channels.toColor(xe>>16,xe>>8&255,255&xe),this._addStyle(P,`background-color:#${b((xe>>>0).toString(16),"0",6)}`);break;default:Ne?(Pe=R.foreground,te.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):Pe=R.background}switch(Ke||ae.isDim()&&(Ke=v.color.multiplyOpacity(Pe,.5)),me){case 16777216:case 33554432:ae.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(P,Pe,R.ansi[oe],ae,Ke,void 0)||te.push(`xterm-fg-${oe}`);break;case 50331648:const J=v.channels.toColor(oe>>16&255,oe>>8&255,255&oe);this._applyMinimumContrast(P,Pe,J,ae,Ke,Ae)||this._addStyle(P,`color:#${b(oe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Pe,R.foreground,ae,Ke,Ae)||Ne&&te.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}te.length&&(P.className=te.join(" "),te.length=0),ve||se||ie?P.textContent=U:j++,W!==this.defaultSpacing&&(P.style.letterSpacing=`${W}px`),$.push(P),_e=re}return P&&j&&(P.textContent=U),$}_applyMinimumContrast(x,C,S,E,L,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const M=this._getContrastCache(E);let D;if(L||A||(D=M.getColor(C.rgba,S.rgba)),D===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=v.color.ensureContrastRatio(L||C,A||S,B),M.setColor((L||C).rgba,(A||S).rgba,D??null)}return!!D&&(this._addStyle(x,`color:${D.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,C){x.setAttribute("style",`${x.getAttribute("style")||""}${C};`)}_isCellInSelection(x,C){const S=this._selectionStart,E=this._selectionEnd;return!(!S||!E)&&(this._columnSelectMode?S[0]<=E[0]?x>=S[0]&&C>=S[1]&&x<E[0]&&C<=E[1]:x<S[0]&&C>=S[1]&&x>=E[0]&&C<=E[1]:C>S[1]&&C<E[1]||S[1]===E[1]&&C===S[1]&&x>=S[0]&&x<E[0]||S[1]<E[1]&&C===E[1]&&x<E[0]||S[1]<E[1]&&C===S[1]&&x>=S[0])}};function b(x,C,S){for(;x.length<S;)x=C+x;return x}s.DomRendererRowFactory=w=c([p(1,h.ICharacterJoinerService),p(2,y.IOptionsService),p(3,h.ICoreBrowserService),p(4,y.ICoreService),p(5,y.IDecorationService),p(6,h.IThemeService)],w)},2550:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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 p=o.createElement("span");p.classList.add("xterm-char-measure-element");const u=o.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const f=o.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[p,u,f,_],this._container.appendChild(p),this._container.appendChild(u),this._container.appendChild(f),this._container.appendChild(_),c.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(o,c,p,u){o===this._font&&c===this._fontSize&&p===this._weight&&u===this._weightBold||(this._font=o,this._fontSize=c,this._weight=p,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(o,c,p){let u=0;if(!c&&!p&&o.length===1&&(u=o.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const y=this._measure(o,0);return y>0&&(this._flat[u]=y),y}let f=o;c&&(f+="B"),p&&(f+="I");let _=this._holey.get(f);if(_===void 0){let y=0;c&&(y|=1),p&&(y|=2),_=this._measure(o,y),_>0&&this._holey.set(f,_)}return _}_measure(o,c){const p=this._measureElements[c];return p.textContent=o.repeat(32),p.offsetWidth/32}}},2223:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(l,s)=>{function o(p){return 57508<=p&&p<=57558}function c(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},s.isEmoji=c,s.allowRescaling=function(p,u,f,_){return u===1&&f>Math.ceil(1.5*_)&&p!==void 0&&p>255&&!c(p)&&!o(p)&&!function(y){return 57344<=y&&y<=63743}(p)},s.treatGlyphAsBackgroundColor=function(p){return o(p)||function(u){return 9472<=u&&u<=9631}(p)},s.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}}}},s.computeNextVariantOffset=function(p,u,f=0){return(p-(2*Math.round(u)-f))%(2*Math.round(u))}},6052:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(p,u,f,_=!1){if(this.selectionStart=u,this.selectionEnd=f,!u||!f||u[0]===f[0]&&u[1]===f[1])return void this.clear();const y=p.buffers.active.ydisp,v=u[1]-y,h=f[1]-y,m=Math.max(v,0),d=Math.min(h,p.rows-1);m>=p.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=m,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=f[0])}isCellSelected(p,u,f){return!!this.hasSelection&&(f-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&f>=this.viewportCappedStartRow&&u<this.endCol&&f<=this.viewportCappedEndRow:u<this.startCol&&f>=this.viewportCappedStartRow&&u>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const u=o(2585),f=o(8460),_=o(844);let y=s.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,g,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new h(d,g,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=c([p(2,u.IOptionsService)],y);class v extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(g,w){g!==void 0&&g>0&&w!==void 0&&w>0&&(this._result.width=g,this._result.height=w)}}class h extends v{constructor(g,w,b){super(),this._document=g,this._parentElement=w,this._optionsService=b,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class m extends v{constructor(g){super(),this._optionsService=g,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const g=this._ctx.measureText("W");return this._validateAndSet(g.width,g.fontBoundingBoxAscent+g.fontBoundingBoxDescent),this._result}}},4269:function(l,s,o){var c=this&&this.__decorate||function(m,d,g,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,g):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(m,d,g,w);else for(var S=m.length-1;S>=0;S--)(b=m[S])&&(C=(x<3?b(C):x>3?b(d,g,C):b(d,g))||C);return x>3&&C&&Object.defineProperty(d,g,C),C},p=this&&this.__param||function(m,d){return function(g,w){d(g,w,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const u=o(3734),f=o(643),_=o(511),y=o(2585);class v extends u.AttributeData{constructor(d,g,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=g,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=v;let h=s.CharacterJoinerService=class mw{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(d){const g={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(g),g.id}deregister(d){for(let g=0;g<this._characterJoiners.length;g++)if(this._characterJoiners[g].id===d)return this._characterJoiners.splice(g,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const g=this._bufferService.buffer.lines.get(d);if(!g||g.length===0)return[];const w=[],b=g.translateToString(!0);let x=0,C=0,S=0,E=g.getFg(0),L=g.getBg(0);for(let A=0;A<g.getTrimmedLength();A++)if(g.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==L){if(A-x>1){const M=this._getJoinedRanges(b,S,C,g,x);for(let D=0;D<M.length;D++)w.push(M[D])}x=A,S=C,E=this._workCell.fg,L=this._workCell.bg}C+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const A=this._getJoinedRanges(b,S,C,g,x);for(let M=0;M<A.length;M++)w.push(A[M])}return w}_getJoinedRanges(d,g,w,b,x){const C=d.substring(g,w);let S=[];try{S=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const L=this._characterJoiners[E].handler(C);for(let A=0;A<L.length;A++)mw._mergeRanges(S,L[A])}catch(L){console.error(L)}return this._stringRangesToCellRanges(S,b,x),S}_stringRangesToCellRanges(d,g,w){let b=0,x=!1,C=0,S=d[b];if(S){for(let E=w;E<this._bufferService.cols;E++){const L=g.getWidth(E),A=g.getString(E).length||f.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!x&&S[0]<=C&&(S[0]=E,x=!0),S[1]<=C){if(S[1]=E,S=d[++b],!S)break;S[0]<=C?(S[0]=E,x=!0):x=!1}C+=A}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(d,g){let w=!1;for(let b=0;b<d.length;b++){const x=d[b];if(w){if(g[1]<=x[0])return d[b-1][1]=g[1],d;if(g[1]<=x[1])return d[b-1][1]=Math.max(g[1],x[1]),d.splice(b,1),d;d.splice(b,1),b--}else{if(g[1]<=x[0])return d.splice(b,0,g),d;if(g[1]<=x[1])return x[0]=Math.min(g[0],x[0]),d;g[0]<x[1]&&(x[0]=Math.min(g[0],x[0]),w=!0)}}return w?d[d.length-1][1]=g[1]:d.push(g),d}};s.CharacterJoinerService=h=c([p(0,y.IBufferService)],h)},5114:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;const c=o(844),p=o(8460),u=o(3656);class f extends c.Disposable{constructor(v,h,m){super(),this._textarea=v,this._window=h,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(d=>this._screenDprMonitor.setWindow(d))),this.register((0,p.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(v){this._window!==v&&(this._window=v,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}}s.CoreBrowserService=f;class _ extends c.Disposable{constructor(v){super(),this._parentWindow=v,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)(()=>this.clearListener()))}setWindow(v){this._parentWindow=v,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var v;this._outerListener&&((v=this._resolutionMediaMatchList)==null||v.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:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;const c=o(844);class p extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{const _=this.linkProviders.indexOf(f);_!==-1&&this.linkProviders.splice(_,1)}}}}s.LinkProviderService=p},8934:function(l,s,o){var c=this&&this.__decorate||function(y,v,h,m){var d,g=arguments.length,w=g<3?v:m===null?m=Object.getOwnPropertyDescriptor(v,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,v,h,m);else for(var b=y.length-1;b>=0;b--)(d=y[b])&&(w=(g<3?d(w):g>3?d(v,h,w):d(v,h))||w);return g>3&&w&&Object.defineProperty(v,h,w),w},p=this&&this.__param||function(y,v){return function(h,m){v(h,m,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const u=o(4725),f=o(9806);let _=s.MouseService=class{constructor(y,v){this._renderService=y,this._charSizeService=v}getCoords(y,v,h,m,d){return(0,f.getCoords)(window,y,v,h,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(y,v){const h=(0,f.getCoordsRelativeToElement)(window,y,v);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};s.MouseService=_=c([p(0,u.IRenderService),p(1,u.ICharSizeService)],_)},3230:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const u=o(6193),f=o(4725),_=o(8460),y=o(844),v=o(7226),h=o(2585);let m=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,g,w,b,x,C,S,E){super(),this._rowCount=d,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new v.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer((L,A)=>this._renderRows(L,A),S),this.register(this._renderDebouncer),this.register(S.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var L;return(L=this._renderer.value)==null?void 0:L.clear()})),this.register(w.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(x.onDecorationRegistered(()=>this._fullRefresh())),this.register(x.onDecorationRemoved(()=>this._fullRefresh())),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(S.window,g),this.register(S.onWindowChange(L=>this._registerIntersectionObserver(L,g)))}_registerIntersectionObserver(d,g){if("IntersectionObserver"in d){const w=new d.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});w.observe(g),this._observerDisposable.value=(0,y.toDisposable)(()=>w.disconnect())}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,g,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,g,this._rowCount))}_renderRows(d,g){this._renderer.value&&(d=Math.min(d,this._rowCount-1),g=Math.min(g,this._rowCount-1),this._renderer.value.renderRows(d,g),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:g}),this._onRender.fire({start:d,end:g}),this._isNextRenderRedrawOnly=!0)}resize(d,g){this._rowCount=g,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw(g=>this.refreshRows(g.start,g.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,g;this._renderer.value&&((g=(d=this._renderer.value).clearTextureAtlas)==null||g.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,g){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,g)}):this._renderer.value.handleResize(d,g),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,g,w){var b;this._selectionState.start=d,this._selectionState.end=g,this._selectionState.columnSelectMode=w,(b=this._renderer.value)==null||b.handleSelectionChanged(d,g,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};s.RenderService=m=c([p(2,h.IOptionsService),p(3,f.ICharSizeService),p(4,h.IDecorationService),p(5,h.IBufferService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],m)},9312:function(l,s,o){var c=this&&this.__decorate||function(S,E,L,A){var M,D=arguments.length,B=D<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,E,L,A);else for(var H=S.length-1;H>=0;H--)(M=S[H])&&(B=(D<3?M(B):D>3?M(E,L,B):M(E,L))||B);return D>3&&B&&Object.defineProperty(E,L,B),B},p=this&&this.__param||function(S,E){return function(L,A){E(L,A,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const u=o(9806),f=o(9504),_=o(456),y=o(4725),v=o(8460),h=o(844),m=o(6114),d=o(4841),g=o(511),w=o(2585),b=" ",x=new RegExp(b,"g");let C=s.SelectionService=class extends h.Disposable{constructor(S,E,L,A,M,D,B,H,F){super(),this._element=S,this._screenElement=E,this._linkifier=L,this._bufferService=A,this._coreService=M,this._mouseService=D,this._optionsService=B,this._renderService=H,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new g.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new v.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E||S[0]===E[0]&&S[1]===E[1])}get selectionText(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!S||!E)return"";const L=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const M=S[0]<E[0]?S[0]:E[0],D=S[0]<E[0]?E[0]:S[0];for(let B=S[1];B<=E[1];B++){const H=L.translateBufferLineToString(B,!0,M,D);A.push(H)}}else{const M=S[1]===E[1]?E[0]:void 0;A.push(L.translateBufferLineToString(S[1],!0,S[0],M));for(let D=S[1]+1;D<=E[1]-1;D++){const B=L.lines.get(D),H=L.translateBufferLineToString(D,!0);B!=null&&B.isWrapped?A[A.length-1]+=H:A.push(H)}if(S[1]!==E[1]){const D=L.lines.get(E[1]),B=L.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?A[A.length-1]+=B:A.push(B)}}return A.map(M=>M.replace(x," ")).join(m.isWindows?`\r
|
|
56
|
+
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}s.OscLinkProvider=_=c([p(0,f.IBufferService),p(1,f.IOptionsService),p(2,f.IOscLinkService)],_)},6193:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderDebouncer=void 0,s.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,c,p){this._rowCount=p,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c,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 o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const c=o(3614),p=o(3656),u=o(3551),f=o(9042),_=o(3730),y=o(1680),v=o(3107),h=o(5744),m=o(2950),d=o(1296),g=o(428),w=o(4269),b=o(5114),x=o(8934),C=o(3230),S=o(9312),E=o(4725),L=o(6731),A=o(8055),M=o(8969),D=o(8460),B=o(844),H=o(6114),F=o(8437),$=o(2584),I=o(7399),R=o(5941),P=o(9074),N=o(2585),j=o(5435),U=o(4567),V=o(779);class ee extends M.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(z={}){super(z),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new B.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(V.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((O,K)=>this.refresh(O,K))),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,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(O=>this._afterResize(O.cols,O.rows))),this.register((0,B.toDisposable)(()=>{var O,K;this._customKeyEventHandler=void 0,(K=(O=this.element)==null?void 0:O.parentNode)==null||K.removeChild(this.element)}))}_handleColorEvent(z){if(this._themeService)for(const O of z){let K,W="";switch(O.index){case 256:K="foreground",W="10";break;case 257:K="background",W="11";break;case 258:K="cursor",W="12";break;default:K="ansi",W="4;"+O.index}switch(O.type){case 0:const te=A.color.toColorRGB(K==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[K]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${W};${(0,R.toRgbString)(te)}${$.C1_ESCAPED.ST}`);break;case 1:if(K==="ansi")this._themeService.modifyColors(J=>J.ansi[O.index]=A.channels.toColor(...O.color));else{const J=K;this._themeService.modifyColors(_e=>_e[J]=A.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(z){z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var z;return(z=this.textarea)==null?void 0:z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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 z=this.buffer.ybase+this.buffer.y,O=this.buffer.lines.get(z);if(!O)return;const K=Math.min(this.buffer.x,this.cols-1),W=this._renderService.dimensions.css.cell.height,te=O.getWidth(K),J=this._renderService.dimensions.css.cell.width*te,_e=this.buffer.y*this._renderService.dimensions.css.cell.height,ue=K*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ue+"px",this.textarea.style.top=_e+"px",this.textarea.style.width=J+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",O=>{this.hasSelection()&&(0,c.copyHandler)(O,this._selectionService)}));const z=O=>(0,c.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",z)),this.register((0,p.addDisposableDomListener)(this.element,"paste",z)),H.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",O=>{O.button===2&&(0,c.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",O=>{(0,c.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),H.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",O=>{O.button===1&&(0,c.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",z=>this._keyUp(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",z=>this._keyDown(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",z=>this._keyPress(z),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",z=>this._compositionHelper.compositionupdate(z))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,p.addDisposableDomListener)(this.textarea,"input",z=>this._inputEvent(z),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(z){var K;if(!z)throw new Error("Terminal requires a parent element.");if(z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((K=this.element)==null?void 0:K.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=z.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"),z.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,p.addDisposableDomListener)(this.screenElement,"mousemove",W=>this.updateCursorStyle(W))),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",f.promptLabel),H.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(b.CoreBrowserService,this.textarea,z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",W=>this._handleTextAreaFocus(W))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(g.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(L.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(w.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(W=>this._onRender.fire(W))),this.onResize(W=>this._renderService.resize(W.cols,W.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(x.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.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(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(W=>this.scrollLines(W.amount,W.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(W=>this._renderService.handleSelectionChanged(W.start,W.end,W.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(W=>{this.textarea.value=W,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(W=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(v.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",W=>this._selectionService.handleMouseDown(W))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",W=>this._handleScreenReaderModeOptionChange(W))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",W=>{!this._overviewRulerRenderer&&W&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(d.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const z=this,O=this.element;function K(J){const _e=z._mouseService.getMouseReportCoords(J,z.screenElement);if(!_e)return!1;let ue,se;switch(J.overrideType||J.type){case"mousemove":se=32,J.buttons===void 0?(ue=3,J.button!==void 0&&(ue=J.button<3?J.button:3)):ue=1&J.buttons?0:4&J.buttons?1:2&J.buttons?2:3;break;case"mouseup":se=0,ue=J.button<3?J.button:3;break;case"mousedown":se=1,ue=J.button<3?J.button:3;break;case"wheel":if(z._customWheelEventHandler&&z._customWheelEventHandler(J)===!1||z.viewport.getLinesScrolled(J)===0)return!1;se=J.deltaY<0?0:1,ue=4;break;default:return!1}return!(se===void 0||ue===void 0||ue>4)&&z.coreMouseService.triggerMouseEvent({col:_e.col,row:_e.row,x:_e.x,y:_e.y,button:ue,action:se,ctrl:J.ctrlKey,alt:J.altKey,shift:J.shiftKey})}const W={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:J=>(K(J),J.buttons||(this._document.removeEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.removeEventListener("mousemove",W.mousedrag)),this.cancel(J)),wheel:J=>(K(J),this.cancel(J,!0)),mousedrag:J=>{J.buttons&&K(J)},mousemove:J=>{J.buttons||K(J)}};this.register(this.coreMouseService.onProtocolChange(J=>{J?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(J)),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&J?W.mousemove||(O.addEventListener("mousemove",te.mousemove),W.mousemove=te.mousemove):(O.removeEventListener("mousemove",W.mousemove),W.mousemove=null),16&J?W.wheel||(O.addEventListener("wheel",te.wheel,{passive:!1}),W.wheel=te.wheel):(O.removeEventListener("wheel",W.wheel),W.wheel=null),2&J?W.mouseup||(W.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",W.mouseup),W.mouseup=null),4&J?W.mousedrag||(W.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",W.mousedrag),W.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(O,"mousedown",J=>{if(J.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(J))return K(J),W.mouseup&&this._document.addEventListener("mouseup",W.mouseup),W.mousedrag&&this._document.addEventListener("mousemove",W.mousedrag),this.cancel(J)})),this.register((0,p.addDisposableDomListener)(O,"wheel",J=>{if(!W.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(J)===!1)return!1;if(!this.buffer.hasScrollback){const _e=this.viewport.getLinesScrolled(J);if(_e===0)return;const ue=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(J.deltaY<0?"A":"B");let se="";for(let re=0;re<Math.abs(_e);re++)se+=ue;return this.coreService.triggerDataEvent(se,!0),this.cancel(J,!0)}return this.viewport.handleWheel(J)?this.cancel(J):void 0}},{passive:!1})),this.register((0,p.addDisposableDomListener)(O,"touchstart",J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(J),this.cancel(J)},{passive:!0})),this.register((0,p.addDisposableDomListener)(O,"touchmove",J=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(J)?void 0:this.cancel(J)},{passive:!1}))}refresh(z,O){var K;(K=this._renderService)==null||K.refreshRows(z,O)}updateCursorStyle(z){var O;(O=this._selectionService)!=null&&O.shouldColumnSelect(z)?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(z,O,K=0){var W;K===1?(super.scrollLines(z,O,K),this.refresh(0,this.rows-1)):(W=this.viewport)==null||W.scrollLines(z)}paste(z){(0,c.paste)(z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(z){this._customKeyEventHandler=z}attachCustomWheelEventHandler(z){this._customWheelEventHandler=z}registerLinkProvider(z){return this._linkProviderService.registerLinkProvider(z)}registerCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const O=this._characterJoinerService.register(z);return this.refresh(0,this.rows-1),O}deregisterCharacterJoiner(z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+z)}registerDecoration(z){return this._decorationService.registerDecoration(z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(z,O,K){this._selectionService.setSelection(z,O,K)}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 z;(z=this._selectionService)==null||z.clearSelection()}selectAll(){var z;(z=this._selectionService)==null||z.selectAll()}selectLines(z,O){var K;(K=this._selectionService)==null||K.selectLines(z,O)}_keyDown(z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&z.altKey;if(!O&&!this._compositionHelper.keydown(z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||z.key!=="Dead"&&z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const K=(0,I.evaluateKeyboardEvent)(z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(z),K.type===3||K.type===2){const W=this.rows-1;return this.scrollLines(K.type===2?-W:W),this.cancel(z,!0)}return K.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,z)||(K.cancel&&this.cancel(z,!0),!K.key||!!(z.key&&!z.ctrlKey&&!z.altKey&&!z.metaKey&&z.key.length===1&&z.key.charCodeAt(0)>=65&&z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(K.key!==$.C0.ETX&&K.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:K.key,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(K.key,!0),!this.optionsService.rawOptions.screenReaderMode||z.altKey||z.ctrlKey?this.cancel(z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(z,O){const K=z.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||z.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||z.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?K:K&&(!O.keyCode||O.keyCode>47)}_keyUp(z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1||(function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18}(z)||this.focus(),this.updateCursorStyle(z),this._keyPressHandled=!1)}_keyPress(z){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(z)===!1)return!1;if(this.cancel(z),z.charCode)O=z.charCode;else if(z.which===null||z.which===void 0)O=z.keyCode;else{if(z.which===0||z.charCode===0)return!1;O=z.which}return!(!O||(z.altKey||z.ctrlKey||z.metaKey)&&!this._isThirdLevelShift(this.browser,z)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:z}),this._showCursor(),this.coreService.triggerDataEvent(O,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(z){if(z.data&&z.inputType==="insertText"&&(!z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const O=z.data;return this.coreService.triggerDataEvent(O,!0),this.cancel(z),!0}return!1}resize(z,O){z!==this.cols||O!==this.rows?super.resize(z,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(z,O){var K,W;(K=this._charSizeService)==null||K.measure(),(W=this.viewport)==null||W.syncScrollArea(!0)}clear(){var z;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(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(z=this.viewport)==null||z.reset(),this.refresh(0,this.rows-1)}}reset(){var O,K;this.options.rows=this.rows,this.options.cols=this.cols;const z=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(K=this.viewport)==null||K.reset(),this._customKeyEventHandler=z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var z;(z=this._renderService)==null||z.clearTextureAtlas()}_reportFocus(){var z;(z=this.element)!=null&&z.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(z){if(this._renderService)switch(z){case j.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),K=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${K};${O}t`);break;case j.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const W=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${te};${W}t`)}}cancel(z,O){if(this.options.cancelEvents||O)return z.preventDefault(),z.stopPropagation(),!1}}s.Terminal=ee},9924:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TimeBasedDebouncer=void 0,s.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,p){this._rowCount=p,o=o!==void 0?o:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const f=u-this._lastRefreshMs,_=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(l,s,o){var c=this&&this.__decorate||function(m,d,g,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,g):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(m,d,g,w);else for(var S=m.length-1;S>=0;S--)(b=m[S])&&(C=(x<3?b(C):x>3?b(d,g,C):b(d,g))||C);return x>3&&C&&Object.defineProperty(d,g,C),C},p=this&&this.__param||function(m,d){return function(g,w){d(g,w,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Viewport=void 0;const u=o(3656),f=o(4725),_=o(8460),y=o(844),v=o(2585);let h=s.Viewport=class extends y.Disposable{constructor(m,d,g,w,b,x,C,S){super(),this._viewportElement=m,this._scrollArea=d,this._bufferService=g,this._optionsService=w,this._charSizeService=b,this._renderService=x,this._coreBrowserService=C,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 _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(S.colors),this.register(S.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(m){this._viewportElement.style.backgroundColor=m.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const d=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==d&&(this._lastRecordedBufferHeight=d,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const d=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:d,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(m,d){const g=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(d<0&&this._viewportElement.scrollTop!==0||d>0&&g<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const d=this._getPixelsScrolled(m);return d!==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+d:this._smoothScrollState.target+=d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=d,this._bubbleScroll(m,d))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const d=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+d,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let d=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?d*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._currentRowHeight*this._bufferService.rows),d}getBufferElements(m,d){var S;let g,w="";const b=[],x=d??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let E=m;E<x;E++){const L=C.get(E);if(!L)continue;const A=(S=C.get(E+1))==null?void 0:S.isWrapped;if(w+=L.translateToString(!A),!A||E===C.length-1){const M=document.createElement("div");M.textContent=w,b.push(M),w.length>0&&(g=M),w=""}}return{bufferElements:b,cursorElement:g}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let d=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(d/=this._currentRowHeight+0,this._wheelPartialScroll+=d,d=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(d*=this._bufferService.rows),d}_applyScrollModifier(m,d){const g=this._optionsService.rawOptions.fastScrollModifier;return g==="alt"&&d.altKey||g==="ctrl"&&d.ctrlKey||g==="shift"&&d.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const d=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,d!==0&&(this._viewportElement.scrollTop+=d,this._bubbleScroll(m,d))}};s.Viewport=h=c([p(2,v.IBufferService),p(3,v.IOptionsService),p(4,f.ICharSizeService),p(5,f.IRenderService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],h)},3107:function(l,s,o){var c=this&&this.__decorate||function(v,h,m,d){var g,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,m,d);else for(var x=v.length-1;x>=0;x--)(g=v[x])&&(b=(w<3?g(b):w>3?g(h,m,b):g(h,m))||b);return w>3&&b&&Object.defineProperty(h,m,b),b},p=this&&this.__param||function(v,h){return function(m,d){h(m,d,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferDecorationRenderer=void 0;const u=o(4725),f=o(844),_=o(2585);let y=s.BufferDecorationRenderer=class extends f.Disposable{constructor(v,h,m,d,g){super(),this._screenElement=v,this._bufferService=h,this._coreBrowserService=m,this._decorationService=d,this._renderService=g,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(w=>this._removeDecoration(w))),this.register((0,f.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 v of this._decorationService.decorations)this._renderDecoration(v);this._dimensionsChanged=!1}_renderDecoration(v){this._refreshStyle(v),this._dimensionsChanged&&this._refreshXPosition(v)}_createElement(v){var d;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((d=v==null?void 0:v.options)==null?void 0:d.layer)==="top"),h.style.width=`${Math.round((v.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(v.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(v.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=v.options.x??0;return m&&m>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(v,h),h}_refreshStyle(v){const h=v.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)v.element&&(v.element.style.display="none",v.onRenderEmitter.fire(v.element));else{let m=this._decorationElements.get(v);m||(m=this._createElement(v),v.element=m,this._decorationElements.set(v,m),this._container.appendChild(m),v.onDispose(()=>{this._decorationElements.delete(v),m.remove()})),m.style.top=h*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",v.onRenderEmitter.fire(m)}}_refreshXPosition(v,h=v.element){if(!h)return;const m=v.options.x??0;(v.options.anchor||"left")==="right"?h.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(v){var h;(h=this._decorationElements.get(v))==null||h.remove(),this._decorationElements.delete(v),v.dispose()}};s.BufferDecorationRenderer=y=c([p(1,_.IBufferService),p(2,u.ICoreBrowserService),p(3,_.IDecorationService),p(4,u.IRenderService)],y)},5871:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorZoneStore=void 0,s.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(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,p){return c>=o.startBufferLine-this._linePadding[p||"full"]&&c<=o.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(l,s,o){var c=this&&this.__decorate||function(g,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,w,b,x);else for(var L=g.length-1;L>=0;L--)(C=g[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},p=this&&this.__param||function(g,w){return function(b,x){w(b,x,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OverviewRulerRenderer=void 0;const u=o(5871),f=o(4725),_=o(844),y=o(2585),v={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let d=s.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(g,w,b,x,C,S,E){var A;super(),this._viewportElement=g,this._screenElement=w,this._bufferService=b,this._decorationService=x,this._renderService=C,this._optionsService=S,this._coreBrowserService=E,this._colorZoneStore=new u.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(),(A=this._viewportElement.parentElement)==null||A.insertBefore(this._canvas,this._viewportElement);const L=this._canvas.getContext("2d");if(!L)throw new Error("Ctx cannot be null");this._ctx=L,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)(()=>{var M;(M=this._canvas)==null||M.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 g=Math.floor(this._canvas.width/3),w=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=g,h.center=w,h.right=g,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=h.left,m.right=h.left+h.center}_refreshDrawHeightConstants(){v.full=Math.round(2*this._coreBrowserService.dpr);const g=this._canvas.height/this._bufferService.buffer.lines.length,w=Math.round(Math.max(Math.min(g,12),6)*this._coreBrowserService.dpr);v.left=w,v.center=w,v.right=w}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v.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 w of this._decorationService.decorations)this._colorZoneStore.addDecoration(w);this._ctx.lineWidth=1;const g=this._colorZoneStore.zones;for(const w of g)w.position!=="full"&&this._renderColorZone(w);for(const w of g)w.position==="full"&&this._renderColorZone(w);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(g){this._ctx.fillStyle=g.color,this._ctx.fillRect(m[g.position||"full"],Math.round((this._canvas.height-1)*(g.startBufferLine/this._bufferService.buffers.active.lines.length)-v[g.position||"full"]/2),h[g.position||"full"],Math.round((this._canvas.height-1)*((g.endBufferLine-g.startBufferLine)/this._bufferService.buffers.active.lines.length)+v[g.position||"full"]))}_queueRefresh(g,w){this._shouldUpdateDimensions=g||this._shouldUpdateDimensions,this._shouldUpdateAnchor=w||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};s.OverviewRulerRenderer=d=c([p(2,y.IBufferService),p(3,y.IDecorationService),p(4,f.IRenderService),p(5,y.IOptionsService),p(6,f.ICoreBrowserService)],d)},2950:function(l,s,o){var c=this&&this.__decorate||function(v,h,m,d){var g,w=arguments.length,b=w<3?h:d===null?d=Object.getOwnPropertyDescriptor(h,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(v,h,m,d);else for(var x=v.length-1;x>=0;x--)(g=v[x])&&(b=(w<3?g(b):w>3?g(h,m,b):g(h,m))||b);return w>3&&b&&Object.defineProperty(h,m,b),b},p=this&&this.__param||function(v,h){return function(m,d){h(m,d,v)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompositionHelper=void 0;const u=o(4725),f=o(2585),_=o(2584);let y=s.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(v,h,m,d,g,w){this._textarea=v,this._compositionView=h,this._bufferService=m,this._optionsService=d,this._coreService=g,this._renderService=w,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(v){this._compositionView.textContent=v.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(v){if(this._isComposing||this._isSendingComposition){if(v.keyCode===229||v.keyCode===16||v.keyCode===17||v.keyCode===18)return!1;this._finalizeComposition(!1)}return v.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(v){if(this._compositionView.classList.remove("active"),this._isComposing=!1,v){const h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}},0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const v=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const h=this._textarea.value,m=h.replace(v,"");this._dataAlreadySent=m,h.length>v.length?this._coreService.triggerDataEvent(m,!0):h.length<v.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):h.length===v.length&&h!==v&&this._coreService.triggerDataEvent(h,!0)}},0)}updateCompositionElements(v){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,d=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,g=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=g+"px",this._compositionView.style.top=d+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const w=this._compositionView.getBoundingClientRect();this._textarea.style.left=g+"px",this._textarea.style.top=d+"px",this._textarea.style.width=Math.max(w.width,1)+"px",this._textarea.style.height=Math.max(w.height,1)+"px",this._textarea.style.lineHeight=w.height+"px"}v||setTimeout(()=>this.updateCompositionElements(!0),0)}}};s.CompositionHelper=y=c([p(2,f.IBufferService),p(3,f.IOptionsService),p(4,f.ICoreService),p(5,u.IRenderService)],y)},9806:(l,s)=>{function o(c,p,u){const f=u.getBoundingClientRect(),_=c.getComputedStyle(u),y=parseInt(_.getPropertyValue("padding-left")),v=parseInt(_.getPropertyValue("padding-top"));return[p.clientX-f.left-y,p.clientY-f.top-v]}Object.defineProperty(s,"__esModule",{value:!0}),s.getCoords=s.getCoordsRelativeToElement=void 0,s.getCoordsRelativeToElement=o,s.getCoords=function(c,p,u,f,_,y,v,h,m){if(!y)return;const d=o(c,p,u);return d?(d[0]=Math.ceil((d[0]+(m?v/2:0))/v),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),f+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),_),d):void 0}},9504:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.moveToCellSequence=void 0;const c=o(2584);function p(h,m,d,g){const w=h-u(h,d),b=m-u(m,d),x=Math.abs(w-b)-function(C,S,E){let L=0;const A=C-u(C,E),M=S-u(S,E);for(let D=0;D<Math.abs(A-M);D++){const B=f(C,S)==="A"?-1:1,H=E.buffer.lines.get(A+B*D);H!=null&&H.isWrapped&&L++}return L}(h,m,d);return v(x,y(f(h,m),g))}function u(h,m){let d=0,g=m.buffer.lines.get(h),w=g==null?void 0:g.isWrapped;for(;w&&h>=0&&h<m.rows;)d++,g=m.buffer.lines.get(--h),w=g==null?void 0:g.isWrapped;return d}function f(h,m){return h>m?"A":"B"}function _(h,m,d,g,w,b){let x=h,C=m,S="";for(;x!==d||C!==g;)x+=w?1:-1,w&&x>b.cols-1?(S+=b.buffer.translateBufferLineToString(C,!1,h,x),x=0,h=0,C++):!w&&x<0&&(S+=b.buffer.translateBufferLineToString(C,!1,0,h+1),x=b.cols-1,h=x,C--);return S+b.buffer.translateBufferLineToString(C,!1,h,x)}function y(h,m){const d=m?"O":"[";return c.C0.ESC+d+h}function v(h,m){h=Math.floor(h);let d="";for(let g=0;g<h;g++)d+=m;return d}s.moveToCellSequence=function(h,m,d,g){const w=d.buffer.x,b=d.buffer.y;if(!d.buffer.hasScrollback)return function(S,E,L,A,M,D){return p(E,A,M,D).length===0?"":v(_(S,E,S,E-u(E,M),!1,M).length,y("D",D))}(w,b,0,m,d,g)+p(b,m,d,g)+function(S,E,L,A,M,D){let B;B=p(E,A,M,D).length>0?A-u(A,M):E;const H=A,F=function($,I,R,P,N,j){let U;return U=p(R,P,N,j).length>0?P-u(P,N):I,$<R&&U<=P||$>=R&&U<P?"C":"D"}(S,E,L,A,M,D);return v(_(S,B,L,H,F==="C",M).length,y(F,D))}(w,b,h,m,d,g);let x;if(b===m)return x=w>h?"D":"C",v(Math.abs(w-h),y(x,g));x=b>m?"D":"C";const C=Math.abs(b-m);return v(function(S,E){return E.cols-S}(b>m?h:w,d)+(C-1)*d.cols+1+((b>m?w:h)-1),y(x,g))}},1296:function(l,s,o){var c=this&&this.__decorate||function(D,B,H,F){var $,I=arguments.length,R=I<3?B:F===null?F=Object.getOwnPropertyDescriptor(B,H):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(D,B,H,F);else for(var P=D.length-1;P>=0;P--)($=D[P])&&(R=(I<3?$(R):I>3?$(B,H,R):$(B,H))||R);return I>3&&R&&Object.defineProperty(B,H,R),R},p=this&&this.__param||function(D,B){return function(H,F){B(H,F,D)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRenderer=void 0;const u=o(3787),f=o(2550),_=o(2223),y=o(6171),v=o(6052),h=o(4725),m=o(8055),d=o(8460),g=o(844),w=o(2585),b="xterm-dom-renderer-owner-",x="xterm-rows",C="xterm-fg-",S="xterm-bg-",E="xterm-focus",L="xterm-selection";let A=1,M=s.DomRenderer=class extends g.Disposable{constructor(D,B,H,F,$,I,R,P,N,j,U,V,ee){super(),this._terminal=D,this._document=B,this._element=H,this._screenElement=F,this._viewportElement=$,this._helperContainer=I,this._linkifier2=R,this._charSizeService=N,this._optionsService=j,this._bufferService=U,this._coreBrowserService=V,this._themeService=ee,this._terminalClass=A++,this._rowElements=[],this._selectionRenderModel=(0,v.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(x),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(L),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(Q=>this._injectCss(Q))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(b+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(Q=>this._handleLinkHover(Q))),this.register(this._linkifier2.onHideLinkUnderline(Q=>this._handleLinkLeave(Q))),this.register((0,g.toDisposable)(()=>{this._element.classList.remove(b+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new f.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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const B=`${this._terminalSelector} .${x} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=B,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let B=`${this._terminalSelector} .${x} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;B+=`${this._terminalSelector} .${x} .xterm-dim { color: ${m.color.multiplyOpacity(D.foreground,.5).css};}`,B+=`${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 H=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,$=`blink_block_${this._terminalClass}`;B+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,B+=`@keyframes ${F} { 50% { box-shadow: none; }}`,B+=`@keyframes ${$} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,B+=`${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${x}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${x} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,B+=`${this._terminalSelector} .${L} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${L} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${L} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[I,R]of D.ansi.entries())B+=`${this._terminalSelector} .${C}${I} { color: ${R.css}; }${this._terminalSelector} .${C}${I}.xterm-dim { color: ${m.color.multiplyOpacity(R,.5).css}; }${this._terminalSelector} .${S}${I} { background-color: ${R.css}; }`;B+=`${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${S}${_.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=B}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,B){for(let H=this._rowElements.length;H<=B;H++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>B;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,B){this._refreshRowElements(D,B),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,B,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,B,H),this.renderRows(0,this._bufferService.rows-1),!D||!B)return;this._selectionRenderModel.update(this._terminal,D,B,H);const F=this._selectionRenderModel.viewportStartRow,$=this._selectionRenderModel.viewportEndRow,I=this._selectionRenderModel.viewportCappedStartRow,R=this._selectionRenderModel.viewportCappedEndRow;if(I>=this._bufferService.rows||R<0)return;const P=this._document.createDocumentFragment();if(H){const N=D[0]>B[0];P.appendChild(this._createSelectionElement(I,N?B[0]:D[0],N?D[0]:B[0],R-I+1))}else{const N=F===I?D[0]:0,j=I===$?B[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(I,N,j));const U=R-I-1;if(P.appendChild(this._createSelectionElement(I+1,0,this._bufferService.cols,U)),I!==R){const V=$===R?B[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(R,0,V))}}this._selectionContainer.appendChild(P)}_createSelectionElement(D,B,H,F=1){const $=this._document.createElement("div"),I=B*this.dimensions.css.cell.width;let R=this.dimensions.css.cell.width*(H-B);return I+R>this.dimensions.css.canvas.width&&(R=this.dimensions.css.canvas.width-I),$.style.height=F*this.dimensions.css.cell.height+"px",$.style.top=D*this.dimensions.css.cell.height+"px",$.style.left=`${I}px`,$.style.width=`${R}px`,$}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 D of this._rowElements)D.replaceChildren()}renderRows(D,B){const H=this._bufferService.buffer,F=H.ybase+H.y,$=Math.min(H.x,this._bufferService.cols-1),I=this._optionsService.rawOptions.cursorBlink,R=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let N=D;N<=B;N++){const j=N+H.ydisp,U=this._rowElements[N],V=H.lines.get(j);if(!U||!V)break;U.replaceChildren(...this._rowFactory.createRow(V,j,j===F,R,P,$,I,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${b}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,B,H,F,$,I){H<0&&(D=0),F<0&&(B=0);const R=this._bufferService.rows-1;H=Math.max(Math.min(H,R),0),F=Math.max(Math.min(F,R),0),$=Math.min($,this._bufferService.cols);const P=this._bufferService.buffer,N=P.ybase+P.y,j=Math.min(P.x,$-1),U=this._optionsService.rawOptions.cursorBlink,V=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let Q=H;Q<=F;++Q){const z=Q+P.ydisp,O=this._rowElements[Q],K=P.lines.get(z);if(!O||!K)break;O.replaceChildren(...this._rowFactory.createRow(K,z,z===N,V,ee,j,U,this.dimensions.css.cell.width,this._widthCache,I?Q===H?D:0:-1,I?(Q===F?B:$)-1:-1))}}};s.DomRenderer=M=c([p(7,w.IInstantiationService),p(8,h.ICharSizeService),p(9,w.IOptionsService),p(10,w.IBufferService),p(11,h.ICoreBrowserService),p(12,h.IThemeService)],M)},3787:function(l,s,o){var c=this&&this.__decorate||function(x,C,S,E){var L,A=arguments.length,M=A<3?C:E===null?E=Object.getOwnPropertyDescriptor(C,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,C,S,E);else for(var D=x.length-1;D>=0;D--)(L=x[D])&&(M=(A<3?L(M):A>3?L(C,S,M):L(C,S))||M);return A>3&&M&&Object.defineProperty(C,S,M),M},p=this&&this.__param||function(x,C){return function(S,E){C(S,E,x)}};Object.defineProperty(s,"__esModule",{value:!0}),s.DomRendererRowFactory=void 0;const u=o(2223),f=o(643),_=o(511),y=o(2585),v=o(8055),h=o(4725),m=o(4269),d=o(6171),g=o(3734);let w=s.DomRendererRowFactory=class{constructor(x,C,S,E,L,A,M){this._document=x,this._characterJoinerService=C,this._optionsService=S,this._coreBrowserService=E,this._coreService=L,this._decorationService=A,this._themeService=M,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(x,C,S){this._selectionStart=x,this._selectionEnd=C,this._columnSelectMode=S}createRow(x,C,S,E,L,A,M,D,B,H,F){const $=[],I=this._characterJoinerService.getJoinedCharacters(C),R=this._themeService.colors;let P,N=x.getNoBgTrimmedLength();S&&N<A+1&&(N=A+1);let j=0,U="",V=0,ee=0,Q=0,z=!1,O=0,K=!1,W=0;const te=[],J=H!==-1&&F!==-1;for(let _e=0;_e<N;_e++){x.loadCell(_e,this._workCell);let ue=this._workCell.getWidth();if(ue===0)continue;let se=!1,re=_e,ae=this._workCell;if(I.length>0&&_e===I[0][0]){se=!0;const Y=I.shift();ae=new m.JoinedCellData(this._workCell,x.translateToString(!0,Y[0],Y[1]),Y[1]-Y[0]),re=Y[1]-1,ue=ae.getWidth()}const ye=this._isCellInSelection(_e,C),ve=S&&_e===A,ne=J&&_e>=H&&_e<=F;let ie=!1;this._decorationService.forEachDecorationAtCell(_e,C,void 0,Y=>{ie=!0});let he=ae.getChars()||f.WHITESPACE_CELL_CHAR;if(he===" "&&(ae.isUnderline()||ae.isOverline())&&(he=" "),W=ue*D-B.get(he,ae.isBold(),ae.isItalic()),P){if(j&&(ye&&K||!ye&&!K&&ae.bg===V)&&(ye&&K&&R.selectionForeground||ae.fg===ee)&&ae.extended.ext===Q&&ne===z&&W===O&&!ve&&!se&&!ie){ae.isInvisible()?U+=f.WHITESPACE_CELL_CHAR:U+=he,j++;continue}j&&(P.textContent=U),P=this._document.createElement("span"),j=0,U=""}else P=this._document.createElement("span");if(V=ae.bg,ee=ae.fg,Q=ae.extended.ext,z=ne,O=W,K=ye,se&&A>=_e&&A<=re&&(A=_e),!this._coreService.isCursorHidden&&ve&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)M&&te.push("xterm-cursor-blink"),te.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(L)switch(L){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(ae.isBold()&&te.push("xterm-bold"),ae.isItalic()&&te.push("xterm-italic"),ae.isDim()&&te.push("xterm-dim"),U=ae.isInvisible()?f.WHITESPACE_CELL_CHAR:ae.getChars()||f.WHITESPACE_CELL_CHAR,ae.isUnderline()&&(te.push(`xterm-underline-${ae.extended.underlineStyle}`),U===" "&&(U=" "),!ae.isUnderlineColorDefault()))if(ae.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${g.AttributeData.toColorRGB(ae.getUnderlineColor()).join(",")})`;else{let Y=ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ae.isBold()&&Y<8&&(Y+=8),P.style.textDecorationColor=R.ansi[Y].css}ae.isOverline()&&(te.push("xterm-overline"),U===" "&&(U=" ")),ae.isStrikethrough()&&te.push("xterm-strikethrough"),ne&&(P.style.textDecoration="underline");let oe=ae.getFgColor(),me=ae.getFgColorMode(),xe=ae.getBgColor(),ke=ae.getBgColorMode();const Ne=!!ae.isInverse();if(Ne){const Y=oe;oe=xe,xe=Y;const Oe=me;me=ke,ke=Oe}let Ke,Ae,Pe,G=!1;switch(this._decorationService.forEachDecorationAtCell(_e,C,void 0,Y=>{Y.options.layer!=="top"&&G||(Y.backgroundColorRGB&&(ke=50331648,xe=Y.backgroundColorRGB.rgba>>8&16777215,Ke=Y.backgroundColorRGB),Y.foregroundColorRGB&&(me=50331648,oe=Y.foregroundColorRGB.rgba>>8&16777215,Ae=Y.foregroundColorRGB),G=Y.options.layer==="top")}),!G&&ye&&(Ke=this._coreBrowserService.isFocused?R.selectionBackgroundOpaque:R.selectionInactiveBackgroundOpaque,xe=Ke.rgba>>8&16777215,ke=50331648,G=!0,R.selectionForeground&&(me=50331648,oe=R.selectionForeground.rgba>>8&16777215,Ae=R.selectionForeground)),G&&te.push("xterm-decoration-top"),ke){case 16777216:case 33554432:Pe=R.ansi[xe],te.push(`xterm-bg-${xe}`);break;case 50331648:Pe=v.channels.toColor(xe>>16,xe>>8&255,255&xe),this._addStyle(P,`background-color:#${b((xe>>>0).toString(16),"0",6)}`);break;default:Ne?(Pe=R.foreground,te.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):Pe=R.background}switch(Ke||ae.isDim()&&(Ke=v.color.multiplyOpacity(Pe,.5)),me){case 16777216:case 33554432:ae.isBold()&&oe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(oe+=8),this._applyMinimumContrast(P,Pe,R.ansi[oe],ae,Ke,void 0)||te.push(`xterm-fg-${oe}`);break;case 50331648:const Y=v.channels.toColor(oe>>16&255,oe>>8&255,255&oe);this._applyMinimumContrast(P,Pe,Y,ae,Ke,Ae)||this._addStyle(P,`color:#${b(oe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,Pe,R.foreground,ae,Ke,Ae)||Ne&&te.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}te.length&&(P.className=te.join(" "),te.length=0),ve||se||ie?P.textContent=U:j++,W!==this.defaultSpacing&&(P.style.letterSpacing=`${W}px`),$.push(P),_e=re}return P&&j&&(P.textContent=U),$}_applyMinimumContrast(x,C,S,E,L,A){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,d.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const M=this._getContrastCache(E);let D;if(L||A||(D=M.getColor(C.rgba,S.rgba)),D===void 0){const B=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=v.color.ensureContrastRatio(L||C,A||S,B),M.setColor((L||C).rgba,(A||S).rgba,D??null)}return!!D&&(this._addStyle(x,`color:${D.css}`),!0)}_getContrastCache(x){return x.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(x,C){x.setAttribute("style",`${x.getAttribute("style")||""}${C};`)}_isCellInSelection(x,C){const S=this._selectionStart,E=this._selectionEnd;return!(!S||!E)&&(this._columnSelectMode?S[0]<=E[0]?x>=S[0]&&C>=S[1]&&x<E[0]&&C<=E[1]:x<S[0]&&C>=S[1]&&x>=E[0]&&C<=E[1]:C>S[1]&&C<E[1]||S[1]===E[1]&&C===S[1]&&x>=S[0]&&x<E[0]||S[1]<E[1]&&C===E[1]&&x<E[0]||S[1]<E[1]&&C===S[1]&&x>=S[0])}};function b(x,C,S){for(;x.length<S;)x=C+x;return x}s.DomRendererRowFactory=w=c([p(1,h.ICharacterJoinerService),p(2,y.IOptionsService),p(3,h.ICoreBrowserService),p(4,y.ICoreService),p(5,y.IDecorationService),p(6,h.IThemeService)],w)},2550:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WidthCache=void 0,s.WidthCache=class{constructor(o,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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 p=o.createElement("span");p.classList.add("xterm-char-measure-element");const u=o.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const f=o.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";const _=o.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[p,u,f,_],this._container.appendChild(p),this._container.appendChild(u),this._container.appendChild(f),this._container.appendChild(_),c.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(o,c,p,u){o===this._font&&c===this._fontSize&&p===this._weight&&u===this._weightBold||(this._font=o,this._fontSize=c,this._weight=p,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(o,c,p){let u=0;if(!c&&!p&&o.length===1&&(u=o.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const y=this._measure(o,0);return y>0&&(this._flat[u]=y),y}let f=o;c&&(f+="B"),p&&(f+="I");let _=this._holey.get(f);if(_===void 0){let y=0;c&&(y|=1),p&&(y|=2),_=this._measure(o,y),_>0&&this._holey.set(f,_)}return _}_measure(o,c){const p=this._measureElements[c];return p.textContent=o.repeat(32),p.offsetWidth/32}}},2223:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(l,s)=>{function o(p){return 57508<=p&&p<=57558}function c(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},s.isEmoji=c,s.allowRescaling=function(p,u,f,_){return u===1&&f>Math.ceil(1.5*_)&&p!==void 0&&p>255&&!c(p)&&!o(p)&&!function(y){return 57344<=y&&y<=63743}(p)},s.treatGlyphAsBackgroundColor=function(p){return o(p)||function(u){return 9472<=u&&u<=9631}(p)},s.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}}}},s.computeNextVariantOffset=function(p,u,f=0){return(p-(2*Math.round(u)-f))%(2*Math.round(u))}},6052:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(p,u,f,_=!1){if(this.selectionStart=u,this.selectionEnd=f,!u||!f||u[0]===f[0]&&u[1]===f[1])return void this.clear();const y=p.buffers.active.ydisp,v=u[1]-y,h=f[1]-y,m=Math.max(v,0),d=Math.min(h,p.rows-1);m>=p.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=m,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=f[0])}isCellSelected(p,u,f){return!!this.hasSelection&&(f-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&f>=this.viewportCappedStartRow&&u<this.endCol&&f<=this.viewportCappedEndRow:u<this.startCol&&f>=this.viewportCappedStartRow&&u>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},456:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionModel=void 0,s.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharSizeService=void 0;const u=o(2585),f=o(8460),_=o(844);let y=s.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(d,g,w){super(),this._optionsService=w,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new h(d,g,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const d=this._measureStrategy.measure();d.width===this.width&&d.height===this.height||(this.width=d.width,this.height=d.height,this._onCharSizeChange.fire())}};s.CharSizeService=y=c([p(2,u.IOptionsService)],y);class v extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(g,w){g!==void 0&&g>0&&w!==void 0&&w>0&&(this._result.width=g,this._result.height=w)}}class h extends v{constructor(g,w,b){super(),this._document=g,this._parentElement=w,this._optionsService=b,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class m extends v{constructor(g){super(),this._optionsService=g,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const w=this._ctx.measureText("W");if(!("width"in w&&"fontBoundingBoxAscent"in w&&"fontBoundingBoxDescent"in w))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const g=this._ctx.measureText("W");return this._validateAndSet(g.width,g.fontBoundingBoxAscent+g.fontBoundingBoxDescent),this._result}}},4269:function(l,s,o){var c=this&&this.__decorate||function(m,d,g,w){var b,x=arguments.length,C=x<3?d:w===null?w=Object.getOwnPropertyDescriptor(d,g):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(m,d,g,w);else for(var S=m.length-1;S>=0;S--)(b=m[S])&&(C=(x<3?b(C):x>3?b(d,g,C):b(d,g))||C);return x>3&&C&&Object.defineProperty(d,g,C),C},p=this&&this.__param||function(m,d){return function(g,w){d(g,w,m)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CharacterJoinerService=s.JoinedCellData=void 0;const u=o(3734),f=o(643),_=o(511),y=o(2585);class v extends u.AttributeData{constructor(d,g,w){super(),this.content=0,this.combinedData="",this.fg=d.fg,this.bg=d.bg,this.combinedData=g,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(d){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.JoinedCellData=v;let h=s.CharacterJoinerService=class mw{constructor(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(d){const g={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(g),g.id}deregister(d){for(let g=0;g<this._characterJoiners.length;g++)if(this._characterJoiners[g].id===d)return this._characterJoiners.splice(g,1),!0;return!1}getJoinedCharacters(d){if(this._characterJoiners.length===0)return[];const g=this._bufferService.buffer.lines.get(d);if(!g||g.length===0)return[];const w=[],b=g.translateToString(!0);let x=0,C=0,S=0,E=g.getFg(0),L=g.getBg(0);for(let A=0;A<g.getTrimmedLength();A++)if(g.loadCell(A,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==L){if(A-x>1){const M=this._getJoinedRanges(b,S,C,g,x);for(let D=0;D<M.length;D++)w.push(M[D])}x=A,S=C,E=this._workCell.fg,L=this._workCell.bg}C+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-x>1){const A=this._getJoinedRanges(b,S,C,g,x);for(let M=0;M<A.length;M++)w.push(A[M])}return w}_getJoinedRanges(d,g,w,b,x){const C=d.substring(g,w);let S=[];try{S=this._characterJoiners[0].handler(C)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const L=this._characterJoiners[E].handler(C);for(let A=0;A<L.length;A++)mw._mergeRanges(S,L[A])}catch(L){console.error(L)}return this._stringRangesToCellRanges(S,b,x),S}_stringRangesToCellRanges(d,g,w){let b=0,x=!1,C=0,S=d[b];if(S){for(let E=w;E<this._bufferService.cols;E++){const L=g.getWidth(E),A=g.getString(E).length||f.WHITESPACE_CELL_CHAR.length;if(L!==0){if(!x&&S[0]<=C&&(S[0]=E,x=!0),S[1]<=C){if(S[1]=E,S=d[++b],!S)break;S[0]<=C?(S[0]=E,x=!0):x=!1}C+=A}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(d,g){let w=!1;for(let b=0;b<d.length;b++){const x=d[b];if(w){if(g[1]<=x[0])return d[b-1][1]=g[1],d;if(g[1]<=x[1])return d[b-1][1]=Math.max(g[1],x[1]),d.splice(b,1),d;d.splice(b,1),b--}else{if(g[1]<=x[0])return d.splice(b,0,g),d;if(g[1]<=x[1])return x[0]=Math.min(g[0],x[0]),d;g[0]<x[1]&&(x[0]=Math.min(g[0],x[0]),w=!0)}}return w?d[d.length-1][1]=g[1]:d.push(g),d}};s.CharacterJoinerService=h=c([p(0,y.IBufferService)],h)},5114:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreBrowserService=void 0;const c=o(844),p=o(8460),u=o(3656);class f extends c.Disposable{constructor(v,h,m){super(),this._textarea=v,this._window=h,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(d=>this._screenDprMonitor.setWindow(d))),this.register((0,p.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(v){this._window!==v&&(this._window=v,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}}s.CoreBrowserService=f;class _ extends c.Disposable{constructor(v){super(),this._parentWindow=v,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)(()=>this.clearListener()))}setWindow(v){this._parentWindow=v,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var v;this._outerListener&&((v=this._resolutionMediaMatchList)==null||v.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:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkProviderService=void 0;const c=o(844);class p extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{const _=this.linkProviders.indexOf(f);_!==-1&&this.linkProviders.splice(_,1)}}}}s.LinkProviderService=p},8934:function(l,s,o){var c=this&&this.__decorate||function(y,v,h,m){var d,g=arguments.length,w=g<3?v:m===null?m=Object.getOwnPropertyDescriptor(v,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(y,v,h,m);else for(var b=y.length-1;b>=0;b--)(d=y[b])&&(w=(g<3?d(w):g>3?d(v,h,w):d(v,h))||w);return g>3&&w&&Object.defineProperty(v,h,w),w},p=this&&this.__param||function(y,v){return function(h,m){v(h,m,y)}};Object.defineProperty(s,"__esModule",{value:!0}),s.MouseService=void 0;const u=o(4725),f=o(9806);let _=s.MouseService=class{constructor(y,v){this._renderService=y,this._charSizeService=v}getCoords(y,v,h,m,d){return(0,f.getCoords)(window,y,v,h,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,d)}getMouseReportCoords(y,v){const h=(0,f.getCoordsRelativeToElement)(window,y,v);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};s.MouseService=_=c([p(0,u.IRenderService),p(1,u.ICharSizeService)],_)},3230:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.RenderService=void 0;const u=o(6193),f=o(4725),_=o(8460),y=o(844),v=o(7226),h=o(2585);let m=s.RenderService=class extends y.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(d,g,w,b,x,C,S,E){super(),this._rowCount=d,this._charSizeService=b,this._renderer=this.register(new y.MutableDisposable),this._pausedResizeTask=new v.DebouncedIdleTask,this._observerDisposable=this.register(new y.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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer((L,A)=>this._renderRows(L,A),S),this.register(this._renderDebouncer),this.register(S.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var L;return(L=this._renderer.value)==null?void 0:L.clear()})),this.register(w.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(x.onDecorationRegistered(()=>this._fullRefresh())),this.register(x.onDecorationRemoved(()=>this._fullRefresh())),this.register(w.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(w.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(S.window,g),this.register(S.onWindowChange(L=>this._registerIntersectionObserver(L,g)))}_registerIntersectionObserver(d,g){if("IntersectionObserver"in d){const w=new d.IntersectionObserver(b=>this._handleIntersectionChange(b[b.length-1]),{threshold:0});w.observe(g),this._observerDisposable.value=(0,y.toDisposable)(()=>w.disconnect())}}_handleIntersectionChange(d){this._isPaused=d.isIntersecting===void 0?d.intersectionRatio===0:!d.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(d,g,w=!1){this._isPaused?this._needsFullRefresh=!0:(w||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(d,g,this._rowCount))}_renderRows(d,g){this._renderer.value&&(d=Math.min(d,this._rowCount-1),g=Math.min(g,this._rowCount-1),this._renderer.value.renderRows(d,g),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:d,end:g}),this._onRender.fire({start:d,end:g}),this._isNextRenderRedrawOnly=!0)}resize(d,g){this._rowCount=g,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(d){this._renderer.value=d,this._renderer.value&&(this._renderer.value.onRequestRedraw(g=>this.refreshRows(g.start,g.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(d){return this._renderDebouncer.addRefreshCallback(d)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var d,g;this._renderer.value&&((g=(d=this._renderer.value).clearTextureAtlas)==null||g.call(d),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(d,g){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var w;return(w=this._renderer.value)==null?void 0:w.handleResize(d,g)}):this._renderer.value.handleResize(d,g),this._fullRefresh())}handleCharSizeChanged(){var d;(d=this._renderer.value)==null||d.handleCharSizeChanged()}handleBlur(){var d;(d=this._renderer.value)==null||d.handleBlur()}handleFocus(){var d;(d=this._renderer.value)==null||d.handleFocus()}handleSelectionChanged(d,g,w){var b;this._selectionState.start=d,this._selectionState.end=g,this._selectionState.columnSelectMode=w,(b=this._renderer.value)==null||b.handleSelectionChanged(d,g,w)}handleCursorMove(){var d;(d=this._renderer.value)==null||d.handleCursorMove()}clear(){var d;(d=this._renderer.value)==null||d.clear()}};s.RenderService=m=c([p(2,h.IOptionsService),p(3,f.ICharSizeService),p(4,h.IDecorationService),p(5,h.IBufferService),p(6,f.ICoreBrowserService),p(7,f.IThemeService)],m)},9312:function(l,s,o){var c=this&&this.__decorate||function(S,E,L,A){var M,D=arguments.length,B=D<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,E,L,A);else for(var H=S.length-1;H>=0;H--)(M=S[H])&&(B=(D<3?M(B):D>3?M(E,L,B):M(E,L))||B);return D>3&&B&&Object.defineProperty(E,L,B),B},p=this&&this.__param||function(S,E){return function(L,A){E(L,A,S)}};Object.defineProperty(s,"__esModule",{value:!0}),s.SelectionService=void 0;const u=o(9806),f=o(9504),_=o(456),y=o(4725),v=o(8460),h=o(844),m=o(6114),d=o(4841),g=o(511),w=o(2585),b=" ",x=new RegExp(b,"g");let C=s.SelectionService=class extends h.Disposable{constructor(S,E,L,A,M,D,B,H,F){super(),this._element=S,this._screenElement=E,this._linkifier=L,this._bufferService=A,this._coreService=M,this._mouseService=D,this._optionsService=B,this._renderService=H,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new g.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new v.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new v.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim($=>this._handleTrim($)),this.register(this._bufferService.buffers.onBufferActivate($=>this._handleBufferActivate($))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!S||!E||S[0]===E[0]&&S[1]===E[1])}get selectionText(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!S||!E)return"";const L=this._bufferService.buffer,A=[];if(this._activeSelectionMode===3){if(S[0]===E[0])return"";const M=S[0]<E[0]?S[0]:E[0],D=S[0]<E[0]?E[0]:S[0];for(let B=S[1];B<=E[1];B++){const H=L.translateBufferLineToString(B,!0,M,D);A.push(H)}}else{const M=S[1]===E[1]?E[0]:void 0;A.push(L.translateBufferLineToString(S[1],!0,S[0],M));for(let D=S[1]+1;D<=E[1]-1;D++){const B=L.lines.get(D),H=L.translateBufferLineToString(D,!0);B!=null&&B.isWrapped?A[A.length-1]+=H:A.push(H)}if(S[1]!==E[1]){const D=L.lines.get(E[1]),B=L.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?A[A.length-1]+=B:A.push(B)}}return A.map(M=>M.replace(x," ")).join(m.isWindows?`\r
|
|
57
57
|
`:`
|
|
58
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),m.isLinux&&S&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(S){const E=this._getMouseBufferCoords(S),L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(L&&A&&E)&&this._areCoordsInSelection(E,L,A)}isCellInSelection(S,E){const L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!L||!A)&&this._areCoordsInSelection([S,E],L,A)}_areCoordsInSelection(S,E,L){return S[1]>E[1]&&S[1]<L[1]||E[1]===L[1]&&S[1]===E[1]&&S[0]>=E[0]&&S[0]<L[0]||E[1]<L[1]&&S[1]===L[1]&&S[0]<L[0]||E[1]<L[1]&&S[1]===E[1]&&S[0]>=E[0]}_selectWordAtCursor(S,E){var M,D;const L=(D=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:D.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const A=this._getMouseBufferCoords(S);return!!A&&(this._selectWordAt(A,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,E){this._model.clearSelection(),S=Math.max(S,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const E=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(S){let E=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=L?0:(E>L&&(E-=L),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(S){return m.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const E=this._getMouseBufferCoords(S);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(S){return S.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const A=L.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const E=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const A=(0,f.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,L=!(!S||!E||S[0]===E[0]&&S[1]===E[1]);L?S&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,E,L)):this._oldHasSelection&&this._fireOnSelectionChange(S,E,L)}_fireOnSelectionChange(S,E,L){this._oldSelectionStart=S,this._oldSelectionEnd=E,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(S,E){let L=E;for(let A=0;E>=A;A++){const M=S.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&E!==A&&(L+=M-1)}return L}setSelection(S,E,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,E],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,E,L=!0,A=!0){if(S[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,D=M.lines.get(S[1]);if(!D)return;const B=M.translateBufferLineToString(S[1],!1);let H=this._convertViewportColToCharacterIndex(D,S[0]),F=H;const $=S[0]-H;let I=0,R=0,P=0,N=0;if(B.charAt(H)===" "){for(;H>0&&B.charAt(H-1)===" ";)H--;for(;F<B.length&&B.charAt(F+1)===" ";)F++}else{let V=S[0],ee=S[0];D.getWidth(V)===0&&(I++,V--),D.getWidth(ee)===2&&(R++,ee++);const Q=D.getString(ee).length;for(Q>1&&(N+=Q-1,F+=Q-1);V>0&&H>0&&!this._isCharWordSeparator(D.loadCell(V-1,this._workCell));){D.loadCell(V-1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,V--):z>1&&(P+=z-1,H-=z-1),H--,V--}for(;ee<D.length&&F+1<B.length&&!this._isCharWordSeparator(D.loadCell(ee+1,this._workCell));){D.loadCell(ee+1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,ee++):z>1&&(N+=z-1,F+=z-1),F++,ee++}}F++;let j=H+$-I+P,U=Math.min(this._bufferService.cols,F-H+I+R-P-N);if(E||B.slice(H,F).trim()!==""){if(L&&j===0&&D.getCodePoint(0)!==32){const V=M.lines.get(S[1]-1);if(V&&D.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(ee){const Q=this._bufferService.cols-ee.start;j-=Q,U+=Q}}}if(A&&j+U===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const V=M.lines.get(S[1]+1);if(V!=null&&V.isWrapped&&V.getCodePoint(0)!==32){const ee=this._getWordAt([0,S[1]+1],!1,!1,!0);ee&&(U+=ee.length)}}return{start:j,length:U}}}_selectWordAt(S,E){const L=this._getWordAt(S,E);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[L.start,S[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(S){const E=this._getWordAt(S,!0);if(E){let L=S[1];for(;E.start<0;)E.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,L]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const E=this._bufferService.buffer.getWrappedRangeForLine(S),L={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols)}};s.SelectionService=C=c([p(3,w.IBufferService),p(4,w.ICoreService),p(5,y.IMouseService),p(6,w.IOptionsService),p(7,y.IRenderService),p(8,y.ICoreBrowserService)],C)},4725:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const c=o(8343);s.ICharSizeService=(0,c.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),s.IMouseService=(0,c.createDecorator)("MouseService"),s.IRenderService=(0,c.createDecorator)("RenderService"),s.ISelectionService=(0,c.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,c.createDecorator)("ThemeService"),s.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(l,s,o){var c=this&&this.__decorate||function(C,S,E,L){var A,M=arguments.length,D=M<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,S,E,L);else for(var B=C.length-1;B>=0;B--)(A=C[B])&&(D=(M<3?A(D):M>3?A(S,E,D):A(S,E))||D);return M>3&&D&&Object.defineProperty(S,E,D),D},p=this&&this.__param||function(C,S){return function(E,L){S(E,L,C)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const u=o(7239),f=o(8055),_=o(8460),y=o(844),v=o(2585),h=f.css.toColor("#ffffff"),m=f.css.toColor("#000000"),d=f.css.toColor("#ffffff"),g=f.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let E=0;E<216;E++){const L=S[E/36%6|0],A=S[E/6%6|0],M=S[E%6];C.push({css:f.channels.toCss(L,A,M),rgba:f.channels.toRgba(L,A,M)})}for(let E=0;E<24;E++){const L=8+10*E;C.push({css:f.channels.toCss(L,L,L),rgba:f.channels.toRgba(L,L,L)})}return C})());let b=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:m,cursor:d,cursorAccent:g,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:f.color.blend(m,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:f.color.blend(m,w),ansi:s.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(C={}){const S=this._colors;if(S.foreground=x(C.foreground,h),S.background=x(C.background,m),S.cursor=x(C.cursor,d),S.cursorAccent=x(C.cursorAccent,g),S.selectionBackgroundTransparent=x(C.selectionBackground,w),S.selectionBackgroundOpaque=f.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=x(C.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=f.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=C.selectionForeground?x(C.selectionForeground,f.NULL_COLOR):void 0,S.selectionForeground===f.NULL_COLOR&&(S.selectionForeground=void 0),f.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=f.color.opacity(S.selectionBackgroundTransparent,.3)),f.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=f.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=s.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=x(C.black,s.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=x(C.red,s.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=x(C.green,s.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=x(C.yellow,s.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=x(C.blue,s.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=x(C.magenta,s.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=x(C.cyan,s.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=x(C.white,s.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=x(C.brightBlack,s.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=x(C.brightRed,s.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=x(C.brightGreen,s.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=x(C.brightYellow,s.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=x(C.brightBlue,s.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=x(C.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=x(C.brightCyan,s.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=x(C.brightWhite,s.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(S.ansi.length-16,C.extendedAnsi.length);for(let L=0;L<E;L++)S.ansi[L+16]=x(C.extendedAnsi[L],s.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(C){C(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 x(C,S){if(C!==void 0)try{return f.css.toColor(C)}catch{}return S}s.ThemeService=b=c([p(0,v.IOptionsService)],b)},6349:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const c=o(8460),p=o(844);class u extends p.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(_){if(this._maxLength===_)return;const y=new Array(_);for(let v=0;v<Math.min(_,this.length);v++)y[v]=this._array[this._getCyclicIndex(v)];this._array=y,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let y=this._length;y<_;y++)this._array[y]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,y){this._array[this._getCyclicIndex(_)]=y}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,y,...v){if(y){for(let h=_;h<this._length-y;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+y)];this._length-=y,this.onDeleteEmitter.fire({index:_,amount:y})}for(let h=this._length-1;h>=_;h--)this._array[this._getCyclicIndex(h+v.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<v.length;h++)this._array[this._getCyclicIndex(_+h)]=v[h];if(v.length&&this.onInsertEmitter.fire({index:_,amount:v.length}),this._length+v.length>this._maxLength){const h=this._length+v.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=v.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,y,v){if(!(y<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let m=y-1;m>=0;m--)this.set(_+m+v,this.get(_+m));const h=_+y+v-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<y;h++)this.set(_+h+v,this.get(_+h))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}s.CircularList=u},1439:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(c,p=5){if(typeof c!="object")return c;const u=Array.isArray(c)?[]:{};for(const f in c)u[f]=p<=1?c[f]:c[f]&&o(c[f],p-1);return u}},8055:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,p=0,u=0;var f,_,y,v,h;function m(g){const w=g.toString(16);return w.length<2?"0"+w:w}function d(g,w){return g<w?(w+.05)/(g+.05):(g+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(g){g.toCss=function(w,b,x,C){return C!==void 0?`#${m(w)}${m(b)}${m(x)}${m(C)}`:`#${m(w)}${m(b)}${m(x)}`},g.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},g.toColor=function(w,b,x,C){return{css:g.toCss(w,b,x,C),rgba:g.toRgba(w,b,x,C)}}}(f||(s.channels=f={})),function(g){function w(b,x){return u=Math.round(255*x),[o,c,p]=h.toChannels(b.rgba),{css:f.toCss(o,c,p,u),rgba:f.toRgba(o,c,p,u)}}g.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),p=M+Math.round((E-M)*u),{css:f.toCss(o,c,p),rgba:f.toRgba(o,c,p)}},g.isOpaque=function(b){return(255&b.rgba)==255},g.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return f.toColor(S>>24&255,S>>16&255,S>>8&255)},g.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,p]=h.toChannels(x),{css:f.toCss(o,c,p),rgba:x}},g.opacity=w,g.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},g.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(s.color=_={})),function(g){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),f.toColor(o,c,p);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),f.toColor(o,c,p,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),p=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(o,c,p,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,p,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(o,c,p,u),css:x}}}(y||(s.css=y={})),function(g){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}g.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},g.relativeLuminance2=w}(v||(s.rgb=v={})),function(g){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||B>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||B<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}g.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),p=D+Math.round((L-D)*u),f.toRgba(o,c,p)},g.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),B=d(E,v.relativeLuminance(D>>8));if(B<S){const H=b(x,C,S);return B>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},g.reduceLuminance=w,g.increaseLuminance=b,g.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(s.rgba=h={})),s.toPaddedHex=m,s.contrastRatio=d},8969:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const c=o(844),p=o(2585),u=o(4348),f=o(7866),_=o(744),y=o(7302),v=o(6975),h=o(8460),m=o(1753),d=o(1480),g=o(7994),w=o(9282),b=o(5435),x=o(5981),C=o(2660);let S=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(A=>{var M;(M=this._onScrollApi)==null||M.fire(A.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(A){for(const M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new y.OptionsService(A)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(g.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(M=>{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(M=>{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 x.WriteBuffer((M,D)=>this._inputHandler.parse(M,D))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=p.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,_.MINIMUM_COLS),M=Math.max(M,_.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M,D){this._bufferService.scrollLines(A,M,D)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)(()=>{for(const M of A)M.dispose()})}}}s.CoreTerminal=E},8460:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const p=[];for(let u=0;u<this._listeners.length;u++)p.push(this._listeners[u]);for(let u=0;u<p.length;u++)p[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o(p=>c.fire(p))},s.runAndSubscribe=function(o,c){return c(void 0),o(p=>c(p))}},5435:function(l,s,o){var c=this&&this.__decorate||function(I,R,P,N){var j,U=arguments.length,V=U<3?R:N===null?N=Object.getOwnPropertyDescriptor(R,P):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(I,R,P,N);else for(var ee=I.length-1;ee>=0;ee--)(j=I[ee])&&(V=(U<3?j(V):U>3?j(R,P,V):j(R,P))||V);return U>3&&V&&Object.defineProperty(R,P,V),V},p=this&&this.__param||function(I,R){return function(P,N){R(P,N,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const u=o(2584),f=o(7116),_=o(2015),y=o(844),v=o(482),h=o(8437),m=o(8460),d=o(643),g=o(511),w=o(3734),b=o(2585),x=o(1480),C=o(6242),S=o(6351),E=o(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function M(I,R){if(I>24)return R.setWinLines||!1;switch(I){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var D;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(s.WindowsOptionsReportType=D={}));let B=0;class H extends y.Disposable{getAttrData(){return this._curAttrData}constructor(R,P,N,j,U,V,ee,Q,z=new _.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=P,this._coreService=N,this._logService=j,this._optionsService=U,this._oscLinkService=V,this._coreMouseService=ee,this._unicodeService=Q,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new g.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(O=>this._activeBuffer=O.activeBuffer)),this._parser.setCsiHandlerFallback((O,K)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:K.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,K,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:K,data:W})}),this._parser.setDcsHandlerFallback((O,K,W)=>{K==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:K,payload:W})}),this._parser.setPrintHandler((O,K,W)=>this.print(O,K,W)),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(u.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(u.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(u.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(u.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(u.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(u.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(u.C1.IND,()=>this.index()),this._parser.setExecuteHandler(u.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(u.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(O=>(this.setTitle(O),this.setIconName(O),!0))),this._parser.registerOscHandler(1,new C.OscHandler(O=>this.setIconName(O))),this._parser.registerOscHandler(2,new C.OscHandler(O=>this.setTitle(O))),this._parser.registerOscHandler(4,new C.OscHandler(O=>this.setOrReportIndexedColor(O))),this._parser.registerOscHandler(8,new C.OscHandler(O=>this.setHyperlink(O))),this._parser.registerOscHandler(10,new C.OscHandler(O=>this.setOrReportFgColor(O))),this._parser.registerOscHandler(11,new C.OscHandler(O=>this.setOrReportBgColor(O))),this._parser.registerOscHandler(12,new C.OscHandler(O=>this.setOrReportCursorColor(O))),this._parser.registerOscHandler(104,new C.OscHandler(O=>this.restoreIndexedColor(O))),this._parser.registerOscHandler(110,new C.OscHandler(O=>this.restoreFgColor(O))),this._parser.registerOscHandler(111,new C.OscHandler(O=>this.restoreBgColor(O))),this._parser.registerOscHandler(112,new C.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 f.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 S.DcsHandler((O,K)=>this.requestStatusString(O,K)))}_preserveStack(R,P,N,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=N,this._parseStack.position=j}_logSlowResolvingAsync(R){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([R,new Promise((P,N)=>setTimeout(()=>N("#SLOW_TIMEOUT"),5e3))]).catch(P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,P){let N,j=this._activeBuffer.x,U=this._activeBuffer.y,V=0;const ee=this._parseStack.paused;if(ee){if(N=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(N),N;j=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>A&&(V=this._parseStack.position+A)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,O=>String.fromCharCode(O)).join("")}"`),typeof R=="string"?R.split("").map(O=>O.charCodeAt(0)):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(R.length,A))),ee||this._dirtyRowTracker.clearRange(),R.length>A)for(let O=V;O<R.length;O+=A){const K=O+A<R.length?O+A:R.length,W=typeof R=="string"?this._stringDecoder.decode(R.substring(O,K),this._parseBuffer):this._utf8Decoder.decode(R.subarray(O,K),this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,W))return this._preserveStack(j,U,W,O),this._logSlowResolvingAsync(N),N}else if(!ee){const O=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,O))return this._preserveStack(j,U,O,0),this._logSlowResolvingAsync(N),N}this._activeBuffer.x===j&&this._activeBuffer.y===U||this._onCursorMove.fire();const Q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(z,this._bufferService.rows-1),Math.min(Q,this._bufferService.rows-1))}print(R,P,N){let j,U;const V=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,K=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&N-P>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,K);let te=this._parser.precedingJoinState;for(let Y=P;Y<N;++Y){if(j=R[Y],j<127&&V){const re=V[String.fromCharCode(j)];re&&(j=re.charCodeAt(0))}const _e=this._unicodeService.charProperties(j,te);U=x.UnicodeService.extractWidth(_e);const ue=x.UnicodeService.extractShouldJoin(_e),se=ue?x.UnicodeService.extractWidth(te):0;if(te=_e,ee&&this._onA11yChar.fire((0,v.stringFromCodePoint)(j)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-se>Q){if(z){const re=W;let ae=this._activeBuffer.x-se;for(this._activeBuffer.x=se,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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),se>0&&W instanceof h.BufferLine&&W.copyCellsFrom(re,ae,0,se,!1);ae<Q;)re.setCellFromCodepoint(ae++,0,1,K)}else if(this._activeBuffer.x=Q-1,U===2)continue}if(ue&&this._activeBuffer.x){const re=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-re,j,U);for(let ae=U-se;--ae>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}else if(O&&(W.insertCells(this._activeBuffer.x,U-se,this._activeBuffer.getNullCell(K)),W.getWidth(Q-1)===2&&W.setCellFromCodepoint(Q-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,K)),W.setCellFromCodepoint(this._activeBuffer.x++,j,U,K),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}this._parser.precedingJoinState=te,this._activeBuffer.x<Q&&N-P>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,K),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,P){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,P):this._parser.registerCsiHandler(R,N=>!M(N.params[0],this._optionsService.rawOptions.windowOptions)||P(N))}registerDcsHandler(R,P){return this._parser.registerDcsHandler(R,new S.DcsHandler(P))}registerEscHandler(R,P){return this._parser.registerEscHandler(R,P)}registerOscHandler(R,P){return this._parser.registerOscHandler(R,new C.OscHandler(P))}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 R;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&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,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(R,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=R,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+P)}cursorUp(R){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const P=R.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const P=R.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,P,N,j=!1,U=!1){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);V.replaceCells(P,N,this._activeBuffer.getNullCell(this._eraseAttrData()),U),j&&(V.isWrapped=!1)}_resetBufferLine(R,P=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);N&&(N.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),N.isWrapped=!1)}eraseInDisplay(R,P=!1){let N;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);N<this._bufferService.rows;N++)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(N);break;case 1:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(N+1).isWrapped=!1);N--;)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(N=this._bufferService.rows,this._dirtyRowTracker.markDirty(N-1);N--;)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(0);break;case 3:const j=this._activeBuffer.lines.length-this._bufferService.rows;j>0&&(this._activeBuffer.lines.trimStart(j),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-j,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-j,0),this._onScroll.fire(0))}return!0}eraseInLine(R,P=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y,j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-j+1;for(;P--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(N,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y;let j;for(j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-j;P--;)this._activeBuffer.lines.splice(N,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let P=R.params[0]||1;for(;P--;)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(R){let P=R.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const P=this._parser.precedingJoinState;if(!P)return!0;const N=R.params[0]||1,j=x.UnicodeService.extractWidth(P),U=this._activeBuffer.x-j,V=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),ee=new Uint32Array(V.length*N);let Q=0;for(let O=0;O<V.length;){const K=V.codePointAt(O)||0;ee[Q++]=K,O+=K>65535?2:1}let z=Q;for(let O=1;O<N;++O)ee.copyWithin(z,0,Q),z+=Q;return this.print(ee,0,z),!0}sendDeviceAttributesPrimary(R){return R.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(R){return R.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.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(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){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(),R.params[P]===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(R,P){const N=this._coreService.decPrivateModes,{activeProtocol:j,activeEncoding:U}=this._coreMouseService,V=this._coreService,{buffers:ee,cols:Q}=this._bufferService,{active:z,alt:O}=ee,K=this._optionsService.rawOptions,W=ue=>ue?1:2,te=R.params[0];return Y=te,_e=P?te===2?4:te===4?W(V.modes.insertMode):te===12?3:te===20?W(K.convertEol):0:te===1?W(N.applicationCursorKeys):te===3?K.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:te===6?W(N.origin):te===7?W(N.wraparound):te===8?3:te===9?W(j==="X10"):te===12?W(K.cursorBlink):te===25?W(!V.isCursorHidden):te===45?W(N.reverseWraparound):te===66?W(N.applicationKeypad):te===67?4:te===1e3?W(j==="VT200"):te===1002?W(j==="DRAG"):te===1003?W(j==="ANY"):te===1004?W(N.sendFocus):te===1005?4:te===1006?W(U==="SGR"):te===1015?4:te===1016?W(U==="SGR_PIXELS"):te===1048?1:te===47||te===1047||te===1049?W(z===O):te===2004?W(N.bracketedPasteMode):0,V.triggerDataEvent(`${u.C0.ESC}[${P?"":"?"}${Y};${_e}$y`),!0;var Y,_e}_updateAttrColor(R,P,N,j,U){return P===2?(R|=50331648,R&=-16777216,R|=w.AttributeData.fromColorRGB([N,j,U])):P===5&&(R&=-50331904,R|=33554432|255&N),R}_extractColor(R,P,N){const j=[0,0,-1,0,0,0];let U=0,V=0;do{if(j[V+U]=R.params[P+V],R.hasSubParams(P+V)){const ee=R.getSubParams(P+V);let Q=0;do j[1]===5&&(U=1),j[V+Q+1+U]=ee[Q];while(++Q<ee.length&&Q+V+1+U<j.length);break}if(j[1]===5&&V+U>=2||j[1]===2&&V+U>=5)break;j[1]&&(U=1)}while(++V+P<R.length&&V+U<j.length);for(let ee=2;ee<j.length;++ee)j[ee]===-1&&(j[ee]=0);switch(j[0]){case 38:N.fg=this._updateAttrColor(N.fg,j[1],j[3],j[4],j[5]);break;case 48:N.bg=this._updateAttrColor(N.bg,j[1],j[3],j[4],j[5]);break;case 58:N.extended=N.extended.clone(),N.extended.underlineColor=this._updateAttrColor(N.extended.underlineColor,j[1],j[3],j[4],j[5])}return V}_processUnderline(R,P){P.extended=P.extended.clone(),(!~R||R>5)&&(R=1),P.extended.underlineStyle=R,P.fg|=268435456,R===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(R){R.fg=h.DEFAULT_ATTR_DATA.fg,R.bg=h.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=R.length;let N;const j=this._curAttrData;for(let U=0;U<P;U++)N=R.params[U],N>=30&&N<=37?(j.fg&=-50331904,j.fg|=16777216|N-30):N>=40&&N<=47?(j.bg&=-50331904,j.bg|=16777216|N-40):N>=90&&N<=97?(j.fg&=-50331904,j.fg|=16777224|N-90):N>=100&&N<=107?(j.bg&=-50331904,j.bg|=16777224|N-100):N===0?this._processSGR0(j):N===1?j.fg|=134217728:N===3?j.bg|=67108864:N===4?(j.fg|=268435456,this._processUnderline(R.hasSubParams(U)?R.getSubParams(U)[0]:1,j)):N===5?j.fg|=536870912:N===7?j.fg|=67108864:N===8?j.fg|=1073741824:N===9?j.fg|=2147483648:N===2?j.bg|=134217728:N===21?this._processUnderline(2,j):N===22?(j.fg&=-134217729,j.bg&=-134217729):N===23?j.bg&=-67108865:N===24?(j.fg&=-268435457,this._processUnderline(0,j)):N===25?j.fg&=-536870913:N===27?j.fg&=-67108865:N===28?j.fg&=-1073741825:N===29?j.fg&=2147483647:N===39?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):N===49?(j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):N===38||N===48||N===58?U+=this._extractColor(R,U,j):N===53?j.bg|=1073741824:N===55?j.bg&=-1073741825:N===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):N===100?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",N);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${P};${N}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const P=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${P};${N}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(R){const P=R.params[0]||1;switch(P){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 N=P%2==1;return this._optionsService.options.cursorBlink=N,!0}setScrollRegion(R){const P=R.params[0]||1;let N;return(R.length<2||(N=R.params[1])>this._bufferService.rows||N===0)&&(N=this._bufferService.rows),N>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=N-1,this._setCursor(0,0)),!0}windowOptions(R){if(!M(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){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(R){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(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const P=[],N=R.split(";");for(;N.length>1;){const j=N.shift(),U=N.shift();if(/^\d+$/.exec(j)){const V=parseInt(j);if($(V))if(U==="?")P.push({type:0,index:V});else{const ee=(0,E.parseColor)(U);ee&&P.push({type:1,index:V,color:ee})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(R){const P=R.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(R,P){this._getCurrentLinkId()&&this._finishHyperlink();const N=R.split(":");let j;const U=N.findIndex(V=>V.startsWith("id="));return U!==-1&&(j=N[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:j,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,P){const N=R.split(";");for(let j=0;j<N.length&&!(P>=this._specialColors.length);++j,++P)if(N[j]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const U=(0,E.parseColor)(N[j]);U&&this._onColor.fire([{type:1,index:this._specialColors[P],color:U}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const P=[],N=R.split(";");for(let j=0;j<N.length;++j)if(/^\d+$/.exec(N[j])){const U=parseInt(N[j]);$(U)&&P.push({type:2,index:U})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){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,f.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(L[R[0]],f.CHARSETS[R[1]]||f.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 R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new g.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const N=this._activeBuffer.ybase+this._activeBuffer.y+P,j=this._activeBuffer.lines.get(N);j&&(j.fill(R),j.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,P){const N=this._bufferService.buffer,j=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${U}${u.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${N.scrollTop+1};${N.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[j.cursorStyle]-(j.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,P){this._dirtyRowTracker.markRangeDirty(R,P)}}s.InputHandler=H;let F=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,R){I>R&&(B=I,I=R,R=B),I<this.start&&(this.start=I),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(I){return 0<=I&&I<256}F=c([p(0,b.IBufferService)],F)},844:(l,s)=>{function o(c){for(const p of c)p.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const p=this._disposables.indexOf(c);p!==-1&&this._disposables.splice(p,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var p;this._isDisposed||c===this._value||((p=this._value)==null||p.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(p,u,f){this._data[p]||(this._data[p]={}),this._data[p][u]=f}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,p,u,f,_){this._data.get(c,p)||this._data.set(c,p,new o),this._data.get(c,p).set(u,f,_)}get(c,p,u,f){var _;return(_=this._data.get(c,p))==null?void 0:_.get(u,f)}clear(){this._data.clear()}}},6114:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},6106:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const p=this._getKey(c);if(p===void 0||(o=this._search(p),o===-1)||this._getKey(this._array[o])!==p)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===p);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,p){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do p(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let p=0,u=this._array.length-1;for(;u>=p;){let f=p+u>>1;const _=this._getKey(this._array[f]);if(_>c)u=f-1;else{if(!(_<c)){for(;f>0&&this._getKey(this._array[f-1])===c;)f--;return f}p=f+1}}return p}}},7226:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const c=o(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),m=_.timeRemaining(),1.5*v>m)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=m}this.clear()}}class u extends p{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const c=o(643);s.updateWindowsModeWrappedState=function(p){const u=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),f=u==null?void 0:u.get(p.cols-1),_=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);_&&f&&(_.isWrapped=f[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&f[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,f=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=f}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const c=o(6349),p=o(7226),u=o(3734),f=o(8437),_=o(4634),y=o(511),v=o(643),h=o(4863),m=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(d,g,w){this._hasScrollback=d,this._optionsService=g,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,g){return new f.BufferLine(this._bufferService.cols,this.getNullCell(d),g)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const g=d+this._optionsService.rawOptions.scrollback;return g>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:g}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=f.DEFAULT_ATTR_DATA);let g=this._rows;for(;g--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,g){const w=this.getNullCell(f.DEFAULT_ATTR_DATA);let b=0;const x=this._getCorrectBufferLength(g);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<d)for(let S=0;S<this.lines.length;S++)b+=+this.lines.get(S).resize(d,w);let C=0;if(this._rows<g)for(let S=this._rows;S<g;S++)this.lines.length<g+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(d,w)));else for(let S=this._rows;S>g;S--)this.lines.length>g+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const S=this.lines.length-x;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=x}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,g-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=g-1,this._isReflowEnabled&&(this._reflow(d,g),this._cols>d))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(d,w);this._cols=d,this._rows=g,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let g=0;for(;this._memoryCleanupPosition<this.lines.length;)if(g+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),g>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,g){this._cols!==d&&(d>this._cols?this._reflowLarger(d,g):this._reflowSmaller(d,g))}_reflowLarger(d,g){const w=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(w.length>0){const b=(0,_.reflowLargerCreateNewLayout)(this.lines,w);(0,_.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(d,g,b.countRemoved)}}_reflowLargerAdjustViewport(d,g,w){const b=this.getNullCell(f.DEFAULT_ATTR_DATA);let x=w;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<g&&this.lines.push(new f.BufferLine(d,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,g){const w=this.getNullCell(f.DEFAULT_ATTR_DATA),b=[];let x=0;for(let C=this.lines.length-1;C>=0;C--){let S=this.lines.get(C);if(!S||!S.isWrapped&&S.getTrimmedLength()<=d)continue;const E=[S];for(;S.isWrapped&&C>0;)S=this.lines.get(--C),E.unshift(S);const L=this.ybase+this.y;if(L>=C&&L<C+E.length)continue;const A=E[E.length-1].getTrimmedLength(),M=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,d),D=M.length-E.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const H=[];for(let N=0;N<D;N++){const j=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);H.push(j)}H.length>0&&(b.push({start:C+E.length+x,newLines:H}),x+=H.length),E.push(...H);let F=M.length-1,$=M[F];$===0&&(F--,$=M[F]);let I=E.length-D-1,R=A;for(;I>=0;){const N=Math.min(R,$);if(E[F]===void 0)break;if(E[F].copyCellsFrom(E[I],R-N,$-N,N,!0),$-=N,$===0&&(F--,$=M[F]),R-=N,R===0){I--;const j=Math.max(I,0);R=(0,_.getWrappedLineTrimmedLength)(E,j,this._cols)}}for(let N=0;N<E.length;N++)M[N]<d&&E[N].setCell(M[N],w);let P=D-B;for(;P-- >0;)this.ybase===0?this.y<g-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-g&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+g-1)}if(b.length>0){const C=[],S=[];for(let F=0;F<this.lines.length;F++)S.push(this.lines.get(F));const E=this.lines.length;let L=E-1,A=0,M=b[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let D=0;for(let F=Math.min(this.lines.maxLength-1,E+x-1);F>=0;F--)if(M&&M.start>L+D){for(let $=M.newLines.length-1;$>=0;$--)this.lines.set(F--,M.newLines[$]);F++,C.push({index:L+1,amount:M.newLines.length}),D+=M.newLines.length,M=b[++A]}else this.lines.set(F,S[L--]);let B=0;for(let F=C.length-1;F>=0;F--)C[F].index+=B,this.lines.onInsertEmitter.fire(C[F]),B+=C[F].amount;const H=Math.max(0,E+x-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(d,g,w=0,b){const x=this.lines.get(d);return x?x.translateToString(g,w,b):""}getWrappedRangeForLine(d){let g=d,w=d;for(;g>0&&this.lines.get(g).isWrapped;)g--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:g,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].line===d&&(this.markers[g].dispose(),this.markers.splice(g--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const g=new h.Marker(d);return this.markers.push(g),g.register(this.lines.onTrim(w=>{g.line-=w,g.line<0&&g.dispose()})),g.register(this.lines.onInsert(w=>{g.line>=w.index&&(g.line+=w.amount)})),g.register(this.lines.onDelete(w=>{g.line>=w.index&&g.line<w.index+w.amount&&g.dispose(),g.line>w.index&&(g.line-=w.amount)})),g.register(g.onDispose(()=>this._removeMarker(g))),g}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const c=o(3734),p=o(511),u=o(643),f=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class y{constructor(h,m,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const g=m||p.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let w=0;w<h;++w)this.setCell(w,g);this.length=h}get(h){const m=this._data[3*h+0],d=2097151&m;return[this._data[3*h+1],2097152&m?this._combined[h]:d?(0,f.stringFromCodePoint)(d):"",m>>22,2097152&m?this._combined[h].charCodeAt(this._combined[h].length-1):d]}set(h,m){this._data[3*h+1]=m[u.CHAR_DATA_ATTR_INDEX],m[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=m[1],this._data[3*h+0]=2097152|h|m[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=m[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const m=this._data[3*h+0];return 2097152&m?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&m}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const m=this._data[3*h+0];return 2097152&m?this._combined[h]:2097151&m?(0,f.stringFromCodePoint)(2097151&m):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,m){return _=3*h,m.content=this._data[_+0],m.fg=this._data[_+1],m.bg=this._data[_+2],2097152&m.content&&(m.combinedData=this._combined[h]),268435456&m.bg&&(m.extended=this._extendedAttrs[h]),m}setCell(h,m){2097152&m.content&&(this._combined[h]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[h]=m.extended),this._data[3*h+0]=m.content,this._data[3*h+1]=m.fg,this._data[3*h+2]=m.bg}setCellFromCodepoint(h,m,d,g){268435456&g.bg&&(this._extendedAttrs[h]=g.extended),this._data[3*h+0]=m|d<<22,this._data[3*h+1]=g.fg,this._data[3*h+2]=g.bg}addCodepointToCell(h,m,d){let g=this._data[3*h+0];2097152&g?this._combined[h]+=(0,f.stringFromCodePoint)(m):2097151&g?(this._combined[h]=(0,f.stringFromCodePoint)(2097151&g)+(0,f.stringFromCodePoint)(m),g&=-2097152,g|=2097152):g=m|4194304,d&&(g&=-12582913,g|=d<<22),this._data[3*h+0]=g}insertCells(h,m,d){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length-h){const g=new p.CellData;for(let w=this.length-h-m-1;w>=0;--w)this.setCell(h+m+w,this.loadCell(h+w,g));for(let w=0;w<m;++w)this.setCell(h+w,d)}else for(let g=h;g<this.length;++g)this.setCell(g,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(h,m,d){if(h%=this.length,m<this.length-h){const g=new p.CellData;for(let w=0;w<this.length-h-m;++w)this.setCell(h+w,this.loadCell(h+m+w,g));for(let w=this.length-m;w<this.length;++w)this.setCell(w,d)}else for(let g=h;g<this.length;++g)this.setCell(g,d);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,d)}replaceCells(h,m,d,g=!1){if(g)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,d);h<m&&h<this.length;)this.isProtected(h)||this.setCell(h,d),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,d);h<m&&h<this.length;)this.setCell(h++,d)}resize(h,m){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const g=new Uint32Array(d);g.set(this._data),this._data=g}for(let g=this.length;g<h;++g)this.setCell(g,m)}else{this._data=this._data.subarray(0,d);const g=Object.keys(this._combined);for(let b=0;b<g.length;b++){const x=parseInt(g[b],10);x>=h&&delete this._combined[x]}const w=Object.keys(this._extendedAttrs);for(let b=0;b<w.length;b++){const x=parseInt(w[b],10);x>=h&&delete this._extendedAttrs[x]}}return this.length=h,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,m=!1){if(m)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,h);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const m in h._combined)this._combined[m]=h._combined[m];this._extendedAttrs={};for(const m in h._extendedAttrs)this._extendedAttrs[m]=h._extendedAttrs[m];this.isWrapped=h.isWrapped}clone(){const h=new y(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const m in this._combined)h._combined[m]=this._combined[m];for(const m in this._extendedAttrs)h._extendedAttrs[m]=this._extendedAttrs[m];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,m,d,g,w){const b=h._data;if(w)for(let C=g-1;C>=0;C--){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(m+C)+S];268435456&b[3*(m+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[m+C])}else for(let C=0;C<g;C++){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(m+C)+S];268435456&b[3*(m+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[m+C])}const x=Object.keys(h._combined);for(let C=0;C<x.length;C++){const S=parseInt(x[C],10);S>=m&&(this._combined[S-m+d]=h._combined[S])}}translateToString(h,m,d,g){m=m??0,d=d??this.length,h&&(d=Math.min(d,this.getTrimmedLength())),g&&(g.length=0);let w="";for(;m<d;){const b=this._data[3*m+0],x=2097151&b,C=2097152&b?this._combined[m]:x?(0,f.stringFromCodePoint)(x):u.WHITESPACE_CELL_CHAR;if(w+=C,g)for(let S=0;S<C.length;++S)g.push(m);m+=b>>22||1}return g&&g.push(m),w}}s.BufferLine=y},4841:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(l,s)=>{function o(c,p,u){if(p===c.length-1)return c[p].getTrimmedLength();const f=!c[p].hasContent(u-1)&&c[p].getWidth(u-1)===1,_=c[p+1].getWidth(0)===2;return f&&_?u-1:u}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,p,u,f,_){const y=[];for(let v=0;v<c.length-1;v++){let h=v,m=c.get(++h);if(!m.isWrapped)continue;const d=[c.get(v)];for(;h<c.length&&m.isWrapped;)d.push(m),m=c.get(++h);if(f>=v&&f<h){v+=d.length-1;continue}let g=0,w=o(d,g,p),b=1,x=0;for(;b<d.length;){const S=o(d,b,p),E=S-x,L=u-w,A=Math.min(E,L);d[g].copyCellsFrom(d[b],x,w,A,!1),w+=A,w===u&&(g++,w=0),x+=A,x===S&&(b++,x=0),w===0&&g!==0&&d[g-1].getWidth(u-1)===2&&(d[g].copyCellsFrom(d[g-1],u-1,w++,1,!1),d[g-1].setCell(u-1,_))}d[g].replaceCells(w,u,_);let C=0;for(let S=d.length-1;S>0&&(S>g||d[S].getTrimmedLength()===0);S--)C++;C>0&&(y.push(v+d.length-C),y.push(C)),v+=d.length-1}return y},s.reflowLargerCreateNewLayout=function(c,p){const u=[];let f=0,_=p[f],y=0;for(let v=0;v<c.length;v++)if(_===v){const h=p[++f];c.onDeleteEmitter.fire({index:v-y,amount:h}),v+=h-1,y+=h,_=p[++f]}else u.push(v);return{layout:u,countRemoved:y}},s.reflowLargerApplyNewLayout=function(c,p){const u=[];for(let f=0;f<p.length;f++)u.push(c.get(p[f]));for(let f=0;f<u.length;f++)c.set(f,u[f]);c.length=p.length},s.reflowSmallerGetNewLineLengths=function(c,p,u){const f=[],_=c.map((m,d)=>o(c,d,p)).reduce((m,d)=>m+d);let y=0,v=0,h=0;for(;h<_;){if(_-h<u){f.push(_-h);break}y+=u;const m=o(c,v,p);y>m&&(y-=m,v++);const d=c[v].getWidth(y-1)===2;d&&y--;const g=d?u-1:u;f.push(g),h+=g}return f},s.getWrappedLineTrimmedLength=o},5295:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const c=o(8460),p=o(844),u=o(9092);class f extends p.Disposable{constructor(y,v){super(),this._optionsService=y,this._bufferService=v,this._onBufferActivate=this.register(new c.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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,v){this._normal.resize(y,v),this._alt.resize(y,v),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=f},511:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const c=o(482),p=o(643),u=o(3734);class f extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new f;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[p.CHAR_DATA_CHAR_INDEX].length===2){const h=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const m=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(h-55296)+m-56320+65536|y[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=f},643:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const c=o(8460),p=o(844);class u{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}s.Marker=u,u._nextId=1},7116:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(l,s)=>{var o,c,p;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
|
|
58
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),m.isLinux&&S&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(S){const E=this._getMouseBufferCoords(S),L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!!(L&&A&&E)&&this._areCoordsInSelection(E,L,A)}isCellInSelection(S,E){const L=this._model.finalSelectionStart,A=this._model.finalSelectionEnd;return!(!L||!A)&&this._areCoordsInSelection([S,E],L,A)}_areCoordsInSelection(S,E,L){return S[1]>E[1]&&S[1]<L[1]||E[1]===L[1]&&S[1]===E[1]&&S[0]>=E[0]&&S[0]<L[0]||E[1]<L[1]&&S[1]===L[1]&&S[0]<L[0]||E[1]<L[1]&&S[1]===E[1]&&S[0]>=E[0]}_selectWordAtCursor(S,E){var M,D;const L=(D=(M=this._linkifier.currentLink)==null?void 0:M.link)==null?void 0:D.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const A=this._getMouseBufferCoords(S);return!!A&&(this._selectWordAt(A,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,E){this._model.clearSelection(),S=Math.max(S,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const E=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(S){let E=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=L?0:(E>L&&(E-=L),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(S){return m.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const E=this._getMouseBufferCoords(S);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(S){return S.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const A=L.lines.get(this._model.selectionEnd[1]);A&&A.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const E=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const A=(0,f.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(A,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,L=!(!S||!E||S[0]===E[0]&&S[1]===E[1]);L?S&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,E,L)):this._oldHasSelection&&this._fireOnSelectionChange(S,E,L)}_fireOnSelectionChange(S,E,L){this._oldSelectionStart=S,this._oldSelectionEnd=E,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(S,E){let L=E;for(let A=0;E>=A;A++){const M=S.loadCell(A,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:M>1&&E!==A&&(L+=M-1)}return L}setSelection(S,E,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,E],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,E,L=!0,A=!0){if(S[0]>=this._bufferService.cols)return;const M=this._bufferService.buffer,D=M.lines.get(S[1]);if(!D)return;const B=M.translateBufferLineToString(S[1],!1);let H=this._convertViewportColToCharacterIndex(D,S[0]),F=H;const $=S[0]-H;let I=0,R=0,P=0,N=0;if(B.charAt(H)===" "){for(;H>0&&B.charAt(H-1)===" ";)H--;for(;F<B.length&&B.charAt(F+1)===" ";)F++}else{let V=S[0],ee=S[0];D.getWidth(V)===0&&(I++,V--),D.getWidth(ee)===2&&(R++,ee++);const Q=D.getString(ee).length;for(Q>1&&(N+=Q-1,F+=Q-1);V>0&&H>0&&!this._isCharWordSeparator(D.loadCell(V-1,this._workCell));){D.loadCell(V-1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===0?(I++,V--):z>1&&(P+=z-1,H-=z-1),H--,V--}for(;ee<D.length&&F+1<B.length&&!this._isCharWordSeparator(D.loadCell(ee+1,this._workCell));){D.loadCell(ee+1,this._workCell);const z=this._workCell.getChars().length;this._workCell.getWidth()===2?(R++,ee++):z>1&&(N+=z-1,F+=z-1),F++,ee++}}F++;let j=H+$-I+P,U=Math.min(this._bufferService.cols,F-H+I+R-P-N);if(E||B.slice(H,F).trim()!==""){if(L&&j===0&&D.getCodePoint(0)!==32){const V=M.lines.get(S[1]-1);if(V&&D.isWrapped&&V.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(ee){const Q=this._bufferService.cols-ee.start;j-=Q,U+=Q}}}if(A&&j+U===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const V=M.lines.get(S[1]+1);if(V!=null&&V.isWrapped&&V.getCodePoint(0)!==32){const ee=this._getWordAt([0,S[1]+1],!1,!1,!0);ee&&(U+=ee.length)}}return{start:j,length:U}}}_selectWordAt(S,E){const L=this._getWordAt(S,E);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[L.start,S[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(S){const E=this._getWordAt(S,!0);if(E){let L=S[1];for(;E.start<0;)E.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,L]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const E=this._bufferService.buffer.getWrappedRangeForLine(S),L={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,d.getRangeLength)(L,this._bufferService.cols)}};s.SelectionService=C=c([p(3,w.IBufferService),p(4,w.ICoreService),p(5,y.IMouseService),p(6,w.IOptionsService),p(7,y.IRenderService),p(8,y.ICoreBrowserService)],C)},4725:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ILinkProviderService=s.IThemeService=s.ICharacterJoinerService=s.ISelectionService=s.IRenderService=s.IMouseService=s.ICoreBrowserService=s.ICharSizeService=void 0;const c=o(8343);s.ICharSizeService=(0,c.createDecorator)("CharSizeService"),s.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),s.IMouseService=(0,c.createDecorator)("MouseService"),s.IRenderService=(0,c.createDecorator)("RenderService"),s.ISelectionService=(0,c.createDecorator)("SelectionService"),s.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),s.IThemeService=(0,c.createDecorator)("ThemeService"),s.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(l,s,o){var c=this&&this.__decorate||function(C,S,E,L){var A,M=arguments.length,D=M<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,E):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,S,E,L);else for(var B=C.length-1;B>=0;B--)(A=C[B])&&(D=(M<3?A(D):M>3?A(S,E,D):A(S,E))||D);return M>3&&D&&Object.defineProperty(S,E,D),D},p=this&&this.__param||function(C,S){return function(E,L){S(E,L,C)}};Object.defineProperty(s,"__esModule",{value:!0}),s.ThemeService=s.DEFAULT_ANSI_COLORS=void 0;const u=o(7239),f=o(8055),_=o(8460),y=o(844),v=o(2585),h=f.css.toColor("#ffffff"),m=f.css.toColor("#000000"),d=f.css.toColor("#ffffff"),g=f.css.toColor("#000000"),w={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};s.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let E=0;E<216;E++){const L=S[E/36%6|0],A=S[E/6%6|0],M=S[E%6];C.push({css:f.channels.toCss(L,A,M),rgba:f.channels.toRgba(L,A,M)})}for(let E=0;E<24;E++){const L=8+10*E;C.push({css:f.channels.toCss(L,L,L),rgba:f.channels.toRgba(L,L,L)})}return C})());let b=s.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:m,cursor:d,cursorAccent:g,selectionForeground:void 0,selectionBackgroundTransparent:w,selectionBackgroundOpaque:f.color.blend(m,w),selectionInactiveBackgroundTransparent:w,selectionInactiveBackgroundOpaque:f.color.blend(m,w),ansi:s.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(C={}){const S=this._colors;if(S.foreground=x(C.foreground,h),S.background=x(C.background,m),S.cursor=x(C.cursor,d),S.cursorAccent=x(C.cursorAccent,g),S.selectionBackgroundTransparent=x(C.selectionBackground,w),S.selectionBackgroundOpaque=f.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=x(C.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=f.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=C.selectionForeground?x(C.selectionForeground,f.NULL_COLOR):void 0,S.selectionForeground===f.NULL_COLOR&&(S.selectionForeground=void 0),f.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=f.color.opacity(S.selectionBackgroundTransparent,.3)),f.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=f.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=s.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=x(C.black,s.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=x(C.red,s.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=x(C.green,s.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=x(C.yellow,s.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=x(C.blue,s.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=x(C.magenta,s.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=x(C.cyan,s.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=x(C.white,s.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=x(C.brightBlack,s.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=x(C.brightRed,s.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=x(C.brightGreen,s.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=x(C.brightYellow,s.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=x(C.brightBlue,s.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=x(C.brightMagenta,s.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=x(C.brightCyan,s.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=x(C.brightWhite,s.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(S.ansi.length-16,C.extendedAnsi.length);for(let L=0;L<E;L++)S.ansi[L+16]=x(C.extendedAnsi[L],s.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(C){C(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 x(C,S){if(C!==void 0)try{return f.css.toColor(C)}catch{}return S}s.ThemeService=b=c([p(0,v.IOptionsService)],b)},6349:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CircularList=void 0;const c=o(8460),p=o(844);class u extends p.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.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(_){if(this._maxLength===_)return;const y=new Array(_);for(let v=0;v<Math.min(_,this.length);v++)y[v]=this._array[this._getCyclicIndex(v)];this._array=y,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let y=this._length;y<_;y++)this._array[y]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,y){this._array[this._getCyclicIndex(_)]=y}push(_){this._array[this._getCyclicIndex(this._length)]=_,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(_,y,...v){if(y){for(let h=_;h<this._length-y;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+y)];this._length-=y,this.onDeleteEmitter.fire({index:_,amount:y})}for(let h=this._length-1;h>=_;h--)this._array[this._getCyclicIndex(h+v.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<v.length;h++)this._array[this._getCyclicIndex(_+h)]=v[h];if(v.length&&this.onInsertEmitter.fire({index:_,amount:v.length}),this._length+v.length>this._maxLength){const h=this._length+v.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=v.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,y,v){if(!(y<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+v<0)throw new Error("Cannot shift elements in list beyond index 0");if(v>0){for(let m=y-1;m>=0;m--)this.set(_+m+v,this.get(_+m));const h=_+y+v-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<y;h++)this.set(_+h+v,this.get(_+h))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}s.CircularList=u},1439:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.clone=void 0,s.clone=function o(c,p=5){if(typeof c!="object")return c;const u=Array.isArray(c)?[]:{};for(const f in c)u[f]=p<=1?c[f]:c[f]&&o(c[f],p-1);return u}},8055:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,p=0,u=0;var f,_,y,v,h;function m(g){const w=g.toString(16);return w.length<2?"0"+w:w}function d(g,w){return g<w?(w+.05)/(g+.05):(g+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(g){g.toCss=function(w,b,x,C){return C!==void 0?`#${m(w)}${m(b)}${m(x)}${m(C)}`:`#${m(w)}${m(b)}${m(x)}`},g.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},g.toColor=function(w,b,x,C){return{css:g.toCss(w,b,x,C),rgba:g.toRgba(w,b,x,C)}}}(f||(s.channels=f={})),function(g){function w(b,x){return u=Math.round(255*x),[o,c,p]=h.toChannels(b.rgba),{css:f.toCss(o,c,p,u),rgba:f.toRgba(o,c,p,u)}}g.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),p=M+Math.round((E-M)*u),{css:f.toCss(o,c,p),rgba:f.toRgba(o,c,p)}},g.isOpaque=function(b){return(255&b.rgba)==255},g.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return f.toColor(S>>24&255,S>>16&255,S>>8&255)},g.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,p]=h.toChannels(x),{css:f.toCss(o,c,p),rgba:x}},g.opacity=w,g.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},g.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(s.color=_={})),function(g){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),f.toColor(o,c,p);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),f.toColor(o,c,p,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),p=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(o,c,p,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,p,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(o,c,p,u),css:x}}}(y||(s.css=y={})),function(g){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}g.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},g.relativeLuminance2=w}(v||(s.rgb=v={})),function(g){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||B>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||B<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}g.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),p=D+Math.round((L-D)*u),f.toRgba(o,c,p)},g.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),B=d(E,v.relativeLuminance(D>>8));if(B<S){const H=b(x,C,S);return B>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},g.reduceLuminance=w,g.increaseLuminance=b,g.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(s.rgba=h={})),s.toPaddedHex=m,s.contrastRatio=d},8969:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CoreTerminal=void 0;const c=o(844),p=o(2585),u=o(4348),f=o(7866),_=o(744),y=o(7302),v=o(6975),h=o(8460),m=o(1753),d=o(1480),g=o(7994),w=o(9282),b=o(5435),x=o(5981),C=o(2660);let S=!1;class E extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event(A=>{var M;(M=this._onScrollApi)==null||M.fire(A.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(A){for(const M in A)this.optionsService.options[M]=A[M]}constructor(A){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new y.OptionsService(A)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(v.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(d.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(g.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new b.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(M=>{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(M=>{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 x.WriteBuffer((M,D)=>this._inputHandler.parse(M,D))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(A,M){this._writeBuffer.write(A,M)}writeSync(A,M){this._logService.logLevel<=p.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(A,M)}input(A,M=!0){this.coreService.triggerDataEvent(A,M)}resize(A,M){isNaN(A)||isNaN(M)||(A=Math.max(A,_.MINIMUM_COLS),M=Math.max(M,_.MINIMUM_ROWS),this._bufferService.resize(A,M))}scroll(A,M=!1){this._bufferService.scroll(A,M)}scrollLines(A,M,D){this._bufferService.scrollLines(A,M,D)}scrollPages(A){this.scrollLines(A*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(A){const M=A-this._bufferService.buffer.ydisp;M!==0&&this.scrollLines(M)}registerEscHandler(A,M){return this._inputHandler.registerEscHandler(A,M)}registerDcsHandler(A,M){return this._inputHandler.registerDcsHandler(A,M)}registerCsiHandler(A,M){return this._inputHandler.registerCsiHandler(A,M)}registerOscHandler(A,M){return this._inputHandler.registerOscHandler(A,M)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let A=!1;const M=this.optionsService.rawOptions.windowsPty;M&&M.buildNumber!==void 0&&M.buildNumber!==void 0?A=M.backend==="conpty"&&M.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(A=!0),A?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const A=[];A.push(this.onLineFeed(w.updateWindowsModeWrappedState.bind(null,this._bufferService))),A.push(this.registerCsiHandler({final:"H"},()=>((0,w.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)(()=>{for(const M of A)M.dispose()})}}}s.CoreTerminal=E},8460:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const p=[];for(let u=0;u<this._listeners.length;u++)p.push(this._listeners[u]);for(let u=0;u<p.length;u++)p[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o(p=>c.fire(p))},s.runAndSubscribe=function(o,c){return c(void 0),o(p=>c(p))}},5435:function(l,s,o){var c=this&&this.__decorate||function(I,R,P,N){var j,U=arguments.length,V=U<3?R:N===null?N=Object.getOwnPropertyDescriptor(R,P):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(I,R,P,N);else for(var ee=I.length-1;ee>=0;ee--)(j=I[ee])&&(V=(U<3?j(V):U>3?j(R,P,V):j(R,P))||V);return U>3&&V&&Object.defineProperty(R,P,V),V},p=this&&this.__param||function(I,R){return function(P,N){R(P,N,I)}};Object.defineProperty(s,"__esModule",{value:!0}),s.InputHandler=s.WindowsOptionsReportType=void 0;const u=o(2584),f=o(7116),_=o(2015),y=o(844),v=o(482),h=o(8437),m=o(8460),d=o(643),g=o(511),w=o(3734),b=o(2585),x=o(1480),C=o(6242),S=o(6351),E=o(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function M(I,R){if(I>24)return R.setWinLines||!1;switch(I){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}var D;(function(I){I[I.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",I[I.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(s.WindowsOptionsReportType=D={}));let B=0;class H extends y.Disposable{getAttrData(){return this._curAttrData}constructor(R,P,N,j,U,V,ee,Q,z=new _.EscapeSequenceParser){super(),this._bufferService=R,this._charsetService=P,this._coreService=N,this._logService=j,this._optionsService=U,this._oscLinkService=V,this._coreMouseService=ee,this._unicodeService=Q,this._parser=z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new v.StringToUtf32,this._utf8Decoder=new v.Utf8ToUtf32,this._workCell=new g.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(O=>this._activeBuffer=O.activeBuffer)),this._parser.setCsiHandlerFallback((O,K)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:K.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,K,W)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:K,data:W})}),this._parser.setDcsHandlerFallback((O,K,W)=>{K==="HOOK"&&(W=W.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:K,payload:W})}),this._parser.setPrintHandler((O,K,W)=>this.print(O,K,W)),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(u.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(u.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(u.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(u.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(u.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(u.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(u.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(u.C1.IND,()=>this.index()),this._parser.setExecuteHandler(u.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(u.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(O=>(this.setTitle(O),this.setIconName(O),!0))),this._parser.registerOscHandler(1,new C.OscHandler(O=>this.setIconName(O))),this._parser.registerOscHandler(2,new C.OscHandler(O=>this.setTitle(O))),this._parser.registerOscHandler(4,new C.OscHandler(O=>this.setOrReportIndexedColor(O))),this._parser.registerOscHandler(8,new C.OscHandler(O=>this.setHyperlink(O))),this._parser.registerOscHandler(10,new C.OscHandler(O=>this.setOrReportFgColor(O))),this._parser.registerOscHandler(11,new C.OscHandler(O=>this.setOrReportBgColor(O))),this._parser.registerOscHandler(12,new C.OscHandler(O=>this.setOrReportCursorColor(O))),this._parser.registerOscHandler(104,new C.OscHandler(O=>this.restoreIndexedColor(O))),this._parser.registerOscHandler(110,new C.OscHandler(O=>this.restoreFgColor(O))),this._parser.registerOscHandler(111,new C.OscHandler(O=>this.restoreBgColor(O))),this._parser.registerOscHandler(112,new C.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 f.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 S.DcsHandler((O,K)=>this.requestStatusString(O,K)))}_preserveStack(R,P,N,j){this._parseStack.paused=!0,this._parseStack.cursorStartX=R,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=N,this._parseStack.position=j}_logSlowResolvingAsync(R){this._logService.logLevel<=b.LogLevelEnum.WARN&&Promise.race([R,new Promise((P,N)=>setTimeout(()=>N("#SLOW_TIMEOUT"),5e3))]).catch(P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(R,P){let N,j=this._activeBuffer.x,U=this._activeBuffer.y,V=0;const ee=this._parseStack.paused;if(ee){if(N=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(N),N;j=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,R.length>A&&(V=this._parseStack.position+A)}if(this._logService.logLevel<=b.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof R=="string"?` "${R}"`:` "${Array.prototype.map.call(R,O=>String.fromCharCode(O)).join("")}"`),typeof R=="string"?R.split("").map(O=>O.charCodeAt(0)):R),this._parseBuffer.length<R.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(R.length,A))),ee||this._dirtyRowTracker.clearRange(),R.length>A)for(let O=V;O<R.length;O+=A){const K=O+A<R.length?O+A:R.length,W=typeof R=="string"?this._stringDecoder.decode(R.substring(O,K),this._parseBuffer):this._utf8Decoder.decode(R.subarray(O,K),this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,W))return this._preserveStack(j,U,W,O),this._logSlowResolvingAsync(N),N}else if(!ee){const O=typeof R=="string"?this._stringDecoder.decode(R,this._parseBuffer):this._utf8Decoder.decode(R,this._parseBuffer);if(N=this._parser.parse(this._parseBuffer,O))return this._preserveStack(j,U,O,0),this._logSlowResolvingAsync(N),N}this._activeBuffer.x===j&&this._activeBuffer.y===U||this._onCursorMove.fire();const Q=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(z,this._bufferService.rows-1),Math.min(Q,this._bufferService.rows-1))}print(R,P,N){let j,U;const V=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,Q=this._bufferService.cols,z=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,K=this._curAttrData;let W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&N-P>0&&W.getWidth(this._activeBuffer.x-1)===2&&W.setCellFromCodepoint(this._activeBuffer.x-1,0,1,K);let te=this._parser.precedingJoinState;for(let J=P;J<N;++J){if(j=R[J],j<127&&V){const re=V[String.fromCharCode(j)];re&&(j=re.charCodeAt(0))}const _e=this._unicodeService.charProperties(j,te);U=x.UnicodeService.extractWidth(_e);const ue=x.UnicodeService.extractShouldJoin(_e),se=ue?x.UnicodeService.extractWidth(te):0;if(te=_e,ee&&this._onA11yChar.fire((0,v.stringFromCodePoint)(j)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-se>Q){if(z){const re=W;let ae=this._activeBuffer.x-se;for(this._activeBuffer.x=se,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),W=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),se>0&&W instanceof h.BufferLine&&W.copyCellsFrom(re,ae,0,se,!1);ae<Q;)re.setCellFromCodepoint(ae++,0,1,K)}else if(this._activeBuffer.x=Q-1,U===2)continue}if(ue&&this._activeBuffer.x){const re=W.getWidth(this._activeBuffer.x-1)?1:2;W.addCodepointToCell(this._activeBuffer.x-re,j,U);for(let ae=U-se;--ae>=0;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}else if(O&&(W.insertCells(this._activeBuffer.x,U-se,this._activeBuffer.getNullCell(K)),W.getWidth(Q-1)===2&&W.setCellFromCodepoint(Q-1,d.NULL_CELL_CODE,d.NULL_CELL_WIDTH,K)),W.setCellFromCodepoint(this._activeBuffer.x++,j,U,K),U>0)for(;--U;)W.setCellFromCodepoint(this._activeBuffer.x++,0,0,K)}this._parser.precedingJoinState=te,this._activeBuffer.x<Q&&N-P>0&&W.getWidth(this._activeBuffer.x)===0&&!W.hasContent(this._activeBuffer.x)&&W.setCellFromCodepoint(this._activeBuffer.x,0,1,K),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(R,P){return R.final!=="t"||R.prefix||R.intermediates?this._parser.registerCsiHandler(R,P):this._parser.registerCsiHandler(R,N=>!M(N.params[0],this._optionsService.rawOptions.windowOptions)||P(N))}registerDcsHandler(R,P){return this._parser.registerDcsHandler(R,new S.DcsHandler(P))}registerEscHandler(R,P){return this._parser.registerEscHandler(R,P)}registerOscHandler(R,P){return this._parser.registerOscHandler(R,new C.OscHandler(P))}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 R;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&&((R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&R.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);P.hasWidth(this._activeBuffer.x)&&!P.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const R=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-R),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(R=this._bufferService.cols-1){this._activeBuffer.x=Math.min(R,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(R,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=R,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=R,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(R,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+R,this._activeBuffer.y+P)}cursorUp(R){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,R.params[0]||1)):this._moveCursor(0,-(R.params[0]||1)),!0}cursorDown(R){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,R.params[0]||1)):this._moveCursor(0,R.params[0]||1),!0}cursorForward(R){return this._moveCursor(R.params[0]||1,0),!0}cursorBackward(R){return this._moveCursor(-(R.params[0]||1),0),!0}cursorNextLine(R){return this.cursorDown(R),this._activeBuffer.x=0,!0}cursorPrecedingLine(R){return this.cursorUp(R),this._activeBuffer.x=0,!0}cursorCharAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(R){return this._setCursor(R.length>=2?(R.params[1]||1)-1:0,(R.params[0]||1)-1),!0}charPosAbsolute(R){return this._setCursor((R.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(R){return this._moveCursor(R.params[0]||1,0),!0}linePosAbsolute(R){return this._setCursor(this._activeBuffer.x,(R.params[0]||1)-1),!0}vPositionRelative(R){return this._moveCursor(0,R.params[0]||1),!0}hVPosition(R){return this.cursorPosition(R),!0}tabClear(R){const P=R.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(R){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=R.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(R){const P=R.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(R,P,N,j=!1,U=!1){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);V.replaceCells(P,N,this._activeBuffer.getNullCell(this._eraseAttrData()),U),j&&(V.isWrapped=!1)}_resetBufferLine(R,P=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);N&&(N.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+R),N.isWrapped=!1)}eraseInDisplay(R,P=!1){let N;switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);N<this._bufferService.rows;N++)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(N);break;case 1:for(N=this._activeBuffer.y,this._dirtyRowTracker.markDirty(N),this._eraseInBufferLine(N,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(N+1).isWrapped=!1);N--;)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(N=this._bufferService.rows,this._dirtyRowTracker.markDirty(N-1);N--;)this._resetBufferLine(N,P);this._dirtyRowTracker.markDirty(0);break;case 3:const j=this._activeBuffer.lines.length-this._bufferService.rows;j>0&&(this._activeBuffer.lines.trimStart(j),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-j,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-j,0),this._onScroll.fire(0))}return!0}eraseInLine(R,P=!1){switch(this._restrictCursor(this._bufferService.cols),R.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y,j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-j+1;for(;P--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(N,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(R){this._restrictCursor();let P=R.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const N=this._activeBuffer.ybase+this._activeBuffer.y;let j;for(j=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-j;P--;)this._activeBuffer.lines.splice(N,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,R.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(R){let P=R.params[0]||1;for(;P--;)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(R){let P=R.params[0]||1;for(;P--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(R){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=R.params[0]||1;for(let N=this._activeBuffer.scrollTop;N<=this._activeBuffer.scrollBottom;++N){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+N);j.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),j.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(R){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(R.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(R){const P=this._parser.precedingJoinState;if(!P)return!0;const N=R.params[0]||1,j=x.UnicodeService.extractWidth(P),U=this._activeBuffer.x-j,V=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),ee=new Uint32Array(V.length*N);let Q=0;for(let O=0;O<V.length;){const K=V.codePointAt(O)||0;ee[Q++]=K,O+=K>65535?2:1}let z=Q;for(let O=1;O<N;++O)ee.copyWithin(z,0,Q),z+=Q;return this.print(ee,0,z),!0}sendDeviceAttributesPrimary(R){return R.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(R){return R.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(R.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(R){return(this._optionsService.rawOptions.termName+"").indexOf(R)===0}setMode(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.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(R){for(let P=0;P<R.length;P++)switch(R.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(R){for(let P=0;P<R.length;P++)switch(R.params[P]){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(),R.params[P]===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(R,P){const N=this._coreService.decPrivateModes,{activeProtocol:j,activeEncoding:U}=this._coreMouseService,V=this._coreService,{buffers:ee,cols:Q}=this._bufferService,{active:z,alt:O}=ee,K=this._optionsService.rawOptions,W=ue=>ue?1:2,te=R.params[0];return J=te,_e=P?te===2?4:te===4?W(V.modes.insertMode):te===12?3:te===20?W(K.convertEol):0:te===1?W(N.applicationCursorKeys):te===3?K.windowOptions.setWinLines?Q===80?2:Q===132?1:0:0:te===6?W(N.origin):te===7?W(N.wraparound):te===8?3:te===9?W(j==="X10"):te===12?W(K.cursorBlink):te===25?W(!V.isCursorHidden):te===45?W(N.reverseWraparound):te===66?W(N.applicationKeypad):te===67?4:te===1e3?W(j==="VT200"):te===1002?W(j==="DRAG"):te===1003?W(j==="ANY"):te===1004?W(N.sendFocus):te===1005?4:te===1006?W(U==="SGR"):te===1015?4:te===1016?W(U==="SGR_PIXELS"):te===1048?1:te===47||te===1047||te===1049?W(z===O):te===2004?W(N.bracketedPasteMode):0,V.triggerDataEvent(`${u.C0.ESC}[${P?"":"?"}${J};${_e}$y`),!0;var J,_e}_updateAttrColor(R,P,N,j,U){return P===2?(R|=50331648,R&=-16777216,R|=w.AttributeData.fromColorRGB([N,j,U])):P===5&&(R&=-50331904,R|=33554432|255&N),R}_extractColor(R,P,N){const j=[0,0,-1,0,0,0];let U=0,V=0;do{if(j[V+U]=R.params[P+V],R.hasSubParams(P+V)){const ee=R.getSubParams(P+V);let Q=0;do j[1]===5&&(U=1),j[V+Q+1+U]=ee[Q];while(++Q<ee.length&&Q+V+1+U<j.length);break}if(j[1]===5&&V+U>=2||j[1]===2&&V+U>=5)break;j[1]&&(U=1)}while(++V+P<R.length&&V+U<j.length);for(let ee=2;ee<j.length;++ee)j[ee]===-1&&(j[ee]=0);switch(j[0]){case 38:N.fg=this._updateAttrColor(N.fg,j[1],j[3],j[4],j[5]);break;case 48:N.bg=this._updateAttrColor(N.bg,j[1],j[3],j[4],j[5]);break;case 58:N.extended=N.extended.clone(),N.extended.underlineColor=this._updateAttrColor(N.extended.underlineColor,j[1],j[3],j[4],j[5])}return V}_processUnderline(R,P){P.extended=P.extended.clone(),(!~R||R>5)&&(R=1),P.extended.underlineStyle=R,P.fg|=268435456,R===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(R){R.fg=h.DEFAULT_ATTR_DATA.fg,R.bg=h.DEFAULT_ATTR_DATA.bg,R.extended=R.extended.clone(),R.extended.underlineStyle=0,R.extended.underlineColor&=-67108864,R.updateExtended()}charAttributes(R){if(R.length===1&&R.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=R.length;let N;const j=this._curAttrData;for(let U=0;U<P;U++)N=R.params[U],N>=30&&N<=37?(j.fg&=-50331904,j.fg|=16777216|N-30):N>=40&&N<=47?(j.bg&=-50331904,j.bg|=16777216|N-40):N>=90&&N<=97?(j.fg&=-50331904,j.fg|=16777224|N-90):N>=100&&N<=107?(j.bg&=-50331904,j.bg|=16777224|N-100):N===0?this._processSGR0(j):N===1?j.fg|=134217728:N===3?j.bg|=67108864:N===4?(j.fg|=268435456,this._processUnderline(R.hasSubParams(U)?R.getSubParams(U)[0]:1,j)):N===5?j.fg|=536870912:N===7?j.fg|=67108864:N===8?j.fg|=1073741824:N===9?j.fg|=2147483648:N===2?j.bg|=134217728:N===21?this._processUnderline(2,j):N===22?(j.fg&=-134217729,j.bg&=-134217729):N===23?j.bg&=-67108865:N===24?(j.fg&=-268435457,this._processUnderline(0,j)):N===25?j.fg&=-536870913:N===27?j.fg&=-67108865:N===28?j.fg&=-1073741825:N===29?j.fg&=2147483647:N===39?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg):N===49?(j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):N===38||N===48||N===58?U+=this._extractColor(R,U,j):N===53?j.bg|=1073741824:N===55?j.bg&=-1073741825:N===59?(j.extended=j.extended.clone(),j.extended.underlineColor=-1,j.updateExtended()):N===100?(j.fg&=-67108864,j.fg|=16777215&h.DEFAULT_ATTR_DATA.fg,j.bg&=-67108864,j.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",N);return!0}deviceStatus(R){switch(R.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${P};${N}R`)}return!0}deviceStatusPrivate(R){if(R.params[0]===6){const P=this._activeBuffer.y+1,N=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${P};${N}R`)}return!0}softReset(R){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(R){const P=R.params[0]||1;switch(P){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 N=P%2==1;return this._optionsService.options.cursorBlink=N,!0}setScrollRegion(R){const P=R.params[0]||1;let N;return(R.length<2||(N=R.params[1])>this._bufferService.rows||N===0)&&(N=this._bufferService.rows),N>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=N-1,this._setCursor(0,0)),!0}windowOptions(R){if(!M(R.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=R.length>1?R.params[1]:0;switch(R.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(R){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(R){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(R){return this._windowTitle=R,this._onTitleChange.fire(R),!0}setIconName(R){return this._iconName=R,!0}setOrReportIndexedColor(R){const P=[],N=R.split(";");for(;N.length>1;){const j=N.shift(),U=N.shift();if(/^\d+$/.exec(j)){const V=parseInt(j);if($(V))if(U==="?")P.push({type:0,index:V});else{const ee=(0,E.parseColor)(U);ee&&P.push({type:1,index:V,color:ee})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(R){const P=R.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(R,P){this._getCurrentLinkId()&&this._finishHyperlink();const N=R.split(":");let j;const U=N.findIndex(V=>V.startsWith("id="));return U!==-1&&(j=N[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:j,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(R,P){const N=R.split(";");for(let j=0;j<N.length&&!(P>=this._specialColors.length);++j,++P)if(N[j]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const U=(0,E.parseColor)(N[j]);U&&this._onColor.fire([{type:1,index:this._specialColors[P],color:U}])}return!0}setOrReportFgColor(R){return this._setOrReportSpecialColor(R,0)}setOrReportBgColor(R){return this._setOrReportSpecialColor(R,1)}setOrReportCursorColor(R){return this._setOrReportSpecialColor(R,2)}restoreIndexedColor(R){if(!R)return this._onColor.fire([{type:2}]),!0;const P=[],N=R.split(";");for(let j=0;j<N.length;++j)if(/^\d+$/.exec(N[j])){const U=parseInt(N[j]);$(U)&&P.push({type:2,index:U})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(R){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(R){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(R){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,f.DEFAULT_CHARSET),!0}selectCharset(R){return R.length!==2?(this.selectDefaultCharset(),!0):(R[0]==="/"||this._charsetService.setgCharset(L[R[0]],f.CHARSETS[R[1]]||f.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 R=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,R,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(R){return this._charsetService.setgLevel(R),!0}screenAlignmentPattern(){const R=new g.CellData;R.content=4194373,R.fg=this._curAttrData.fg,R.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const N=this._activeBuffer.ybase+this._activeBuffer.y+P,j=this._activeBuffer.lines.get(N);j&&(j.fill(R),j.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(R,P){const N=this._bufferService.buffer,j=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${U}${u.C0.ESC}\\`),!0))(R==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:R==='"p'?'P1$r61;1"p':R==="r"?`P1$r${N.scrollTop+1};${N.scrollBottom+1}r`:R==="m"?"P1$r0m":R===" q"?`P1$r${{block:2,underline:4,bar:6}[j.cursorStyle]-(j.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(R,P){this._dirtyRowTracker.markRangeDirty(R,P)}}s.InputHandler=H;let F=class{constructor(I){this._bufferService=I,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(I){I<this.start?this.start=I:I>this.end&&(this.end=I)}markRangeDirty(I,R){I>R&&(B=I,I=R,R=B),I<this.start&&(this.start=I),R>this.end&&(this.end=R)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function $(I){return 0<=I&&I<256}F=c([p(0,b.IBufferService)],F)},844:(l,s)=>{function o(c){for(const p of c)p.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const p=this._disposables.indexOf(c);p!==-1&&this._disposables.splice(p,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var p;this._isDisposed||c===this._value||((p=this._value)==null||p.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(p,u,f){this._data[p]||(this._data[p]={}),this._data[p][u]=f}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,p,u,f,_){this._data.get(c,p)||this._data.set(c,p,new o),this._data.get(c,p).set(u,f,_)}get(c,p,u,f){var _;return(_=this._data.get(c,p))==null?void 0:_.get(u,f)}clear(){this._data.clear()}}},6114:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},6106:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SortedList=void 0;let o=0;s.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const p=this._getKey(c);if(p===void 0||(o=this._search(p),o===-1)||this._getKey(this._array[o])!==p)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===p);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,p){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do p(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let p=0,u=this._array.length-1;for(;u>=p;){let f=p+u>>1;const _=this._getKey(this._array[f]);if(_>c)u=f-1;else{if(!(_<c)){for(;f>0&&this._getKey(this._array[f-1])===c;)f--;return f}p=f+1}}return p}}},7226:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const c=o(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),m=_.timeRemaining(),1.5*v>m)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=m}this.clear()}}class u extends p{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.updateWindowsModeWrappedState=void 0;const c=o(643);s.updateWindowsModeWrappedState=function(p){const u=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),f=u==null?void 0:u.get(p.cols-1),_=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);_&&f&&(_.isWrapped=f[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&f[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,f=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=f}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},9092:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Buffer=s.MAX_BUFFER_SIZE=void 0;const c=o(6349),p=o(7226),u=o(3734),f=o(8437),_=o(4634),y=o(511),v=o(643),h=o(4863),m=o(7116);s.MAX_BUFFER_SIZE=4294967295,s.Buffer=class{constructor(d,g,w){this._hasScrollback=d,this._optionsService=g,this._bufferService=w,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,v.WHITESPACE_CELL_CHAR,v.WHITESPACE_CELL_WIDTH,v.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(d){return d?(this._nullCell.fg=d.fg,this._nullCell.bg=d.bg,this._nullCell.extended=d.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(d){return d?(this._whitespaceCell.fg=d.fg,this._whitespaceCell.bg=d.bg,this._whitespaceCell.extended=d.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(d,g){return new f.BufferLine(this._bufferService.cols,this.getNullCell(d),g)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const d=this.ybase+this.y-this.ydisp;return d>=0&&d<this._rows}_getCorrectBufferLength(d){if(!this._hasScrollback)return d;const g=d+this._optionsService.rawOptions.scrollback;return g>s.MAX_BUFFER_SIZE?s.MAX_BUFFER_SIZE:g}fillViewportRows(d){if(this.lines.length===0){d===void 0&&(d=f.DEFAULT_ATTR_DATA);let g=this._rows;for(;g--;)this.lines.push(this.getBlankLine(d))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(d,g){const w=this.getNullCell(f.DEFAULT_ATTR_DATA);let b=0;const x=this._getCorrectBufferLength(g);if(x>this.lines.maxLength&&(this.lines.maxLength=x),this.lines.length>0){if(this._cols<d)for(let S=0;S<this.lines.length;S++)b+=+this.lines.get(S).resize(d,w);let C=0;if(this._rows<g)for(let S=this._rows;S<g;S++)this.lines.length<g+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(d,w)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(d,w)));else for(let S=this._rows;S>g;S--)this.lines.length>g+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(x<this.lines.maxLength){const S=this.lines.length-x;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=x}this.x=Math.min(this.x,d-1),this.y=Math.min(this.y,g-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,d-1),this.scrollTop=0}if(this.scrollBottom=g-1,this._isReflowEnabled&&(this._reflow(d,g),this._cols>d))for(let C=0;C<this.lines.length;C++)b+=+this.lines.get(C).resize(d,w);this._cols=d,this._rows=g,this._memoryCleanupQueue.clear(),b>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let d=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,d=!1);let g=0;for(;this._memoryCleanupPosition<this.lines.length;)if(g+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),g>100)return!0;return d}get _isReflowEnabled(){const d=this._optionsService.rawOptions.windowsPty;return d&&d.buildNumber?this._hasScrollback&&d.backend==="conpty"&&d.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(d,g){this._cols!==d&&(d>this._cols?this._reflowLarger(d,g):this._reflowSmaller(d,g))}_reflowLarger(d,g){const w=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,d,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(w.length>0){const b=(0,_.reflowLargerCreateNewLayout)(this.lines,w);(0,_.reflowLargerApplyNewLayout)(this.lines,b.layout),this._reflowLargerAdjustViewport(d,g,b.countRemoved)}}_reflowLargerAdjustViewport(d,g,w){const b=this.getNullCell(f.DEFAULT_ATTR_DATA);let x=w;for(;x-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<g&&this.lines.push(new f.BufferLine(d,b))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-w,0)}_reflowSmaller(d,g){const w=this.getNullCell(f.DEFAULT_ATTR_DATA),b=[];let x=0;for(let C=this.lines.length-1;C>=0;C--){let S=this.lines.get(C);if(!S||!S.isWrapped&&S.getTrimmedLength()<=d)continue;const E=[S];for(;S.isWrapped&&C>0;)S=this.lines.get(--C),E.unshift(S);const L=this.ybase+this.y;if(L>=C&&L<C+E.length)continue;const A=E[E.length-1].getTrimmedLength(),M=(0,_.reflowSmallerGetNewLineLengths)(E,this._cols,d),D=M.length-E.length;let B;B=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const H=[];for(let N=0;N<D;N++){const j=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);H.push(j)}H.length>0&&(b.push({start:C+E.length+x,newLines:H}),x+=H.length),E.push(...H);let F=M.length-1,$=M[F];$===0&&(F--,$=M[F]);let I=E.length-D-1,R=A;for(;I>=0;){const N=Math.min(R,$);if(E[F]===void 0)break;if(E[F].copyCellsFrom(E[I],R-N,$-N,N,!0),$-=N,$===0&&(F--,$=M[F]),R-=N,R===0){I--;const j=Math.max(I,0);R=(0,_.getWrappedLineTrimmedLength)(E,j,this._cols)}}for(let N=0;N<E.length;N++)M[N]<d&&E[N].setCell(M[N],w);let P=D-B;for(;P-- >0;)this.ybase===0?this.y<g-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+x)-g&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+g-1)}if(b.length>0){const C=[],S=[];for(let F=0;F<this.lines.length;F++)S.push(this.lines.get(F));const E=this.lines.length;let L=E-1,A=0,M=b[A];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+x);let D=0;for(let F=Math.min(this.lines.maxLength-1,E+x-1);F>=0;F--)if(M&&M.start>L+D){for(let $=M.newLines.length-1;$>=0;$--)this.lines.set(F--,M.newLines[$]);F++,C.push({index:L+1,amount:M.newLines.length}),D+=M.newLines.length,M=b[++A]}else this.lines.set(F,S[L--]);let B=0;for(let F=C.length-1;F>=0;F--)C[F].index+=B,this.lines.onInsertEmitter.fire(C[F]),B+=C[F].amount;const H=Math.max(0,E+x-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(d,g,w=0,b){const x=this.lines.get(d);return x?x.translateToString(g,w,b):""}getWrappedRangeForLine(d){let g=d,w=d;for(;g>0&&this.lines.get(g).isWrapped;)g--;for(;w+1<this.lines.length&&this.lines.get(w+1).isWrapped;)w++;return{first:g,last:w}}setupTabStops(d){for(d!=null?this.tabs[d]||(d=this.prevStop(d)):(this.tabs={},d=0);d<this._cols;d+=this._optionsService.rawOptions.tabStopWidth)this.tabs[d]=!0}prevStop(d){for(d==null&&(d=this.x);!this.tabs[--d]&&d>0;);return d>=this._cols?this._cols-1:d<0?0:d}nextStop(d){for(d==null&&(d=this.x);!this.tabs[++d]&&d<this._cols;);return d>=this._cols?this._cols-1:d<0?0:d}clearMarkers(d){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].line===d&&(this.markers[g].dispose(),this.markers.splice(g--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].dispose(),this.markers.splice(d--,1);this._isClearing=!1}addMarker(d){const g=new h.Marker(d);return this.markers.push(g),g.register(this.lines.onTrim(w=>{g.line-=w,g.line<0&&g.dispose()})),g.register(this.lines.onInsert(w=>{g.line>=w.index&&(g.line+=w.amount)})),g.register(this.lines.onDelete(w=>{g.line>=w.index&&g.line<w.index+w.amount&&g.dispose(),g.line>w.index&&(g.line-=w.amount)})),g.register(g.onDispose(()=>this._removeMarker(g))),g}_removeMarker(d){this._isClearing||this.markers.splice(this.markers.indexOf(d),1)}}},8437:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLine=s.DEFAULT_ATTR_DATA=void 0;const c=o(3734),p=o(511),u=o(643),f=o(482);s.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let _=0;class y{constructor(h,m,d=!1){this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const g=m||p.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let w=0;w<h;++w)this.setCell(w,g);this.length=h}get(h){const m=this._data[3*h+0],d=2097151&m;return[this._data[3*h+1],2097152&m?this._combined[h]:d?(0,f.stringFromCodePoint)(d):"",m>>22,2097152&m?this._combined[h].charCodeAt(this._combined[h].length-1):d]}set(h,m){this._data[3*h+1]=m[u.CHAR_DATA_ATTR_INDEX],m[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=m[1],this._data[3*h+0]=2097152|h|m[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=m[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const m=this._data[3*h+0];return 2097152&m?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&m}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const m=this._data[3*h+0];return 2097152&m?this._combined[h]:2097151&m?(0,f.stringFromCodePoint)(2097151&m):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,m){return _=3*h,m.content=this._data[_+0],m.fg=this._data[_+1],m.bg=this._data[_+2],2097152&m.content&&(m.combinedData=this._combined[h]),268435456&m.bg&&(m.extended=this._extendedAttrs[h]),m}setCell(h,m){2097152&m.content&&(this._combined[h]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[h]=m.extended),this._data[3*h+0]=m.content,this._data[3*h+1]=m.fg,this._data[3*h+2]=m.bg}setCellFromCodepoint(h,m,d,g){268435456&g.bg&&(this._extendedAttrs[h]=g.extended),this._data[3*h+0]=m|d<<22,this._data[3*h+1]=g.fg,this._data[3*h+2]=g.bg}addCodepointToCell(h,m,d){let g=this._data[3*h+0];2097152&g?this._combined[h]+=(0,f.stringFromCodePoint)(m):2097151&g?(this._combined[h]=(0,f.stringFromCodePoint)(2097151&g)+(0,f.stringFromCodePoint)(m),g&=-2097152,g|=2097152):g=m|4194304,d&&(g&=-12582913,g|=d<<22),this._data[3*h+0]=g}insertCells(h,m,d){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length-h){const g=new p.CellData;for(let w=this.length-h-m-1;w>=0;--w)this.setCell(h+m+w,this.loadCell(h+w,g));for(let w=0;w<m;++w)this.setCell(h+w,d)}else for(let g=h;g<this.length;++g)this.setCell(g,d);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,d)}deleteCells(h,m,d){if(h%=this.length,m<this.length-h){const g=new p.CellData;for(let w=0;w<this.length-h-m;++w)this.setCell(h+w,this.loadCell(h+m+w,g));for(let w=this.length-m;w<this.length;++w)this.setCell(w,d)}else for(let g=h;g<this.length;++g)this.setCell(g,d);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,d)}replaceCells(h,m,d,g=!1){if(g)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,d);h<m&&h<this.length;)this.isProtected(h)||this.setCell(h,d),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,d),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,d);h<m&&h<this.length;)this.setCell(h++,d)}resize(h,m){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const d=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*d)this._data=new Uint32Array(this._data.buffer,0,d);else{const g=new Uint32Array(d);g.set(this._data),this._data=g}for(let g=this.length;g<h;++g)this.setCell(g,m)}else{this._data=this._data.subarray(0,d);const g=Object.keys(this._combined);for(let b=0;b<g.length;b++){const x=parseInt(g[b],10);x>=h&&delete this._combined[x]}const w=Object.keys(this._extendedAttrs);for(let b=0;b<w.length;b++){const x=parseInt(w[b],10);x>=h&&delete this._extendedAttrs[x]}}return this.length=h,4*d*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,m=!1){if(m)for(let d=0;d<this.length;++d)this.isProtected(d)||this.setCell(d,h);else{this._combined={},this._extendedAttrs={};for(let d=0;d<this.length;++d)this.setCell(d,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const m in h._combined)this._combined[m]=h._combined[m];this._extendedAttrs={};for(const m in h._extendedAttrs)this._extendedAttrs[m]=h._extendedAttrs[m];this.isWrapped=h.isWrapped}clone(){const h=new y(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const m in this._combined)h._combined[m]=this._combined[m];for(const m in this._extendedAttrs)h._extendedAttrs[m]=this._extendedAttrs[m];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,m,d,g,w){const b=h._data;if(w)for(let C=g-1;C>=0;C--){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(m+C)+S];268435456&b[3*(m+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[m+C])}else for(let C=0;C<g;C++){for(let S=0;S<3;S++)this._data[3*(d+C)+S]=b[3*(m+C)+S];268435456&b[3*(m+C)+2]&&(this._extendedAttrs[d+C]=h._extendedAttrs[m+C])}const x=Object.keys(h._combined);for(let C=0;C<x.length;C++){const S=parseInt(x[C],10);S>=m&&(this._combined[S-m+d]=h._combined[S])}}translateToString(h,m,d,g){m=m??0,d=d??this.length,h&&(d=Math.min(d,this.getTrimmedLength())),g&&(g.length=0);let w="";for(;m<d;){const b=this._data[3*m+0],x=2097151&b,C=2097152&b?this._combined[m]:x?(0,f.stringFromCodePoint)(x):u.WHITESPACE_CELL_CHAR;if(w+=C,g)for(let S=0;S<C.length;++S)g.push(m);m+=b>>22||1}return g&&g.push(m),w}}s.BufferLine=y},4841:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getRangeLength=void 0,s.getRangeLength=function(o,c){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(l,s)=>{function o(c,p,u){if(p===c.length-1)return c[p].getTrimmedLength();const f=!c[p].hasContent(u-1)&&c[p].getWidth(u-1)===1,_=c[p+1].getWidth(0)===2;return f&&_?u-1:u}Object.defineProperty(s,"__esModule",{value:!0}),s.getWrappedLineTrimmedLength=s.reflowSmallerGetNewLineLengths=s.reflowLargerApplyNewLayout=s.reflowLargerCreateNewLayout=s.reflowLargerGetLinesToRemove=void 0,s.reflowLargerGetLinesToRemove=function(c,p,u,f,_){const y=[];for(let v=0;v<c.length-1;v++){let h=v,m=c.get(++h);if(!m.isWrapped)continue;const d=[c.get(v)];for(;h<c.length&&m.isWrapped;)d.push(m),m=c.get(++h);if(f>=v&&f<h){v+=d.length-1;continue}let g=0,w=o(d,g,p),b=1,x=0;for(;b<d.length;){const S=o(d,b,p),E=S-x,L=u-w,A=Math.min(E,L);d[g].copyCellsFrom(d[b],x,w,A,!1),w+=A,w===u&&(g++,w=0),x+=A,x===S&&(b++,x=0),w===0&&g!==0&&d[g-1].getWidth(u-1)===2&&(d[g].copyCellsFrom(d[g-1],u-1,w++,1,!1),d[g-1].setCell(u-1,_))}d[g].replaceCells(w,u,_);let C=0;for(let S=d.length-1;S>0&&(S>g||d[S].getTrimmedLength()===0);S--)C++;C>0&&(y.push(v+d.length-C),y.push(C)),v+=d.length-1}return y},s.reflowLargerCreateNewLayout=function(c,p){const u=[];let f=0,_=p[f],y=0;for(let v=0;v<c.length;v++)if(_===v){const h=p[++f];c.onDeleteEmitter.fire({index:v-y,amount:h}),v+=h-1,y+=h,_=p[++f]}else u.push(v);return{layout:u,countRemoved:y}},s.reflowLargerApplyNewLayout=function(c,p){const u=[];for(let f=0;f<p.length;f++)u.push(c.get(p[f]));for(let f=0;f<u.length;f++)c.set(f,u[f]);c.length=p.length},s.reflowSmallerGetNewLineLengths=function(c,p,u){const f=[],_=c.map((m,d)=>o(c,d,p)).reduce((m,d)=>m+d);let y=0,v=0,h=0;for(;h<_;){if(_-h<u){f.push(_-h);break}y+=u;const m=o(c,v,p);y>m&&(y-=m,v++);const d=c[v].getWidth(y-1)===2;d&&y--;const g=d?u-1:u;f.push(g),h+=g}return f},s.getWrappedLineTrimmedLength=o},5295:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferSet=void 0;const c=o(8460),p=o(844),u=o(9092);class f extends p.Disposable{constructor(y,v){super(),this._optionsService=y,this._bufferService=v,this._onBufferActivate=this.register(new c.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 u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,v){this._normal.resize(y,v),this._alt.resize(y,v),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}s.BufferSet=f},511:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const c=o(482),p=o(643),u=o(3734);class f extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new f;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[p.CHAR_DATA_CHAR_INDEX].length===2){const h=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const m=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(h-55296)+m-56320+65536|y[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=f},643:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},4863:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Marker=void 0;const c=o(8460),p=o(844);class u{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}s.Marker=u,u._nextId=1},7116:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DEFAULT_CHARSET=s.CHARSETS=void 0,s.CHARSETS={},s.DEFAULT_CHARSET=s.CHARSETS.B,s.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:"≥","{":"π","|":"≠","}":"£","~":"·"},s.CHARSETS.A={"#":"£"},s.CHARSETS.B=void 0,s.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},s.CHARSETS.C=s.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},s.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},s.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},s.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},s.CHARSETS.E=s.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},s.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},s.CHARSETS.H=s.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},s.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(l,s)=>{var o,c,p;Object.defineProperty(s,"__esModule",{value:!0}),s.C1_ESCAPED=s.C1=s.C0=void 0,function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
|
|
59
59
|
`,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL=""}(o||(s.C0=o={})),function(u){u.PAD="",u.HOP="",u.BPH="",u.NBH="",u.IND="",u.NEL="
",u.SSA="",u.ESA="",u.HTS="",u.HTJ="",u.VTS="",u.PLD="",u.PLU="",u.RI="",u.SS2="",u.SS3="",u.DCS="",u.PU1="",u.PU2="",u.STS="",u.CCH="",u.MW="",u.SPA="",u.EPA="",u.SOS="",u.SGCI="",u.SCI="",u.CSI="",u.ST="",u.OSC="",u.PM="",u.APC=""}(c||(s.C1=c={})),function(u){u.ST=`${o.ESC}\\`}(p||(s.C1_ESCAPED=p={}))},7399:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.evaluateKeyboardEvent=void 0;const c=o(2584),p={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:["'",'"']};s.evaluateKeyboardEvent=function(u,f,_,y){const v={type:0,cancel:!1,key:void 0},h=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?v.key=f?c.C0.ESC+"OA":c.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?v.key=f?c.C0.ESC+"OD":c.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?v.key=f?c.C0.ESC+"OC":c.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(v.key=f?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:v.key=u.ctrlKey?"\b":c.C0.DEL,u.altKey&&(v.key=c.C0.ESC+v.key);break;case 9:if(u.shiftKey){v.key=c.C0.ESC+"[Z";break}v.key=c.C0.HT,v.cancel=!0;break;case 13:v.key=u.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,v.cancel=!0;break;case 27:v.key=c.C0.ESC,u.altKey&&(v.key=c.C0.ESC+c.C0.ESC),v.cancel=!0;break;case 37:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"D",v.key===c.C0.ESC+"[1;3D"&&(v.key=c.C0.ESC+(_?"b":"[1;5D"))):v.key=f?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"C",v.key===c.C0.ESC+"[1;3C"&&(v.key=c.C0.ESC+(_?"f":"[1;5C"))):v.key=f?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"A",_||v.key!==c.C0.ESC+"[1;3A"||(v.key=c.C0.ESC+"[1;5A")):v.key=f?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(u.metaKey)break;h?(v.key=c.C0.ESC+"[1;"+(h+1)+"B",_||v.key!==c.C0.ESC+"[1;3B"||(v.key=c.C0.ESC+"[1;5B")):v.key=f?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(v.key=c.C0.ESC+"[2~");break;case 46:v.key=h?c.C0.ESC+"[3;"+(h+1)+"~":c.C0.ESC+"[3~";break;case 36:v.key=h?c.C0.ESC+"[1;"+(h+1)+"H":f?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:v.key=h?c.C0.ESC+"[1;"+(h+1)+"F":f?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:u.shiftKey?v.type=2:u.ctrlKey?v.key=c.C0.ESC+"[5;"+(h+1)+"~":v.key=c.C0.ESC+"[5~";break;case 34:u.shiftKey?v.type=3:u.ctrlKey?v.key=c.C0.ESC+"[6;"+(h+1)+"~":v.key=c.C0.ESC+"[6~";break;case 112:v.key=h?c.C0.ESC+"[1;"+(h+1)+"P":c.C0.ESC+"OP";break;case 113:v.key=h?c.C0.ESC+"[1;"+(h+1)+"Q":c.C0.ESC+"OQ";break;case 114:v.key=h?c.C0.ESC+"[1;"+(h+1)+"R":c.C0.ESC+"OR";break;case 115:v.key=h?c.C0.ESC+"[1;"+(h+1)+"S":c.C0.ESC+"OS";break;case 116:v.key=h?c.C0.ESC+"[15;"+(h+1)+"~":c.C0.ESC+"[15~";break;case 117:v.key=h?c.C0.ESC+"[17;"+(h+1)+"~":c.C0.ESC+"[17~";break;case 118:v.key=h?c.C0.ESC+"[18;"+(h+1)+"~":c.C0.ESC+"[18~";break;case 119:v.key=h?c.C0.ESC+"[19;"+(h+1)+"~":c.C0.ESC+"[19~";break;case 120:v.key=h?c.C0.ESC+"[20;"+(h+1)+"~":c.C0.ESC+"[20~";break;case 121:v.key=h?c.C0.ESC+"[21;"+(h+1)+"~":c.C0.ESC+"[21~";break;case 122:v.key=h?c.C0.ESC+"[23;"+(h+1)+"~":c.C0.ESC+"[23~";break;case 123:v.key=h?c.C0.ESC+"[24;"+(h+1)+"~":c.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(_&&!y||!u.altKey||u.metaKey)!_||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?v.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(v.key=c.C0.US),u.key==="@"&&(v.key=c.C0.NUL)):u.keyCode===65&&(v.type=1);else{const m=p[u.keyCode],d=m==null?void 0:m[u.shiftKey?1:0];if(d)v.key=c.C0.ESC+d;else if(u.keyCode>=65&&u.keyCode<=90){const g=u.ctrlKey?u.keyCode-64:u.keyCode+32;let w=String.fromCharCode(g);u.shiftKey&&(w=w.toUpperCase()),v.key=c.C0.ESC+w}else if(u.keyCode===32)v.key=c.C0.ESC+(u.ctrlKey?c.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let g=u.code.slice(3,4);u.shiftKey||(g=g.toLowerCase()),v.key=c.C0.ESC+g,v.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?v.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?v.key=c.C0.NUL:u.keyCode>=51&&u.keyCode<=55?v.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?v.key=c.C0.DEL:u.keyCode===219?v.key=c.C0.ESC:u.keyCode===220?v.key=c.C0.FS:u.keyCode===221&&(v.key=c.C0.GS)}return v}},482:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,p=o.length){let u="";for(let f=c;f<p;++f){let _=o[f];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const p=o.length;if(!p)return 0;let u=0,f=0;if(this._interim){const _=o.charCodeAt(f++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=f;_<p;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=p)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const p=o.length;if(!p)return 0;let u,f,_,y,v=0,h=0,m=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;m<E;){if(m>=p)return 0;if(x=o[m++],(192&x)!=128){m--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?m--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=p-4;let g=m;for(;g<p;){for(;!(!(g<d)||128&(u=o[g])||128&(f=o[g+1])||128&(_=o[g+2])||128&(y=o[g+3]));)c[v++]=u,c[v++]=f,c[v++]=_,c[v++]=y,g+=4;if(u=o[g++],u<128)c[v++]=u;else if((224&u)==192){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(h=(31&u)<<6|63&f,h<128){g--;continue}c[v++]=h}else if((240&u)==224){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(h=(15&u)<<12|(63&f)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,this.interim[2]=_,v;if(y=o[g++],(192&y)!=128){g--;continue}if(h=(7&u)<<18|(63&f)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},225:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeV6=void 0;const c=o(1480),p=[[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]],u=[[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 f;s.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let _=0;_<p.length;++_)f.fill(0,p[_][0],p[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?f[_]:function(y,v){let h,m=0,d=v.length-1;if(y<v[0][0]||y>v[d][1])return!1;for(;d>=m;)if(h=m+d>>1,y>v[h][1])m=h+1;else{if(!(y<v[h][0]))return!0;d=h-1}return!1}(_,u)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,y){let v=this.wcwidth(_),h=v===0&&y!==0;if(h){const m=c.UnicodeService.extractWidth(y);m===0?h=!1:m>v&&(v=m)}return c.UnicodeService.createPropertyValue(0,v,h)}}},5981:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WriteBuffer=void 0;const c=o(8460),p=o(844);class u extends p.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);const h=this._callbacks.shift();h&&h()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,y){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(y),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(y)}_innerWrite(_=0,y=!0){const v=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const h=this._writeBuffer[this._bufferOffset],m=this._action(h,y);if(m){const g=w=>Date.now()-v>=12?setTimeout(()=>this._innerWrite(0,w)):this._innerWrite(v,w);return void m.catch(w=>(queueMicrotask(()=>{throw w}),Promise.resolve(!1))).then(g)}const d=this._callbacks[this._bufferOffset];if(d&&d(),this._bufferOffset++,this._pendingData-=h.length,Date.now()-v>=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()}}s.WriteBuffer=u},5941:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.toRgbString=s.parseColor=void 0;const o=/^([\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})$/,c=/^[\da-f]+$/;function p(u,f){const _=u.toString(16),y=_.length<2?"0"+_:_;switch(f){case 4:return _[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}s.parseColor=function(u){if(!u)return;let f=u.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);const _=o.exec(f);if(_){const y=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/y*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/y*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/y*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),c.exec(f)&&[3,6,9,12].includes(f.length))){const _=f.length/3,y=[0,0,0];for(let v=0;v<3;++v){const h=parseInt(f.slice(_*v,_*v+_),16);y[v]=_===1?h<<4:_===2?h:_===3?h>>4:h>>8}return y}},s.toRgbString=function(u,f=16){const[_,y,v]=u;return`rgb:${p(_,f)}/${p(y,f)}/${p(v,f)}`}},5770:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PAYLOAD_LIMIT=void 0,s.PAYLOAD_LIMIT=1e7},6351:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DcsHandler=s.DcsParser=void 0;const c=o(482),p=o(8742),u=o(5770),f=[];s.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(y,v){this._handlers[y]===void 0&&(this._handlers[y]=[]);const h=this._handlers[y];return h.push(v),{dispose:()=>{const m=h.indexOf(v);m!==-1&&h.splice(m,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(y,v){if(this.reset(),this._ident=y,this._active=this._handlers[y]||f,this._active.length)for(let h=this._active.length-1;h>=0;h--)this._active[h].hook(v);else this._handlerFb(this._ident,"HOOK",v)}put(y,v,h){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(y,v,h);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(y,v,h))}unhook(y,v=!0){if(this._active.length){let h=!1,m=this._active.length-1,d=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,h=v,d=this._stack.fallThrough,this._stack.paused=!1),!d&&h===!1){for(;m>=0&&(h=this._active[m].unhook(y),h!==!0);m--)if(h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,h;m--}for(;m>=0;m--)if(h=this._active[m].unhook(!1),h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,h}else this._handlerFb(this._ident,"UNHOOK",y);this._active=f,this._ident=0}};const _=new p.Params;_.addParam(0),s.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=_,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():_,this._data="",this._hitLimit=!1}put(y,v,h){this._hitLimit||(this._data+=(0,c.utf32ToString)(y,v,h),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let v=!1;if(this._hitLimit)v=!1;else if(y&&(v=this._handler(this._data,this._params),v instanceof Promise))return v.then(h=>(this._params=_,this._data="",this._hitLimit=!1,h));return this._params=_,this._data="",this._hitLimit=!1,v}}},2015:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.EscapeSequenceParser=s.VT500_TRANSITION_TABLE=s.TransitionTable=void 0;const c=o(844),p=o(8742),u=o(6242),f=o(6351);class _{constructor(m){this.table=new Uint8Array(m)}setDefault(m,d){this.table.fill(m<<4|d)}add(m,d,g,w){this.table[d<<8|m]=g<<4|w}addMany(m,d,g,w){for(let b=0;b<m.length;b++)this.table[d<<8|m[b]]=g<<4|w}}s.TransitionTable=_;const y=160;s.VT500_TRANSITION_TABLE=function(){const h=new _(4095),m=Array.apply(null,Array(256)).map((C,S)=>S),d=(C,S)=>m.slice(C,S),g=d(32,127),w=d(0,24);w.push(25),w.push.apply(w,d(28,32));const b=d(0,14);let x;for(x in h.setDefault(1,0),h.addMany(g,0,2,0),b)h.addMany([24,26,153,154],x,3,0),h.addMany(d(128,144),x,3,0),h.addMany(d(144,152),x,3,0),h.add(156,x,0,0),h.add(27,x,11,1),h.add(157,x,4,8),h.addMany([152,158,159],x,0,7),h.add(155,x,11,3),h.add(144,x,11,9);return h.addMany(w,0,3,0),h.addMany(w,1,3,1),h.add(127,1,0,1),h.addMany(w,8,0,8),h.addMany(w,3,3,3),h.add(127,3,0,3),h.addMany(w,4,3,4),h.add(127,4,0,4),h.addMany(w,6,3,6),h.addMany(w,5,3,5),h.add(127,5,0,5),h.addMany(w,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(g,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(d(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(g,7,0,7),h.addMany(w,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(d(64,127),3,7,0),h.addMany(d(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(d(48,60),4,8,4),h.addMany(d(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(d(32,64),6,0,6),h.add(127,6,0,6),h.addMany(d(64,127),6,0,0),h.addMany(d(32,48),3,9,5),h.addMany(d(32,48),5,9,5),h.addMany(d(48,64),5,0,6),h.addMany(d(64,127),5,7,0),h.addMany(d(32,48),4,9,5),h.addMany(d(32,48),1,9,2),h.addMany(d(32,48),2,9,2),h.addMany(d(48,127),2,10,0),h.addMany(d(48,80),1,10,0),h.addMany(d(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(d(96,127),1,10,0),h.add(80,1,11,9),h.addMany(w,9,0,9),h.add(127,9,0,9),h.addMany(d(28,32),9,0,9),h.addMany(d(32,48),9,9,12),h.addMany(d(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(w,11,0,11),h.addMany(d(32,128),11,0,11),h.addMany(d(28,32),11,0,11),h.addMany(w,10,0,10),h.add(127,10,0,10),h.addMany(d(28,32),10,0,10),h.addMany(d(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(d(32,48),10,9,12),h.addMany(w,12,0,12),h.add(127,12,0,12),h.addMany(d(28,32),12,0,12),h.addMany(d(32,48),12,9,12),h.addMany(d(48,64),12,0,11),h.addMany(d(64,127),12,12,13),h.addMany(d(64,127),10,12,13),h.addMany(d(64,127),9,12,13),h.addMany(w,13,13,13),h.addMany(g,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(y,0,2,0),h.add(y,8,5,8),h.add(y,6,0,6),h.add(y,11,0,11),h.add(y,13,13,13),h}();class v extends c.Disposable{constructor(m=s.VT500_TRANSITION_TABLE){super(),this._transitions=m,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(d,g,w)=>{},this._executeHandlerFb=d=>{},this._csiHandlerFb=(d,g)=>{},this._escHandlerFb=d=>{},this._errorHandlerFb=d=>d,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new u.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(m,d=[64,126]){let g=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(g=m.prefix.charCodeAt(0),g&&60>g||g>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let b=0;b<m.intermediates.length;++b){const x=m.intermediates.charCodeAt(b);if(32>x||x>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");g<<=8,g|=x}}if(m.final.length!==1)throw new Error("final must be a single byte");const w=m.final.charCodeAt(0);if(d[0]>w||w>d[1])throw new Error(`final must be in range ${d[0]} .. ${d[1]}`);return g<<=8,g|=w,g}identToString(m){const d=[];for(;m;)d.push(String.fromCharCode(255&m)),m>>=8;return d.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,d){const g=this._identifier(m,[48,126]);this._escHandlers[g]===void 0&&(this._escHandlers[g]=[]);const w=this._escHandlers[g];return w.push(d),{dispose:()=>{const b=w.indexOf(d);b!==-1&&w.splice(b,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,d){this._executeHandlers[m.charCodeAt(0)]=d}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,d){const g=this._identifier(m);this._csiHandlers[g]===void 0&&(this._csiHandlers[g]=[]);const w=this._csiHandlers[g];return w.push(d),{dispose:()=>{const b=w.indexOf(d);b!==-1&&w.splice(b,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,d){return this._dcsParser.registerHandler(this._identifier(m),d)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,d){return this._oscParser.registerHandler(m,d)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(m,d,g,w,b){this._parseStack.state=m,this._parseStack.handlers=d,this._parseStack.handlerPos=g,this._parseStack.transition=w,this._parseStack.chunkPos=b}parse(m,d,g){let w,b=0,x=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(g===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(g===!1&&E>-1){for(;E>=0&&(w=S[E](this._params),w!==!0);E--)if(w instanceof Promise)return this._parseStack.handlerPos=E,w}this._parseStack.handlers=[];break;case 4:if(g===!1&&E>-1){for(;E>=0&&(w=S[E](),w!==!0);E--)if(w instanceof Promise)return this._parseStack.handlerPos=E,w}this._parseStack.handlers=[];break;case 6:if(b=m[this._parseStack.chunkPos],w=this._dcsParser.unhook(b!==24&&b!==26,g),w)return w;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(b=m[this._parseStack.chunkPos],w=this._oscParser.end(b!==24&&b!==26,g),w)return w;b===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let S=C;S<d;++S){switch(b=m[S],x=this._transitions.table[this.currentState<<8|(b<160?b:y)],x>>4){case 2:for(let D=S+1;;++D){if(D>=d||(b=m[D])<32||b>126&&b<y){this._printHandler(m,S,D),S=D-1;break}if(++D>=d||(b=m[D])<32||b>126&&b<y){this._printHandler(m,S,D),S=D-1;break}if(++D>=d||(b=m[D])<32||b>126&&b<y){this._printHandler(m,S,D),S=D-1;break}if(++D>=d||(b=m[D])<32||b>126&&b<y){this._printHandler(m,S,D),S=D-1;break}}break;case 3:this._executeHandlers[b]?this._executeHandlers[b]():this._executeHandlerFb(b),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:b,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|b];let L=E?E.length-1:-1;for(;L>=0&&(w=E[L](this._params),w!==!0);L--)if(w instanceof Promise)return this._preserveStack(3,E,L,x,S),w;L<0&&this._csiHandlerFb(this._collect<<8|b,this._params),this.precedingJoinState=0;break;case 8:do switch(b){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(b-48)}while(++S<d&&(b=m[S])>47&&b<60);S--;break;case 9:this._collect<<=8,this._collect|=b;break;case 10:const A=this._escHandlers[this._collect<<8|b];let M=A?A.length-1:-1;for(;M>=0&&(w=A[M](),w!==!0);M--)if(w instanceof Promise)return this._preserveStack(4,A,M,x,S),w;M<0&&this._escHandlerFb(this._collect<<8|b),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|b,this._params);break;case 13:for(let D=S+1;;++D)if(D>=d||(b=m[D])===24||b===26||b===27||b>127&&b<y){this._dcsParser.put(m,S,D),S=D-1;break}break;case 14:if(w=this._dcsParser.unhook(b!==24&&b!==26),w)return this._preserveStack(6,[],0,x,S),w;b===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let D=S+1;;D++)if(D>=d||(b=m[D])<32||b>127&&b<y){this._oscParser.put(m,S,D),S=D-1;break}break;case 6:if(w=this._oscParser.end(b!==24&&b!==26),w)return this._preserveStack(5,[],0,x,S),w;b===27&&(x|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&x}}}s.EscapeSequenceParser=v},6242:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OscHandler=s.OscParser=void 0;const c=o(5770),p=o(482),u=[];s.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,_){this._handlers[f]===void 0&&(this._handlers[f]=[]);const y=this._handlers[f];return y.push(_),{dispose:()=>{const v=y.indexOf(_);v!==-1&&y.splice(v,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,_,y){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(f,_,y);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(f,_,y))}start(){this.reset(),this._state=1}put(f,_,y){if(this._state!==3){if(this._state===1)for(;_<y;){const v=f[_++];if(v===59){this._state=2,this._start();break}if(v<48||57<v)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+v-48}this._state===2&&y-_>0&&this._put(f,_,y)}}end(f,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,v=this._active.length-1,h=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,y=_,h=this._stack.fallThrough,this._stack.paused=!1),!h&&y===!1){for(;v>=0&&(y=this._active[v].end(f),y!==!0);v--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,y;v--}for(;v>=0;v--)if(y=this._active[v].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",f);this._active=u,this._id=-1,this._state=0}}},s.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,_,y){this._hitLimit||(this._data+=(0,p.utf32ToString)(f,_,y),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let _=!1;if(this._hitLimit)_=!1;else if(f&&(_=this._handler(this._data),_ instanceof Promise))return _.then(y=>(this._data="",this._hitLimit=!1,y));return this._data="",this._hitLimit=!1,_}}},8742:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Params=void 0;const o=2147483647;class c{static fromArray(u){const f=new c;if(!u.length)return f;for(let _=Array.isArray(u[0])?1:0;_<u.length;++_){const y=u[_];if(Array.isArray(y))for(let v=0;v<y.length;++v)f.addSubParam(y[v]);else f.addParam(y)}return f}constructor(u=32,f=32){if(this.maxLength=u,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const u=new c(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){const u=[];for(let f=0;f<this.length;++f){u.push(this.params[f]);const _=this._subParamsIdx[f]>>8,y=255&this._subParamsIdx[f];y-_>0&&u.push(Array.prototype.slice.call(this._subParams,_,y))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>o?o:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>o?o:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){const f=this._subParamsIdx[u]>>8,_=255&this._subParamsIdx[u];return _-f>0?this._subParams.subarray(f,_):null}getSubParamsAll(){const u={};for(let f=0;f<this.length;++f){const _=this._subParamsIdx[f]>>8,y=255&this._subParamsIdx[f];y-_>0&&(u[f]=this._subParams.slice(_,y))}return u}addDigit(u){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,y=_[f-1];_[f-1]=~y?Math.min(10*y+u,o):u}}s.Params=c},5741:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AddonManager=void 0,s.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const p={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(p),c.dispose=()=>this._wrappedAddonDispose(p),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===o){c=p;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(c,1)}}},8771:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferApiView=void 0;const c=o(3785),p=o(511);s.BufferApiView=class{constructor(u,f){this._buffer=u,this.type=f}init(u){return this._buffer=u,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(u){const f=this._buffer.lines.get(u);if(f)return new c.BufferLineApiView(f)}getNullCell(){return new p.CellData}}},3785:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferLineApiView=void 0;const c=o(511);s.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,u){if(!(p<0||p>=this._line.length))return u?(this._line.loadCell(p,u),u):this._line.loadCell(p,new c.CellData)}translateToString(p,u,f){return this._line.translateToString(p,u,f)}}},8285:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BufferNamespaceApi=void 0;const c=o(8771),p=o(8460),u=o(844);class f extends u.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.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)}}s.BufferNamespaceApi=f},7975:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ParserApi=void 0,s.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,p=>c(p.toArray()))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,(p,u)=>c(p,u.toArray()))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeApi=void 0,s.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(l,s,o){var c=this&&this.__decorate||function(h,m,d,g){var w,b=arguments.length,x=b<3?m:g===null?g=Object.getOwnPropertyDescriptor(m,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,m,d,g);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(m,d,x):w(m,d))||x);return b>3&&x&&Object.defineProperty(m,d,x),x},p=this&&this.__param||function(h,m){return function(d,g){m(d,g,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.BufferService=s.MINIMUM_ROWS=s.MINIMUM_COLS=void 0;const u=o(8460),f=o(844),_=o(5295),y=o(2585);s.MINIMUM_COLS=2,s.MINIMUM_ROWS=1;let v=s.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(h){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(h.rawOptions.cols||0,s.MINIMUM_COLS),this.rows=Math.max(h.rawOptions.rows||0,s.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(h,this))}resize(h,m){this.cols=h,this.rows=m,this.buffers.resize(h,m),this._onResize.fire({cols:h,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(h,m=!1){const d=this.buffer;let g;g=this._cachedBlankLine,g&&g.length===this.cols&&g.getFg(0)===h.fg&&g.getBg(0)===h.bg||(g=d.getBlankLine(h,m),this._cachedBlankLine=g),g.isWrapped=m;const w=d.ybase+d.scrollTop,b=d.ybase+d.scrollBottom;if(d.scrollTop===0){const x=d.lines.isFull;b===d.lines.length-1?x?d.lines.recycle().copyFrom(g):d.lines.push(g.clone()):d.lines.splice(b+1,0,g.clone()),x?this.isUserScrolling&&(d.ydisp=Math.max(d.ydisp-1,0)):(d.ybase++,this.isUserScrolling||d.ydisp++)}else{const x=b-w+1;d.lines.shiftElements(w+1,x-1,-1),d.lines.set(b,g.clone())}this.isUserScrolling||(d.ydisp=d.ybase),this._onScroll.fire(d.ydisp)}scrollLines(h,m,d){const g=this.buffer;if(h<0){if(g.ydisp===0)return;this.isUserScrolling=!0}else h+g.ydisp>=g.ybase&&(this.isUserScrolling=!1);const w=g.ydisp;g.ydisp=Math.max(Math.min(g.ydisp+h,g.ybase),0),w!==g.ydisp&&(m||this._onScroll.fire(g.ydisp))}};s.BufferService=v=c([p(0,y.IOptionsService)],v)},7994:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CharsetService=void 0,s.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(l,s,o){var c=this&&this.__decorate||function(g,w,b,x){var C,S=arguments.length,E=S<3?w:x===null?x=Object.getOwnPropertyDescriptor(w,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(g,w,b,x);else for(var L=g.length-1;L>=0;L--)(C=g[L])&&(E=(S<3?C(E):S>3?C(w,b,E):C(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},p=this&&this.__param||function(g,w){return function(b,x){w(b,x,g)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreMouseService=void 0;const u=o(2585),f=o(8460),_=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:g=>g.button!==4&&g.action===1&&(g.ctrl=!1,g.alt=!1,g.shift=!1,!0)},VT200:{events:19,restrict:g=>g.action!==32},DRAG:{events:23,restrict:g=>g.action!==32||g.button!==3},ANY:{events:31,restrict:g=>!0}};function v(g,w){let b=(g.ctrl?16:0)|(g.shift?4:0)|(g.alt?8:0);return g.button===4?(b|=64,b|=g.action):(b|=3&g.button,4&g.button&&(b|=64),8&g.button&&(b|=128),g.action===32?b|=32:g.action!==0||w||(b|=3)),b}const h=String.fromCharCode,m={DEFAULT:g=>{const w=[v(g,!1)+32,g.col+32,g.row+32];return w[0]>255||w[1]>255||w[2]>255?"":`\x1B[M${h(w[0])}${h(w[1])}${h(w[2])}`},SGR:g=>{const w=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${v(g,!0)};${g.col};${g.row}${w}`},SGR_PIXELS:g=>{const w=g.action===0&&g.button!==4?"m":"M";return`\x1B[<${v(g,!0)};${g.x};${g.y}${w}`}};let d=s.CoreMouseService=class extends _.Disposable{constructor(g,w){super(),this._bufferService=g,this._coreService=w,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const b of Object.keys(y))this.addProtocol(b,y[b]);for(const b of Object.keys(m))this.addEncoding(b,m[b]);this.reset()}addProtocol(g,w){this._protocols[g]=w}addEncoding(g,w){this._encodings[g]=w}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(g){if(!this._protocols[g])throw new Error(`unknown protocol "${g}"`);this._activeProtocol=g,this._onProtocolChange.fire(this._protocols[g].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(g){if(!this._encodings[g])throw new Error(`unknown encoding "${g}"`);this._activeEncoding=g}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(g){if(g.col<0||g.col>=this._bufferService.cols||g.row<0||g.row>=this._bufferService.rows||g.button===4&&g.action===32||g.button===3&&g.action!==32||g.button!==4&&(g.action===2||g.action===3)||(g.col++,g.row++,g.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,g,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(g))return!1;const w=this._encodings[this._activeEncoding](g);return w&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(w):this._coreService.triggerDataEvent(w,!0)),this._lastEvent=g,!0}explainEvents(g){return{down:!!(1&g),up:!!(2&g),drag:!!(4&g),move:!!(8&g),wheel:!!(16&g)}}_equalEvents(g,w,b){if(b){if(g.x!==w.x||g.y!==w.y)return!1}else if(g.col!==w.col||g.row!==w.row)return!1;return g.button===w.button&&g.action===w.action&&g.ctrl===w.ctrl&&g.alt===w.alt&&g.shift===w.shift}};s.CoreMouseService=d=c([p(0,u.IBufferService),p(1,u.ICoreService)],d)},6975:function(l,s,o){var c=this&&this.__decorate||function(d,g,w,b){var x,C=arguments.length,S=C<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(d,g,w,b);else for(var E=d.length-1;E>=0;E--)(x=d[E])&&(S=(C<3?x(S):C>3?x(g,w,S):x(g,w))||S);return C>3&&S&&Object.defineProperty(g,w,S),S},p=this&&this.__param||function(d,g){return function(w,b){g(w,b,d)}};Object.defineProperty(s,"__esModule",{value:!0}),s.CoreService=void 0;const u=o(1439),f=o(8460),_=o(844),y=o(2585),v=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=s.CoreService=class extends _.Disposable{constructor(d,g,w){super(),this._bufferService=d,this._logService=g,this._optionsService=w,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(v),this.decPrivateModes=(0,u.clone)(h)}reset(){this.modes=(0,u.clone)(v),this.decPrivateModes=(0,u.clone)(h)}triggerDataEvent(d,g=!1){if(this._optionsService.rawOptions.disableStdin)return;const w=this._bufferService.buffer;g&&this._optionsService.rawOptions.scrollOnUserInput&&w.ybase!==w.ydisp&&this._onRequestScrollToBottom.fire(),g&&this._onUserInput.fire(),this._logService.debug(`sending data "${d}"`,()=>d.split("").map(b=>b.charCodeAt(0))),this._onData.fire(d)}triggerBinaryEvent(d){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${d}"`,()=>d.split("").map(g=>g.charCodeAt(0))),this._onBinary.fire(d))}};s.CoreService=m=c([p(0,y.IBufferService),p(1,y.ILogService),p(2,y.IOptionsService)],m)},9074:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DecorationService=void 0;const c=o(8055),p=o(8460),u=o(844),f=o(6106);let _=0,y=0;class v extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList(d=>d==null?void 0:d.marker.line),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,u.toDisposable)(()=>this.reset()))}registerDecoration(d){if(d.marker.isDisposed)return;const g=new h(d);if(g){const w=g.marker.onDispose(()=>g.dispose());g.onDispose(()=>{g&&(this._decorations.delete(g)&&this._onDecorationRemoved.fire(g),w.dispose())}),this._decorations.insert(g),this._onDecorationRegistered.fire(g)}return g}reset(){for(const d of this._decorations.values())d.dispose();this._decorations.clear()}*getDecorationsAtCell(d,g,w){let b=0,x=0;for(const C of this._decorations.getKeyIterator(g))b=C.options.x??0,x=b+(C.options.width??1),d>=b&&d<x&&(!w||(C.options.layer??"bottom")===w)&&(yield C)}forEachDecorationAtCell(d,g,w,b){this._decorations.forEachByKey(g,x=>{_=x.options.x??0,y=_+(x.options.width??1),d>=_&&d<y&&(!w||(x.options.layer??"bottom")===w)&&b(x)})}}s.DecorationService=v;class h extends u.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(d){super(),this.options=d,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=d.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.InstantiationService=s.ServiceCollection=void 0;const c=o(2585),p=o(8343);class u{constructor(..._){this._entries=new Map;for(const[y,v]of _)this.set(y,v)}set(_,y){const v=this._entries.get(_);return this._entries.set(_,y),v}forEach(_){for(const[y,v]of this._entries.entries())_(y,v)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}s.ServiceCollection=u,s.InstantiationService=class{constructor(){this._services=new u,this._services.set(c.IInstantiationService,this)}setService(f,_){this._services.set(f,_)}getService(f){return this._services.get(f)}createInstance(f,..._){const y=(0,p.getServiceDependencies)(f).sort((m,d)=>m.index-d.index),v=[];for(const m of y){const d=this._services.get(m.id);if(!d)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${m.id}.`);v.push(d)}const h=y.length>0?y[0].index:_.length;if(_.length!==h)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${h+1} conflicts with ${_.length} static arguments`);return new f(..._,...v)}}},7866:function(l,s,o){var c=this&&this.__decorate||function(h,m,d,g){var w,b=arguments.length,x=b<3?m:g===null?g=Object.getOwnPropertyDescriptor(m,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,m,d,g);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(m,d,x):w(m,d))||x);return b>3&&x&&Object.defineProperty(m,d,x),x},p=this&&this.__param||function(h,m){return function(d,g){m(d,g,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const u=o(844),f=o(2585),_={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let y,v=s.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let m=0;m<h.length;m++)typeof h[m]=="function"&&(h[m]=h[m]())}_log(h,m,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...d)}trace(h,...m){var d;this._logLevel<=f.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,m)}debug(h,...m){var d;this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,m)}info(h,...m){var d;this._logLevel<=f.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,m)}warn(h,...m){var d;this._logLevel<=f.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,m)}error(h,...m){var d;this._logLevel<=f.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,m)}};s.LogService=v=c([p(0,f.IOptionsService)],v),s.setTraceLogger=function(h){y=h},s.traceCall=function(h,m,d){if(typeof d.value!="function")throw new Error("not supported");const g=d.value;d.value=function(...w){if(y.logLevel!==f.LogLevelEnum.TRACE)return g.apply(this,w);y.trace(`GlyphRenderer#${g.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=g.apply(this,w);return y.trace(`GlyphRenderer#${g.name} return`,b),b}}},7302:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionsService=s.DEFAULT_OPTIONS=void 0;const c=o(8460),p=o(844),u=o(6114);s.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:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const f=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends p.Disposable{constructor(v){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const h={...s.DEFAULT_OPTIONS};for(const m in v)if(m in h)try{const d=v[m];h[m]=this._sanitizeAndValidateOption(m,d)}catch(d){console.error(d)}this.rawOptions=h,this.options={...h},this._setupOptions(),this.register((0,p.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(v,h){return this.onOptionChange(m=>{m===v&&h(this.rawOptions[v])})}onMultipleOptionChange(v,h){return this.onOptionChange(m=>{v.indexOf(m)!==-1&&h()})}_setupOptions(){const v=m=>{if(!(m in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},h=(m,d)=>{if(!(m in s.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);d=this._sanitizeAndValidateOption(m,d),this.rawOptions[m]!==d&&(this.rawOptions[m]=d,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const d={get:v.bind(this,m),set:h.bind(this,m)};Object.defineProperty(this.options,m,d)}}_sanitizeAndValidateOption(v,h){switch(v){case"cursorStyle":if(h||(h=s.DEFAULT_OPTIONS[v]),!function(m){return m==="block"||m==="underline"||m==="bar"}(h))throw new Error(`"${h}" is not a valid value for ${v}`);break;case"wordSeparator":h||(h=s.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof h=="number"&&1<=h&&h<=1e3)break;h=f.includes(h)?h:s.DEFAULT_OPTIONS[v];break;case"cursorWidth":h=Math.floor(h);case"lineHeight":case"tabStopWidth":if(h<1)throw new Error(`${v} cannot be less than 1, value: ${h}`);break;case"minimumContrastRatio":h=Math.max(1,Math.min(21,Math.round(10*h)/10));break;case"scrollback":if((h=Math.min(h,4294967295))<0)throw new Error(`${v} cannot be less than 0, value: ${h}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(h<=0)throw new Error(`${v} cannot be less than or equal to 0, value: ${h}`);break;case"rows":case"cols":if(!h&&h!==0)throw new Error(`${v} must be numeric, value: ${h}`);break;case"windowsPty":h=h??{}}return h}}s.OptionsService=_},2660:function(l,s,o){var c=this&&this.__decorate||function(_,y,v,h){var m,d=arguments.length,g=d<3?y:h===null?h=Object.getOwnPropertyDescriptor(y,v):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(_,y,v,h);else for(var w=_.length-1;w>=0;w--)(m=_[w])&&(g=(d<3?m(g):d>3?m(y,v,g):m(y,v))||g);return d>3&&g&&Object.defineProperty(y,v,g),g},p=this&&this.__param||function(_,y){return function(v,h){y(v,h,_)}};Object.defineProperty(s,"__esModule",{value:!0}),s.OscLinkService=void 0;const u=o(2585);let f=s.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const y=this._bufferService.buffer;if(_.id===void 0){const w=y.addMarker(y.ybase+y.y),b={data:_,id:this._nextId++,lines:[w]};return w.onDispose(()=>this._removeMarkerFromLink(b,w)),this._dataByLinkId.set(b.id,b),b.id}const v=_,h=this._getEntryIdKey(v),m=this._entriesWithId.get(h);if(m)return this.addLineToLink(m.id,y.ybase+y.y),m.id;const d=y.addMarker(y.ybase+y.y),g={id:this._nextId++,key:this._getEntryIdKey(v),data:v,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(g,d)),this._entriesWithId.set(g.key,g),this._dataByLinkId.set(g.id,g),g.id}addLineToLink(_,y){const v=this._dataByLinkId.get(_);if(v&&v.lines.every(h=>h.line!==y)){const h=this._bufferService.buffer.addMarker(y);v.lines.push(h),h.onDispose(()=>this._removeMarkerFromLink(v,h))}}getLinkData(_){var y;return(y=this._dataByLinkId.get(_))==null?void 0:y.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,y){const v=_.lines.indexOf(y);v!==-1&&(_.lines.splice(v,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};s.OscLinkService=f=c([p(0,u.IBufferService)],f)},8343:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const o="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(p){return p[c]||[]},s.createDecorator=function(p){if(s.serviceRegistry.has(p))return s.serviceRegistry.get(p);const u=function(f,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,m){h[o]===h?h[c].push({id:v,index:m}):(h[c]=[{id:v,index:m}],h[o]=h)})(u,f,y)};return u.toString=()=>p,s.serviceRegistry.set(p,u),u}},2585:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const c=o(8343);var p;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(p||(s.LogLevelEnum=p={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.UnicodeService=void 0;const c=o(8460),p=o(225);class u{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,y,v=!1){return(16777215&_)<<3|(3&y)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const _=new p.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let y=0,v=0;const h=_.length;for(let m=0;m<h;++m){let d=_.charCodeAt(m);if(55296<=d&&d<=56319){if(++m>=h)return y+this.wcwidth(d);const b=_.charCodeAt(m);56320<=b&&b<=57343?d=1024*(d-55296)+b-56320+65536:y+=this.wcwidth(b)}const g=this.charProperties(d,v);let w=u.extractWidth(g);u.extractShouldJoin(g)&&(w-=u.extractWidth(v)),y+=w,v=g}return y}charProperties(_,y){return this._activeProvider.charProperties(_,y)}}s.UnicodeService=u}},n={};function i(l){var s=n[l];if(s!==void 0)return s.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,i),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const s=i(9042),o=i(3236),c=i(844),p=i(5741),u=i(8285),f=i(7975),_=i(7090),y=["cols","rows"];class v extends c.Disposable{constructor(m){super(),this._core=this.register(new o.Terminal(m)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const d=w=>this._core.options[w],g=(w,b)=>{this._checkReadonlyOptions(w),this._core.options[w]=b};for(const w in this._core.options){const b={get:d.bind(this,w),set:g.bind(this,w)};Object.defineProperty(this._publicOptions,w,b)}}_checkReadonlyOptions(m){if(y.includes(m))throw new Error(`Option "${m}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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 u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let d="none";switch(this._core.coreMouseService.activeProtocol){case"X10":d="x10";break;case"VT200":d="vt200";break;case"DRAG":d="drag";break;case"ANY":d="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:d,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const d in m)this._publicOptions[d]=m[d]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,d=!0){this._core.input(m,d)}resize(m,d){this._verifyIntegers(m,d),this._core.resize(m,d)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,d,g){this._verifyIntegers(m,d,g),this._core.select(m,d,g)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,d){this._verifyIntegers(m,d),this._core.selectLines(m,d)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,d){this._core.write(m,d)}writeln(m,d){this._core.write(m),this._core.write(`\r
|
|
60
60
|
`,d)}paste(m){this._core.paste(m)}refresh(m,d){this._verifyIntegers(m,d),this._core.refresh(m,d)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return s}_verifyIntegers(...m){for(const d of m)if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const d of m)if(d&&(d===1/0||isNaN(d)||d%1!=0||d<0))throw new Error("This API only accepts positive integers")}}l.Terminal=v})(),a})())})(pw);var zR=pw.exports;/**
|
|
61
61
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
@@ -125,7 +125,7 @@ out vec4 outColor;
|
|
|
125
125
|
|
|
126
126
|
void main() {
|
|
127
127
|
outColor = v_color;
|
|
128
|
-
}`)),this.register((0,p.toDisposable)(()=>M.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(M.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=M.createVertexArray(),M.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),B=M.createBuffer();this.register((0,p.toDisposable)(()=>M.deleteBuffer(B))),M.bindBuffer(M.ARRAY_BUFFER,B),M.bufferData(M.ARRAY_BUFFER,D,M.STATIC_DRAW),M.enableVertexAttribArray(3),M.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const H=new Uint8Array([0,1,2,3]),F=M.createBuffer();this.register((0,p.toDisposable)(()=>M.deleteBuffer(F))),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,F),M.bufferData(M.ELEMENT_ARRAY_BUFFER,H,M.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(M.createBuffer()),this.register((0,p.toDisposable)(()=>M.deleteBuffer(this._attributesBuffer))),M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,M.FLOAT,!1,_,0),M.vertexAttribDivisor(0,1),M.enableVertexAttribArray(1),M.vertexAttribPointer(1,2,M.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(1,1),M.enableVertexAttribArray(2),M.vertexAttribPointer(2,4,M.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(2,1),this._updateCachedColors(A.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),E.uniformMatrix4fv(this._projectionLocation,!1,f.PROJECTION_MATRIX),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,S.attributes,E.DYNAMIC_DRAW),E.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(S){const E=this._terminal,L=this._vertices;let A,M,D,B,H,F,$,I,R,P,N,j=1;for(A=0;A<E.rows;A++){for(D=-1,B=0,H=0,F=!1,M=0;M<E.cols;M++)$=(A*E.cols+M)*u.RENDER_MODEL_INDICIES_PER_CELL,I=S.cells[$+u.RENDER_MODEL_BG_OFFSET],R=S.cells[$+u.RENDER_MODEL_FG_OFFSET],P=!!(67108864&R),(I!==B||R!==H&&(F||P))&&((B!==0||F&&H!==0)&&(N=8*j++,this._updateRectangle(L,N,H,B,D,M,A)),D=M,B=I,H=R,F=P);(B!==0||F&&H!==0)&&(N=8*j++,this._updateRectangle(L,N,H,B,D,E.cols,A))}L.count=j}updateCursor(S){const E=this._verticesCursor,L=S.cursor;if(!L||L.style==="block")return void(E.count=0);let A,M=0;L.style!=="bar"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.style==="bar"?L.dpr*L.cursorWidth:L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.style!=="underline"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,(L.y+1)*this._dimensions.device.cell.height-L.dpr,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat)),L.style==="outline"&&(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat),A=8*M++,this._addRectangleFloat(E.attributes,A,(L.x+L.width)*this._dimensions.device.cell.width-L.dpr,L.y*this._dimensions.device.cell.height,L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),E.count=M}_updateRectangle(S,E,L,A,M,D,B){if(67108864&L)switch(50331648&L){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&L].rgba;break;case 50331648:v=(16777215&L)<<8;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&A){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&A].rgba;break;case 50331648:v=(16777215&A)<<8;break;default:v=this._themeService.colors.background.rgba}S.attributes.length<E+4&&(S.attributes=(0,f.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),h=M*this._dimensions.device.cell.width,m=B*this._dimensions.device.cell.height,d=(v>>24&255)/255,g=(v>>16&255)/255,w=(v>>8&255)/255,b=1,this._addRectangle(S.attributes,E,h,m,(D-M)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d,g,w,b)}_addRectangle(S,E,L,A,M,D,B,H,F,$){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=B,S[E+5]=H,S[E+6]=F,S[E+7]=$}_addRectangleFloat(S,E,L,A,M,D,B){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=B[0],S[E+5]=B[1],S[E+6]=B[2],S[E+7]=B[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}s.RectangleRenderer=x},310:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderModel=s.COMBINED_CHAR_BIT_MASK=s.RENDER_MODEL_EXT_OFFSET=s.RENDER_MODEL_FG_OFFSET=s.RENDER_MODEL_BG_OFFSET=s.RENDER_MODEL_INDICIES_PER_CELL=void 0;const c=o(296);s.RENDER_MODEL_INDICIES_PER_CELL=4,s.RENDER_MODEL_BG_OFFSET=1,s.RENDER_MODEL_FG_OFFSET=2,s.RENDER_MODEL_EXT_OFFSET=3,s.COMBINED_CHAR_BIT_MASK=2147483648,s.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,c.createSelectionRenderModel)()}resize(p,u){const f=p*u*s.RENDER_MODEL_INDICIES_PER_CELL;f!==this.cells.length&&(this.cells=new Uint32Array(f),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.JoinedCellData=s.WebglRenderer=void 0;const c=o(820),p=o(274),u=o(627),f=o(457),_=o(56),y=o(374),v=o(345),h=o(859),m=o(147),d=o(782),g=o(855),w=o(965),b=o(742),x=o(310),C=o(733);class S extends h.Disposable{constructor(M,D,B,H,F,$,I,R,P){super(),this._terminal=M,this._characterJoinerService=D,this._charSizeService=B,this._coreBrowserService=H,this._coreService=F,this._decorationService=$,this._optionsService=I,this._themeService=R,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new x.RenderModel,this._workCell=new d.CellData,this._workCell2=new d.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.MutableDisposable),this._onChangeTextureAtlas=this.register(new v.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new v.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new v.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new v.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new p.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new C.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,I,this._themeService)],this.dimensions=(0,y.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(I.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const N={antialias:!1,depth:!1,preserveDrawingBuffer:P};if(this._gl=this._canvas.getContext("webgl2",N),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextlost",j=>{console.log("webglcontextlost event received"),j.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(j)},3e3)})),this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextrestored",j=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(j,U)=>this._setCanvasDevicePixelDimensions(j,U)),this.register(this._coreBrowserService.onWindowChange(j=>{this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,j,(U,V)=>this._setCanvasDevicePixelDimensions(U,V))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,h.toDisposable)(()=>{var j;for(const U of this._renderLayers)U.dispose();(j=this._canvas.parentElement)==null||j.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var M;return(M=this._charAtlas)==null?void 0:M.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(M,D){var B,H,F,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const I of this._renderLayers)I.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(B=this._rectangleRenderer.value)==null||B.setDimensions(this.dimensions),(H=this._rectangleRenderer.value)==null||H.handleResize(),(F=this._glyphRenderer.value)==null||F.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var M;for(const D of this._renderLayers)D.handleBlur(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.pause(),this._requestRedrawViewport()}handleFocus(){var M;for(const D of this._renderLayers)D.handleFocus(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.resume(),this._requestRedrawViewport()}handleSelectionChanged(M,D,B){for(const H of this._renderLayers)H.handleSelectionChanged(this._terminal,M,D,B);this._model.selection.update(this._core,M,D,B),this._requestRedrawViewport()}handleCursorMove(){var M;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new w.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const M=(0,u.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==M&&(this._onChangeTextureAtlas.fire(M.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,v.forwardEvent)(M.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,v.forwardEvent)(M.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=M,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(M){var D;this._model.clear(),M&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var M;(M=this._charAtlas)==null||M.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var M;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(M){return-1}deregisterCharacterJoiner(M){return!1}renderRows(M,D){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const B of this._renderLayers)B.handleGridChanged(this._terminal,M,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(M,D),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new f.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(M,D){const B=this._core;let H,F,$,I,R,P,N,j,U,V,ee,Q,z,O,K=this._workCell;M=L(M,B.rows-1,0),D=L(D,B.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,te=W-B.buffer.ydisp,Y=Math.min(this._terminal.buffer.active.cursorX,B.cols-1);let _e=-1;const ue=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let se=!1;for(F=M;F<=D;F++)for($=F+B.buffer.ydisp,I=B.buffer.lines.get($),this._model.lineLengths[F]=0,R=this._characterJoinerService.getJoinedCharacters($),z=0;z<B.cols;z++)if(H=this._cellColorResolver.result.bg,I.loadCell(z,K),z===0&&(H=this._cellColorResolver.result.bg),P=!1,N=z,R.length>0&&z===R[0][0]&&(P=!0,j=R.shift(),K=new E(K,I.translateToString(!0,j[0],j[1]),j[1]-j[0]),N=j[1]-1),U=K.getChars(),V=K.getCode(),Q=(F*B.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(K,z,$,this.dimensions.device.cell.width),ue&&$===W&&(z===Y&&(this._model.cursor={x:Y,y:te,width:K.getWidth(),style:this._coreBrowserService.isFocused?B.options.cursorStyle||"block":B.options.cursorInactiveStyle,cursorWidth:B.options.cursorWidth,dpr:this._devicePixelRatio},_e=Y+K.getWidth()-1),z>=Y&&z<=_e&&(this._coreBrowserService.isFocused&&(B.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&B.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),V!==g.NULL_CELL_CODE&&(this._model.lineLengths[F]=z+1),(this._model.cells[Q]!==V||this._model.cells[Q+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Q+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Q+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(se=!0,U.length>1&&(V|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[Q]=V,this._model.cells[Q+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Q+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Q+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ee=K.getWidth(),this._glyphRenderer.value.updateCell(z,F,V,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,ee,H),P))for(K=this._workCell,z++;z<N;z++)O=(F*B.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(z,F,g.NULL_CELL_CODE,0,0,0,g.NULL_CELL_CHAR,0,0),this._model.cells[O]=g.NULL_CELL_CODE,this._model.cells[O+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[O+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[O+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;se&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(M,D){this._canvas.width===M&&this._canvas.height===D||(this._canvas.width=M,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const M=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:M,end:M})}}s.WebglRenderer=S;class E extends m.AttributeData{constructor(M,D,B){super(),this.content=0,this.combinedData="",this.fg=M.fg,this.bg=M.bg,this.combinedData=D,this._width=B}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()]}}function L(A,M,D=0){return Math.max(Math.min(A,M),D)}s.JoinedCellData=E},381:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GLTexture=s.expandFloat32Array=s.createShader=s.createProgram=s.PROJECTION_MATRIX=void 0;const c=o(374);function p(u,f,_){const y=(0,c.throwIfFalsy)(u.createShader(f));if(u.shaderSource(y,_),u.compileShader(y),u.getShaderParameter(y,u.COMPILE_STATUS))return y;console.error(u.getShaderInfoLog(y)),u.deleteShader(y)}s.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),s.createProgram=function(u,f,_){const y=(0,c.throwIfFalsy)(u.createProgram());if(u.attachShader(y,(0,c.throwIfFalsy)(p(u,u.VERTEX_SHADER,f))),u.attachShader(y,(0,c.throwIfFalsy)(p(u,u.FRAGMENT_SHADER,_))),u.linkProgram(y),u.getProgramParameter(y,u.LINK_STATUS))return y;console.error(u.getProgramInfoLog(y)),u.deleteProgram(y)},s.createShader=p,s.expandFloat32Array=function(u,f){const _=Math.min(2*u.length,f),y=new Float32Array(_);for(let v=0;v<u.length;v++)y[v]=u[v];return y},s.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseRenderLayer=void 0;const c=o(627),p=o(237),u=o(374),f=o(859);class _ extends f.Disposable{constructor(v,h,m,d,g,w,b,x){super(),this._container=h,this._alpha=g,this._coreBrowserService=w,this._optionsService=b,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${m}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(C=>{this._refreshCharAtlas(v,C),this.reset(v)})),this.register((0,f.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(v){}handleFocus(v){}handleCursorMove(v){}handleGridChanged(v,h,m){}handleSelectionChanged(v,h,m,d=!1){}_setTransparency(v,h){if(h===this._alpha)return;const m=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(v,this._themeService.colors),this.handleGridChanged(v,0,v.rows-1)}_refreshCharAtlas(v,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,c.acquireTextureAtlas)(v,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(v,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(v,this._themeService.colors)}_fillBottomLineAtCells(v,h,m=1){this._ctx.fillRect(v*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,m*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(v,h,m,d){this._alpha?this._ctx.clearRect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(v,h,m,d){this._ctx.font=this._getFont(v,!1,!1),this._ctx.textBaseline=p.TEXT_BASELINE,this._clipCell(m,d,h.getWidth()),this._ctx.fillText(h.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(v,h,m){this._ctx.beginPath(),this._ctx.rect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(v,h,m){return`${m?"italic":""} ${h?v.options.fontWeightBold:v.options.fontWeight} ${v.options.fontSize*this._coreBrowserService.dpr}px ${v.options.fontFamily}`}}s.BaseRenderLayer=_},733:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkRenderLayer=void 0;const c=o(197),p=o(237),u=o(592);class f extends u.BaseRenderLayer{constructor(y,v,h,m,d,g,w){super(h,y,"link",v,!0,d,g,w),this.register(m.onShowLinkUnderline(b=>this._handleShowLinkUnderline(b))),this.register(m.onHideLinkUnderline(b=>this._handleHideLinkUnderline(b)))}resize(y,v){super.resize(y,v),this._state=void 0}reset(y){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(y){if(y.fg===p.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:y.fg!==void 0&&(0,c.is256Color)(y.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[y.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(let v=y.y1+1;v<y.y2;v++)this._fillBottomLineAtCells(0,v,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y}_handleHideLinkUnderline(y){this._clearCurrentLink()}}s.LinkRenderLayer=f},820:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,p,u){o.addEventListener(c,p,u);let f=!1;return{dispose:()=>{f||(f=!0,o.removeEventListener(c,p,u))}}}},274:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellColorResolver=void 0;const c=o(855),p=o(160),u=o(374);let f,_=0,y=0,v=!1,h=!1,m=!1,d=0;s.CellColorResolver=class{constructor(g,w,b,x,C,S){this._terminal=g,this._optionService=w,this._selectionRenderModel=b,this._decorationService=x,this._coreBrowserService=C,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(g,w,b,x){if(this.result.bg=g.bg,this.result.fg=g.fg,this.result.ext=268435456&g.bg?g.extended.ext:0,y=0,_=0,h=!1,v=!1,m=!1,f=this._themeService.colors,d=0,g.getCode()!==c.NULL_CELL_CODE&&g.extended.underlineStyle===4){const C=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));d=w*x%(2*Math.round(C))}if(this._decorationService.forEachDecorationAtCell(w,b,"bottom",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),m=this._selectionRenderModel.isCellSelected(this._terminal,w,b),m){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:y=(16777215&this.result.fg)<<8|255;break;default:y=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:y=(16777215&this.result.bg)<<8|255}y=p.rgba.blend(y,4294967040&(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else y=(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(h=!0,f.selectionForeground&&(_=f.selectionForeground.rgba>>8&16777215,v=!0),(0,u.treatGlyphAsBackgroundColor)(g.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))_=(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:_=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:_=(16777215&this.result.fg)<<8|255;break;default:_=this._themeService.colors.foreground.rgba}_=p.rgba.blend(_,4294967040&(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}v=!0}}this._decorationService.forEachDecorationAtCell(w,b,"top",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),h&&(y=m?-16777216&g.bg&-134217729|y|50331648:-16777216&g.bg|y|50331648),v&&(_=-16777216&g.fg&-67108865|_|50331648),67108864&this.result.fg&&(h&&!v&&(_=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&f.background.rgba>>8|50331648,v=!0),!h&&v&&(y=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&f.foreground.rgba>>8|50331648,h=!0)),f=void 0,this.result.bg=h?y:this.result.bg,this.result.fg=v?_:this.result.fg,this.result.ext&=536870911,this.result.ext|=d<<29&3758096384}}},627:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.removeTerminalFromCache=s.acquireTextureAtlas=void 0;const c=o(509),p=o(197),u=[];s.acquireTextureAtlas=function(f,_,y,v,h,m,d,g){const w=(0,p.generateConfig)(v,h,m,d,_,y,g);for(let C=0;C<u.length;C++){const S=u[C],E=S.ownedBy.indexOf(f);if(E>=0){if((0,p.configEquals)(S.config,w))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),u.splice(C,1)):S.ownedBy.splice(E,1);break}}for(let C=0;C<u.length;C++){const S=u[C];if((0,p.configEquals)(S.config,w))return S.ownedBy.push(f),S.atlas}const b=f._core,x={atlas:new c.TextureAtlas(document,w,b.unicodeService),config:w,ownedBy:[f]};return u.push(x),x.atlas},s.removeTerminalFromCache=function(f){for(let _=0;_<u.length;_++){const y=u[_].ownedBy.indexOf(f);if(y!==-1){u[_].ownedBy.length===1?(u[_].atlas.dispose(),u.splice(_,1)):u[_].ownedBy.splice(y,1);break}}}},197:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.is256Color=s.configEquals=s.generateConfig=void 0;const c=o(160);s.generateConfig=function(p,u,f,_,y,v,h){const m={foreground:v.foreground,background:v.background,cursor:c.NULL_COLOR,cursorAccent:c.NULL_COLOR,selectionForeground:c.NULL_COLOR,selectionBackgroundTransparent:c.NULL_COLOR,selectionBackgroundOpaque:c.NULL_COLOR,selectionInactiveBackgroundTransparent:c.NULL_COLOR,selectionInactiveBackgroundOpaque:c.NULL_COLOR,ansi:v.ansi.slice(),contrastCache:v.contrastCache,halfContrastCache:v.halfContrastCache};return{customGlyphs:y.customGlyphs,devicePixelRatio:h,letterSpacing:y.letterSpacing,lineHeight:y.lineHeight,deviceCellWidth:p,deviceCellHeight:u,deviceCharWidth:f,deviceCharHeight:_,fontFamily:y.fontFamily,fontSize:y.fontSize,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,allowTransparency:y.allowTransparency,drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,minimumContrastRatio:y.minimumContrastRatio,colors:m}},s.configEquals=function(p,u){for(let f=0;f<p.colors.ansi.length;f++)if(p.colors.ansi[f].rgba!==u.colors.ansi[f].rgba)return!1;return p.devicePixelRatio===u.devicePixelRatio&&p.customGlyphs===u.customGlyphs&&p.lineHeight===u.lineHeight&&p.letterSpacing===u.letterSpacing&&p.fontFamily===u.fontFamily&&p.fontSize===u.fontSize&&p.fontWeight===u.fontWeight&&p.fontWeightBold===u.fontWeightBold&&p.allowTransparency===u.allowTransparency&&p.deviceCharWidth===u.deviceCharWidth&&p.deviceCharHeight===u.deviceCharHeight&&p.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&p.minimumContrastRatio===u.minimumContrastRatio&&p.colors.foreground.rgba===u.colors.foreground.rgba&&p.colors.background.rgba===u.colors.background.rgba},s.is256Color=function(p){return(50331648&p)==16777216||(50331648&p)==33554432}},237:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const c=o(399);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},457:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CursorBlinkStateManager=void 0,s.CursorBlinkStateManager=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,c>0)return void this._restartInterval(c)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(c)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tryDrawCustomChar=s.powerlineDefinitions=s.boxDrawingDefinitions=s.blockElementDefinitions=void 0;const c=o(374);s.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const p={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};s.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╒":{1:(v,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(v,h)=>`M${.5-v},1 L${.5-v},.5 L1,.5 M${.5+v},.5 L${.5+v},1`},"╔":{1:(v,h)=>`M1,${.5-h} L${.5-v},${.5-h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╕":{1:(v,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(v,h)=>`M${.5+v},1 L${.5+v},.5 L0,.5 M${.5-v},.5 L${.5-v},1`},"╗":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5+v},${.5-h} L${.5+v},1`},"╘":{1:(v,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(v,h)=>`M1,.5 L${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╚":{1:(v,h)=>`M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0 M1,${.5+h} L${.5-v},${.5+h} L${.5-v},0`},"╛":{1:(v,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(v,h)=>`M0,.5 L${.5+v},.5 L${.5+v},0 M${.5-v},.5 L${.5-v},0`},"╝":{1:(v,h)=>`M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M0,${.5+h} L${.5+v},${.5+h} L${.5+v},0`},"╞":{1:(v,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1 M${.5+v},.5 L1,.5`},"╠":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╡":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(v,h)=>`M0,.5 L${.5-v},.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╣":{1:(v,h)=>`M${.5+v},0 L${.5+v},1 M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0`},"╤":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},1 M${.5+v},.5 L${.5+v},1`},"╦":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╧":{1:(v,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╩":{1:(v,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╪":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╬":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,1,.5`}},s.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.tryDrawCustomChar=function(v,h,m,d,g,w,b,x){const C=s.blockElementDefinitions[h];if(C)return function(A,M,D,B,H,F){for(let $=0;$<M.length;$++){const I=M[$],R=H/8,P=F/8;A.fillRect(D+I.x*R,B+I.y*P,I.w*R,I.h*P)}}(v,C,m,d,g,w),!0;const S=p[h];if(S)return function(A,M,D,B,H,F){let $=u.get(M);$||($=new Map,u.set(M,$));const I=A.fillStyle;if(typeof I!="string")throw new Error(`Unexpected fillStyle type "${I}"`);let R=$.get(I);if(!R){const P=M[0].length,N=M.length,j=A.canvas.ownerDocument.createElement("canvas");j.width=P,j.height=N;const U=(0,c.throwIfFalsy)(j.getContext("2d")),V=new ImageData(P,N);let ee,Q,z,O;if(I.startsWith("#"))ee=parseInt(I.slice(1,3),16),Q=parseInt(I.slice(3,5),16),z=parseInt(I.slice(5,7),16),O=I.length>7&&parseInt(I.slice(7,9),16)||1;else{if(!I.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${I}" when drawing pattern glyph`);[ee,Q,z,O]=I.substring(5,I.length-1).split(",").map(K=>parseFloat(K))}for(let K=0;K<N;K++)for(let W=0;W<P;W++)V.data[4*(K*P+W)]=ee,V.data[4*(K*P+W)+1]=Q,V.data[4*(K*P+W)+2]=z,V.data[4*(K*P+W)+3]=M[K][W]*(255*O);U.putImageData(V,0,0),R=(0,c.throwIfFalsy)(A.createPattern(j,null)),$.set(I,R)}A.fillStyle=R,A.fillRect(D,B,H,F)}(v,S,m,d,g,w),!0;const E=s.boxDrawingDefinitions[h];if(E)return function(A,M,D,B,H,F,$){A.strokeStyle=A.fillStyle;for(const[I,R]of Object.entries(M)){let P;A.beginPath(),A.lineWidth=$*Number.parseInt(I),P=typeof R=="function"?R(.15,.15/F*H):R;for(const N of P.split(" ")){const j=N[0],U=_[j];if(!U){console.error(`Could not find drawing instructions for "${j}"`);continue}const V=N.substring(1).split(",");V[0]&&V[1]&&U(A,y(V,H,F,D,B,!0,$))}A.stroke(),A.closePath()}}(v,E,m,d,g,w,x),!0;const L=s.powerlineDefinitions[h];return!!L&&(function(A,M,D,B,H,F,$,I){const R=new Path2D;R.rect(D,B,H,F),A.clip(R),A.beginPath();const P=$/12;A.lineWidth=I*P;for(const N of M.d.split(" ")){const j=N[0],U=_[j];if(!U){console.error(`Could not find drawing instructions for "${j}"`);continue}const V=N.substring(1).split(",");V[0]&&V[1]&&U(A,y(V,H,F,D,B,!1,I,(M.leftPadding??0)*(P/2),(M.rightPadding??0)*(P/2)))}M.type===1?(A.strokeStyle=A.fillStyle,A.stroke()):A.fill(),A.closePath()}(v,L,m,d,g,w,b,x),!0)};const u=new Map;function f(v,h,m=0){return Math.max(Math.min(v,h),m)}const _={C:(v,h)=>v.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(v,h)=>v.lineTo(h[0],h[1]),M:(v,h)=>v.moveTo(h[0],h[1])};function y(v,h,m,d,g,w,b,x=0,C=0){const S=v.map(E=>parseFloat(E)||parseInt(E));if(S.length<2)throw new Error("Too few arguments for instruction");for(let E=0;E<S.length;E+=2)S[E]*=h-x*b-C*b,w&&S[E]!==0&&(S[E]=f(Math.round(S[E]+.5)-.5,h,0)),S[E]+=d+x*b;for(let E=1;E<S.length;E+=2)S[E]*=m,w&&S[E]!==0&&(S[E]=f(Math.round(S[E]+.5)-.5,m,0)),S[E]+=g;return S}},56:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.observeDevicePixelDimensions=void 0;const c=o(859);s.observeDevicePixelDimensions=function(p,u,f){let _=new u.ResizeObserver(y=>{const v=y.find(d=>d.target===p);if(!v)return;if(!("devicePixelContentBoxSize"in v))return _==null||_.disconnect(),void(_=void 0);const h=v.devicePixelContentBoxSize[0].inlineSize,m=v.devicePixelContentBoxSize[0].blockSize;h>0&&m>0&&f(h,m)});try{_.observe(p,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return(0,c.toDisposable)(()=>_==null?void 0:_.disconnect())}},374:(l,s)=>{function o(p){return 57508<=p&&p<=57558}function c(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},s.isEmoji=c,s.allowRescaling=function(p,u,f,_){return u===1&&f>Math.ceil(1.5*_)&&p!==void 0&&p>255&&!c(p)&&!o(p)&&!function(y){return 57344<=y&&y<=63743}(p)},s.treatGlyphAsBackgroundColor=function(p){return o(p)||function(u){return 9472<=u&&u<=9631}(p)},s.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}}}},s.computeNextVariantOffset=function(p,u,f=0){return(p-(2*Math.round(u)-f))%(2*Math.round(u))}},296:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(p,u,f,_=!1){if(this.selectionStart=u,this.selectionEnd=f,!u||!f||u[0]===f[0]&&u[1]===f[1])return void this.clear();const y=p.buffers.active.ydisp,v=u[1]-y,h=f[1]-y,m=Math.max(v,0),d=Math.min(h,p.rows-1);m>=p.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=m,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=f[0])}isCellSelected(p,u,f){return!!this.hasSelection&&(f-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&f>=this.viewportCappedStartRow&&u<this.endCol&&f<=this.viewportCappedEndRow:u<this.startCol&&f>=this.viewportCappedStartRow&&u>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},509:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TextureAtlas=void 0;const c=o(237),p=o(860),u=o(374),f=o(160),_=o(345),y=o(485),v=o(385),h=o(147),m=o(855),d={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let g;class w{get pages(){return this._pages}constructor(E,L,A){this._document=E,this._config=L,this._unicodeService=A,this._didWarmUp=!1,this._cacheMap=new y.FourKeyMap,this._cacheMapCombined=new y.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new _.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=C(E,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const E of this.pages)E.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const E=new v.IdleTaskQueue;for(let L=33;L<126;L++)E.enqueue(()=>{if(!this._cacheMap.get(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT)){const A=this._drawToCache(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT);this._cacheMap.set(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT,A)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const E of this._pages)E.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(w.maxAtlasPages&&this._pages.length>=Math.max(4,w.maxAtlasPages)){const L=this._pages.filter($=>2*$.canvas.width<=(w.maxTextureSize||4096)).sort(($,I)=>I.canvas.width!==$.canvas.width?I.canvas.width-$.canvas.width:I.percentageUsed-$.percentageUsed);let A=-1,M=0;for(let $=0;$<L.length;$++)if(L[$].canvas.width!==M)A=$,M=L[$].canvas.width;else if($-A==3)break;const D=L.slice(A,A+4),B=D.map($=>$.glyphs[0].texturePage).sort(($,I)=>$>I?1:-1),H=this.pages.length-D.length,F=this._mergePages(D,H);F.version++;for(let $=B.length-1;$>=0;$--)this._deletePage(B[$]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const E=new b(this._document,this._textureSize);return this._pages.push(E),this._activePages.push(E),this._onAddTextureAtlasCanvas.fire(E.canvas),E}_mergePages(E,L){const A=2*E[0].canvas.width,M=new b(this._document,A,E);for(const[D,B]of E.entries()){const H=D*B.canvas.width%A,F=Math.floor(D/2)*B.canvas.height;M.ctx.drawImage(B.canvas,H,F);for(const I of B.glyphs)I.texturePage=L,I.sizeClipSpace.x=I.size.x/A,I.sizeClipSpace.y=I.size.y/A,I.texturePosition.x+=H,I.texturePosition.y+=F,I.texturePositionClipSpace.x=I.texturePosition.x/A,I.texturePositionClipSpace.y=I.texturePosition.y/A;this._onRemoveTextureAtlasCanvas.fire(B.canvas);const $=this._activePages.indexOf(B);$!==-1&&this._activePages.splice($,1)}return M}_deletePage(E){this._pages.splice(E,1);for(let L=E;L<this._pages.length;L++){const A=this._pages[L];for(const M of A.glyphs)M.texturePage--;A.version++}}getRasterizedGlyphCombinedChar(E,L,A,M,D){return this._getFromCacheMap(this._cacheMapCombined,E,L,A,M,D)}getRasterizedGlyph(E,L,A,M,D){return this._getFromCacheMap(this._cacheMap,E,L,A,M,D)}_getFromCacheMap(E,L,A,M,D,B=!1){return g=E.get(L,A,M,D),g||(g=this._drawToCache(L,A,M,D,B),E.set(L,A,M,D,g)),g}_getColorFromAnsiIndex(E){if(E>=this._config.colors.ansi.length)throw new Error("No color found for idx "+E);return this._config.colors.ansi[E]}_getBackgroundColor(E,L,A,M){if(this._config.allowTransparency)return f.NULL_COLOR;let D;switch(E){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(L);break;case 50331648:const B=h.AttributeData.toColorRGB(L);D=f.channels.toColor(B[0],B[1],B[2]);break;default:D=A?f.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(E,L,A,M,D,B,H,F,$,I){const R=this._getMinimumContrastColor(E,L,A,M,D,B,H,$,F,I);if(R)return R;let P;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&B<8&&(B+=8),P=this._getColorFromAnsiIndex(B);break;case 50331648:const N=h.AttributeData.toColorRGB(B);P=f.channels.toColor(N[0],N[1],N[2]);break;default:P=H?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(P=f.color.opaque(P)),F&&(P=f.color.multiplyOpacity(P,c.DIM_OPACITY)),P}_resolveBackgroundRgba(E,L,A){switch(E){case 16777216:case 33554432:return this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(E,L,A,M){switch(E){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&M&&L<8&&(L+=8),this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(E,L,A,M,D,B,H,F,$,I){if(this._config.minimumContrastRatio===1||I)return;const R=this._getContrastCache($),P=R.getColor(E,M);if(P!==void 0)return P||void 0;const N=this._resolveBackgroundRgba(L,A,H),j=this._resolveForegroundRgba(D,B,H,F),U=f.rgba.ensureContrastRatio(N,j,this._config.minimumContrastRatio/($?2:1));if(!U)return void R.setColor(E,M,null);const V=f.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return R.setColor(E,M,V),V}_getContrastCache(E){return E?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(E,L,A,M,D=!1){const B=typeof E=="number"?String.fromCharCode(E):E,H=Math.min(this._config.deviceCellWidth*Math.max(B.length,2)+4,this._textureSize);this._tmpCanvas.width<H&&(this._tmpCanvas.width=H);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=A,this._workAttributeData.bg=L,this._workAttributeData.extended.ext=M,this._workAttributeData.isInvisible())return d;const $=!!this._workAttributeData.isBold(),I=!!this._workAttributeData.isInverse(),R=!!this._workAttributeData.isDim(),P=!!this._workAttributeData.isItalic(),N=!!this._workAttributeData.isUnderline(),j=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let V=this._workAttributeData.getFgColor(),ee=this._workAttributeData.getFgColorMode(),Q=this._workAttributeData.getBgColor(),z=this._workAttributeData.getBgColorMode();if(I){const oe=V;V=Q,Q=oe;const me=ee;ee=z,z=me}const O=this._getBackgroundColor(z,Q,I,R);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const K=$?this._config.fontWeightBold:this._config.fontWeight,W=P?"italic":"";this._tmpCtx.font=`${W} ${K} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c.TEXT_BASELINE;const te=B.length===1&&(0,u.isPowerlineGlyph)(B.charCodeAt(0)),Y=B.length===1&&(0,u.isRestrictedPowerlineGlyph)(B.charCodeAt(0)),_e=this._getForegroundColor(L,z,Q,A,ee,V,I,R,$,(0,u.treatGlyphAsBackgroundColor)(B.charCodeAt(0)));this._tmpCtx.fillStyle=_e.css;const ue=Y?0:4;let se=!1;this._config.customGlyphs!==!1&&(se=(0,p.tryDrawCustomChar)(this._tmpCtx,B,ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let re,ae=!te;if(re=typeof E=="number"?this._unicodeService.wcwidth(E):this._unicodeService.getStringCellWidth(E),N){this._tmpCtx.save();const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),me=oe%2==1?.5:0;if(this._tmpCtx.lineWidth=oe,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ae=!1;let Pe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Pe<8&&(Pe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Pe).css}this._tmpCtx.beginPath();const xe=ue,ke=Math.ceil(ue+this._config.deviceCharHeight)-me-(D?2*oe:0),Ne=ke+oe,Ke=ke+2*oe;let Ae=this._workAttributeData.getUnderlineVariantOffset();for(let Pe=0;Pe<re;Pe++){this._tmpCtx.save();const G=xe+Pe*this._config.deviceCellWidth,J=xe+(Pe+1)*this._config.deviceCellWidth,Oe=G+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(J,ke),this._tmpCtx.moveTo(G,Ke),this._tmpCtx.lineTo(J,Ke);break;case 3:const $e=oe<=1?Ke:Math.ceil(ue+this._config.deviceCharHeight-oe/2)-me,X=oe<=1?ke:Math.ceil(ue+this._config.deviceCharHeight+oe/2)-me,le=new Path2D;le.rect(G,ke,this._config.deviceCellWidth,Ke-ke),this._tmpCtx.clip(le),this._tmpCtx.moveTo(G-this._config.deviceCellWidth/2,Ne),this._tmpCtx.bezierCurveTo(G-this._config.deviceCellWidth/2,X,G,X,G,Ne),this._tmpCtx.bezierCurveTo(G,$e,Oe,$e,Oe,Ne),this._tmpCtx.bezierCurveTo(Oe,X,J,X,J,Ne),this._tmpCtx.bezierCurveTo(J,$e,J+this._config.deviceCellWidth/2,$e,J+this._config.deviceCellWidth/2,Ne);break;case 4:const ge=Ae===0?0:Ae>=oe?2*oe-Ae:oe-Ae;Ae>=oe||ge===0?(this._tmpCtx.setLineDash([Math.round(oe),Math.round(oe)]),this._tmpCtx.moveTo(G+ge,ke),this._tmpCtx.lineTo(J,ke)):(this._tmpCtx.setLineDash([Math.round(oe),Math.round(oe)]),this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(G+ge,ke),this._tmpCtx.moveTo(G+ge+oe,ke),this._tmpCtx.lineTo(J,ke)),Ae=(0,u.computeNextVariantOffset)(J-G,oe,Ae);break;case 5:const We=.6,Z=.3,Le=J-G,de=Math.floor(We*Le),fe=Math.floor(Z*Le),Ee=Le-de-fe;this._tmpCtx.setLineDash([de,fe,Ee]),this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(J,ke);break;default:this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(J,ke)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!se&&this._config.fontSize>=12&&!this._config.allowTransparency&&B!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Pe=this._tmpCtx.measureText(B);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Pe&&Pe.actualBoundingBoxDescent>0){this._tmpCtx.save();const G=new Path2D;G.rect(xe,ke-Math.ceil(oe/2),this._config.deviceCellWidth*re,Ke-ke+Math.ceil(oe/2)),this._tmpCtx.clip(G),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=O.css,this._tmpCtx.strokeText(B,ue,ue+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),me=oe%2==1?.5:0;this._tmpCtx.lineWidth=oe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ue,ue+me),this._tmpCtx.lineTo(ue+this._config.deviceCharWidth*re,ue+me),this._tmpCtx.stroke()}if(se||this._tmpCtx.fillText(B,ue,ue+this._config.deviceCharHeight),B==="_"&&!this._config.allowTransparency){let oe=x(this._tmpCtx.getImageData(ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight),O,_e,ae);if(oe)for(let me=1;me<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(B,ue,ue+this._config.deviceCharHeight-me),oe=x(this._tmpCtx.getImageData(ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight),O,_e,ae),oe);me++);}if(j){const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),me=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=oe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ue,ue+Math.floor(this._config.deviceCharHeight/2)-me),this._tmpCtx.lineTo(ue+this._config.deviceCharWidth*re,ue+Math.floor(this._config.deviceCharHeight/2)-me),this._tmpCtx.stroke()}this._tmpCtx.restore();const ye=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let ve;if(ve=this._config.allowTransparency?function(oe){for(let me=0;me<oe.data.length;me+=4)if(oe.data[me+3]>0)return!1;return!0}(ye):x(ye,O,_e,ae),ve)return d;const ne=this._findGlyphBoundingBox(ye,this._workBoundingBox,H,Y,se,ue);let ie,he;for(;;){if(this._activePages.length===0){const oe=this._createNewPage();ie=oe,he=oe.currentRow,he.height=ne.size.y;break}ie=this._activePages[this._activePages.length-1],he=ie.currentRow;for(const oe of this._activePages)ne.size.y<=oe.currentRow.height&&(ie=oe,he=oe.currentRow);for(let oe=this._activePages.length-1;oe>=0;oe--)for(const me of this._activePages[oe].fixedRows)me.height<=he.height&&ne.size.y<=me.height&&(ie=this._activePages[oe],he=me);if(he.y+ne.size.y>=ie.canvas.height||he.height>ne.size.y+2){let oe=!1;if(ie.currentRow.y+ie.currentRow.height+ne.size.y>=ie.canvas.height){let me;for(const xe of this._activePages)if(xe.currentRow.y+xe.currentRow.height+ne.size.y<xe.canvas.height){me=xe;break}if(me)ie=me;else if(w.maxAtlasPages&&this._pages.length>=w.maxAtlasPages&&he.y+ne.size.y<=ie.canvas.height&&he.height>=ne.size.y&&he.x+ne.size.x<=ie.canvas.width)oe=!0;else{const xe=this._createNewPage();ie=xe,he=xe.currentRow,he.height=ne.size.y,oe=!0}}oe||(ie.currentRow.height>0&&ie.fixedRows.push(ie.currentRow),he={x:0,y:ie.currentRow.y+ie.currentRow.height,height:ne.size.y},ie.fixedRows.push(he),ie.currentRow={x:0,y:he.y+he.height,height:0})}if(he.x+ne.size.x<=ie.canvas.width)break;he===ie.currentRow?(he.x=0,he.y+=he.height,he.height=0):ie.fixedRows.splice(ie.fixedRows.indexOf(he),1)}return ne.texturePage=this._pages.indexOf(ie),ne.texturePosition.x=he.x,ne.texturePosition.y=he.y,ne.texturePositionClipSpace.x=he.x/ie.canvas.width,ne.texturePositionClipSpace.y=he.y/ie.canvas.height,ne.sizeClipSpace.x/=ie.canvas.width,ne.sizeClipSpace.y/=ie.canvas.height,he.height=Math.max(he.height,ne.size.y),he.x+=ne.size.x,ie.ctx.putImageData(ye,ne.texturePosition.x-this._workBoundingBox.left,ne.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ne.size.x,ne.size.y),ie.addGlyph(ne),ie.version++,ne}_findGlyphBoundingBox(E,L,A,M,D,B){L.top=0;const H=M?this._config.deviceCellHeight:this._tmpCanvas.height,F=M?this._config.deviceCellWidth:A;let $=!1;for(let I=0;I<H;I++){for(let R=0;R<F;R++){const P=I*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.top=I,$=!0;break}}if($)break}L.left=0,$=!1;for(let I=0;I<B+F;I++){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*I+3;if(E.data[P]!==0){L.left=I,$=!0;break}}if($)break}L.right=F,$=!1;for(let I=B+F-1;I>=B;I--){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*I+3;if(E.data[P]!==0){L.right=I,$=!0;break}}if($)break}L.bottom=H,$=!1;for(let I=H-1;I>=0;I--){for(let R=0;R<F;R++){const P=I*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.bottom=I,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:L.right-L.left+1,y:L.bottom-L.top+1},sizeClipSpace:{x:L.right-L.left+1,y:L.bottom-L.top+1},offset:{x:-L.left+B+(M||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-L.top+B+(M||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}s.TextureAtlas=w;class b{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(E){this._glyphs.push(E),this._usedPixels+=E.size.x*E.size.y}constructor(E,L,A){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],A)for(const M of A)this._glyphs.push(...M.glyphs),this._usedPixels+=M._usedPixels;this.canvas=C(E,L,L),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(S,E,L,A){const M=E.rgba>>>24,D=E.rgba>>>16&255,B=E.rgba>>>8&255,H=L.rgba>>>24,F=L.rgba>>>16&255,$=L.rgba>>>8&255,I=Math.floor((Math.abs(M-H)+Math.abs(D-F)+Math.abs(B-$))/12);let R=!0;for(let P=0;P<S.data.length;P+=4)S.data[P]===M&&S.data[P+1]===D&&S.data[P+2]===B||A&&Math.abs(S.data[P]-M)+Math.abs(S.data[P+1]-D)+Math.abs(S.data[P+2]-B)<I?S.data[P+3]=0:R=!1;return R}function C(S,E,L){const A=S.createElement("canvas");return A.width=E,A.height=L,A}},160:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,p=0,u=0;var f,_,y,v,h;function m(g){const w=g.toString(16);return w.length<2?"0"+w:w}function d(g,w){return g<w?(w+.05)/(g+.05):(g+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(g){g.toCss=function(w,b,x,C){return C!==void 0?`#${m(w)}${m(b)}${m(x)}${m(C)}`:`#${m(w)}${m(b)}${m(x)}`},g.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},g.toColor=function(w,b,x,C){return{css:g.toCss(w,b,x,C),rgba:g.toRgba(w,b,x,C)}}}(f||(s.channels=f={})),function(g){function w(b,x){return u=Math.round(255*x),[o,c,p]=h.toChannels(b.rgba),{css:f.toCss(o,c,p,u),rgba:f.toRgba(o,c,p,u)}}g.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),p=M+Math.round((E-M)*u),{css:f.toCss(o,c,p),rgba:f.toRgba(o,c,p)}},g.isOpaque=function(b){return(255&b.rgba)==255},g.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return f.toColor(S>>24&255,S>>16&255,S>>8&255)},g.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,p]=h.toChannels(x),{css:f.toCss(o,c,p),rgba:x}},g.opacity=w,g.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},g.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(s.color=_={})),function(g){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),f.toColor(o,c,p);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),f.toColor(o,c,p,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),p=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(o,c,p,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,p,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(o,c,p,u),css:x}}}(y||(s.css=y={})),function(g){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}g.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},g.relativeLuminance2=w}(v||(s.rgb=v={})),function(g){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||B>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||B<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}g.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),p=D+Math.round((L-D)*u),f.toRgba(o,c,p)},g.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),B=d(E,v.relativeLuminance(D>>8));if(B<S){const H=b(x,C,S);return B>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},g.reduceLuminance=w,g.increaseLuminance=b,g.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(s.rgba=h={})),s.toPaddedHex=m,s.contrastRatio=d},345:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const p=[];for(let u=0;u<this._listeners.length;u++)p.push(this._listeners[u]);for(let u=0;u<p.length;u++)p[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o(p=>c.fire(p))},s.runAndSubscribe=function(o,c){return c(void 0),o(p=>c(p))}},859:(l,s)=>{function o(c){for(const p of c)p.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const p=this._disposables.indexOf(c);p!==-1&&this._disposables.splice(p,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var p;this._isDisposed||c===this._value||((p=this._value)==null||p.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},485:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(p,u,f){this._data[p]||(this._data[p]={}),this._data[p][u]=f}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,p,u,f,_){this._data.get(c,p)||this._data.set(c,p,new o),this._data.get(c,p).set(u,f,_)}get(c,p,u,f){var _;return(_=this._data.get(c,p))==null?void 0:_.get(u,f)}clear(){this._data.clear()}}},399:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},385:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const c=o(399);class p{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),m=_.timeRemaining(),1.5*v>m)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=m}this.clear()}}class u extends p{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},147:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,f=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=f}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},782:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const c=o(133),p=o(855),u=o(147);class f extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new f;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[p.CHAR_DATA_CHAR_INDEX].length===2){const h=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const m=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(h-55296)+m-56320+65536|y[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=f},855:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},133:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,p=o.length){let u="";for(let f=c;f<p;++f){let _=o[f];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const p=o.length;if(!p)return 0;let u=0,f=0;if(this._interim){const _=o.charCodeAt(f++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=f;_<p;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=p)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const p=o.length;if(!p)return 0;let u,f,_,y,v=0,h=0,m=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;m<E;){if(m>=p)return 0;if(x=o[m++],(192&x)!=128){m--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?m--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=p-4;let g=m;for(;g<p;){for(;!(!(g<d)||128&(u=o[g])||128&(f=o[g+1])||128&(_=o[g+2])||128&(y=o[g+3]));)c[v++]=u,c[v++]=f,c[v++]=_,c[v++]=y,g+=4;if(u=o[g++],u<128)c[v++]=u;else if((224&u)==192){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(h=(31&u)<<6|63&f,h<128){g--;continue}c[v++]=h}else if((240&u)==224){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(h=(15&u)<<12|(63&f)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,this.interim[2]=_,v;if(y=o[g++],(192&y)!=128){g--;continue}if(h=(7&u)<<18|(63&f)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},776:function(l,s,o){var c=this&&this.__decorate||function(h,m,d,g){var w,b=arguments.length,x=b<3?m:g===null?g=Object.getOwnPropertyDescriptor(m,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,m,d,g);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(m,d,x):w(m,d))||x);return b>3&&x&&Object.defineProperty(m,d,x),x},p=this&&this.__param||function(h,m){return function(d,g){m(d,g,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const u=o(859),f=o(97),_={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let y,v=s.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let m=0;m<h.length;m++)typeof h[m]=="function"&&(h[m]=h[m]())}_log(h,m,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...d)}trace(h,...m){var d;this._logLevel<=f.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,m)}debug(h,...m){var d;this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,m)}info(h,...m){var d;this._logLevel<=f.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,m)}warn(h,...m){var d;this._logLevel<=f.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,m)}error(h,...m){var d;this._logLevel<=f.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,m)}};s.LogService=v=c([p(0,f.IOptionsService)],v),s.setTraceLogger=function(h){y=h},s.traceCall=function(h,m,d){if(typeof d.value!="function")throw new Error("not supported");const g=d.value;d.value=function(...w){if(y.logLevel!==f.LogLevelEnum.TRACE)return g.apply(this,w);y.trace(`GlyphRenderer#${g.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=g.apply(this,w);return y.trace(`GlyphRenderer#${g.name} return`,b),b}}},726:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const o="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(p){return p[c]||[]},s.createDecorator=function(p){if(s.serviceRegistry.has(p))return s.serviceRegistry.get(p);const u=function(f,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,m){h[o]===h?h[c].push({id:v,index:m}):(h[c]=[{id:v,index:m}],h[o]=h)})(u,f,y)};return u.toString=()=>p,s.serviceRegistry.set(p,u),u}},97:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const c=o(726);var p;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(p||(s.LogLevelEnum=p={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")}},n={};function i(l){var s=n[l];if(s!==void 0)return s.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,i),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.WebglAddon=void 0;const s=i(345),o=i(859),c=i(399),p=i(666),u=i(776);class f extends o.Disposable{constructor(y){if(c.isSafari&&(0,c.getSafariVersion)()<16){const v={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",v))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=y,this._onChangeTextureAtlas=this.register(new s.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new s.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new s.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new s.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(y){const v=y._core;if(!y.element)return void this.register(v.onWillOpen(()=>this.activate(y)));this._terminal=y;const h=v.coreService,m=v.optionsService,d=v,g=d._renderService,w=d._characterJoinerService,b=d._charSizeService,x=d._coreBrowserService,C=d._decorationService,S=d._logService,E=d._themeService;(0,u.setTraceLogger)(S),this._renderer=this.register(new p.WebglRenderer(y,w,b,x,h,C,m,E,this._preserveDrawingBuffer)),this.register((0,s.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,s.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,s.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,s.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),g.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const L=this._terminal._core._renderService;L.setRenderer(this._terminal._core._createRenderer()),L.handleResize(y.cols,y.rows)}))}get textureAtlas(){var y;return(y=this._renderer)==null?void 0:y.textureAtlas}clearTextureAtlas(){var y;(y=this._renderer)==null||y.clearTextureAtlas()}}l.WebglAddon=f})(),a})())})(gw);var dv=gw.exports;/**
|
|
128
|
+
}`)),this.register((0,p.toDisposable)(()=>M.deleteProgram(this._program))),this._projectionLocation=(0,c.throwIfFalsy)(M.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=M.createVertexArray(),M.bindVertexArray(this._vertexArrayObject);const D=new Float32Array([0,0,1,0,0,1,1,1]),B=M.createBuffer();this.register((0,p.toDisposable)(()=>M.deleteBuffer(B))),M.bindBuffer(M.ARRAY_BUFFER,B),M.bufferData(M.ARRAY_BUFFER,D,M.STATIC_DRAW),M.enableVertexAttribArray(3),M.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const H=new Uint8Array([0,1,2,3]),F=M.createBuffer();this.register((0,p.toDisposable)(()=>M.deleteBuffer(F))),M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,F),M.bufferData(M.ELEMENT_ARRAY_BUFFER,H,M.STATIC_DRAW),this._attributesBuffer=(0,c.throwIfFalsy)(M.createBuffer()),this.register((0,p.toDisposable)(()=>M.deleteBuffer(this._attributesBuffer))),M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.enableVertexAttribArray(0),M.vertexAttribPointer(0,2,M.FLOAT,!1,_,0),M.vertexAttribDivisor(0,1),M.enableVertexAttribArray(1),M.vertexAttribPointer(1,2,M.FLOAT,!1,_,2*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(1,1),M.enableVertexAttribArray(2),M.vertexAttribPointer(2,4,M.FLOAT,!1,_,4*Float32Array.BYTES_PER_ELEMENT),M.vertexAttribDivisor(2,1),this._updateCachedColors(A.colors),this.register(this._themeService.onChangeColors($=>{this._updateCachedColors($),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const E=this._gl;E.useProgram(this._program),E.bindVertexArray(this._vertexArrayObject),E.uniformMatrix4fv(this._projectionLocation,!1,f.PROJECTION_MATRIX),E.bindBuffer(E.ARRAY_BUFFER,this._attributesBuffer),E.bufferData(E.ARRAY_BUFFER,S.attributes,E.DYNAMIC_DRAW),E.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,E.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(S){const E=this._terminal,L=this._vertices;let A,M,D,B,H,F,$,I,R,P,N,j=1;for(A=0;A<E.rows;A++){for(D=-1,B=0,H=0,F=!1,M=0;M<E.cols;M++)$=(A*E.cols+M)*u.RENDER_MODEL_INDICIES_PER_CELL,I=S.cells[$+u.RENDER_MODEL_BG_OFFSET],R=S.cells[$+u.RENDER_MODEL_FG_OFFSET],P=!!(67108864&R),(I!==B||R!==H&&(F||P))&&((B!==0||F&&H!==0)&&(N=8*j++,this._updateRectangle(L,N,H,B,D,M,A)),D=M,B=I,H=R,F=P);(B!==0||F&&H!==0)&&(N=8*j++,this._updateRectangle(L,N,H,B,D,E.cols,A))}L.count=j}updateCursor(S){const E=this._verticesCursor,L=S.cursor;if(!L||L.style==="block")return void(E.count=0);let A,M=0;L.style!=="bar"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.style==="bar"?L.dpr*L.cursorWidth:L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.style!=="underline"&&L.style!=="outline"||(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,(L.y+1)*this._dimensions.device.cell.height-L.dpr,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat)),L.style==="outline"&&(A=8*M++,this._addRectangleFloat(E.attributes,A,L.x*this._dimensions.device.cell.width,L.y*this._dimensions.device.cell.height,L.width*this._dimensions.device.cell.width,L.dpr,this._cursorFloat),A=8*M++,this._addRectangleFloat(E.attributes,A,(L.x+L.width)*this._dimensions.device.cell.width-L.dpr,L.y*this._dimensions.device.cell.height,L.dpr,this._dimensions.device.cell.height,this._cursorFloat)),E.count=M}_updateRectangle(S,E,L,A,M,D,B){if(67108864&L)switch(50331648&L){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&L].rgba;break;case 50331648:v=(16777215&L)<<8;break;default:v=this._themeService.colors.foreground.rgba}else switch(50331648&A){case 16777216:case 33554432:v=this._themeService.colors.ansi[255&A].rgba;break;case 50331648:v=(16777215&A)<<8;break;default:v=this._themeService.colors.background.rgba}S.attributes.length<E+4&&(S.attributes=(0,f.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),h=M*this._dimensions.device.cell.width,m=B*this._dimensions.device.cell.height,d=(v>>24&255)/255,g=(v>>16&255)/255,w=(v>>8&255)/255,b=1,this._addRectangle(S.attributes,E,h,m,(D-M)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,d,g,w,b)}_addRectangle(S,E,L,A,M,D,B,H,F,$){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=B,S[E+5]=H,S[E+6]=F,S[E+7]=$}_addRectangleFloat(S,E,L,A,M,D,B){S[E]=L/this._dimensions.device.canvas.width,S[E+1]=A/this._dimensions.device.canvas.height,S[E+2]=M/this._dimensions.device.canvas.width,S[E+3]=D/this._dimensions.device.canvas.height,S[E+4]=B[0],S[E+5]=B[1],S[E+6]=B[2],S[E+7]=B[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}s.RectangleRenderer=x},310:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.RenderModel=s.COMBINED_CHAR_BIT_MASK=s.RENDER_MODEL_EXT_OFFSET=s.RENDER_MODEL_FG_OFFSET=s.RENDER_MODEL_BG_OFFSET=s.RENDER_MODEL_INDICIES_PER_CELL=void 0;const c=o(296);s.RENDER_MODEL_INDICIES_PER_CELL=4,s.RENDER_MODEL_BG_OFFSET=1,s.RENDER_MODEL_FG_OFFSET=2,s.RENDER_MODEL_EXT_OFFSET=3,s.COMBINED_CHAR_BIT_MASK=2147483648,s.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,c.createSelectionRenderModel)()}resize(p,u){const f=p*u*s.RENDER_MODEL_INDICIES_PER_CELL;f!==this.cells.length&&(this.cells=new Uint32Array(f),this.lineLengths=new Uint32Array(u))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.JoinedCellData=s.WebglRenderer=void 0;const c=o(820),p=o(274),u=o(627),f=o(457),_=o(56),y=o(374),v=o(345),h=o(859),m=o(147),d=o(782),g=o(855),w=o(965),b=o(742),x=o(310),C=o(733);class S extends h.Disposable{constructor(M,D,B,H,F,$,I,R,P){super(),this._terminal=M,this._characterJoinerService=D,this._charSizeService=B,this._coreBrowserService=H,this._coreService=F,this._decorationService=$,this._optionsService=I,this._themeService=R,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new x.RenderModel,this._workCell=new d.CellData,this._workCell2=new d.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.MutableDisposable),this._onChangeTextureAtlas=this.register(new v.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new v.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new v.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new v.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new v.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new p.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new C.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,I,this._themeService)],this.dimensions=(0,y.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(I.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const N={antialias:!1,depth:!1,preserveDrawingBuffer:P};if(this._gl=this._canvas.getContext("webgl2",N),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextlost",j=>{console.log("webglcontextlost event received"),j.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(j)},3e3)})),this.register((0,c.addDisposableDomListener)(this._canvas,"webglcontextrestored",j=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,u.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(j,U)=>this._setCanvasDevicePixelDimensions(j,U)),this.register(this._coreBrowserService.onWindowChange(j=>{this._observerDisposable.value=(0,_.observeDevicePixelDimensions)(this._canvas,j,(U,V)=>this._setCanvasDevicePixelDimensions(U,V))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,h.toDisposable)(()=>{var j;for(const U of this._renderLayers)U.dispose();(j=this._canvas.parentElement)==null||j.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var M;return(M=this._charAtlas)==null?void 0:M.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(M,D){var B,H,F,$;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const I of this._renderLayers)I.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(B=this._rectangleRenderer.value)==null||B.setDimensions(this.dimensions),(H=this._rectangleRenderer.value)==null||H.handleResize(),(F=this._glyphRenderer.value)==null||F.setDimensions(this.dimensions),($=this._glyphRenderer.value)==null||$.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var M;for(const D of this._renderLayers)D.handleBlur(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.pause(),this._requestRedrawViewport()}handleFocus(){var M;for(const D of this._renderLayers)D.handleFocus(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.resume(),this._requestRedrawViewport()}handleSelectionChanged(M,D,B){for(const H of this._renderLayers)H.handleSelectionChanged(this._terminal,M,D,B);this._model.selection.update(this._core,M,D,B),this._requestRedrawViewport()}handleCursorMove(){var M;for(const D of this._renderLayers)D.handleCursorMove(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new w.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var D;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const M=(0,u.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==M&&(this._onChangeTextureAtlas.fire(M.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,v.forwardEvent)(M.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,v.forwardEvent)(M.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=M,this._charAtlas.warmUp(),(D=this._glyphRenderer.value)==null||D.setAtlas(this._charAtlas)}_clearModel(M){var D;this._model.clear(),M&&((D=this._glyphRenderer.value)==null||D.clear())}clearTextureAtlas(){var M;(M=this._charAtlas)==null||M.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var M;this._clearModel(!0);for(const D of this._renderLayers)D.reset(this._terminal);(M=this._cursorBlinkStateManager.value)==null||M.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(M){return-1}deregisterCharacterJoiner(M){return!1}renderRows(M,D){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const B of this._renderLayers)B.handleGridChanged(this._terminal,M,D);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(M,D),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new f.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(M,D){const B=this._core;let H,F,$,I,R,P,N,j,U,V,ee,Q,z,O,K=this._workCell;M=L(M,B.rows-1,0),D=L(D,B.rows-1,0);const W=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,te=W-B.buffer.ydisp,J=Math.min(this._terminal.buffer.active.cursorX,B.cols-1);let _e=-1;const ue=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let se=!1;for(F=M;F<=D;F++)for($=F+B.buffer.ydisp,I=B.buffer.lines.get($),this._model.lineLengths[F]=0,R=this._characterJoinerService.getJoinedCharacters($),z=0;z<B.cols;z++)if(H=this._cellColorResolver.result.bg,I.loadCell(z,K),z===0&&(H=this._cellColorResolver.result.bg),P=!1,N=z,R.length>0&&z===R[0][0]&&(P=!0,j=R.shift(),K=new E(K,I.translateToString(!0,j[0],j[1]),j[1]-j[0]),N=j[1]-1),U=K.getChars(),V=K.getCode(),Q=(F*B.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(K,z,$,this.dimensions.device.cell.width),ue&&$===W&&(z===J&&(this._model.cursor={x:J,y:te,width:K.getWidth(),style:this._coreBrowserService.isFocused?B.options.cursorStyle||"block":B.options.cursorInactiveStyle,cursorWidth:B.options.cursorWidth,dpr:this._devicePixelRatio},_e=J+K.getWidth()-1),z>=J&&z<=_e&&(this._coreBrowserService.isFocused&&(B.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&B.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),V!==g.NULL_CELL_CODE&&(this._model.lineLengths[F]=z+1),(this._model.cells[Q]!==V||this._model.cells[Q+x.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Q+x.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Q+x.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(se=!0,U.length>1&&(V|=x.COMBINED_CHAR_BIT_MASK),this._model.cells[Q]=V,this._model.cells[Q+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Q+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Q+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ee=K.getWidth(),this._glyphRenderer.value.updateCell(z,F,V,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,U,ee,H),P))for(K=this._workCell,z++;z<N;z++)O=(F*B.cols+z)*x.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(z,F,g.NULL_CELL_CODE,0,0,0,g.NULL_CELL_CHAR,0,0),this._model.cells[O]=g.NULL_CELL_CODE,this._model.cells[O+x.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[O+x.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[O+x.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;se&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(M,D){this._canvas.width===M&&this._canvas.height===D||(this._canvas.width=M,this._canvas.height=D,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const M=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:M,end:M})}}s.WebglRenderer=S;class E extends m.AttributeData{constructor(M,D,B){super(),this.content=0,this.combinedData="",this.fg=M.fg,this.bg=M.bg,this.combinedData=D,this._width=B}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()]}}function L(A,M,D=0){return Math.max(Math.min(A,M),D)}s.JoinedCellData=E},381:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GLTexture=s.expandFloat32Array=s.createShader=s.createProgram=s.PROJECTION_MATRIX=void 0;const c=o(374);function p(u,f,_){const y=(0,c.throwIfFalsy)(u.createShader(f));if(u.shaderSource(y,_),u.compileShader(y),u.getShaderParameter(y,u.COMPILE_STATUS))return y;console.error(u.getShaderInfoLog(y)),u.deleteShader(y)}s.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),s.createProgram=function(u,f,_){const y=(0,c.throwIfFalsy)(u.createProgram());if(u.attachShader(y,(0,c.throwIfFalsy)(p(u,u.VERTEX_SHADER,f))),u.attachShader(y,(0,c.throwIfFalsy)(p(u,u.FRAGMENT_SHADER,_))),u.linkProgram(y),u.getProgramParameter(y,u.LINK_STATUS))return y;console.error(u.getProgramInfoLog(y)),u.deleteProgram(y)},s.createShader=p,s.expandFloat32Array=function(u,f){const _=Math.min(2*u.length,f),y=new Float32Array(_);for(let v=0;v<u.length;v++)y[v]=u[v];return y},s.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseRenderLayer=void 0;const c=o(627),p=o(237),u=o(374),f=o(859);class _ extends f.Disposable{constructor(v,h,m,d,g,w,b,x){super(),this._container=h,this._alpha=g,this._coreBrowserService=w,this._optionsService=b,this._themeService=x,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${m}-layer`),this._canvas.style.zIndex=d.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(C=>{this._refreshCharAtlas(v,C),this.reset(v)})),this.register((0,f.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,u.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(v){}handleFocus(v){}handleCursorMove(v){}handleGridChanged(v,h,m){}handleSelectionChanged(v,h,m,d=!1){}_setTransparency(v,h){if(h===this._alpha)return;const m=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(v,this._themeService.colors),this.handleGridChanged(v,0,v.rows-1)}_refreshCharAtlas(v,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,c.acquireTextureAtlas)(v,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(v,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(v,this._themeService.colors)}_fillBottomLineAtCells(v,h,m=1){this._ctx.fillRect(v*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,m*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(v,h,m,d){this._alpha?this._ctx.clearRect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,d*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,d*this._deviceCellHeight))}_fillCharTrueColor(v,h,m,d){this._ctx.font=this._getFont(v,!1,!1),this._ctx.textBaseline=p.TEXT_BASELINE,this._clipCell(m,d,h.getWidth()),this._ctx.fillText(h.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,d*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(v,h,m){this._ctx.beginPath(),this._ctx.rect(v*this._deviceCellWidth,h*this._deviceCellHeight,m*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(v,h,m){return`${m?"italic":""} ${h?v.options.fontWeightBold:v.options.fontWeight} ${v.options.fontSize*this._coreBrowserService.dpr}px ${v.options.fontFamily}`}}s.BaseRenderLayer=_},733:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.LinkRenderLayer=void 0;const c=o(197),p=o(237),u=o(592);class f extends u.BaseRenderLayer{constructor(y,v,h,m,d,g,w){super(h,y,"link",v,!0,d,g,w),this.register(m.onShowLinkUnderline(b=>this._handleShowLinkUnderline(b))),this.register(m.onHideLinkUnderline(b=>this._handleHideLinkUnderline(b)))}resize(y,v){super.resize(y,v),this._state=void 0}reset(y){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const y=this._state.y2-this._state.y1-1;y>0&&this._clearCells(0,this._state.y1+1,this._state.cols,y),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(y){if(y.fg===p.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:y.fg!==void 0&&(0,c.is256Color)(y.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[y.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,y.y1===y.y2)this._fillBottomLineAtCells(y.x1,y.y1,y.x2-y.x1);else{this._fillBottomLineAtCells(y.x1,y.y1,y.cols-y.x1);for(let v=y.y1+1;v<y.y2;v++)this._fillBottomLineAtCells(0,v,y.cols);this._fillBottomLineAtCells(0,y.y2,y.x2)}this._state=y}_handleHideLinkUnderline(y){this._clearCurrentLink()}}s.LinkRenderLayer=f},820:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,p,u){o.addEventListener(c,p,u);let f=!1;return{dispose:()=>{f||(f=!0,o.removeEventListener(c,p,u))}}}},274:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellColorResolver=void 0;const c=o(855),p=o(160),u=o(374);let f,_=0,y=0,v=!1,h=!1,m=!1,d=0;s.CellColorResolver=class{constructor(g,w,b,x,C,S){this._terminal=g,this._optionService=w,this._selectionRenderModel=b,this._decorationService=x,this._coreBrowserService=C,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(g,w,b,x){if(this.result.bg=g.bg,this.result.fg=g.fg,this.result.ext=268435456&g.bg?g.extended.ext:0,y=0,_=0,h=!1,v=!1,m=!1,f=this._themeService.colors,d=0,g.getCode()!==c.NULL_CELL_CODE&&g.extended.underlineStyle===4){const C=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));d=w*x%(2*Math.round(C))}if(this._decorationService.forEachDecorationAtCell(w,b,"bottom",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),m=this._selectionRenderModel.isCellSelected(this._terminal,w,b),m){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:y=(16777215&this.result.fg)<<8|255;break;default:y=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:y=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:y=(16777215&this.result.bg)<<8|255}y=p.rgba.blend(y,4294967040&(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else y=(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(h=!0,f.selectionForeground&&(_=f.selectionForeground.rgba>>8&16777215,v=!0),(0,u.treatGlyphAsBackgroundColor)(g.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))_=(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:_=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:_=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:_=(16777215&this.result.fg)<<8|255;break;default:_=this._themeService.colors.foreground.rgba}_=p.rgba.blend(_,4294967040&(this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}v=!0}}this._decorationService.forEachDecorationAtCell(w,b,"top",C=>{C.backgroundColorRGB&&(y=C.backgroundColorRGB.rgba>>8&16777215,h=!0),C.foregroundColorRGB&&(_=C.foregroundColorRGB.rgba>>8&16777215,v=!0)}),h&&(y=m?-16777216&g.bg&-134217729|y|50331648:-16777216&g.bg|y|50331648),v&&(_=-16777216&g.fg&-67108865|_|50331648),67108864&this.result.fg&&(h&&!v&&(_=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&f.background.rgba>>8|50331648,v=!0),!h&&v&&(y=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&f.foreground.rgba>>8|50331648,h=!0)),f=void 0,this.result.bg=h?y:this.result.bg,this.result.fg=v?_:this.result.fg,this.result.ext&=536870911,this.result.ext|=d<<29&3758096384}}},627:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.removeTerminalFromCache=s.acquireTextureAtlas=void 0;const c=o(509),p=o(197),u=[];s.acquireTextureAtlas=function(f,_,y,v,h,m,d,g){const w=(0,p.generateConfig)(v,h,m,d,_,y,g);for(let C=0;C<u.length;C++){const S=u[C],E=S.ownedBy.indexOf(f);if(E>=0){if((0,p.configEquals)(S.config,w))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),u.splice(C,1)):S.ownedBy.splice(E,1);break}}for(let C=0;C<u.length;C++){const S=u[C];if((0,p.configEquals)(S.config,w))return S.ownedBy.push(f),S.atlas}const b=f._core,x={atlas:new c.TextureAtlas(document,w,b.unicodeService),config:w,ownedBy:[f]};return u.push(x),x.atlas},s.removeTerminalFromCache=function(f){for(let _=0;_<u.length;_++){const y=u[_].ownedBy.indexOf(f);if(y!==-1){u[_].ownedBy.length===1?(u[_].atlas.dispose(),u.splice(_,1)):u[_].ownedBy.splice(y,1);break}}}},197:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.is256Color=s.configEquals=s.generateConfig=void 0;const c=o(160);s.generateConfig=function(p,u,f,_,y,v,h){const m={foreground:v.foreground,background:v.background,cursor:c.NULL_COLOR,cursorAccent:c.NULL_COLOR,selectionForeground:c.NULL_COLOR,selectionBackgroundTransparent:c.NULL_COLOR,selectionBackgroundOpaque:c.NULL_COLOR,selectionInactiveBackgroundTransparent:c.NULL_COLOR,selectionInactiveBackgroundOpaque:c.NULL_COLOR,ansi:v.ansi.slice(),contrastCache:v.contrastCache,halfContrastCache:v.halfContrastCache};return{customGlyphs:y.customGlyphs,devicePixelRatio:h,letterSpacing:y.letterSpacing,lineHeight:y.lineHeight,deviceCellWidth:p,deviceCellHeight:u,deviceCharWidth:f,deviceCharHeight:_,fontFamily:y.fontFamily,fontSize:y.fontSize,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,allowTransparency:y.allowTransparency,drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,minimumContrastRatio:y.minimumContrastRatio,colors:m}},s.configEquals=function(p,u){for(let f=0;f<p.colors.ansi.length;f++)if(p.colors.ansi[f].rgba!==u.colors.ansi[f].rgba)return!1;return p.devicePixelRatio===u.devicePixelRatio&&p.customGlyphs===u.customGlyphs&&p.lineHeight===u.lineHeight&&p.letterSpacing===u.letterSpacing&&p.fontFamily===u.fontFamily&&p.fontSize===u.fontSize&&p.fontWeight===u.fontWeight&&p.fontWeightBold===u.fontWeightBold&&p.allowTransparency===u.allowTransparency&&p.deviceCharWidth===u.deviceCharWidth&&p.deviceCharHeight===u.deviceCharHeight&&p.drawBoldTextInBrightColors===u.drawBoldTextInBrightColors&&p.minimumContrastRatio===u.minimumContrastRatio&&p.colors.foreground.rgba===u.colors.foreground.rgba&&p.colors.background.rgba===u.colors.background.rgba},s.is256Color=function(p){return(50331648&p)==16777216||(50331648&p)==33554432}},237:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TEXT_BASELINE=s.DIM_OPACITY=s.INVERTED_DEFAULT_COLOR=void 0;const c=o(399);s.INVERTED_DEFAULT_COLOR=257,s.DIM_OPACITY=.5,s.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},457:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CursorBlinkStateManager=void 0,s.CursorBlinkStateManager=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(o=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,c>0)return void this._restartInterval(c)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const c=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(c)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},o)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tryDrawCustomChar=s.powerlineDefinitions=s.boxDrawingDefinitions=s.blockElementDefinitions=void 0;const c=o(374);s.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const p={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};s.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╒":{1:(v,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(v,h)=>`M${.5-v},1 L${.5-v},.5 L1,.5 M${.5+v},.5 L${.5+v},1`},"╔":{1:(v,h)=>`M1,${.5-h} L${.5-v},${.5-h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╕":{1:(v,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(v,h)=>`M${.5+v},1 L${.5+v},.5 L0,.5 M${.5-v},.5 L${.5-v},1`},"╗":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5+v},${.5-h} L${.5+v},1`},"╘":{1:(v,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(v,h)=>`M1,.5 L${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╚":{1:(v,h)=>`M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0 M1,${.5+h} L${.5-v},${.5+h} L${.5-v},0`},"╛":{1:(v,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(v,h)=>`M0,.5 L${.5+v},.5 L${.5+v},0 M${.5-v},.5 L${.5-v},0`},"╝":{1:(v,h)=>`M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M0,${.5+h} L${.5+v},${.5+h} L${.5+v},0`},"╞":{1:(v,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1 M${.5+v},.5 L1,.5`},"╠":{1:(v,h)=>`M${.5-v},0 L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╡":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(v,h)=>`M0,.5 L${.5-v},.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╣":{1:(v,h)=>`M${.5+v},0 L${.5+v},1 M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0`},"╤":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},1 M${.5+v},.5 L${.5+v},1`},"╦":{1:(v,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1`},"╧":{1:(v,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},.5 L${.5-v},0 M${.5+v},.5 L${.5+v},0`},"╩":{1:(v,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╪":{1:(v,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(v,h)=>`M0,.5 L1,.5 M${.5-v},0 L${.5-v},1 M${.5+v},0 L${.5+v},1`},"╬":{1:(v,h)=>`M0,${.5+h} L${.5-v},${.5+h} L${.5-v},1 M1,${.5+h} L${.5+v},${.5+h} L${.5+v},1 M0,${.5-h} L${.5-v},${.5-h} L${.5-v},0 M1,${.5-h} L${.5+v},${.5-h} L${.5+v},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(v,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(v,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,1,.5`}},s.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.powerlineDefinitions[""]=s.powerlineDefinitions[""],s.tryDrawCustomChar=function(v,h,m,d,g,w,b,x){const C=s.blockElementDefinitions[h];if(C)return function(A,M,D,B,H,F){for(let $=0;$<M.length;$++){const I=M[$],R=H/8,P=F/8;A.fillRect(D+I.x*R,B+I.y*P,I.w*R,I.h*P)}}(v,C,m,d,g,w),!0;const S=p[h];if(S)return function(A,M,D,B,H,F){let $=u.get(M);$||($=new Map,u.set(M,$));const I=A.fillStyle;if(typeof I!="string")throw new Error(`Unexpected fillStyle type "${I}"`);let R=$.get(I);if(!R){const P=M[0].length,N=M.length,j=A.canvas.ownerDocument.createElement("canvas");j.width=P,j.height=N;const U=(0,c.throwIfFalsy)(j.getContext("2d")),V=new ImageData(P,N);let ee,Q,z,O;if(I.startsWith("#"))ee=parseInt(I.slice(1,3),16),Q=parseInt(I.slice(3,5),16),z=parseInt(I.slice(5,7),16),O=I.length>7&&parseInt(I.slice(7,9),16)||1;else{if(!I.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${I}" when drawing pattern glyph`);[ee,Q,z,O]=I.substring(5,I.length-1).split(",").map(K=>parseFloat(K))}for(let K=0;K<N;K++)for(let W=0;W<P;W++)V.data[4*(K*P+W)]=ee,V.data[4*(K*P+W)+1]=Q,V.data[4*(K*P+W)+2]=z,V.data[4*(K*P+W)+3]=M[K][W]*(255*O);U.putImageData(V,0,0),R=(0,c.throwIfFalsy)(A.createPattern(j,null)),$.set(I,R)}A.fillStyle=R,A.fillRect(D,B,H,F)}(v,S,m,d,g,w),!0;const E=s.boxDrawingDefinitions[h];if(E)return function(A,M,D,B,H,F,$){A.strokeStyle=A.fillStyle;for(const[I,R]of Object.entries(M)){let P;A.beginPath(),A.lineWidth=$*Number.parseInt(I),P=typeof R=="function"?R(.15,.15/F*H):R;for(const N of P.split(" ")){const j=N[0],U=_[j];if(!U){console.error(`Could not find drawing instructions for "${j}"`);continue}const V=N.substring(1).split(",");V[0]&&V[1]&&U(A,y(V,H,F,D,B,!0,$))}A.stroke(),A.closePath()}}(v,E,m,d,g,w,x),!0;const L=s.powerlineDefinitions[h];return!!L&&(function(A,M,D,B,H,F,$,I){const R=new Path2D;R.rect(D,B,H,F),A.clip(R),A.beginPath();const P=$/12;A.lineWidth=I*P;for(const N of M.d.split(" ")){const j=N[0],U=_[j];if(!U){console.error(`Could not find drawing instructions for "${j}"`);continue}const V=N.substring(1).split(",");V[0]&&V[1]&&U(A,y(V,H,F,D,B,!1,I,(M.leftPadding??0)*(P/2),(M.rightPadding??0)*(P/2)))}M.type===1?(A.strokeStyle=A.fillStyle,A.stroke()):A.fill(),A.closePath()}(v,L,m,d,g,w,b,x),!0)};const u=new Map;function f(v,h,m=0){return Math.max(Math.min(v,h),m)}const _={C:(v,h)=>v.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(v,h)=>v.lineTo(h[0],h[1]),M:(v,h)=>v.moveTo(h[0],h[1])};function y(v,h,m,d,g,w,b,x=0,C=0){const S=v.map(E=>parseFloat(E)||parseInt(E));if(S.length<2)throw new Error("Too few arguments for instruction");for(let E=0;E<S.length;E+=2)S[E]*=h-x*b-C*b,w&&S[E]!==0&&(S[E]=f(Math.round(S[E]+.5)-.5,h,0)),S[E]+=d+x*b;for(let E=1;E<S.length;E+=2)S[E]*=m,w&&S[E]!==0&&(S[E]=f(Math.round(S[E]+.5)-.5,m,0)),S[E]+=g;return S}},56:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.observeDevicePixelDimensions=void 0;const c=o(859);s.observeDevicePixelDimensions=function(p,u,f){let _=new u.ResizeObserver(y=>{const v=y.find(d=>d.target===p);if(!v)return;if(!("devicePixelContentBoxSize"in v))return _==null||_.disconnect(),void(_=void 0);const h=v.devicePixelContentBoxSize[0].inlineSize,m=v.devicePixelContentBoxSize[0].blockSize;h>0&&m>0&&f(h,m)});try{_.observe(p,{box:["device-pixel-content-box"]})}catch{_.disconnect(),_=void 0}return(0,c.toDisposable)(()=>_==null?void 0:_.disconnect())}},374:(l,s)=>{function o(p){return 57508<=p&&p<=57558}function c(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(s,"__esModule",{value:!0}),s.computeNextVariantOffset=s.createRenderDimensions=s.treatGlyphAsBackgroundColor=s.allowRescaling=s.isEmoji=s.isRestrictedPowerlineGlyph=s.isPowerlineGlyph=s.throwIfFalsy=void 0,s.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},s.isPowerlineGlyph=o,s.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},s.isEmoji=c,s.allowRescaling=function(p,u,f,_){return u===1&&f>Math.ceil(1.5*_)&&p!==void 0&&p>255&&!c(p)&&!o(p)&&!function(y){return 57344<=y&&y<=63743}(p)},s.treatGlyphAsBackgroundColor=function(p){return o(p)||function(u){return 9472<=u&&u<=9631}(p)},s.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}}}},s.computeNextVariantOffset=function(p,u,f=0){return(p-(2*Math.round(u)-f))%(2*Math.round(u))}},296:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createSelectionRenderModel=void 0;class o{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(p,u,f,_=!1){if(this.selectionStart=u,this.selectionEnd=f,!u||!f||u[0]===f[0]&&u[1]===f[1])return void this.clear();const y=p.buffers.active.ydisp,v=u[1]-y,h=f[1]-y,m=Math.max(v,0),d=Math.min(h,p.rows-1);m>=p.rows||d<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=v,this.viewportEndRow=h,this.viewportCappedStartRow=m,this.viewportCappedEndRow=d,this.startCol=u[0],this.endCol=f[0])}isCellSelected(p,u,f){return!!this.hasSelection&&(f-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&f>=this.viewportCappedStartRow&&u<this.endCol&&f<=this.viewportCappedEndRow:u<this.startCol&&f>=this.viewportCappedStartRow&&u>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&u>=this.startCol)}}s.createSelectionRenderModel=function(){return new o}},509:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TextureAtlas=void 0;const c=o(237),p=o(860),u=o(374),f=o(160),_=o(345),y=o(485),v=o(385),h=o(147),m=o(855),d={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let g;class w{get pages(){return this._pages}constructor(E,L,A){this._document=E,this._config=L,this._unicodeService=A,this._didWarmUp=!1,this._cacheMap=new y.FourKeyMap,this._cacheMapCombined=new y.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new _.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new _.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=C(E,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,u.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const E of this.pages)E.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const E=new v.IdleTaskQueue;for(let L=33;L<126;L++)E.enqueue(()=>{if(!this._cacheMap.get(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT)){const A=this._drawToCache(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT);this._cacheMap.set(L,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT,A)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const E of this._pages)E.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(w.maxAtlasPages&&this._pages.length>=Math.max(4,w.maxAtlasPages)){const L=this._pages.filter($=>2*$.canvas.width<=(w.maxTextureSize||4096)).sort(($,I)=>I.canvas.width!==$.canvas.width?I.canvas.width-$.canvas.width:I.percentageUsed-$.percentageUsed);let A=-1,M=0;for(let $=0;$<L.length;$++)if(L[$].canvas.width!==M)A=$,M=L[$].canvas.width;else if($-A==3)break;const D=L.slice(A,A+4),B=D.map($=>$.glyphs[0].texturePage).sort(($,I)=>$>I?1:-1),H=this.pages.length-D.length,F=this._mergePages(D,H);F.version++;for(let $=B.length-1;$>=0;$--)this._deletePage(B[$]);this.pages.push(F),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(F.canvas)}const E=new b(this._document,this._textureSize);return this._pages.push(E),this._activePages.push(E),this._onAddTextureAtlasCanvas.fire(E.canvas),E}_mergePages(E,L){const A=2*E[0].canvas.width,M=new b(this._document,A,E);for(const[D,B]of E.entries()){const H=D*B.canvas.width%A,F=Math.floor(D/2)*B.canvas.height;M.ctx.drawImage(B.canvas,H,F);for(const I of B.glyphs)I.texturePage=L,I.sizeClipSpace.x=I.size.x/A,I.sizeClipSpace.y=I.size.y/A,I.texturePosition.x+=H,I.texturePosition.y+=F,I.texturePositionClipSpace.x=I.texturePosition.x/A,I.texturePositionClipSpace.y=I.texturePosition.y/A;this._onRemoveTextureAtlasCanvas.fire(B.canvas);const $=this._activePages.indexOf(B);$!==-1&&this._activePages.splice($,1)}return M}_deletePage(E){this._pages.splice(E,1);for(let L=E;L<this._pages.length;L++){const A=this._pages[L];for(const M of A.glyphs)M.texturePage--;A.version++}}getRasterizedGlyphCombinedChar(E,L,A,M,D){return this._getFromCacheMap(this._cacheMapCombined,E,L,A,M,D)}getRasterizedGlyph(E,L,A,M,D){return this._getFromCacheMap(this._cacheMap,E,L,A,M,D)}_getFromCacheMap(E,L,A,M,D,B=!1){return g=E.get(L,A,M,D),g||(g=this._drawToCache(L,A,M,D,B),E.set(L,A,M,D,g)),g}_getColorFromAnsiIndex(E){if(E>=this._config.colors.ansi.length)throw new Error("No color found for idx "+E);return this._config.colors.ansi[E]}_getBackgroundColor(E,L,A,M){if(this._config.allowTransparency)return f.NULL_COLOR;let D;switch(E){case 16777216:case 33554432:D=this._getColorFromAnsiIndex(L);break;case 50331648:const B=h.AttributeData.toColorRGB(L);D=f.channels.toColor(B[0],B[1],B[2]);break;default:D=A?f.color.opaque(this._config.colors.foreground):this._config.colors.background}return D}_getForegroundColor(E,L,A,M,D,B,H,F,$,I){const R=this._getMinimumContrastColor(E,L,A,M,D,B,H,$,F,I);if(R)return R;let P;switch(D){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&$&&B<8&&(B+=8),P=this._getColorFromAnsiIndex(B);break;case 50331648:const N=h.AttributeData.toColorRGB(B);P=f.channels.toColor(N[0],N[1],N[2]);break;default:P=H?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(P=f.color.opaque(P)),F&&(P=f.color.multiplyOpacity(P,c.DIM_OPACITY)),P}_resolveBackgroundRgba(E,L,A){switch(E){case 16777216:case 33554432:return this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(E,L,A,M){switch(E){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&M&&L<8&&(L+=8),this._getColorFromAnsiIndex(L).rgba;case 50331648:return L<<8;default:return A?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(E,L,A,M,D,B,H,F,$,I){if(this._config.minimumContrastRatio===1||I)return;const R=this._getContrastCache($),P=R.getColor(E,M);if(P!==void 0)return P||void 0;const N=this._resolveBackgroundRgba(L,A,H),j=this._resolveForegroundRgba(D,B,H,F),U=f.rgba.ensureContrastRatio(N,j,this._config.minimumContrastRatio/($?2:1));if(!U)return void R.setColor(E,M,null);const V=f.channels.toColor(U>>24&255,U>>16&255,U>>8&255);return R.setColor(E,M,V),V}_getContrastCache(E){return E?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(E,L,A,M,D=!1){const B=typeof E=="number"?String.fromCharCode(E):E,H=Math.min(this._config.deviceCellWidth*Math.max(B.length,2)+4,this._textureSize);this._tmpCanvas.width<H&&(this._tmpCanvas.width=H);const F=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<F&&(this._tmpCanvas.height=F),this._tmpCtx.save(),this._workAttributeData.fg=A,this._workAttributeData.bg=L,this._workAttributeData.extended.ext=M,this._workAttributeData.isInvisible())return d;const $=!!this._workAttributeData.isBold(),I=!!this._workAttributeData.isInverse(),R=!!this._workAttributeData.isDim(),P=!!this._workAttributeData.isItalic(),N=!!this._workAttributeData.isUnderline(),j=!!this._workAttributeData.isStrikethrough(),U=!!this._workAttributeData.isOverline();let V=this._workAttributeData.getFgColor(),ee=this._workAttributeData.getFgColorMode(),Q=this._workAttributeData.getBgColor(),z=this._workAttributeData.getBgColorMode();if(I){const oe=V;V=Q,Q=oe;const me=ee;ee=z,z=me}const O=this._getBackgroundColor(z,Q,I,R);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const K=$?this._config.fontWeightBold:this._config.fontWeight,W=P?"italic":"";this._tmpCtx.font=`${W} ${K} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=c.TEXT_BASELINE;const te=B.length===1&&(0,u.isPowerlineGlyph)(B.charCodeAt(0)),J=B.length===1&&(0,u.isRestrictedPowerlineGlyph)(B.charCodeAt(0)),_e=this._getForegroundColor(L,z,Q,A,ee,V,I,R,$,(0,u.treatGlyphAsBackgroundColor)(B.charCodeAt(0)));this._tmpCtx.fillStyle=_e.css;const ue=J?0:4;let se=!1;this._config.customGlyphs!==!1&&(se=(0,p.tryDrawCustomChar)(this._tmpCtx,B,ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let re,ae=!te;if(re=typeof E=="number"?this._unicodeService.wcwidth(E):this._unicodeService.getStringCellWidth(E),N){this._tmpCtx.save();const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),me=oe%2==1?.5:0;if(this._tmpCtx.lineWidth=oe,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{ae=!1;let Pe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Pe<8&&(Pe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Pe).css}this._tmpCtx.beginPath();const xe=ue,ke=Math.ceil(ue+this._config.deviceCharHeight)-me-(D?2*oe:0),Ne=ke+oe,Ke=ke+2*oe;let Ae=this._workAttributeData.getUnderlineVariantOffset();for(let Pe=0;Pe<re;Pe++){this._tmpCtx.save();const G=xe+Pe*this._config.deviceCellWidth,Y=xe+(Pe+1)*this._config.deviceCellWidth,Oe=G+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(Y,ke),this._tmpCtx.moveTo(G,Ke),this._tmpCtx.lineTo(Y,Ke);break;case 3:const $e=oe<=1?Ke:Math.ceil(ue+this._config.deviceCharHeight-oe/2)-me,X=oe<=1?ke:Math.ceil(ue+this._config.deviceCharHeight+oe/2)-me,le=new Path2D;le.rect(G,ke,this._config.deviceCellWidth,Ke-ke),this._tmpCtx.clip(le),this._tmpCtx.moveTo(G-this._config.deviceCellWidth/2,Ne),this._tmpCtx.bezierCurveTo(G-this._config.deviceCellWidth/2,X,G,X,G,Ne),this._tmpCtx.bezierCurveTo(G,$e,Oe,$e,Oe,Ne),this._tmpCtx.bezierCurveTo(Oe,X,Y,X,Y,Ne),this._tmpCtx.bezierCurveTo(Y,$e,Y+this._config.deviceCellWidth/2,$e,Y+this._config.deviceCellWidth/2,Ne);break;case 4:const ge=Ae===0?0:Ae>=oe?2*oe-Ae:oe-Ae;Ae>=oe||ge===0?(this._tmpCtx.setLineDash([Math.round(oe),Math.round(oe)]),this._tmpCtx.moveTo(G+ge,ke),this._tmpCtx.lineTo(Y,ke)):(this._tmpCtx.setLineDash([Math.round(oe),Math.round(oe)]),this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(G+ge,ke),this._tmpCtx.moveTo(G+ge+oe,ke),this._tmpCtx.lineTo(Y,ke)),Ae=(0,u.computeNextVariantOffset)(Y-G,oe,Ae);break;case 5:const We=.6,Z=.3,Le=Y-G,de=Math.floor(We*Le),fe=Math.floor(Z*Le),Ee=Le-de-fe;this._tmpCtx.setLineDash([de,fe,Ee]),this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(Y,ke);break;default:this._tmpCtx.moveTo(G,ke),this._tmpCtx.lineTo(Y,ke)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!se&&this._config.fontSize>=12&&!this._config.allowTransparency&&B!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Pe=this._tmpCtx.measureText(B);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Pe&&Pe.actualBoundingBoxDescent>0){this._tmpCtx.save();const G=new Path2D;G.rect(xe,ke-Math.ceil(oe/2),this._config.deviceCellWidth*re,Ke-ke+Math.ceil(oe/2)),this._tmpCtx.clip(G),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=O.css,this._tmpCtx.strokeText(B,ue,ue+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(U){const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),me=oe%2==1?.5:0;this._tmpCtx.lineWidth=oe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ue,ue+me),this._tmpCtx.lineTo(ue+this._config.deviceCharWidth*re,ue+me),this._tmpCtx.stroke()}if(se||this._tmpCtx.fillText(B,ue,ue+this._config.deviceCharHeight),B==="_"&&!this._config.allowTransparency){let oe=x(this._tmpCtx.getImageData(ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight),O,_e,ae);if(oe)for(let me=1;me<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(B,ue,ue+this._config.deviceCharHeight-me),oe=x(this._tmpCtx.getImageData(ue,ue,this._config.deviceCellWidth,this._config.deviceCellHeight),O,_e,ae),oe);me++);}if(j){const oe=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),me=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=oe,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ue,ue+Math.floor(this._config.deviceCharHeight/2)-me),this._tmpCtx.lineTo(ue+this._config.deviceCharWidth*re,ue+Math.floor(this._config.deviceCharHeight/2)-me),this._tmpCtx.stroke()}this._tmpCtx.restore();const ye=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let ve;if(ve=this._config.allowTransparency?function(oe){for(let me=0;me<oe.data.length;me+=4)if(oe.data[me+3]>0)return!1;return!0}(ye):x(ye,O,_e,ae),ve)return d;const ne=this._findGlyphBoundingBox(ye,this._workBoundingBox,H,J,se,ue);let ie,he;for(;;){if(this._activePages.length===0){const oe=this._createNewPage();ie=oe,he=oe.currentRow,he.height=ne.size.y;break}ie=this._activePages[this._activePages.length-1],he=ie.currentRow;for(const oe of this._activePages)ne.size.y<=oe.currentRow.height&&(ie=oe,he=oe.currentRow);for(let oe=this._activePages.length-1;oe>=0;oe--)for(const me of this._activePages[oe].fixedRows)me.height<=he.height&&ne.size.y<=me.height&&(ie=this._activePages[oe],he=me);if(he.y+ne.size.y>=ie.canvas.height||he.height>ne.size.y+2){let oe=!1;if(ie.currentRow.y+ie.currentRow.height+ne.size.y>=ie.canvas.height){let me;for(const xe of this._activePages)if(xe.currentRow.y+xe.currentRow.height+ne.size.y<xe.canvas.height){me=xe;break}if(me)ie=me;else if(w.maxAtlasPages&&this._pages.length>=w.maxAtlasPages&&he.y+ne.size.y<=ie.canvas.height&&he.height>=ne.size.y&&he.x+ne.size.x<=ie.canvas.width)oe=!0;else{const xe=this._createNewPage();ie=xe,he=xe.currentRow,he.height=ne.size.y,oe=!0}}oe||(ie.currentRow.height>0&&ie.fixedRows.push(ie.currentRow),he={x:0,y:ie.currentRow.y+ie.currentRow.height,height:ne.size.y},ie.fixedRows.push(he),ie.currentRow={x:0,y:he.y+he.height,height:0})}if(he.x+ne.size.x<=ie.canvas.width)break;he===ie.currentRow?(he.x=0,he.y+=he.height,he.height=0):ie.fixedRows.splice(ie.fixedRows.indexOf(he),1)}return ne.texturePage=this._pages.indexOf(ie),ne.texturePosition.x=he.x,ne.texturePosition.y=he.y,ne.texturePositionClipSpace.x=he.x/ie.canvas.width,ne.texturePositionClipSpace.y=he.y/ie.canvas.height,ne.sizeClipSpace.x/=ie.canvas.width,ne.sizeClipSpace.y/=ie.canvas.height,he.height=Math.max(he.height,ne.size.y),he.x+=ne.size.x,ie.ctx.putImageData(ye,ne.texturePosition.x-this._workBoundingBox.left,ne.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ne.size.x,ne.size.y),ie.addGlyph(ne),ie.version++,ne}_findGlyphBoundingBox(E,L,A,M,D,B){L.top=0;const H=M?this._config.deviceCellHeight:this._tmpCanvas.height,F=M?this._config.deviceCellWidth:A;let $=!1;for(let I=0;I<H;I++){for(let R=0;R<F;R++){const P=I*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.top=I,$=!0;break}}if($)break}L.left=0,$=!1;for(let I=0;I<B+F;I++){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*I+3;if(E.data[P]!==0){L.left=I,$=!0;break}}if($)break}L.right=F,$=!1;for(let I=B+F-1;I>=B;I--){for(let R=0;R<H;R++){const P=R*this._tmpCanvas.width*4+4*I+3;if(E.data[P]!==0){L.right=I,$=!0;break}}if($)break}L.bottom=H,$=!1;for(let I=H-1;I>=0;I--){for(let R=0;R<F;R++){const P=I*this._tmpCanvas.width*4+4*R+3;if(E.data[P]!==0){L.bottom=I,$=!0;break}}if($)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:L.right-L.left+1,y:L.bottom-L.top+1},sizeClipSpace:{x:L.right-L.left+1,y:L.bottom-L.top+1},offset:{x:-L.left+B+(M||D?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-L.top+B+(M||D?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}s.TextureAtlas=w;class b{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(E){this._glyphs.push(E),this._usedPixels+=E.size.x*E.size.y}constructor(E,L,A){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],A)for(const M of A)this._glyphs.push(...M.glyphs),this._usedPixels+=M._usedPixels;this.canvas=C(E,L,L),this.ctx=(0,u.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function x(S,E,L,A){const M=E.rgba>>>24,D=E.rgba>>>16&255,B=E.rgba>>>8&255,H=L.rgba>>>24,F=L.rgba>>>16&255,$=L.rgba>>>8&255,I=Math.floor((Math.abs(M-H)+Math.abs(D-F)+Math.abs(B-$))/12);let R=!0;for(let P=0;P<S.data.length;P+=4)S.data[P]===M&&S.data[P+1]===D&&S.data[P+2]===B||A&&Math.abs(S.data[P]-M)+Math.abs(S.data[P+1]-D)+Math.abs(S.data[P+2]-B)<I?S.data[P+3]=0:R=!1;return R}function C(S,E,L){const A=S.createElement("canvas");return A.width=E,A.height=L,A}},160:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.contrastRatio=s.toPaddedHex=s.rgba=s.rgb=s.css=s.color=s.channels=s.NULL_COLOR=void 0;let o=0,c=0,p=0,u=0;var f,_,y,v,h;function m(g){const w=g.toString(16);return w.length<2?"0"+w:w}function d(g,w){return g<w?(w+.05)/(g+.05):(g+.05)/(w+.05)}s.NULL_COLOR={css:"#00000000",rgba:0},function(g){g.toCss=function(w,b,x,C){return C!==void 0?`#${m(w)}${m(b)}${m(x)}${m(C)}`:`#${m(w)}${m(b)}${m(x)}`},g.toRgba=function(w,b,x,C=255){return(w<<24|b<<16|x<<8|C)>>>0},g.toColor=function(w,b,x,C){return{css:g.toCss(w,b,x,C),rgba:g.toRgba(w,b,x,C)}}}(f||(s.channels=f={})),function(g){function w(b,x){return u=Math.round(255*x),[o,c,p]=h.toChannels(b.rgba),{css:f.toCss(o,c,p,u),rgba:f.toRgba(o,c,p,u)}}g.blend=function(b,x){if(u=(255&x.rgba)/255,u===1)return{css:x.css,rgba:x.rgba};const C=x.rgba>>24&255,S=x.rgba>>16&255,E=x.rgba>>8&255,L=b.rgba>>24&255,A=b.rgba>>16&255,M=b.rgba>>8&255;return o=L+Math.round((C-L)*u),c=A+Math.round((S-A)*u),p=M+Math.round((E-M)*u),{css:f.toCss(o,c,p),rgba:f.toRgba(o,c,p)}},g.isOpaque=function(b){return(255&b.rgba)==255},g.ensureContrastRatio=function(b,x,C){const S=h.ensureContrastRatio(b.rgba,x.rgba,C);if(S)return f.toColor(S>>24&255,S>>16&255,S>>8&255)},g.opaque=function(b){const x=(255|b.rgba)>>>0;return[o,c,p]=h.toChannels(x),{css:f.toCss(o,c,p),rgba:x}},g.opacity=w,g.multiplyOpacity=function(b,x){return u=255&b.rgba,w(b,u*x/255)},g.toColorRGB=function(b){return[b.rgba>>24&255,b.rgba>>16&255,b.rgba>>8&255]}}(_||(s.color=_={})),function(g){let w,b;try{const x=document.createElement("canvas");x.width=1,x.height=1;const C=x.getContext("2d",{willReadFrequently:!0});C&&(w=C,w.globalCompositeOperation="copy",b=w.createLinearGradient(0,0,1,1))}catch{}g.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),f.toColor(o,c,p);case 5:return o=parseInt(x.slice(1,2).repeat(2),16),c=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),u=parseInt(x.slice(4,5).repeat(2),16),f.toColor(o,c,p,u);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const C=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return o=parseInt(C[1]),c=parseInt(C[2]),p=parseInt(C[3]),u=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(o,c,p,u);if(!w||!b)throw new Error("css.toColor: Unsupported css format");if(w.fillStyle=b,w.fillStyle=x,typeof w.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(w.fillRect(0,0,1,1),[o,c,p,u]=w.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(o,c,p,u),css:x}}}(y||(s.css=y={})),function(g){function w(b,x,C){const S=b/255,E=x/255,L=C/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}g.relativeLuminance=function(b){return w(b>>16&255,b>>8&255,255&b)},g.relativeLuminance2=w}(v||(s.rgb=v={})),function(g){function w(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M>0||D>0||B>0);)M-=Math.max(0,Math.ceil(.1*M)),D-=Math.max(0,Math.ceil(.1*D)),B-=Math.max(0,Math.ceil(.1*B)),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}function b(x,C,S){const E=x>>24&255,L=x>>16&255,A=x>>8&255;let M=C>>24&255,D=C>>16&255,B=C>>8&255,H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));for(;H<S&&(M<255||D<255||B<255);)M=Math.min(255,M+Math.ceil(.1*(255-M))),D=Math.min(255,D+Math.ceil(.1*(255-D))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=d(v.relativeLuminance2(M,D,B),v.relativeLuminance2(E,L,A));return(M<<24|D<<16|B<<8|255)>>>0}g.blend=function(x,C){if(u=(255&C)/255,u===1)return C;const S=C>>24&255,E=C>>16&255,L=C>>8&255,A=x>>24&255,M=x>>16&255,D=x>>8&255;return o=A+Math.round((S-A)*u),c=M+Math.round((E-M)*u),p=D+Math.round((L-D)*u),f.toRgba(o,c,p)},g.ensureContrastRatio=function(x,C,S){const E=v.relativeLuminance(x>>8),L=v.relativeLuminance(C>>8);if(d(E,L)<S){if(L<E){const D=w(x,C,S),B=d(E,v.relativeLuminance(D>>8));if(B<S){const H=b(x,C,S);return B>d(E,v.relativeLuminance(H>>8))?D:H}return D}const A=b(x,C,S),M=d(E,v.relativeLuminance(A>>8));if(M<S){const D=w(x,C,S);return M>d(E,v.relativeLuminance(D>>8))?A:D}return A}},g.reduceLuminance=w,g.increaseLuminance=b,g.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]}}(h||(s.rgba=h={})),s.toPaddedHex=m,s.contrastRatio=d},345:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.runAndSubscribe=s.forwardEvent=s.EventEmitter=void 0,s.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const p=[];for(let u=0;u<this._listeners.length;u++)p.push(this._listeners[u]);for(let u=0;u<p.length;u++)p[u].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},s.forwardEvent=function(o,c){return o(p=>c.fire(p))},s.runAndSubscribe=function(o,c){return c(void 0),o(p=>c(p))}},859:(l,s)=>{function o(c){for(const p of c)p.dispose();c.length=0}Object.defineProperty(s,"__esModule",{value:!0}),s.getDisposeArrayDisposable=s.disposeArray=s.toDisposable=s.MutableDisposable=s.Disposable=void 0,s.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const p=this._disposables.indexOf(c);p!==-1&&this._disposables.splice(p,1)}},s.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var p;this._isDisposed||c===this._value||((p=this._value)==null||p.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},s.toDisposable=function(c){return{dispose:c}},s.disposeArray=o,s.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},485:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FourKeyMap=s.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(p,u,f){this._data[p]||(this._data[p]={}),this._data[p][u]=f}get(p,u){return this._data[p]?this._data[p][u]:void 0}clear(){this._data={}}}s.TwoKeyMap=o,s.FourKeyMap=class{constructor(){this._data=new o}set(c,p,u,f,_){this._data.get(c,p)||this._data.set(c,p,new o),this._data.get(c,p).set(u,f,_)}get(c,p,u,f){var _;return(_=this._data.get(c,p))==null?void 0:_.get(u,f)}clear(){this._data.clear()}}},399:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.isChromeOS=s.isLinux=s.isWindows=s.isIphone=s.isIpad=s.isMac=s.getSafariVersion=s.isSafari=s.isLegacyEdge=s.isFirefox=s.isNode=void 0,s.isNode=typeof process<"u"&&"title"in process;const o=s.isNode?"node":navigator.userAgent,c=s.isNode?"node":navigator.platform;s.isFirefox=o.includes("Firefox"),s.isLegacyEdge=o.includes("Edge"),s.isSafari=/^((?!chrome|android).)*safari/i.test(o),s.getSafariVersion=function(){if(!s.isSafari)return 0;const p=o.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},s.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),s.isIpad=c==="iPad",s.isIphone=c==="iPhone",s.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),s.isLinux=c.indexOf("Linux")>=0,s.isChromeOS=/\bCrOS\b/.test(o)},385:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.DebouncedIdleTask=s.IdleTaskQueue=s.PriorityTaskQueue=void 0;const c=o(399);class p{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),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(_){this._idleCallback=void 0;let y=0,v=0,h=_.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),v=Math.max(y,v),m=_.timeRemaining(),1.5*v>m)return h-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-y))}ms`),void this._start();h=m}this.clear()}}class u extends p{_requestCallback(_){return setTimeout(()=>_(this._createDeadline(16)))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const y=Date.now()+_;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}s.PriorityTaskQueue=u,s.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:u,s.DebouncedIdleTask=class{constructor(){this._queue=new s.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},147:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExtendedAttrs=s.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new o;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}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}}s.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,f=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=f}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}s.ExtendedAttrs=c},782:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CellData=void 0;const c=o(133),p=o(855),u=o(147);class f extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const v=new f;return v.setFromCharData(y),v}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let v=!1;if(y[p.CHAR_DATA_CHAR_INDEX].length>2)v=!0;else if(y[p.CHAR_DATA_CHAR_INDEX].length===2){const h=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const m=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(h-55296)+m-56320+65536|y[p.CHAR_DATA_WIDTH_INDEX]<<22:v=!0}else v=!0}else this.content=y[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[p.CHAR_DATA_WIDTH_INDEX]<<22;v&&(this.combinedData=y[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}s.CellData=f},855:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.WHITESPACE_CELL_CODE=s.WHITESPACE_CELL_WIDTH=s.WHITESPACE_CELL_CHAR=s.NULL_CELL_CODE=s.NULL_CELL_WIDTH=s.NULL_CELL_CHAR=s.CHAR_DATA_CODE_INDEX=s.CHAR_DATA_WIDTH_INDEX=s.CHAR_DATA_CHAR_INDEX=s.CHAR_DATA_ATTR_INDEX=s.DEFAULT_EXT=s.DEFAULT_ATTR=s.DEFAULT_COLOR=void 0,s.DEFAULT_COLOR=0,s.DEFAULT_ATTR=256|s.DEFAULT_COLOR<<9,s.DEFAULT_EXT=0,s.CHAR_DATA_ATTR_INDEX=0,s.CHAR_DATA_CHAR_INDEX=1,s.CHAR_DATA_WIDTH_INDEX=2,s.CHAR_DATA_CODE_INDEX=3,s.NULL_CELL_CHAR="",s.NULL_CELL_WIDTH=1,s.NULL_CELL_CODE=0,s.WHITESPACE_CELL_CHAR=" ",s.WHITESPACE_CELL_WIDTH=1,s.WHITESPACE_CELL_CODE=32},133:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Utf8ToUtf32=s.StringToUtf32=s.utf32ToString=s.stringFromCodePoint=void 0,s.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},s.utf32ToString=function(o,c=0,p=o.length){let u="";for(let f=c;f<p;++f){let _=o[f];_>65535?(_-=65536,u+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):u+=String.fromCharCode(_)}return u},s.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const p=o.length;if(!p)return 0;let u=0,f=0;if(this._interim){const _=o.charCodeAt(f++);56320<=_&&_<=57343?c[u++]=1024*(this._interim-55296)+_-56320+65536:(c[u++]=this._interim,c[u++]=_),this._interim=0}for(let _=f;_<p;++_){const y=o.charCodeAt(_);if(55296<=y&&y<=56319){if(++_>=p)return this._interim=y,u;const v=o.charCodeAt(_);56320<=v&&v<=57343?c[u++]=1024*(y-55296)+v-56320+65536:(c[u++]=y,c[u++]=v)}else y!==65279&&(c[u++]=y)}return u}},s.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const p=o.length;if(!p)return 0;let u,f,_,y,v=0,h=0,m=0;if(this.interim[0]){let w=!1,b=this.interim[0];b&=(224&b)==192?31:(240&b)==224?15:7;let x,C=0;for(;(x=63&this.interim[++C])&&C<4;)b<<=6,b|=x;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=S-C;for(;m<E;){if(m>=p)return 0;if(x=o[m++],(192&x)!=128){m--,w=!0;break}this.interim[C++]=x,b<<=6,b|=63&x}w||(S===2?b<128?m--:c[v++]=b:S===3?b<2048||b>=55296&&b<=57343||b===65279||(c[v++]=b):b<65536||b>1114111||(c[v++]=b)),this.interim.fill(0)}const d=p-4;let g=m;for(;g<p;){for(;!(!(g<d)||128&(u=o[g])||128&(f=o[g+1])||128&(_=o[g+2])||128&(y=o[g+3]));)c[v++]=u,c[v++]=f,c[v++]=_,c[v++]=y,g+=4;if(u=o[g++],u<128)c[v++]=u;else if((224&u)==192){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(h=(31&u)<<6|63&f,h<128){g--;continue}c[v++]=h}else if((240&u)==224){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(h=(15&u)<<12|(63&f)<<6|63&_,h<2048||h>=55296&&h<=57343||h===65279)continue;c[v++]=h}else if((248&u)==240){if(g>=p)return this.interim[0]=u,v;if(f=o[g++],(192&f)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,v;if(_=o[g++],(192&_)!=128){g--;continue}if(g>=p)return this.interim[0]=u,this.interim[1]=f,this.interim[2]=_,v;if(y=o[g++],(192&y)!=128){g--;continue}if(h=(7&u)<<18|(63&f)<<12|(63&_)<<6|63&y,h<65536||h>1114111)continue;c[v++]=h}}return v}}},776:function(l,s,o){var c=this&&this.__decorate||function(h,m,d,g){var w,b=arguments.length,x=b<3?m:g===null?g=Object.getOwnPropertyDescriptor(m,d):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(h,m,d,g);else for(var C=h.length-1;C>=0;C--)(w=h[C])&&(x=(b<3?w(x):b>3?w(m,d,x):w(m,d))||x);return b>3&&x&&Object.defineProperty(m,d,x),x},p=this&&this.__param||function(h,m){return function(d,g){m(d,g,h)}};Object.defineProperty(s,"__esModule",{value:!0}),s.traceCall=s.setTraceLogger=s.LogService=void 0;const u=o(859),f=o(97),_={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let y,v=s.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),y=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let m=0;m<h.length;m++)typeof h[m]=="function"&&(h[m]=h[m]())}_log(h,m,d){this._evalLazyOptionalParams(d),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...d)}trace(h,...m){var d;this._logLevel<=f.LogLevelEnum.TRACE&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.trace.bind(this._optionsService.options.logger))??console.log,h,m)}debug(h,...m){var d;this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.debug.bind(this._optionsService.options.logger))??console.log,h,m)}info(h,...m){var d;this._logLevel<=f.LogLevelEnum.INFO&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.info.bind(this._optionsService.options.logger))??console.info,h,m)}warn(h,...m){var d;this._logLevel<=f.LogLevelEnum.WARN&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.warn.bind(this._optionsService.options.logger))??console.warn,h,m)}error(h,...m){var d;this._logLevel<=f.LogLevelEnum.ERROR&&this._log(((d=this._optionsService.options.logger)==null?void 0:d.error.bind(this._optionsService.options.logger))??console.error,h,m)}};s.LogService=v=c([p(0,f.IOptionsService)],v),s.setTraceLogger=function(h){y=h},s.traceCall=function(h,m,d){if(typeof d.value!="function")throw new Error("not supported");const g=d.value;d.value=function(...w){if(y.logLevel!==f.LogLevelEnum.TRACE)return g.apply(this,w);y.trace(`GlyphRenderer#${g.name}(${w.map(x=>JSON.stringify(x)).join(", ")})`);const b=g.apply(this,w);return y.trace(`GlyphRenderer#${g.name} return`,b),b}}},726:(l,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createDecorator=s.getServiceDependencies=s.serviceRegistry=void 0;const o="di$target",c="di$dependencies";s.serviceRegistry=new Map,s.getServiceDependencies=function(p){return p[c]||[]},s.createDecorator=function(p){if(s.serviceRegistry.has(p))return s.serviceRegistry.get(p);const u=function(f,_,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,h,m){h[o]===h?h[c].push({id:v,index:m}):(h[c]=[{id:v,index:m}],h[o]=h)})(u,f,y)};return u.toString=()=>p,s.serviceRegistry.set(p,u),u}},97:(l,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IDecorationService=s.IUnicodeService=s.IOscLinkService=s.IOptionsService=s.ILogService=s.LogLevelEnum=s.IInstantiationService=s.ICharsetService=s.ICoreService=s.ICoreMouseService=s.IBufferService=void 0;const c=o(726);var p;s.IBufferService=(0,c.createDecorator)("BufferService"),s.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),s.ICoreService=(0,c.createDecorator)("CoreService"),s.ICharsetService=(0,c.createDecorator)("CharsetService"),s.IInstantiationService=(0,c.createDecorator)("InstantiationService"),function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"}(p||(s.LogLevelEnum=p={})),s.ILogService=(0,c.createDecorator)("LogService"),s.IOptionsService=(0,c.createDecorator)("OptionsService"),s.IOscLinkService=(0,c.createDecorator)("OscLinkService"),s.IUnicodeService=(0,c.createDecorator)("UnicodeService"),s.IDecorationService=(0,c.createDecorator)("DecorationService")}},n={};function i(l){var s=n[l];if(s!==void 0)return s.exports;var o=n[l]={exports:{}};return r[l].call(o.exports,o,o.exports,i),o.exports}var a={};return(()=>{var l=a;Object.defineProperty(l,"__esModule",{value:!0}),l.WebglAddon=void 0;const s=i(345),o=i(859),c=i(399),p=i(666),u=i(776);class f extends o.Disposable{constructor(y){if(c.isSafari&&(0,c.getSafariVersion)()<16){const v={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",v))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=y,this._onChangeTextureAtlas=this.register(new s.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new s.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new s.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new s.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(y){const v=y._core;if(!y.element)return void this.register(v.onWillOpen(()=>this.activate(y)));this._terminal=y;const h=v.coreService,m=v.optionsService,d=v,g=d._renderService,w=d._characterJoinerService,b=d._charSizeService,x=d._coreBrowserService,C=d._decorationService,S=d._logService,E=d._themeService;(0,u.setTraceLogger)(S),this._renderer=this.register(new p.WebglRenderer(y,w,b,x,h,C,m,E,this._preserveDrawingBuffer)),this.register((0,s.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,s.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,s.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,s.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),g.setRenderer(this._renderer),this.register((0,o.toDisposable)(()=>{const L=this._terminal._core._renderService;L.setRenderer(this._terminal._core._createRenderer()),L.handleResize(y.cols,y.rows)}))}get textureAtlas(){var y;return(y=this._renderer)==null?void 0:y.textureAtlas}clearTextureAtlas(){var y;(y=this._renderer)==null||y.clearTextureAtlas()}}l.WebglAddon=f})(),a})())})(gw);var dv=gw.exports;/**
|
|
129
129
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
130
130
|
* @license MIT
|
|
131
131
|
*
|
|
@@ -170,7 +170,7 @@ void main() {
|
|
|
170
170
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
171
171
|
* http://bellard.org/jslinux/
|
|
172
172
|
* Copyright (c) 2011 Fabrice Bellard
|
|
173
|
-
*/function yv(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var _D=class{constructor(){this._st=0,this._pr=0}dispose(){var e,t;(e=this._seqHandler)==null||e.dispose(),(t=this._onChange)==null||t.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=yv(r[1]),i=yv(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(i<0)return!0;this.progress={state:n,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:n,value:i||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){var t;if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),(t=this._onChange)==null||t.fire({state:this._st,value:this._pr})}};const yD=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,wD=/[.,;:!?]+$/,SD=[["(",")"],["[","]"],["{","}"]],wv=(e,t)=>e.split(t).length-1;function yu(e){let t=e.trim();if(!t)return t;const r=()=>{t=t.replace(wD,"")};r();let n=!0;for(;n;){n=!1;for(const[i,a]of SD){if(!t.endsWith(a))continue;const l=wv(t,i);wv(t,a)>l&&(t=t.slice(0,-1),n=!0)}}return r(),t}const Oa=()=>typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),xD="\x1B[200~\x1B[201~";class bD{async readText(t){if(t!=="c")return"";try{return await navigator.clipboard.readText()}catch{return""}}async writeText(t,r){if(!(t!=="c"||!(r!=null&&r.trim())))try{await navigator.clipboard.writeText(r)}catch{}}}const CD="︎",Iw=["⏺"],ED=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),kD=new RegExp(Iw.map(ED).join("|"),"g");function LD(e){for(const t of Iw)if(e.indexOf(t)!==-1)return e.replace(kD,`$&${CD}`);return e}function TD({sessionId:e,tmuxTarget:t,allowAttach:r=!0,connectionStatus:n="connected",connectionEpoch:i=0,sendMessage:a,subscribe:l,theme:s,fontSize:o,lineHeight:c,letterSpacing:p,fontFamily:u,useWebGL:f,onScrollChange:_}){const y=Qo(),v=k.useRef(null),h=k.useRef(null),m=k.useRef(null),d=k.useRef(null),g=k.useRef(null),w=k.useRef(null),b=k.useRef(null),x=k.useRef(null),C=k.useRef(null),S=k.useRef(null),E=k.useRef(null),L=k.useRef(null),A=k.useRef(0),M=k.useRef(!1),D=k.useRef(null),B=k.useRef(null),H=k.useRef(null),F=k.useRef(-1),$=k.useRef(null),I=k.useRef(a),R=k.useRef(_),P=k.useRef(f),N=k.useRef(""),j=k.useRef(null),U=k.useRef(null),V=2,ee=16,Q=k.useRef(null),z=k.useRef(null),O=k.useRef(null),K=()=>{if(Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null),z.current!==null&&(cancelAnimationFrame(z.current),z.current=null),O.current!==null){const se=v.current;se&&(se.style.display=O.current),O.current=null}},W=se=>{const re=v.current;re&&(K(),Q.current=window.setTimeout(()=>{Q.current=null;const ae=h.current;ae&&ae.refresh(0,ae.rows-1),O.current=re.style.display,re.style.display="none",z.current=requestAnimationFrame(()=>{z.current=requestAnimationFrame(()=>{z.current=null,re.style.display=O.current??"",O.current=null})})},se))};k.useEffect(()=>{I.current=a},[a]),k.useEffect(()=>{R.current=_},[_]);const te=k.useCallback(()=>{const se=h.current;if(!se||!R.current)return;const re=se.buffer.active,ae=!M.current&&re.viewportY>=re.baseY;R.current(ae)},[]),
|
|
173
|
+
*/function yv(e){let t=0;for(let r=0;r<e.length;++r){let n=e.charCodeAt(r);if(n<48||57<n)return-1;t=t*10+n-48}return t}var _D=class{constructor(){this._st=0,this._pr=0}dispose(){var e,t;(e=this._seqHandler)==null||e.dispose(),(t=this._onChange)==null||t.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,t=>{if(!t.startsWith("4;"))return!1;let r=t.split(";");if(r.length>3)return!0;r.length===2&&r.push("");let n=yv(r[1]),i=yv(r[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(i<0)return!0;this.progress={state:n,value:i};break;case 2:case 4:if(i<0)return!0;this.progress={state:n,value:i||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){var t;if(e.state<0||e.state>4){console.warn("progress state out of bounds, not applied");return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),(t=this._onChange)==null||t.fire({state:this._st,value:this._pr})}};const yD=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,wD=/[.,;:!?]+$/,SD=[["(",")"],["[","]"],["{","}"]],wv=(e,t)=>e.split(t).length-1;function yu(e){let t=e.trim();if(!t)return t;const r=()=>{t=t.replace(wD,"")};r();let n=!0;for(;n;){n=!1;for(const[i,a]of SD){if(!t.endsWith(a))continue;const l=wv(t,i);wv(t,a)>l&&(t=t.slice(0,-1),n=!0)}}return r(),t}const Oa=()=>typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),xD="\x1B[200~\x1B[201~";class bD{async readText(t){if(t!=="c")return"";try{return await navigator.clipboard.readText()}catch{return""}}async writeText(t,r){if(!(t!=="c"||!(r!=null&&r.trim())))try{await navigator.clipboard.writeText(r)}catch{}}}const CD="︎",Iw=["⏺"],ED=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),kD=new RegExp(Iw.map(ED).join("|"),"g");function LD(e){for(const t of Iw)if(e.indexOf(t)!==-1)return e.replace(kD,`$&${CD}`);return e}function TD({sessionId:e,tmuxTarget:t,allowAttach:r=!0,connectionStatus:n="connected",connectionEpoch:i=0,sendMessage:a,subscribe:l,theme:s,fontSize:o,lineHeight:c,letterSpacing:p,fontFamily:u,useWebGL:f,onScrollChange:_}){const y=Qo(),v=k.useRef(null),h=k.useRef(null),m=k.useRef(null),d=k.useRef(null),g=k.useRef(null),w=k.useRef(null),b=k.useRef(null),x=k.useRef(null),C=k.useRef(null),S=k.useRef(null),E=k.useRef(null),L=k.useRef(null),A=k.useRef(0),M=k.useRef(!1),D=k.useRef(null),B=k.useRef(null),H=k.useRef(null),F=k.useRef(-1),$=k.useRef(null),I=k.useRef(a),R=k.useRef(_),P=k.useRef(f),N=k.useRef(""),j=k.useRef(null),U=k.useRef(null),V=2,ee=16,Q=k.useRef(null),z=k.useRef(null),O=k.useRef(null),K=()=>{if(Q.current!==null&&(window.clearTimeout(Q.current),Q.current=null),z.current!==null&&(cancelAnimationFrame(z.current),z.current=null),O.current!==null){const se=v.current;se&&(se.style.display=O.current),O.current=null}},W=se=>{const re=v.current;re&&(K(),Q.current=window.setTimeout(()=>{Q.current=null;const ae=h.current;ae&&ae.refresh(0,ae.rows-1),O.current=re.style.display,re.style.display="none",z.current=requestAnimationFrame(()=>{z.current=requestAnimationFrame(()=>{z.current=null,re.style.display=O.current??"",O.current=null})})},se))};k.useEffect(()=>{I.current=a},[a]),k.useEffect(()=>{R.current=_},[_]);const te=k.useCallback(()=>{const se=h.current;if(!se||!R.current)return;const re=se.buffer.active,ae=!M.current&&re.viewportY>=re.baseY;R.current(ae)},[]),J=k.useCallback(se=>{if(M.current===se)return;M.current=se;const re=h.current;re&&se&&re.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l"),te()},[te]),_e=k.useCallback(()=>{const se=B.current;se&&(D.current!==null&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{D.current=null,I.current({type:"tmux-check-copy-mode",sessionId:se})},150))},[]),ue=k.useCallback(()=>{const se=h.current,re=m.current;if(!se||!re)return;re.fit();const ae=B.current;ae&&I.current({type:"terminal-resize",sessionId:ae,cols:se.cols,rows:se.rows})},[]);return k.useEffect(()=>{var Le;const se=v.current;if(!se||h.current)return;let re=!1;se.innerHTML="";const ye=((de,fe)=>Math.round(de*fe)/de)(o,c),ve=new zR.Terminal({fontFamily:u,fontSize:o,lineHeight:ye,letterSpacing:p,scrollback:0,cursorBlink:!1,cursorStyle:"underline",convertEol:!0,theme:s,screenReaderMode:y,minimumContrastRatio:4.5}),ne=new VR;ve.loadAddon(ne),ve.loadAddon(new lD(void 0,new bD));const ie=new hD.SearchAddon;ve.loadAddon(ie),b.current=ie;const he=new gD;ve.loadAddon(he),x.current=he;const oe=new _D;ve.loadAddon(oe),C.current=oe;const me=()=>{if(!re){if(P.current)try{const de=new dv.WebglAddon;de.onContextLoss(()=>{try{de.dispose()}catch{}d.current=null}),ve.loadAddon(de),d.current=de}catch{}ve.open(se),ne.fit(),xe&&ve.element&&ve.element.appendChild(xe)}};(Le=document.fonts)!=null&&Le.ready?document.fonts.ready.then(me).catch(me):me();let xe=null,ke=null,Ne=null;typeof document<"u"&&document.createElement&&(xe=document.createElement("div"),xe.className="xterm-hover",xe.style.cssText=`
|
|
174
174
|
position: absolute;
|
|
175
175
|
display: none;
|
|
176
176
|
z-index: 20;
|
|
@@ -184,7 +184,7 @@ void main() {
|
|
|
184
184
|
pointer-events: none;
|
|
185
185
|
max-width: 400px;
|
|
186
186
|
word-break: break-all;
|
|
187
|
-
`,ke=document.createElement("div"),xe.appendChild(ke),Ne=document.createElement("div"),Ne.style.color="var(--text-muted)",Ne.style.marginTop="2px",Ne.style.fontSize="11px",xe.appendChild(Ne),w.current=xe);const Ke=(de,fe)=>{if(!ve.element||!xe||!ke||!Ne)return;const Ee=yu(fe);if(!Ee)return;const Re=ve.element.getBoundingClientRect(),je=Ee.length>60?Ee.slice(0,57)+"...":Ee;ke.textContent=je,Ne.textContent=`${Oa()?"⌘":"Ctrl"}+click to open`,xe.style.left=`${de.clientX-Re.left+10}px`,xe.style.top=`${de.clientY-Re.top+10}px`,xe.style.display="block"},Ae=()=>{xe&&(xe.style.display="none")};let Pe=null,G=!1,J=null;const Oe={activate:(de,fe)=>{if(!G&&(de.metaKey||de.ctrlKey)){const Ee=yu(fe);if(!Ee)return;window.open(Ee,"_blank","noopener")}},hover:(de,fe)=>{Pe=yu(fe)||null,Ke(de,fe)},leave:()=>{Pe=null,Ae()}},$e=de=>{Pe&&(de.metaKey||de.ctrlKey)&&(de.preventDefault(),de.stopPropagation(),G=!0,window.open(Pe,"_blank","noopener"),J&&clearTimeout(J),J=setTimeout(()=>{G=!1},100))};se.addEventListener("mousedown",$e,!0),ve.options.linkHandler=Oe;const X=new JR((de,fe)=>Oe.activate(de,fe),{urlRegex:yD,hover:(de,fe)=>Oe.hover(de,fe),leave:()=>Oe.leave()});ve.loadAddon(X),g.current=X;let le=null,ge=null;const We=Oa()?"metaKey":"ctrlKey";ve.attachCustomKeyEventHandler(de=>{if((de.ctrlKey||de.metaKey)&&de.key.toLowerCase()==="c"&&ve.hasSelection()){const fe=ve.getSelection();return fe!=null&&fe.trim()&&navigator.clipboard&&navigator.clipboard.writeText(fe),!1}if(Oa()&&!y&&de.ctrlKey&&!de.metaKey&&de.key.toLowerCase()==="v"&&de.type==="keydown")return B.current&&(M.current&&(I.current({type:"tmux-cancel-copy-mode",sessionId:B.current}),Y(!1)),I.current({type:"terminal-input",sessionId:B.current,data:xD})),!B.current;if(de[We]&&de.key.toLowerCase()==="v"&&de.type==="keydown"){ge!==null&&(clearTimeout(ge),ge=null),le=null;const fe=new Promise(Ee=>{ge=setTimeout(()=>{ge=null,le=null,Ee(null)},100),le=Re=>{ge!==null&&(clearTimeout(ge),ge=null),Ee(Re)}});return(async()=>{try{const Ee=B.current;if(!Ee)return;let Re=await fe;if(Re==null)try{Re=await navigator.clipboard.readText()}catch{Re=""}if(!Re&&Oa()&&!y)try{const je=await fetch("/api/clipboard-file-path");if(je.ok){const{path:Me}=await je.json();if(Me){I.current({type:"terminal-input",sessionId:Ee,data:Me});return}}}catch{}Re&&ve.paste(Re)}finally{le=null}})(),!1}if(de.ctrlKey&&de.key==="Backspace"&&de.type==="keydown"){const fe=B.current;return fe&&I.current({type:"terminal-input",sessionId:fe,data:""}),!1}return!0});const Z=de=>{var Re;if(!le)return;de.preventDefault(),de.stopPropagation();const fe=((Re=de.clipboardData)==null?void 0:Re.getData("text/plain"))??"",Ee=le;le=null,Ee(fe)};return se.addEventListener("paste",Z,{capture:!0}),ve.onData(de=>{const fe=B.current;if(fe){const Ee=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(de);if(M.current&&Ee)return;M.current&&(I.current({type:"tmux-cancel-copy-mode",sessionId:fe}),Y(!1)),I.current({type:"terminal-input",sessionId:fe,data:de})}}),ve.attachCustomWheelEventHandler(de=>{const fe=B.current;if(!fe)return!0;const Ee=de.target;if(Ee!=null&&Ee.closest('input, textarea, [contenteditable="true"], .xterm-hover')||ve.hasSelection()||de.shiftKey)return!0;const Re=30;A.current+=de.deltaY;const je=ve.cols,Me=ve.rows,Ie=Math.floor(je/2),Ve=Math.floor(Me/2);let ot=!1,He=!1;for(;Math.abs(A.current)>=Re;){He=!0;const Te=A.current>0;A.current+=Te?-Re:Re;const De=Te?65:64;Te||(ot=!0),I.current({type:"terminal-input",sessionId:fe,data:`\x1B[<${De};${Ie};${Ve}M`})}return ot&&Y(!0),He&&_e(),!1}),h.current=ve,m.current=ne,()=>{if(re=!0,J&&clearTimeout(J),Pe=null,se.removeEventListener("mousedown",$e,!0),se.removeEventListener("paste",Z,!0),ge!==null&&(clearTimeout(ge),ge=null),le=null,w.current&&(w.current.remove(),w.current=null),g.current){try{g.current.dispose()}catch{}g.current=null}if(d.current){try{d.current.dispose()}catch{}d.current=null}try{ve.dispose()}catch{}se&&(se.innerHTML=""),h.current=null,m.current=null,b.current=null,x.current=null,C.current=null,L.current&&window.clearTimeout(L.current),D.current!==null&&window.clearTimeout(D.current)}},[ue]),k.useEffect(()=>{h.current&&(h.current.options.theme=s)},[s]),k.useEffect(()=>{const se=h.current,re=m.current;if(se&&re){se.options.fontFamily=u,se.options.fontSize=o,se.options.lineHeight=Math.round(o*c)/o,se.options.letterSpacing=p,re.fit();const ae=B.current;ae&&I.current({type:"terminal-resize",sessionId:ae,cols:se.cols,rows:se.rows})}},[o,c,p,u]),k.useEffect(()=>{const se=h.current;if(!se)return;const re=P.current;if(P.current=f,re!==f){if(f){if(!d.current)try{const ae=new dv.WebglAddon;ae.onContextLoss(()=>{try{ae.dispose()}catch{}d.current=null}),se.loadAddon(ae),d.current=ae}catch{}}else if(d.current){try{d.current.dispose()}catch{}d.current=null}}},[f]),k.useEffect(()=>{const se=h.current;if(!se)return;const re=B.current,ae=H.current;if(!r){re&&(I.current({type:"terminal-detach",sessionId:re}),B.current=null,H.current=null,F.current=-1,M.current=!1),se.reset();return}if(n!=="connected"){re&&(Qe("terminal_detach_on_disconnect",{connectionStatus:n,prevAttached:re}),B.current=null,H.current=null,F.current=-1,M.current=!1);return}re&&re!==e&&(I.current({type:"terminal-detach",sessionId:re}),B.current=null,H.current=null,F.current=-1,M.current=!1);const ye=F.current,ve=i!==ye;if(e&&(e!==re||t!==ae||ve)){Qe("terminal_attach",{sessionId:e,tmuxTarget:t,prevAttached:re,prevTarget:ae,connectionStatus:n,connectionEpoch:i,attachedEpoch:ye});const ne=performance.now();se.reset();const ie=performance.now(),he=m.current;he&&he.fit();const oe=performance.now();I.current({type:"terminal-attach",sessionId:e,tmuxTarget:t??void 0,cols:se.cols,rows:se.rows}),B.current=e,H.current=t??null,F.current=i,I.current({type:"tmux-check-copy-mode",sessionId:e}),Qe("switch_attach_sent",{sessionId:e,resetMs:Math.round(ie-ne),fitMs:Math.round(oe-ie),totalMs:Math.round(performance.now()-ne),from:re??null}),$.current=ne,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{se.scrollToBottom(),te(),se.focus()},300)}e&&e===re&&t===ae&&!ve&&Qe("terminal_attach_skip",{sessionId:e,prevAttached:re,connectionStatus:n,connectionEpoch:i,attachedEpoch:ye}),!e&&re&&(B.current=null,H.current=null,F.current=-1)},[e,t,r,n,i,te]),k.useEffect(()=>{const se=()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null),U.current!==null&&(window.clearTimeout(U.current),U.current=null);const ye=h.current,ve=N.current;if(!ye||!ve)return;N.current="";const ne=performance.now(),ie=ve.length;ye.write(ve,()=>{const he=Math.round(performance.now()-ne);he>50&&Qe("switch_write_slow",{sessionId:B.current,writeMs:he,bytes:ie}),te()})},re=()=>{j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(se,V),U.current===null&&(U.current=window.setTimeout(se,ee))},ae=l(ye=>{const ve=B.current;if(ye.type==="terminal-output"&&ve&&ye.sessionId===ve){const ne=$.current;ne&&(Qe("switch_first_output",{sessionId:ye.sessionId,serverRoundtripMs:Math.round(performance.now()-ne),bytes:ye.data.length}),$.current=null),N.current+=y?LD(ye.data):ye.data,re()}if(ye.type==="terminal-ready"&&ve&&ye.sessionId===ve){const ne=$.current;ne&&(Qe("switch_ready",{sessionId:ye.sessionId,totalMs:Math.round(performance.now()-ne)}),$.current=null),y&&(se(),W(50))}ye.type==="tmux-copy-mode-status"&&ve&&ye.sessionId===ve&&Y(ye.inCopyMode)});return()=>{ae(),se(),K()}},[l,te,Y]),k.useEffect(()=>{const se=v.current,re=h.current,ae=m.current;if(!se||!re||!ae)return;const ye=()=>{S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{ue()},150)},ve=new ResizeObserver(ye);return ve.observe(se),ye(),()=>{ve.disconnect(),S.current&&window.clearTimeout(S.current)}},[]),k.useEffect(()=>{if(!y)return;const se=()=>{document.visibilityState!=="hidden"&&W(200)},re=ye=>{ye.persisted&&W(200)},ae=()=>{W(200)};return document.addEventListener("visibilitychange",se),window.addEventListener("pageshow",re),window.addEventListener("focus",ae),()=>{document.removeEventListener("visibilitychange",se),window.removeEventListener("pageshow",re),window.removeEventListener("focus",ae),K()}},[]),{containerRef:v,terminalRef:h,searchAddonRef:b,serializeAddonRef:x,progressAddonRef:C,inTmuxCopyModeRef:M,setTmuxCopyMode:Y}}function RD(e="(max-width: 767px)"){const[t,r]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(e),i=()=>r(n.matches);return i(),typeof n.addEventListener=="function"?(n.addEventListener("change",i),()=>n.removeEventListener("change",i)):(n.addListener(i),()=>n.removeListener(i))},[e]),t}function DD(e,t,r){k.useEffect(()=>{if(!t)return;const n=i=>{e.current&&!e.current.contains(i.target)&&r()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t,r])}function MD(e,t){k.useEffect(()=>{if(!e)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),t())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t])}function AD({enabled:e,isOpen:t,onOpen:r,edgeThresholdPx:n=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){const l=k.useRef(!1);return k.useEffect(()=>{if(!e)return;let s=0,o=0,c=!1;const p=f=>{if(t)return;const _=f.touches[0];_.clientX<=n?(s=_.clientX,o=_.clientY,c=!0,l.current=!0):c=!1},u=f=>{if(l.current=!1,!c||t)return;const _=f.changedTouches[0],y=_.clientX-s,v=Math.abs(_.clientY-o);y>=i&&y>v*a&&r(),c=!1};return document.addEventListener("touchstart",p,{passive:!0}),document.addEventListener("touchend",u,{passive:!0}),()=>{l.current=!1,document.removeEventListener("touchstart",p),document.removeEventListener("touchend",u)}},[e,t,r,n,i,a]),l}const Gl=uf()(hf(e=>({theme:"dark",setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="dark"?"light":"dark"}))}),{name:"agentboard-theme",storage:mc(()=>df)})),PD={dark:{background:"#2d2d2d",foreground:"#d4d4d4",cursor:"#3b82f6",cursorAccent:"#2d2d2d",selectionBackground:"rgba(59, 130, 246, 0.35)",selectionForeground:"#ffffff",black:"#808080",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#d4d4d4",brightBlack:"#a0a0a0",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},light:{background:"#fafafa",foreground:"#171717",cursor:"#2563eb",cursorAccent:"#fafafa",selectionBackground:"rgba(37, 99, 235, 0.2)",selectionForeground:"#000000",black:"#171717",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f5f5f5",brightBlack:"#737373",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"}},ID={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},BD=150,OD=250,ND=400,Sv=1500,jD=15,Qi=70;function wu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}function FD(e,t){const r=Math.sqrt(e*e+t*t);if(r<jD)return{direction:null,distance:0};const n=Math.atan2(t,e)*(180/Math.PI);let i;return n>=-45&&n<45?i="right":n>=45&&n<135?i="down":n>=-135&&n<-45?i="up":i="left",{direction:i,distance:r}}function $D(e){const t=Qi-20,r=Math.min(e/t,1);return Sv-r*(Sv-ND)}function HD({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[i,a]=k.useState(!1),[l,s]=k.useState(null),[o,c]=k.useState({x:0,y:0}),[p,u]=k.useState({x:0,y:0}),f=k.useRef(null),_=k.useRef(null),y=k.useRef(null),v=k.useRef(!1),h=k.useRef(null),m=k.useRef(0),d=k.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),g=k.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),w=k.useCallback(D=>{const B=$D(m.current);y.current=setTimeout(()=>{h.current&&(wu(5),e(D),w(D))},B)},[e]),b=k.useCallback((D,B)=>{if(!D||t)return;const H=ID[D];m.current=B,wu(8),e(H),g(),_.current=setTimeout(()=>{w(H)},OD)},[t,e,g,w]),x=k.useCallback((D,B)=>{const H=D-o.x,F=B-o.y,$=Math.sqrt(H*H+F*F),I=Math.min($,Qi-20),R=$>0?I/$:0;u({x:H*R,y:F*R});const{direction:P,distance:N}=FD(H,F);m.current=N,P!==h.current&&(h.current=P,s(P),g(),P&&b(P,N))},[o,g,b]),C=k.useCallback(()=>{a(!1),s(null),u({x:0,y:0}),g(),h.current=null,v.current&&(r==null||r())},[g,r]),S=k.useCallback(D=>{if(t)return;D.preventDefault(),D.stopPropagation();const B=D.touches[0];v.current=(n==null?void 0:n())??!1,f.current=setTimeout(()=>{wu(15),c({x:B.clientX,y:B.clientY-80}),u({x:0,y:0}),a(!0)},BD)},[t,n]),E=k.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),!i)return;const B=D.touches[0];x(B.clientX,B.clientY)},[i,x]),L=k.useCallback(D=>{D.preventDefault(),D.stopPropagation(),f.current&&(clearTimeout(f.current),f.current=null),i&&C()},[i,C]),A=k.useCallback(D=>{D.preventDefault(),d(),C()},[d,C]);k.useEffect(()=>()=>{d()},[d]);const M=[{dir:"up",angle:-90,label:"↑"},{dir:"right",angle:0,label:"→"},{dir:"down",angle:90,label:"↓"},{dir:"left",angle:180,label:"←"}];return T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button","aria-label":"Arrow keys",className:`
|
|
187
|
+
`,ke=document.createElement("div"),xe.appendChild(ke),Ne=document.createElement("div"),Ne.style.color="var(--text-muted)",Ne.style.marginTop="2px",Ne.style.fontSize="11px",xe.appendChild(Ne),w.current=xe);const Ke=(de,fe)=>{if(!ve.element||!xe||!ke||!Ne)return;const Ee=yu(fe);if(!Ee)return;const Re=ve.element.getBoundingClientRect(),je=Ee.length>60?Ee.slice(0,57)+"...":Ee;ke.textContent=je,Ne.textContent=`${Oa()?"⌘":"Ctrl"}+click to open`,xe.style.left=`${de.clientX-Re.left+10}px`,xe.style.top=`${de.clientY-Re.top+10}px`,xe.style.display="block"},Ae=()=>{xe&&(xe.style.display="none")};let Pe=null,G=!1,Y=null;const Oe={activate:(de,fe)=>{if(!G&&(de.metaKey||de.ctrlKey)){const Ee=yu(fe);if(!Ee)return;window.open(Ee,"_blank","noopener")}},hover:(de,fe)=>{Pe=yu(fe)||null,Ke(de,fe)},leave:()=>{Pe=null,Ae()}},$e=de=>{Pe&&(de.metaKey||de.ctrlKey)&&(de.preventDefault(),de.stopPropagation(),G=!0,window.open(Pe,"_blank","noopener"),Y&&clearTimeout(Y),Y=setTimeout(()=>{G=!1},100))};se.addEventListener("mousedown",$e,!0),ve.options.linkHandler=Oe;const X=new JR((de,fe)=>Oe.activate(de,fe),{urlRegex:yD,hover:(de,fe)=>Oe.hover(de,fe),leave:()=>Oe.leave()});ve.loadAddon(X),g.current=X;let le=null,ge=null;const We=Oa()?"metaKey":"ctrlKey";ve.attachCustomKeyEventHandler(de=>{if((de.ctrlKey||de.metaKey)&&de.key.toLowerCase()==="c"&&ve.hasSelection()){const fe=ve.getSelection();return fe!=null&&fe.trim()&&navigator.clipboard&&navigator.clipboard.writeText(fe),!1}if(Oa()&&!y&&de.ctrlKey&&!de.metaKey&&de.key.toLowerCase()==="v"&&de.type==="keydown")return B.current&&(M.current&&(I.current({type:"tmux-cancel-copy-mode",sessionId:B.current}),J(!1)),I.current({type:"terminal-input",sessionId:B.current,data:xD})),!B.current;if(de[We]&&de.key.toLowerCase()==="v"&&de.type==="keydown"){ge!==null&&(clearTimeout(ge),ge=null),le=null;const fe=new Promise(Ee=>{ge=setTimeout(()=>{ge=null,le=null,Ee(null)},100),le=Re=>{ge!==null&&(clearTimeout(ge),ge=null),Ee(Re)}});return(async()=>{try{const Ee=B.current;if(!Ee)return;let Re=await fe;if(Re==null)try{Re=await navigator.clipboard.readText()}catch{Re=""}if(!Re&&Oa()&&!y)try{const je=await fetch("/api/clipboard-file-path");if(je.ok){const{path:Me}=await je.json();if(Me){I.current({type:"terminal-input",sessionId:Ee,data:Me});return}}}catch{}Re&&ve.paste(Re)}finally{le=null}})(),!1}if(de.ctrlKey&&de.key==="Backspace"&&de.type==="keydown"){const fe=B.current;return fe&&I.current({type:"terminal-input",sessionId:fe,data:""}),!1}return!0});const Z=de=>{var Re;if(!le)return;de.preventDefault(),de.stopPropagation();const fe=((Re=de.clipboardData)==null?void 0:Re.getData("text/plain"))??"",Ee=le;le=null,Ee(fe)};return se.addEventListener("paste",Z,{capture:!0}),ve.onData(de=>{const fe=B.current;if(fe){const Ee=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(de);if(M.current&&Ee)return;M.current&&(I.current({type:"tmux-cancel-copy-mode",sessionId:fe}),J(!1)),I.current({type:"terminal-input",sessionId:fe,data:de})}}),ve.attachCustomWheelEventHandler(de=>{const fe=B.current;if(!fe)return!0;const Ee=de.target;if(Ee!=null&&Ee.closest('input, textarea, [contenteditable="true"], .xterm-hover')||ve.hasSelection()||de.shiftKey)return!0;const Re=30;A.current+=de.deltaY;const je=ve.cols,Me=ve.rows,Ie=Math.floor(je/2),Ve=Math.floor(Me/2);let ot=!1,He=!1;for(;Math.abs(A.current)>=Re;){He=!0;const Te=A.current>0;A.current+=Te?-Re:Re;const De=Te?65:64;Te||(ot=!0),I.current({type:"terminal-input",sessionId:fe,data:`\x1B[<${De};${Ie};${Ve}M`})}return ot&&J(!0),He&&_e(),!1}),h.current=ve,m.current=ne,()=>{if(re=!0,Y&&clearTimeout(Y),Pe=null,se.removeEventListener("mousedown",$e,!0),se.removeEventListener("paste",Z,!0),ge!==null&&(clearTimeout(ge),ge=null),le=null,w.current&&(w.current.remove(),w.current=null),g.current){try{g.current.dispose()}catch{}g.current=null}if(d.current){try{d.current.dispose()}catch{}d.current=null}try{ve.dispose()}catch{}se&&(se.innerHTML=""),h.current=null,m.current=null,b.current=null,x.current=null,C.current=null,L.current&&window.clearTimeout(L.current),D.current!==null&&window.clearTimeout(D.current)}},[ue]),k.useEffect(()=>{h.current&&(h.current.options.theme=s)},[s]),k.useEffect(()=>{const se=h.current,re=m.current;if(se&&re){se.options.fontFamily=u,se.options.fontSize=o,se.options.lineHeight=Math.round(o*c)/o,se.options.letterSpacing=p,re.fit();const ae=B.current;ae&&I.current({type:"terminal-resize",sessionId:ae,cols:se.cols,rows:se.rows})}},[o,c,p,u]),k.useEffect(()=>{const se=h.current;if(!se)return;const re=P.current;if(P.current=f,re!==f){if(f){if(!d.current)try{const ae=new dv.WebglAddon;ae.onContextLoss(()=>{try{ae.dispose()}catch{}d.current=null}),se.loadAddon(ae),d.current=ae}catch{}}else if(d.current){try{d.current.dispose()}catch{}d.current=null}}},[f]),k.useEffect(()=>{const se=h.current;if(!se)return;const re=B.current,ae=H.current;if(!r){re&&(I.current({type:"terminal-detach",sessionId:re}),B.current=null,H.current=null,F.current=-1,M.current=!1),se.reset();return}if(n!=="connected"){re&&(Qe("terminal_detach_on_disconnect",{connectionStatus:n,prevAttached:re}),B.current=null,H.current=null,F.current=-1,M.current=!1);return}re&&re!==e&&(I.current({type:"terminal-detach",sessionId:re}),B.current=null,H.current=null,F.current=-1,M.current=!1);const ye=F.current,ve=i!==ye;if(e&&(e!==re||t!==ae||ve)){Qe("terminal_attach",{sessionId:e,tmuxTarget:t,prevAttached:re,prevTarget:ae,connectionStatus:n,connectionEpoch:i,attachedEpoch:ye});const ne=performance.now();se.reset();const ie=performance.now(),he=m.current;he&&he.fit();const oe=performance.now();I.current({type:"terminal-attach",sessionId:e,tmuxTarget:t??void 0,cols:se.cols,rows:se.rows}),B.current=e,H.current=t??null,F.current=i,I.current({type:"tmux-check-copy-mode",sessionId:e}),Qe("switch_attach_sent",{sessionId:e,resetMs:Math.round(ie-ne),fitMs:Math.round(oe-ie),totalMs:Math.round(performance.now()-ne),from:re??null}),$.current=ne,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{se.scrollToBottom(),te(),se.focus()},300)}e&&e===re&&t===ae&&!ve&&Qe("terminal_attach_skip",{sessionId:e,prevAttached:re,connectionStatus:n,connectionEpoch:i,attachedEpoch:ye}),!e&&re&&(B.current=null,H.current=null,F.current=-1)},[e,t,r,n,i,te]),k.useEffect(()=>{const se=()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null),U.current!==null&&(window.clearTimeout(U.current),U.current=null);const ye=h.current,ve=N.current;if(!ye||!ve)return;N.current="";const ne=performance.now(),ie=ve.length;ye.write(ve,()=>{const he=Math.round(performance.now()-ne);he>50&&Qe("switch_write_slow",{sessionId:B.current,writeMs:he,bytes:ie}),te()})},re=()=>{j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(se,V),U.current===null&&(U.current=window.setTimeout(se,ee))},ae=l(ye=>{const ve=B.current;if(ye.type==="terminal-output"&&ve&&ye.sessionId===ve){const ne=$.current;ne&&(Qe("switch_first_output",{sessionId:ye.sessionId,serverRoundtripMs:Math.round(performance.now()-ne),bytes:ye.data.length}),$.current=null),N.current+=y?LD(ye.data):ye.data,re()}if(ye.type==="terminal-ready"&&ve&&ye.sessionId===ve){const ne=$.current;ne&&(Qe("switch_ready",{sessionId:ye.sessionId,totalMs:Math.round(performance.now()-ne)}),$.current=null),y&&(se(),W(50))}ye.type==="tmux-copy-mode-status"&&ve&&ye.sessionId===ve&&J(ye.inCopyMode)});return()=>{ae(),se(),K()}},[l,te,J]),k.useEffect(()=>{const se=v.current,re=h.current,ae=m.current;if(!se||!re||!ae)return;const ye=()=>{S.current&&window.clearTimeout(S.current),S.current=window.setTimeout(()=>{ue()},150)},ve=new ResizeObserver(ye);return ve.observe(se),ye(),()=>{ve.disconnect(),S.current&&window.clearTimeout(S.current)}},[]),k.useEffect(()=>{if(!y)return;const se=()=>{document.visibilityState!=="hidden"&&W(200)},re=ye=>{ye.persisted&&W(200)},ae=()=>{W(200)};return document.addEventListener("visibilitychange",se),window.addEventListener("pageshow",re),window.addEventListener("focus",ae),()=>{document.removeEventListener("visibilitychange",se),window.removeEventListener("pageshow",re),window.removeEventListener("focus",ae),K()}},[]),{containerRef:v,terminalRef:h,searchAddonRef:b,serializeAddonRef:x,progressAddonRef:C,inTmuxCopyModeRef:M,setTmuxCopyMode:J}}function RD(e="(max-width: 767px)"){const[t,r]=k.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return k.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(e),i=()=>r(n.matches);return i(),typeof n.addEventListener=="function"?(n.addEventListener("change",i),()=>n.removeEventListener("change",i)):(n.addListener(i),()=>n.removeListener(i))},[e]),t}function DD(e,t,r){k.useEffect(()=>{if(!t)return;const n=i=>{e.current&&!e.current.contains(i.target)&&r()};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}},[e,t,r])}function MD(e,t){k.useEffect(()=>{if(!e)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),t())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t])}function AD({enabled:e,isOpen:t,onOpen:r,edgeThresholdPx:n=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){const l=k.useRef(!1);return k.useEffect(()=>{if(!e)return;let s=0,o=0,c=!1;const p=f=>{if(t)return;const _=f.touches[0];_.clientX<=n?(s=_.clientX,o=_.clientY,c=!0,l.current=!0):c=!1},u=f=>{if(l.current=!1,!c||t)return;const _=f.changedTouches[0],y=_.clientX-s,v=Math.abs(_.clientY-o);y>=i&&y>v*a&&r(),c=!1};return document.addEventListener("touchstart",p,{passive:!0}),document.addEventListener("touchend",u,{passive:!0}),()=>{l.current=!1,document.removeEventListener("touchstart",p),document.removeEventListener("touchend",u)}},[e,t,r,n,i,a]),l}const Gl=uf()(hf(e=>({theme:"dark",setTheme:t=>e({theme:t}),toggleTheme:()=>e(t=>({theme:t.theme==="dark"?"light":"dark"}))}),{name:"agentboard-theme",storage:mc(()=>df)})),PD={dark:{background:"#2d2d2d",foreground:"#d4d4d4",cursor:"#3b82f6",cursorAccent:"#2d2d2d",selectionBackground:"rgba(59, 130, 246, 0.35)",selectionForeground:"#ffffff",black:"#808080",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#d4d4d4",brightBlack:"#a0a0a0",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde047",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"},light:{background:"#fafafa",foreground:"#171717",cursor:"#2563eb",cursorAccent:"#fafafa",selectionBackground:"rgba(37, 99, 235, 0.2)",selectionForeground:"#000000",black:"#171717",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f5f5f5",brightBlack:"#737373",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#a855f7",brightCyan:"#06b6d4",brightWhite:"#ffffff"}},ID={up:"\x1B[A",down:"\x1B[B",left:"\x1B[D",right:"\x1B[C"},BD=150,OD=250,ND=400,Sv=1500,jD=15,Qi=70;function wu(e=10){"vibrate"in navigator&&navigator.vibrate(e)}function FD(e,t){const r=Math.sqrt(e*e+t*t);if(r<jD)return{direction:null,distance:0};const n=Math.atan2(t,e)*(180/Math.PI);let i;return n>=-45&&n<45?i="right":n>=45&&n<135?i="down":n>=-135&&n<-45?i="up":i="left",{direction:i,distance:r}}function $D(e){const t=Qi-20,r=Math.min(e/t,1);return Sv-r*(Sv-ND)}function HD({onSendKey:e,disabled:t=!1,onRefocus:r,isKeyboardVisible:n}){const[i,a]=k.useState(!1),[l,s]=k.useState(null),[o,c]=k.useState({x:0,y:0}),[p,u]=k.useState({x:0,y:0}),f=k.useRef(null),_=k.useRef(null),y=k.useRef(null),v=k.useRef(!1),h=k.useRef(null),m=k.useRef(0),d=k.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null),_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),g=k.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),w=k.useCallback(D=>{const B=$D(m.current);y.current=setTimeout(()=>{h.current&&(wu(5),e(D),w(D))},B)},[e]),b=k.useCallback((D,B)=>{if(!D||t)return;const H=ID[D];m.current=B,wu(8),e(H),g(),_.current=setTimeout(()=>{w(H)},OD)},[t,e,g,w]),x=k.useCallback((D,B)=>{const H=D-o.x,F=B-o.y,$=Math.sqrt(H*H+F*F),I=Math.min($,Qi-20),R=$>0?I/$:0;u({x:H*R,y:F*R});const{direction:P,distance:N}=FD(H,F);m.current=N,P!==h.current&&(h.current=P,s(P),g(),P&&b(P,N))},[o,g,b]),C=k.useCallback(()=>{a(!1),s(null),u({x:0,y:0}),g(),h.current=null,v.current&&(r==null||r())},[g,r]),S=k.useCallback(D=>{if(t)return;D.preventDefault(),D.stopPropagation();const B=D.touches[0];v.current=(n==null?void 0:n())??!1,f.current=setTimeout(()=>{wu(15),c({x:B.clientX,y:B.clientY-80}),u({x:0,y:0}),a(!0)},BD)},[t,n]),E=k.useCallback(D=>{if(D.preventDefault(),D.stopPropagation(),!i)return;const B=D.touches[0];x(B.clientX,B.clientY)},[i,x]),L=k.useCallback(D=>{D.preventDefault(),D.stopPropagation(),f.current&&(clearTimeout(f.current),f.current=null),i&&C()},[i,C]),A=k.useCallback(D=>{D.preventDefault(),d(),C()},[d,C]);k.useEffect(()=>()=>{d()},[d]);const M=[{dir:"up",angle:-90,label:"↑"},{dir:"right",angle:0,label:"→"},{dir:"down",angle:90,label:"↓"},{dir:"left",angle:180,label:"←"}];return T.jsxs(T.Fragment,{children:[T.jsx("button",{type:"button","aria-label":"Arrow keys",className:`
|
|
188
188
|
terminal-key
|
|
189
189
|
flex items-center justify-center
|
|
190
190
|
h-11 min-w-[2.75rem] px-2.5
|
|
@@ -291,13 +291,13 @@ void main() {
|
|
|
291
291
|
select-none touch-manipulation
|
|
292
292
|
text-secondary
|
|
293
293
|
${t?"opacity-50":""}
|
|
294
|
-
`,onMouseDown:F=>F.preventDefault(),onTouchStart:B(M),onClick:H(M),disabled:t,children:qD})]}),c&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{ref:d,className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-1 text-balance",children:"Paste"}),T.jsx("p",{className:"text-xs text-muted mb-3 text-pretty",children:"Text or image (long-press → Paste)"}),_?T.jsx("div",{className:"w-full h-11 flex items-center justify-center bg-surface border border-border rounded-md text-secondary",children:"Uploading image..."}):T.jsx("input",{ref:m,type:"text",value:u,onChange:F=>f(F.target.value),onKeyDown:F=>{F.key==="Enter"?(F.preventDefault(),E()):F.key==="Escape"&&(F.preventDefault(),L())},placeholder:"Paste here...",className:"w-full h-11 px-3 text-[16px] bg-surface border border-border rounded-md text-primary placeholder:text-muted outline-none focus:border-accent",style:{fontSize:"16px"}}),T.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[T.jsx("button",{type:"button",onClick:L,className:"px-4 py-2 text-sm font-medium text-secondary bg-surface border border-border rounded-md active:scale-95 transition-transform",children:"Cancel"}),T.jsx("button",{type:"button",onClick:E,disabled:_,className:"px-4 py-2 text-sm font-medium bg-accent text-white rounded-md active:scale-95 transition-transform disabled:opacity-50",children:"Send"})]})]})})]})}function ZD({isOpen:e,onClose:t,sessions:r,inactiveSessions:n=[],selectedSessionId:i,onSelect:a,onRename:l,onResume:s,onSetPinned:o,onNewSession:c,loading:p,error:u}){const f=$1(),_=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{if(!e)return;const m=d=>{d.key==="Escape"&&(d.preventDefault(),t())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),k.useEffect(()=>{var m;e?(y.current=document.activeElement,(m=_.current)==null||m.focus()):y.current&&(y.current.focus(),y.current=null)},[e]),k.useEffect(()=>{if(!e)return;const m=_.current;if(!m)return;const d=50,g=1.5;let w=0,b=0;const x=S=>{const E=S.touches[0];w=E.clientX,b=E.clientY},C=S=>{const E=S.changedTouches[0],L=w-E.clientX,A=Math.abs(E.clientY-b);L>=d&&L>A*g&&("vibrate"in navigator&&navigator.vibrate(10),t())};return m.addEventListener("touchstart",x,{passive:!0}),m.addEventListener("touchend",C,{passive:!0}),()=>{m.removeEventListener("touchstart",x),m.removeEventListener("touchend",C)}},[e,t]);const v=m=>{a(m),t()},h=f?{transition:"none"}:void 0;return T.jsxs(T.Fragment,{children:[T.jsx("div",{className:`session-drawer-backdrop ${e?"open":""}`,style:h,onClick:t,"aria-hidden":"true"}),T.jsxs("div",{ref:_,className:`session-drawer ${e?"open":""}`,style:h,role:"dialog","aria-modal":"true","aria-label":"Session list",tabIndex:-1,children:[T.jsx(hw,{sessions:r,inactiveSessions:n,selectedSessionId:i,onSelect:v,onRename:l,onResume:s,onSetPinned:o,loading:p,error:u}),T.jsx("div",{className:"shrink-0 border-t border-border px-2 pt-2",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom, 0.5rem))"},children:T.jsx("button",{onClick:()=>{c(),t()},className:"btn btn-primary w-full py-2 text-sm",children:"New Session"})})]})]})}const eM={working:"Working",waiting:"Waiting",permission:"Needs Input",unknown:"Unknown"},tM={working:"text-working",waiting:"text-waiting",permission:"text-approval",unknown:"text-muted"},rM={working:"bg-green-500/35 text-white",waiting:"bg-blue-500/35 text-white",permission:"bg-amber-500/35 text-white",unknown:"bg-gray-500/35 text-white"},nM={working:"bg-working text-white",waiting:"bg-waiting text-white",permission:"bg-approval text-white",unknown:"bg-muted text-white"};function xv(){"vibrate"in navigator&&navigator.vibrate(10)}function sM({session:e,sessions:t,inactiveSessions:r=[],connectionStatus:n,connectionEpoch:i=0,sendMessage:a,subscribe:l,onClose:s,onSelectSession:o,onNewSession:c,onKillSession:p,onRenameSession:u,onResumeSession:f,onSetPinned:_,onOpenSettings:y,loading:v=!1,error:h=null}){const m=Gl(Z=>Z.theme),d=PD[m],g=pe(Z=>Z.useWebGL),w=pe(Z=>Z.fontSize),b=pe(Z=>Z.lineHeight),x=pe(Z=>Z.letterSpacing),C=pe(Z=>Z.fontOption),S=pe(Z=>Z.customFontFamily),E=iC(C,S),L=pe(Z=>Z.shortcutModifier),A=ii(Zo(L)),M=Qo(),D=RD(),[B,H]=k.useState(!1),[F,$]=k.useState(!1),[I,R]=k.useState(!1),[P,N]=k.useState(!1),[j,U]=k.useState(!1),[V,ee]=k.useState(!1),[Q,z]=k.useState(""),O=k.useRef(!1),K=k.useRef(null),W=k.useRef(null),te=k.useRef(null),Y=k.useRef(null),_e=(e==null?void 0:e.remote)===!0,ue=Ge(Z=>Z.remoteAllowControl),se=Ge(Z=>Z.remoteAllowAttach),re=_e&&!se,ae=!_e||ue&&(e==null?void 0:e.source)==="managed",{containerRef:ye,terminalRef:ve,inTmuxCopyModeRef:ne,setTmuxCopyMode:ie}=TD({sessionId:(e==null?void 0:e.id)??null,tmuxTarget:(e==null?void 0:e.tmuxWindow)??null,allowAttach:!re,connectionStatus:n,connectionEpoch:i,sendMessage:a,subscribe:l,theme:d,fontSize:w,lineHeight:b,letterSpacing:x,fontFamily:E,useWebGL:g,onScrollChange:Z=>{H(!Z)}}),he=k.useCallback(()=>{var Z;!e||re||(a({type:"tmux-cancel-copy-mode",sessionId:e.id}),ie(!1),(Z=ve.current)==null||Z.scrollToBottom())},[e,re,a,ie,ve]),oe=k.useCallback(()=>{U(!0),xv()},[]),me=AD({enabled:D||M,isOpen:j,onOpen:oe});k.useEffect(()=>{!D&&!M&&j&&U(!1)},[j,D,M]);const xe=k.useCallback(()=>N(!1),[]);DD(W,P,xe),k.useEffect(()=>{V&&te.current&&(te.current.focus(),te.current.select())},[V]),k.useEffect(()=>{I&&Y.current&&Y.current.focus()},[I]);const ke=k.useCallback(()=>R(!1),[]);MD(I,ke);const Ne=()=>{e&&(p(e.id),R(!1))},Ke=()=>{e&&(z(e.agentSessionName||e.name),ee(!0),N(!1))},Ae=()=>{if(!e)return;const Z=Q.trim(),Le=e.agentSessionName||e.name;Z&&Z!==Le&&u(e.id,Z),ee(!1)},Pe=Z=>{Z.key==="Enter"?(Z.preventDefault(),Ae()):Z.key==="Escape"&&(Z.preventDefault(),ee(!1))};k.useEffect(()=>{if(!M||!e){$(!1);return}const Z=ye.current;if(!Z)return;const Le=Te=>{const De=Z.querySelector(".xterm-accessibility-tree");if(!De)return!1;const ze=Te.anchorNode,Xe=Te.focusNode;return!!ze&&De.contains(ze)||!!Xe&&De.contains(Xe)},de=()=>{const Te=Z.querySelector(".xterm-accessibility"),De=Z.querySelector(".xterm-accessibility-tree");!Te||!De||(Te.style.setProperty("opacity","0"),De.style.setProperty("opacity","0"),Te.style.setProperty("-webkit-user-select","none"),Te.style.setProperty("user-select","none"),De.style.setProperty("-webkit-user-select","none"),De.style.setProperty("user-select","none"),Te.offsetHeight,requestAnimationFrame(()=>{Te.style.removeProperty("opacity"),De.style.removeProperty("opacity"),Te.style.removeProperty("-webkit-user-select"),Te.style.removeProperty("user-select"),De.style.removeProperty("-webkit-user-select"),De.style.removeProperty("user-select")}))},fe=()=>{var De;O.current=!1;const Te=window.getSelection();try{Te==null||Te.removeAllRanges()}catch{}(De=ve.current)==null||De.clearSelection(),de(),$(!1)};K.current=fe;const Ee=()=>{const Te=window.getSelection();if(!Te||Te.rangeCount===0||Te.isCollapsed){O.current?fe():$(Xe=>Xe&&!1);return}const De=Le(Te);if(!De&&O.current){fe();return}O.current=De;const ze=De;$(Xe=>Xe!==ze?ze:Xe)},Re=()=>{const Te=window.getSelection();!Te||Te.isCollapsed||Le(Te)&&setTimeout(fe,0)},je=10;let Me=null,Ie=!1;const Ve=Te=>{if(Te.touches.length===1){const De=Te.touches[0];Me={x:De.clientX,y:De.clientY},Ie=!1}},ot=Te=>{if(Ie||!Me||Te.touches.length!==1)return;const De=Te.touches[0],ze=Math.abs(De.clientX-Me.x),Xe=Math.abs(De.clientY-Me.y);(ze>je||Xe>je)&&(Ie=!0)},He=Te=>{const De=Ie;Me=null,Ie=!1;const ze=window.getSelection();if(!ze||ze.rangeCount===0||ze.isCollapsed){$(!1);return}const Xe=Z.querySelector(".xterm-accessibility-tree");if(!Xe)return;if(!Le(ze)){$(!1);return}if(De)return;const Ht=Te.target,_t=Ht?Xe.contains(Ht):!1;let zt=!1;if(_t&&Ht)try{zt=ze.containsNode(Ht,!0)}catch{zt=!1}(!_t||!zt)&&setTimeout(fe,0)};return document.addEventListener("selectionchange",Ee),document.addEventListener("copy",Re),document.addEventListener("touchstart",Ve,{passive:!0}),document.addEventListener("touchmove",ot,{passive:!0}),document.addEventListener("touchend",He,{passive:!0}),()=>{document.removeEventListener("selectionchange",Ee),document.removeEventListener("copy",Re),document.removeEventListener("touchstart",Ve),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",He),K.current=null,O.current=!1}},[ye,M,e==null?void 0:e.id]),k.useEffect(()=>{var Me;if(!M)return;const Z=ye.current;if(!Z)return;const Le=()=>{const Ie=ve.current,Ve=Z.querySelector(".xterm");if(!Ie||!Ve)return;const ot=Ve.querySelector(".xterm-screen"),He=Ve.querySelector(".xterm-accessibility"),Te=Ve.querySelector(".xterm-accessibility-tree");if(!ot||!He||!Te)return;const De=Ve.getBoundingClientRect(),ze=ot.getBoundingClientRect(),Xe=ze.left-De.left,Ht=ze.top-De.top;Object.assign(He.style,{left:`${Xe}px`,top:`${Ht}px`,right:"auto",bottom:"auto",width:`${ze.width}px`,height:`${ze.height}px`});const _t=ze.width/Ie.cols,zt=ze.height/Ie.rows,It=document.createElement("span");It.textContent="0".repeat(200),It.style.cssText="position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px",Te.appendChild(It);const wn=It.getBoundingClientRect().width/200;It.remove();const Ts=Math.max(-2,Math.min(2,_t-wn));Z.style.setProperty("--xterm-font-size",`${Ie.options.fontSize}px`),Z.style.setProperty("--xterm-cell-height",`${zt}px`),Z.style.setProperty("--xterm-a11y-letter-spacing",`${Ts}px`)},de=performance.now();Le();const fe=Math.round(performance.now()-de);fe>10&&Qe("switch_a11y_overlay",{sessionId:e==null?void 0:e.id,a11yMs:fe});const Ee=window.requestAnimationFrame(Le),Re=window.setTimeout(Le,100),je=()=>window.requestAnimationFrame(Le);return(Me=window.visualViewport)==null||Me.addEventListener("resize",je),window.addEventListener("orientationchange",je),()=>{var Ie;window.cancelAnimationFrame(Ee),window.clearTimeout(Re),(Ie=window.visualViewport)==null||Ie.removeEventListener("resize",je),window.removeEventListener("orientationchange",je)}},[ye,w,M,e==null?void 0:e.id,ve]);const G=k.useRef(F);k.useEffect(()=>{G.current=F},[F]);const J=k.useRef(e==null?void 0:e.id);k.useEffect(()=>{J.current=e==null?void 0:e.id},[e==null?void 0:e.id]);const Oe=k.useRef(a);k.useEffect(()=>{Oe.current=a},[a]);const $e=k.useRef(!1);k.useEffect(()=>{const Z=ye.current;if(!Z||!(e!=null&&e.id)||!D&&!M)return;const Le=6,de=350;let fe={x:0,y:0},Ee=0,Re=!1,je=null,Me=0,Ie=0,Ve=0,ot=Math.round(w*b),He=null;const Te=()=>{const Et=window.getComputedStyle(Z).getPropertyValue("--xterm-cell-height").trim(),kt=Number.parseFloat(Et);return!Number.isNaN(kt)&&kt>0?kt:Math.round(w*b)},De=()=>Z.querySelector(".xterm-helper-textarea"),ze=()=>{const Be=De();Be&&document.activeElement!==Be&&(Be.disabled=!0)},Xe=()=>{const Be=De();Be&&(Be.disabled=!1)};ze();const Ht=()=>{if(ne.current)return;const Be=De();Be&&(Be.disabled=!1,Be.focus())},_t=()=>{He!==null&&(cancelAnimationFrame(He),He=null),Ie=0},zt=Be=>{const Et=J.current;if(!Et||Be===0)return!1;const kt=ve.current,Zr=(kt==null?void 0:kt.cols)??80,Ds=(kt==null?void 0:kt.rows)??24,Ms=Math.floor(Zr/2),Jn=Math.floor(Ds/2),Qn=Be>0?65:64,Zn=Math.abs(Be),Sn=Be<0;for(let en=0;en<Zn;en++)Oe.current({type:"terminal-input",sessionId:Et,data:`\x1B[<${Qn};${Ms};${Jn}M`});return Sn&&ie(!0),Sn},It=()=>{je=null,Ie=0,Ve=0},wn=()=>{if(!M)return!1;const Be=window.getSelection();if(!Be||Be.isCollapsed)return!1;const Et=Z.querySelector(".xterm-accessibility-tree");if(!Et)return!1;const kt=Be.anchorNode,Zr=Be.focusNode;return!!kt&&Et.contains(kt)||!!Zr&&Et.contains(Zr)},Ts=()=>{var Be;!M||!O.current||wn()||(Be=K.current)==null||Be.call(K)},la=Be=>{if(_t(),Ts(),me.current||j){It();return}if(G.current){It();return}if(Be.touches.length===1){const Et=Be.touches[0];fe={x:Et.clientX,y:Et.clientY},Ee=performance.now(),Re=!1,je=Et.clientY,Me=Ee,Ie=0,Ve=0,ot=Te(),Xe()}},q=Be=>{if(Be.touches.length!==1||je===null)return;if(Ts(),me.current||j){It();return}if(G.current||wn()){It();return}Be.preventDefault(),Be.stopPropagation();const Et=performance.now(),kt=Be.touches[0],Zr=kt.clientX,Ds=kt.clientY,Ms=Math.abs(Zr-fe.x),Jn=Math.abs(Ds-fe.y);!Re&&(Ms>Le||Jn>Le)&&(Re=!0,ze());const Qn=je-Ds,Zn=Et-Me;if(je=Ds,Me=Et,Zn>0){const Ec=Qn/Zn;Ie=Ie*.7+Ec*.3}Ve+=Qn;const Sn=Math.max(6,ot*.6),en=Math.trunc(Ve/Sn);en!==0&&(zt(en),Ve-=en*Sn)},et=Be=>{var Ms;const Et=Ie,kt=performance.now()-Ee;if(It(),me.current||j)return;const Zr=wn();if(G.current&&!Zr&&((Ms=K.current)==null||Ms.call(K)),G.current||Zr){ne.current&&($e.current=!0);return}if(!Re){if(M&&kt>=de)return;if(ne.current){Be.preventDefault(),Be.stopPropagation(),$e.current=!0;return}Ht();return}if(Math.abs(Et)>.12){let Jn=Et,Qn=performance.now();const Zn=()=>{const Sn=performance.now(),en=Sn-Qn;Qn=Sn;const Ec=Jn*en;Ve+=Ec;const Cp=Math.max(6,ot*.6),kc=Math.trunc(Ve/Cp);kc!==0&&(zt(kc),Ve-=kc*Cp),Jn*=Math.pow(.95,en/16.67),Math.abs(Jn)>.02?He=requestAnimationFrame(Zn):He=null};He=requestAnimationFrame(Zn)}},Jr=Be=>{$e.current&&(Be.preventDefault(),Be.stopPropagation(),$e.current=!1)},Qr={passive:!0,capture:!0},Rs={passive:!1,capture:!0},xp={passive:!1,capture:!0},bp={capture:!0};return Z.addEventListener("touchstart",la,Qr),Z.addEventListener("touchmove",q,Rs),Z.addEventListener("touchend",et,xp),Z.addEventListener("mousedown",Jr,bp),()=>{Z.removeEventListener("touchstart",la,Qr),Z.removeEventListener("touchmove",q,Rs),Z.removeEventListener("touchend",et,xp),Z.removeEventListener("mousedown",Jr,bp);const Be=De();Be&&(Be.disabled=!1)}},[e==null?void 0:e.id,ye,ve,M,D,j,w,b]);const X=k.useCallback(Z=>{!e||re||a({type:"terminal-input",sessionId:e.id,data:Z})},[e,re,a]),le=k.useCallback(()=>{const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-helper-textarea");Le&&(Le.removeAttribute("disabled"),Le.focus())},[ye]),ge=k.useCallback(()=>{if(!e||re)return;ne.current&&(a({type:"tmux-cancel-copy-mode",sessionId:e.id}),ie(!1));const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-helper-textarea");Le&&(Le.removeAttribute("disabled"),Le.focus())},[e,re,a,ye,ne,ie]),We=k.useCallback(()=>{var Re,je;if(typeof document>"u")return!1;const Z=ye.current;if(!Z)return!1;const Le=Z.querySelector(".xterm-helper-textarea");if(Le&&document.activeElement===Le)return!0;const de=document.activeElement,fe=typeof HTMLInputElement<"u"&&de instanceof HTMLInputElement,Ee=typeof HTMLTextAreaElement<"u"&&de instanceof HTMLTextAreaElement;return fe||Ee||de&&de.isContentEditable?!1:!!((je=(Re=document.documentElement)==null?void 0:Re.classList)!=null&&je.contains("keyboard-visible"))},[ye]);return k.useEffect(()=>{if(!M)return;const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-accessibility"),de=Z.querySelector(".xterm-accessibility-tree");if(!Le||!de)return;const fe=()=>{const Ee=Z.querySelector(".xterm-helper-textarea");(Ee?document.activeElement===Ee:!1)&&!G.current?(Le.style.pointerEvents="none",de.style.pointerEvents="none"):(Le.style.removeProperty("pointer-events"),de.style.removeProperty("pointer-events"))};return fe(),document.addEventListener("focusin",fe),document.addEventListener("focusout",fe),()=>{document.removeEventListener("focusin",fe),document.removeEventListener("focusout",fe)}},[ye,M,F]),T.jsxs("section",{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${M?"ios-native-term-selection":""}`,"data-testid":"terminal-panel",children:[T.jsxs("div",{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3 ${e?"":"md:hidden"}`,children:[T.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[T.jsx("button",{onClick:()=>U(!0),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all md:hidden shrink-0","aria-label":"Open session menu",children:T.jsx(EC,{width:16,height:16})}),e&&ae&&T.jsx("button",{onClick:()=>R(!0),className:"hidden md:flex h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all shrink-0",title:`Kill session (${A}X)`,"aria-label":"Kill session",children:T.jsx(Th,{width:16,height:16})}),e?T.jsxs("div",{className:"flex items-baseline gap-3 min-w-0",children:[V?T.jsx("input",{ref:te,type:"text",value:Q,onChange:Z=>z(Z.target.value),onBlur:Ae,onKeyDown:Pe,className:"w-full max-w-[200px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"text-sm font-medium text-primary truncate",children:e.agentSessionName||e.name}),T.jsx("span",{className:`text-xs shrink-0 ${tM[e.status]}`,children:eM[e.status]})]}):T.jsx("span",{className:"text-sm font-medium text-primary md:hidden",children:"Sessions"})]}),T.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n!=="connected"&&T.jsx("span",{className:"text-xs text-approval",children:n}),T.jsx("button",{onClick:c,className:"flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all md:hidden",title:`New session (${A}N)`,"aria-label":"New session",children:T.jsx(iy,{width:16,height:16})}),e&&ae&&T.jsx("button",{onClick:()=>R(!0),className:"flex md:hidden h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all",title:`Kill session (${A}X)`,"aria-label":"Kill session",children:T.jsx(Th,{width:16,height:16})}),e&&T.jsxs("div",{className:"relative md:hidden",ref:W,children:[T.jsx("button",{onClick:()=>N(!P),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all",title:"More options","aria-label":"More options",children:T.jsx(vC,{width:16,height:16})}),P&&T.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1",children:[ae&&T.jsxs("button",{onClick:Ke,className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(ny,{width:14,height:14}),"Rename"]}),T.jsxs("button",{onClick:()=>{y(),N(!1)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(MC,{width:14,height:14}),"Settings"]})]})]})]})]}),e&&t.length>1&&T.jsxs("div",{className:"relative overflow-hidden bg-elevated border-b border-border md:hidden",children:[T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 pl-5 pr-3 py-1.5 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:t.map((Z,Le)=>{const de=Z.id===e.id;return T.jsx("button",{type:"button",className:`
|
|
294
|
+
`,onMouseDown:F=>F.preventDefault(),onTouchStart:B(M),onClick:H(M),disabled:t,children:qD})]}),c&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{ref:d,className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-1 text-balance",children:"Paste"}),T.jsx("p",{className:"text-xs text-muted mb-3 text-pretty",children:"Text or image (long-press → Paste)"}),_?T.jsx("div",{className:"w-full h-11 flex items-center justify-center bg-surface border border-border rounded-md text-secondary",children:"Uploading image..."}):T.jsx("input",{ref:m,type:"text",value:u,onChange:F=>f(F.target.value),onKeyDown:F=>{F.key==="Enter"?(F.preventDefault(),E()):F.key==="Escape"&&(F.preventDefault(),L())},placeholder:"Paste here...",className:"w-full h-11 px-3 text-[16px] bg-surface border border-border rounded-md text-primary placeholder:text-muted outline-none focus:border-accent",style:{fontSize:"16px"}}),T.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[T.jsx("button",{type:"button",onClick:L,className:"px-4 py-2 text-sm font-medium text-secondary bg-surface border border-border rounded-md active:scale-95 transition-transform",children:"Cancel"}),T.jsx("button",{type:"button",onClick:E,disabled:_,className:"px-4 py-2 text-sm font-medium bg-accent text-white rounded-md active:scale-95 transition-transform disabled:opacity-50",children:"Send"})]})]})})]})}function ZD({isOpen:e,onClose:t,sessions:r,inactiveSessions:n=[],selectedSessionId:i,onSelect:a,onRename:l,onResume:s,onSetPinned:o,onNewSession:c,loading:p,error:u}){const f=$1(),_=k.useRef(null),y=k.useRef(null);k.useEffect(()=>{if(!e)return;const m=d=>{d.key==="Escape"&&(d.preventDefault(),t())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),k.useEffect(()=>{var m;e?(y.current=document.activeElement,(m=_.current)==null||m.focus()):y.current&&(y.current.focus(),y.current=null)},[e]),k.useEffect(()=>{if(!e)return;const m=_.current;if(!m)return;const d=50,g=1.5;let w=0,b=0;const x=S=>{const E=S.touches[0];w=E.clientX,b=E.clientY},C=S=>{const E=S.changedTouches[0],L=w-E.clientX,A=Math.abs(E.clientY-b);L>=d&&L>A*g&&("vibrate"in navigator&&navigator.vibrate(10),t())};return m.addEventListener("touchstart",x,{passive:!0}),m.addEventListener("touchend",C,{passive:!0}),()=>{m.removeEventListener("touchstart",x),m.removeEventListener("touchend",C)}},[e,t]);const v=m=>{a(m),t()},h=f?{transition:"none"}:void 0;return T.jsxs(T.Fragment,{children:[T.jsx("div",{className:`session-drawer-backdrop ${e?"open":""}`,style:h,onClick:t,"aria-hidden":"true"}),T.jsxs("div",{ref:_,className:`session-drawer ${e?"open":""}`,style:h,role:"dialog","aria-modal":"true","aria-label":"Session list",tabIndex:-1,children:[T.jsx(hw,{sessions:r,inactiveSessions:n,selectedSessionId:i,onSelect:v,onRename:l,onResume:s,onSetPinned:o,loading:p,error:u}),T.jsx("div",{className:"shrink-0 border-t border-border px-2 pt-2",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom, 0.5rem))"},children:T.jsx("button",{onClick:()=>{c(),t()},className:"btn btn-primary w-full py-2 text-sm",children:"New Session"})})]})]})}const eM={working:"Working",waiting:"Waiting",permission:"Needs Input",unknown:"Unknown"},tM={working:"text-working",waiting:"text-waiting",permission:"text-approval",unknown:"text-muted"},rM={working:"bg-green-500/35 text-white",waiting:"bg-blue-500/35 text-white",permission:"bg-amber-500/35 text-white",unknown:"bg-gray-500/35 text-white"},nM={working:"bg-working text-white",waiting:"bg-waiting text-white",permission:"bg-approval text-white",unknown:"bg-muted text-white"};function xv(){"vibrate"in navigator&&navigator.vibrate(10)}function sM({session:e,sessions:t,inactiveSessions:r=[],connectionStatus:n,connectionEpoch:i=0,sendMessage:a,subscribe:l,onClose:s,onSelectSession:o,onNewSession:c,onKillSession:p,onRenameSession:u,onResumeSession:f,onSetPinned:_,onOpenSettings:y,loading:v=!1,error:h=null}){const m=Gl(Z=>Z.theme),d=PD[m],g=pe(Z=>Z.useWebGL),w=pe(Z=>Z.fontSize),b=pe(Z=>Z.lineHeight),x=pe(Z=>Z.letterSpacing),C=pe(Z=>Z.fontOption),S=pe(Z=>Z.customFontFamily),E=iC(C,S),L=pe(Z=>Z.shortcutModifier),A=ii(Zo(L)),M=Qo(),D=RD(),[B,H]=k.useState(!1),[F,$]=k.useState(!1),[I,R]=k.useState(!1),[P,N]=k.useState(!1),[j,U]=k.useState(!1),[V,ee]=k.useState(!1),[Q,z]=k.useState(""),O=k.useRef(!1),K=k.useRef(null),W=k.useRef(null),te=k.useRef(null),J=k.useRef(null),_e=(e==null?void 0:e.remote)===!0,ue=Ge(Z=>Z.remoteAllowControl),se=Ge(Z=>Z.remoteAllowAttach),re=_e&&!se,ae=!_e||ue&&(e==null?void 0:e.source)==="managed",{containerRef:ye,terminalRef:ve,inTmuxCopyModeRef:ne,setTmuxCopyMode:ie}=TD({sessionId:(e==null?void 0:e.id)??null,tmuxTarget:(e==null?void 0:e.tmuxWindow)??null,allowAttach:!re,connectionStatus:n,connectionEpoch:i,sendMessage:a,subscribe:l,theme:d,fontSize:w,lineHeight:b,letterSpacing:x,fontFamily:E,useWebGL:g,onScrollChange:Z=>{H(!Z)}}),he=k.useCallback(()=>{var Z;!e||re||(a({type:"tmux-cancel-copy-mode",sessionId:e.id}),ie(!1),(Z=ve.current)==null||Z.scrollToBottom())},[e,re,a,ie,ve]),oe=k.useCallback(()=>{U(!0),xv()},[]),me=AD({enabled:D||M,isOpen:j,onOpen:oe});k.useEffect(()=>{!D&&!M&&j&&U(!1)},[j,D,M]);const xe=k.useCallback(()=>N(!1),[]);DD(W,P,xe),k.useEffect(()=>{V&&te.current&&(te.current.focus(),te.current.select())},[V]),k.useEffect(()=>{I&&J.current&&J.current.focus()},[I]);const ke=k.useCallback(()=>R(!1),[]);MD(I,ke);const Ne=()=>{e&&(p(e.id),R(!1))},Ke=()=>{e&&(z(e.agentSessionName||e.name),ee(!0),N(!1))},Ae=()=>{if(!e)return;const Z=Q.trim(),Le=e.agentSessionName||e.name;Z&&Z!==Le&&u(e.id,Z),ee(!1)},Pe=Z=>{Z.key==="Enter"?(Z.preventDefault(),Ae()):Z.key==="Escape"&&(Z.preventDefault(),ee(!1))};k.useEffect(()=>{if(!M||!e){$(!1);return}const Z=ye.current;if(!Z)return;const Le=Te=>{const De=Z.querySelector(".xterm-accessibility-tree");if(!De)return!1;const ze=Te.anchorNode,Xe=Te.focusNode;return!!ze&&De.contains(ze)||!!Xe&&De.contains(Xe)},de=()=>{const Te=Z.querySelector(".xterm-accessibility"),De=Z.querySelector(".xterm-accessibility-tree");!Te||!De||(Te.style.setProperty("opacity","0"),De.style.setProperty("opacity","0"),Te.style.setProperty("-webkit-user-select","none"),Te.style.setProperty("user-select","none"),De.style.setProperty("-webkit-user-select","none"),De.style.setProperty("user-select","none"),Te.offsetHeight,requestAnimationFrame(()=>{Te.style.removeProperty("opacity"),De.style.removeProperty("opacity"),Te.style.removeProperty("-webkit-user-select"),Te.style.removeProperty("user-select"),De.style.removeProperty("-webkit-user-select"),De.style.removeProperty("user-select")}))},fe=()=>{var De;O.current=!1;const Te=window.getSelection();try{Te==null||Te.removeAllRanges()}catch{}(De=ve.current)==null||De.clearSelection(),de(),$(!1)};K.current=fe;const Ee=()=>{const Te=window.getSelection();if(!Te||Te.rangeCount===0||Te.isCollapsed){O.current?fe():$(Xe=>Xe&&!1);return}const De=Le(Te);if(!De&&O.current){fe();return}O.current=De;const ze=De;$(Xe=>Xe!==ze?ze:Xe)},Re=()=>{const Te=window.getSelection();!Te||Te.isCollapsed||Le(Te)&&setTimeout(fe,0)},je=10;let Me=null,Ie=!1;const Ve=Te=>{if(Te.touches.length===1){const De=Te.touches[0];Me={x:De.clientX,y:De.clientY},Ie=!1}},ot=Te=>{if(Ie||!Me||Te.touches.length!==1)return;const De=Te.touches[0],ze=Math.abs(De.clientX-Me.x),Xe=Math.abs(De.clientY-Me.y);(ze>je||Xe>je)&&(Ie=!0)},He=Te=>{const De=Ie;Me=null,Ie=!1;const ze=window.getSelection();if(!ze||ze.rangeCount===0||ze.isCollapsed){$(!1);return}const Xe=Z.querySelector(".xterm-accessibility-tree");if(!Xe)return;if(!Le(ze)){$(!1);return}if(De)return;const Ht=Te.target,_t=Ht?Xe.contains(Ht):!1;let zt=!1;if(_t&&Ht)try{zt=ze.containsNode(Ht,!0)}catch{zt=!1}(!_t||!zt)&&setTimeout(fe,0)};return document.addEventListener("selectionchange",Ee),document.addEventListener("copy",Re),document.addEventListener("touchstart",Ve,{passive:!0}),document.addEventListener("touchmove",ot,{passive:!0}),document.addEventListener("touchend",He,{passive:!0}),()=>{document.removeEventListener("selectionchange",Ee),document.removeEventListener("copy",Re),document.removeEventListener("touchstart",Ve),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",He),K.current=null,O.current=!1}},[ye,M,e==null?void 0:e.id]),k.useEffect(()=>{var Me;if(!M)return;const Z=ye.current;if(!Z)return;const Le=()=>{const Ie=ve.current,Ve=Z.querySelector(".xterm");if(!Ie||!Ve)return;const ot=Ve.querySelector(".xterm-screen"),He=Ve.querySelector(".xterm-accessibility"),Te=Ve.querySelector(".xterm-accessibility-tree");if(!ot||!He||!Te)return;const De=Ve.getBoundingClientRect(),ze=ot.getBoundingClientRect(),Xe=ze.left-De.left,Ht=ze.top-De.top;Object.assign(He.style,{left:`${Xe}px`,top:`${Ht}px`,right:"auto",bottom:"auto",width:`${ze.width}px`,height:`${ze.height}px`});const _t=ze.width/Ie.cols,zt=ze.height/Ie.rows,It=document.createElement("span");It.textContent="0".repeat(200),It.style.cssText="position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px",Te.appendChild(It);const wn=It.getBoundingClientRect().width/200;It.remove();const Ts=Math.max(-2,Math.min(2,_t-wn));Z.style.setProperty("--xterm-font-size",`${Ie.options.fontSize}px`),Z.style.setProperty("--xterm-cell-height",`${zt}px`),Z.style.setProperty("--xterm-a11y-letter-spacing",`${Ts}px`)},de=performance.now();Le();const fe=Math.round(performance.now()-de);fe>10&&Qe("switch_a11y_overlay",{sessionId:e==null?void 0:e.id,a11yMs:fe});const Ee=window.requestAnimationFrame(Le),Re=window.setTimeout(Le,100),je=()=>window.requestAnimationFrame(Le);return(Me=window.visualViewport)==null||Me.addEventListener("resize",je),window.addEventListener("orientationchange",je),()=>{var Ie;window.cancelAnimationFrame(Ee),window.clearTimeout(Re),(Ie=window.visualViewport)==null||Ie.removeEventListener("resize",je),window.removeEventListener("orientationchange",je)}},[ye,w,M,e==null?void 0:e.id,ve]);const G=k.useRef(F);k.useEffect(()=>{G.current=F},[F]);const Y=k.useRef(e==null?void 0:e.id);k.useEffect(()=>{Y.current=e==null?void 0:e.id},[e==null?void 0:e.id]);const Oe=k.useRef(a);k.useEffect(()=>{Oe.current=a},[a]);const $e=k.useRef(!1);k.useEffect(()=>{const Z=ye.current;if(!Z||!(e!=null&&e.id)||!D&&!M)return;const Le=6,de=350;let fe={x:0,y:0},Ee=0,Re=!1,je=null,Me=0,Ie=0,Ve=0,ot=Math.round(w*b),He=null;const Te=()=>{const Et=window.getComputedStyle(Z).getPropertyValue("--xterm-cell-height").trim(),kt=Number.parseFloat(Et);return!Number.isNaN(kt)&&kt>0?kt:Math.round(w*b)},De=()=>Z.querySelector(".xterm-helper-textarea"),ze=()=>{const Be=De();Be&&document.activeElement!==Be&&(Be.disabled=!0)},Xe=()=>{const Be=De();Be&&(Be.disabled=!1)};ze();const Ht=()=>{if(ne.current)return;const Be=De();Be&&(Be.disabled=!1,Be.focus())},_t=()=>{He!==null&&(cancelAnimationFrame(He),He=null),Ie=0},zt=Be=>{const Et=Y.current;if(!Et||Be===0)return!1;const kt=ve.current,Zr=(kt==null?void 0:kt.cols)??80,Ds=(kt==null?void 0:kt.rows)??24,Ms=Math.floor(Zr/2),Jn=Math.floor(Ds/2),Qn=Be>0?65:64,Zn=Math.abs(Be),Sn=Be<0;for(let en=0;en<Zn;en++)Oe.current({type:"terminal-input",sessionId:Et,data:`\x1B[<${Qn};${Ms};${Jn}M`});return Sn&&ie(!0),Sn},It=()=>{je=null,Ie=0,Ve=0},wn=()=>{if(!M)return!1;const Be=window.getSelection();if(!Be||Be.isCollapsed)return!1;const Et=Z.querySelector(".xterm-accessibility-tree");if(!Et)return!1;const kt=Be.anchorNode,Zr=Be.focusNode;return!!kt&&Et.contains(kt)||!!Zr&&Et.contains(Zr)},Ts=()=>{var Be;!M||!O.current||wn()||(Be=K.current)==null||Be.call(K)},la=Be=>{if(_t(),Ts(),me.current||j){It();return}if(G.current){It();return}if(Be.touches.length===1){const Et=Be.touches[0];fe={x:Et.clientX,y:Et.clientY},Ee=performance.now(),Re=!1,je=Et.clientY,Me=Ee,Ie=0,Ve=0,ot=Te(),Xe()}},q=Be=>{if(Be.touches.length!==1||je===null)return;if(Ts(),me.current||j){It();return}if(G.current||wn()){It();return}Be.preventDefault(),Be.stopPropagation();const Et=performance.now(),kt=Be.touches[0],Zr=kt.clientX,Ds=kt.clientY,Ms=Math.abs(Zr-fe.x),Jn=Math.abs(Ds-fe.y);!Re&&(Ms>Le||Jn>Le)&&(Re=!0,ze());const Qn=je-Ds,Zn=Et-Me;if(je=Ds,Me=Et,Zn>0){const Ec=Qn/Zn;Ie=Ie*.7+Ec*.3}Ve+=Qn;const Sn=Math.max(6,ot*.6),en=Math.trunc(Ve/Sn);en!==0&&(zt(en),Ve-=en*Sn)},et=Be=>{var Ms;const Et=Ie,kt=performance.now()-Ee;if(It(),me.current||j)return;const Zr=wn();if(G.current&&!Zr&&((Ms=K.current)==null||Ms.call(K)),G.current||Zr){ne.current&&($e.current=!0);return}if(!Re){if(M&&kt>=de)return;if(ne.current){Be.preventDefault(),Be.stopPropagation(),$e.current=!0;return}Ht();return}if(Math.abs(Et)>.12){let Jn=Et,Qn=performance.now();const Zn=()=>{const Sn=performance.now(),en=Sn-Qn;Qn=Sn;const Ec=Jn*en;Ve+=Ec;const Cp=Math.max(6,ot*.6),kc=Math.trunc(Ve/Cp);kc!==0&&(zt(kc),Ve-=kc*Cp),Jn*=Math.pow(.95,en/16.67),Math.abs(Jn)>.02?He=requestAnimationFrame(Zn):He=null};He=requestAnimationFrame(Zn)}},Jr=Be=>{$e.current&&(Be.preventDefault(),Be.stopPropagation(),$e.current=!1)},Qr={passive:!0,capture:!0},Rs={passive:!1,capture:!0},xp={passive:!1,capture:!0},bp={capture:!0};return Z.addEventListener("touchstart",la,Qr),Z.addEventListener("touchmove",q,Rs),Z.addEventListener("touchend",et,xp),Z.addEventListener("mousedown",Jr,bp),()=>{Z.removeEventListener("touchstart",la,Qr),Z.removeEventListener("touchmove",q,Rs),Z.removeEventListener("touchend",et,xp),Z.removeEventListener("mousedown",Jr,bp);const Be=De();Be&&(Be.disabled=!1)}},[e==null?void 0:e.id,ye,ve,M,D,j,w,b]);const X=k.useCallback(Z=>{!e||re||a({type:"terminal-input",sessionId:e.id,data:Z})},[e,re,a]),le=k.useCallback(()=>{const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-helper-textarea");Le&&(Le.removeAttribute("disabled"),Le.focus())},[ye]),ge=k.useCallback(()=>{if(!e||re)return;ne.current&&(a({type:"tmux-cancel-copy-mode",sessionId:e.id}),ie(!1));const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-helper-textarea");Le&&(Le.removeAttribute("disabled"),Le.focus())},[e,re,a,ye,ne,ie]),We=k.useCallback(()=>{var Re,je;if(typeof document>"u")return!1;const Z=ye.current;if(!Z)return!1;const Le=Z.querySelector(".xterm-helper-textarea");if(Le&&document.activeElement===Le)return!0;const de=document.activeElement,fe=typeof HTMLInputElement<"u"&&de instanceof HTMLInputElement,Ee=typeof HTMLTextAreaElement<"u"&&de instanceof HTMLTextAreaElement;return fe||Ee||de&&de.isContentEditable?!1:!!((je=(Re=document.documentElement)==null?void 0:Re.classList)!=null&&je.contains("keyboard-visible"))},[ye]);return k.useEffect(()=>{if(!M)return;const Z=ye.current;if(!Z)return;const Le=Z.querySelector(".xterm-accessibility"),de=Z.querySelector(".xterm-accessibility-tree");if(!Le||!de)return;const fe=()=>{const Ee=Z.querySelector(".xterm-helper-textarea");(Ee?document.activeElement===Ee:!1)&&!G.current?(Le.style.pointerEvents="none",de.style.pointerEvents="none"):(Le.style.removeProperty("pointer-events"),de.style.removeProperty("pointer-events"))};return fe(),document.addEventListener("focusin",fe),document.addEventListener("focusout",fe),()=>{document.removeEventListener("focusin",fe),document.removeEventListener("focusout",fe)}},[ye,M,F]),T.jsxs("section",{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${M?"ios-native-term-selection":""}`,"data-testid":"terminal-panel",children:[T.jsxs("div",{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3 ${e?"":"md:hidden"}`,children:[T.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[T.jsx("button",{onClick:()=>U(!0),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all md:hidden shrink-0","aria-label":"Open session menu",children:T.jsx(EC,{width:16,height:16})}),e&&ae&&T.jsx("button",{onClick:()=>R(!0),className:"hidden md:flex h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all shrink-0",title:`Kill session (${A}X)`,"aria-label":"Kill session",children:T.jsx(Th,{width:16,height:16})}),e?T.jsxs("div",{className:"flex items-baseline gap-3 min-w-0",children:[V?T.jsx("input",{ref:te,type:"text",value:Q,onChange:Z=>z(Z.target.value),onBlur:Ae,onKeyDown:Pe,className:"w-full max-w-[200px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent"}):T.jsx("span",{className:"text-sm font-medium text-primary truncate",children:e.agentSessionName||e.name}),T.jsx("span",{className:`text-xs shrink-0 ${tM[e.status]}`,children:eM[e.status]})]}):T.jsx("span",{className:"text-sm font-medium text-primary md:hidden",children:"Sessions"})]}),T.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[n!=="connected"&&T.jsx("span",{className:"text-xs text-approval",children:n}),T.jsx("button",{onClick:c,className:"flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all md:hidden",title:`New session (${A}N)`,"aria-label":"New session",children:T.jsx(iy,{width:16,height:16})}),e&&ae&&T.jsx("button",{onClick:()=>R(!0),className:"flex md:hidden h-7 w-7 items-center justify-center rounded bg-danger/10 border border-danger/30 text-danger hover:bg-danger/20 active:scale-95 transition-all",title:`Kill session (${A}X)`,"aria-label":"Kill session",children:T.jsx(Th,{width:16,height:16})}),e&&T.jsxs("div",{className:"relative md:hidden",ref:W,children:[T.jsx("button",{onClick:()=>N(!P),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all",title:"More options","aria-label":"More options",children:T.jsx(vC,{width:16,height:16})}),P&&T.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1",children:[ae&&T.jsxs("button",{onClick:Ke,className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(ny,{width:14,height:14}),"Rename"]}),T.jsxs("button",{onClick:()=>{y(),N(!1)},className:"w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2",children:[T.jsx(MC,{width:14,height:14}),"Settings"]})]})]})]})]}),e&&t.length>1&&T.jsxs("div",{className:"relative overflow-hidden bg-elevated border-b border-border md:hidden",children:[T.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none"}),T.jsx("div",{className:"flex items-center gap-1.5 pl-5 pr-3 py-1.5 overflow-x-auto scrollbar-none scroll-smooth snap-x snap-mandatory",style:{WebkitOverflowScrolling:"touch"},children:t.map((Z,Le)=>{const de=Z.id===e.id;return T.jsx("button",{type:"button",className:`
|
|
295
295
|
flex items-center justify-center shrink-0 snap-start
|
|
296
296
|
h-8 w-8 text-sm font-extrabold rounded-lg
|
|
297
297
|
active:scale-95 transition-all duration-75
|
|
298
298
|
select-none touch-manipulation
|
|
299
299
|
${de?nM[Z.status]:rM[Z.status]}
|
|
300
|
-
`,onClick:()=>{xv(),o(Z.id)},children:Le+1},Z.id)})})]}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx("div",{ref:ye,className:"absolute inset-0"}),!e&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted",children:"Select a session to view terminal"}),e&&re&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-center text-sm text-muted",children:"Remote session (read-only). Use SSH to attach on the host."}),B&&e&&!F&&T.jsxs("button",{onClick:he,className:"absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all",style:{transform:"translateX(-50%)"},title:"Scroll to bottom","aria-label":"Scroll to bottom",children:[T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),T.jsx("span",{className:"text-sm font-medium",children:"Jump to bottom"})]})]}),e&&T.jsx(QD,{onSendKey:X,disabled:n!=="connected"||re,sessions:t.map(Z=>({id:Z.id,name:Z.name,status:Z.status})),currentSessionId:e.id,onSelectSession:o,hideSessionSwitcher:!0,onRefocus:le,isKeyboardVisible:We,onEnterTextMode:ge}),(D||M)&&T.jsx(ZD,{isOpen:j,onClose:()=>U(!1),sessions:t,inactiveSessions:r,selectedSessionId:(e==null?void 0:e.id)??null,onSelect:o,onRename:u,onResume:f,onSetPinned:_,onNewSession:c,loading:v,error:h}),I&&e&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-2 text-balance",children:"Kill Session"}),T.jsxs("p",{className:"text-sm text-secondary mb-4 text-pretty",children:['Kill "',e.agentSessionName||e.name,'"? The process will be terminated. Conversation history is preserved in logs.']}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx("button",{onClick:()=>R(!1),className:"btn py-1.5 px-3 text-sm",children:"Cancel"}),T.jsx("button",{ref:Y,onClick:Ne,className:"btn btn-danger py-1.5 px-3 text-sm",children:"Kill Session"})]})]})})]})}function iM({onSelect:e,onCancel:t,initialPath:r}){const[n,i]=k.useState(r||"~"),[a,l]=k.useState(null),[s,o]=k.useState(null),[c,p]=k.useState(!0),[u,f]=k.useState(-1),_=k.useRef(null),y=pe(g=>g.recentPaths),v=k.useCallback(async g=>{var x;(x=_.current)==null||x.abort();const w=new AbortController;_.current=w;const{signal:b}=w;p(!0),o(null),l(null),f(-1),i(g);try{const C=await fetch(`/api/directories?path=${encodeURIComponent(g)}`,{signal:b});if(!C.ok){const E=await C.json();throw new Error(E.message||"Failed to load directory")}const S=await C.json();if(_.current!==w)return;l(S),i(S.path)}catch(C){if(_.current!==w)return;const S=C;(S==null?void 0:S.name)!=="AbortError"&&o((S==null?void 0:S.message)||"Failed to load directory")}finally{_.current===w&&p(!1)}},[]);k.useEffect(()=>(v(r||"~"),()=>{var g;(g=_.current)==null||g.abort()}),[v,r]);const h=(a==null?void 0:a.directories)??[],m=(a==null?void 0:a.path)||n,d=a==null?void 0:a.parent;return k.useEffect(()=>{const g=w=>{if(w.key==="Escape"){w.preventDefault(),t();return}if(!c){if(w.key==="ArrowDown"){w.preventDefault(),f(b=>h.length===0?-1:b<0?0:Math.min(b+1,h.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),f(b=>h.length===0?-1:b<0?h.length-1:Math.max(b-1,0));return}if(w.key==="Enter"){w.preventDefault();const b=h[u];b?v(b.path):m&&e(m);return}w.key==="Backspace"&&d&&(w.preventDefault(),v(d))}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[h,m,v,u,c,t,e,d]),T.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Directory browser",className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onClick:g=>{g.target===g.currentTarget&&t()},"data-testid":"directory-browser",children:T.jsxs("div",{className:"w-full max-w-lg border border-border bg-elevated p-4",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border pb-2",children:[T.jsx("button",{type:"button",className:"btn",onClick:()=>{d&&v(d)},disabled:!d||c,children:"Up"}),T.jsx("div",{className:"min-w-0 flex-1 truncate text-xs font-mono text-secondary",title:m,"data-testid":"directory-current-path",children:m})]}),T.jsx("div",{className:"mt-3 max-h-60 overflow-y-auto border border-border bg-surface",children:c?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-loading",children:"Loading directories..."}):s?T.jsxs("div",{className:"px-3 py-4 text-xs","data-testid":"directory-error",children:[T.jsx("p",{className:"text-danger",children:s}),T.jsx("button",{type:"button",className:"btn mt-3",onClick:()=>v(n),children:"Retry"})]}):h.length===0?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-empty",children:"No subdirectories"}):T.jsx("div",{className:"py-1",children:h.map((g,w)=>T.jsxs("button",{type:"button",onClick:()=>v(g.path),onMouseEnter:()=>f(w),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${w===u?"bg-hover text-primary":"text-secondary"}`,"data-testid":"directory-entry","data-entry-name":g.name,"data-entry-path":g.path,children:[T.jsx(SC,{width:14,height:14,className:"shrink-0 text-muted","aria-hidden":"true"}),T.jsx("span",{className:"truncate",children:g.name})]},g.path))})}),a!=null&&a.truncated?T.jsx("p",{className:"mt-2 text-[10px] text-muted",children:"Showing first 200 directories."}):null,T.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[T.jsx("div",{className:"text-[10px] uppercase tracking-wider text-secondary",children:"Recent"}),y.length===0?T.jsx("p",{className:"mt-2 text-xs text-muted",children:"No recent paths yet."}):T.jsx("div",{className:"mt-2 space-y-1",children:y.map(g=>T.jsx("button",{type:"button",className:"block w-full truncate text-left text-xs text-secondary hover:text-primary",onClick:()=>v(g),title:g,"data-testid":"directory-recent","data-recent-path":g,children:g},g))})]}),T.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>{m&&e(m)},className:"btn btn-primary",disabled:c||!m,children:"Select"})]})]})})}function oM({isOpen:e,onClose:t,onCreate:r,defaultProjectDir:n,commandPresets:i,defaultPresetId:a,lastProjectPath:l,activeProjectPath:s,remoteHosts:o=[],remoteAllowControl:c=!1,initialHost:p,initialPath:u,initialCommand:f}){const[_,y]=k.useState(""),[v,h]=k.useState(""),[m,d]=k.useState(null),[g,w]=k.useState(""),[b,x]=k.useState(!1),[C,S]=k.useState(""),E=k.useRef(null),L=k.useRef(null),A=k.useRef(null),M=c&&o.length>0;if(k.useEffect(()=>{if(!e){y(""),h(""),d(null),w(""),x(!1),S(p??""),setTimeout(()=>{if(typeof document>"u"||typeof document.querySelector!="function")return;const U=document.querySelector(".xterm-helper-textarea");U&&(U.removeAttribute("disabled"),U.focus())},300);return}if(typeof document<"u"&&typeof document.querySelector=="function"){const U=document.querySelector(".xterm-helper-textarea");U&&typeof U.setAttribute=="function"&&(typeof U.blur=="function"&&U.blur(),U.setAttribute("disabled","true"))}const N=(u==null?void 0:u.trim())||(s==null?void 0:s.trim())||l||n||"";y(N),h(""),S(p??"");const j=f==null?void 0:f.trim();if(j){const U=i.find(V=>$i(V)===j);U?(d(U.id),w($i(U))):(d(null),w(j))}else{const U=i.find(V=>V.id===a);U?(d(a),w($i(U))):i.length>0?(d(i[0].id),w($i(i[0]))):(d(null),w(""))}setTimeout(()=>{var U;if((U=A.current)==null||U.focus(),L.current){const V=L.current;V.scrollLeft=V.scrollWidth}},50)},[s,i,a,n,e,l,p,u,f]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const N=()=>E.current?Array.from(E.current.querySelectorAll('input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]')):[],j=U=>{var V,ee;if(!b){if(U.key==="Escape"){typeof U.stopPropagation=="function"&&U.stopPropagation(),t();return}if(U.key==="Enter"){const Q=document.activeElement;if(!Q||Q.tagName==="INPUT"||Q.closest('[data-testid="host-select"]')||!Q.closest('[data-testid="command-select"]'))return;U.preventDefault(),typeof U.stopPropagation=="function"&&U.stopPropagation(),(V=E.current)==null||V.requestSubmit();return}if(U.key==="Tab"){U.preventDefault(),typeof U.stopPropagation=="function"&&U.stopPropagation();const Q=N();if(Q.length===0)return;const z=document.activeElement,O=Q.indexOf(z);let K;O===-1?K=U.shiftKey?Q.length-1:0:U.shiftKey?K=O<=0?Q.length-1:O-1:K=O>=Q.length-1?0:O+1,(ee=Q[K])==null||ee.focus()}}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[e,t,b]),!e)return null;const D=N=>{const j=i.find(U=>U.id===N);j&&(d(N),w($i(j)))},B=()=>{d(null),w("")},H=m===null,F=C!=="",$=N=>{N.preventDefault();const j=_.trim();if(!j)return;const U=g.trim();r(j,v.trim()||void 0,U||void 0,F?C:void 0),t()},I=[...i.map(N=>({id:N.id,label:N.label,isCustom:!1,agentType:N.agentType,command:N.command})),{id:"custom",label:"Custom",isCustom:!0,agentType:void 0,command:void 0}],R=[{id:"",label:"Local",ok:!0,error:void 0},...o.map(N=>({id:N.host,label:N.host,ok:N.ok,error:N.error}))],P=_.trim()||"~";return T.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"new-session-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:N=>{N.target===N.currentTarget&&t()},children:[T.jsxs("form",{ref:E,onSubmit:$,className:"w-full max-w-md border border-border bg-elevated p-6",children:[T.jsx("h2",{id:"new-session-title",className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"New Session"}),T.jsxs("div",{className:"mt-4 space-y-4",children:[M&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Host"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Host","data-testid":"host-select",children:R.map((N,j)=>{const U=C===N.id,V=!N.ok&&!U;return T.jsx("button",{type:"button",role:"radio","aria-checked":U,"aria-label":N.label,title:N.ok?void 0:N.error||"Unreachable",tabIndex:U?0:-1,onClick:()=>S(N.id),onKeyDown:ee=>{var W;let Q=j;if(ee.key==="ArrowRight"||ee.key==="ArrowDown")ee.preventDefault(),Q=(j+1)%R.length;else if(ee.key==="ArrowLeft"||ee.key==="ArrowUp")ee.preventDefault(),Q=(j-1+R.length)%R.length;else return;const z=R[Q];S(z.id);const O=ee.currentTarget.parentElement,K=O==null?void 0:O.querySelectorAll('[role="radio"]');(W=K==null?void 0:K[Q])==null||W.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${U?"btn-primary":""} ${V?"opacity-60":""}`,children:N.label},N.id||"local")})})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Command"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Command preset","data-testid":"command-select",children:I.map((N,j)=>{const U=N.isCustom?H:m===N.id;return T.jsxs("button",{ref:U?A:void 0,type:"button",role:"radio","aria-checked":U,tabIndex:U?0:-1,onClick:()=>{N.isCustom?B():D(N.id)},onKeyDown:V=>{var K;let ee=j;if(V.key==="ArrowRight"||V.key==="ArrowDown")V.preventDefault(),ee=(j+1)%I.length;else if(V.key==="ArrowLeft"||V.key==="ArrowUp")V.preventDefault(),ee=(j-1+I.length)%I.length;else return;const Q=I[ee];Q.isCustom?B():D(Q.id);const z=V.currentTarget.parentElement,O=z==null?void 0:z.querySelectorAll('[role="radio"]');(K=O==null?void 0:O[ee])==null||K.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${U?"btn-primary":""}`,children:[T.jsx(bc,{agentType:N.agentType,command:N.command,className:"inline-block h-3.5 w-3.5 shrink-0"}),N.label]},N.id)})}),T.jsx("input",{value:g,onChange:N=>w(N.target.value),placeholder:"Enter command...",className:"input mt-2 font-mono text-xs"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Project Path"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("input",{ref:L,value:_,onChange:N=>y(N.target.value),placeholder:F?"/home/user/project":s||l||n||"/Users/you/code/my-project",className:"input flex-1 text-sm"}),!F&&T.jsx("button",{type:"button",className:"btn",onClick:()=>x(!0),children:"Browse"})]})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Display Name"}),T.jsx("input",{value:v,onChange:N=>h(N.target.value),placeholder:"auto-generated",className:"input text-sm placeholder:italic"})]})]}),T.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Create"})]})]}),b&&!F&&T.jsx(iM,{initialPath:P,onSelect:N=>{y(N),x(!1)},onCancel:()=>x(!1)})]})}const bu=1,Cu=168;function aM({controlled:e,default:t,name:r,state:n="value"}){const{current:i}=k.useRef(e!==void 0),[a,l]=k.useState(t),s=i?e:a,o=k.useCallback(c=>{i||l(c)},[]);return[s,o]}const bv={};function ks(e,t){const r=k.useRef(bv);return r.current===bv&&(r.current=e(t)),r}const Eu=Yv[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],lM=Eu&&Eu!==k.useLayoutEffect?Eu:e=>e();function Xr(e){const t=ks(cM).current;return t.next=e,lM(t.effect),t.trampoline}function cM(){const e={next:void 0,callback:uM,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function uM(){}function od(e,t,r,n){const i=ks(Nw).current;return dM(i,e,t,r,n)&&jw(i,[e,t,r,n]),i.callback}function hM(e){const t=ks(Nw).current;return fM(t,e)&&jw(t,e),t.callback}function Nw(){return{callback:null,cleanup:null,refs:[]}}function dM(e,t,r,n,i){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==n||e.refs[3]!==i}function fM(e,t){return e.refs.length!==t.length||e.refs.some((r,n)=>r!==t[n])}function jw(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const n=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const l=a(r);typeof l=="function"&&(n[i]=l);break}case"object":{a.current=r;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const l=n[i];typeof l=="function"?l():a(null);break}case"object":{a.current=null;break}}}}}}}const pM=()=>{},qt=typeof document<"u"?k.useLayoutEffect:pM,Fw={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},op={...Fw,position:"fixed",top:0,left:0},mM={...Fw,position:"absolute"};function ur(){}const zr=Object.freeze({});function Yr(e,...t){const r=new URL("https://base-ui.com/production-error");return r.searchParams.set("code",e.toString()),t.forEach(n=>r.searchParams.append("args[]",n)),`Base UI error #${e}; visit ${r} for the full message.`}const gM=parseInt(k.version,10);function ap(e){return gM>=e}function Cv(e){if(!k.isValidElement(e))return null;const t=e,r=t.props;return(ap(19)?r==null?void 0:r.ref:t.ref)??null}function ad(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function vM(e,t){const r={};for(const n in e){const i=e[n];if(t!=null&&t.hasOwnProperty(n)){const a=t[n](i);a!=null&&Object.assign(r,a);continue}i===!0?r[`data-${n.toLowerCase()}`]="":i&&(r[`data-${n.toLowerCase()}`]=i.toString())}return r}function _M(e,t){return typeof e=="function"?e(t):e}function yM(e,t){return typeof e=="function"?e(t):e}const vo={};function lp(e,t,r,n,i){let a={...ld(e,vo)};return t&&(a=cl(a,t)),r&&(a=cl(a,r)),n&&(a=cl(a,n)),a}function wM(e){if(e.length===0)return vo;if(e.length===1)return ld(e[0],vo);let t={...ld(e[0],vo)};for(let r=1;r<e.length;r+=1)t=cl(t,e[r]);return t}function cl(e,t){return $w(t)?t(e):SM(e,t)}function SM(e,t){if(!t)return e;for(const r in t){const n=t[r];switch(r){case"style":{e[r]=ad(e.style,n);break}case"className":{e[r]=Hw(e.className,n);break}default:xM(r,n)?e[r]=bM(e[r],n):e[r]=n}}return e}function xM(e,t){const r=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2);return r===111&&n===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function $w(e){return typeof e=="function"}function ld(e,t){return $w(e)?e(t):e??vo}function bM(e,t){return t?e?r=>{if(CM(r)){const i=r;cd(i);const a=t(i);return i.baseUIHandlerPrevented||e==null||e(i),a}const n=t(r);return e==null||e(r),n}:t:e}function cd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Hw(e,t){return t?e?t+" "+e:t:e}function CM(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ls(e,t,r={}){const n=t.render,i=EM(t,r);if(r.enabled===!1)return null;const a=r.state??zr;return LM(e,n,i,a)}function EM(e,t={}){const{className:r,style:n,render:i}=e,{state:a=zr,ref:l,props:s,stateAttributesMapping:o,enabled:c=!0}=t,p=c?_M(r,a):void 0,u=c?yM(n,a):void 0,f=c?vM(a,o):zr,_=c?ad(f,Array.isArray(s)?wM(s):s)??zr:zr;return typeof document<"u"&&(c?Array.isArray(l)?_.ref=hM([_.ref,Cv(i),...l]):_.ref=od(_.ref,Cv(i),l):od(null,null)),c?(p!==void 0&&(_.className=Hw(_.className,p)),u!==void 0&&(_.style=ad(_.style,u)),_):zr}const kM=Symbol.for("react.lazy");function LM(e,t,r,n){if(t){if(typeof t=="function")return t(r,n);const i=lp(r,t.props);i.ref=r.ref;let a=t;return(a==null?void 0:a.$$typeof)===kM&&(a=k.Children.toArray(t)[0]),k.cloneElement(a,i)}if(e&&typeof e=="string")return TM(e,r);throw new Error(Yr(8))}function TM(e,t){return e==="button"?k.createElement("button",{type:"button",...t,key:t.key}):e==="img"?k.createElement("img",{alt:"",...t,key:t.key}):k.createElement(e,t)}const RM={...Yv};let Ev=0;function DM(e,t="mui"){const[r,n]=k.useState(e),i=e||r;return k.useEffect(()=>{r==null&&(Ev+=1,n(`${t}-${Ev}`))},[r,t]),i}const kv=RM.useId;function cp(e,t){if(kv!==void 0){const r=kv();return e??(t?`${t}-${r}`:r)}return DM(e,t)}function zw(e){return cp(e,"base-ui")}function up(){return typeof window<"u"}function Vo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function MM(e){return up()?e instanceof Element||e instanceof Vo(e).Element:!1}function AM(e){return up()?e instanceof HTMLElement||e instanceof Vo(e).HTMLElement:!1}function PM(e){return!up()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vo(e).ShadowRoot}const IM=k.createContext(void 0);function BM(e=!1){const t=k.useContext(IM);if(t===void 0&&!e)throw new Error(Yr(16));return t}function OM(e){const{focusableWhenDisabled:t,disabled:r,composite:n=!1,tabIndex:i=0,isNativeButton:a}=e,l=n&&t!==!1,s=n&&t===!1;return{props:k.useMemo(()=>{const c={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return n||(c.tabIndex=i,!a&&r&&(c.tabIndex=t?i:-1)),(a&&(t||l)||!a&&r)&&(c["aria-disabled"]=r),a&&(!t||s)&&(c.disabled=r),c},[n,r,t,l,s,a,i])}}function Uw(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:n=0,native:i=!0}=e,a=k.useRef(null),l=BM(!0)!==void 0,s=Xr(()=>{const f=a.current;return!!((f==null?void 0:f.tagName)==="A"&&(f!=null&&f.href))}),{props:o}=OM({focusableWhenDisabled:r,disabled:t,composite:l,tabIndex:n,isNativeButton:i}),c=k.useCallback(()=>{const f=a.current;NM(f)&&l&&t&&o.disabled===void 0&&f.disabled&&(f.disabled=!1)},[t,o.disabled,l]);qt(c,[c]);const p=k.useCallback((f={})=>{const{onClick:_,onMouseDown:y,onKeyUp:v,onKeyDown:h,onPointerDown:m,...d}=f;return lp({type:i?"button":void 0,onClick(w){if(t){w.preventDefault();return}_==null||_(w)},onMouseDown(w){t||y==null||y(w)},onKeyDown(w){if(t||(cd(w),h==null||h(w)),w.baseUIHandlerPrevented)return;const b=w.target===w.currentTarget&&!i&&!s()&&!t,x=w.key==="Enter",C=w.key===" ";b&&((C||x)&&w.preventDefault(),x&&(_==null||_(w)))},onKeyUp(w){t||(cd(w),v==null||v(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!i&&!t&&w.key===" "&&(_==null||_(w))},onPointerDown(w){if(t){w.preventDefault();return}m==null||m(w)}},i?void 0:{role:"button"},o,d)},[t,o,i,s]),u=Xr(f=>{a.current=f,c()});return{getButtonProps:p,buttonRef:u}}function NM(e){return AM(e)&&e.tagName==="BUTTON"}const Ww=k.createContext(void 0);function jM(){const e=k.useContext(Ww);if(e===void 0)throw new Error(Yr(63));return e}let Lv=function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const FM={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},$M={valid(e){return e===null?null:e?{[Lv.valid]:""}:{[Lv.invalid]:""}}};let Tv=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Vw={...$M,checked(e){return e?{[Tv.checked]:""}:{[Tv.unchecked]:""}}};function HM(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const zM=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:ur,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Kw(){return k.useContext(zM)}const UM=k.createContext({invalid:void 0,name:void 0,validityData:{state:FM,errors:[],error:"",value:"",initialValue:null},setValidityData:ur,disabled:void 0,touched:!1,setTouched:ur,dirty:!1,setDirty:ur,filled:!1,setFilled:ur,focused:!1,setFocused:ur,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=zr)=>e,getInputValidationProps:(e=zr)=>e,inputRef:{current:null},commit:async()=>{}}});function hp(e=!0){const t=k.useContext(UM);if(t.setValidityData===ur&&!e)throw new Error(Yr(28));return t}function WM(e){const{enabled:t=!0,value:r,id:n,name:i,controlRef:a,commit:l}=e,{formRef:s}=Kw(),{invalid:o,markedDirtyRef:c,validityData:p,setValidityData:u}=hp(),f=Xr(e.getValue);qt(()=>{if(!t)return;let _=r;_===void 0&&(_=f()),p.initialValue===null&&_!==null&&u(y=>({...y,initialValue:_}))},[t,u,r,p.initialValue,f]),qt(()=>{!t||!n||s.current.fields.set(n,{getValue:f,name:i,controlRef:a,validityData:HM(p,o),validate(_=!0){let y=r;y===void 0&&(y=f()),c.current=!0,_?hn.flushSync(()=>l(y)):l(y)}})},[l,a,t,s,f,n,o,c,i,p,r]),qt(()=>{const _=s.current.fields;return()=>{n&&_.delete(n)}},[s,n])}const VM=k.createContext({controlId:void 0,registerControlId:ur,labelId:void 0,setLabelId:ur,messageIds:[],setMessageIds:ur,getDescriptionProps:e=>e});function Gw(){return k.useContext(VM)}function KM(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:i,registerControlId:a}=Gw(),l=zw(t),s=r?i:void 0,o=ks(()=>Symbol("labelable-control")),c=k.useRef(!1),p=k.useRef(t!=null),u=Xr(()=>{!c.current||a===ur||(c.current=!1,a(o.current,void 0))});return qt(()=>{if(a===ur)return;let f;if(r){const _=n==null?void 0:n.current;MM(_)&&_.closest("label")!=null?f=t??null:f=s??l}else if(t!=null)p.current=!0,f=t;else if(p.current)f=l;else{u();return}if(f===void 0){u();return}c.current=!0,a(o.current,f)},[t,n,s,a,r,l,o,u]),k.useEffect(()=>u,[u]),i??l}const GM="none";function qM(e,t,r,n){let i=!1,a=!1;const l=zr;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:r,...l}}function XM(e,t){const r=k.useRef(e),n=Xr(t);qt(()=>{r.current!==e&&n(r.current)},[e,n]),qt(()=>{r.current=e},[e])}const YM=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:a,id:l,inputRef:s,name:o,nativeButton:c=!1,onCheckedChange:p,readOnly:u=!1,required:f=!1,disabled:_=!1,render:y,uncheckedValue:v,value:h,...m}=t,{clearErrors:d}=Kw(),{state:g,setTouched:w,setDirty:b,validityData:x,setFilled:C,setFocused:S,shouldValidateOnChange:E,validationMode:L,disabled:A,name:M,validation:D}=hp(),{labelId:B}=Gw(),H=A||_,F=M??o,$=Xr(p),I=k.useRef(null),R=od(I,s,D.inputRef),P=k.useRef(null),N=zw(),j=KM({id:l,implicit:!1,controlRef:P}),U=c?void 0:j,[V,ee]=aM({controlled:n,default:!!a,name:"Switch",state:"checked"});WM({id:N,commit:D.commit,value:V,controlRef:P,name:F,getValue:()=>V}),qt(()=>{I.current&&C(I.current.checked)},[I,C]),XM(V,()=>{d(F),b(V!==x.initialValue),C(V),E()?D.commit(V):D.commit(V,!0)});const{getButtonProps:Q,buttonRef:z}=Uw({disabled:H,native:c}),O={id:c?j:N,role:"switch","aria-checked":V,"aria-readonly":u||void 0,"aria-required":f||void 0,"aria-labelledby":B,onFocus(){H||S(!0)},onBlur(){const Y=I.current;!Y||H||(w(!0),S(!1),L==="onBlur"&&D.commit(Y.checked))},onClick(Y){var _e;u||H||(Y.preventDefault(),(_e=I.current)==null||_e.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:Y.shiftKey,ctrlKey:Y.ctrlKey,altKey:Y.altKey,metaKey:Y.metaKey})))}},K=k.useMemo(()=>lp({checked:V,disabled:H,id:U,name:F,required:f,style:F?mM:op,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:R,onChange(Y){if(Y.nativeEvent.defaultPrevented)return;const _e=Y.target.checked,ue=qM(GM,Y.nativeEvent);$==null||$(_e,ue),!ue.isCanceled&&ee(_e)},onFocus(){var Y;(Y=P.current)==null||Y.focus()}},D.getInputValidationProps,h!==void 0?{value:h}:zr),[V,H,R,U,F,$,f,ee,D,h]),W=k.useMemo(()=>({...g,checked:V,disabled:H,readOnly:u,required:f}),[g,V,H,u,f]),te=Ls("span",t,{state:W,ref:[r,P,z],props:[O,D.getValidationProps,m,Q],stateAttributesMapping:Vw});return T.jsxs(Ww.Provider,{value:W,children:[te,!V&&F&&v!==void 0&&T.jsx("input",{type:"hidden",name:F,value:v}),T.jsx("input",{...K})]})}),JM=k.forwardRef(function(t,r){const{render:n,className:i,...a}=t,{state:l}=hp(),s=jM(),o={...l,...s};return Ls("span",t,{state:o,ref:r,stateAttributesMapping:Vw,props:a})});function qw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=qw(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function QM(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=qw(e))&&(n&&(n+=" "),n+=t);return n}const ZM=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},e3=(e,t)=>({classGroupId:e,validator:t}),Xw=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ql="-",Rv=[],t3="arbitrary..",r3=e=>{const t=s3(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return n3(l);const s=l.split(ql),o=s[0]===""&&s.length>1?1:0;return Yw(s,o,t)},getConflictingClassGroupIds:(l,s)=>{if(s){const o=n[l],c=r[l];return o?c?ZM(c,o):o:c||Rv}return r[l]||Rv}}},Yw=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],a=r.nextPart.get(i);if(a){const c=Yw(e,t+1,a);if(c)return c}const l=r.validators;if(l===null)return;const s=t===0?e.join(ql):e.slice(t).join(ql),o=l.length;for(let c=0;c<o;c++){const p=l[c];if(p.validator(s))return p.classGroupId}},n3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?t3+n:void 0})(),s3=e=>{const{theme:t,classGroups:r}=e;return i3(r,t)},i3=(e,t)=>{const r=Xw();for(const n in e){const i=e[n];dp(i,r,n,t)}return r},dp=(e,t,r,n)=>{const i=e.length;for(let a=0;a<i;a++){const l=e[a];o3(l,t,r,n)}},o3=(e,t,r,n)=>{if(typeof e=="string"){a3(e,t,r);return}if(typeof e=="function"){l3(e,t,r,n);return}c3(e,t,r,n)},a3=(e,t,r)=>{const n=e===""?t:Jw(t,e);n.classGroupId=r},l3=(e,t,r,n)=>{if(u3(e)){dp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(e3(r,e))},c3=(e,t,r,n)=>{const i=Object.entries(e),a=i.length;for(let l=0;l<a;l++){const[s,o]=i[l];dp(o,Jw(t,s),r,n)}},Jw=(e,t)=>{let r=e;const n=t.split(ql),i=n.length;for(let a=0;a<i;a++){const l=n[a];let s=r.nextPart.get(l);s||(s=Xw(),r.nextPart.set(l,s)),r=s}return r},u3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,h3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return i(a,l),l},set(a,l){a in r?r[a]=l:i(a,l)}}},ud="!",Dv=":",d3=[],Mv=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),f3=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const a=[];let l=0,s=0,o=0,c;const p=i.length;for(let v=0;v<p;v++){const h=i[v];if(l===0&&s===0){if(h===Dv){a.push(i.slice(o,v)),o=v+1;continue}if(h==="/"){c=v;continue}}h==="["?l++:h==="]"?l--:h==="("?s++:h===")"&&s--}const u=a.length===0?i:i.slice(o);let f=u,_=!1;u.endsWith(ud)?(f=u.slice(0,-1),_=!0):u.startsWith(ud)&&(f=u.slice(1),_=!0);const y=c&&c>o?c-o:void 0;return Mv(a,_,f,y)};if(t){const i=t+Dv,a=n;n=l=>l.startsWith(i)?a(l.slice(i.length)):Mv(d3,!1,l,void 0,!0)}if(r){const i=n;n=a=>r({className:a,parseClassName:i})}return n},p3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let a=0;a<r.length;a++){const l=r[a],s=l[0]==="[",o=t.has(l);s||o?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(l)):i.push(l)}return i.length>0&&(i.sort(),n.push(...i)),n}},m3=e=>({cache:h3(e.cacheSize),parseClassName:f3(e),sortModifiers:p3(e),...r3(e)}),g3=/\s+/,v3=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a}=t,l=[],s=e.trim().split(g3);let o="";for(let c=s.length-1;c>=0;c-=1){const p=s[c],{isExternal:u,modifiers:f,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:v}=r(p);if(u){o=p+(o.length>0?" "+o:o);continue}let h=!!v,m=n(h?y.substring(0,v):y);if(!m){if(!h){o=p+(o.length>0?" "+o:o);continue}if(m=n(y),!m){o=p+(o.length>0?" "+o:o);continue}h=!1}const d=f.length===0?"":f.length===1?f[0]:a(f).join(":"),g=_?d+ud:d,w=g+m;if(l.indexOf(w)>-1)continue;l.push(w);const b=i(m,h);for(let x=0;x<b.length;++x){const C=b[x];l.push(g+C)}o=p+(o.length>0?" "+o:o)}return o},_3=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Qw(r))&&(i&&(i+=" "),i+=n);return i},Qw=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qw(e[n]))&&(r&&(r+=" "),r+=t);return r},y3=(e,...t)=>{let r,n,i,a;const l=o=>{const c=t.reduce((p,u)=>u(p),e());return r=m3(c),n=r.cache.get,i=r.cache.set,a=s,s(o)},s=o=>{const c=n(o);if(c)return c;const p=v3(o,r);return i(o,p),p};return a=l,(...o)=>a(_3(...o))},w3=[],yt=e=>{const t=r=>r[e]||w3;return t.isThemeGetter=!0,t},Zw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,S3=/^\d+\/\d+$/,x3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,b3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,C3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,E3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Is=e=>S3.test(e),Fe=e=>!!e&&!Number.isNaN(Number(e)),bn=e=>!!e&&Number.isInteger(Number(e)),ku=e=>e.endsWith("%")&&Fe(e.slice(0,-1)),rn=e=>x3.test(e),L3=()=>!0,T3=e=>b3.test(e)&&!C3.test(e),tS=()=>!1,R3=e=>E3.test(e),D3=e=>k3.test(e),M3=e=>!be(e)&&!Ce(e),A3=e=>Di(e,sS,tS),be=e=>Zw.test(e),ns=e=>Di(e,iS,T3),Lu=e=>Di(e,N3,Fe),Av=e=>Di(e,rS,tS),P3=e=>Di(e,nS,D3),Na=e=>Di(e,oS,R3),Ce=e=>eS.test(e),zi=e=>Mi(e,iS),I3=e=>Mi(e,j3),Pv=e=>Mi(e,rS),B3=e=>Mi(e,sS),O3=e=>Mi(e,nS),ja=e=>Mi(e,oS,!0),Di=(e,t,r)=>{const n=Zw.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Mi=(e,t,r=!1)=>{const n=eS.exec(e);return n?n[1]?t(n[1]):r:!1},rS=e=>e==="position"||e==="percentage",nS=e=>e==="image"||e==="url",sS=e=>e==="length"||e==="size"||e==="bg-size",iS=e=>e==="length",N3=e=>e==="number",j3=e=>e==="family-name",oS=e=>e==="shadow",F3=()=>{const e=yt("color"),t=yt("font"),r=yt("text"),n=yt("font-weight"),i=yt("tracking"),a=yt("leading"),l=yt("breakpoint"),s=yt("container"),o=yt("spacing"),c=yt("radius"),p=yt("shadow"),u=yt("inset-shadow"),f=yt("text-shadow"),_=yt("drop-shadow"),y=yt("blur"),v=yt("perspective"),h=yt("aspect"),m=yt("ease"),d=yt("animate"),g=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],b=()=>[...w(),Ce,be],x=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],S=()=>[Ce,be,o],E=()=>[Is,"full","auto",...S()],L=()=>[bn,"none","subgrid",Ce,be],A=()=>["auto",{span:["full",bn,Ce,be]},bn,Ce,be],M=()=>[bn,"auto",Ce,be],D=()=>["auto","min","max","fr",Ce,be],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...S()],$=()=>[Is,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],I=()=>[e,Ce,be],R=()=>[...w(),Pv,Av,{position:[Ce,be]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",B3,A3,{size:[Ce,be]}],j=()=>[ku,zi,ns],U=()=>["","none","full",c,Ce,be],V=()=>["",Fe,zi,ns],ee=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[Fe,ku,Pv,Av],O=()=>["","none",y,Ce,be],K=()=>["none",Fe,Ce,be],W=()=>["none",Fe,Ce,be],te=()=>[Fe,Ce,be],Y=()=>[Is,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[L3],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[M3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",Fe],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Is,be,Ce,h]}],container:["container"],columns:[{columns:[Fe,be,Ce,s]}],"break-after":[{"break-after":g()}],"break-before":[{"break-before":g()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[bn,"auto",Ce,be]}],basis:[{basis:[Is,"full","auto",s,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,Is,"auto","initial","none",be]}],grow:[{grow:["",Fe,Ce,be]}],shrink:[{shrink:["",Fe,Ce,be]}],order:[{order:[bn,"first","last","none",Ce,be]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[s,"screen",...$()]}],"min-w":[{"min-w":[s,"screen","none",...$()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",r,zi,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ce,Lu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ku,be]}],"font-family":[{font:[I3,be,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ce,be]}],"line-clamp":[{"line-clamp":[Fe,"none",Ce,Lu]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",Ce,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ce,ns]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ce,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bn,Ce,be],radial:["",Ce,be],conic:[bn,Ce,be]},O3,P3]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ce,be]}],"outline-w":[{outline:["",Fe,zi,ns]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",p,ja,Na]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",u,ja,Na]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Fe,ns]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,ja,Na]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Fe,Ce,be]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Ce,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,be]}],filter:[{filter:["","none",Ce,be]}],blur:[{blur:O()}],brightness:[{brightness:[Fe,Ce,be]}],contrast:[{contrast:[Fe,Ce,be]}],"drop-shadow":[{"drop-shadow":["","none",_,ja,Na]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Fe,Ce,be]}],"hue-rotate":[{"hue-rotate":[Fe,Ce,be]}],invert:[{invert:["",Fe,Ce,be]}],saturate:[{saturate:[Fe,Ce,be]}],sepia:[{sepia:["",Fe,Ce,be]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,be]}],"backdrop-blur":[{"backdrop-blur":O()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ce,be]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ce,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ce,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ce,be]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ce,be]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ce,be]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ce,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ce,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ce,be]}],ease:[{ease:["linear","initial",m,Ce,be]}],delay:[{delay:[Fe,Ce,be]}],animate:[{animate:["none",d,Ce,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Ce,be]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[Ce,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,be]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Fe,zi,ns,Lu]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$3=y3(F3);function Xl(...e){return $3(QM(e))}function Cn({checked:e,onCheckedChange:t,disabled:r,className:n}){return T.jsx(YM,{checked:e,onCheckedChange:t,disabled:r,className:Xl("group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","bg-border data-[checked]:bg-accent","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base","disabled:cursor-not-allowed disabled:opacity-50",n),children:T.jsx(JM,{className:Xl("pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform","translate-x-1 group-data-[checked]:translate-x-5")})})}let Ar=null,fp=!1;const Yl={},aS=500;function pp(){if(typeof window>"u")return null;if((Ar==null?void 0:Ar.state)==="closed"&&(Ar=null),!Ar){const e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Ar=new e}return Ar}function H3(){Ar&&(Ar.close().catch(()=>{}),Ar=null),pp()}function z3(){return fp}function Tu(){Ar&&(H3(),fp=!0)}if(typeof window<"u"){window.addEventListener("pageshow",t=>{t.persisted&&Tu()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Tu()});let e=Date.now();setInterval(()=>{const t=Date.now();t-e>15e3&&Tu(),e=t},5e3)}async function hd(){const e=pp();e&&e.state==="suspended"&&await e.resume().catch(()=>{}),fp=!1}async function U3(e){e.state==="suspended"&&await e.resume().catch(()=>{})}async function lS(e){const t=pp();if(!t||(await U3(t),t.state!=="running"))return;const{frequencies:r,durationMs:n,attackMs:i,peakGain:a,type:l="sine"}=e,s=t.currentTime,o=n/1e3,c=i/1e3,p=t.createGain();p.connect(t.destination);const u=s+o*.7;p.gain.setValueAtTime(0,s),p.gain.linearRampToValueAtTime(a,s+c),p.gain.setValueAtTime(a,u),p.gain.linearRampToValueAtTime(0,s+o);const f=r.map(y=>{const v=t.createOscillator();return v.type=l,v.frequency.setValueAtTime(y,s),v.connect(p),v});for(const y of f)y.start(s),y.stop(s+o);const _=f[f.length-1];_.onended=()=>{for(const y of f)y.disconnect();p.disconnect()}}async function dd(){const e=Date.now();if(!(e-(Yl.permission||0)<aS)){Yl.permission=e;try{await lS({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:"sine"})}catch{}}}async function fd(){const e=Date.now();if(!(e-(Yl.idle||0)<aS)){Yl.idle=e;try{await lS({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:"sine"})}catch{}}}function W3({isOpen:e,onClose:t}){const r=pe(q=>q.defaultProjectDir),n=pe(q=>q.setDefaultProjectDir),i=pe(q=>q.commandPresets),a=pe(q=>q.setCommandPresets),l=pe(q=>q.defaultPresetId),s=pe(q=>q.setDefaultPresetId),o=pe(q=>q.sessionSortMode),c=pe(q=>q.setSessionSortMode),p=pe(q=>q.sessionSortDirection),u=pe(q=>q.setSessionSortDirection),f=pe(q=>q.useWebGL),_=pe(q=>q.setUseWebGL),y=pe(q=>q.fontSize),v=pe(q=>q.setFontSize),h=pe(q=>q.lineHeight),m=pe(q=>q.setLineHeight),d=pe(q=>q.letterSpacing),g=pe(q=>q.setLetterSpacing),w=pe(q=>q.fontOption),b=pe(q=>q.setFontOption),x=pe(q=>q.customFontFamily),C=pe(q=>q.setCustomFontFamily),S=pe(q=>q.shortcutModifier),E=pe(q=>q.setShortcutModifier),L=pe(q=>q.showProjectName),A=pe(q=>q.setShowProjectName),M=pe(q=>q.showLastUserMessage),D=pe(q=>q.setShowLastUserMessage),B=pe(q=>q.showSessionIdPrefix),H=pe(q=>q.setShowSessionIdPrefix),F=Gl(q=>q.theme),$=Gl(q=>q.setTheme),I=pe(q=>q.soundOnPermission),R=pe(q=>q.setSoundOnPermission),P=pe(q=>q.soundOnIdle),N=pe(q=>q.setSoundOnIdle),[j,U]=k.useState(r),[V,ee]=k.useState(i),[Q,z]=k.useState(l),[O,K]=k.useState(o),[W,te]=k.useState(p),[Y,_e]=k.useState(f),[ue,se]=k.useState(y),[re,ae]=k.useState(h),[ye,ve]=k.useState(d),[ne,ie]=k.useState(w),[he,oe]=k.useState(x),[me,xe]=k.useState(S),[ke,Ne]=k.useState(L),[Ke,Ae]=k.useState(M),[Pe,G]=k.useState(B),[J,Oe]=k.useState(F),[$e,X]=k.useState(I),[le,ge]=k.useState(P),[We,Z]=k.useState(!0),[Le,de]=k.useState(!1),[fe,Ee]=k.useState(24),[Re,je]=k.useState(!1),[Me,Ie]=k.useState(!1),[Ve,ot]=k.useState(""),[He,Te]=k.useState(""),[De,ze]=k.useState(""),Xe=k.useRef(null);if(k.useEffect(()=>{if(Xe.current&&(clearTimeout(Xe.current),Xe.current=null),e){if(U(r),ee(i),z(l),K(o),te(p),_e(f),se(y),ae(h),ve(d),ie(w),oe(x),xe(S),Ne(L),Ae(M),G(B),Oe(F),X(I),ge(P),Ie(!1),ot(""),Te(""),ze(""),fetch("/api/settings/tmux-mouse-mode").then(q=>q.json()).then(q=>Z(q.enabled)).catch(()=>{}),fetch("/api/settings/inactive-max-age-hours").then(q=>q.json()).then(q=>Ee(q.hours)).catch(()=>{}),typeof document<"u"){const q=document.querySelector(".xterm-helper-textarea");q&&typeof q.setAttribute=="function"&&(typeof q.blur=="function"&&q.blur(),q.setAttribute("disabled","true"))}}else typeof document<"u"&&(Xe.current=setTimeout(()=>{if(typeof document>"u")return;const q=document.querySelector(".xterm-helper-textarea");q&&(q.removeAttribute("disabled"),q.focus())},300));return()=>{Xe.current&&(clearTimeout(Xe.current),Xe.current=null)}},[i,l,r,o,p,f,y,h,d,w,x,S,L,M,B,F,I,P,e]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const q=et=>{et.key==="Escape"&&(typeof et.stopPropagation=="function"&&et.stopPropagation(),t())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[e,t]),!e)return null;const Ht=q=>{q.preventDefault();const et=j.trim(),Jr=Y!==f;n(et||kh),a(V),s(Q),c(O),u(W),_(Y),v(ue),m(re),g(ye),b(ne),C(he),E(me),A(ke),D(Ke),H(Pe),$(J),R($e),N(le),t({webglChanged:Jr})},_t=(q,et)=>{ee(Jr=>Jr.map(Qr=>Qr.id===q?{...Qr,...et}:Qr))},zt=q=>{var Qr;const et=V.find(Rs=>Rs.id===q);if(!et||et.isBuiltIn)return;const Jr=V.filter(Rs=>Rs.id!==q);ee(Jr),q===Q&&z(((Qr=Jr[0])==null?void 0:Qr.id)||"claude")},It=()=>{if(!Ve.trim()||!He.trim()||V.length>=si)return;const q={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:Ve.trim(),command:He.trim(),isBuiltIn:!1,agentType:De||void 0};ee([...V,q]),Ie(!1),ot(""),Te(""),ze("")},wn=V.length<si,Ts=q=>{de(!0),Z(q),fetch("/api/settings/tmux-mouse-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:q})}).catch(()=>Z(!q)).finally(()=>de(!1))},la=q=>{const et=fe;je(!0),Ee(q),fetch("/api/settings/inactive-max-age-hours",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:q})}).catch(()=>Ee(et)).finally(()=>je(!1))};return T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:q=>{q.target===q.currentTarget&&t()},children:T.jsxs("form",{onSubmit:Ht,className:"w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"p-6 pb-0",children:[T.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"Settings"}),T.jsx("p",{className:"mt-2 text-xs text-muted text-pretty",children:"Configure default directory, command presets, and display options."})]}),T.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4",children:T.jsxs("div",{className:"mt-5 space-y-4",children:[T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Default Project Directory"}),T.jsx("input",{value:j,onChange:q=>U(q.target.value),placeholder:kh,className:"input",autoFocus:!0})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsxs("div",{className:"flex items-center justify-between mb-2",children:[T.jsx("label",{className:"text-xs text-secondary",children:"Command Presets"}),T.jsx("select",{value:Q,onChange:q=>z(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:V.map(q=>T.jsx("option",{value:q.id,children:q.label},q.id))})]}),T.jsx("p",{className:"text-[10px] text-muted mb-3",children:"Default preset is pre-selected when creating new sessions."}),T.jsx("div",{className:"space-y-3",children:V.map(q=>T.jsxs("div",{className:"border border-border p-3 space-y-2",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsx("div",{className:"flex items-center gap-2",children:T.jsx("input",{value:q.label,onChange:et=>_t(q.id,{label:et.target.value}),className:"input text-sm py-1 px-2 w-32",placeholder:"Label"})}),!q.isBuiltIn&&T.jsx("button",{type:"button",onClick:()=>zt(q.id),className:"btn text-xs px-2 py-1 text-error hover:bg-error/10",children:"Delete"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Command"}),T.jsx("input",{value:q.command,onChange:et=>_t(q.id,{command:et.target.value}),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"})]}),!q.isBuiltIn&&T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Icon"}),T.jsxs("select",{value:q.agentType||"",onChange:et=>_t(q.id,{agentType:et.target.value||void 0}),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal"}),T.jsx("option",{value:"claude",children:"Claude"}),T.jsx("option",{value:"codex",children:"Codex"})]})]})]},q.id))}),Me?T.jsxs("div",{className:"mt-3 border border-border p-3 space-y-2",children:[T.jsx("div",{className:"text-xs text-secondary mb-2",children:"New Preset"}),T.jsx("input",{value:Ve,onChange:q=>ot(q.target.value),className:"input text-xs py-1 px-2 w-full",placeholder:"Label"}),T.jsx("input",{value:He,onChange:q=>Te(q.target.value),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("select",{value:De,onChange:q=>ze(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal Icon"}),T.jsx("option",{value:"claude",children:"Claude Icon"}),T.jsx("option",{value:"codex",children:"Codex Icon"})]}),T.jsx("div",{className:"flex-1"}),T.jsx("button",{type:"button",onClick:()=>Ie(!1),className:"btn text-xs px-2 py-1",children:"Cancel"}),T.jsx("button",{type:"button",onClick:It,disabled:!Ve.trim()||!He.trim(),className:"btn btn-primary text-xs px-2 py-1",children:"Add"})]})]}):T.jsx("button",{type:"button",onClick:()=>Ie(!0),disabled:!wn,className:"btn text-xs mt-3 w-full",children:wn?"+ Add Preset":`Max ${si} presets`})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Session List Order"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${O==="created"?"btn-primary":""}`,onClick:()=>K("created"),children:"Created"}),T.jsx("button",{type:"button",className:`btn flex-1 ${O==="status"?"btn-primary":""}`,onClick:()=>K("status"),children:"Status"}),T.jsx("button",{type:"button",className:`btn flex-1 ${O==="manual"?"btn-primary":""}`,onClick:()=>K("manual"),children:"Manual"})]}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:O==="status"?"Sessions auto-resort by status (waiting, working, unknown)":O==="manual"?"Drag sessions to reorder manually":"Sessions stay in creation order"})]}),O==="created"&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Sort Direction"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${W==="desc"?"btn-primary":""}`,onClick:()=>te("desc"),children:"Newest First"}),T.jsx("button",{type:"button",className:`btn flex-1 ${W==="asc"?"btn-primary":""}`,onClick:()=>te("asc"),children:"Oldest First"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Session List Details"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Project Name"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the project folder name under each session."})]}),T.jsx(Cn,{checked:ke,onCheckedChange:Ne})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Last User Message"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the most recent user input next to the project name."})]}),T.jsx(Cn,{checked:Ke,onCheckedChange:Ae})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Session ID Prefix"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show first 5 characters of agent session IDs in the list."})]}),T.jsx(Cn,{checked:Pe,onCheckedChange:G})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Inactive Sessions Lookback"}),T.jsxs("div",{className:"text-[10px] text-muted",children:["Show inactive sessions from the last N hours (",bu,"-",Cu,")."]})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"number",min:bu,max:Cu,value:fe,onChange:q=>{const et=parseInt(q.target.value,10);et>=bu&&et<=Cu&&la(et)},disabled:Re,className:"input text-xs py-1 px-2 w-16 text-center"}),T.jsx("span",{className:"text-xs text-muted",children:"hrs"})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Notifications"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Permission Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a ping when any session needs permission."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void dd(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(Cn,{checked:$e,onCheckedChange:q=>{X(q),q&&hd()}})]})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Idle Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a chime when a session finishes working."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void fd(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(Cn,{checked:le,onCheckedChange:q=>{ge(q),q&&hd()}})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Terminal Rendering"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"WebGL Acceleration"}),T.jsx("div",{className:"text-[10px] text-muted",children:"GPU rendering for better performance. Turn off if text looks fuzzy or flickering."})]}),T.jsx(Cn,{checked:Y,onCheckedChange:_e})]}),Y!==f&&T.jsx("p",{className:"mt-2 text-[10px] text-approval",children:"Terminal will reload when saved"}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Mouse Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Enable tmux mouse mode for trackpad/scroll wheel support."})]}),T.jsx(Cn,{checked:We,onCheckedChange:Ts,disabled:Le})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Size"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal text size in pixels (6-24)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>se(Math.max(6,ue-1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"−"})}),T.jsx("span",{className:"text-sm text-secondary w-6 text-center",children:ue}),T.jsx("button",{type:"button",onClick:()=>se(Math.min(24,ue+1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"+"})})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Line Height"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Vertical spacing (1.0 = compact, 2.0 = spacious)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"1.0",max:"2.0",step:"0.1",value:re,onChange:q=>ae(parseFloat(q.target.value)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsx("span",{className:"text-xs text-secondary w-8 text-right",children:re.toFixed(1)})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Letter Spacing"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Horizontal spacing between characters in pixels"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"-3",max:"3",step:"1",value:ye,onChange:q=>ve(parseInt(q.target.value,10)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsxs("span",{className:"text-xs text-secondary w-8 text-right",children:[ye,"px"]})]})]}),T.jsxs("div",{className:"mt-4",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Family"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal typeface"})]}),T.jsx("select",{value:ne,onChange:q=>ie(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:Lh.map(q=>T.jsx("option",{value:q.id,children:q.label},q.id))})]}),ne==="custom"&&T.jsx("input",{value:he,onChange:q=>oe(q.target.value),placeholder:'"Fira Code", monospace',className:"input text-xs mt-2 font-mono"})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Dark Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Switch between dark and light themes."})]}),T.jsx(Cn,{checked:J==="dark",onCheckedChange:q=>Oe(q?"dark":"light")})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Keyboard Shortcut Modifier"}),T.jsx("div",{className:"grid grid-cols-5 gap-1",children:["auto","ctrl-option","ctrl-shift","cmd-option","cmd-shift"].map(q=>T.jsx("button",{type:"button",className:`btn text-xs px-2 ${me===q?"btn-primary":""}`,onClick:()=>xe(q),children:q==="auto"?"Auto":ii(q)},q))}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:me==="auto"?`Platform default: ${ii(Zo("auto"))}`:`Shortcuts: ${ii(me)}+[N/X/[/]]`})]})]})}),T.jsxs("div",{className:"flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated",children:[T.jsx("button",{type:"button",onClick:()=>t(),className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save"})]})]})})}const V3=[];function mp(e){k.useEffect(e,V3)}const gp=k.createContext(void 0);function vp(){const e=k.useContext(gp);if(!e)throw new Error(Yr(73));return e}var Jl=Symbol("NOT_FOUND");function K3(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function G3(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function q3(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Iv=e=>Array.isArray(e)?e:[e];function X3(e){const t=Array.isArray(e[0])?e[0]:e;return q3(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Y3(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}function J3(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Jl},put(r,n){t={key:r,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Q3(e,t){let r=[];function n(s){const o=r.findIndex(c=>t(s,c.key));if(o>-1){const c=r[o];return o>0&&(r.splice(o,1),r.unshift(c)),c.value}return Jl}function i(s,o){n(s)===Jl&&(r.unshift({key:s,value:o}),r.length>e&&r.pop())}function a(){return r}function l(){r=[]}return{get:n,put:i,getEntries:a,clear:l}}var Z3=(e,t)=>e===t;function eA(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;const{length:i}=r;for(let a=0;a<i;a++)if(!e(r[a],n[a]))return!1;return!0}}function tA(e,t){const r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=Z3,maxSize:i=1,resultEqualityCheck:a}=r,l=eA(n);let s=0;const o=i<=1?J3(l):Q3(i,l);function c(){let p=o.get(arguments);if(p===Jl){if(p=e.apply(null,arguments),s++,a){const f=o.getEntries().find(_=>a(_.value,p));f&&(p=f.value,s!==0&&s--)}o.put(arguments,p)}return p}return c.clearCache=()=>{o.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}var rA=class{constructor(e){this.value=e}deref(){return this.value}},nA=typeof WeakRef<"u"?WeakRef:rA,sA=0,Bv=1;function Fa(){return{s:sA,v:void 0,o:null,p:null}}function cS(e,t={}){let r=Fa();const{resultEqualityCheck:n}=t;let i,a=0;function l(){var u;let s=r;const{length:o}=arguments;for(let f=0,_=o;f<_;f++){const y=arguments[f];if(typeof y=="function"||typeof y=="object"&&y!==null){let v=s.o;v===null&&(s.o=v=new WeakMap);const h=v.get(y);h===void 0?(s=Fa(),v.set(y,s)):s=h}else{let v=s.p;v===null&&(s.p=v=new Map);const h=v.get(y);h===void 0?(s=Fa(),v.set(y,s)):s=h}}const c=s;let p;if(s.s===Bv)p=s.v;else if(p=e.apply(null,arguments),a++,n){const f=((u=i==null?void 0:i.deref)==null?void 0:u.call(i))??i;f!=null&&n(f,p)&&(p=f,a!==0&&a--),i=typeof p=="object"&&p!==null||typeof p=="function"?new nA(p):p}return c.s=Bv,c.v=p,p}return l.clearCache=()=>{r=Fa(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}function uS(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,l=0,s,o={},c=i.pop();typeof c=="object"&&(o=c,c=i.pop()),K3(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const p={...r,...o},{memoize:u,memoizeOptions:f=[],argsMemoize:_=cS,argsMemoizeOptions:y=[]}=p,v=Iv(f),h=Iv(y),m=X3(i),d=u(function(){return a++,c.apply(null,arguments)},...v),g=_(function(){l++;const b=Y3(m,arguments);return s=d.apply(null,b),s},...h);return Object.assign(g,{resultFunc:c,memoizedResultFunc:d,dependencies:m,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:_})};return Object.assign(n,{withTypes:()=>n}),n}var iA=uS(cS),oA=Object.assign((e,t=iA)=>{G3(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((l,s,o)=>(l[r[o]]=s,l),{}))},{withTypes:()=>oA});const aA=uS({memoize:tA,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),Tr=(e,t,r,n,i,a,...l)=>{if(l.length>0)throw new Error(Yr(1));let s;if(e&&t)s=(o,c,p,u)=>{const f=e(o,c,p,u);return t(f,c,p,u)};else if(e)s=e;else throw new Error("Missing arguments");return s},lA=(...e)=>{const t=new WeakMap;let r=1;const n=e[e.length-1],i=e.length-1||1,a=n.length-i;if(a>3)throw new Error(Yr(2));return(s,o,c,p)=>{let u=s.__cacheKey__;u||(u={id:r},s.__cacheKey__=u,r+=1);let f=t.get(u);if(!f){let _=e;const y=[void 0,void 0,void 0];switch(a){case 0:break;case 1:{_=[...e.slice(0,-1),()=>y[0],n];break}case 2:{_=[...e.slice(0,-1),()=>y[0],()=>y[1],n];break}case 3:{_=[...e.slice(0,-1),()=>y[0],()=>y[1],()=>y[2],n];break}default:throw new Error(Yr(2))}f=aA(..._),f.selectorArgs=y,t.set(u,f)}switch(f.selectorArgs[0]=o,f.selectorArgs[1]=c,f.selectorArgs[2]=p,a){case 0:return f(s);case 1:return f(s,o);case 2:return f(s,o,c);case 3:return f(s,o,c,p);default:throw new Error("unreachable")}}};var hS={exports:{}},dS={};/**
|
|
300
|
+
`,onClick:()=>{xv(),o(Z.id)},children:Le+1},Z.id)})})]}),T.jsxs("div",{className:"relative flex-1",children:[T.jsx("div",{ref:ye,className:"absolute inset-0"}),!e&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted",children:"Select a session to view terminal"}),e&&re&&T.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-center text-sm text-muted",children:"Remote session (read-only). Use SSH to attach on the host."}),B&&e&&!F&&T.jsxs("button",{onClick:he,className:"absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all",style:{transform:"translateX(-50%)"},title:"Scroll to bottom","aria-label":"Scroll to bottom",children:[T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.jsx("path",{d:"M12 5v14M5 12l7 7 7-7"})}),T.jsx("span",{className:"text-sm font-medium",children:"Jump to bottom"})]})]}),e&&T.jsx(QD,{onSendKey:X,disabled:n!=="connected"||re,sessions:t.map(Z=>({id:Z.id,name:Z.name,status:Z.status})),currentSessionId:e.id,onSelectSession:o,hideSessionSwitcher:!0,onRefocus:le,isKeyboardVisible:We,onEnterTextMode:ge}),(D||M)&&T.jsx(ZD,{isOpen:j,onClose:()=>U(!1),sessions:t,inactiveSessions:r,selectedSessionId:(e==null?void 0:e.id)??null,onSelect:o,onRename:u,onResume:f,onSetPinned:_,onNewSession:c,loading:v,error:h}),I&&e&&T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:T.jsxs("div",{className:"mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl",children:[T.jsx("h3",{className:"text-base font-medium text-primary mb-2 text-balance",children:"Kill Session"}),T.jsxs("p",{className:"text-sm text-secondary mb-4 text-pretty",children:['Kill "',e.agentSessionName||e.name,'"? The process will be terminated. Conversation history is preserved in logs.']}),T.jsxs("div",{className:"flex justify-end gap-2",children:[T.jsx("button",{onClick:()=>R(!1),className:"btn py-1.5 px-3 text-sm",children:"Cancel"}),T.jsx("button",{ref:J,onClick:Ne,className:"btn btn-danger py-1.5 px-3 text-sm",children:"Kill Session"})]})]})})]})}function iM({onSelect:e,onCancel:t,initialPath:r}){const[n,i]=k.useState(r||"~"),[a,l]=k.useState(null),[s,o]=k.useState(null),[c,p]=k.useState(!0),[u,f]=k.useState(-1),_=k.useRef(null),y=pe(g=>g.recentPaths),v=k.useCallback(async g=>{var x;(x=_.current)==null||x.abort();const w=new AbortController;_.current=w;const{signal:b}=w;p(!0),o(null),l(null),f(-1),i(g);try{const C=await fetch(`/api/directories?path=${encodeURIComponent(g)}`,{signal:b});if(!C.ok){const E=await C.json();throw new Error(E.message||"Failed to load directory")}const S=await C.json();if(_.current!==w)return;l(S),i(S.path)}catch(C){if(_.current!==w)return;const S=C;(S==null?void 0:S.name)!=="AbortError"&&o((S==null?void 0:S.message)||"Failed to load directory")}finally{_.current===w&&p(!1)}},[]);k.useEffect(()=>(v(r||"~"),()=>{var g;(g=_.current)==null||g.abort()}),[v,r]);const h=(a==null?void 0:a.directories)??[],m=(a==null?void 0:a.path)||n,d=a==null?void 0:a.parent;return k.useEffect(()=>{const g=w=>{if(w.key==="Escape"){w.preventDefault(),t();return}if(!c){if(w.key==="ArrowDown"){w.preventDefault(),f(b=>h.length===0?-1:b<0?0:Math.min(b+1,h.length-1));return}if(w.key==="ArrowUp"){w.preventDefault(),f(b=>h.length===0?-1:b<0?h.length-1:Math.max(b-1,0));return}if(w.key==="Enter"){w.preventDefault();const b=h[u];b?v(b.path):m&&e(m);return}w.key==="Backspace"&&d&&(w.preventDefault(),v(d))}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[h,m,v,u,c,t,e,d]),T.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Directory browser",className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onClick:g=>{g.target===g.currentTarget&&t()},"data-testid":"directory-browser",children:T.jsxs("div",{className:"w-full max-w-lg border border-border bg-elevated p-4",children:[T.jsxs("div",{className:"flex items-center gap-3 border-b border-border pb-2",children:[T.jsx("button",{type:"button",className:"btn",onClick:()=>{d&&v(d)},disabled:!d||c,children:"Up"}),T.jsx("div",{className:"min-w-0 flex-1 truncate text-xs font-mono text-secondary",title:m,"data-testid":"directory-current-path",children:m})]}),T.jsx("div",{className:"mt-3 max-h-60 overflow-y-auto border border-border bg-surface",children:c?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-loading",children:"Loading directories..."}):s?T.jsxs("div",{className:"px-3 py-4 text-xs","data-testid":"directory-error",children:[T.jsx("p",{className:"text-danger",children:s}),T.jsx("button",{type:"button",className:"btn mt-3",onClick:()=>v(n),children:"Retry"})]}):h.length===0?T.jsx("div",{className:"px-3 py-4 text-xs text-muted","data-testid":"directory-empty",children:"No subdirectories"}):T.jsx("div",{className:"py-1",children:h.map((g,w)=>T.jsxs("button",{type:"button",onClick:()=>v(g.path),onMouseEnter:()=>f(w),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${w===u?"bg-hover text-primary":"text-secondary"}`,"data-testid":"directory-entry","data-entry-name":g.name,"data-entry-path":g.path,children:[T.jsx(SC,{width:14,height:14,className:"shrink-0 text-muted","aria-hidden":"true"}),T.jsx("span",{className:"truncate",children:g.name})]},g.path))})}),a!=null&&a.truncated?T.jsx("p",{className:"mt-2 text-[10px] text-muted",children:"Showing first 200 directories."}):null,T.jsxs("div",{className:"mt-4 border-t border-border pt-3",children:[T.jsx("div",{className:"text-[10px] uppercase tracking-wider text-secondary",children:"Recent"}),y.length===0?T.jsx("p",{className:"mt-2 text-xs text-muted",children:"No recent paths yet."}):T.jsx("div",{className:"mt-2 space-y-1",children:y.map(g=>T.jsx("button",{type:"button",className:"block w-full truncate text-left text-xs text-secondary hover:text-primary",onClick:()=>v(g),title:g,"data-testid":"directory-recent","data-recent-path":g,children:g},g))})]}),T.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"button",onClick:()=>{m&&e(m)},className:"btn btn-primary",disabled:c||!m,children:"Select"})]})]})})}function oM({isOpen:e,onClose:t,onCreate:r,defaultProjectDir:n,commandPresets:i,defaultPresetId:a,lastProjectPath:l,activeProjectPath:s,remoteHosts:o=[],remoteAllowControl:c=!1,initialHost:p,initialPath:u,initialCommand:f}){const[_,y]=k.useState(""),[v,h]=k.useState(""),[m,d]=k.useState(null),[g,w]=k.useState(""),[b,x]=k.useState(!1),[C,S]=k.useState(""),E=k.useRef(null),L=k.useRef(null),A=k.useRef(null),M=c&&o.length>0;if(k.useEffect(()=>{if(!e){y(""),h(""),d(null),w(""),x(!1),S(p??""),setTimeout(()=>{if(typeof document>"u"||typeof document.querySelector!="function")return;const U=document.querySelector(".xterm-helper-textarea");U&&(U.removeAttribute("disabled"),U.focus())},300);return}if(typeof document<"u"&&typeof document.querySelector=="function"){const U=document.querySelector(".xterm-helper-textarea");U&&typeof U.setAttribute=="function"&&(typeof U.blur=="function"&&U.blur(),U.setAttribute("disabled","true"))}const N=(u==null?void 0:u.trim())||(s==null?void 0:s.trim())||l||n||"";y(N),h(""),S(p??"");const j=f==null?void 0:f.trim();if(j){const U=i.find(V=>$i(V)===j);U?(d(U.id),w($i(U))):(d(null),w(j))}else{const U=i.find(V=>V.id===a);U?(d(a),w($i(U))):i.length>0?(d(i[0].id),w($i(i[0]))):(d(null),w(""))}setTimeout(()=>{var U;if((U=A.current)==null||U.focus(),L.current){const V=L.current;V.scrollLeft=V.scrollWidth}},50)},[s,i,a,n,e,l,p,u,f]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const N=()=>E.current?Array.from(E.current.querySelectorAll('input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]')):[],j=U=>{var V,ee;if(!b){if(U.key==="Escape"){typeof U.stopPropagation=="function"&&U.stopPropagation(),t();return}if(U.key==="Enter"){const Q=document.activeElement;if(!Q||Q.tagName==="INPUT"||Q.closest('[data-testid="host-select"]')||!Q.closest('[data-testid="command-select"]'))return;U.preventDefault(),typeof U.stopPropagation=="function"&&U.stopPropagation(),(V=E.current)==null||V.requestSubmit();return}if(U.key==="Tab"){U.preventDefault(),typeof U.stopPropagation=="function"&&U.stopPropagation();const Q=N();if(Q.length===0)return;const z=document.activeElement,O=Q.indexOf(z);let K;O===-1?K=U.shiftKey?Q.length-1:0:U.shiftKey?K=O<=0?Q.length-1:O-1:K=O>=Q.length-1?0:O+1,(ee=Q[K])==null||ee.focus()}}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[e,t,b]),!e)return null;const D=N=>{const j=i.find(U=>U.id===N);j&&(d(N),w($i(j)))},B=()=>{d(null),w("")},H=m===null,F=C!=="",$=N=>{N.preventDefault();const j=_.trim();if(!j)return;const U=g.trim();r(j,v.trim()||void 0,U||void 0,F?C:void 0),t()},I=[...i.map(N=>({id:N.id,label:N.label,isCustom:!1,agentType:N.agentType,command:N.command})),{id:"custom",label:"Custom",isCustom:!0,agentType:void 0,command:void 0}],R=[{id:"",label:"Local",ok:!0,error:void 0},...o.map(N=>({id:N.host,label:N.host,ok:N.ok,error:N.error}))],P=_.trim()||"~";return T.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"new-session-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:N=>{N.target===N.currentTarget&&t()},children:[T.jsxs("form",{ref:E,onSubmit:$,className:"w-full max-w-md border border-border bg-elevated p-6",children:[T.jsx("h2",{id:"new-session-title",className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"New Session"}),T.jsxs("div",{className:"mt-4 space-y-4",children:[M&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Host"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Host","data-testid":"host-select",children:R.map((N,j)=>{const U=C===N.id,V=!N.ok&&!U;return T.jsx("button",{type:"button",role:"radio","aria-checked":U,"aria-label":N.label,title:N.ok?void 0:N.error||"Unreachable",tabIndex:U?0:-1,onClick:()=>S(N.id),onKeyDown:ee=>{var W;let Q=j;if(ee.key==="ArrowRight"||ee.key==="ArrowDown")ee.preventDefault(),Q=(j+1)%R.length;else if(ee.key==="ArrowLeft"||ee.key==="ArrowUp")ee.preventDefault(),Q=(j-1+R.length)%R.length;else return;const z=R[Q];S(z.id);const O=ee.currentTarget.parentElement,K=O==null?void 0:O.querySelectorAll('[role="radio"]');(W=K==null?void 0:K[Q])==null||W.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${U?"btn-primary":""} ${V?"opacity-60":""}`,children:N.label},N.id||"local")})})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Command"}),T.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Command preset","data-testid":"command-select",children:I.map((N,j)=>{const U=N.isCustom?H:m===N.id;return T.jsxs("button",{ref:U?A:void 0,type:"button",role:"radio","aria-checked":U,tabIndex:U?0:-1,onClick:()=>{N.isCustom?B():D(N.id)},onKeyDown:V=>{var K;let ee=j;if(V.key==="ArrowRight"||V.key==="ArrowDown")V.preventDefault(),ee=(j+1)%I.length;else if(V.key==="ArrowLeft"||V.key==="ArrowUp")V.preventDefault(),ee=(j-1+I.length)%I.length;else return;const Q=I[ee];Q.isCustom?B():D(Q.id);const z=V.currentTarget.parentElement,O=z==null?void 0:z.querySelectorAll('[role="radio"]');(K=O==null?void 0:O[ee])==null||K.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${U?"btn-primary":""}`,children:[T.jsx(bc,{agentType:N.agentType,command:N.command,className:"inline-block h-3.5 w-3.5 shrink-0"}),N.label]},N.id)})}),T.jsx("input",{value:g,onChange:N=>w(N.target.value),placeholder:"Enter command...",className:"input mt-2 font-mono text-xs"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Project Path"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("input",{ref:L,value:_,onChange:N=>y(N.target.value),placeholder:F?"/home/user/project":s||l||n||"/Users/you/code/my-project",className:"input flex-1 text-sm"}),!F&&T.jsx("button",{type:"button",className:"btn",onClick:()=>x(!0),children:"Browse"})]})]}),T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Display Name"}),T.jsx("input",{value:v,onChange:N=>h(N.target.value),placeholder:"auto-generated",className:"input text-sm placeholder:italic"})]})]}),T.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[T.jsx("button",{type:"button",onClick:t,className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Create"})]})]}),b&&!F&&T.jsx(iM,{initialPath:P,onSelect:N=>{y(N),x(!1)},onCancel:()=>x(!1)})]})}const bu=1,Cu=168;function aM({controlled:e,default:t,name:r,state:n="value"}){const{current:i}=k.useRef(e!==void 0),[a,l]=k.useState(t),s=i?e:a,o=k.useCallback(c=>{i||l(c)},[]);return[s,o]}const bv={};function ks(e,t){const r=k.useRef(bv);return r.current===bv&&(r.current=e(t)),r}const Eu=Yv[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],lM=Eu&&Eu!==k.useLayoutEffect?Eu:e=>e();function Xr(e){const t=ks(cM).current;return t.next=e,lM(t.effect),t.trampoline}function cM(){const e={next:void 0,callback:uM,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function uM(){}function od(e,t,r,n){const i=ks(Nw).current;return dM(i,e,t,r,n)&&jw(i,[e,t,r,n]),i.callback}function hM(e){const t=ks(Nw).current;return fM(t,e)&&jw(t,e),t.callback}function Nw(){return{callback:null,cleanup:null,refs:[]}}function dM(e,t,r,n,i){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==n||e.refs[3]!==i}function fM(e,t){return e.refs.length!==t.length||e.refs.some((r,n)=>r!==t[n])}function jw(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const n=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const l=a(r);typeof l=="function"&&(n[i]=l);break}case"object":{a.current=r;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const l=n[i];typeof l=="function"?l():a(null);break}case"object":{a.current=null;break}}}}}}}const pM=()=>{},qt=typeof document<"u"?k.useLayoutEffect:pM,Fw={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},op={...Fw,position:"fixed",top:0,left:0},mM={...Fw,position:"absolute"};function ur(){}const zr=Object.freeze({});function Yr(e,...t){const r=new URL("https://base-ui.com/production-error");return r.searchParams.set("code",e.toString()),t.forEach(n=>r.searchParams.append("args[]",n)),`Base UI error #${e}; visit ${r} for the full message.`}const gM=parseInt(k.version,10);function ap(e){return gM>=e}function Cv(e){if(!k.isValidElement(e))return null;const t=e,r=t.props;return(ap(19)?r==null?void 0:r.ref:t.ref)??null}function ad(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function vM(e,t){const r={};for(const n in e){const i=e[n];if(t!=null&&t.hasOwnProperty(n)){const a=t[n](i);a!=null&&Object.assign(r,a);continue}i===!0?r[`data-${n.toLowerCase()}`]="":i&&(r[`data-${n.toLowerCase()}`]=i.toString())}return r}function _M(e,t){return typeof e=="function"?e(t):e}function yM(e,t){return typeof e=="function"?e(t):e}const vo={};function lp(e,t,r,n,i){let a={...ld(e,vo)};return t&&(a=cl(a,t)),r&&(a=cl(a,r)),n&&(a=cl(a,n)),a}function wM(e){if(e.length===0)return vo;if(e.length===1)return ld(e[0],vo);let t={...ld(e[0],vo)};for(let r=1;r<e.length;r+=1)t=cl(t,e[r]);return t}function cl(e,t){return $w(t)?t(e):SM(e,t)}function SM(e,t){if(!t)return e;for(const r in t){const n=t[r];switch(r){case"style":{e[r]=ad(e.style,n);break}case"className":{e[r]=Hw(e.className,n);break}default:xM(r,n)?e[r]=bM(e[r],n):e[r]=n}}return e}function xM(e,t){const r=e.charCodeAt(0),n=e.charCodeAt(1),i=e.charCodeAt(2);return r===111&&n===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function $w(e){return typeof e=="function"}function ld(e,t){return $w(e)?e(t):e??vo}function bM(e,t){return t?e?r=>{if(CM(r)){const i=r;cd(i);const a=t(i);return i.baseUIHandlerPrevented||e==null||e(i),a}const n=t(r);return e==null||e(r),n}:t:e}function cd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Hw(e,t){return t?e?t+" "+e:t:e}function CM(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ls(e,t,r={}){const n=t.render,i=EM(t,r);if(r.enabled===!1)return null;const a=r.state??zr;return LM(e,n,i,a)}function EM(e,t={}){const{className:r,style:n,render:i}=e,{state:a=zr,ref:l,props:s,stateAttributesMapping:o,enabled:c=!0}=t,p=c?_M(r,a):void 0,u=c?yM(n,a):void 0,f=c?vM(a,o):zr,_=c?ad(f,Array.isArray(s)?wM(s):s)??zr:zr;return typeof document<"u"&&(c?Array.isArray(l)?_.ref=hM([_.ref,Cv(i),...l]):_.ref=od(_.ref,Cv(i),l):od(null,null)),c?(p!==void 0&&(_.className=Hw(_.className,p)),u!==void 0&&(_.style=ad(_.style,u)),_):zr}const kM=Symbol.for("react.lazy");function LM(e,t,r,n){if(t){if(typeof t=="function")return t(r,n);const i=lp(r,t.props);i.ref=r.ref;let a=t;return(a==null?void 0:a.$$typeof)===kM&&(a=k.Children.toArray(t)[0]),k.cloneElement(a,i)}if(e&&typeof e=="string")return TM(e,r);throw new Error(Yr(8))}function TM(e,t){return e==="button"?k.createElement("button",{type:"button",...t,key:t.key}):e==="img"?k.createElement("img",{alt:"",...t,key:t.key}):k.createElement(e,t)}const RM={...Yv};let Ev=0;function DM(e,t="mui"){const[r,n]=k.useState(e),i=e||r;return k.useEffect(()=>{r==null&&(Ev+=1,n(`${t}-${Ev}`))},[r,t]),i}const kv=RM.useId;function cp(e,t){if(kv!==void 0){const r=kv();return e??(t?`${t}-${r}`:r)}return DM(e,t)}function zw(e){return cp(e,"base-ui")}function up(){return typeof window<"u"}function Vo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function MM(e){return up()?e instanceof Element||e instanceof Vo(e).Element:!1}function AM(e){return up()?e instanceof HTMLElement||e instanceof Vo(e).HTMLElement:!1}function PM(e){return!up()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vo(e).ShadowRoot}const IM=k.createContext(void 0);function BM(e=!1){const t=k.useContext(IM);if(t===void 0&&!e)throw new Error(Yr(16));return t}function OM(e){const{focusableWhenDisabled:t,disabled:r,composite:n=!1,tabIndex:i=0,isNativeButton:a}=e,l=n&&t!==!1,s=n&&t===!1;return{props:k.useMemo(()=>{const c={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return n||(c.tabIndex=i,!a&&r&&(c.tabIndex=t?i:-1)),(a&&(t||l)||!a&&r)&&(c["aria-disabled"]=r),a&&(!t||s)&&(c.disabled=r),c},[n,r,t,l,s,a,i])}}function Uw(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:n=0,native:i=!0}=e,a=k.useRef(null),l=BM(!0)!==void 0,s=Xr(()=>{const f=a.current;return!!((f==null?void 0:f.tagName)==="A"&&(f!=null&&f.href))}),{props:o}=OM({focusableWhenDisabled:r,disabled:t,composite:l,tabIndex:n,isNativeButton:i}),c=k.useCallback(()=>{const f=a.current;NM(f)&&l&&t&&o.disabled===void 0&&f.disabled&&(f.disabled=!1)},[t,o.disabled,l]);qt(c,[c]);const p=k.useCallback((f={})=>{const{onClick:_,onMouseDown:y,onKeyUp:v,onKeyDown:h,onPointerDown:m,...d}=f;return lp({type:i?"button":void 0,onClick(w){if(t){w.preventDefault();return}_==null||_(w)},onMouseDown(w){t||y==null||y(w)},onKeyDown(w){if(t||(cd(w),h==null||h(w)),w.baseUIHandlerPrevented)return;const b=w.target===w.currentTarget&&!i&&!s()&&!t,x=w.key==="Enter",C=w.key===" ";b&&((C||x)&&w.preventDefault(),x&&(_==null||_(w)))},onKeyUp(w){t||(cd(w),v==null||v(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!i&&!t&&w.key===" "&&(_==null||_(w))},onPointerDown(w){if(t){w.preventDefault();return}m==null||m(w)}},i?void 0:{role:"button"},o,d)},[t,o,i,s]),u=Xr(f=>{a.current=f,c()});return{getButtonProps:p,buttonRef:u}}function NM(e){return AM(e)&&e.tagName==="BUTTON"}const Ww=k.createContext(void 0);function jM(){const e=k.useContext(Ww);if(e===void 0)throw new Error(Yr(63));return e}let Lv=function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const FM={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},$M={valid(e){return e===null?null:e?{[Lv.valid]:""}:{[Lv.invalid]:""}}};let Tv=function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e}({});const Vw={...$M,checked(e){return e?{[Tv.checked]:""}:{[Tv.unchecked]:""}}};function HM(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const zM=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:ur,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Kw(){return k.useContext(zM)}const UM=k.createContext({invalid:void 0,name:void 0,validityData:{state:FM,errors:[],error:"",value:"",initialValue:null},setValidityData:ur,disabled:void 0,touched:!1,setTouched:ur,dirty:!1,setDirty:ur,filled:!1,setFilled:ur,focused:!1,setFocused:ur,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=zr)=>e,getInputValidationProps:(e=zr)=>e,inputRef:{current:null},commit:async()=>{}}});function hp(e=!0){const t=k.useContext(UM);if(t.setValidityData===ur&&!e)throw new Error(Yr(28));return t}function WM(e){const{enabled:t=!0,value:r,id:n,name:i,controlRef:a,commit:l}=e,{formRef:s}=Kw(),{invalid:o,markedDirtyRef:c,validityData:p,setValidityData:u}=hp(),f=Xr(e.getValue);qt(()=>{if(!t)return;let _=r;_===void 0&&(_=f()),p.initialValue===null&&_!==null&&u(y=>({...y,initialValue:_}))},[t,u,r,p.initialValue,f]),qt(()=>{!t||!n||s.current.fields.set(n,{getValue:f,name:i,controlRef:a,validityData:HM(p,o),validate(_=!0){let y=r;y===void 0&&(y=f()),c.current=!0,_?hn.flushSync(()=>l(y)):l(y)}})},[l,a,t,s,f,n,o,c,i,p,r]),qt(()=>{const _=s.current.fields;return()=>{n&&_.delete(n)}},[s,n])}const VM=k.createContext({controlId:void 0,registerControlId:ur,labelId:void 0,setLabelId:ur,messageIds:[],setMessageIds:ur,getDescriptionProps:e=>e});function Gw(){return k.useContext(VM)}function KM(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:i,registerControlId:a}=Gw(),l=zw(t),s=r?i:void 0,o=ks(()=>Symbol("labelable-control")),c=k.useRef(!1),p=k.useRef(t!=null),u=Xr(()=>{!c.current||a===ur||(c.current=!1,a(o.current,void 0))});return qt(()=>{if(a===ur)return;let f;if(r){const _=n==null?void 0:n.current;MM(_)&&_.closest("label")!=null?f=t??null:f=s??l}else if(t!=null)p.current=!0,f=t;else if(p.current)f=l;else{u();return}if(f===void 0){u();return}c.current=!0,a(o.current,f)},[t,n,s,a,r,l,o,u]),k.useEffect(()=>u,[u]),i??l}const GM="none";function qM(e,t,r,n){let i=!1,a=!1;const l=zr;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:r,...l}}function XM(e,t){const r=k.useRef(e),n=Xr(t);qt(()=>{r.current!==e&&n(r.current)},[e,n]),qt(()=>{r.current=e},[e])}const YM=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:a,id:l,inputRef:s,name:o,nativeButton:c=!1,onCheckedChange:p,readOnly:u=!1,required:f=!1,disabled:_=!1,render:y,uncheckedValue:v,value:h,...m}=t,{clearErrors:d}=Kw(),{state:g,setTouched:w,setDirty:b,validityData:x,setFilled:C,setFocused:S,shouldValidateOnChange:E,validationMode:L,disabled:A,name:M,validation:D}=hp(),{labelId:B}=Gw(),H=A||_,F=M??o,$=Xr(p),I=k.useRef(null),R=od(I,s,D.inputRef),P=k.useRef(null),N=zw(),j=KM({id:l,implicit:!1,controlRef:P}),U=c?void 0:j,[V,ee]=aM({controlled:n,default:!!a,name:"Switch",state:"checked"});WM({id:N,commit:D.commit,value:V,controlRef:P,name:F,getValue:()=>V}),qt(()=>{I.current&&C(I.current.checked)},[I,C]),XM(V,()=>{d(F),b(V!==x.initialValue),C(V),E()?D.commit(V):D.commit(V,!0)});const{getButtonProps:Q,buttonRef:z}=Uw({disabled:H,native:c}),O={id:c?j:N,role:"switch","aria-checked":V,"aria-readonly":u||void 0,"aria-required":f||void 0,"aria-labelledby":B,onFocus(){H||S(!0)},onBlur(){const J=I.current;!J||H||(w(!0),S(!1),L==="onBlur"&&D.commit(J.checked))},onClick(J){var _e;u||H||(J.preventDefault(),(_e=I.current)==null||_e.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:J.shiftKey,ctrlKey:J.ctrlKey,altKey:J.altKey,metaKey:J.metaKey})))}},K=k.useMemo(()=>lp({checked:V,disabled:H,id:U,name:F,required:f,style:F?mM:op,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:R,onChange(J){if(J.nativeEvent.defaultPrevented)return;const _e=J.target.checked,ue=qM(GM,J.nativeEvent);$==null||$(_e,ue),!ue.isCanceled&&ee(_e)},onFocus(){var J;(J=P.current)==null||J.focus()}},D.getInputValidationProps,h!==void 0?{value:h}:zr),[V,H,R,U,F,$,f,ee,D,h]),W=k.useMemo(()=>({...g,checked:V,disabled:H,readOnly:u,required:f}),[g,V,H,u,f]),te=Ls("span",t,{state:W,ref:[r,P,z],props:[O,D.getValidationProps,m,Q],stateAttributesMapping:Vw});return T.jsxs(Ww.Provider,{value:W,children:[te,!V&&F&&v!==void 0&&T.jsx("input",{type:"hidden",name:F,value:v}),T.jsx("input",{...K})]})}),JM=k.forwardRef(function(t,r){const{render:n,className:i,...a}=t,{state:l}=hp(),s=jM(),o={...l,...s};return Ls("span",t,{state:o,ref:r,stateAttributesMapping:Vw,props:a})});function qw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=qw(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function QM(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=qw(e))&&(n&&(n+=" "),n+=t);return n}const ZM=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},e3=(e,t)=>({classGroupId:e,validator:t}),Xw=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ql="-",Rv=[],t3="arbitrary..",r3=e=>{const t=s3(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return n3(l);const s=l.split(ql),o=s[0]===""&&s.length>1?1:0;return Yw(s,o,t)},getConflictingClassGroupIds:(l,s)=>{if(s){const o=n[l],c=r[l];return o?c?ZM(c,o):o:c||Rv}return r[l]||Rv}}},Yw=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],a=r.nextPart.get(i);if(a){const c=Yw(e,t+1,a);if(c)return c}const l=r.validators;if(l===null)return;const s=t===0?e.join(ql):e.slice(t).join(ql),o=l.length;for(let c=0;c<o;c++){const p=l[c];if(p.validator(s))return p.classGroupId}},n3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?t3+n:void 0})(),s3=e=>{const{theme:t,classGroups:r}=e;return i3(r,t)},i3=(e,t)=>{const r=Xw();for(const n in e){const i=e[n];dp(i,r,n,t)}return r},dp=(e,t,r,n)=>{const i=e.length;for(let a=0;a<i;a++){const l=e[a];o3(l,t,r,n)}},o3=(e,t,r,n)=>{if(typeof e=="string"){a3(e,t,r);return}if(typeof e=="function"){l3(e,t,r,n);return}c3(e,t,r,n)},a3=(e,t,r)=>{const n=e===""?t:Jw(t,e);n.classGroupId=r},l3=(e,t,r,n)=>{if(u3(e)){dp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(e3(r,e))},c3=(e,t,r,n)=>{const i=Object.entries(e),a=i.length;for(let l=0;l<a;l++){const[s,o]=i[l];dp(o,Jw(t,s),r,n)}},Jw=(e,t)=>{let r=e;const n=t.split(ql),i=n.length;for(let a=0;a<i;a++){const l=n[a];let s=r.nextPart.get(l);s||(s=Xw(),r.nextPart.set(l,s)),r=s}return r},u3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,h3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return i(a,l),l},set(a,l){a in r?r[a]=l:i(a,l)}}},ud="!",Dv=":",d3=[],Mv=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),f3=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const a=[];let l=0,s=0,o=0,c;const p=i.length;for(let v=0;v<p;v++){const h=i[v];if(l===0&&s===0){if(h===Dv){a.push(i.slice(o,v)),o=v+1;continue}if(h==="/"){c=v;continue}}h==="["?l++:h==="]"?l--:h==="("?s++:h===")"&&s--}const u=a.length===0?i:i.slice(o);let f=u,_=!1;u.endsWith(ud)?(f=u.slice(0,-1),_=!0):u.startsWith(ud)&&(f=u.slice(1),_=!0);const y=c&&c>o?c-o:void 0;return Mv(a,_,f,y)};if(t){const i=t+Dv,a=n;n=l=>l.startsWith(i)?a(l.slice(i.length)):Mv(d3,!1,l,void 0,!0)}if(r){const i=n;n=a=>r({className:a,parseClassName:i})}return n},p3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let a=0;a<r.length;a++){const l=r[a],s=l[0]==="[",o=t.has(l);s||o?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(l)):i.push(l)}return i.length>0&&(i.sort(),n.push(...i)),n}},m3=e=>({cache:h3(e.cacheSize),parseClassName:f3(e),sortModifiers:p3(e),...r3(e)}),g3=/\s+/,v3=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a}=t,l=[],s=e.trim().split(g3);let o="";for(let c=s.length-1;c>=0;c-=1){const p=s[c],{isExternal:u,modifiers:f,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:v}=r(p);if(u){o=p+(o.length>0?" "+o:o);continue}let h=!!v,m=n(h?y.substring(0,v):y);if(!m){if(!h){o=p+(o.length>0?" "+o:o);continue}if(m=n(y),!m){o=p+(o.length>0?" "+o:o);continue}h=!1}const d=f.length===0?"":f.length===1?f[0]:a(f).join(":"),g=_?d+ud:d,w=g+m;if(l.indexOf(w)>-1)continue;l.push(w);const b=i(m,h);for(let x=0;x<b.length;++x){const C=b[x];l.push(g+C)}o=p+(o.length>0?" "+o:o)}return o},_3=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Qw(r))&&(i&&(i+=" "),i+=n);return i},Qw=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Qw(e[n]))&&(r&&(r+=" "),r+=t);return r},y3=(e,...t)=>{let r,n,i,a;const l=o=>{const c=t.reduce((p,u)=>u(p),e());return r=m3(c),n=r.cache.get,i=r.cache.set,a=s,s(o)},s=o=>{const c=n(o);if(c)return c;const p=v3(o,r);return i(o,p),p};return a=l,(...o)=>a(_3(...o))},w3=[],yt=e=>{const t=r=>r[e]||w3;return t.isThemeGetter=!0,t},Zw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,S3=/^\d+\/\d+$/,x3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,b3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,C3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,E3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,k3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Is=e=>S3.test(e),Fe=e=>!!e&&!Number.isNaN(Number(e)),bn=e=>!!e&&Number.isInteger(Number(e)),ku=e=>e.endsWith("%")&&Fe(e.slice(0,-1)),rn=e=>x3.test(e),L3=()=>!0,T3=e=>b3.test(e)&&!C3.test(e),tS=()=>!1,R3=e=>E3.test(e),D3=e=>k3.test(e),M3=e=>!be(e)&&!Ce(e),A3=e=>Di(e,sS,tS),be=e=>Zw.test(e),ns=e=>Di(e,iS,T3),Lu=e=>Di(e,N3,Fe),Av=e=>Di(e,rS,tS),P3=e=>Di(e,nS,D3),Na=e=>Di(e,oS,R3),Ce=e=>eS.test(e),zi=e=>Mi(e,iS),I3=e=>Mi(e,j3),Pv=e=>Mi(e,rS),B3=e=>Mi(e,sS),O3=e=>Mi(e,nS),ja=e=>Mi(e,oS,!0),Di=(e,t,r)=>{const n=Zw.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Mi=(e,t,r=!1)=>{const n=eS.exec(e);return n?n[1]?t(n[1]):r:!1},rS=e=>e==="position"||e==="percentage",nS=e=>e==="image"||e==="url",sS=e=>e==="length"||e==="size"||e==="bg-size",iS=e=>e==="length",N3=e=>e==="number",j3=e=>e==="family-name",oS=e=>e==="shadow",F3=()=>{const e=yt("color"),t=yt("font"),r=yt("text"),n=yt("font-weight"),i=yt("tracking"),a=yt("leading"),l=yt("breakpoint"),s=yt("container"),o=yt("spacing"),c=yt("radius"),p=yt("shadow"),u=yt("inset-shadow"),f=yt("text-shadow"),_=yt("drop-shadow"),y=yt("blur"),v=yt("perspective"),h=yt("aspect"),m=yt("ease"),d=yt("animate"),g=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],b=()=>[...w(),Ce,be],x=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],S=()=>[Ce,be,o],E=()=>[Is,"full","auto",...S()],L=()=>[bn,"none","subgrid",Ce,be],A=()=>["auto",{span:["full",bn,Ce,be]},bn,Ce,be],M=()=>[bn,"auto",Ce,be],D=()=>["auto","min","max","fr",Ce,be],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...S()],$=()=>[Is,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],I=()=>[e,Ce,be],R=()=>[...w(),Pv,Av,{position:[Ce,be]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],N=()=>["auto","cover","contain",B3,A3,{size:[Ce,be]}],j=()=>[ku,zi,ns],U=()=>["","none","full",c,Ce,be],V=()=>["",Fe,zi,ns],ee=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[Fe,ku,Pv,Av],O=()=>["","none",y,Ce,be],K=()=>["none",Fe,Ce,be],W=()=>["none",Fe,Ce,be],te=()=>[Fe,Ce,be],J=()=>[Is,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[L3],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[M3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",Fe],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Is,be,Ce,h]}],container:["container"],columns:[{columns:[Fe,be,Ce,s]}],"break-after":[{"break-after":g()}],"break-before":[{"break-before":g()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{start:E()}],end:[{end:E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[bn,"auto",Ce,be]}],basis:[{basis:[Is,"full","auto",s,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,Is,"auto","initial","none",be]}],grow:[{grow:["",Fe,Ce,be]}],shrink:[{shrink:["",Fe,Ce,be]}],order:[{order:[bn,"first","last","none",Ce,be]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],w:[{w:[s,"screen",...$()]}],"min-w":[{"min-w":[s,"screen","none",...$()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[l]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",r,zi,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ce,Lu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ku,be]}],"font-family":[{font:[I3,be,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ce,be]}],"line-clamp":[{"line-clamp":[Fe,"none",Ce,Lu]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",Ce,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Ce,ns]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Fe,"auto",Ce,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},bn,Ce,be],radial:["",Ce,be],conic:[bn,Ce,be]},O3,P3]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Ce,be]}],"outline-w":[{outline:["",Fe,zi,ns]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",p,ja,Na]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",u,ja,Na]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Fe,ns]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,ja,Na]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Fe,Ce,be]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Ce,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,be]}],filter:[{filter:["","none",Ce,be]}],blur:[{blur:O()}],brightness:[{brightness:[Fe,Ce,be]}],contrast:[{contrast:[Fe,Ce,be]}],"drop-shadow":[{"drop-shadow":["","none",_,ja,Na]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",Fe,Ce,be]}],"hue-rotate":[{"hue-rotate":[Fe,Ce,be]}],invert:[{invert:["",Fe,Ce,be]}],saturate:[{saturate:[Fe,Ce,be]}],sepia:[{sepia:["",Fe,Ce,be]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,be]}],"backdrop-blur":[{"backdrop-blur":O()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Ce,be]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Ce,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Ce,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Ce,be]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Ce,be]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Ce,be]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Ce,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Ce,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Ce,be]}],ease:[{ease:["linear","initial",m,Ce,be]}],delay:[{delay:[Fe,Ce,be]}],animate:[{animate:["none",d,Ce,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Ce,be]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[Ce,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,be]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[Fe,zi,ns,Lu]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$3=y3(F3);function Xl(...e){return $3(QM(e))}function Cn({checked:e,onCheckedChange:t,disabled:r,className:n}){return T.jsx(YM,{checked:e,onCheckedChange:t,disabled:r,className:Xl("group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","bg-border data-[checked]:bg-accent","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base","disabled:cursor-not-allowed disabled:opacity-50",n),children:T.jsx(JM,{className:Xl("pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform","translate-x-1 group-data-[checked]:translate-x-5")})})}let Ar=null,fp=!1;const Yl={},aS=500;function pp(){if(typeof window>"u")return null;if((Ar==null?void 0:Ar.state)==="closed"&&(Ar=null),!Ar){const e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Ar=new e}return Ar}function H3(){Ar&&(Ar.close().catch(()=>{}),Ar=null),pp()}function z3(){return fp}function Tu(){Ar&&(H3(),fp=!0)}if(typeof window<"u"){window.addEventListener("pageshow",t=>{t.persisted&&Tu()}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Tu()});let e=Date.now();setInterval(()=>{const t=Date.now();t-e>15e3&&Tu(),e=t},5e3)}async function hd(){const e=pp();e&&e.state==="suspended"&&await e.resume().catch(()=>{}),fp=!1}async function U3(e){e.state==="suspended"&&await e.resume().catch(()=>{})}async function lS(e){const t=pp();if(!t||(await U3(t),t.state!=="running"))return;const{frequencies:r,durationMs:n,attackMs:i,peakGain:a,type:l="sine"}=e,s=t.currentTime,o=n/1e3,c=i/1e3,p=t.createGain();p.connect(t.destination);const u=s+o*.7;p.gain.setValueAtTime(0,s),p.gain.linearRampToValueAtTime(a,s+c),p.gain.setValueAtTime(a,u),p.gain.linearRampToValueAtTime(0,s+o);const f=r.map(y=>{const v=t.createOscillator();return v.type=l,v.frequency.setValueAtTime(y,s),v.connect(p),v});for(const y of f)y.start(s),y.stop(s+o);const _=f[f.length-1];_.onended=()=>{for(const y of f)y.disconnect();p.disconnect()}}async function dd(){const e=Date.now();if(!(e-(Yl.permission||0)<aS)){Yl.permission=e;try{await lS({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:"sine"})}catch{}}}async function fd(){const e=Date.now();if(!(e-(Yl.idle||0)<aS)){Yl.idle=e;try{await lS({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:"sine"})}catch{}}}function W3({isOpen:e,onClose:t}){const r=pe(q=>q.defaultProjectDir),n=pe(q=>q.setDefaultProjectDir),i=pe(q=>q.commandPresets),a=pe(q=>q.setCommandPresets),l=pe(q=>q.defaultPresetId),s=pe(q=>q.setDefaultPresetId),o=pe(q=>q.sessionSortMode),c=pe(q=>q.setSessionSortMode),p=pe(q=>q.sessionSortDirection),u=pe(q=>q.setSessionSortDirection),f=pe(q=>q.useWebGL),_=pe(q=>q.setUseWebGL),y=pe(q=>q.fontSize),v=pe(q=>q.setFontSize),h=pe(q=>q.lineHeight),m=pe(q=>q.setLineHeight),d=pe(q=>q.letterSpacing),g=pe(q=>q.setLetterSpacing),w=pe(q=>q.fontOption),b=pe(q=>q.setFontOption),x=pe(q=>q.customFontFamily),C=pe(q=>q.setCustomFontFamily),S=pe(q=>q.shortcutModifier),E=pe(q=>q.setShortcutModifier),L=pe(q=>q.showProjectName),A=pe(q=>q.setShowProjectName),M=pe(q=>q.showLastUserMessage),D=pe(q=>q.setShowLastUserMessage),B=pe(q=>q.showSessionIdPrefix),H=pe(q=>q.setShowSessionIdPrefix),F=Gl(q=>q.theme),$=Gl(q=>q.setTheme),I=pe(q=>q.soundOnPermission),R=pe(q=>q.setSoundOnPermission),P=pe(q=>q.soundOnIdle),N=pe(q=>q.setSoundOnIdle),[j,U]=k.useState(r),[V,ee]=k.useState(i),[Q,z]=k.useState(l),[O,K]=k.useState(o),[W,te]=k.useState(p),[J,_e]=k.useState(f),[ue,se]=k.useState(y),[re,ae]=k.useState(h),[ye,ve]=k.useState(d),[ne,ie]=k.useState(w),[he,oe]=k.useState(x),[me,xe]=k.useState(S),[ke,Ne]=k.useState(L),[Ke,Ae]=k.useState(M),[Pe,G]=k.useState(B),[Y,Oe]=k.useState(F),[$e,X]=k.useState(I),[le,ge]=k.useState(P),[We,Z]=k.useState(!0),[Le,de]=k.useState(!1),[fe,Ee]=k.useState(24),[Re,je]=k.useState(!1),[Me,Ie]=k.useState(!1),[Ve,ot]=k.useState(""),[He,Te]=k.useState(""),[De,ze]=k.useState(""),Xe=k.useRef(null);if(k.useEffect(()=>{if(Xe.current&&(clearTimeout(Xe.current),Xe.current=null),e){if(U(r),ee(i),z(l),K(o),te(p),_e(f),se(y),ae(h),ve(d),ie(w),oe(x),xe(S),Ne(L),Ae(M),G(B),Oe(F),X(I),ge(P),Ie(!1),ot(""),Te(""),ze(""),fetch("/api/settings/tmux-mouse-mode").then(q=>q.json()).then(q=>Z(q.enabled)).catch(()=>{}),fetch("/api/settings/inactive-max-age-hours").then(q=>q.json()).then(q=>Ee(q.hours)).catch(()=>{}),typeof document<"u"){const q=document.querySelector(".xterm-helper-textarea");q&&typeof q.setAttribute=="function"&&(typeof q.blur=="function"&&q.blur(),q.setAttribute("disabled","true"))}}else typeof document<"u"&&(Xe.current=setTimeout(()=>{if(typeof document>"u")return;const q=document.querySelector(".xterm-helper-textarea");q&&(q.removeAttribute("disabled"),q.focus())},300));return()=>{Xe.current&&(clearTimeout(Xe.current),Xe.current=null)}},[i,l,r,o,p,f,y,h,d,w,x,S,L,M,B,F,I,P,e]),k.useEffect(()=>{if(!e||typeof window>"u"||typeof window.addEventListener!="function")return;const q=et=>{et.key==="Escape"&&(typeof et.stopPropagation=="function"&&et.stopPropagation(),t())};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[e,t]),!e)return null;const Ht=q=>{q.preventDefault();const et=j.trim(),Jr=J!==f;n(et||kh),a(V),s(Q),c(O),u(W),_(J),v(ue),m(re),g(ye),b(ne),C(he),E(me),A(ke),D(Ke),H(Pe),$(Y),R($e),N(le),t({webglChanged:Jr})},_t=(q,et)=>{ee(Jr=>Jr.map(Qr=>Qr.id===q?{...Qr,...et}:Qr))},zt=q=>{var Qr;const et=V.find(Rs=>Rs.id===q);if(!et||et.isBuiltIn)return;const Jr=V.filter(Rs=>Rs.id!==q);ee(Jr),q===Q&&z(((Qr=Jr[0])==null?void 0:Qr.id)||"claude")},It=()=>{if(!Ve.trim()||!He.trim()||V.length>=si)return;const q={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:Ve.trim(),command:He.trim(),isBuiltIn:!1,agentType:De||void 0};ee([...V,q]),Ie(!1),ot(""),Te(""),ze("")},wn=V.length<si,Ts=q=>{de(!0),Z(q),fetch("/api/settings/tmux-mouse-mode",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:q})}).catch(()=>Z(!q)).finally(()=>de(!1))},la=q=>{const et=fe;je(!0),Ee(q),fetch("/api/settings/inactive-max-age-hours",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:q})}).catch(()=>Ee(et)).finally(()=>je(!1))};return T.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:q=>{q.target===q.currentTarget&&t()},children:T.jsxs("form",{onSubmit:Ht,className:"w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated",children:[T.jsxs("div",{className:"p-6 pb-0",children:[T.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-primary text-balance",children:"Settings"}),T.jsx("p",{className:"mt-2 text-xs text-muted text-pretty",children:"Configure default directory, command presets, and display options."})]}),T.jsx("div",{className:"flex-1 overflow-y-auto px-6 pb-4",children:T.jsxs("div",{className:"mt-5 space-y-4",children:[T.jsxs("div",{children:[T.jsx("label",{className:"mb-1.5 block text-xs text-secondary",children:"Default Project Directory"}),T.jsx("input",{value:j,onChange:q=>U(q.target.value),placeholder:kh,className:"input",autoFocus:!0})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsxs("div",{className:"flex items-center justify-between mb-2",children:[T.jsx("label",{className:"text-xs text-secondary",children:"Command Presets"}),T.jsx("select",{value:Q,onChange:q=>z(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:V.map(q=>T.jsx("option",{value:q.id,children:q.label},q.id))})]}),T.jsx("p",{className:"text-[10px] text-muted mb-3",children:"Default preset is pre-selected when creating new sessions."}),T.jsx("div",{className:"space-y-3",children:V.map(q=>T.jsxs("div",{className:"border border-border p-3 space-y-2",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsx("div",{className:"flex items-center gap-2",children:T.jsx("input",{value:q.label,onChange:et=>_t(q.id,{label:et.target.value}),className:"input text-sm py-1 px-2 w-32",placeholder:"Label"})}),!q.isBuiltIn&&T.jsx("button",{type:"button",onClick:()=>zt(q.id),className:"btn text-xs px-2 py-1 text-error hover:bg-error/10",children:"Delete"})]}),T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Command"}),T.jsx("input",{value:q.command,onChange:et=>_t(q.id,{command:et.target.value}),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"})]}),!q.isBuiltIn&&T.jsxs("div",{children:[T.jsx("label",{className:"text-[10px] text-muted block mb-1",children:"Icon"}),T.jsxs("select",{value:q.agentType||"",onChange:et=>_t(q.id,{agentType:et.target.value||void 0}),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal"}),T.jsx("option",{value:"claude",children:"Claude"}),T.jsx("option",{value:"codex",children:"Codex"})]})]})]},q.id))}),Me?T.jsxs("div",{className:"mt-3 border border-border p-3 space-y-2",children:[T.jsx("div",{className:"text-xs text-secondary mb-2",children:"New Preset"}),T.jsx("input",{value:Ve,onChange:q=>ot(q.target.value),className:"input text-xs py-1 px-2 w-full",placeholder:"Label"}),T.jsx("input",{value:He,onChange:q=>Te(q.target.value),className:"input text-xs py-1 px-2 font-mono w-full",placeholder:"command --flags"}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("select",{value:De,onChange:q=>ze(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:[T.jsx("option",{value:"",children:"Terminal Icon"}),T.jsx("option",{value:"claude",children:"Claude Icon"}),T.jsx("option",{value:"codex",children:"Codex Icon"})]}),T.jsx("div",{className:"flex-1"}),T.jsx("button",{type:"button",onClick:()=>Ie(!1),className:"btn text-xs px-2 py-1",children:"Cancel"}),T.jsx("button",{type:"button",onClick:It,disabled:!Ve.trim()||!He.trim(),className:"btn btn-primary text-xs px-2 py-1",children:"Add"})]})]}):T.jsx("button",{type:"button",onClick:()=>Ie(!0),disabled:!wn,className:"btn text-xs mt-3 w-full",children:wn?"+ Add Preset":`Max ${si} presets`})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Session List Order"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${O==="created"?"btn-primary":""}`,onClick:()=>K("created"),children:"Created"}),T.jsx("button",{type:"button",className:`btn flex-1 ${O==="status"?"btn-primary":""}`,onClick:()=>K("status"),children:"Status"}),T.jsx("button",{type:"button",className:`btn flex-1 ${O==="manual"?"btn-primary":""}`,onClick:()=>K("manual"),children:"Manual"})]}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:O==="status"?"Sessions auto-resort by status (waiting, working, unknown)":O==="manual"?"Drag sessions to reorder manually":"Sessions stay in creation order"})]}),O==="created"&&T.jsxs("div",{children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Sort Direction"}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx("button",{type:"button",className:`btn flex-1 ${W==="desc"?"btn-primary":""}`,onClick:()=>te("desc"),children:"Newest First"}),T.jsx("button",{type:"button",className:`btn flex-1 ${W==="asc"?"btn-primary":""}`,onClick:()=>te("asc"),children:"Oldest First"})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Session List Details"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Project Name"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the project folder name under each session."})]}),T.jsx(Cn,{checked:ke,onCheckedChange:Ne})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Last User Message"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show the most recent user input next to the project name."})]}),T.jsx(Cn,{checked:Ke,onCheckedChange:Ae})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Session ID Prefix"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Show first 5 characters of agent session IDs in the list."})]}),T.jsx(Cn,{checked:Pe,onCheckedChange:G})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Inactive Sessions Lookback"}),T.jsxs("div",{className:"text-[10px] text-muted",children:["Show inactive sessions from the last N hours (",bu,"-",Cu,")."]})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"number",min:bu,max:Cu,value:fe,onChange:q=>{const et=parseInt(q.target.value,10);et>=bu&&et<=Cu&&la(et)},disabled:Re,className:"input text-xs py-1 px-2 w-16 text-center"}),T.jsx("span",{className:"text-xs text-muted",children:"hrs"})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4 space-y-3",children:[T.jsx("label",{className:"mb-1 block text-xs text-secondary",children:"Notifications"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Permission Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a ping when any session needs permission."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void dd(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(Cn,{checked:$e,onCheckedChange:q=>{X(q),q&&hd()}})]})]}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{className:"flex-1",children:[T.jsx("div",{className:"text-sm text-primary",children:"Idle Sound"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Play a chime when a session finishes working."})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>void fd(),className:"btn text-xs px-2 py-1",children:"Test"}),T.jsx(Cn,{checked:le,onCheckedChange:q=>{ge(q),q&&hd()}})]})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Terminal Rendering"}),T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"WebGL Acceleration"}),T.jsx("div",{className:"text-[10px] text-muted",children:"GPU rendering for better performance. Turn off if text looks fuzzy or flickering."})]}),T.jsx(Cn,{checked:J,onCheckedChange:_e})]}),J!==f&&T.jsx("p",{className:"mt-2 text-[10px] text-approval",children:"Terminal will reload when saved"}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Mouse Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Enable tmux mouse mode for trackpad/scroll wheel support."})]}),T.jsx(Cn,{checked:We,onCheckedChange:Ts,disabled:Le})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Size"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal text size in pixels (6-24)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("button",{type:"button",onClick:()=>se(Math.max(6,ue-1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"−"})}),T.jsx("span",{className:"text-sm text-secondary w-6 text-center",children:ue}),T.jsx("button",{type:"button",onClick:()=>se(Math.min(24,ue+1)),className:"flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover",children:T.jsx("span",{className:"text-sm font-bold",children:"+"})})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Line Height"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Vertical spacing (1.0 = compact, 2.0 = spacious)"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"1.0",max:"2.0",step:"0.1",value:re,onChange:q=>ae(parseFloat(q.target.value)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsx("span",{className:"text-xs text-secondary w-8 text-right",children:re.toFixed(1)})]})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Letter Spacing"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Horizontal spacing between characters in pixels"})]}),T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"range",min:"-3",max:"3",step:"1",value:ye,onChange:q=>ve(parseInt(q.target.value,10)),className:"w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent"}),T.jsxs("span",{className:"text-xs text-secondary w-8 text-right",children:[ye,"px"]})]})]}),T.jsxs("div",{className:"mt-4",children:[T.jsxs("div",{className:"flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Font Family"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Terminal typeface"})]}),T.jsx("select",{value:ne,onChange:q=>ie(q.target.value),className:"input text-xs py-1 px-2 w-auto",children:Lh.map(q=>T.jsx("option",{value:q.id,children:q.label},q.id))})]}),ne==="custom"&&T.jsx("input",{value:he,onChange:q=>oe(q.target.value),placeholder:'"Fira Code", monospace',className:"input text-xs mt-2 font-mono"})]}),T.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[T.jsxs("div",{children:[T.jsx("div",{className:"text-sm text-primary",children:"Dark Mode"}),T.jsx("div",{className:"text-[10px] text-muted",children:"Switch between dark and light themes."})]}),T.jsx(Cn,{checked:Y==="dark",onCheckedChange:q=>Oe(q?"dark":"light")})]})]}),T.jsxs("div",{className:"border-t border-border pt-4",children:[T.jsx("label",{className:"mb-2 block text-xs text-secondary",children:"Keyboard Shortcut Modifier"}),T.jsx("div",{className:"grid grid-cols-5 gap-1",children:["auto","ctrl-option","ctrl-shift","cmd-option","cmd-shift"].map(q=>T.jsx("button",{type:"button",className:`btn text-xs px-2 ${me===q?"btn-primary":""}`,onClick:()=>xe(q),children:q==="auto"?"Auto":ii(q)},q))}),T.jsx("p",{className:"mt-1.5 text-[10px] text-muted",children:me==="auto"?`Platform default: ${ii(Zo("auto"))}`:`Shortcuts: ${ii(me)}+[N/X/[/]]`})]})]})}),T.jsxs("div",{className:"flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated",children:[T.jsx("button",{type:"button",onClick:()=>t(),className:"btn",children:"Cancel"}),T.jsx("button",{type:"submit",className:"btn btn-primary",children:"Save"})]})]})})}const V3=[];function mp(e){k.useEffect(e,V3)}const gp=k.createContext(void 0);function vp(){const e=k.useContext(gp);if(!e)throw new Error(Yr(73));return e}var Jl=Symbol("NOT_FOUND");function K3(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function G3(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function q3(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Iv=e=>Array.isArray(e)?e:[e];function X3(e){const t=Array.isArray(e[0])?e[0]:e;return q3(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Y3(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}function J3(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Jl},put(r,n){t={key:r,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Q3(e,t){let r=[];function n(s){const o=r.findIndex(c=>t(s,c.key));if(o>-1){const c=r[o];return o>0&&(r.splice(o,1),r.unshift(c)),c.value}return Jl}function i(s,o){n(s)===Jl&&(r.unshift({key:s,value:o}),r.length>e&&r.pop())}function a(){return r}function l(){r=[]}return{get:n,put:i,getEntries:a,clear:l}}var Z3=(e,t)=>e===t;function eA(e){return function(r,n){if(r===null||n===null||r.length!==n.length)return!1;const{length:i}=r;for(let a=0;a<i;a++)if(!e(r[a],n[a]))return!1;return!0}}function tA(e,t){const r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:n=Z3,maxSize:i=1,resultEqualityCheck:a}=r,l=eA(n);let s=0;const o=i<=1?J3(l):Q3(i,l);function c(){let p=o.get(arguments);if(p===Jl){if(p=e.apply(null,arguments),s++,a){const f=o.getEntries().find(_=>a(_.value,p));f&&(p=f.value,s!==0&&s--)}o.put(arguments,p)}return p}return c.clearCache=()=>{o.clear(),c.resetResultsCount()},c.resultsCount=()=>s,c.resetResultsCount=()=>{s=0},c}var rA=class{constructor(e){this.value=e}deref(){return this.value}},nA=typeof WeakRef<"u"?WeakRef:rA,sA=0,Bv=1;function Fa(){return{s:sA,v:void 0,o:null,p:null}}function cS(e,t={}){let r=Fa();const{resultEqualityCheck:n}=t;let i,a=0;function l(){var u;let s=r;const{length:o}=arguments;for(let f=0,_=o;f<_;f++){const y=arguments[f];if(typeof y=="function"||typeof y=="object"&&y!==null){let v=s.o;v===null&&(s.o=v=new WeakMap);const h=v.get(y);h===void 0?(s=Fa(),v.set(y,s)):s=h}else{let v=s.p;v===null&&(s.p=v=new Map);const h=v.get(y);h===void 0?(s=Fa(),v.set(y,s)):s=h}}const c=s;let p;if(s.s===Bv)p=s.v;else if(p=e.apply(null,arguments),a++,n){const f=((u=i==null?void 0:i.deref)==null?void 0:u.call(i))??i;f!=null&&n(f,p)&&(p=f,a!==0&&a--),i=typeof p=="object"&&p!==null||typeof p=="function"?new nA(p):p}return c.s=Bv,c.v=p,p}return l.clearCache=()=>{r=Fa(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}function uS(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,l=0,s,o={},c=i.pop();typeof c=="object"&&(o=c,c=i.pop()),K3(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const p={...r,...o},{memoize:u,memoizeOptions:f=[],argsMemoize:_=cS,argsMemoizeOptions:y=[]}=p,v=Iv(f),h=Iv(y),m=X3(i),d=u(function(){return a++,c.apply(null,arguments)},...v),g=_(function(){l++;const b=Y3(m,arguments);return s=d.apply(null,b),s},...h);return Object.assign(g,{resultFunc:c,memoizedResultFunc:d,dependencies:m,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:_})};return Object.assign(n,{withTypes:()=>n}),n}var iA=uS(cS),oA=Object.assign((e,t=iA)=>{G3(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((l,s,o)=>(l[r[o]]=s,l),{}))},{withTypes:()=>oA});const aA=uS({memoize:tA,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),Tr=(e,t,r,n,i,a,...l)=>{if(l.length>0)throw new Error(Yr(1));let s;if(e&&t)s=(o,c,p,u)=>{const f=e(o,c,p,u);return t(f,c,p,u)};else if(e)s=e;else throw new Error("Missing arguments");return s},lA=(...e)=>{const t=new WeakMap;let r=1;const n=e[e.length-1],i=e.length-1||1,a=n.length-i;if(a>3)throw new Error(Yr(2));return(s,o,c,p)=>{let u=s.__cacheKey__;u||(u={id:r},s.__cacheKey__=u,r+=1);let f=t.get(u);if(!f){let _=e;const y=[void 0,void 0,void 0];switch(a){case 0:break;case 1:{_=[...e.slice(0,-1),()=>y[0],n];break}case 2:{_=[...e.slice(0,-1),()=>y[0],()=>y[1],n];break}case 3:{_=[...e.slice(0,-1),()=>y[0],()=>y[1],()=>y[2],n];break}default:throw new Error(Yr(2))}f=aA(..._),f.selectorArgs=y,t.set(u,f)}switch(f.selectorArgs[0]=o,f.selectorArgs[1]=c,f.selectorArgs[2]=p,a){case 0:return f(s);case 1:return f(s,o);case 2:return f(s,o,c);case 3:return f(s,o,c,p);default:throw new Error("unreachable")}}};var hS={exports:{}},dS={};/**
|
|
301
301
|
* @license React
|
|
302
302
|
* use-sync-external-store-shim.production.js
|
|
303
303
|
*
|
|
@@ -313,4 +313,4 @@ void main() {
|
|
|
313
313
|
*
|
|
314
314
|
* This source code is licensed under the MIT license found in the
|
|
315
315
|
* LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/var Cc=k,_A=fS;function yA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wA=typeof Object.is=="function"?Object.is:yA,SA=_A.useSyncExternalStore,xA=Cc.useRef,bA=Cc.useEffect,CA=Cc.useMemo,EA=Cc.useDebugValue;mS.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var a=xA(null);if(a.current===null){var l={hasValue:!1,value:null};a.current=l}else l=a.current;a=CA(function(){function o(_){if(!c){if(c=!0,p=_,_=n(_),i!==void 0&&l.hasValue){var y=l.value;if(i(y,_))return u=y}return u=_}if(y=u,wA(p,_))return y;var v=n(_);return i!==void 0&&i(y,v)?(p=_,y):(p=_,u=v)}var c=!1,p,u,f=r===void 0?null:r;return[function(){return o(t())},f===null?void 0:function(){return o(f())}]},[t,r,n,i]);var s=SA(e,a[0],a[1]);return bA(function(){l.hasValue=!0,l.value=s},[s]),EA(s),s};pS.exports=mS;var kA=pS.exports;const LA=ap(19),TA=LA?DA:MA;function gS(e,t,r,n,i){return TA(e,t,r,n,i)}function RA(e,t,r,n,i){const a=k.useCallback(()=>t(e.getSnapshot(),r,n,i),[e,t,r,n,i]);return fS.useSyncExternalStore(e.subscribe,a,a)}function DA(e,t,r,n,i){return RA(e,t,r,n,i)}function MA(e,t,r,n,i){return kA.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,a=>t(a,r,n,i))}class AA{constructor(t){tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const r=this.updateTick;for(const n of this.listeners){if(r!==this.updateTick)return;n(t)}}update(t){for(const r in t)if(!Object.is(this.state[r],t[r])){this.setState({...this.state,...t});return}}set(t,r){Object.is(this.state[t],r)||this.setState({...this.state,[t]:r})}notifyAll(){const t={...this.state};this.setState(t)}use(t,r,n,i){return gS(this,t,r,n,i)}}class PA extends AA{constructor(t,r={},n){super(t),this.context=r,this.selectors=n}useSyncedValue(t,r){k.useDebugValue(t),qt(()=>{this.state[t]!==r&&this.set(t,r)},[t,r])}useSyncedValueWithCleanup(t,r){const n=this;qt(()=>(n.state[t]!==r&&n.set(t,r),()=>{n.set(t,void 0)}),[n,t,r])}useSyncedValues(t){const r=this,n=Object.values(t);qt(()=>{r.update(t)},[r,...n])}useControlledProp(t,r){k.useDebugValue(t);const n=r!==void 0;qt(()=>{n&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})},[t,r,n])}select(t,r,n,i){const a=this.selectors[t];return a(this.state,r,n,i)}useState(t,r,n,i){return k.useDebugValue(t),gS(this,this.selectors[t],r,n,i)}useContextCallback(t,r){k.useDebugValue(t);const n=Xr(r??ur);this.context[t]=n}useStateSetter(t){const r=k.useRef(void 0);return r.current===void 0&&(r.current=n=>{this.set(t,n)}),r.current}observe(t,r){let n;typeof t=="function"?n=t:n=this.selectors[t];let i=n(this.state);return r(i,i,this),this.subscribe(a=>{const l=n(a);if(!Object.is(i,l)){const s=i;i=l,r(l,s,this)}})}}const $a=null;class IA{constructor(){tt(this,"callbacks",[]);tt(this,"callbacksCount",0);tt(this,"nextId",1);tt(this,"startId",1);tt(this,"isScheduled",!1);tt(this,"tick",t=>{var i;this.isScheduled=!1;const r=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let a=0;a<r.length;a+=1)(i=r[a])==null||i.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const Ha=new IA;class _p{constructor(){tt(this,"currentId",$a);tt(this,"cancel",()=>{this.currentId!==$a&&(Ha.cancel(this.currentId),this.currentId=$a)});tt(this,"disposeEffect",()=>this.cancel)}static create(){return new _p}static request(t){return Ha.request(t)}static cancel(t){return Ha.cancel(t)}request(t){this.cancel(),this.currentId=Ha.request(()=>{this.currentId=$a,t()})}}function BA(){const e=ks(_p.create).current;return mp(e.disposeEffect),e}const Ui=0;class Ko{constructor(){tt(this,"currentId",Ui);tt(this,"clear",()=>{this.currentId!==Ui&&(clearTimeout(this.currentId),this.currentId=Ui)});tt(this,"disposeEffect",()=>this.clear)}static create(){return new Ko}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ui,r()},t)}isStarted(){return this.currentId!==Ui}}function OA(){const e=ks(Ko.create).current;return mp(e.disposeEffect),e}let Ov=0;function vS(e){return Ov+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Ov}`}function Js(e){return(e==null?void 0:e.ownerDocument)||document}function Du(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const r=e(t);return typeof r=="string"?{description:r}:r}return e}const aa=typeof navigator<"u",Mu=HA(),NA=UA(),jA=zA();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");Mu.platform==="MacIntel"&&Mu.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(Mu.platform);const FA=aa&&/apple/i.test(navigator.vendor);aa&&NA.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const $A=jA.includes("jsdom/");function HA(){if(!aa)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function zA(){if(!aa)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:r})=>`${t}/${r}`).join(" "):navigator.userAgent}function UA(){if(!aa)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Ql(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function yi(e,t){var n;if(!e||!t)return!1;const r=(n=t.getRootNode)==null?void 0:n.call(t);if(e.contains(t))return!0;if(r&&PM(r)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function yp(e){return"composedPath"in e?e.composedPath()[0]:e.target}function pd(e){if(!e||$A)return!0;try{return e.matches(":focus-visible")}catch{return!0}}const za=lA(e=>e.toasts,e=>{const t=new Map;let r=0,n=0;return e.forEach((i,a)=>{const l=i.transitionStatus==="ending";t.set(i.id,{value:i,domIndex:a,visibleIndex:l?-1:r,offsetY:n}),n+=i.height||0,l||(r+=1)}),t}),nn={toasts:Tr(e=>e.toasts),isEmpty:Tr(e=>e.toasts.length===0),toast:Tr(za,(e,t)=>{var r;return(r=e.get(t))==null?void 0:r.value}),toastIndex:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.domIndex)??-1}),toastOffsetY:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.offsetY)??0}),toastVisibleIndex:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.visibleIndex)??-1}),hovering:Tr(e=>e.hovering),focused:Tr(e=>e.focused),expanded:Tr(e=>e.hovering||e.focused),expandedOrOutOfFocus:Tr(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:Tr(e=>e.prevFocusElement)};class WA extends PA{constructor(r){super(r,{},nn);tt(this,"timers",new Map);tt(this,"areTimersPaused",!1);tt(this,"setViewport",r=>{this.set("viewport",r)});tt(this,"disposeEffect",()=>()=>{this.timers.forEach(r=>{var n;(n=r.timeout)==null||n.clear()}),this.timers.clear()});tt(this,"addToast",r=>{const{toasts:n,timeout:i,limit:a}=this.state,l=r.id||vS("toast"),s={...r,id:l,transitionStatus:"starting"},o=[s,...n],c=o.filter(u=>u.transitionStatus!=="ending");if(c.length>a){const u=c.length-a,f=c.slice(-u),_=new Set(f.map(y=>y.id));this.setToasts(o.map(y=>{const v=_.has(y.id);return y.limited!==v?{...y,limited:v}:y}))}else this.setToasts(o.map(u=>u.limited?{...u,limited:!1}:u));const p=s.timeout??i;return s.type!=="loading"&&p>0&&this.scheduleTimer(l,p,()=>this.closeToast(l)),nn.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),l});tt(this,"updateToast",(r,n)=>{this.updateToastInternal(r,n)});tt(this,"updateToastInternal",(r,n)=>{var v,h;const{timeout:i,toasts:a}=this.state,l=nn.toast(this.state,r)??null;if(!l||l.transitionStatus==="ending")return;const s={...l,...n};this.setToasts(a.map(m=>m.id===r?{...m,...n}:m));const o=s.timeout??i,c=(l==null?void 0:l.timeout)??i,p=Object.hasOwn(n,"timeout"),u=s.transitionStatus!=="ending"&&s.type!=="loading"&&o>0,f=this.timers.has(r),_=c!==o,y=(l==null?void 0:l.type)==="loading";if(!u&&f){const m=this.timers.get(r);(v=m==null?void 0:m.timeout)==null||v.clear(),this.timers.delete(r);return}if(u&&(!f||_||p||y)){const m=this.timers.get(r);m&&((h=m.timeout)==null||h.clear(),this.timers.delete(r)),this.scheduleTimer(r,o,()=>this.closeToast(r)),nn.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}});tt(this,"closeToast",r=>{var c;const n=nn.toast(this.state,r);(c=n==null?void 0:n.onClose)==null||c.call(n);const{limit:i,toasts:a}=this.state;let l=0;const s=a.map(p=>{if(p.id===r)return{...p,transitionStatus:"ending",height:0};if(p.transitionStatus==="ending")return p;const u=l>=i;return l+=1,p.limited!==u?{...p,limited:u}:p}),o=this.timers.get(r);o&&o.timeout&&(o.timeout.clear(),this.timers.delete(r)),this.handleFocusManagement(r),this.setToasts(s)});tt(this,"promiseToast",(r,n)=>{const i=Du(n.loading),a=this.addToast({...i,type:"loading"}),l=r.then(s=>{const o=Du(n.success,s);return this.updateToast(a,{...o,type:"success",timeout:o.timeout}),s}).catch(s=>{const o=Du(n.error,s);return this.updateToast(a,{...o,type:"error",timeout:o.timeout}),Promise.reject(s)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(l),l});tt(this,"handleDocumentPointerDown",r=>{if(r.pointerType!=="touch")return;const n=yp(r);yi(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}setFocused(r){this.set("focused",r)}setHovering(r){this.set("hovering",r)}setIsWindowFocused(r){this.set("isWindowFocused",r)}setPrevFocusElement(r){this.set("prevFocusElement",r)}removeToast(r){var l;const n=nn.toastIndex(this.state,r);if(n===-1)return;const i=this.state.toasts[n];(l=i==null?void 0:i.onRemove)==null||l.call(i);const a=[...this.state.toasts];a.splice(n,1),this.setToasts(a)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(r=>{if(r.timeout){r.timeout.clear();const n=Date.now()-r.start,i=r.delay-n;r.remaining=i>0?i:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((r,n)=>{r.remaining=r.remaining>0?r.remaining:r.delay,r.timeout??(r.timeout=Ko.create()),r.timeout.start(r.remaining,()=>{this.timers.delete(n),r.callback()}),r.start=Date.now()}))}restoreFocusToPrevElement(){var r;(r=this.state.prevFocusElement)==null||r.focus({preventScroll:!0})}scheduleTimer(r,n,i){const a=Date.now(),l=!nn.expandedOrOutOfFocus(this.state),s=l?Ko.create():void 0;s==null||s.start(n,()=>{this.timers.delete(r),i()}),this.timers.set(r,{timeout:s,start:l?a:0,delay:n,remaining:n,callback:i})}setToasts(r){const n={toasts:r};r.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(r){var o,c;const n=Ql(Js(this.state.viewport));if(!this.state.viewport||!yi(this.state.viewport,n)||!pd(n))return;const i=nn.toasts(this.state),a=nn.toastIndex(this.state,r);let l=null,s=a+1;for(;s<i.length;){if(i[s].transitionStatus!=="ending"){l=i[s];break}s+=1}if(!l)for(s=a-1;s>=0;){if(i[s].transitionStatus!=="ending"){l=i[s];break}s-=1}l?(c=(o=l.ref)==null?void 0:o.current)==null||c.focus():this.restoreFocusToPrevElement()}}const VA=function(t){const{children:r,timeout:n=5e3,limit:i=3,toastManager:a}=t,l=ks(()=>new WA({timeout:n,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return mp(l.disposeEffect),k.useEffect(function(){return a?a[" subscribe"](({action:c,options:p})=>{const u=p.id;c==="promise"&&p.promise?l.promiseToast(p.promise,p):c==="update"&&u?l.updateToast(u,p):c==="close"&&u?l.closeToast(u):l.addToast(p)}):void 0},[l,n,a]),l.useSyncedValues({timeout:n,limit:i}),T.jsx(gp.Provider,{value:l,children:r})},Au=k.forwardRef(function(t,r){const[n,i]=k.useState();qt(()=>{FA&&i("button")},[]);const a={tabIndex:0,role:n};return T.jsx("span",{...t,ref:r,style:op,"aria-hidden":n?void 0:!0,...a,"data-base-ui-focus-guard":""})});let KA=function(e){return e.frontmostHeight="--toast-frontmost-height",e}({});const GA=k.forwardRef(function(t,r){var M;const{render:n,className:i,children:a,...l}=t,s=vp(),o=OA(),c=k.useRef(!1),p=k.useRef(!1),u=s.useState("isEmpty"),f=s.useState("toasts"),_=s.useState("focused"),y=s.useState("expanded"),v=s.useState("prevFocusElement"),h=((M=f[0])==null?void 0:M.height)??0,m=k.useMemo(()=>f.some(D=>D.transitionStatus==="ending"),[f]);k.useEffect(()=>{const D=s.state.viewport;if(!D)return;function B(F){u||F.key==="F6"&&F.target!==D&&(F.preventDefault(),s.setPrevFocusElement(Ql(Js(D))),D==null||D.focus({preventScroll:!0}),s.pauseTimers(),s.setFocused(!0))}const H=Vo(D);return H.addEventListener("keydown",B),()=>{H.removeEventListener("keydown",B)}},[s,u]),k.useEffect(()=>{const D=s.state.viewport;if(!D||u)return;const B=Vo(D);function H($){$.target===B&&(s.setIsWindowFocused(!1),s.pauseTimers())}function F($){if($.relatedTarget||$.target===B)return;const I=yp($),R=Ql(Js(D));(!yi(D,I)||!pd(R))&&s.resumeTimers(),o.start(0,()=>s.setIsWindowFocused(!0))}return B.addEventListener("blur",H,!0),B.addEventListener("focus",F,!0),()=>{B.removeEventListener("blur",H,!0),B.removeEventListener("focus",F,!0)}},[s,o,u]),k.useEffect(()=>{const D=s.state.viewport;if(!D||u)return;const B=Js(D);return B.addEventListener("pointerdown",s.handleDocumentPointerDown,!0),()=>{B.removeEventListener("pointerdown",s.handleDocumentPointerDown,!0)}},[u,s]);function d(D){var H,F,$;const B=s.state.viewport;B&&(c.current=!0,D.relatedTarget===B?($=(F=(H=f[0])==null?void 0:H.ref)==null?void 0:F.current)==null||$.focus():s.restoreFocusToPrevElement())}function g(D){D.key==="Tab"&&D.shiftKey&&D.target===s.state.viewport&&(D.preventDefault(),s.restoreFocusToPrevElement(),s.resumeTimers())}k.useEffect(()=>{!s.state.isWindowFocused||m||!p.current||(s.resumeTimers(),s.setHovering(!1),p.current=!1)},[m,s]);function w(){s.pauseTimers(),s.setHovering(!0),p.current=!1}function b(){m?p.current=!0:(s.resumeTimers(),s.setHovering(!1))}function x(){if(c.current){c.current=!1;return}_||pd(Js(s.state.viewport).activeElement)&&(s.setFocused(!0),s.pauseTimers())}function C(D){!_||yi(s.state.viewport,D.relatedTarget)||(s.setFocused(!1),s.resumeTimers())}const S={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:w,onMouseMove:w,onMouseLeave:b,onFocus:x,onBlur:C,onKeyDown:g,onClick:x},E={expanded:y},L=Ls("div",t,{ref:[r,s.setViewport],state:E,props:[S,{style:{[KA.frontmostHeight]:h?`${h}px`:void 0}},l,{children:T.jsxs(k.Fragment,{children:[!u&&v&&T.jsx(Au,{onFocus:d}),a,!u&&v&&T.jsx(Au,{onFocus:d})]})}]}),A=k.useMemo(()=>f.filter(D=>D.priority==="high"),[f]);return T.jsxs(k.Fragment,{children:[!u&&v&&T.jsx(Au,{onFocus:d}),L,!_&&A.length>0&&T.jsx("div",{style:op,children:A.map(D=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:D.title}),T.jsx("div",{children:D.description})]},D.id))})]})});function qA(e){return ap(19)?e:e?"true":void 0}const _S=k.createContext(void 0);function wp(){const e=k.useContext(_S);if(!e)throw new Error(Yr(66));return e}let Sp=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const XA={[Sp.startingStyle]:""},YA={[Sp.endingStyle]:""},JA={transitionStatus(e){return e==="starting"?XA:e==="ending"?YA:null}};function QA(e){return e==null?e:"current"in e?e.current:e}function ZA(e,t=!1,r=!0){const n=BA();return Xr((i,a=null)=>{n.cancel();function l(){hn.flushSync(i)}const s=QA(e);if(s==null)return;const o=s;if(typeof o.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{let u=function(){const _=Sp.startingStyle;if(!o.hasAttribute(_)){n.request(f);return}const y=new MutationObserver(()=>{o.hasAttribute(_)||(y.disconnect(),f())});y.observe(o,{attributes:!0,attributeFilter:[_]}),a==null||a.addEventListener("abort",()=>y.disconnect(),{once:!0})},f=function(){Promise.all(o.getAnimations().map(_=>_.finished)).then(()=>{a!=null&&a.aborted||l()}).catch(()=>{const _=o.getAnimations();if(r){if(a!=null&&a.aborted)return;l()}else _.length>0&&_.some(y=>y.pending||y.playState!=="finished")&&f()})};var c=u,p=f;if(t){u();return}n.request(f)}})}function eP(e){const{enabled:t=!0,open:r,ref:n,onComplete:i}=e,a=Xr(i),l=ZA(n,r,!1);k.useEffect(()=>{if(!t)return;const s=new AbortController;return l(a,s.signal),()=>{s.abort()}},[t,r,a,l])}let ss=function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e}({});const tP={...JA,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Wi=40,rP=10,En=.5,nP=1;function Nv(e,t,r){switch(e){case"up":return-r;case"down":return r;case"left":return-t;case"right":return t;default:return 0}}function sP(e){const r=window.getComputedStyle(e).transform;let n=0,i=0,a=1;if(r&&r!=="none"){const l=r.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const s=l[1].split(", ").map(parseFloat);s.length===6?(n=s[4],i=s[5],a=Math.sqrt(s[0]*s[0]+s[1]*s[1])):s.length===16&&(n=s[12],i=s[13],a=s[0])}}return{x:n,y:i,scale:a}}const iP=k.forwardRef(function(t,r){var ve;const{toast:n,render:i,className:a,swipeDirection:l=["down","right"],...s}=t,o=((ve=n.positionerProps)==null?void 0:ve.anchor)!==void 0;let c=[];o||(c=Array.isArray(l)?l:[l]);const p=c.length>0,u=vp(),[f,_]=k.useState(void 0),[y,v]=k.useState(!1),[h,m]=k.useState(!1),[d,g]=k.useState(!1),[w,b]=k.useState({x:0,y:0}),[x,C]=k.useState({x:0,y:0,scale:1}),[S,E]=k.useState(),[L,A]=k.useState(),[M,D]=k.useState(null),B=k.useRef(null),H=k.useRef({x:0,y:0}),F=k.useRef({x:0,y:0,scale:1}),$=k.useRef(void 0),I=k.useRef(0),R=k.useRef(!1),P=k.useRef({x:0,y:0}),N=k.useRef(!1),j=u.useState("toastIndex",n.id),U=u.useState("toastVisibleIndex",n.id),V=u.useState("toastOffsetY",n.id),ee=u.useState("focused"),Q=u.useState("expanded");eP({open:n.transitionStatus!=="ending",ref:B,onComplete(){n.transitionStatus==="ending"&&u.removeToast(n.id)}});const z=Xr((ne=!1)=>{const ie=B.current;if(!ie)return;const he=ie.style.height;ie.style.height="auto";const oe=ie.offsetHeight;ie.style.height=he;function me(){u.updateToastInternal(n.id,{ref:B,height:oe,...n.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}ne?hn.flushSync(me):me()});qt(z,[z]);function O(ne,ie){let he=ne,oe=ie;return!c.includes("left")&&!c.includes("right")?he=ne>0?ne**En:-(Math.abs(ne)**En):(!c.includes("right")&&ne>0&&(he=ne**En),!c.includes("left")&&ne<0&&(he=-(Math.abs(ne)**En))),!c.includes("up")&&!c.includes("down")?oe=ie>0?ie**En:-(Math.abs(ie)**En):(!c.includes("down")&&ie>0&&(oe=ie**En),!c.includes("up")&&ie<0&&(oe=-(Math.abs(ie)**En))),{x:he,y:oe}}function K(ne){var oe;if(ne.button!==0)return;ne.pointerType==="touch"&&u.pauseTimers();const ie=yp(ne.nativeEvent);if(!(ie&&ie.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(R.current=!1,$.current=void 0,I.current=0,H.current={x:ne.clientX,y:ne.clientY},P.current=H.current,B.current){const me=sP(B.current);F.current=me,C(me),b({x:me.x,y:me.y})}u.setHovering(!0),v(!0),m(!1),D(null),N.current=!0,(oe=B.current)==null||oe.setPointerCapture(ne.pointerId)}}function W(ne){if(!y)return;ne.preventDefault(),N.current&&(H.current={x:ne.clientX,y:ne.clientY},N.current=!1);const{clientY:ie,clientX:he,movementX:oe,movementY:me}=ne;(me<0&&ie>P.current.y||me>0&&ie<P.current.y)&&(P.current={x:P.current.x,y:ie}),(oe<0&&he>P.current.x||oe>0&&he<P.current.x)&&(P.current={x:he,y:P.current.y});const xe=he-H.current.x,ke=ie-H.current.y,Ne=ie-P.current.y,Ke=he-P.current.x;if(!h&&Math.sqrt(xe*xe+ke*ke)>=nP&&(m(!0),M===null)){const $e=c.includes("left")||c.includes("right"),X=c.includes("up")||c.includes("down");if($e&&X){const le=Math.abs(xe),ge=Math.abs(ke);D(le>ge?"horizontal":"vertical")}}let Ae;if(!$.current)M==="vertical"?ke>0?Ae="down":ke<0&&(Ae="up"):M==="horizontal"?xe>0?Ae="right":xe<0&&(Ae="left"):Math.abs(xe)>=Math.abs(ke)?Ae=xe>0?"right":"left":Ae=ke>0?"down":"up",Ae&&c.includes(Ae)&&($.current=Ae,I.current=Nv(Ae,xe,ke),_(Ae));else{const Oe=$.current,$e=Nv(Oe,Ke,Ne);$e>Wi?(R.current=!1,_(Oe)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&I.current-$e>=rP&&(R.current=!0)}const Pe=O(xe,ke);let G=F.current.x,J=F.current.y;M==="horizontal"?(c.includes("left")||c.includes("right"))&&(G+=Pe.x):(M==="vertical"||(c.includes("left")||c.includes("right"))&&(G+=Pe.x),(c.includes("up")||c.includes("down"))&&(J+=Pe.y)),b({x:G,y:J})}function te(ne){var xe;if(!y)return;if(v(!1),m(!1),D(null),(xe=B.current)==null||xe.releasePointerCapture(ne.pointerId),R.current){b({x:x.x,y:x.y}),_(void 0);return}let ie=!1;const he=w.x-x.x,oe=w.y-x.y;let me;for(const ke of c){switch(ke){case"right":he>Wi&&(ie=!0,me="right");break;case"left":he<-Wi&&(ie=!0,me="left");break;case"down":oe>Wi&&(ie=!0,me="down");break;case"up":oe<-Wi&&(ie=!0,me="up");break}if(ie)break}ie?(_(me),g(!0),u.closeToast(n.id)):(b({x:x.x,y:x.y}),_(void 0))}function Y(ne){if(ne.key==="Escape"){if(!B.current||!yi(B.current,Ql(Js(B.current))))return;u.closeToast(n.id)}}k.useEffect(()=>{if(!p)return;const ne=B.current;if(!ne)return;function ie(he){yi(ne,he.target)&&he.preventDefault()}return ne.addEventListener("touchmove",ie,{passive:!1}),()=>{ne.removeEventListener("touchmove",ie)}},[p]);function _e(){if(!y&&w.x===x.x&&w.y===x.y&&!d)return{[ss.swipeMovementX]:"0px",[ss.swipeMovementY]:"0px"};const ne=w.x-x.x,ie=w.y-x.y;return{transition:y?"none":void 0,transform:y?`translateX(${w.x}px) translateY(${w.y}px) scale(${x.scale})`:void 0,[ss.swipeMovementX]:`${ne}px`,[ss.swipeMovementY]:`${ie}px`}}const ue=n.priority==="high",se={role:ue?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":S,"aria-describedby":L,"aria-hidden":ue&&!ee?!0:void 0,onPointerDown:p?K:void 0,onPointerMove:p?W:void 0,onPointerUp:p?te:void 0,onKeyDown:Y,inert:qA(n.limited),style:{..._e(),[ss.index]:n.transitionStatus==="ending"?j:U,[ss.offsetY]:`${V}px`,[ss.height]:n.height?`${n.height}px`:void 0}},re=k.useMemo(()=>({rootRef:B,toast:n,titleId:S,setTitleId:E,descriptionId:L,setDescriptionId:A,swiping:y,swipeDirection:f,recalculateHeight:z,index:j,visibleIndex:U,expanded:Q}),[n,S,L,y,f,z,j,U,Q]),ae={transitionStatus:n.transitionStatus,expanded:Q,limited:n.limited||!1,type:n.type,swiping:re.swiping,swipeDirection:re.swipeDirection},ye=Ls("div",t,{ref:[r,re.rootRef],state:ae,stateAttributesMapping:tP,props:[se,s]});return T.jsx(_S.Provider,{value:re,children:ye})}),oP=k.forwardRef(function(t,r){const{render:n,className:i,id:a,children:l,...s}=t,{toast:o,setDescriptionId:c}=wp(),p=l??o.description,u=!!p,f=cp(a);qt(()=>{if(u)return c(f),()=>{c(void 0)}},[u,f,c]);const _={type:o.type},y=Ls("p",t,{ref:r,state:_,props:{...s,id:f,children:p}});return u?y:null}),aP=k.forwardRef(function(t,r){const{render:n,className:i,id:a,children:l,...s}=t,{toast:o,setTitleId:c}=wp(),p=l??o.title,u=!!p,f=cp(a);qt(()=>{if(u)return c(f),()=>{c(void 0)}},[u,f,c]);const _={type:o.type},y=Ls("h2",t,{ref:r,state:_,props:{...s,id:f,children:p}});return u?y:null}),lP=k.forwardRef(function(t,r){const{render:n,className:i,disabled:a,nativeButton:l=!0,...s}=t,o=vp(),{toast:c}=wp(),p=o.useState("expanded"),[u,f]=k.useState(!1),{getButtonProps:_,buttonRef:y}=Uw({disabled:a,native:l}),v={type:c.type};return Ls("button",t,{ref:[r,y],state:v,props:[{"aria-hidden":!p&&!u,onClick(){o.closeToast(c.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,_]})});function cP(){const e=k.useContext(gp);if(!e)throw new Error(Yr(73));const t=e.useState("toasts");return k.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function uP(){const e=new Set;function t(r){e.forEach(n=>n(r))}return{" subscribe":function(n){return e.add(n),()=>{e.delete(n)}},add(r){const n=r.id||vS("toast"),i={...r,id:n,transitionStatus:"starting"};return t({action:"add",options:i}),n},close(r){t({action:"close",options:{id:r}})},update(r,n){t({action:"update",options:{...n,id:r}})},promise(r,n){let i=r;return t({action:"promise",options:{...n,promise:r,setPromise(a){i=a}}}),i}}}const hP=5e3,yS=uP();function dP({toast:e}){return T.jsxs(iP,{toast:e,className:Xl("relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg","data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]","data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]","data-[ending-style]:opacity-0","data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0","transition-all duration-200",e.type==="error"&&"border-error/50",e.type==="success"&&"border-approval/50",(!e.type||e.type==="info")&&"border-border"),children:[T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsx(aP,{className:Xl("text-sm font-medium",e.type==="error"&&"text-error",e.type==="success"&&"text-approval",(!e.type||e.type==="info")&&"text-primary"),children:e.title}),e.description&&T.jsx(oP,{className:"mt-1 text-xs text-muted line-clamp-2",children:e.description})]}),T.jsx(lP,{className:"shrink-0 text-muted hover:text-primary transition-colors","aria-label":"Close",children:T.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function fP(){const{toasts:e}=cP();return T.jsx(T.Fragment,{children:e.map(t=>T.jsx(dP,{toast:t},t.id))})}function pP(){return T.jsxs(VA,{timeout:hP,toastManager:yS,children:[T.jsx(fP,{}),T.jsx(GA,{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2"})]})}const jv=["CONNECTING","OPEN","CLOSING","CLOSED"],mP=3e3,gP=15e3,vP=5e3,_P=1e4,yP=2e4,wP=1e4,SP=3e3;class xP{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status="connecting",this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.onVisibilityChange=()=>{if(Qe("ws_visibility",{state:document.visibilityState,...this.wsSnap()}),document.visibilityState==="visible"){const t=Date.now(),n=t-this.lastTick>_P;this.lastTick=t,this.forceReconnect("visibilitychange",n),!n&&this.status==="connected"&&(this.startHeartbeat(),this.sendVerificationPing())}else this.stopHeartbeat(),this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},this.onPageShow=t=>{Qe("ws_pageshow",{persisted:t.persisted,...this.wsSnap()}),t.persisted&&(this.lastTick=Date.now(),this.forceReconnect("pageshow",!0))}}wsSnap(){return{status:this.status,ws:this.ws?jv[this.ws.readyState]:null,attempt:this.reconnectAttempts}}connect(){if(this.ws){const i=this.ws.readyState===WebSocket.OPEN;if(i&&this.status==="connected"){Qe("ws_connect_skip",{reason:"already_open",...this.wsSnap()});return}Qe("ws_connect_destroy_zombie",{reason:i?"open_desynced":"not_open",...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus("connecting");const r=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`;Qe("ws_connect",{url:r,...this.wsSnap()});const n=new WebSocket(r);this.ws=n,this.connectTimer=window.setTimeout(()=>{if(this.ws!==n)return;this.connectTimer=null,n.readyState===WebSocket.OPEN&&this.status==="connected"||(Qe("ws_connect_timeout",{wsState:jv[n.readyState],managerStatus:this.status,...this.wsSnap()}),this.destroySocket(),this.scheduleReconnect())},mP),n.onopen=()=>{Qe("ws_onopen",this.wsSnap()),this.clearConnectTimer(),this.reconnectAttempts=0,this.connectionEpoch+=1,this.setStatus("connected"),this.startHeartbeat()},n.onmessage=i=>{try{const a=JSON.parse(i.data);if(a.type==="pong"){a.seq===this.pingSeq&&this.clearPongTimer();return}this.listeners.forEach(l=>l(a))}catch{}},n.onerror=()=>{Qe("ws_onerror",this.wsSnap()),this.clearConnectTimer()},n.onclose=i=>{Qe("ws_onclose",{code:i.code,reason:i.reason,clean:i.wasClean,...this.wsSnap()}),this.clearConnectTimer(),this.ws=null,this.manualClose?this.setStatus("disconnected"):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.destroySocket(),this.setStatus("disconnected")}startLifecycleListeners(){this.lifecycleStarted||typeof document>"u"||typeof window>"u"||(this.lifecycleStarted=!0,document.addEventListener("visibilitychange",this.onVisibilityChange),window.addEventListener("pageshow",this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{const t=Date.now(),r=t-this.lastTick;this.isHidden()||(r>gP&&(Qe("ws_time_jump",{gapMs:r,...this.wsSnap()}),this.forceReconnect("time_jump",!0)),this.lastTick=t)},vP))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener("visibilitychange",this.onVisibilityChange),window.removeEventListener("pageshow",this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(t){var r;if(((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(t)),!0}catch(n){return Qe("ws_send_error",{messageType:t.type,error:n instanceof Error?n.message:String(n),...this.wsSnap()}),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}subscribeStatus(t){return this.statusListeners.add(t),t(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(t)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}forceReconnect(t="unknown",r=!1){var a;if(this.manualClose){Qe("ws_force_skip",{trigger:t,reason:"manual_close"});return}const n=Date.now(),i=r?200:500;if(n-this.lastForceReconnectTs<i){Qe("ws_force_skip",{trigger:t,reason:"debounce",force:r});return}if(!r&&((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.status==="connected"){Qe("ws_force_skip",{trigger:t,reason:"already_connected"});return}this.lastForceReconnectTs=n,Qe("ws_force_reconnect",{trigger:t,force:r,...this.wsSnap()}),this.reconnectAttempts=0,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.destroySocket(),this.connect()}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=window.setInterval(()=>{var t;((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:"ping",seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,Qe("ws_pong_timeout",this.wsSnap()),this.destroySocket(),this.scheduleReconnect()},wP)))},yP)}sendVerificationPing(){var r;if(((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN)return;this.pingSeq+=1;const t=this.pingSeq;Qe("ws_resume_verify",{seq:t,...this.wsSnap()}),this.send({type:"ping",seq:t})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,Qe("ws_resume_verify_timeout",{seq:t,...this.wsSnap()}),this.destroySocket(),this.reconnectAttempts=0,this.connect()},SP))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(t,r=null){this.status=t,this.error=r,this.statusListeners.forEach(n=>n(t,r,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){Qe("ws_schedule_skip",{reason:"hidden",...this.wsSnap()}),this.setStatus("reconnecting");return}this.reconnectAttempts+=1;const t=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);Qe("ws_schedule_reconnect",{delay:t,...this.wsSnap()}),this.setStatus("reconnecting"),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}isHidden(){return typeof document<"u"&&document.visibilityState==="hidden"}clearConnectTimer(){this.connectTimer&&(window.clearTimeout(this.connectTimer),this.connectTimer=null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),!this.ws)return;const t=this.ws;this.ws=null,t.onopen=null,t.onmessage=null,t.onerror=null,t.onclose=null;try{t.close()}catch{}}}const sn=new xP;function bP(){const e=Ge(o=>o.setConnectionStatus),t=Ge(o=>o.setConnectionError),[r,n]=k.useState(sn.getStatus()),[i,a]=k.useState(sn.getConnectionEpoch());k.useEffect(()=>{sn.connect(),sn.startLifecycleListeners();const o=sn.subscribeStatus((c,p,u)=>{n(c),a(u),e(c),t(p)});return()=>{o(),sn.stopLifecycleListeners()}},[t,e]);const l=k.useMemo(()=>o=>{sn.send(o)},[]),s=k.useMemo(()=>sn.subscribe.bind(sn),[]);return{status:r,connectionEpoch:i,sendMessage:l,subscribe:s}}const CP=100;function EP({viewport:e,win:t,doc:r}){if(!e)return!1;const n=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+n),l=Math.max(0,a),s=Math.max(0,e.height||0),o=Math.max(0,e.width||0);return r.documentElement.style.setProperty("--keyboard-inset",`${l}px`),r.documentElement.style.setProperty("--viewport-offset-top",`${n}px`),r.documentElement.style.setProperty("--viewport-offset-left",`${i}px`),r.documentElement.style.setProperty("--visual-viewport-height",`${s}px`),r.documentElement.style.setProperty("--visual-viewport-width",`${o}px`),l>CP?r.documentElement.classList.add("keyboard-visible"):r.documentElement.classList.remove("keyboard-visible"),!0}function kP(e){e.documentElement.style.removeProperty("--keyboard-inset"),e.documentElement.style.removeProperty("--viewport-offset-top"),e.documentElement.style.removeProperty("--viewport-offset-left"),e.documentElement.style.removeProperty("--visual-viewport-height"),e.documentElement.style.removeProperty("--visual-viewport-width"),e.documentElement.classList.remove("keyboard-visible")}function LP(){k.useEffect(()=>{const e=window.visualViewport;if(!e)return;let t=null,r=null;const n=()=>{var v;const _=document.activeElement;if(!_)return!1;const y=(v=_.tagName)==null?void 0:v.toLowerCase();return y==="input"||y==="textarea"?!0:!!_.isContentEditable},i=()=>{EP({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!="function"){i();return}t!==null&&window.cancelAnimationFrame(t);const _=performance.now(),y=()=>{i(),performance.now()-_<1500?t=window.requestAnimationFrame(y):t=null};t=window.requestAnimationFrame(y)},l=()=>{if(!n()){o();return}i()},s=()=>{r!==null||typeof window.setInterval!="function"||(r=window.setInterval(l,250),l())},o=()=>{r===null||typeof window.clearInterval!="function"||(window.clearInterval(r),r=null)},c=()=>{n()?(a(),s(),i()):o()},p=()=>{c()},u=()=>{c()},f=()=>{a()};return i(),c(),e.addEventListener("resize",i),e.addEventListener("scroll",i),typeof window.addEventListener=="function"&&(window.addEventListener("resize",i),window.addEventListener("orientationchange",f)),typeof document.addEventListener=="function"&&(document.addEventListener("focusin",p),document.addEventListener("focusout",u),document.addEventListener("focus",p,!0),document.addEventListener("blur",u,!0)),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),typeof window.removeEventListener=="function"&&(window.removeEventListener("resize",i),window.removeEventListener("orientationchange",f)),typeof document.removeEventListener=="function"&&(document.removeEventListener("focusin",p),document.removeEventListener("focusout",u),document.removeEventListener("focus",p,!0),document.removeEventListener("blur",u,!0)),t!==null&&typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(t),o(),kP(document)}},[])}function TP(){const[e,t]=k.useState(!1),[r,n]=k.useState(void 0),[i,a]=k.useState(void 0),[l,s]=k.useState(void 0),[o,c]=k.useState(!1),[p,u]=k.useState(null),[f,_]=k.useState(null),y=Ge(G=>G.sessions),v=Ge(G=>G.agentSessions),h=Ge(G=>G.selectedSessionId),m=Ge(G=>G.setSessions),d=Ge(G=>G.setAgentSessions),g=Ge(G=>G.setHostStatuses),w=Ge(G=>G.updateSession),b=Ge(G=>G.setSelectedSessionId),x=Ge(G=>G.hasLoaded),C=Ge(G=>G.connectionStatus),S=Ge(G=>G.connectionError),E=Ge(G=>G.clearExitingSession),L=Ge(G=>G.markSessionExiting),A=Ge(G=>G.setRemoteAllowControl),M=Ge(G=>G.setRemoteAllowAttach),D=Ge(G=>G.setHostLabel),B=Ge(G=>G.hostStatuses),H=Ge(G=>G.remoteAllowControl),F=Ge(G=>G.hostLabel),$=Gl(G=>G.theme),I=pe(G=>G.defaultProjectDir),R=pe(G=>G.commandPresets),P=pe(G=>G.defaultPresetId),N=pe(G=>G.lastProjectPath),j=pe(G=>G.setLastProjectPath),U=pe(G=>G.addRecentPath),V=pe(G=>G.shortcutModifier),ee=pe(G=>G.sidebarWidth),Q=pe(G=>G.setSidebarWidth),z=pe(G=>G.projectFilters),O=pe(G=>G.hostFilters),K=pe(G=>G.soundOnPermission),W=pe(G=>G.soundOnIdle),{sendMessage:te,subscribe:Y,connectionEpoch:_e}=bP();LP(),k.useEffect(()=>{if(typeof document>"u"||!K&&!W)return;let G=!1;const J=()=>{G&&!z3()||(G=!0,hd())};return document.addEventListener("click",J,{passive:!0}),document.addEventListener("keydown",J,{passive:!0}),document.addEventListener("touchstart",J,{passive:!0}),()=>{document.removeEventListener("click",J),document.removeEventListener("keydown",J),document.removeEventListener("touchstart",J)}},[K,W]);const ue=k.useRef(!1),se=k.useCallback(G=>{G.preventDefault(),ue.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);k.useEffect(()=>{if(typeof document>"u"||typeof document.addEventListener!="function")return;const G=Oe=>{if(!ue.current)return;const $e=Oe.clientX;Q(Math.max(ey,Math.min(ty,$e)))},J=()=>{ue.current&&(ue.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",J),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",J)}},[Q]),k.useEffect(()=>{const G=Y(J=>{var Oe,$e;if(J.type==="sessions"){const X=Ge.getState().sessions,{soundOnPermission:le,soundOnIdle:ge}=pe.getState();if(le||ge)for(const We of J.sessions){const Z=X.find(Le=>Le.id===We.id);Z&&Z.status!==We.status&&(Z.status!=="permission"&&We.status==="permission"&&le&&dd(),Z.status==="working"&&We.status==="waiting"&&ge&&fd())}m(J.sessions)}if(J.type==="host-status"&&g(J.hosts),J.type==="server-config"&&(A(J.remoteAllowControl),M(J.remoteAllowAttach),D(J.hostLabel),J.clientLogLevel&&HR(J.clientLogLevel)),J.type==="session-update"){const le=Ge.getState().sessions.find(Z=>Z.id===J.session.id),ge=le==null?void 0:le.status,We=J.session.status;if(w(J.session),ge){const{soundOnPermission:Z,soundOnIdle:Le}=pe.getState();ge!=="permission"&&We==="permission"&&Z&&dd(),ge==="working"&&We==="waiting"&&Le&&fd()}}if(J.type==="session-created"){const X=Ge.getState().sessions;X.some(We=>We.id===J.session.id)||m([J.session,...X]),b(J.session.id),U(J.session.projectPath);const{projectFilters:le,setProjectFilters:ge}=pe.getState();le.length>0&&!le.includes(J.session.projectPath)&&ge([...le,J.session.projectPath])}if(J.type==="session-removed"){const X=Ge.getState().sessions,le=X.filter(ge=>ge.id!==J.sessionId);le.length!==X.length&&m(le)}if(J.type==="agent-sessions"&&d(J.active,J.inactive),J.type==="session-orphaned"){const X=Ge.getState().sessions,le=X.filter(ge=>{var We;return((We=ge.agentSessionId)==null?void 0:We.trim())!==J.session.sessionId});le.length!==X.length&&m(le)}if(J.type==="session-resume-result")if(J.ok&&J.session){const X=Ge.getState().sessions;X.some(le=>le.id===J.session.id)||m([J.session,...X]),b(J.session.id)}else J.ok||(u(`${(Oe=J.error)==null?void 0:Oe.code}: ${($e=J.error)==null?void 0:$e.message}`),window.setTimeout(()=>u(null),6e3));J.type==="terminal-error"&&(!J.sessionId||J.sessionId===h)&&(u(`${J.code}: ${J.message}`),window.setTimeout(()=>u(null),6e3)),J.type==="terminal-ready"&&J.sessionId===h&&u(null),J.type==="error"&&(u(J.message),window.setTimeout(()=>u(null),6e3)),J.type==="kill-failed"&&(E(J.sessionId),u(J.message),window.setTimeout(()=>u(null),6e3)),J.type==="session-pin-result"&&!J.ok&&J.error&&(u(J.error),window.setTimeout(()=>u(null),6e3)),J.type==="session-resurrection-failed"&&yS.add({title:"Session resurrection failed",description:`"${J.displayName}" could not be resumed: ${J.error}`,type:"error",timeout:8e3})});return()=>{G()}},[h,U,E,te,b,m,d,g,A,M,D,Y,w]);const re=k.useMemo(()=>y.find(G=>G.id===h)||null,[h,y]);k.useEffect(()=>{re!=null&&re.projectPath&&!re.remote&&j(re.projectPath)},[re==null?void 0:re.projectPath,re==null?void 0:re.remote,j]);const ae=pe(G=>G.sessionSortMode),ye=pe(G=>G.sessionSortDirection),ve=pe(G=>G.manualSessionOrder),ne=k.useMemo(()=>rp(y,{mode:ae,direction:ye,manualOrder:ve}),[y,ae,ye,ve]),ie=k.useMemo(()=>{let G=ne;return z.length>0&&(G=G.filter(J=>z.includes(J.projectPath))),O.length>0&&(G=G.filter(J=>O.includes(J.host??""))),G},[ne,z,O]);k.useEffect(()=>{h&&ie.length>0&&!ie.some(G=>G.id===h)&&b(ie[0].id)},[h,ie,b]),k.useEffect(()=>{window.matchMedia("(max-width: 767px)").matches&&x&&h===null&&ne.length>0&&b(ne[0].id)},[x,h,ne,b]);const he=k.useCallback(G=>{L(G),te({type:"session-kill",sessionId:G})},[L,te]);k.useEffect(()=>{const G=Zo(V),J=Oe=>{if(Oe.defaultPrevented)return;const $e=Oe.code,X=$C(Oe,G);if(X&&($e==="BracketLeft"||$e==="BracketRight")){Oe.preventDefault();const le=ie;if(le.length===0)return;const ge=le.findIndex(Le=>Le.id===h);if(ge===-1){b(le[0].id);return}const Z=(ge+($e==="BracketLeft"?-1:1)+le.length)%le.length;b(le[Z].id);return}if(X&&$e==="KeyN"){Oe.preventDefault(),e||t(!0);return}if(X&&$e==="KeyX"){Oe.preventDefault(),h&&!e&&he(h);return}};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[e,h,b,ie,he,V]);const oe=()=>{n(void 0),a(void 0),s(void 0),t(!0)},me=()=>c(!0),xe=(G,J,Oe,$e)=>{te({type:"session-create",projectPath:G,name:J,command:Oe,host:$e}),$e||j(G)},ke=G=>{te({type:"session-resume",sessionId:G})},Ne=(G,J)=>{te({type:"session-rename",sessionId:G,newName:J})},Ke=k.useCallback(G=>{const J=y.find(Oe=>Oe.id===G);J&&te({type:"session-create",projectPath:J.projectPath,command:J.command||void 0,host:J.remote&&J.host?J.host:void 0})},[y,te]),Ae=k.useCallback((G,J)=>{te({type:"session-pin",sessionId:G,isPinned:J})},[te]);k.useEffect(()=>{document.documentElement.setAttribute("data-theme",$)},[$]),k.useEffect(()=>{fetch("/api/server-info").then(G=>G.json()).then(G=>_(G)).catch(()=>{})},[]);const Pe=k.useMemo(()=>F?B.filter(G=>G.host!==F):B,[B,F]);return T.jsxs("div",{className:"flex h-full overflow-hidden",children:[T.jsxs("div",{className:"hidden h-full flex-col md:flex md:shrink-0",style:{width:ee},children:[T.jsx(zC,{connectionStatus:C,onNewSession:oe,onOpenSettings:me,tailscaleIp:(f==null?void 0:f.tailscaleIp)??null}),T.jsx(hw,{sessions:y,inactiveSessions:v.inactive,selectedSessionId:h,onSelect:b,onRename:Ne,onResume:ke,onKill:he,onDuplicate:Ke,onSetPinned:Ae,loading:!x,error:S||p})]}),T.jsx("div",{className:"hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20",onMouseDown:se}),T.jsx(sM,{session:re,sessions:ie,connectionStatus:C,connectionEpoch:_e,sendMessage:te,subscribe:Y,onClose:()=>b(null),onSelectSession:b,onNewSession:oe,onKillSession:he,onRenameSession:Ne,onOpenSettings:me,onResumeSession:ke,onSetPinned:Ae,inactiveSessions:v.inactive,loading:!x,error:S||p}),T.jsx(oM,{isOpen:e,onClose:()=>t(!1),onCreate:xe,defaultProjectDir:I,commandPresets:R,defaultPresetId:P,lastProjectPath:N,activeProjectPath:re&&!re.remote?re.projectPath:void 0,remoteHosts:Pe,remoteAllowControl:H,initialHost:r,initialPath:i,initialCommand:l}),T.jsx(W3,{isOpen:o,onClose:()=>c(!1)}),T.jsx(pP,{})]})}const RP="modulepreload",DP=function(e){return"/"+e},Fv={},MP=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),s=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=Promise.allSettled(r.map(o=>{if(o=DP(o),o in Fv)return;Fv[o]=!0;const c=o.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${p}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":RP,c||(u.as="script"),u.crossOrigin="",u.href=o,s&&u.setAttribute("nonce",s),document.head.appendChild(u),c)return new Promise((f,_)=>{u.addEventListener("load",f),u.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${o}`)))})}))}function a(l){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=l,window.dispatchEvent(s),!s.defaultPrevented)throw l}return i.then(l=>{for(const s of l||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})};function AP(e={}){const{immediate:t=!1,onNeedRefresh:r,onOfflineReady:n,onRegistered:i,onRegisteredSW:a,onRegisterError:l}=e;let s,o;const c=async(u=!0)=>{await o};async function p(){if("serviceWorker"in navigator){if(s=await MP(async()=>{const{Workbox:u}=await import("./workbox-window.prod.es5-vqzQaGvo.js");return{Workbox:u}},[]).then(({Workbox:u})=>new u("/sw.js",{scope:"/",type:"classic"})).catch(u=>{l==null||l(u)}),!s)return;s.addEventListener("activated",u=>{(u.isUpdate||u.isExternal)&&window.location.reload()}),s.addEventListener("installed",u=>{u.isUpdate||n==null||n()}),s.register({immediate:t}).then(u=>{a?a("/sw.js",u):i==null||i(u)}).catch(u=>{l==null||l(u)})}}return o=p(),c}Qo()&&document.documentElement.classList.add("ios");NC()&&document.documentElement.classList.add("ios-pwa");AP({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},5*60*1e3),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&t.update()}))}});const wS=document.getElementById("root");if(!wS)throw new Error("Root element not found");Z0(wS).render(T.jsx(gt.StrictMode,{children:T.jsx(TP,{})}));
|
|
316
|
+
*/var Cc=k,_A=fS;function yA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wA=typeof Object.is=="function"?Object.is:yA,SA=_A.useSyncExternalStore,xA=Cc.useRef,bA=Cc.useEffect,CA=Cc.useMemo,EA=Cc.useDebugValue;mS.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var a=xA(null);if(a.current===null){var l={hasValue:!1,value:null};a.current=l}else l=a.current;a=CA(function(){function o(_){if(!c){if(c=!0,p=_,_=n(_),i!==void 0&&l.hasValue){var y=l.value;if(i(y,_))return u=y}return u=_}if(y=u,wA(p,_))return y;var v=n(_);return i!==void 0&&i(y,v)?(p=_,y):(p=_,u=v)}var c=!1,p,u,f=r===void 0?null:r;return[function(){return o(t())},f===null?void 0:function(){return o(f())}]},[t,r,n,i]);var s=SA(e,a[0],a[1]);return bA(function(){l.hasValue=!0,l.value=s},[s]),EA(s),s};pS.exports=mS;var kA=pS.exports;const LA=ap(19),TA=LA?DA:MA;function gS(e,t,r,n,i){return TA(e,t,r,n,i)}function RA(e,t,r,n,i){const a=k.useCallback(()=>t(e.getSnapshot(),r,n,i),[e,t,r,n,i]);return fS.useSyncExternalStore(e.subscribe,a,a)}function DA(e,t,r,n,i){return RA(e,t,r,n,i)}function MA(e,t,r,n,i){return kA.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,a=>t(a,r,n,i))}class AA{constructor(t){tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const r=this.updateTick;for(const n of this.listeners){if(r!==this.updateTick)return;n(t)}}update(t){for(const r in t)if(!Object.is(this.state[r],t[r])){this.setState({...this.state,...t});return}}set(t,r){Object.is(this.state[t],r)||this.setState({...this.state,[t]:r})}notifyAll(){const t={...this.state};this.setState(t)}use(t,r,n,i){return gS(this,t,r,n,i)}}class PA extends AA{constructor(t,r={},n){super(t),this.context=r,this.selectors=n}useSyncedValue(t,r){k.useDebugValue(t),qt(()=>{this.state[t]!==r&&this.set(t,r)},[t,r])}useSyncedValueWithCleanup(t,r){const n=this;qt(()=>(n.state[t]!==r&&n.set(t,r),()=>{n.set(t,void 0)}),[n,t,r])}useSyncedValues(t){const r=this,n=Object.values(t);qt(()=>{r.update(t)},[r,...n])}useControlledProp(t,r){k.useDebugValue(t);const n=r!==void 0;qt(()=>{n&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})},[t,r,n])}select(t,r,n,i){const a=this.selectors[t];return a(this.state,r,n,i)}useState(t,r,n,i){return k.useDebugValue(t),gS(this,this.selectors[t],r,n,i)}useContextCallback(t,r){k.useDebugValue(t);const n=Xr(r??ur);this.context[t]=n}useStateSetter(t){const r=k.useRef(void 0);return r.current===void 0&&(r.current=n=>{this.set(t,n)}),r.current}observe(t,r){let n;typeof t=="function"?n=t:n=this.selectors[t];let i=n(this.state);return r(i,i,this),this.subscribe(a=>{const l=n(a);if(!Object.is(i,l)){const s=i;i=l,r(l,s,this)}})}}const $a=null;class IA{constructor(){tt(this,"callbacks",[]);tt(this,"callbacksCount",0);tt(this,"nextId",1);tt(this,"startId",1);tt(this,"isScheduled",!1);tt(this,"tick",t=>{var i;this.isScheduled=!1;const r=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let a=0;a<r.length;a+=1)(i=r[a])==null||i.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const Ha=new IA;class _p{constructor(){tt(this,"currentId",$a);tt(this,"cancel",()=>{this.currentId!==$a&&(Ha.cancel(this.currentId),this.currentId=$a)});tt(this,"disposeEffect",()=>this.cancel)}static create(){return new _p}static request(t){return Ha.request(t)}static cancel(t){return Ha.cancel(t)}request(t){this.cancel(),this.currentId=Ha.request(()=>{this.currentId=$a,t()})}}function BA(){const e=ks(_p.create).current;return mp(e.disposeEffect),e}const Ui=0;class Ko{constructor(){tt(this,"currentId",Ui);tt(this,"clear",()=>{this.currentId!==Ui&&(clearTimeout(this.currentId),this.currentId=Ui)});tt(this,"disposeEffect",()=>this.clear)}static create(){return new Ko}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ui,r()},t)}isStarted(){return this.currentId!==Ui}}function OA(){const e=ks(Ko.create).current;return mp(e.disposeEffect),e}let Ov=0;function vS(e){return Ov+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${Ov}`}function Js(e){return(e==null?void 0:e.ownerDocument)||document}function Du(e,t){if(typeof e=="string")return{description:e};if(typeof e=="function"){const r=e(t);return typeof r=="string"?{description:r}:r}return e}const aa=typeof navigator<"u",Mu=HA(),NA=UA(),jA=zA();typeof CSS>"u"||!CSS.supports||CSS.supports("-webkit-backdrop-filter:none");Mu.platform==="MacIntel"&&Mu.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(Mu.platform);const FA=aa&&/apple/i.test(navigator.vendor);aa&&NA.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const $A=jA.includes("jsdom/");function HA(){if(!aa)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function zA(){if(!aa)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:r})=>`${t}/${r}`).join(" "):navigator.userAgent}function UA(){if(!aa)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Ql(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function yi(e,t){var n;if(!e||!t)return!1;const r=(n=t.getRootNode)==null?void 0:n.call(t);if(e.contains(t))return!0;if(r&&PM(r)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function yp(e){return"composedPath"in e?e.composedPath()[0]:e.target}function pd(e){if(!e||$A)return!0;try{return e.matches(":focus-visible")}catch{return!0}}const za=lA(e=>e.toasts,e=>{const t=new Map;let r=0,n=0;return e.forEach((i,a)=>{const l=i.transitionStatus==="ending";t.set(i.id,{value:i,domIndex:a,visibleIndex:l?-1:r,offsetY:n}),n+=i.height||0,l||(r+=1)}),t}),nn={toasts:Tr(e=>e.toasts),isEmpty:Tr(e=>e.toasts.length===0),toast:Tr(za,(e,t)=>{var r;return(r=e.get(t))==null?void 0:r.value}),toastIndex:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.domIndex)??-1}),toastOffsetY:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.offsetY)??0}),toastVisibleIndex:Tr(za,(e,t)=>{var r;return((r=e.get(t))==null?void 0:r.visibleIndex)??-1}),hovering:Tr(e=>e.hovering),focused:Tr(e=>e.focused),expanded:Tr(e=>e.hovering||e.focused),expandedOrOutOfFocus:Tr(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:Tr(e=>e.prevFocusElement)};class WA extends PA{constructor(r){super(r,{},nn);tt(this,"timers",new Map);tt(this,"areTimersPaused",!1);tt(this,"setViewport",r=>{this.set("viewport",r)});tt(this,"disposeEffect",()=>()=>{this.timers.forEach(r=>{var n;(n=r.timeout)==null||n.clear()}),this.timers.clear()});tt(this,"addToast",r=>{const{toasts:n,timeout:i,limit:a}=this.state,l=r.id||vS("toast"),s={...r,id:l,transitionStatus:"starting"},o=[s,...n],c=o.filter(u=>u.transitionStatus!=="ending");if(c.length>a){const u=c.length-a,f=c.slice(-u),_=new Set(f.map(y=>y.id));this.setToasts(o.map(y=>{const v=_.has(y.id);return y.limited!==v?{...y,limited:v}:y}))}else this.setToasts(o.map(u=>u.limited?{...u,limited:!1}:u));const p=s.timeout??i;return s.type!=="loading"&&p>0&&this.scheduleTimer(l,p,()=>this.closeToast(l)),nn.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),l});tt(this,"updateToast",(r,n)=>{this.updateToastInternal(r,n)});tt(this,"updateToastInternal",(r,n)=>{var v,h;const{timeout:i,toasts:a}=this.state,l=nn.toast(this.state,r)??null;if(!l||l.transitionStatus==="ending")return;const s={...l,...n};this.setToasts(a.map(m=>m.id===r?{...m,...n}:m));const o=s.timeout??i,c=(l==null?void 0:l.timeout)??i,p=Object.hasOwn(n,"timeout"),u=s.transitionStatus!=="ending"&&s.type!=="loading"&&o>0,f=this.timers.has(r),_=c!==o,y=(l==null?void 0:l.type)==="loading";if(!u&&f){const m=this.timers.get(r);(v=m==null?void 0:m.timeout)==null||v.clear(),this.timers.delete(r);return}if(u&&(!f||_||p||y)){const m=this.timers.get(r);m&&((h=m.timeout)==null||h.clear(),this.timers.delete(r)),this.scheduleTimer(r,o,()=>this.closeToast(r)),nn.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}});tt(this,"closeToast",r=>{var c;const n=nn.toast(this.state,r);(c=n==null?void 0:n.onClose)==null||c.call(n);const{limit:i,toasts:a}=this.state;let l=0;const s=a.map(p=>{if(p.id===r)return{...p,transitionStatus:"ending",height:0};if(p.transitionStatus==="ending")return p;const u=l>=i;return l+=1,p.limited!==u?{...p,limited:u}:p}),o=this.timers.get(r);o&&o.timeout&&(o.timeout.clear(),this.timers.delete(r)),this.handleFocusManagement(r),this.setToasts(s)});tt(this,"promiseToast",(r,n)=>{const i=Du(n.loading),a=this.addToast({...i,type:"loading"}),l=r.then(s=>{const o=Du(n.success,s);return this.updateToast(a,{...o,type:"success",timeout:o.timeout}),s}).catch(s=>{const o=Du(n.error,s);return this.updateToast(a,{...o,type:"error",timeout:o.timeout}),Promise.reject(s)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(l),l});tt(this,"handleDocumentPointerDown",r=>{if(r.pointerType!=="touch")return;const n=yp(r);yi(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}setFocused(r){this.set("focused",r)}setHovering(r){this.set("hovering",r)}setIsWindowFocused(r){this.set("isWindowFocused",r)}setPrevFocusElement(r){this.set("prevFocusElement",r)}removeToast(r){var l;const n=nn.toastIndex(this.state,r);if(n===-1)return;const i=this.state.toasts[n];(l=i==null?void 0:i.onRemove)==null||l.call(i);const a=[...this.state.toasts];a.splice(n,1),this.setToasts(a)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(r=>{if(r.timeout){r.timeout.clear();const n=Date.now()-r.start,i=r.delay-n;r.remaining=i>0?i:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((r,n)=>{r.remaining=r.remaining>0?r.remaining:r.delay,r.timeout??(r.timeout=Ko.create()),r.timeout.start(r.remaining,()=>{this.timers.delete(n),r.callback()}),r.start=Date.now()}))}restoreFocusToPrevElement(){var r;(r=this.state.prevFocusElement)==null||r.focus({preventScroll:!0})}scheduleTimer(r,n,i){const a=Date.now(),l=!nn.expandedOrOutOfFocus(this.state),s=l?Ko.create():void 0;s==null||s.start(n,()=>{this.timers.delete(r),i()}),this.timers.set(r,{timeout:s,start:l?a:0,delay:n,remaining:n,callback:i})}setToasts(r){const n={toasts:r};r.length===0&&(n.hovering=!1,n.focused=!1),this.update(n)}handleFocusManagement(r){var o,c;const n=Ql(Js(this.state.viewport));if(!this.state.viewport||!yi(this.state.viewport,n)||!pd(n))return;const i=nn.toasts(this.state),a=nn.toastIndex(this.state,r);let l=null,s=a+1;for(;s<i.length;){if(i[s].transitionStatus!=="ending"){l=i[s];break}s+=1}if(!l)for(s=a-1;s>=0;){if(i[s].transitionStatus!=="ending"){l=i[s];break}s-=1}l?(c=(o=l.ref)==null?void 0:o.current)==null||c.focus():this.restoreFocusToPrevElement()}}const VA=function(t){const{children:r,timeout:n=5e3,limit:i=3,toastManager:a}=t,l=ks(()=>new WA({timeout:n,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return mp(l.disposeEffect),k.useEffect(function(){return a?a[" subscribe"](({action:c,options:p})=>{const u=p.id;c==="promise"&&p.promise?l.promiseToast(p.promise,p):c==="update"&&u?l.updateToast(u,p):c==="close"&&u?l.closeToast(u):l.addToast(p)}):void 0},[l,n,a]),l.useSyncedValues({timeout:n,limit:i}),T.jsx(gp.Provider,{value:l,children:r})},Au=k.forwardRef(function(t,r){const[n,i]=k.useState();qt(()=>{FA&&i("button")},[]);const a={tabIndex:0,role:n};return T.jsx("span",{...t,ref:r,style:op,"aria-hidden":n?void 0:!0,...a,"data-base-ui-focus-guard":""})});let KA=function(e){return e.frontmostHeight="--toast-frontmost-height",e}({});const GA=k.forwardRef(function(t,r){var M;const{render:n,className:i,children:a,...l}=t,s=vp(),o=OA(),c=k.useRef(!1),p=k.useRef(!1),u=s.useState("isEmpty"),f=s.useState("toasts"),_=s.useState("focused"),y=s.useState("expanded"),v=s.useState("prevFocusElement"),h=((M=f[0])==null?void 0:M.height)??0,m=k.useMemo(()=>f.some(D=>D.transitionStatus==="ending"),[f]);k.useEffect(()=>{const D=s.state.viewport;if(!D)return;function B(F){u||F.key==="F6"&&F.target!==D&&(F.preventDefault(),s.setPrevFocusElement(Ql(Js(D))),D==null||D.focus({preventScroll:!0}),s.pauseTimers(),s.setFocused(!0))}const H=Vo(D);return H.addEventListener("keydown",B),()=>{H.removeEventListener("keydown",B)}},[s,u]),k.useEffect(()=>{const D=s.state.viewport;if(!D||u)return;const B=Vo(D);function H($){$.target===B&&(s.setIsWindowFocused(!1),s.pauseTimers())}function F($){if($.relatedTarget||$.target===B)return;const I=yp($),R=Ql(Js(D));(!yi(D,I)||!pd(R))&&s.resumeTimers(),o.start(0,()=>s.setIsWindowFocused(!0))}return B.addEventListener("blur",H,!0),B.addEventListener("focus",F,!0),()=>{B.removeEventListener("blur",H,!0),B.removeEventListener("focus",F,!0)}},[s,o,u]),k.useEffect(()=>{const D=s.state.viewport;if(!D||u)return;const B=Js(D);return B.addEventListener("pointerdown",s.handleDocumentPointerDown,!0),()=>{B.removeEventListener("pointerdown",s.handleDocumentPointerDown,!0)}},[u,s]);function d(D){var H,F,$;const B=s.state.viewport;B&&(c.current=!0,D.relatedTarget===B?($=(F=(H=f[0])==null?void 0:H.ref)==null?void 0:F.current)==null||$.focus():s.restoreFocusToPrevElement())}function g(D){D.key==="Tab"&&D.shiftKey&&D.target===s.state.viewport&&(D.preventDefault(),s.restoreFocusToPrevElement(),s.resumeTimers())}k.useEffect(()=>{!s.state.isWindowFocused||m||!p.current||(s.resumeTimers(),s.setHovering(!1),p.current=!1)},[m,s]);function w(){s.pauseTimers(),s.setHovering(!0),p.current=!1}function b(){m?p.current=!0:(s.resumeTimers(),s.setHovering(!1))}function x(){if(c.current){c.current=!1;return}_||pd(Js(s.state.viewport).activeElement)&&(s.setFocused(!0),s.pauseTimers())}function C(D){!_||yi(s.state.viewport,D.relatedTarget)||(s.setFocused(!1),s.resumeTimers())}const S={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:w,onMouseMove:w,onMouseLeave:b,onFocus:x,onBlur:C,onKeyDown:g,onClick:x},E={expanded:y},L=Ls("div",t,{ref:[r,s.setViewport],state:E,props:[S,{style:{[KA.frontmostHeight]:h?`${h}px`:void 0}},l,{children:T.jsxs(k.Fragment,{children:[!u&&v&&T.jsx(Au,{onFocus:d}),a,!u&&v&&T.jsx(Au,{onFocus:d})]})}]}),A=k.useMemo(()=>f.filter(D=>D.priority==="high"),[f]);return T.jsxs(k.Fragment,{children:[!u&&v&&T.jsx(Au,{onFocus:d}),L,!_&&A.length>0&&T.jsx("div",{style:op,children:A.map(D=>T.jsxs("div",{role:"alert","aria-atomic":!0,children:[T.jsx("div",{children:D.title}),T.jsx("div",{children:D.description})]},D.id))})]})});function qA(e){return ap(19)?e:e?"true":void 0}const _S=k.createContext(void 0);function wp(){const e=k.useContext(_S);if(!e)throw new Error(Yr(66));return e}let Sp=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const XA={[Sp.startingStyle]:""},YA={[Sp.endingStyle]:""},JA={transitionStatus(e){return e==="starting"?XA:e==="ending"?YA:null}};function QA(e){return e==null?e:"current"in e?e.current:e}function ZA(e,t=!1,r=!0){const n=BA();return Xr((i,a=null)=>{n.cancel();function l(){hn.flushSync(i)}const s=QA(e);if(s==null)return;const o=s;if(typeof o.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{let u=function(){const _=Sp.startingStyle;if(!o.hasAttribute(_)){n.request(f);return}const y=new MutationObserver(()=>{o.hasAttribute(_)||(y.disconnect(),f())});y.observe(o,{attributes:!0,attributeFilter:[_]}),a==null||a.addEventListener("abort",()=>y.disconnect(),{once:!0})},f=function(){Promise.all(o.getAnimations().map(_=>_.finished)).then(()=>{a!=null&&a.aborted||l()}).catch(()=>{const _=o.getAnimations();if(r){if(a!=null&&a.aborted)return;l()}else _.length>0&&_.some(y=>y.pending||y.playState!=="finished")&&f()})};var c=u,p=f;if(t){u();return}n.request(f)}})}function eP(e){const{enabled:t=!0,open:r,ref:n,onComplete:i}=e,a=Xr(i),l=ZA(n,r,!1);k.useEffect(()=>{if(!t)return;const s=new AbortController;return l(a,s.signal),()=>{s.abort()}},[t,r,a,l])}let ss=function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.height="--toast-height",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e}({});const tP={...JA,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},Wi=40,rP=10,En=.5,nP=1;function Nv(e,t,r){switch(e){case"up":return-r;case"down":return r;case"left":return-t;case"right":return t;default:return 0}}function sP(e){const r=window.getComputedStyle(e).transform;let n=0,i=0,a=1;if(r&&r!=="none"){const l=r.match(/matrix(?:3d)?\(([^)]+)\)/);if(l){const s=l[1].split(", ").map(parseFloat);s.length===6?(n=s[4],i=s[5],a=Math.sqrt(s[0]*s[0]+s[1]*s[1])):s.length===16&&(n=s[12],i=s[13],a=s[0])}}return{x:n,y:i,scale:a}}const iP=k.forwardRef(function(t,r){var ve;const{toast:n,render:i,className:a,swipeDirection:l=["down","right"],...s}=t,o=((ve=n.positionerProps)==null?void 0:ve.anchor)!==void 0;let c=[];o||(c=Array.isArray(l)?l:[l]);const p=c.length>0,u=vp(),[f,_]=k.useState(void 0),[y,v]=k.useState(!1),[h,m]=k.useState(!1),[d,g]=k.useState(!1),[w,b]=k.useState({x:0,y:0}),[x,C]=k.useState({x:0,y:0,scale:1}),[S,E]=k.useState(),[L,A]=k.useState(),[M,D]=k.useState(null),B=k.useRef(null),H=k.useRef({x:0,y:0}),F=k.useRef({x:0,y:0,scale:1}),$=k.useRef(void 0),I=k.useRef(0),R=k.useRef(!1),P=k.useRef({x:0,y:0}),N=k.useRef(!1),j=u.useState("toastIndex",n.id),U=u.useState("toastVisibleIndex",n.id),V=u.useState("toastOffsetY",n.id),ee=u.useState("focused"),Q=u.useState("expanded");eP({open:n.transitionStatus!=="ending",ref:B,onComplete(){n.transitionStatus==="ending"&&u.removeToast(n.id)}});const z=Xr((ne=!1)=>{const ie=B.current;if(!ie)return;const he=ie.style.height;ie.style.height="auto";const oe=ie.offsetHeight;ie.style.height=he;function me(){u.updateToastInternal(n.id,{ref:B,height:oe,...n.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}ne?hn.flushSync(me):me()});qt(z,[z]);function O(ne,ie){let he=ne,oe=ie;return!c.includes("left")&&!c.includes("right")?he=ne>0?ne**En:-(Math.abs(ne)**En):(!c.includes("right")&&ne>0&&(he=ne**En),!c.includes("left")&&ne<0&&(he=-(Math.abs(ne)**En))),!c.includes("up")&&!c.includes("down")?oe=ie>0?ie**En:-(Math.abs(ie)**En):(!c.includes("down")&&ie>0&&(oe=ie**En),!c.includes("up")&&ie<0&&(oe=-(Math.abs(ie)**En))),{x:he,y:oe}}function K(ne){var oe;if(ne.button!==0)return;ne.pointerType==="touch"&&u.pauseTimers();const ie=yp(ne.nativeEvent);if(!(ie&&ie.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(R.current=!1,$.current=void 0,I.current=0,H.current={x:ne.clientX,y:ne.clientY},P.current=H.current,B.current){const me=sP(B.current);F.current=me,C(me),b({x:me.x,y:me.y})}u.setHovering(!0),v(!0),m(!1),D(null),N.current=!0,(oe=B.current)==null||oe.setPointerCapture(ne.pointerId)}}function W(ne){if(!y)return;ne.preventDefault(),N.current&&(H.current={x:ne.clientX,y:ne.clientY},N.current=!1);const{clientY:ie,clientX:he,movementX:oe,movementY:me}=ne;(me<0&&ie>P.current.y||me>0&&ie<P.current.y)&&(P.current={x:P.current.x,y:ie}),(oe<0&&he>P.current.x||oe>0&&he<P.current.x)&&(P.current={x:he,y:P.current.y});const xe=he-H.current.x,ke=ie-H.current.y,Ne=ie-P.current.y,Ke=he-P.current.x;if(!h&&Math.sqrt(xe*xe+ke*ke)>=nP&&(m(!0),M===null)){const $e=c.includes("left")||c.includes("right"),X=c.includes("up")||c.includes("down");if($e&&X){const le=Math.abs(xe),ge=Math.abs(ke);D(le>ge?"horizontal":"vertical")}}let Ae;if(!$.current)M==="vertical"?ke>0?Ae="down":ke<0&&(Ae="up"):M==="horizontal"?xe>0?Ae="right":xe<0&&(Ae="left"):Math.abs(xe)>=Math.abs(ke)?Ae=xe>0?"right":"left":Ae=ke>0?"down":"up",Ae&&c.includes(Ae)&&($.current=Ae,I.current=Nv(Ae,xe,ke),_(Ae));else{const Oe=$.current,$e=Nv(Oe,Ke,Ne);$e>Wi?(R.current=!1,_(Oe)):!(c.includes("left")&&c.includes("right"))&&!(c.includes("up")&&c.includes("down"))&&I.current-$e>=rP&&(R.current=!0)}const Pe=O(xe,ke);let G=F.current.x,Y=F.current.y;M==="horizontal"?(c.includes("left")||c.includes("right"))&&(G+=Pe.x):(M==="vertical"||(c.includes("left")||c.includes("right"))&&(G+=Pe.x),(c.includes("up")||c.includes("down"))&&(Y+=Pe.y)),b({x:G,y:Y})}function te(ne){var xe;if(!y)return;if(v(!1),m(!1),D(null),(xe=B.current)==null||xe.releasePointerCapture(ne.pointerId),R.current){b({x:x.x,y:x.y}),_(void 0);return}let ie=!1;const he=w.x-x.x,oe=w.y-x.y;let me;for(const ke of c){switch(ke){case"right":he>Wi&&(ie=!0,me="right");break;case"left":he<-Wi&&(ie=!0,me="left");break;case"down":oe>Wi&&(ie=!0,me="down");break;case"up":oe<-Wi&&(ie=!0,me="up");break}if(ie)break}ie?(_(me),g(!0),u.closeToast(n.id)):(b({x:x.x,y:x.y}),_(void 0))}function J(ne){if(ne.key==="Escape"){if(!B.current||!yi(B.current,Ql(Js(B.current))))return;u.closeToast(n.id)}}k.useEffect(()=>{if(!p)return;const ne=B.current;if(!ne)return;function ie(he){yi(ne,he.target)&&he.preventDefault()}return ne.addEventListener("touchmove",ie,{passive:!1}),()=>{ne.removeEventListener("touchmove",ie)}},[p]);function _e(){if(!y&&w.x===x.x&&w.y===x.y&&!d)return{[ss.swipeMovementX]:"0px",[ss.swipeMovementY]:"0px"};const ne=w.x-x.x,ie=w.y-x.y;return{transition:y?"none":void 0,transform:y?`translateX(${w.x}px) translateY(${w.y}px) scale(${x.scale})`:void 0,[ss.swipeMovementX]:`${ne}px`,[ss.swipeMovementY]:`${ie}px`}}const ue=n.priority==="high",se={role:ue?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":S,"aria-describedby":L,"aria-hidden":ue&&!ee?!0:void 0,onPointerDown:p?K:void 0,onPointerMove:p?W:void 0,onPointerUp:p?te:void 0,onKeyDown:J,inert:qA(n.limited),style:{..._e(),[ss.index]:n.transitionStatus==="ending"?j:U,[ss.offsetY]:`${V}px`,[ss.height]:n.height?`${n.height}px`:void 0}},re=k.useMemo(()=>({rootRef:B,toast:n,titleId:S,setTitleId:E,descriptionId:L,setDescriptionId:A,swiping:y,swipeDirection:f,recalculateHeight:z,index:j,visibleIndex:U,expanded:Q}),[n,S,L,y,f,z,j,U,Q]),ae={transitionStatus:n.transitionStatus,expanded:Q,limited:n.limited||!1,type:n.type,swiping:re.swiping,swipeDirection:re.swipeDirection},ye=Ls("div",t,{ref:[r,re.rootRef],state:ae,stateAttributesMapping:tP,props:[se,s]});return T.jsx(_S.Provider,{value:re,children:ye})}),oP=k.forwardRef(function(t,r){const{render:n,className:i,id:a,children:l,...s}=t,{toast:o,setDescriptionId:c}=wp(),p=l??o.description,u=!!p,f=cp(a);qt(()=>{if(u)return c(f),()=>{c(void 0)}},[u,f,c]);const _={type:o.type},y=Ls("p",t,{ref:r,state:_,props:{...s,id:f,children:p}});return u?y:null}),aP=k.forwardRef(function(t,r){const{render:n,className:i,id:a,children:l,...s}=t,{toast:o,setTitleId:c}=wp(),p=l??o.title,u=!!p,f=cp(a);qt(()=>{if(u)return c(f),()=>{c(void 0)}},[u,f,c]);const _={type:o.type},y=Ls("h2",t,{ref:r,state:_,props:{...s,id:f,children:p}});return u?y:null}),lP=k.forwardRef(function(t,r){const{render:n,className:i,disabled:a,nativeButton:l=!0,...s}=t,o=vp(),{toast:c}=wp(),p=o.useState("expanded"),[u,f]=k.useState(!1),{getButtonProps:_,buttonRef:y}=Uw({disabled:a,native:l}),v={type:c.type};return Ls("button",t,{ref:[r,y],state:v,props:[{"aria-hidden":!p&&!u,onClick(){o.closeToast(c.id)},onFocus(){f(!0)},onBlur(){f(!1)}},s,_]})});function cP(){const e=k.useContext(gp);if(!e)throw new Error(Yr(73));const t=e.useState("toasts");return k.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function uP(){const e=new Set;function t(r){e.forEach(n=>n(r))}return{" subscribe":function(n){return e.add(n),()=>{e.delete(n)}},add(r){const n=r.id||vS("toast"),i={...r,id:n,transitionStatus:"starting"};return t({action:"add",options:i}),n},close(r){t({action:"close",options:{id:r}})},update(r,n){t({action:"update",options:{...n,id:r}})},promise(r,n){let i=r;return t({action:"promise",options:{...n,promise:r,setPromise(a){i=a}}}),i}}}const hP=5e3,yS=uP();function dP({toast:e}){return T.jsxs(iP,{toast:e,className:Xl("relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg","data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]","data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]","data-[ending-style]:opacity-0","data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0","transition-all duration-200",e.type==="error"&&"border-error/50",e.type==="success"&&"border-approval/50",(!e.type||e.type==="info")&&"border-border"),children:[T.jsxs("div",{className:"flex-1 min-w-0",children:[T.jsx(aP,{className:Xl("text-sm font-medium",e.type==="error"&&"text-error",e.type==="success"&&"text-approval",(!e.type||e.type==="info")&&"text-primary"),children:e.title}),e.description&&T.jsx(oP,{className:"mt-1 text-xs text-muted line-clamp-2",children:e.description})]}),T.jsx(lP,{className:"shrink-0 text-muted hover:text-primary transition-colors","aria-label":"Close",children:T.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[T.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),T.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function fP(){const{toasts:e}=cP();return T.jsx(T.Fragment,{children:e.map(t=>T.jsx(dP,{toast:t},t.id))})}function pP(){return T.jsxs(VA,{timeout:hP,toastManager:yS,children:[T.jsx(fP,{}),T.jsx(GA,{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2"})]})}const jv=["CONNECTING","OPEN","CLOSING","CLOSED"],mP=3e3,gP=15e3,vP=5e3,_P=1e4,yP=2e4,wP=1e4,SP=3e3;class xP{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status="connecting",this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.onVisibilityChange=()=>{if(Qe("ws_visibility",{state:document.visibilityState,...this.wsSnap()}),document.visibilityState==="visible"){const t=Date.now(),n=t-this.lastTick>_P;this.lastTick=t,this.forceReconnect("visibilitychange",n),!n&&this.status==="connected"&&(this.startHeartbeat(),this.sendVerificationPing())}else this.stopHeartbeat(),this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},this.onPageShow=t=>{Qe("ws_pageshow",{persisted:t.persisted,...this.wsSnap()}),t.persisted&&(this.lastTick=Date.now(),this.forceReconnect("pageshow",!0))}}wsSnap(){return{status:this.status,ws:this.ws?jv[this.ws.readyState]:null,attempt:this.reconnectAttempts}}connect(){if(this.ws){const i=this.ws.readyState===WebSocket.OPEN;if(i&&this.status==="connected"){Qe("ws_connect_skip",{reason:"already_open",...this.wsSnap()});return}Qe("ws_connect_destroy_zombie",{reason:i?"open_desynced":"not_open",...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus("connecting");const r=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`;Qe("ws_connect",{url:r,...this.wsSnap()});const n=new WebSocket(r);this.ws=n,this.connectTimer=window.setTimeout(()=>{if(this.ws!==n)return;this.connectTimer=null,n.readyState===WebSocket.OPEN&&this.status==="connected"||(Qe("ws_connect_timeout",{wsState:jv[n.readyState],managerStatus:this.status,...this.wsSnap()}),this.destroySocket(),this.scheduleReconnect())},mP),n.onopen=()=>{Qe("ws_onopen",this.wsSnap()),this.clearConnectTimer(),this.reconnectAttempts=0,this.connectionEpoch+=1,this.setStatus("connected"),this.startHeartbeat()},n.onmessage=i=>{try{const a=JSON.parse(i.data);if(a.type==="pong"){a.seq===this.pingSeq&&this.clearPongTimer();return}this.listeners.forEach(l=>l(a))}catch{}},n.onerror=()=>{Qe("ws_onerror",this.wsSnap()),this.clearConnectTimer()},n.onclose=i=>{Qe("ws_onclose",{code:i.code,reason:i.reason,clean:i.wasClean,...this.wsSnap()}),this.clearConnectTimer(),this.ws=null,this.manualClose?this.setStatus("disconnected"):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.destroySocket(),this.setStatus("disconnected")}startLifecycleListeners(){this.lifecycleStarted||typeof document>"u"||typeof window>"u"||(this.lifecycleStarted=!0,document.addEventListener("visibilitychange",this.onVisibilityChange),window.addEventListener("pageshow",this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{const t=Date.now(),r=t-this.lastTick;this.isHidden()||(r>gP&&(Qe("ws_time_jump",{gapMs:r,...this.wsSnap()}),this.forceReconnect("time_jump",!0)),this.lastTick=t)},vP))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener("visibilitychange",this.onVisibilityChange),window.removeEventListener("pageshow",this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(t){var r;if(((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(t)),!0}catch(n){return Qe("ws_send_error",{messageType:t.type,error:n instanceof Error?n.message:String(n),...this.wsSnap()}),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}subscribeStatus(t){return this.statusListeners.add(t),t(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(t)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}forceReconnect(t="unknown",r=!1){var a;if(this.manualClose){Qe("ws_force_skip",{trigger:t,reason:"manual_close"});return}const n=Date.now(),i=r?200:500;if(n-this.lastForceReconnectTs<i){Qe("ws_force_skip",{trigger:t,reason:"debounce",force:r});return}if(!r&&((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.status==="connected"){Qe("ws_force_skip",{trigger:t,reason:"already_connected"});return}this.lastForceReconnectTs=n,Qe("ws_force_reconnect",{trigger:t,force:r,...this.wsSnap()}),this.reconnectAttempts=0,this.reconnectTimer&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.destroySocket(),this.connect()}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=window.setInterval(()=>{var t;((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:"ping",seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,Qe("ws_pong_timeout",this.wsSnap()),this.destroySocket(),this.scheduleReconnect()},wP)))},yP)}sendVerificationPing(){var r;if(((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN)return;this.pingSeq+=1;const t=this.pingSeq;Qe("ws_resume_verify",{seq:t,...this.wsSnap()}),this.send({type:"ping",seq:t})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,Qe("ws_resume_verify_timeout",{seq:t,...this.wsSnap()}),this.destroySocket(),this.reconnectAttempts=0,this.connect()},SP))}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(t,r=null){this.status=t,this.error=r,this.statusListeners.forEach(n=>n(t,r,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){Qe("ws_schedule_skip",{reason:"hidden",...this.wsSnap()}),this.setStatus("reconnecting");return}this.reconnectAttempts+=1;const t=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);Qe("ws_schedule_reconnect",{delay:t,...this.wsSnap()}),this.setStatus("reconnecting"),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}isHidden(){return typeof document<"u"&&document.visibilityState==="hidden"}clearConnectTimer(){this.connectTimer&&(window.clearTimeout(this.connectTimer),this.connectTimer=null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),!this.ws)return;const t=this.ws;this.ws=null,t.onopen=null,t.onmessage=null,t.onerror=null,t.onclose=null;try{t.close()}catch{}}}const sn=new xP;function bP(){const e=Ge(o=>o.setConnectionStatus),t=Ge(o=>o.setConnectionError),[r,n]=k.useState(sn.getStatus()),[i,a]=k.useState(sn.getConnectionEpoch());k.useEffect(()=>{sn.connect(),sn.startLifecycleListeners();const o=sn.subscribeStatus((c,p,u)=>{n(c),a(u),e(c),t(p)});return()=>{o(),sn.stopLifecycleListeners()}},[t,e]);const l=k.useMemo(()=>o=>{sn.send(o)},[]),s=k.useMemo(()=>sn.subscribe.bind(sn),[]);return{status:r,connectionEpoch:i,sendMessage:l,subscribe:s}}const CP=100;function EP({viewport:e,win:t,doc:r}){if(!e)return!1;const n=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+n),l=Math.max(0,a),s=Math.max(0,e.height||0),o=Math.max(0,e.width||0);return r.documentElement.style.setProperty("--keyboard-inset",`${l}px`),r.documentElement.style.setProperty("--viewport-offset-top",`${n}px`),r.documentElement.style.setProperty("--viewport-offset-left",`${i}px`),r.documentElement.style.setProperty("--visual-viewport-height",`${s}px`),r.documentElement.style.setProperty("--visual-viewport-width",`${o}px`),l>CP?r.documentElement.classList.add("keyboard-visible"):r.documentElement.classList.remove("keyboard-visible"),!0}function kP(e){e.documentElement.style.removeProperty("--keyboard-inset"),e.documentElement.style.removeProperty("--viewport-offset-top"),e.documentElement.style.removeProperty("--viewport-offset-left"),e.documentElement.style.removeProperty("--visual-viewport-height"),e.documentElement.style.removeProperty("--visual-viewport-width"),e.documentElement.classList.remove("keyboard-visible")}function LP(){k.useEffect(()=>{const e=window.visualViewport;if(!e)return;let t=null,r=null;const n=()=>{var v;const _=document.activeElement;if(!_)return!1;const y=(v=_.tagName)==null?void 0:v.toLowerCase();return y==="input"||y==="textarea"?!0:!!_.isContentEditable},i=()=>{EP({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!="function"){i();return}t!==null&&window.cancelAnimationFrame(t);const _=performance.now(),y=()=>{i(),performance.now()-_<1500?t=window.requestAnimationFrame(y):t=null};t=window.requestAnimationFrame(y)},l=()=>{if(!n()){o();return}i()},s=()=>{r!==null||typeof window.setInterval!="function"||(r=window.setInterval(l,250),l())},o=()=>{r===null||typeof window.clearInterval!="function"||(window.clearInterval(r),r=null)},c=()=>{n()?(a(),s(),i()):o()},p=()=>{c()},u=()=>{c()},f=()=>{a()};return i(),c(),e.addEventListener("resize",i),e.addEventListener("scroll",i),typeof window.addEventListener=="function"&&(window.addEventListener("resize",i),window.addEventListener("orientationchange",f)),typeof document.addEventListener=="function"&&(document.addEventListener("focusin",p),document.addEventListener("focusout",u),document.addEventListener("focus",p,!0),document.addEventListener("blur",u,!0)),()=>{e.removeEventListener("resize",i),e.removeEventListener("scroll",i),typeof window.removeEventListener=="function"&&(window.removeEventListener("resize",i),window.removeEventListener("orientationchange",f)),typeof document.removeEventListener=="function"&&(document.removeEventListener("focusin",p),document.removeEventListener("focusout",u),document.removeEventListener("focus",p,!0),document.removeEventListener("blur",u,!0)),t!==null&&typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(t),o(),kP(document)}},[])}function TP(){const[e,t]=k.useState(!1),[r,n]=k.useState(void 0),[i,a]=k.useState(void 0),[l,s]=k.useState(void 0),[o,c]=k.useState(!1),[p,u]=k.useState(null),[f,_]=k.useState(null),y=Ge(G=>G.sessions),v=Ge(G=>G.agentSessions),h=Ge(G=>G.selectedSessionId),m=Ge(G=>G.setSessions),d=Ge(G=>G.setAgentSessions),g=Ge(G=>G.setHostStatuses),w=Ge(G=>G.updateSession),b=Ge(G=>G.setSelectedSessionId),x=Ge(G=>G.hasLoaded),C=Ge(G=>G.connectionStatus),S=Ge(G=>G.connectionError),E=Ge(G=>G.clearExitingSession),L=Ge(G=>G.markSessionExiting),A=Ge(G=>G.setRemoteAllowControl),M=Ge(G=>G.setRemoteAllowAttach),D=Ge(G=>G.setHostLabel),B=Ge(G=>G.hostStatuses),H=Ge(G=>G.remoteAllowControl),F=Ge(G=>G.hostLabel),$=Gl(G=>G.theme),I=pe(G=>G.defaultProjectDir),R=pe(G=>G.commandPresets),P=pe(G=>G.defaultPresetId),N=pe(G=>G.lastProjectPath),j=pe(G=>G.setLastProjectPath),U=pe(G=>G.addRecentPath),V=pe(G=>G.shortcutModifier),ee=pe(G=>G.sidebarWidth),Q=pe(G=>G.setSidebarWidth),z=pe(G=>G.projectFilters),O=pe(G=>G.hostFilters),K=pe(G=>G.soundOnPermission),W=pe(G=>G.soundOnIdle),{sendMessage:te,subscribe:J,connectionEpoch:_e}=bP();LP(),k.useEffect(()=>{if(typeof document>"u"||!K&&!W)return;let G=!1;const Y=()=>{G&&!z3()||(G=!0,hd())};return document.addEventListener("click",Y,{passive:!0}),document.addEventListener("keydown",Y,{passive:!0}),document.addEventListener("touchstart",Y,{passive:!0}),()=>{document.removeEventListener("click",Y),document.removeEventListener("keydown",Y),document.removeEventListener("touchstart",Y)}},[K,W]);const ue=k.useRef(!1),se=k.useCallback(G=>{G.preventDefault(),ue.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);k.useEffect(()=>{if(typeof document>"u"||typeof document.addEventListener!="function")return;const G=Oe=>{if(!ue.current)return;const $e=Oe.clientX;Q(Math.max(ey,Math.min(ty,$e)))},Y=()=>{ue.current&&(ue.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y)}},[Q]),k.useEffect(()=>{const G=J(Y=>{var Oe,$e;if(Y.type==="sessions"){const X=Ge.getState().sessions,{soundOnPermission:le,soundOnIdle:ge}=pe.getState();if(le||ge)for(const We of Y.sessions){const Z=X.find(Le=>Le.id===We.id);Z&&Z.status!==We.status&&(Z.status!=="permission"&&We.status==="permission"&&le&&dd(),Z.status==="working"&&We.status==="waiting"&&ge&&fd())}m(Y.sessions)}if(Y.type==="host-status"&&g(Y.hosts),Y.type==="server-config"&&(A(Y.remoteAllowControl),M(Y.remoteAllowAttach),D(Y.hostLabel),Y.clientLogLevel&&HR(Y.clientLogLevel)),Y.type==="session-update"){const le=Ge.getState().sessions.find(Z=>Z.id===Y.session.id),ge=le==null?void 0:le.status,We=Y.session.status;if(w(Y.session),ge){const{soundOnPermission:Z,soundOnIdle:Le}=pe.getState();ge!=="permission"&&We==="permission"&&Z&&dd(),ge==="working"&&We==="waiting"&&Le&&fd()}}if(Y.type==="session-created"){const X=Ge.getState().sessions;X.some(We=>We.id===Y.session.id)||m([Y.session,...X]),b(Y.session.id),U(Y.session.projectPath);const{projectFilters:le,setProjectFilters:ge}=pe.getState();le.length>0&&!le.includes(Y.session.projectPath)&&ge([...le,Y.session.projectPath])}if(Y.type==="session-removed"){const X=Ge.getState().sessions,le=X.filter(ge=>ge.id!==Y.sessionId);le.length!==X.length&&m(le)}if(Y.type==="agent-sessions"&&d(Y.active,Y.inactive),Y.type==="session-orphaned"&&!Y.supersededBy){const X=Ge.getState().sessions,le=X.filter(ge=>{var We;return((We=ge.agentSessionId)==null?void 0:We.trim())!==Y.session.sessionId});le.length!==X.length&&m(le)}if(Y.type==="session-activated"){const X=Ge.getState().sessions.find(le=>le.tmuxWindow===Y.window);X&&w({...X,agentSessionId:Y.session.sessionId,agentSessionName:Y.session.displayName,logFilePath:Y.session.logFilePath,isPinned:Y.session.isPinned,lastUserMessage:Y.session.lastUserMessage??X.lastUserMessage})}if(Y.type==="session-resume-result")if(Y.ok&&Y.session){const X=Ge.getState().sessions;X.some(le=>le.id===Y.session.id)||m([Y.session,...X]),b(Y.session.id)}else Y.ok||(u(`${(Oe=Y.error)==null?void 0:Oe.code}: ${($e=Y.error)==null?void 0:$e.message}`),window.setTimeout(()=>u(null),6e3));Y.type==="terminal-error"&&(!Y.sessionId||Y.sessionId===h)&&(u(`${Y.code}: ${Y.message}`),window.setTimeout(()=>u(null),6e3)),Y.type==="terminal-ready"&&Y.sessionId===h&&u(null),Y.type==="error"&&(u(Y.message),window.setTimeout(()=>u(null),6e3)),Y.type==="kill-failed"&&(E(Y.sessionId),u(Y.message),window.setTimeout(()=>u(null),6e3)),Y.type==="session-pin-result"&&!Y.ok&&Y.error&&(u(Y.error),window.setTimeout(()=>u(null),6e3)),Y.type==="session-resurrection-failed"&&yS.add({title:"Session resurrection failed",description:`"${Y.displayName}" could not be resumed: ${Y.error}`,type:"error",timeout:8e3})});return()=>{G()}},[h,U,E,te,b,m,d,g,A,M,D,J,w]);const re=k.useMemo(()=>y.find(G=>G.id===h)||null,[h,y]);k.useEffect(()=>{re!=null&&re.projectPath&&!re.remote&&j(re.projectPath)},[re==null?void 0:re.projectPath,re==null?void 0:re.remote,j]);const ae=pe(G=>G.sessionSortMode),ye=pe(G=>G.sessionSortDirection),ve=pe(G=>G.manualSessionOrder),ne=k.useMemo(()=>rp(y,{mode:ae,direction:ye,manualOrder:ve}),[y,ae,ye,ve]),ie=k.useMemo(()=>{let G=ne;return z.length>0&&(G=G.filter(Y=>z.includes(Y.projectPath))),O.length>0&&(G=G.filter(Y=>O.includes(Y.host??""))),G},[ne,z,O]);k.useEffect(()=>{h&&ie.length>0&&!ie.some(G=>G.id===h)&&b(ie[0].id)},[h,ie,b]),k.useEffect(()=>{window.matchMedia("(max-width: 767px)").matches&&x&&h===null&&ne.length>0&&b(ne[0].id)},[x,h,ne,b]);const he=k.useCallback(G=>{L(G),te({type:"session-kill",sessionId:G})},[L,te]);k.useEffect(()=>{const G=Zo(V),Y=Oe=>{if(Oe.defaultPrevented)return;const $e=Oe.code,X=$C(Oe,G);if(X&&($e==="BracketLeft"||$e==="BracketRight")){Oe.preventDefault();const le=ie;if(le.length===0)return;const ge=le.findIndex(Le=>Le.id===h);if(ge===-1){b(le[0].id);return}const Z=(ge+($e==="BracketLeft"?-1:1)+le.length)%le.length;b(le[Z].id);return}if(X&&$e==="KeyN"){Oe.preventDefault(),e||t(!0);return}if(X&&$e==="KeyX"){Oe.preventDefault(),h&&!e&&he(h);return}};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e,h,b,ie,he,V]);const oe=()=>{n(void 0),a(void 0),s(void 0),t(!0)},me=()=>c(!0),xe=(G,Y,Oe,$e)=>{te({type:"session-create",projectPath:G,name:Y,command:Oe,host:$e}),$e||j(G)},ke=G=>{te({type:"session-resume",sessionId:G})},Ne=(G,Y)=>{te({type:"session-rename",sessionId:G,newName:Y})},Ke=k.useCallback(G=>{const Y=y.find(Oe=>Oe.id===G);Y&&te({type:"session-create",projectPath:Y.projectPath,command:Y.command||void 0,host:Y.remote&&Y.host?Y.host:void 0})},[y,te]),Ae=k.useCallback((G,Y)=>{te({type:"session-pin",sessionId:G,isPinned:Y})},[te]);k.useEffect(()=>{document.documentElement.setAttribute("data-theme",$)},[$]),k.useEffect(()=>{fetch("/api/server-info").then(G=>G.json()).then(G=>_(G)).catch(()=>{})},[]);const Pe=k.useMemo(()=>F?B.filter(G=>G.host!==F):B,[B,F]);return T.jsxs("div",{className:"flex h-full overflow-hidden",children:[T.jsxs("div",{className:"hidden h-full flex-col md:flex md:shrink-0",style:{width:ee},children:[T.jsx(zC,{connectionStatus:C,onNewSession:oe,onOpenSettings:me,tailscaleIp:(f==null?void 0:f.tailscaleIp)??null}),T.jsx(hw,{sessions:y,inactiveSessions:v.inactive,selectedSessionId:h,onSelect:b,onRename:Ne,onResume:ke,onKill:he,onDuplicate:Ke,onSetPinned:Ae,loading:!x,error:S||p})]}),T.jsx("div",{className:"hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20",onMouseDown:se}),T.jsx(sM,{session:re,sessions:ie,connectionStatus:C,connectionEpoch:_e,sendMessage:te,subscribe:J,onClose:()=>b(null),onSelectSession:b,onNewSession:oe,onKillSession:he,onRenameSession:Ne,onOpenSettings:me,onResumeSession:ke,onSetPinned:Ae,inactiveSessions:v.inactive,loading:!x,error:S||p}),T.jsx(oM,{isOpen:e,onClose:()=>t(!1),onCreate:xe,defaultProjectDir:I,commandPresets:R,defaultPresetId:P,lastProjectPath:N,activeProjectPath:re&&!re.remote?re.projectPath:void 0,remoteHosts:Pe,remoteAllowControl:H,initialHost:r,initialPath:i,initialCommand:l}),T.jsx(W3,{isOpen:o,onClose:()=>c(!1)}),T.jsx(pP,{})]})}const RP="modulepreload",DP=function(e){return"/"+e},Fv={},MP=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),s=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=Promise.allSettled(r.map(o=>{if(o=DP(o),o in Fv)return;Fv[o]=!0;const c=o.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${p}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":RP,c||(u.as="script"),u.crossOrigin="",u.href=o,s&&u.setAttribute("nonce",s),document.head.appendChild(u),c)return new Promise((f,_)=>{u.addEventListener("load",f),u.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${o}`)))})}))}function a(l){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=l,window.dispatchEvent(s),!s.defaultPrevented)throw l}return i.then(l=>{for(const s of l||[])s.status==="rejected"&&a(s.reason);return t().catch(a)})};function AP(e={}){const{immediate:t=!1,onNeedRefresh:r,onOfflineReady:n,onRegistered:i,onRegisteredSW:a,onRegisterError:l}=e;let s,o;const c=async(u=!0)=>{await o};async function p(){if("serviceWorker"in navigator){if(s=await MP(async()=>{const{Workbox:u}=await import("./workbox-window.prod.es5-vqzQaGvo.js");return{Workbox:u}},[]).then(({Workbox:u})=>new u("/sw.js",{scope:"/",type:"classic"})).catch(u=>{l==null||l(u)}),!s)return;s.addEventListener("activated",u=>{(u.isUpdate||u.isExternal)&&window.location.reload()}),s.addEventListener("installed",u=>{u.isUpdate||n==null||n()}),s.register({immediate:t}).then(u=>{a?a("/sw.js",u):i==null||i(u)}).catch(u=>{l==null||l(u)})}}return o=p(),c}Qo()&&document.documentElement.classList.add("ios");NC()&&document.documentElement.classList.add("ios-pwa");AP({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},5*60*1e3),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&t.update()}))}});const wS=document.getElementById("root");if(!wS)throw new Error("Root element not found");Z0(wS).render(T.jsx(gt.StrictMode,{children:T.jsx(TP,{})}));
|