From 5fe416f94144f971536f745394a90aeef7d8aa3b Mon Sep 17 00:00:00 2001 From: SaelixCode Date: Thu, 26 Feb 2026 14:43:45 -0500 Subject: [PATCH] feat: add frontend index.html and Vite logo; enhance system stats API with network metrics - Created a new index.html file for the frontend with theme handling and linked assets. - Added a Vite logo SVG to the public directory. - Updated the system stats API to include network statistics (rxBytes, txBytes, rxSec, txSec). - Enhanced the EditorLayout component to display network I/O rates for containers. - Modified HomeDashboard to show host network statistics with appropriate formatting. --- backend/public/assets/index-DQZd4c74.js | 96 +++++++++++++++++++++++ backend/public/assets/index-dtrnzjcf.css | 1 + backend/public/index.html | 26 ++++++ backend/public/vite.svg | 1 + backend/src/index.ts | 21 ++++- frontend/src/components/EditorLayout.tsx | 44 ++++++++++- frontend/src/components/HomeDashboard.tsx | 38 ++++++--- 7 files changed, 210 insertions(+), 17 deletions(-) create mode 100644 backend/public/assets/index-DQZd4c74.js create mode 100644 backend/public/assets/index-dtrnzjcf.css create mode 100644 backend/public/index.html create mode 100644 backend/public/vite.svg diff --git a/backend/public/assets/index-DQZd4c74.js b/backend/public/assets/index-DQZd4c74.js new file mode 100644 index 00000000..0570f653 --- /dev/null +++ b/backend/public/assets/index-DQZd4c74.js @@ -0,0 +1,96 @@ +function jE(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(a){if(a.ep)return;a.ep=!0;const c=r(a);fetch(a.href,c)}})();function pS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Of={exports:{}},il={};var hy;function HE(){if(hy)return il;hy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,c){var u=null;if(c!==void 0&&(u=""+c),a.key!==void 0&&(u=""+a.key),"key"in a){c={};for(var f in a)f!=="key"&&(c[f]=a[f])}else c=a;return a=c.ref,{$$typeof:e,type:n,key:u,ref:a!==void 0?a:null,props:c}}return il.Fragment=t,il.jsx=r,il.jsxs=r,il}var dy;function PE(){return dy||(dy=1,Of.exports=HE()),Of.exports}var v=PE(),Bf={exports:{}},ke={};var fy;function UE(){if(fy)return ke;fy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function T(D,O,q){this.props=D,this.context=O,this.refs=k,this.updater=q||x}T.prototype.isReactComponent={},T.prototype.setState=function(D,O){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,O,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=T.prototype;function z(D,O,q){this.props=D,this.context=O,this.refs=k,this.updater=q||x}var A=z.prototype=new $;A.constructor=z,C(A,T.prototype),A.isPureReactComponent=!0;var j=Array.isArray;function P(){}var F={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function re(D,O,q){var Q=q.ref;return{$$typeof:e,type:D,key:O,ref:Q!==void 0?Q:null,props:q}}function le(D,O){return re(D.type,O,D.props)}function ce(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function W(D){var O={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(q){return O[q]})}var M=/\/+/g;function H(D,O){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):O.toString(36)}function N(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(P,P):(D.status="pending",D.then(function(O){D.status==="pending"&&(D.status="fulfilled",D.value=O)},function(O){D.status==="pending"&&(D.status="rejected",D.reason=O)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function R(D,O,q,Q,X){var ae=typeof D;(ae==="undefined"||ae==="boolean")&&(D=null);var de=!1;if(D===null)de=!0;else switch(ae){case"bigint":case"string":case"number":de=!0;break;case"object":switch(D.$$typeof){case e:case t:de=!0;break;case g:return de=D._init,R(de(D._payload),O,q,Q,X)}}if(de)return X=X(D),de=Q===""?"."+H(D,0):Q,j(X)?(q="",de!=null&&(q=de.replace(M,"$&/")+"/"),R(X,O,q,"",function(Je){return Je})):X!=null&&(ce(X)&&(X=le(X,q+(X.key==null||D&&D.key===X.key?"":(""+X.key).replace(M,"$&/")+"/")+de)),O.push(X)),1;de=0;var _e=Q===""?".":Q+":";if(j(D))for(var me=0;me>>1,ee=R[se];if(0>>1;sea(q,U))Qa(X,q)?(R[se]=X,R[Q]=U,se=Q):(R[se]=q,R[O]=U,se=O);else if(Qa(X,U))R[se]=X,R[Q]=U,se=Q;else break e}}return L}function a(R,L){var U=R.sortIndex-L.sortIndex;return U!==0?U:R.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],d=[],g=1,_=null,S=3,w=!1,x=!1,C=!1,k=!1,T=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function A(R){for(var L=r(d);L!==null;){if(L.callback===null)n(d);else if(L.startTime<=R)n(d),L.sortIndex=L.expirationTime,t(m,L);else break;L=r(d)}}function j(R){if(C=!1,A(R),!x)if(r(m)!==null)x=!0,P||(P=!0,W());else{var L=r(d);L!==null&&N(j,L.startTime-R)}}var P=!1,F=-1,G=5,re=-1;function le(){return k?!0:!(e.unstable_now()-reR&&le());){var se=_.callback;if(typeof se=="function"){_.callback=null,S=_.priorityLevel;var ee=se(_.expirationTime<=R);if(R=e.unstable_now(),typeof ee=="function"){_.callback=ee,A(R),L=!0;break t}_===r(m)&&n(m),A(R)}else n(m);_=r(m)}if(_!==null)L=!0;else{var D=r(d);D!==null&&N(j,D.startTime-R),L=!1}}break e}finally{_=null,S=U,w=!1}L=void 0}}finally{L?W():P=!1}}}var W;if(typeof z=="function")W=function(){z(ce)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,H=M.port2;M.port1.onmessage=ce,W=function(){H.postMessage(null)}}else W=function(){T(ce,0)};function N(R,L){F=T(function(){R(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125se?(R.sortIndex=U,t(d,R),r(m)===null&&R===r(d)&&(C?($(F),F=-1):C=!0,N(j,U-se))):(R.sortIndex=ee,t(m,R),x||w||(x=!0,P||(P=!0,W()))),R},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(R){var L=S;return function(){var U=S;S=L;try{return R.apply(this,arguments)}finally{S=U}}}})(jf)),jf}var _y;function $E(){return _y||(_y=1,zf.exports=IE()),zf.exports}var Hf={exports:{}},ci={};var gy;function FE(){if(gy)return ci;gy=1;var e=wp();function t(m){var d="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hf.exports=FE(),Hf.exports}var yy;function WE(){if(yy)return rl;yy=1;var e=$E(),t=wp(),r=_S();function n(i){var s="https://react.dev/errors/"+i;if(1ee||(i.current=se[ee],se[ee]=null,ee--)}function q(i,s){ee++,se[ee]=i.current,i.current=s}var Q=D(null),X=D(null),ae=D(null),de=D(null);function _e(i,s){switch(q(ae,s),q(X,i),q(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?B0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=B0(s),i=L0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}O(Q),q(Q,i)}function me(){O(Q),O(X),O(ae)}function Je(i){i.memoizedState!==null&&q(de,i);var s=Q.current,o=L0(s,i.type);s!==o&&(q(X,i),q(Q,o))}function ot(i){X.current===i&&(O(Q),O(X)),de.current===i&&(O(de),Qa._currentValue=U)}var Ke,Re;function mt(i){if(Ke===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",Re=-1)":-1h||B[l]!==K[h]){var te=` +`+B[l].replace(" at new "," at ");return i.displayName&&te.includes("")&&(te=te.replace("",i.displayName)),te}while(1<=l&&0<=h);break}}}finally{vi=!1,Error.prepareStackTrace=o}return(o=i?i.displayName||i.name:"")?mt(o):""}function Kr(i,s){switch(i.tag){case 26:case 27:case 5:return mt(i.type);case 16:return mt("Lazy");case 13:return i.child!==s&&s!==null?mt("Suspense Fallback"):mt("Suspense");case 19:return mt("SuspenseList");case 0:case 15:return Yr(i.type,!1);case 11:return Yr(i.type.render,!1);case 1:return Yr(i.type,!0);case 31:return mt("Activity");default:return""}}function bn(i){try{var s="",o=null;do s+=Kr(i,o),o=i,i=i.return;while(i);return s}catch(l){return` +Error generating stack: `+l.message+` +`+l.stack}}var di=Object.prototype.hasOwnProperty,Sn=e.unstable_scheduleCallback,wn=e.unstable_cancelCallback,Jt=e.unstable_shouldYield,Cr=e.unstable_requestPaint,ei=e.unstable_now,da=e.unstable_getCurrentPriorityLevel,Gr=e.unstable_ImmediatePriority,to=e.unstable_UserBlockingPriority,Xr=e.unstable_NormalPriority,hr=e.unstable_LowPriority,dr=e.unstable_IdlePriority,io=e.log,fr=e.unstable_setDisableYieldValue,Zr=null,Pt=null;function Di(i){if(typeof io=="function"&&fr(i),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(Zr,i)}catch{}}var Ut=Math.clz32?Math.clz32:Se,ro=Math.log,he=Math.LN2;function Se(i){return i>>>=0,i===0?32:31-(ro(i)/he|0)|0}var Te=256,Me=262144,lt=4194304;function Ye(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function xe(i,s,o){var l=i.pendingLanes;if(l===0)return 0;var h=0,p=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var E=l&134217727;return E!==0?(l=E&~p,l!==0?h=Ye(l):(b&=E,b!==0?h=Ye(b):o||(o=E&~i,o!==0&&(h=Ye(o))))):(E=l&~p,E!==0?h=Ye(E):b!==0?h=Ye(b):o||(o=l&~i,o!==0&&(h=Ye(o)))),h===0?0:s!==0&&s!==h&&(s&p)===0&&(p=h&-h,o=s&-s,p>=o||p===32&&(o&4194048)!==0)?s:h}function Ge(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function gt(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function It(){var i=lt;return lt<<=1,(lt&62914560)===0&&(lt=4194304),i}function Er(i){for(var s=[],o=0;31>o;o++)s.push(i);return s}function st(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function $t(i,s,o,l,h,p){var b=i.pendingLanes;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=o,i.entangledLanes&=o,i.errorRecoveryDisabledLanes&=o,i.shellSuspendCounter=0;var E=i.entanglements,B=i.expirationTimes,K=i.hiddenUpdates;for(o=b&~o;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var MC=/[\n"\\]/g;function Ki(i){return i.replace(MC,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Rh(i,s,o,l,h,p,b,E){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),s!=null?b==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Yi(s)):i.value!==""+Yi(s)&&(i.value=""+Yi(s)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),s!=null?kh(i,b,Yi(s)):o!=null?kh(i,b,Yi(o)):l!=null&&i.removeAttribute("value"),h==null&&p!=null&&(i.defaultChecked=!!p),h!=null&&(i.checked=h&&typeof h!="function"&&typeof h!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?i.name=""+Yi(E):i.removeAttribute("name")}function T_(i,s,o,l,h,p,b,E){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(i.type=p),s!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||s!=null)){Eh(i);return}o=o!=null?""+Yi(o):"",s=s!=null?""+Yi(s):o,E||s===i.value||(i.value=s),i.defaultValue=s}l=l??h,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=E?i.checked:!!l,i.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b),Eh(i)}function kh(i,s,o){s==="number"&&Fl(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function co(i,s,o,l){if(i=i.options,s){s={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nh=!1;if(es)try{var _a={};Object.defineProperty(_a,"passive",{get:function(){Nh=!0}}),window.addEventListener("test",_a,_a),window.removeEventListener("test",_a,_a)}catch{Nh=!1}var Os=null,Oh=null,ql=null;function L_(){if(ql)return ql;var i,s=Oh,o=s.length,l,h="value"in Os?Os.value:Os.textContent,p=h.length;for(i=0;i=ya),I_=" ",$_=!1;function F_(i,s){switch(i){case"keyup":return n2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function W_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var mo=!1;function a2(i,s){switch(i){case"compositionend":return W_(s);case"keypress":return s.which!==32?null:($_=!0,I_);case"textInput":return i=s.data,i===I_&&$_?null:i;default:return null}}function l2(i,s){if(mo)return i==="compositionend"||!Hh&&F_(i,s)?(i=L_(),ql=Oh=Os=null,mo=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:o,offset:s-i};i=l}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Q_(o)}}function eg(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?eg(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function tg(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Fl(i.document);s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=Fl(i.document)}return s}function Ih(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var _2=es&&"documentMode"in document&&11>=document.documentMode,po=null,$h=null,xa=null,Fh=!1;function ig(i,s,o){var l=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Fh||po==null||po!==Fl(l)||(l=po,"selectionStart"in l&&Ih(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),xa&&wa(xa,l)||(xa=l,l=Hc($h,"onSelect"),0>=b,h-=b,Rr=1<<32-Ut(s)+h|o<De?(Pe=be,be=null):Pe=be.sibling;var We=Z(V,be,Y[De],ie);if(We===null){be===null&&(be=Pe);break}i&&be&&We.alternate===null&&s(V,be),I=p(We,I,De),Fe===null?we=We:Fe.sibling=We,Fe=We,be=Pe}if(De===Y.length)return o(V,be),Ue&&is(V,De),we;if(be===null){for(;DeDe?(Pe=be,be=null):Pe=be.sibling;var tn=Z(V,be,We.value,ie);if(tn===null){be===null&&(be=Pe);break}i&&be&&tn.alternate===null&&s(V,be),I=p(tn,I,De),Fe===null?we=tn:Fe.sibling=tn,Fe=tn,be=Pe}if(We.done)return o(V,be),Ue&&is(V,De),we;if(be===null){for(;!We.done;De++,We=Y.next())We=ne(V,We.value,ie),We!==null&&(I=p(We,I,De),Fe===null?we=We:Fe.sibling=We,Fe=We);return Ue&&is(V,De),we}for(be=l(be);!We.done;De++,We=Y.next())We=J(be,V,De,We.value,ie),We!==null&&(i&&We.alternate!==null&&be.delete(We.key===null?De:We.key),I=p(We,I,De),Fe===null?we=We:Fe.sibling=We,Fe=We);return i&&be.forEach(function(zE){return s(V,zE)}),Ue&&is(V,De),we}function it(V,I,Y,ie){if(typeof Y=="object"&&Y!==null&&Y.type===C&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case w:e:{for(var we=Y.key;I!==null;){if(I.key===we){if(we=Y.type,we===C){if(I.tag===7){o(V,I.sibling),ie=h(I,Y.props.children),ie.return=V,V=ie;break e}}else if(I.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===G&&On(we)===I.type){o(V,I.sibling),ie=h(I,Y.props),Aa(ie,Y),ie.return=V,V=ie;break e}o(V,I);break}else s(V,I);I=I.sibling}Y.type===C?(ie=Tn(Y.props.children,V.mode,ie,Y.key),ie.return=V,V=ie):(ie=tc(Y.type,Y.key,Y.props,null,V.mode,ie),Aa(ie,Y),ie.return=V,V=ie)}return b(V);case x:e:{for(we=Y.key;I!==null;){if(I.key===we)if(I.tag===4&&I.stateNode.containerInfo===Y.containerInfo&&I.stateNode.implementation===Y.implementation){o(V,I.sibling),ie=h(I,Y.children||[]),ie.return=V,V=ie;break e}else{o(V,I);break}else s(V,I);I=I.sibling}ie=Xh(Y,V.mode,ie),ie.return=V,V=ie}return b(V);case G:return Y=On(Y),it(V,I,Y,ie)}if(N(Y))return ge(V,I,Y,ie);if(W(Y)){if(we=W(Y),typeof we!="function")throw Error(n(150));return Y=we.call(Y),Ce(V,I,Y,ie)}if(typeof Y.then=="function")return it(V,I,lc(Y),ie);if(Y.$$typeof===z)return it(V,I,sc(V,Y),ie);cc(V,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,I!==null&&I.tag===6?(o(V,I.sibling),ie=h(I,Y),ie.return=V,V=ie):(o(V,I),ie=Gh(Y,V.mode,ie),ie.return=V,V=ie),b(V)):o(V,I)}return function(V,I,Y,ie){try{Ta=0;var we=it(V,I,Y,ie);return Ro=null,we}catch(be){if(be===Eo||be===oc)throw be;var Fe=Bi(29,be,null,V.mode);return Fe.lanes=ie,Fe.return=V,Fe}}}var Ln=Eg(!0),Rg=Eg(!1),Hs=!1;function ld(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cd(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ps(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Us(i,s,o){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(qe&2)!==0){var h=l.pending;return h===null?s.next=s:(s.next=h.next,h.next=s),l.pending=s,s=ec(i),cg(i,null,o),s}return Jl(i,l,s,o),ec(i)}function Da(i,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,o|=l,s.lanes=o,Ot(i,o)}}function ud(i,s){var o=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,o===l)){var h=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var b={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?h=p=b:p=p.next=b,o=o.next}while(o!==null);p===null?h=p=s:p=p.next=s}else h=p=s;o={baseState:l.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=s:i.next=s,o.lastBaseUpdate=s}var hd=!1;function Ma(){if(hd){var i=Co;if(i!==null)throw i}}function Na(i,s,o,l){hd=!1;var h=i.updateQueue;Hs=!1;var p=h.firstBaseUpdate,b=h.lastBaseUpdate,E=h.shared.pending;if(E!==null){h.shared.pending=null;var B=E,K=B.next;B.next=null,b===null?p=K:b.next=K,b=B;var te=i.alternate;te!==null&&(te=te.updateQueue,E=te.lastBaseUpdate,E!==b&&(E===null?te.firstBaseUpdate=K:E.next=K,te.lastBaseUpdate=B))}if(p!==null){var ne=h.baseState;b=0,te=K=B=null,E=p;do{var Z=E.lane&-536870913,J=Z!==E.lane;if(J?(He&Z)===Z:(l&Z)===Z){Z!==0&&Z===xo&&(hd=!0),te!==null&&(te=te.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var ge=i,Ce=E;Z=s;var it=o;switch(Ce.tag){case 1:if(ge=Ce.payload,typeof ge=="function"){ne=ge.call(it,ne,Z);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ce.payload,Z=typeof ge=="function"?ge.call(it,ne,Z):ge,Z==null)break e;ne=_({},ne,Z);break e;case 2:Hs=!0}}Z=E.callback,Z!==null&&(i.flags|=64,J&&(i.flags|=8192),J=h.callbacks,J===null?h.callbacks=[Z]:J.push(Z))}else J={lane:Z,tag:E.tag,payload:E.payload,callback:E.callback,next:null},te===null?(K=te=J,B=ne):te=te.next=J,b|=Z;if(E=E.next,E===null){if(E=h.shared.pending,E===null)break;J=E,E=J.next,J.next=null,h.lastBaseUpdate=J,h.shared.pending=null}}while(!0);te===null&&(B=ne),h.baseState=B,h.firstBaseUpdate=K,h.lastBaseUpdate=te,p===null&&(h.shared.lanes=0),qs|=b,i.lanes=b,i.memoizedState=ne}}function kg(i,s){if(typeof i!="function")throw Error(n(191,i));i.call(s)}function Tg(i,s){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;ip?p:8;var b=R.T,E={};R.T=E,Dd(i,!1,s,o);try{var B=h(),K=R.S;if(K!==null&&K(E,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var te=E2(B,l);La(i,s,te,Pi(i))}else La(i,s,l,Pi(i))}catch(ne){La(i,s,{then:function(){},status:"rejected",reason:ne},Pi())}finally{L.p=p,b!==null&&E.types!==null&&(b.types=E.types),R.T=b}}function M2(){}function Td(i,s,o,l){if(i.tag!==5)throw Error(n(476));var h=ov(i).queue;nv(i,h,s,U,o===null?M2:function(){return av(i),o(l)})}function ov(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:U,baseState:U,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:U},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:o},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function av(i){var s=ov(i);s.next===null&&(s=i.alternate.memoizedState),La(i,s.next.queue,{},Pi())}function Ad(){return ri(Qa)}function lv(){return Et().memoizedState}function cv(){return Et().memoizedState}function N2(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var o=Pi();i=Ps(o);var l=Us(s,i,o);l!==null&&(Ei(l,s,o),Da(l,s,o)),s={cache:sd()},i.payload=s;return}s=s.return}}function O2(i,s,o){var l=Pi();o={lane:l,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},yc(i)?hv(s,o):(o=Yh(i,s,o,l),o!==null&&(Ei(o,i,l),dv(o,s,l)))}function uv(i,s,o){var l=Pi();La(i,s,o,l)}function La(i,s,o,l){var h={lane:l,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(yc(i))hv(s,h);else{var p=i.alternate;if(i.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var b=s.lastRenderedState,E=p(b,o);if(h.hasEagerState=!0,h.eagerState=E,Oi(E,b))return Jl(i,s,h,0),nt===null&&Ql(),!1}catch{}if(o=Yh(i,s,h,l),o!==null)return Ei(o,i,l),dv(o,s,l),!0}return!1}function Dd(i,s,o,l){if(l={lane:2,revertLane:cf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},yc(i)){if(s)throw Error(n(479))}else s=Yh(i,o,l,2),s!==null&&Ei(s,i,2)}function yc(i){var s=i.alternate;return i===Ae||s!==null&&s===Ae}function hv(i,s){To=dc=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function dv(i,s,o){if((o&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,o|=l,s.lanes=o,Ot(i,o)}}var za={readContext:ri,use:pc,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};za.useEffectEvent=vt;var fv={readContext:ri,use:pc,useCallback:function(i,s){return fi().memoizedState=[i,s===void 0?null:s],i},useContext:ri,useEffect:Xg,useImperativeHandle:function(i,s,o){o=o!=null?o.concat([i]):null,gc(4194308,4,ev.bind(null,s,i),o)},useLayoutEffect:function(i,s){return gc(4194308,4,i,s)},useInsertionEffect:function(i,s){gc(4,2,i,s)},useMemo:function(i,s){var o=fi();s=s===void 0?null:s;var l=i();if(zn){Di(!0);try{i()}finally{Di(!1)}}return o.memoizedState=[l,s],l},useReducer:function(i,s,o){var l=fi();if(o!==void 0){var h=o(s);if(zn){Di(!0);try{o(s)}finally{Di(!1)}}}else h=s;return l.memoizedState=l.baseState=h,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:h},l.queue=i,i=i.dispatch=O2.bind(null,Ae,i),[l.memoizedState,i]},useRef:function(i){var s=fi();return i={current:i},s.memoizedState=i},useState:function(i){i=xd(i);var s=i.queue,o=uv.bind(null,Ae,s);return s.dispatch=o,[i.memoizedState,o]},useDebugValue:Rd,useDeferredValue:function(i,s){var o=fi();return kd(o,i,s)},useTransition:function(){var i=xd(!1);return i=nv.bind(null,Ae,i.queue,!0,!1),fi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,o){var l=Ae,h=fi();if(Ue){if(o===void 0)throw Error(n(407));o=o()}else{if(o=s(),nt===null)throw Error(n(349));(He&127)!==0||Bg(l,s,o)}h.memoizedState=o;var p={value:o,getSnapshot:s};return h.queue=p,Xg(zg.bind(null,l,p,i),[i]),l.flags|=2048,Do(9,{destroy:void 0},Lg.bind(null,l,p,o,s),null),o},useId:function(){var i=fi(),s=nt.identifierPrefix;if(Ue){var o=kr,l=Rr;o=(l&~(1<<32-Ut(l)-1)).toString(32)+o,s="_"+s+"R_"+o,o=fc++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?b.createElement("select",{is:l.is}):b.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?b.createElement(h,{is:l.is}):b.createElement(h)}}p[ti]=s,p[yi]=l;e:for(b=s.child;b!==null;){if(b.tag===5||b.tag===6)p.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===s)break e;for(;b.sibling===null;){if(b.return===null||b.return===s)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}s.stateNode=p;e:switch(ni(p,h,l),h){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ls(s)}}return ut(s),Wd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,o),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&ls(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(n(166));if(i=ae.current,So(s)){if(i=s.stateNode,o=s.memoizedProps,l=null,h=ii,h!==null)switch(h.tag){case 27:case 5:l=h.memoizedProps}i[ti]=s,i=!!(i.nodeValue===o||l!==null&&l.suppressHydrationWarning===!0||N0(i.nodeValue,o)),i||zs(s,!0)}else i=Pc(i).createTextNode(l),i[ti]=s,s.stateNode=i}return ut(s),null;case 31:if(o=s.memoizedState,i===null||i.memoizedState!==null){if(l=So(s),o!==null){if(i===null){if(!l)throw Error(n(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(n(557));i[ti]=s}else An(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ut(s),i=!1}else o=ed(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=o),i=!0;if(!i)return s.flags&256?(zi(s),s):(zi(s),null);if((s.flags&128)!==0)throw Error(n(558))}return ut(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(h=So(s),l!==null&&l.dehydrated!==null){if(i===null){if(!h)throw Error(n(318));if(h=s.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(n(317));h[ti]=s}else An(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ut(s),h=!1}else h=ed(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),h=!0;if(!h)return s.flags&256?(zi(s),s):(zi(s),null)}return zi(s),(s.flags&128)!==0?(s.lanes=o,s):(o=l!==null,i=i!==null&&i.memoizedState!==null,o&&(l=s.child,h=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(h=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==h&&(l.flags|=2048)),o!==i&&o&&(s.child.flags|=8192),Cc(s,s.updateQueue),ut(s),null);case 4:return me(),i===null&&ff(s.stateNode.containerInfo),ut(s),null;case 10:return ss(s.type),ut(s),null;case 19:if(O(Ct),l=s.memoizedState,l===null)return ut(s),null;if(h=(s.flags&128)!==0,p=l.rendering,p===null)if(h)Ha(l,!1);else{if(yt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(p=hc(i),p!==null){for(s.flags|=128,Ha(l,!1),i=p.updateQueue,s.updateQueue=i,Cc(s,i),s.subtreeFlags=0,i=o,o=s.child;o!==null;)ug(o,i),o=o.sibling;return q(Ct,Ct.current&1|2),Ue&&is(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&ei()>Ac&&(s.flags|=128,h=!0,Ha(l,!1),s.lanes=4194304)}else{if(!h)if(i=hc(p),i!==null){if(s.flags|=128,h=!0,i=i.updateQueue,s.updateQueue=i,Cc(s,i),Ha(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!Ue)return ut(s),null}else 2*ei()-l.renderingStartTime>Ac&&o!==536870912&&(s.flags|=128,h=!0,Ha(l,!1),s.lanes=4194304);l.isBackwards?(p.sibling=s.child,s.child=p):(i=l.last,i!==null?i.sibling=p:s.child=p,l.last=p)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=ei(),i.sibling=null,o=Ct.current,q(Ct,h?o&1|2:o&1),Ue&&is(s,l.treeForkCount),i):(ut(s),null);case 22:case 23:return zi(s),fd(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(o&536870912)!==0&&(s.flags&128)===0&&(ut(s),s.subtreeFlags&6&&(s.flags|=8192)):ut(s),o=s.updateQueue,o!==null&&Cc(s,o.retryQueue),o=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==o&&(s.flags|=2048),i!==null&&O(Nn),null;case 24:return o=null,i!==null&&(o=i.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ss(kt),ut(s),null;case 25:return null;case 30:return null}throw Error(n(156,s.tag))}function H2(i,s){switch(Qh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ss(kt),me(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ot(s),null;case 31:if(s.memoizedState!==null){if(zi(s),s.alternate===null)throw Error(n(340));An()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(zi(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(n(340));An()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return O(Ct),null;case 4:return me(),null;case 10:return ss(s.type),null;case 22:case 23:return zi(s),fd(),i!==null&&O(Nn),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return ss(kt),null;case 25:return null;default:return null}}function jv(i,s){switch(Qh(s),s.tag){case 3:ss(kt),me();break;case 26:case 27:case 5:ot(s);break;case 4:me();break;case 31:s.memoizedState!==null&&zi(s);break;case 13:zi(s);break;case 19:O(Ct);break;case 10:ss(s.type);break;case 22:case 23:zi(s),fd(),i!==null&&O(Nn);break;case 24:ss(kt)}}function Pa(i,s){try{var o=s.updateQueue,l=o!==null?o.lastEffect:null;if(l!==null){var h=l.next;o=h;do{if((o.tag&i)===i){l=void 0;var p=o.create,b=o.inst;l=p(),b.destroy=l}o=o.next}while(o!==h)}}catch(E){Ze(s,s.return,E)}}function Fs(i,s,o){try{var l=s.updateQueue,h=l!==null?l.lastEffect:null;if(h!==null){var p=h.next;l=p;do{if((l.tag&i)===i){var b=l.inst,E=b.destroy;if(E!==void 0){b.destroy=void 0,h=s;var B=o,K=E;try{K()}catch(te){Ze(h,B,te)}}}l=l.next}while(l!==p)}}catch(te){Ze(s,s.return,te)}}function Hv(i){var s=i.updateQueue;if(s!==null){var o=i.stateNode;try{Tg(s,o)}catch(l){Ze(i,i.return,l)}}}function Pv(i,s,o){o.props=jn(i.type,i.memoizedProps),o.state=i.memoizedState;try{o.componentWillUnmount()}catch(l){Ze(i,s,l)}}function Ua(i,s){try{var o=i.ref;if(o!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof o=="function"?i.refCleanup=o(l):o.current=l}}catch(h){Ze(i,s,h)}}function Tr(i,s){var o=i.ref,l=i.refCleanup;if(o!==null)if(typeof l=="function")try{l()}catch(h){Ze(i,s,h)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(h){Ze(i,s,h)}else o.current=null}function Uv(i){var s=i.type,o=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&l.focus();break e;case"img":o.src?l.src=o.src:o.srcSet&&(l.srcset=o.srcSet)}}catch(h){Ze(i,i.return,h)}}function qd(i,s,o){try{var l=i.stateNode;oE(l,i.type,o,s),l[yi]=s}catch(h){Ze(i,i.return,h)}}function Iv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Xs(i.type)||i.tag===4}function Vd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Iv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Xs(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Yd(i,s,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(i,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(i),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Jr));else if(l!==4&&(l===27&&Xs(i.type)&&(o=i.stateNode,s=null),i=i.child,i!==null))for(Yd(i,s,o),i=i.sibling;i!==null;)Yd(i,s,o),i=i.sibling}function Ec(i,s,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?o.insertBefore(i,s):o.appendChild(i);else if(l!==4&&(l===27&&Xs(i.type)&&(o=i.stateNode),i=i.child,i!==null))for(Ec(i,s,o),i=i.sibling;i!==null;)Ec(i,s,o),i=i.sibling}function $v(i){var s=i.stateNode,o=i.memoizedProps;try{for(var l=i.type,h=s.attributes;h.length;)s.removeAttributeNode(h[0]);ni(s,l,o),s[ti]=i,s[yi]=o}catch(p){Ze(i,i.return,p)}}var cs=!1,Dt=!1,Kd=!1,Fv=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function P2(i,s){if(i=i.containerInfo,_f=Vc,i=tg(i),Ih(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var h=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var b=0,E=-1,B=-1,K=0,te=0,ne=i,Z=null;t:for(;;){for(var J;ne!==o||h!==0&&ne.nodeType!==3||(E=b+h),ne!==p||l!==0&&ne.nodeType!==3||(B=b+l),ne.nodeType===3&&(b+=ne.nodeValue.length),(J=ne.firstChild)!==null;)Z=ne,ne=J;for(;;){if(ne===i)break t;if(Z===o&&++K===h&&(E=b),Z===p&&++te===l&&(B=b),(J=ne.nextSibling)!==null)break;ne=Z,Z=ne.parentNode}ne=J}o=E===-1||B===-1?null:{start:E,end:B}}else o=null}o=o||{start:0,end:0}}else o=null;for(gf={focusedElem:i,selectionRange:o},Vc=!1,Wt=s;Wt!==null;)if(s=Wt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Wt=i;else for(;Wt!==null;){switch(s=Wt,p=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(o=0;o title"))),ni(p,l,o),p[ti]=i,Ft(p),l=p;break e;case"link":var b=G0("link","href",h).get(l+(o.href||""));if(b){for(var E=0;Eit&&(b=it,it=Ce,Ce=b);var V=J_(E,Ce),I=J_(E,it);if(V&&I&&(J.rangeCount!==1||J.anchorNode!==V.node||J.anchorOffset!==V.offset||J.focusNode!==I.node||J.focusOffset!==I.offset)){var Y=ne.createRange();Y.setStart(V.node,V.offset),J.removeAllRanges(),Ce>it?(J.addRange(Y),J.extend(I.node,I.offset)):(Y.setEnd(I.node,I.offset),J.addRange(Y))}}}}for(ne=[],J=E;J=J.parentNode;)J.nodeType===1&&ne.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;Eo?32:o,R.T=null,o=tf,tf=null;var p=Ys,b=ms;if(Bt=0,Lo=Ys=null,ms=0,(qe&6)!==0)throw Error(n(331));var E=qe;if(qe|=4,e0(p.current),Zv(p,p.current,b,o),qe=E,Va(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(Zr,p)}catch{}return!0}finally{L.p=h,R.T=l,v0(i,s)}}function b0(i,s,o){s=Xi(o,s),s=Bd(i.stateNode,s,2),i=Us(i,s,2),i!==null&&(st(i,2),Ar(i))}function Ze(i,s,o){if(i.tag===3)b0(i,i,o);else for(;s!==null;){if(s.tag===3){b0(s,i,o);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Vs===null||!Vs.has(l))){i=Xi(o,i),o=Sv(2),l=Us(s,o,2),l!==null&&(wv(o,l,s,i),st(l,2),Ar(l));break}}s=s.return}}function of(i,s,o){var l=i.pingCache;if(l===null){l=i.pingCache=new $2;var h=new Set;l.set(s,h)}else h=l.get(s),h===void 0&&(h=new Set,l.set(s,h));h.has(o)||(Zd=!0,h.add(o),i=Y2.bind(null,i,s,o),s.then(i,i))}function Y2(i,s,o){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&o,i.warmLanes&=~o,nt===i&&(He&o)===o&&(yt===4||yt===3&&(He&62914560)===He&&300>ei()-Tc?(qe&2)===0&&zo(i,0):Qd|=o,Bo===He&&(Bo=0)),Ar(i)}function S0(i,s){s===0&&(s=It()),i=kn(i,s),i!==null&&(st(i,s),Ar(i))}function K2(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),S0(i,o)}function G2(i,s){var o=0;switch(i.tag){case 31:case 13:var l=i.stateNode,h=i.memoizedState;h!==null&&(o=h.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(n(314))}l!==null&&l.delete(s),S0(i,o)}function X2(i,s){return Sn(i,s)}var Lc=null,Ho=null,af=!1,zc=!1,lf=!1,Gs=0;function Ar(i){i!==Ho&&i.next===null&&(Ho===null?Lc=Ho=i:Ho=Ho.next=i),zc=!0,af||(af=!0,Q2())}function Va(i,s){if(!lf&&zc){lf=!0;do for(var o=!1,l=Lc;l!==null;){if(i!==0){var h=l.pendingLanes;if(h===0)var p=0;else{var b=l.suspendedLanes,E=l.pingedLanes;p=(1<<31-Ut(42|i)+1)-1,p&=h&~(b&~E),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,E0(l,p))}else p=He,p=xe(l,l===nt?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||Ge(l,p)||(o=!0,E0(l,p));l=l.next}while(o);lf=!1}}function Z2(){w0()}function w0(){zc=af=!1;var i=0;Gs!==0&&lE()&&(i=Gs);for(var s=ei(),o=null,l=Lc;l!==null;){var h=l.next,p=x0(l,s);p===0?(l.next=null,o===null?Lc=h:o.next=h,h===null&&(Ho=o)):(o=l,(i!==0||(p&3)!==0)&&(zc=!0)),l=h}Bt!==0&&Bt!==5||Va(i),Gs!==0&&(Gs=0)}function x0(i,s){for(var o=i.suspendedLanes,l=i.pingedLanes,h=i.expirationTimes,p=i.pendingLanes&-62914561;0E)break;var te=B.transferSize,ne=B.initiatorType;te&&O0(ne)&&(B=B.responseEnd,b+=te*(B"u"?null:document;function q0(i,s,o){var l=Po;if(l&&typeof s=="string"&&s){var h=Ki(s);h='link[rel="'+i+'"][href="'+h+'"]',typeof o=="string"&&(h+='[crossorigin="'+o+'"]'),W0.has(h)||(W0.add(h),i={rel:i,crossOrigin:o,href:s},l.querySelector(h)===null&&(s=l.createElement("link"),ni(s,"link",i),Ft(s),l.head.appendChild(s)))}}function gE(i){ps.D(i),q0("dns-prefetch",i,null)}function vE(i,s){ps.C(i,s),q0("preconnect",i,s)}function yE(i,s,o){ps.L(i,s,o);var l=Po;if(l&&i&&s){var h='link[rel="preload"][as="'+Ki(s)+'"]';s==="image"&&o&&o.imageSrcSet?(h+='[imagesrcset="'+Ki(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(h+='[imagesizes="'+Ki(o.imageSizes)+'"]')):h+='[href="'+Ki(i)+'"]';var p=h;switch(s){case"style":p=Uo(i);break;case"script":p=Io(i)}ir.has(p)||(i=_({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:i,as:s},o),ir.set(p,i),l.querySelector(h)!==null||s==="style"&&l.querySelector(Xa(p))||s==="script"&&l.querySelector(Za(p))||(s=l.createElement("link"),ni(s,"link",i),Ft(s),l.head.appendChild(s)))}}function bE(i,s){ps.m(i,s);var o=Po;if(o&&i){var l=s&&typeof s.as=="string"?s.as:"script",h='link[rel="modulepreload"][as="'+Ki(l)+'"][href="'+Ki(i)+'"]',p=h;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Io(i)}if(!ir.has(p)&&(i=_({rel:"modulepreload",href:i},s),ir.set(p,i),o.querySelector(h)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Za(p)))return}l=o.createElement("link"),ni(l,"link",i),Ft(l),o.head.appendChild(l)}}}function SE(i,s,o){ps.S(i,s,o);var l=Po;if(l&&i){var h=ao(l).hoistableStyles,p=Uo(i);s=s||"default";var b=h.get(p);if(!b){var E={loading:0,preload:null};if(b=l.querySelector(Xa(p)))E.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":s},o),(o=ir.get(p))&&Cf(i,o);var B=b=l.createElement("link");Ft(B),ni(B,"link",i),B._p=new Promise(function(K,te){B.onload=K,B.onerror=te}),B.addEventListener("load",function(){E.loading|=1}),B.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Ic(b,s,l)}b={type:"stylesheet",instance:b,count:1,state:E},h.set(p,b)}}}function wE(i,s){ps.X(i,s);var o=Po;if(o&&i){var l=ao(o).hoistableScripts,h=Io(i),p=l.get(h);p||(p=o.querySelector(Za(h)),p||(i=_({src:i,async:!0},s),(s=ir.get(h))&&Ef(i,s),p=o.createElement("script"),Ft(p),ni(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(h,p))}}function xE(i,s){ps.M(i,s);var o=Po;if(o&&i){var l=ao(o).hoistableScripts,h=Io(i),p=l.get(h);p||(p=o.querySelector(Za(h)),p||(i=_({src:i,async:!0,type:"module"},s),(s=ir.get(h))&&Ef(i,s),p=o.createElement("script"),Ft(p),ni(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(h,p))}}function V0(i,s,o,l){var h=(h=ae.current)?Uc(h):null;if(!h)throw Error(n(446));switch(i){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Uo(o.href),o=ao(h).hoistableStyles,l=o.get(s),l||(l={type:"style",instance:null,count:0,state:null},o.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){i=Uo(o.href);var p=ao(h).hoistableStyles,b=p.get(i);if(b||(h=h.ownerDocument||h,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(i,b),(p=h.querySelector(Xa(i)))&&!p._p&&(b.instance=p,b.state.loading=5),ir.has(i)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ir.set(i,o),p||CE(h,i,o,b.state))),s&&l===null)throw Error(n(528,""));return b}if(s&&l!==null)throw Error(n(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Io(o),o=ao(h).hoistableScripts,l=o.get(s),l||(l={type:"script",instance:null,count:0,state:null},o.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,i))}}function Uo(i){return'href="'+Ki(i)+'"'}function Xa(i){return'link[rel="stylesheet"]['+i+"]"}function Y0(i){return _({},i,{"data-precedence":i.precedence,precedence:null})}function CE(i,s,o,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),ni(s,"link",o),Ft(s),i.head.appendChild(s))}function Io(i){return'[src="'+Ki(i)+'"]'}function Za(i){return"script[async]"+i}function K0(i,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Ki(o.href)+'"]');if(l)return s.instance=l,Ft(l),l;var h=_({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Ft(l),ni(l,"style",h),Ic(l,o.precedence,i),s.instance=l;case"stylesheet":h=Uo(o.href);var p=i.querySelector(Xa(h));if(p)return s.state.loading|=4,s.instance=p,Ft(p),p;l=Y0(o),(h=ir.get(h))&&Cf(l,h),p=(i.ownerDocument||i).createElement("link"),Ft(p);var b=p;return b._p=new Promise(function(E,B){b.onload=E,b.onerror=B}),ni(p,"link",l),s.state.loading|=4,Ic(p,o.precedence,i),s.instance=p;case"script":return p=Io(o.src),(h=i.querySelector(Za(p)))?(s.instance=h,Ft(h),h):(l=o,(h=ir.get(p))&&(l=_({},o),Ef(l,h)),i=i.ownerDocument||i,h=i.createElement("script"),Ft(h),ni(h,"link",l),i.head.appendChild(h),s.instance=h);case"void":return null;default:throw Error(n(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Ic(l,o.precedence,i));return s.instance}function Ic(i,s,o){for(var l=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=l.length?l[l.length-1]:null,p=h,b=0;b title"):null)}function EE(i,s,o){if(o===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Z0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function RE(i,s,o,l){if(o.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var h=Uo(l.href),p=s.querySelector(Xa(h));if(p){s=p._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Fc.bind(i),s.then(i,i)),o.state.loading|=4,o.instance=p,Ft(p);return}p=s.ownerDocument||s,l=Y0(l),(h=ir.get(h))&&Cf(l,h),p=p.createElement("link"),Ft(p);var b=p;b._p=new Promise(function(E,B){b.onload=E,b.onerror=B}),ni(p,"link",l),o.instance=p}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(i.count++,o=Fc.bind(i),s.addEventListener("load",o),s.addEventListener("error",o))}}var Rf=0;function kE(i,s){return i.stylesheets&&i.count===0&&qc(i,i.stylesheets),0Rf?50:800)+s);return i.unsuspend=o,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(h)}}:null}function Fc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Wc=null;function qc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Wc=new Map,s.forEach(TE,i),Wc=null,Fc.call(i))}function TE(i,s){if(!(s.state.loading&4)){var o=Wc.get(i);if(o)var l=o.get(null);else{o=new Map,Wc.set(i,o);for(var h=i.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Lf.exports=WE(),Lf.exports}var VE=qE();const gS=y.createContext(void 0);function YE({children:e}){const[t,r]=y.useState("loading"),n=async()=>{try{if((await(await fetch("/api/auth/status",{credentials:"include"})).json()).needsSetup){r("needsSetup");return}(await fetch("/api/auth/check",{credentials:"include"})).ok?r("authenticated"):r("notAuthenticated")}catch{r("notAuthenticated")}};y.useEffect(()=>{n()},[]);const a=async(f,m)=>{try{const d=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:f,password:m})}),g=await d.json();return d.ok&&g.success?(r("authenticated"),{success:!0}):{success:!1,error:g.error||"Login failed"}}catch{return{success:!1,error:"Network error. Please try again."}}},c=async()=>{try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}catch(f){console.error("Logout error:",f)}finally{r("notAuthenticated")}},u=()=>{r("authenticated")};return v.jsx(gS.Provider,{value:{appStatus:t,isAuthenticated:t==="authenticated",needsSetup:t==="needsSetup",login:a,logout:c,completeSetup:u,checkAuth:n},children:e})}function Cp(){const e=y.useContext(gS);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function vS(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let n=0;n({classGroupId:e,validator:t}),bS=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Mu="-",Sy=[],XE="arbitrary..",ZE=e=>{const t=JE(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return QE(u);const f=u.split(Mu),m=f[0]===""&&f.length>1?1:0;return SS(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=n[u],d=r[u];return m?d?KE(d,m):m:d||Sy}return r[u]||Sy}}},SS=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],c=r.nextPart.get(a);if(c){const d=SS(e,t+1,c);if(d)return d}const u=r.validators;if(u===null)return;const f=t===0?e.join(Mu):e.slice(t).join(Mu),m=u.length;for(let d=0;de.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?XE+n:void 0})(),JE=e=>{const{theme:t,classGroups:r}=e;return eR(r,t)},eR=(e,t)=>{const r=bS();for(const n in e){const a=e[n];Ep(a,r,n,t)}return r},Ep=(e,t,r,n)=>{const a=e.length;for(let c=0;c{if(typeof e=="string"){iR(e,t,r);return}if(typeof e=="function"){rR(e,t,r,n);return}sR(e,t,r,n)},iR=(e,t,r)=>{const n=e===""?t:wS(t,e);n.classGroupId=r},rR=(e,t,r,n)=>{if(nR(e)){Ep(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(GE(r,e))},sR=(e,t,r,n)=>{const a=Object.entries(e),c=a.length;for(let u=0;u{let r=e;const n=t.split(Mu),a=n.length;for(let c=0;c"isThemeGetter"in e&&e.isThemeGetter===!0,oR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(c,u)=>{r[c]=u,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=n[c])!==void 0)return a(c,u),u},set(c,u){c in r?r[c]=u:a(c,u)}}},ym="!",wy=":",aR=[],xy=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),lR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const c=[];let u=0,f=0,m=0,d;const g=a.length;for(let C=0;Cm?d-m:void 0;return xy(c,w,S,x)};if(t){const a=t+wy,c=n;n=u=>u.startsWith(a)?c(u.slice(a.length)):xy(aR,!1,u,void 0,!0)}if(r){const a=n;n=c=>r({className:c,parseClassName:a})}return n},cR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let c=0;c0&&(a.sort(),n.push(...a),a=[]),n.push(u)):a.push(u)}return a.length>0&&(a.sort(),n.push(...a)),n}},uR=e=>({cache:oR(e.cacheSize),parseClassName:lR(e),sortModifiers:cR(e),...ZE(e)}),hR=/\s+/,dR=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:c}=t,u=[],f=e.trim().split(hR);let m="";for(let d=f.length-1;d>=0;d-=1){const g=f[d],{isExternal:_,modifiers:S,hasImportantModifier:w,baseClassName:x,maybePostfixModifierPosition:C}=r(g);if(_){m=g+(m.length>0?" "+m:m);continue}let k=!!C,T=n(k?x.substring(0,C):x);if(!T){if(!k){m=g+(m.length>0?" "+m:m);continue}if(T=n(x),!T){m=g+(m.length>0?" "+m:m);continue}k=!1}const $=S.length===0?"":S.length===1?S[0]:c(S).join(":"),z=w?$+ym:$,A=z+T;if(u.indexOf(A)>-1)continue;u.push(A);const j=a(T,k);for(let P=0;P0?" "+m:m)}return m},fR=(...e)=>{let t=0,r,n,a="";for(;t{if(typeof e=="string")return e;let t,r="";for(let n=0;n{let r,n,a,c;const u=m=>{const d=t.reduce((g,_)=>_(g),e());return r=uR(d),n=r.cache.get,a=r.cache.set,c=f,f(m)},f=m=>{const d=n(m);if(d)return d;const g=dR(m,r);return a(m,g),g};return c=u,(...m)=>c(fR(...m))},pR=[],Lt=e=>{const t=r=>r[e]||pR;return t.isThemeGetter=!0,t},CS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ES=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_R=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vR=/\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$/,yR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,SR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rn=e=>_R.test(e),Oe=e=>!!e&&!Number.isNaN(Number(e)),sn=e=>!!e&&Number.isInteger(Number(e)),Pf=e=>e.endsWith("%")&&Oe(e.slice(0,-1)),_s=e=>gR.test(e),RS=()=>!0,wR=e=>vR.test(e)&&!yR.test(e),Rp=()=>!1,xR=e=>bR.test(e),CR=e=>SR.test(e),ER=e=>!ve(e)&&!ye(e),RR=e=>vn(e,AS,Rp),ve=e=>CS.test(e),Un=e=>vn(e,DS,wR),Cy=e=>vn(e,BR,Oe),kR=e=>vn(e,NS,RS),TR=e=>vn(e,MS,Rp),Ey=e=>vn(e,kS,Rp),AR=e=>vn(e,TS,CR),Jc=e=>vn(e,OS,xR),ye=e=>ES.test(e),sl=e=>Jn(e,DS),DR=e=>Jn(e,MS),Ry=e=>Jn(e,kS),MR=e=>Jn(e,AS),NR=e=>Jn(e,TS),eu=e=>Jn(e,OS,!0),OR=e=>Jn(e,NS,!0),vn=(e,t,r)=>{const n=CS.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Jn=(e,t,r=!1)=>{const n=ES.exec(e);return n?n[1]?t(n[1]):r:!1},kS=e=>e==="position"||e==="percentage",TS=e=>e==="image"||e==="url",AS=e=>e==="length"||e==="size"||e==="bg-size",DS=e=>e==="length",BR=e=>e==="number",MS=e=>e==="family-name",NS=e=>e==="number"||e==="weight",OS=e=>e==="shadow",LR=()=>{const e=Lt("color"),t=Lt("font"),r=Lt("text"),n=Lt("font-weight"),a=Lt("tracking"),c=Lt("leading"),u=Lt("breakpoint"),f=Lt("container"),m=Lt("spacing"),d=Lt("radius"),g=Lt("shadow"),_=Lt("inset-shadow"),S=Lt("text-shadow"),w=Lt("drop-shadow"),x=Lt("blur"),C=Lt("perspective"),k=Lt("aspect"),T=Lt("ease"),$=Lt("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...A(),ye,ve],P=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],G=()=>[ye,ve,m],re=()=>[rn,"full","auto",...G()],le=()=>[sn,"none","subgrid",ye,ve],ce=()=>["auto",{span:["full",sn,ye,ve]},sn,ye,ve],W=()=>[sn,"auto",ye,ve],M=()=>["auto","min","max","fr",ye,ve],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],N=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...G()],L=()=>[rn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...G()],U=()=>[rn,"screen","full","dvw","lvw","svw","min","max","fit",...G()],se=()=>[rn,"screen","full","lh","dvh","lvh","svh","min","max","fit",...G()],ee=()=>[e,ye,ve],D=()=>[...A(),Ry,Ey,{position:[ye,ve]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",MR,RR,{size:[ye,ve]}],Q=()=>[Pf,sl,Un],X=()=>["","none","full",d,ye,ve],ae=()=>["",Oe,sl,Un],de=()=>["solid","dashed","dotted","double"],_e=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[Oe,Pf,Ry,Ey],Je=()=>["","none",x,ye,ve],ot=()=>["none",Oe,ye,ve],Ke=()=>["none",Oe,ye,ve],Re=()=>[Oe,ye,ve],mt=()=>[rn,"full",...G()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[_s],breakpoint:[_s],color:[RS],container:[_s],"drop-shadow":[_s],ease:["in","out","in-out"],font:[ER],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[_s],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[_s],shadow:[_s],spacing:["px",Oe],text:[_s],"text-shadow":[_s],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rn,ve,ye,k]}],container:["container"],columns:[{columns:[Oe,ve,ye,f]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:j()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:re()}],"inset-x":[{"inset-x":re()}],"inset-y":[{"inset-y":re()}],start:[{"inset-s":re(),start:re()}],end:[{"inset-e":re(),end:re()}],"inset-bs":[{"inset-bs":re()}],"inset-be":[{"inset-be":re()}],top:[{top:re()}],right:[{right:re()}],bottom:[{bottom:re()}],left:[{left:re()}],visibility:["visible","invisible","collapse"],z:[{z:[sn,"auto",ye,ve]}],basis:[{basis:[rn,"full","auto",f,...G()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Oe,rn,"auto","initial","none",ve]}],grow:[{grow:["",Oe,ye,ve]}],shrink:[{shrink:["",Oe,ye,ve]}],order:[{order:[sn,"first","last","none",ye,ve]}],"grid-cols":[{"grid-cols":le()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":le()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:G()}],"gap-x":[{"gap-x":G()}],"gap-y":[{"gap-y":G()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...N(),"normal"]}],"justify-self":[{"justify-self":["auto",...N()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...N(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...N(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...N(),"baseline"]}],"place-self":[{"place-self":["auto",...N()]}],p:[{p:G()}],px:[{px:G()}],py:[{py:G()}],ps:[{ps:G()}],pe:[{pe:G()}],pbs:[{pbs:G()}],pbe:[{pbe:G()}],pt:[{pt:G()}],pr:[{pr:G()}],pb:[{pb:G()}],pl:[{pl:G()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mbs:[{mbs:R()}],mbe:[{mbe:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":G()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":G()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],"inline-size":[{inline:["auto",...U()]}],"min-inline-size":[{"min-inline":["auto",...U()]}],"max-inline-size":[{"max-inline":["none",...U()]}],"block-size":[{block:["auto",...se()]}],"min-block-size":[{"min-block":["auto",...se()]}],"max-block-size":[{"max-block":["none",...se()]}],w:[{w:[f,"screen",...L()]}],"min-w":[{"min-w":[f,"screen","none",...L()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",r,sl,Un]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,OR,kR]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Pf,ve]}],"font-family":[{font:[DR,TR,t]}],"font-features":[{"font-features":[ve]}],"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:[a,ye,ve]}],"line-clamp":[{"line-clamp":[Oe,"none",ye,Cy]}],leading:[{leading:[c,...G()]}],"list-image":[{"list-image":["none",ye,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Oe,"from-font","auto",ye,Un]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Oe,"auto",ye,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:G()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,ve]}],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",ye,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sn,ye,ve],radial:["",ye,ve],conic:[sn,ye,ve]},NR,AR]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-bs":[{"border-bs":ee()}],"border-color-be":[{"border-be":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Oe,ye,ve]}],"outline-w":[{outline:["",Oe,sl,Un]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",g,eu,Jc]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",_,eu,Jc]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Oe,Un]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",S,eu,Jc]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Oe,ye,ve]}],"mix-blend":[{"mix-blend":[..._e(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":_e()}],"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":[Oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[ye,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[Oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ve]}],filter:[{filter:["","none",ye,ve]}],blur:[{blur:Je()}],brightness:[{brightness:[Oe,ye,ve]}],contrast:[{contrast:[Oe,ye,ve]}],"drop-shadow":[{"drop-shadow":["","none",w,eu,Jc]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Oe,ye,ve]}],"hue-rotate":[{"hue-rotate":[Oe,ye,ve]}],invert:[{invert:["",Oe,ye,ve]}],saturate:[{saturate:[Oe,ye,ve]}],sepia:[{sepia:["",Oe,ye,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ve]}],"backdrop-blur":[{"backdrop-blur":Je()}],"backdrop-brightness":[{"backdrop-brightness":[Oe,ye,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Oe,ye,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Oe,ye,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Oe,ye,ve]}],"backdrop-invert":[{"backdrop-invert":["",Oe,ye,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Oe,ye,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Oe,ye,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Oe,ye,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":G()}],"border-spacing-x":[{"border-spacing-x":G()}],"border-spacing-y":[{"border-spacing-y":G()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Oe,"initial",ye,ve]}],ease:[{ease:["linear","initial",T,ye,ve]}],delay:[{delay:[Oe,ye,ve]}],animate:[{animate:["none",$,ye,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,ye,ve]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:ot()}],"rotate-x":[{"rotate-x":ot()}],"rotate-y":[{"rotate-y":ot()}],"rotate-z":[{"rotate-z":ot()}],scale:[{scale:Ke()}],"scale-x":[{"scale-x":Ke()}],"scale-y":[{"scale-y":Ke()}],"scale-z":[{"scale-z":Ke()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[ye,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:mt()}],"translate-x":[{"translate-x":mt()}],"translate-y":[{"translate-y":mt()}],"translate-z":[{"translate-z":mt()}],"translate-none":["translate-none"],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"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",ye,ve]}],"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":G()}],"scroll-mx":[{"scroll-mx":G()}],"scroll-my":[{"scroll-my":G()}],"scroll-ms":[{"scroll-ms":G()}],"scroll-me":[{"scroll-me":G()}],"scroll-mbs":[{"scroll-mbs":G()}],"scroll-mbe":[{"scroll-mbe":G()}],"scroll-mt":[{"scroll-mt":G()}],"scroll-mr":[{"scroll-mr":G()}],"scroll-mb":[{"scroll-mb":G()}],"scroll-ml":[{"scroll-ml":G()}],"scroll-p":[{"scroll-p":G()}],"scroll-px":[{"scroll-px":G()}],"scroll-py":[{"scroll-py":G()}],"scroll-ps":[{"scroll-ps":G()}],"scroll-pe":[{"scroll-pe":G()}],"scroll-pbs":[{"scroll-pbs":G()}],"scroll-pbe":[{"scroll-pbe":G()}],"scroll-pt":[{"scroll-pt":G()}],"scroll-pr":[{"scroll-pr":G()}],"scroll-pb":[{"scroll-pb":G()}],"scroll-pl":[{"scroll-pl":G()}],"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",ye,ve]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Oe,sl,Un,Cy]}],stroke:[{stroke:["none",...ee()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]}},zR=mR(LR);function Le(...e){return zR(yS(e))}function ky(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ir(...e){return t=>{let r=!1;const n=e.map(a=>{const c=ky(a,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let a=0;a{let{children:c,...u}=n;BS(c)&&typeof Nu=="function"&&(c=Nu(c._payload));const f=y.Children.toArray(c),m=f.find($R);if(m){const d=m.props.children,g=f.map(_=>_===m?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:_);return v.jsx(t,{...u,ref:a,children:y.isValidElement(d)?y.cloneElement(d,void 0,g):null})}return v.jsx(t,{...u,ref:a,children:c})});return r.displayName=`${e}.Slot`,r}var PR=LS("Slot");function UR(e){const t=y.forwardRef((r,n)=>{let{children:a,...c}=r;if(BS(a)&&typeof Nu=="function"&&(a=Nu(a._payload)),y.isValidElement(a)){const u=WR(a),f=FR(c,a.props);return a.type!==y.Fragment&&(f.ref=n?Ir(n,u):u),y.cloneElement(a,f)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var IR=Symbol("radix.slottable");function $R(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===IR}function FR(e,t){const r={...t};for(const n in t){const a=e[n],c=t[n];/^on[A-Z]/.test(n)?a&&c?r[n]=(...f)=>{const m=c(...f);return a(...f),m}:a&&(r[n]=a):n==="style"?r[n]={...a,...c}:n==="className"&&(r[n]=[a,c].filter(Boolean).join(" "))}return{...e,...r}}function WR(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const Ty=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ay=yS,kp=(e,t)=>r=>{var n;if(t?.variants==null)return Ay(e,r?.class,r?.className);const{variants:a,defaultVariants:c}=t,u=Object.keys(a).map(d=>{const g=r?.[d],_=c?.[d];if(g===null)return null;const S=Ty(g)||Ty(_);return a[d][S]}),f=r&&Object.entries(r).reduce((d,g)=>{let[_,S]=g;return S===void 0||(d[_]=S),d},{}),m=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,g)=>{let{class:_,className:S,...w}=g;return Object.entries(w).every(x=>{let[C,k]=x;return Array.isArray(k)?k.includes({...c,...f}[C]):{...c,...f}[C]===k})?[...d,_,S]:d},[]);return Ay(e,u,m,r?.class,r?.className)},Tp=kp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Ie=y.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},c)=>{const u=n?PR:"button";return v.jsx(u,{className:Le(Tp({variant:t,size:r,className:e})),ref:c,...a})});Ie.displayName="Button";const or=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("rounded-xl border bg-card text-card-foreground shadow",e),...t}));or.displayName="Card";const gr=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("flex flex-col space-y-1.5 p-6",e),...t}));gr.displayName="CardHeader";const vr=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("font-semibold leading-none tracking-tight",e),...t}));vr.displayName="CardTitle";const Ap=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Ap.displayName="CardDescription";const yr=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("p-6 pt-0",e),...t}));yr.displayName="CardContent";const qR=y.forwardRef(({className:e,...t},r)=>v.jsx("div",{ref:r,className:Le("flex items-center p-6 pt-0",e),...t}));qR.displayName="CardFooter";const xs=y.forwardRef(({className:e,type:t,...r},n)=>v.jsx("input",{type:t,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));xs.displayName="Input";var Dp=_S();const zS=pS(Dp);var VR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YR=VR.reduce((e,t)=>{const r=LS(`Primitive.${t}`),n=y.forwardRef((a,c)=>{const{asChild:u,...f}=a,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(m,{...f,ref:c})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),KR="Label",jS=y.forwardRef((e,t)=>v.jsx(YR.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));jS.displayName=KR;var HS=jS;const GR=kp("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Cs=y.forwardRef(({className:e,...t},r)=>v.jsx(HS,{ref:r,className:Le(GR(),e),...t}));Cs.displayName=HS.displayName;function XR({className:e,...t}){const{login:r}=Cp(),[n,a]=y.useState(""),[c,u]=y.useState(""),[f,m]=y.useState(""),[d,g]=y.useState(!1),_=async S=>{S.preventDefault(),m(""),g(!0);const w=await r(n,c);w.success||m(w.error||"Login failed"),g(!1)};return v.jsx("div",{className:Le("flex flex-col gap-6",e),...t,children:v.jsxs(or,{children:[v.jsxs(gr,{children:[v.jsx(vr,{className:"text-2xl",children:"Sencho"}),v.jsx(Ap,{children:"Enter your credentials to access the dashboard"})]}),v.jsx(yr,{children:v.jsx("form",{onSubmit:_,children:v.jsxs("div",{className:"flex flex-col gap-6",children:[v.jsxs("div",{className:"grid gap-2",children:[v.jsx(Cs,{htmlFor:"username",children:"Username"}),v.jsx(xs,{id:"username",type:"text",placeholder:"admin",required:!0,value:n,onChange:S=>a(S.target.value)})]}),v.jsxs("div",{className:"grid gap-2",children:[v.jsx(Cs,{htmlFor:"password",children:"Password"}),v.jsx(xs,{id:"password",type:"password",required:!0,value:c,onChange:S=>u(S.target.value)})]}),f&&v.jsx("div",{className:"text-sm text-red-500 text-center",children:f}),v.jsx(Ie,{type:"submit",className:"w-full",disabled:d,children:d?"Logging in...":"Login"})]})})})]})})}function ZR({onComplete:e,className:t,...r}){const[n,a]=y.useState(""),[c,u]=y.useState(""),[f,m]=y.useState(""),[d,g]=y.useState(""),[_,S]=y.useState(!1),w=async x=>{if(x.preventDefault(),g(""),c!==f){g("Passwords do not match");return}if(n.length<3){g("Username must be at least 3 characters");return}if(c.length<6){g("Password must be at least 6 characters");return}S(!0);try{const C=await fetch("/api/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:n,password:c,confirmPassword:f})}),k=await C.json();C.ok&&k.success?e():g(k.error||"Setup failed")}catch{g("Network error. Please try again.")}finally{S(!1)}};return v.jsx("div",{className:Le("flex flex-col gap-6",t),...r,children:v.jsxs(or,{children:[v.jsxs(gr,{children:[v.jsx(vr,{className:"text-2xl",children:"Welcome to Sencho"}),v.jsx(Ap,{children:"Create your admin account to get started"})]}),v.jsx(yr,{children:v.jsx("form",{onSubmit:w,children:v.jsxs("div",{className:"flex flex-col gap-6",children:[v.jsxs("div",{className:"grid gap-2",children:[v.jsx(Cs,{htmlFor:"username",children:"Username"}),v.jsx(xs,{id:"username",type:"text",placeholder:"admin",required:!0,value:n,onChange:x=>a(x.target.value)})]}),v.jsxs("div",{className:"grid gap-2",children:[v.jsx(Cs,{htmlFor:"password",children:"Password"}),v.jsx(xs,{id:"password",type:"password",required:!0,value:c,onChange:x=>u(x.target.value)})]}),v.jsxs("div",{className:"grid gap-2",children:[v.jsx(Cs,{htmlFor:"confirmPassword",children:"Confirm Password"}),v.jsx(xs,{id:"confirmPassword",type:"password",required:!0,value:f,onChange:x=>m(x.target.value)})]}),d&&v.jsx("div",{className:"text-sm text-red-500 text-center",children:d}),v.jsx(Ie,{type:"submit",className:"w-full",disabled:_,children:_?"Setting up...":"Complete Setup"})]})})})]})})}function Dy(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r=e.length?e.apply(this,a):function(){for(var u=arguments.length,f=new Array(u),m=0;m1&&arguments[1]!==void 0?arguments[1]:{};tu.initial(e),tu.handler(t);var r={current:e},n=dl(Sk)(r,t),a=dl(bk)(r),c=dl(tu.changes)(e),u=dl(yk)(r);function f(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(g){return g};return tu.selector(d),d(r.current)}function m(d){ck(n,a,c,u)(d)}return[f,m]}function yk(e,t){return wl(t)?t(e.current):t}function bk(e,t){return e.current=By(By({},e.current),t),t}function Sk(e,t,r){return wl(t)?t(e.current):Object.keys(r).forEach(function(n){var a;return(a=t[n])===null||a===void 0?void 0:a.call(t,e.current[n])}),r}var wk={create:vk},xk={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ck(e){return function t(){for(var r=this,n=arguments.length,a=new Array(n),c=0;c=e.length?e.apply(this,a):function(){for(var u=arguments.length,f=new Array(u),m=0;m{n.current=!1}:e,t)}var Wi=Xk;function yl(){}function Zo(e,t,r,n){return Zk(e,n)||Qk(e,t,r,n)}function Zk(e,t){return e.editor.getModel(VS(e,t))}function Qk(e,t,r,n){return e.editor.createModel(t,r,n?VS(e,n):void 0)}function VS(e,t){return e.Uri.parse(t)}function Jk({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:c,modifiedModelPath:u,keepCurrentOriginalModel:f=!1,keepCurrentModifiedModel:m=!1,theme:d="light",loading:g="Loading...",options:_={},height:S="100%",width:w="100%",className:x,wrapperProps:C={},beforeMount:k=yl,onMount:T=yl}){let[$,z]=y.useState(!1),[A,j]=y.useState(!0),P=y.useRef(null),F=y.useRef(null),G=y.useRef(null),re=y.useRef(T),le=y.useRef(k),ce=y.useRef(!1);qS(()=>{let N=FS.init();return N.then(R=>(F.current=R)&&j(!1)).catch(R=>R?.type!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>P.current?H():N.cancel()}),Wi(()=>{if(P.current&&F.current){let N=P.current.getOriginalEditor(),R=Zo(F.current,e||"",n||r||"text",c||"");R!==N.getModel()&&N.setModel(R)}},[c],$),Wi(()=>{if(P.current&&F.current){let N=P.current.getModifiedEditor(),R=Zo(F.current,t||"",a||r||"text",u||"");R!==N.getModel()&&N.setModel(R)}},[u],$),Wi(()=>{let N=P.current.getModifiedEditor();N.getOption(F.current.editor.EditorOption.readOnly)?N.setValue(t||""):t!==N.getValue()&&(N.executeEdits("",[{range:N.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),N.pushUndoStop())},[t],$),Wi(()=>{P.current?.getModel()?.original.setValue(e||"")},[e],$),Wi(()=>{let{original:N,modified:R}=P.current.getModel();F.current.editor.setModelLanguage(N,n||r||"text"),F.current.editor.setModelLanguage(R,a||r||"text")},[r,n,a],$),Wi(()=>{F.current?.editor.setTheme(d)},[d],$),Wi(()=>{P.current?.updateOptions(_)},[_],$);let W=y.useCallback(()=>{if(!F.current)return;le.current(F.current);let N=Zo(F.current,e||"",n||r||"text",c||""),R=Zo(F.current,t||"",a||r||"text",u||"");P.current?.setModel({original:N,modified:R})},[r,t,a,e,n,c,u]),M=y.useCallback(()=>{!ce.current&&G.current&&(P.current=F.current.editor.createDiffEditor(G.current,{automaticLayout:!0,..._}),W(),F.current?.editor.setTheme(d),z(!0),ce.current=!0)},[_,d,W]);y.useEffect(()=>{$&&re.current(P.current,F.current)},[$]),y.useEffect(()=>{!A&&!$&&M()},[A,$,M]);function H(){let N=P.current?.getModel();f||N?.original?.dispose(),m||N?.modified?.dispose(),P.current?.dispose()}return ue.createElement(WS,{width:w,height:S,isEditorReady:$,loading:g,_ref:G,className:x,wrapperProps:C})}var eT=Jk;y.memo(eT);function tT(e){let t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current}var iT=tT,iu=new Map;function rT({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:c,theme:u="light",line:f,loading:m="Loading...",options:d={},overrideServices:g={},saveViewState:_=!0,keepCurrentModel:S=!1,width:w="100%",height:x="100%",className:C,wrapperProps:k={},beforeMount:T=yl,onMount:$=yl,onChange:z,onValidate:A=yl}){let[j,P]=y.useState(!1),[F,G]=y.useState(!0),re=y.useRef(null),le=y.useRef(null),ce=y.useRef(null),W=y.useRef($),M=y.useRef(T),H=y.useRef(),N=y.useRef(n),R=iT(c),L=y.useRef(!1),U=y.useRef(!1);qS(()=>{let D=FS.init();return D.then(O=>(re.current=O)&&G(!1)).catch(O=>O?.type!=="cancelation"&&console.error("Monaco initialization: error:",O)),()=>le.current?ee():D.cancel()}),Wi(()=>{let D=Zo(re.current,e||n||"",t||a||"",c||r||"");D!==le.current?.getModel()&&(_&&iu.set(R,le.current?.saveViewState()),le.current?.setModel(D),_&&le.current?.restoreViewState(iu.get(c)))},[c],j),Wi(()=>{le.current?.updateOptions(d)},[d],j),Wi(()=>{!le.current||n===void 0||(le.current.getOption(re.current.editor.EditorOption.readOnly)?le.current.setValue(n):n!==le.current.getValue()&&(U.current=!0,le.current.executeEdits("",[{range:le.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),le.current.pushUndoStop(),U.current=!1))},[n],j),Wi(()=>{let D=le.current?.getModel();D&&a&&re.current?.editor.setModelLanguage(D,a)},[a],j),Wi(()=>{f!==void 0&&le.current?.revealLine(f)},[f],j),Wi(()=>{re.current?.editor.setTheme(u)},[u],j);let se=y.useCallback(()=>{if(!(!ce.current||!re.current)&&!L.current){M.current(re.current);let D=c||r,O=Zo(re.current,n||e||"",t||a||"",D||"");le.current=re.current?.editor.create(ce.current,{model:O,automaticLayout:!0,...d},g),_&&le.current.restoreViewState(iu.get(D)),re.current.editor.setTheme(u),f!==void 0&&le.current.revealLine(f),P(!0),L.current=!0}},[e,t,r,n,a,c,d,g,_,u,f]);y.useEffect(()=>{j&&W.current(le.current,re.current)},[j]),y.useEffect(()=>{!F&&!j&&se()},[F,j,se]),N.current=n,y.useEffect(()=>{j&&z&&(H.current?.dispose(),H.current=le.current?.onDidChangeModelContent(D=>{U.current||z(le.current.getValue(),D)}))},[j,z]),y.useEffect(()=>{if(j){let D=re.current.editor.onDidChangeMarkers(O=>{let q=le.current.getModel()?.uri;if(q&&O.find(Q=>Q.path===q.path)){let Q=re.current.editor.getModelMarkers({resource:q});A?.(Q)}});return()=>{D?.dispose()}}return()=>{}},[j,A]);function ee(){H.current?.dispose(),S?_&&iu.set(c,le.current.saveViewState()):le.current.getModel()?.dispose(),le.current.dispose()}return ue.createElement(WS,{width:w,height:x,isEditorReady:j,loading:m,_ref:ce,className:C,wrapperProps:k})}var sT=rT,nT=y.memo(sT),oT=nT;var YS=Object.defineProperty,aT=Object.getOwnPropertyDescriptor,lT=(e,t)=>{for(var r in t)YS(e,r,{get:t[r],enumerable:!0})},xt=(e,t,r,n)=>{for(var a=n>1?void 0:n?aT(t,r):t,c=e.length-1,u;c>=0;c--)(u=e[c])&&(a=(n?u(t,r,a):u(a))||a);return n&&a&&YS(t,r,a),a},pe=(e,t)=>(r,n)=>t(r,n,e),zy="Terminal input",bm={get:()=>zy,set:e=>zy=e},jy="Too much output to announce, navigate to rows manually to read",Sm={get:()=>jy,set:e=>jy=e};function cT(e){return e.replace(/\r?\n/g,"\r")}function uT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function hT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function dT(e,t,r,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");KS(a,t,r,n)}}function KS(e,t,r,n){e=cT(e),e=uT(e,r.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function GS(e,t,r){let n=r.getBoundingClientRect(),a=e.clientX-n.left-10,c=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Hy(e,t,r,n,a){GS(e,t,r),a&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function un(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ih(e,t=0,r=e.length){let n="";for(let a=t;a65535?(c-=65536,n+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):n+=String.fromCharCode(c)}return n}var fT=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a=0;if(this._interim){let c=e.charCodeAt(a++);56320<=c&&c<=57343?t[n++]=(this._interim-55296)*1024+c-56320+65536:(t[n++]=this._interim,t[n++]=c),this._interim=0}for(let c=a;c=r)return this._interim=u,n;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[n++]=(u-55296)*1024+f-56320+65536:(t[n++]=u,t[n++]=f);continue}u!==65279&&(t[n++]=u)}return n}},mT=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let n=0,a,c,u,f,m=0,d=0;if(this.interim[0]){let S=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let x=0,C;for(;(C=this.interim[++x]&63)&&x<4;)w<<=6,w|=C;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,T=k-x;for(;d=r)return 0;if(C=e[d++],(C&192)!==128){d--,S=!0;break}else this.interim[x++]=C,w<<=6,w|=C&63}S||(k===2?w<128?d--:t[n++]=w:k===3?w<2048||w>=55296&&w<=57343||w===65279||(t[n++]=w):w<65536||w>1114111||(t[n++]=w)),this.interim.fill(0)}let g=r-4,_=d;for(;_=r)return this.interim[0]=a,n;if(c=e[_++],(c&192)!==128){_--;continue}if(m=(a&31)<<6|c&63,m<128){_--;continue}t[n++]=m}else if((a&240)===224){if(_>=r)return this.interim[0]=a,n;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=r)return this.interim[0]=a,this.interim[1]=c,n;if(u=e[_++],(u&192)!==128){_--;continue}if(m=(a&15)<<12|(c&63)<<6|u&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[n++]=m}else if((a&248)===240){if(_>=r)return this.interim[0]=a,n;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=r)return this.interim[0]=a,this.interim[1]=c,n;if(u=e[_++],(u&192)!==128){_--;continue}if(_>=r)return this.interim[0]=a,this.interim[1]=c,this.interim[2]=u,n;if(f=e[_++],(f&192)!==128){_--;continue}if(m=(a&7)<<18|(c&63)<<12|(u&63)<<6|f&63,m<65536||m>1114111)continue;t[n++]=m}}return n}},XS="",hn=" ",Dl=class ZS{constructor(){this.fg=0,this.bg=0,this.extended=new Bu}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ZS;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Bu=class QS{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new QS(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},lr=class JS extends Dl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Bu,this.combinedData=""}static fromCharData(t){let r=new JS;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?un(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Py="di$target",wm="di$dependencies",Ff=new Map;function pT(e){return e[wm]||[]}function Qt(e){if(Ff.has(e))return Ff.get(e);let t=function(r,n,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_T(t,r,a)};return t._id=e,Ff.set(e,t),t}function _T(e,t,r){t[Py]===t?t[wm].push({id:e,index:r}):(t[wm]=[{id:e,index:r}],t[Py]=t)}var _i=Qt("BufferService"),e1=Qt("CoreMouseService"),eo=Qt("CoreService"),gT=Qt("CharsetService"),Mp=Qt("InstantiationService"),t1=Qt("LogService"),gi=Qt("OptionsService"),i1=Qt("OscLinkService"),vT=Qt("UnicodeService"),Ml=Qt("DecorationService"),xm=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let n=[],a=this._optionsService.rawOptions.linkHandler,c=new lr,u=r.getTrimmedLength(),f=-1,m=-1,d=!1;for(let g=0;ga?a.activate(x,C,S):yT(x,C),hover:(x,C)=>a?.hover?.(x,C,S),leave:(x,C)=>a?.leave?.(x,C,S)})}d=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=g,f=c.extended.urlId):(m=-1,f=-1)}}t(n)}};xm=xt([pe(0,_i),pe(1,gi),pe(2,i1)],xm);function yT(e,t){if(confirm(`Do you want to navigate to ${t}? + +WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var rh=Qt("CharSizeService"),Ts=Qt("CoreBrowserService"),Np=Qt("MouseService"),As=Qt("RenderService"),bT=Qt("SelectionService"),r1=Qt("CharacterJoinerService"),aa=Qt("ThemeService"),s1=Qt("LinkProviderService"),ST=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Uy.isErrorNoTelemetry(e)?new Uy(e.message+` + +`+e.stack):new Error(e.message+` + +`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},wT=new ST;function bu(e){xT(e)||wT.onUnexpectedError(e)}var Cm="Canceled";function xT(e){return e instanceof CT?!0:e instanceof Error&&e.name===Cm&&e.message===Cm}var CT=class extends Error{constructor(){super(Cm),this.name=this.message}};function ET(e){return new Error(`Illegal argument: ${e}`)}var Uy=class Em extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Em)return t;let r=new Em;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Rm=class n1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,n1.prototype)}};function Ui(e,t=0){return e[e.length-(1+t)]}var RT;(e=>{function t(c){return c<0}e.isLessThan=t;function r(c){return c<=0}e.isLessThanOrEqual=r;function n(c){return c>0}e.isGreaterThan=n;function a(c){return c===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(RT||={});function kT(e,t){let r=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(r,arguments))),a}}var o1;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*a(A){yield A}e.single=a;function c(A){return t(A)?A:a(A)}e.wrap=c;function u(A){return A||r}e.from=u;function*f(A){for(let j=A.length-1;j>=0;j--)yield A[j]}e.reverse=f;function m(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=m;function d(A){return A[Symbol.iterator]().next().value}e.first=d;function g(A,j){let P=0;for(let F of A)if(j(F,P++))return!0;return!1}e.some=g;function _(A,j){for(let P of A)if(j(P))return P}e.find=_;function*S(A,j){for(let P of A)j(P)&&(yield P)}e.filter=S;function*w(A,j){let P=0;for(let F of A)yield j(F,P++)}e.map=w;function*x(A,j){let P=0;for(let F of A)yield*j(F,P++)}e.flatMap=x;function*C(...A){for(let j of A)yield*j}e.concat=C;function k(A,j,P){let F=P;for(let G of A)F=j(F,G);return F}e.reduce=k;function*T(A,j,P=A.length){for(j<0&&(j+=A.length),P<0?P+=A.length:P>A.length&&(P=A.length);j1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function TT(...e){return ft(()=>Kn(e))}function ft(e){return{dispose:kT(()=>{e()})}}var a1=class l1{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Kn(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?l1.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};a1.DISABLE_DISPOSED_WARNING=!1;var fn=a1,Be=class{constructor(){this._store=new fn,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Be.None=Object.freeze({dispose(){}});var ra=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},ws=typeof window=="object"?window:globalThis,km=class Tm{constructor(t){this.element=t,this.next=Tm.Undefined,this.prev=Tm.Undefined}};km.Undefined=new km(void 0);var pt=km,Iy=class{constructor(){this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===pt.Undefined}clear(){let e=this._first;for(;e!==pt.Undefined;){let t=e.next;e.prev=pt.Undefined,e.next=pt.Undefined,e=t}this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new pt(e);if(this._first===pt.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==pt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==pt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==pt.Undefined&&e.next!==pt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===pt.Undefined&&e.next===pt.Undefined?(this._first=pt.Undefined,this._last=pt.Undefined):e.next===pt.Undefined?(this._last=this._last.prev,this._last.next=pt.Undefined):e.prev===pt.Undefined&&(this._first=this._first.next,this._first.prev=pt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==pt.Undefined;)yield e.element,e=e.next}},AT=globalThis.performance&&typeof globalThis.performance.now=="function",DT=class c1{static create(t){return new c1(t)}constructor(t){this._now=AT&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ai;(e=>{e.None=()=>Be.None;function t(W,M){return _(W,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function r(W){return(M,H=null,N)=>{let R=!1,L;return L=W(U=>{if(!R)return L?L.dispose():R=!0,M.call(H,U)},null,N),R&&L.dispose(),L}}e.once=r;function n(W,M,H){return d((N,R=null,L)=>W(U=>N.call(R,M(U)),null,L),H)}e.map=n;function a(W,M,H){return d((N,R=null,L)=>W(U=>{M(U),N.call(R,U)},null,L),H)}e.forEach=a;function c(W,M,H){return d((N,R=null,L)=>W(U=>M(U)&&N.call(R,U),null,L),H)}e.filter=c;function u(W){return W}e.signal=u;function f(...W){return(M,H=null,N)=>{let R=TT(...W.map(L=>L(U=>M.call(H,U))));return g(R,N)}}e.any=f;function m(W,M,H,N){let R=H;return n(W,L=>(R=M(R,L),R),N)}e.reduce=m;function d(W,M){let H,N={onWillAddFirstListener(){H=W(R.fire,R)},onDidRemoveLastListener(){H?.dispose()}},R=new fe(N);return M?.add(R),R.event}function g(W,M){return M instanceof Array?M.push(W):M&&M.add(W),W}function _(W,M,H=100,N=!1,R=!1,L,U){let se,ee,D,O=0,q,Q={leakWarningThreshold:L,onWillAddFirstListener(){se=W(ae=>{O++,ee=M(ee,ae),N&&!D&&(X.fire(ee),ee=void 0),q=()=>{let de=ee;ee=void 0,D=void 0,(!N||O>1)&&X.fire(de),O=0},typeof H=="number"?(clearTimeout(D),D=setTimeout(q,H)):D===void 0&&(D=0,queueMicrotask(q))})},onWillRemoveListener(){R&&O>0&&q?.()},onDidRemoveLastListener(){q=void 0,se.dispose()}},X=new fe(Q);return U?.add(X),X.event}e.debounce=_;function S(W,M=0,H){return e.debounce(W,(N,R)=>N?(N.push(R),N):[R],M,void 0,!0,void 0,H)}e.accumulate=S;function w(W,M=(N,R)=>N===R,H){let N=!0,R;return c(W,L=>{let U=N||!M(L,R);return N=!1,R=L,U},H)}e.latch=w;function x(W,M,H){return[e.filter(W,M,H),e.filter(W,N=>!M(N),H)]}e.split=x;function C(W,M=!1,H=[],N){let R=H.slice(),L=W(ee=>{R?R.push(ee):se.fire(ee)});N&&N.add(L);let U=()=>{R?.forEach(ee=>se.fire(ee)),R=null},se=new fe({onWillAddFirstListener(){L||(L=W(ee=>se.fire(ee)),N&&N.add(L))},onDidAddFirstListener(){R&&(M?setTimeout(U):U())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return N&&N.add(se),se.event}e.buffer=C;function k(W,M){return(H,N,R)=>{let L=M(new $);return W(function(U){let se=L.evaluate(U);se!==T&&H.call(N,se)},void 0,R)}}e.chain=k;let T=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(H=>(M(H),H)),this}filter(M){return this.steps.push(H=>M(H)?H:T),this}reduce(M,H){let N=H;return this.steps.push(R=>(N=M(N,R),N)),this}latch(M=(H,N)=>H===N){let H=!0,N;return this.steps.push(R=>{let L=H||!M(R,N);return H=!1,N=R,L?R:T}),this}evaluate(M){for(let H of this.steps)if(M=H(M),M===T)break;return M}}function z(W,M,H=N=>N){let N=(...se)=>U.fire(H(...se)),R=()=>W.on(M,N),L=()=>W.removeListener(M,N),U=new fe({onWillAddFirstListener:R,onDidRemoveLastListener:L});return U.event}e.fromNodeEventEmitter=z;function A(W,M,H=N=>N){let N=(...se)=>U.fire(H(...se)),R=()=>W.addEventListener(M,N),L=()=>W.removeEventListener(M,N),U=new fe({onWillAddFirstListener:R,onDidRemoveLastListener:L});return U.event}e.fromDOMEventEmitter=A;function j(W){return new Promise(M=>r(W)(M))}e.toPromise=j;function P(W){let M=new fe;return W.then(H=>{M.fire(H)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=P;function F(W,M){return W(H=>M.fire(H))}e.forward=F;function G(W,M,H){return M(H),W(N=>M(N))}e.runAndSubscribe=G;class re{constructor(M,H){this._observable=M,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new fe(N),H&&H.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,H){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(W,M){return new re(W,M).emitter.event}e.fromObservable=le;function ce(W){return(M,H,N)=>{let R=0,L=!1,U={beginUpdate(){R++},endUpdate(){R--,R===0&&(W.reportChanges(),L&&(L=!1,M.call(H)))},handlePossibleChange(){},handleChange(){L=!0}};W.addObserver(U),W.reportChanges();let se={dispose(){W.removeObserver(U)}};return N instanceof fn?N.add(se):Array.isArray(N)&&N.push(se),se}}e.fromObservableLight=ce})(ai||={});var Am=class Dm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Dm._idPool++}`,Dm.all.add(this)}start(t){this._stopWatch=new DT,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Am.all=new Set,Am._idPool=0;var MT=Am,NT=-1,u1=class h1{constructor(t,r,n=(h1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let n=this.threshold;if(n<=0||r{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,a]of this._stacks)(!t||r{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let m=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new zT(`${f}. HINT: Stack shows most frequent listener (${m[1]}-times)`,m[0]);return(this._options?.onListenerError||bu)(d),Be.None}if(this._disposed)return Be.None;r&&(t=t.bind(r));let a=new Wf(t),c;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=BT.create(),c=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Wf?(this._deliveryQueue??=new UT,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=ft(()=>{c?.(),this._removeListener(a)});return n instanceof fn?n.add(u):Array.isArray(n)&&n.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let r=this._listeners,n=r.indexOf(t);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*HT<=r.length){let c=0;for(let u=0;u0}},UT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Mm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new fe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new fe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let n=this.getWindowId(r);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Mm.INSTANCE=new Mm;var Op=Mm;function IT(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}Op.INSTANCE.onDidChangeZoomLevel;function $T(e){return Op.INSTANCE.getZoomFactor(e)}Op.INSTANCE.onDidChangeFullscreen;var la=typeof navigator=="object"?navigator.userAgent:"",Nm=la.indexOf("Firefox")>=0,FT=la.indexOf("AppleWebKit")>=0,Bp=la.indexOf("Chrome")>=0,WT=!Bp&&la.indexOf("Safari")>=0;la.indexOf("Electron/")>=0;la.indexOf("Android")>=0;var qf=!1;if(typeof ws.matchMedia=="function"){let e=ws.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ws.matchMedia("(display-mode: fullscreen)");qf=e.matches,IT(ws,e,({matches:r})=>{qf&&t.matches||(qf=r)})}var Qo="en",Om=!1,Bm=!1,Su=!1,f1=!1,ru,wu=Qo,$y=Qo,qT,ys,Vn=globalThis,$i;typeof Vn.vscode<"u"&&typeof Vn.vscode.process<"u"?$i=Vn.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&($i=process);var VT=typeof $i?.versions?.electron=="string",YT=VT&&$i?.type==="renderer";if(typeof $i=="object"){Om=$i.platform==="win32",Bm=$i.platform==="darwin",Su=$i.platform==="linux",Su&&$i.env.SNAP&&$i.env.SNAP_REVISION,$i.env.CI||$i.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ru=Qo,wu=Qo;let e=$i.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ru=t.userLocale,$y=t.osLocale,wu=t.resolvedLanguage||Qo,qT=t.languagePack?.translationsConfigFile}catch{}f1=!0}else typeof navigator=="object"&&!YT?(ys=navigator.userAgent,Om=ys.indexOf("Windows")>=0,Bm=ys.indexOf("Macintosh")>=0,(ys.indexOf("Macintosh")>=0||ys.indexOf("iPad")>=0||ys.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Su=ys.indexOf("Linux")>=0,ys?.indexOf("Mobi")>=0,wu=globalThis._VSCODE_NLS_LANGUAGE||Qo,ru=navigator.language.toLowerCase(),$y=ru):console.error("Unable to resolve platform.");var m1=Om,Pr=Bm,KT=Su,Fy=f1,$r=ys,nn=wu,GT;(e=>{function t(){return nn}e.value=t;function r(){return nn.length===2?nn==="en":nn.length>=3?nn[0]==="e"&&nn[1]==="n"&&nn[2]==="-":!1}e.isDefaultVariant=r;function n(){return nn==="en"}e.isDefault=n})(GT||={});var XT=typeof Vn.postMessage=="function"&&!Vn.importScripts;(()=>{if(XT){let e=[];Vn.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,a=e.length;n{let n=++t;e.push({id:n,callback:r}),Vn.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var ZT=!!($r&&$r.indexOf("Chrome")>=0);$r&&$r.indexOf("Firefox")>=0;!ZT&&$r&&$r.indexOf("Safari")>=0;$r&&$r.indexOf("Edg/")>=0;$r&&$r.indexOf("Android")>=0;var Fo=typeof navigator=="object"?navigator:{};Fy||document.queryCommandSupported&&document.queryCommandSupported("copy")||Fo&&Fo.clipboard&&Fo.clipboard.writeText,Fy||Fo&&Fo.clipboard&&Fo.clipboard.readText;var Lp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Vf=new Lp,Wy=new Lp,qy=new Lp,QT=new Array(230),p1;(e=>{function t(f){return Vf.keyCodeToStr(f)}e.toString=t;function r(f){return Vf.strToKeyCode(f)}e.fromString=r;function n(f){return Wy.keyCodeToStr(f)}e.toUserSettingsUS=n;function a(f){return qy.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function c(f){return Wy.strToKeyCode(f)||qy.strToKeyCode(f)}e.fromUserSettings=c;function u(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Vf.keyCodeToStr(f)}e.toElectronAccelerator=u})(p1||={});var JT=class _1{constructor(t,r,n,a,c){this.ctrlKey=t,this.shiftKey=r,this.altKey=n,this.metaKey=a,this.keyCode=c}equals(t){return t instanceof _1&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",n=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${r}${n}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new eA([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},eA=class{constructor(e){if(e.length===0)throw ET("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t{function t(r){return r===e.None||r===e.Cancelled||r instanceof cA?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ai.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:g1})})(lA||={});var cA=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?g1:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Rm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Rm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},uA=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Rm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=r.setInterval(()=>{e()},t);this.disposable=ft(()=>{r.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},hA;(e=>{async function t(n){let a,c=await Promise.all(n.map(u=>u.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return c}e.settled=t;function r(n){return new Promise(async(a,c)=>{try{await n(a,c)}catch(u){c(u)}})}e.withAsyncBody=r})(hA||={});var Gy=class sr{static fromArray(t){return new sr(r=>{r.emitMany(t)})}static fromPromise(t){return new sr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new sr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new sr(async r=>{await Promise.all(t.map(async n=>{for await(let a of n)r.emitOne(a)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new fe,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new sr(async n=>{for await(let a of t)n.emitOne(r(a))})}map(t){return sr.map(this,t)}static filter(t,r){return new sr(async n=>{for await(let a of t)r(a)&&n.emitOne(a)})}filter(t){return sr.filter(this,t)}static coalesce(t){return sr.filter(t,r=>!!r)}coalesce(){return sr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return sr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Gy.EMPTY=Gy.fromArray([]);var{getWindow:zr,getWindowId:dA,onDidRegisterWindow:fA}=(function(){let e=new Map,t={window:ws,disposables:new fn};e.set(ws.vscodeWindowId,t);let r=new fe,n=new fe,a=new fe;function c(u,f){return(typeof u=="number"?e.get(u):void 0)??(f?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Be.None;let f=new fn,m={window:u,disposables:f.add(new fn)};return e.set(u.vscodeWindowId,m),f.add(ft(()=>{e.delete(u.vscodeWindowId),n.fire(u)})),f.add(Ee(u,qt.BEFORE_UNLOAD,()=>{a.fire(u)})),r.fire(m),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:c,getWindow(u){let f=u;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let m=u;return m?.view?m.view.window:ws},getDocument(u){return zr(u).document}}})(),mA=class{constructor(e,t,r,n){this._node=e,this._type=t,this._handler=r,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ee(e,t,r,n){return new mA(e,t,r,n)}var Xy=function(e,t,r,n){return Ee(e,t,r,n)},jp,pA=class extends uA{constructor(e){super(),this.defaultTarget=e&&zr(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},Zy=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){bu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,n=new Map,a=c=>{r.set(c,!1);let u=e.get(c)??[];for(t.set(c,u),e.set(c,[]),n.set(c,!0);u.length>0;)u.sort(Zy.sort),u.shift().execute();n.set(c,!1)};jp=(c,u,f=0)=>{let m=dA(c),d=new Zy(u,f),g=e.get(m);return g||(g=[],e.set(m,g)),g.push(d),r.get(m)||(r.set(m,!0),c.requestAnimationFrame(()=>a(m))),d}})();function _A(e){let t=e.getBoundingClientRect(),r=zr(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var qt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},gA=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ri(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ri(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ri(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ri(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ri(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ri(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ri(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ri(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ri(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ri(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ri(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ri(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ri(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ri(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ri(e){return typeof e=="number"?`${e}px`:e}function bl(e){return new gA(e)}var v1=class{constructor(){this._hooks=new fn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,n,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=a;let c=e;try{e.setPointerCapture(t),this._hooks.add(ft(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=zr(e)}this._hooks.add(Ee(c,qt.POINTER_MOVE,u=>{if(u.buttons!==r){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(Ee(c,qt.POINTER_UP,u=>this.stopMonitoring(!0)))}};function vA(e,t,r){let n=null,a=null;if(typeof r.value=="function"?(n="value",a=r.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(n="get",a=r.get),!a)throw new Error("not supported");let c=`$memoize$${t}`;r[n]=function(...u){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,u)}),this[c]}}var Or;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Or||={});var fl=class ui extends Be{constructor(){super(),this.dispatched=!1,this.targets=new Iy,this.ignoreTargets=new Iy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ai.runAndSubscribe(fA,({window:t,disposables:r})=>{r.add(Ee(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),r.add(Ee(t.document,"touchend",n=>this.onTouchEnd(t,n))),r.add(Ee(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:ws,disposables:this._store}))}static addTarget(t){if(!ui.isTouchDevice())return Be.None;ui.INSTANCE||(ui.INSTANCE=new ui);let r=ui.INSTANCE.targets.push(t);return ft(r)}static ignoreTarget(t){if(!ui.isTouchDevice())return Be.None;ui.INSTANCE||(ui.INSTANCE=new ui);let r=ui.INSTANCE.ignoreTargets.push(t);return ft(r)}static isTouchDevice(){return"ontouchstart"in ws||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,a=t.targetTouches.length;n=ui.HOLD_DELAY&&Math.abs(m.initialPageX-Ui(m.rollingPageX))<30&&Math.abs(m.initialPageY-Ui(m.rollingPageY))<30){let g=this.newGestureEvent(Or.Contextmenu,m.initialTarget);g.pageX=Ui(m.rollingPageX),g.pageY=Ui(m.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Ui(m.rollingPageX),_=Ui(m.rollingPageY),S=Ui(m.rollingTimestamps)-m.rollingTimestamps[0],w=g-m.rollingPageX[0],x=_-m.rollingPageY[0],C=[...this.targets].filter(k=>m.initialTarget instanceof Node&&k.contains(m.initialTarget));this.inertia(t,C,n,Math.abs(w)/S,w>0?1:-1,g,Math.abs(x)/S,x>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Or.End,m.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=r,n.tapCount=0,n}dispatchEvent(t){if(t.type===Or.Tap){let r=new Date().getTime(),n=0;r-this._lastSetTapCountTime>ui.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=r,t.tapCount=n}else(t.type===Or.Change||t.type===Or.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let r=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let a=0,c=t.initialTarget;for(;c&&c!==n;)a++,c=c.parentElement;r.push([a,n])}r.sort((n,a)=>n[0]-a[0]);for(let[n,a]of r)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,n,a,c,u,f,m,d){this.handle=jp(t,()=>{let g=Date.now(),_=g-n,S=0,w=0,x=!0;a+=ui.SCROLL_FRICTION*_,f+=ui.SCROLL_FRICTION*_,a>0&&(x=!1,S=c*a*_),f>0&&(x=!1,w=m*f*_);let C=this.newGestureEvent(Or.Change);C.translationX=S,C.translationY=w,r.forEach(k=>k.dispatchEvent(C)),x||this.inertia(t,r,g,a,c,u+S,f,m,d+w)})}onTouchMove(t){let r=Date.now();for(let n=0,a=t.changedTouches.length;n3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(c.pageX),u.rollingPageY.push(c.pageY),u.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};fl.SCROLL_FRICTION=-.005,fl.HOLD_DELAY=700,fl.CLEAR_TAP_COUNT_TIME=400,xt([vA],fl,"isTouchDevice",1);var yA=fl,Hp=class extends Be{onclick(e,t){this._register(Ee(e,qt.CLICK,r=>t(new su(zr(e),r))))}onmousedown(e,t){this._register(Ee(e,qt.MOUSE_DOWN,r=>t(new su(zr(e),r))))}onmouseover(e,t){this._register(Ee(e,qt.MOUSE_OVER,r=>t(new su(zr(e),r))))}onmouseleave(e,t){this._register(Ee(e,qt.MOUSE_LEAVE,r=>t(new su(zr(e),r))))}onkeydown(e,t){this._register(Ee(e,qt.KEY_DOWN,r=>t(new Vy(r))))}onkeyup(e,t){this._register(Ee(e,qt.KEY_UP,r=>t(new Vy(r))))}oninput(e,t){this._register(Ee(e,qt.INPUT,t))}onblur(e,t){this._register(Ee(e,qt.BLUR,t))}onfocus(e,t){this._register(Ee(e,qt.FOCUS,t))}onchange(e,t){this._register(Ee(e,qt.CHANGE,t))}ignoreGesture(e){return yA.ignoreTarget(e)}},Qy=11,bA=class extends Hp{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Qy+"px",this.domNode.style.height=Qy+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new v1),this._register(Xy(this.bgDomNode,qt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Xy(this.domNode,qt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new pA),this._pointerdownScheduleRepeatTimer=this._register(new zp)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,zr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},SA=class Lm{constructor(t,r,n,a,c,u,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,n=n|0,a=a|0,c=c|0,u=u|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,r<0&&(r=0),a+r>n&&(a=n-r),a<0&&(a=0),c<0&&(c=0),f+c>u&&(f=u-c),f<0&&(f=0),this.width=r,this.scrollWidth=n,this.scrollLeft=a,this.height=c,this.scrollHeight=u,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new Lm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Lm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let n=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:a,scrollLeftChanged:c,heightChanged:u,scrollHeightChanged:f,scrollTopChanged:m}}},wA=class extends Be{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new SA(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let n;t?n=new eb(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=eb.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},Jy=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function Yf(e,t){let r=t-e;return function(n){return e+r*EA(n)}}function xA(e,t,r){return function(n){return n2.5*n){let a,c;return t{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},kA=140,y1=class extends Hp{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new RA(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new v1),this._shouldRender=!0,this.domNode=bl(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ee(this.domNode.domNode,qt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new bA(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,n){this.slider=bl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ee(this.slider.domNode,qt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);r<=a&&a<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let a=_A(this.domNode.domNode);t=e.pageX-a.left,r=e.pageY-a.top}let n=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let c=this._sliderOrthogonalPointerPosition(a),u=Math.abs(c-r);if(m1&&u>kA){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},b1=class jm{constructor(t,r,n,a,c,u){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=c,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new jm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,n,a,c){let u=Math.max(0,n-t),f=Math.max(0,u-2*r),m=a>0&&a>n;if(!m)return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*f/a))),g=(f-d)/(a-n),_=c*g;return{computedAvailableSize:Math.round(u),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=jm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,n=this._scrollPosition;return r0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),r){let a=Math.abs(t.deltaX),c=Math.abs(t.deltaY),u=Math.abs(r.deltaX),f=Math.abs(r.deltaY),m=Math.max(Math.min(a,u),1),d=Math.max(Math.min(c,f),1),g=Math.max(a,u),_=Math.max(c,f);g%m===0&&_%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Hm.INSTANCE=new Hm;var NA=Hm,OA=class extends Hp{constructor(e,t,r){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),this.onWillScroll=this._onWillScroll.event,this._options=LA(t),this._scrollable=r,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let n={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new AA(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new TA(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=bl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new zp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Kn(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Pr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ky(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Kn(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new Ky(r))};this._mouseWheelToDispose.push(Ee(this._listenOnDomNode,qt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=NA.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let u=!Pr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),m={};if(a){let d=tb*a,g=f.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(m,g)}if(c){let d=tb*c,g=f.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(m,g)}m=this._scrollable.validateScrollPosition(m),(f.scrollLeft!==m.scrollLeft||f.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),r=!0)}let n=r;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,n=r?" left":"",a=t?" top":"",c=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${a}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),DA)}},BA=class extends OA{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function LA(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Pr&&(t.className+=" mac"),t}var Pm=class extends Be{constructor(e,t,r,n,a,c,u,f){super(),this._bufferService=r,this._optionsService=u,this._renderService=f,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new wA({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>jp(n.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new BA(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ai.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ft(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ft(()=>this._styleElement.remove())),this._register(ai.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(` +`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};Pm=xt([pe(2,_i),pe(3,Ts),pe(4,e1),pe(5,aa),pe(6,gi),pe(7,As)],Pm);var Um=class extends Be{constructor(e,t,r,n,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=n,this._renderService=a,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(c=>this._removeDecoration(c))),this._register(ft(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Um=xt([pe(1,_i),pe(2,Ts),pe(3,Ml),pe(4,As)],Um);var zA=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Dr={full:0,left:0,center:0,right:0},on={full:0,left:0,center:0,right:0},nl={full:0,left:0,center:0,right:0},Lu=class extends Be{constructor(e,t,r,n,a,c,u,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=a,this._optionsService=c,this._themeService=u,this._coreBrowserService=f,this._colorZoneStore=new zA,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(ft(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);on.full=this._canvas.width,on.left=e,on.center=t,on.right=e,this._refreshDrawHeightConstants(),nl.full=1,nl.left=1,nl.center=1+on.left,nl.right=1+on.left+on.center}_refreshDrawHeightConstants(){Dr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Dr.left=t,Dr.center=t,Dr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(nl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Dr[e.position||"full"]/2),on[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Dr[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Lu=xt([pe(2,_i),pe(3,Ml),pe(4,As),pe(5,gi),pe(6,aa),pe(7,Ts)],Lu);var oe;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=` +`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(oe||={});var xu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(xu||={});var S1;(e=>e.ST=`${oe.ESC}\\`)(S1||={});var Im=class{constructor(e,t,r,n,a,c){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=a,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.lengththis.updateCompositionElements(!0),0)}}};Im=xt([pe(2,_i),pe(3,gi),pe(4,eo),pe(5,As)],Im);var Vt=0,Yt=0,Kt=0,bt=0,ib={css:"#00000000",rgba:0},Nt;(e=>{function t(a,c,u,f){return f!==void 0?`#${In(a)}${In(c)}${In(u)}${In(f)}`:`#${In(a)}${In(c)}${In(u)}`}e.toCss=t;function r(a,c,u,f=255){return(a<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function n(a,c,u,f){return{css:e.toCss(a,c,u,f),rgba:e.toRgba(a,c,u,f)}}e.toColor=n})(Nt||={});var ht;(e=>{function t(m,d){if(bt=(d.rgba&255)/255,bt===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,_=d.rgba>>16&255,S=d.rgba>>8&255,w=m.rgba>>24&255,x=m.rgba>>16&255,C=m.rgba>>8&255;Vt=w+Math.round((g-w)*bt),Yt=x+Math.round((_-x)*bt),Kt=C+Math.round((S-C)*bt);let k=Nt.toCss(Vt,Yt,Kt),T=Nt.toRgba(Vt,Yt,Kt);return{css:k,rgba:T}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function n(m,d,g){let _=Cu.ensureContrastRatio(m.rgba,d.rgba,g);if(_)return Nt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=n;function a(m){let d=(m.rgba|255)>>>0;return[Vt,Yt,Kt]=Cu.toChannels(d),{css:Nt.toCss(Vt,Yt,Kt),rgba:d}}e.opaque=a;function c(m,d){return bt=Math.round(d*255),[Vt,Yt,Kt]=Cu.toChannels(m.rgba),{css:Nt.toCss(Vt,Yt,Kt,bt),rgba:Nt.toRgba(Vt,Yt,Kt,bt)}}e.opacity=c;function u(m,d){return bt=m.rgba&255,c(m,bt*d/255)}e.multiplyOpacity=u;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(ht||={});var _t;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Vt=parseInt(a.slice(1,2).repeat(2),16),Yt=parseInt(a.slice(2,3).repeat(2),16),Kt=parseInt(a.slice(3,4).repeat(2),16),Nt.toColor(Vt,Yt,Kt);case 5:return Vt=parseInt(a.slice(1,2).repeat(2),16),Yt=parseInt(a.slice(2,3).repeat(2),16),Kt=parseInt(a.slice(3,4).repeat(2),16),bt=parseInt(a.slice(4,5).repeat(2),16),Nt.toColor(Vt,Yt,Kt,bt);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.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 Vt=parseInt(c[1]),Yt=parseInt(c[2]),Kt=parseInt(c[3]),bt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Nt.toColor(Vt,Yt,Kt,bt);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Vt,Yt,Kt,bt]=t.getImageData(0,0,1,1).data,bt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Nt.toRgba(Vt,Yt,Kt,bt),css:a}}e.toColor=n})(_t||={});var mi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,c){let u=n/255,f=a/255,m=c/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return d*.2126+g*.7152+_*.0722}e.relativeLuminance2=r})(mi||={});var Cu;(e=>{function t(u,f){if(bt=(f&255)/255,bt===1)return f;let m=f>>24&255,d=f>>16&255,g=f>>8&255,_=u>>24&255,S=u>>16&255,w=u>>8&255;return Vt=_+Math.round((m-_)*bt),Yt=S+Math.round((d-S)*bt),Kt=w+Math.round((g-w)*bt),Nt.toRgba(Vt,Yt,Kt)}e.blend=t;function r(u,f,m){let d=mi.relativeLuminance(u>>8),g=mi.relativeLuminance(f>>8);if(gs(d,g)>8));if(x>8));return x>k?w:C}return w}let _=a(u,f,m),S=gs(d,mi.relativeLuminance(_>>8));if(S>8));return S>x?_:w}return _}}e.ensureContrastRatio=r;function n(u,f,m){let d=u>>24&255,g=u>>16&255,_=u>>8&255,S=f>>24&255,w=f>>16&255,x=f>>8&255,C=gs(mi.relativeLuminance2(S,w,x),mi.relativeLuminance2(d,g,_));for(;C0||w>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C=gs(mi.relativeLuminance2(S,w,x),mi.relativeLuminance2(d,g,_));return(S<<24|w<<16|x<<8|255)>>>0}e.reduceLuminance=n;function a(u,f,m){let d=u>>24&255,g=u>>16&255,_=u>>8&255,S=f>>24&255,w=f>>16&255,x=f>>8&255,C=gs(mi.relativeLuminance2(S,w,x),mi.relativeLuminance2(d,g,_));for(;C>>0}e.increaseLuminance=a;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(Cu||={});function In(e){let t=e.toString(16);return t.length<2?"0"+t:t}function gs(e,t){return e1){let g=this._getJoinedRanges(n,u,c,t,a);for(let _=0;_1){let d=this._getJoinedRanges(n,u,c,t,a);for(let g=0;g=le,L=M,U=this._workCell;if(S.length>0&&M===S[0][0]&&R){let Re=S.shift(),mt=this._isCellInSelection(Re[0],t);for($=Re[0]+1;$=Re[1],R?(N=!0,U=new jA(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),L=Re[1]-1,H=U.getWidth()):le=Re[1]}let se=this._isCellInSelection(M,t),ee=r&&M===c,D=W&&M>=d&&M<=g,O=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,Re=>{O=!0});let q=U.getChars()||hn;if(q===" "&&(U.isUnderline()||U.isOverline())&&(q=" "),re=H*f-m.get(q,U.isBold(),U.isItalic()),!C)C=this._document.createElement("span");else if(k&&(se&&G||!se&&!G&&U.bg===z)&&(se&&G&&w.selectionForeground||U.fg===A)&&U.extended.ext===j&&D===P&&re===F&&!ee&&!N&&!O&&R){U.isInvisible()?T+=hn:T+=q,k++;continue}else k&&(C.textContent=T),C=this._document.createElement("span"),k=0,T="";if(z=U.bg,A=U.fg,j=U.extended.ext,P=D,F=re,G=se,N&&c>=M&&c<=L&&(c=M),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&ce.push("xterm-cursor-blink"),ce.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline");break}}if(U.isBold()&&ce.push("xterm-bold"),U.isItalic()&&ce.push("xterm-italic"),U.isDim()&&ce.push("xterm-dim"),U.isInvisible()?T=hn:T=U.getChars()||hn,U.isUnderline()&&(ce.push(`xterm-underline-${U.extended.underlineStyle}`),T===" "&&(T=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${Dl.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let Re=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&Re<8&&(Re+=8),C.style.textDecorationColor=w.ansi[Re].css}U.isOverline()&&(ce.push("xterm-overline"),T===" "&&(T=" ")),U.isStrikethrough()&&ce.push("xterm-strikethrough"),D&&(C.style.textDecoration="underline");let Q=U.getFgColor(),X=U.getFgColorMode(),ae=U.getBgColor(),de=U.getBgColorMode(),_e=!!U.isInverse();if(_e){let Re=Q;Q=ae,ae=Re;let mt=X;X=de,de=mt}let me,Je,ot=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,Re=>{Re.options.layer!=="top"&&ot||(Re.backgroundColorRGB&&(de=50331648,ae=Re.backgroundColorRGB.rgba>>8&16777215,me=Re.backgroundColorRGB),Re.foregroundColorRGB&&(X=50331648,Q=Re.foregroundColorRGB.rgba>>8&16777215,Je=Re.foregroundColorRGB),ot=Re.options.layer==="top")}),!ot&&se&&(me=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,ae=me.rgba>>8&16777215,de=50331648,ot=!0,w.selectionForeground&&(X=50331648,Q=w.selectionForeground.rgba>>8&16777215,Je=w.selectionForeground)),ot&&ce.push("xterm-decoration-top");let Ke;switch(de){case 16777216:case 33554432:Ke=w.ansi[ae],ce.push(`xterm-bg-${ae}`);break;case 50331648:Ke=Nt.toColor(ae>>16,ae>>8&255,ae&255),this._addStyle(C,`background-color:#${rb((ae>>>0).toString(16),"0",6)}`);break;default:_e?(Ke=w.foreground,ce.push("xterm-bg-257")):Ke=w.background}switch(me||U.isDim()&&(me=ht.multiplyOpacity(Ke,.5)),X){case 16777216:case 33554432:U.isBold()&&Q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Q+=8),this._applyMinimumContrast(C,Ke,w.ansi[Q],U,me,void 0)||ce.push(`xterm-fg-${Q}`);break;case 50331648:let Re=Nt.toColor(Q>>16&255,Q>>8&255,Q&255);this._applyMinimumContrast(C,Ke,Re,U,me,Je)||this._addStyle(C,`color:#${rb(Q.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(C,Ke,w.foreground,U,me,Je)||_e&&ce.push("xterm-fg-257")}ce.length&&(C.className=ce.join(" "),ce.length=0),!ee&&!N&&!O&&R?k++:C.textContent=T,re!==this.defaultSpacing&&(C.style.letterSpacing=`${re}px`),_.push(C),M=L}return C&&k&&(C.textContent=T),_}_applyMinimumContrast(e,t,r,n,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||UA(n.getCode()))return!1;let u=this._getContrastCache(n),f;if(!a&&!c&&(f=u.getColor(t.rgba,r.rgba)),f===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);f=ht.ensureContrastRatio(a||t,c||r,m),u.setColor((a||t).rgba,(c||r).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,n=this._selectionEnd;return!r||!n?!1:this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t=r[0]&&e=r[0]}};$m=xt([pe(1,r1),pe(2,gi),pe(3,Ts),pe(4,eo),pe(5,Ml),pe(6,aa)],$m);function rb(e,t,r){for(;e.length0&&(this._flat[n]=u),u}let a=e;t&&(a+="B"),r&&(a+="I");let c=this._holey.get(a);if(c===void 0){let u=0;t&&(u|=1),r&&(u|=2),c=this._measure(e,u),c>0&&this._holey.set(a,c)}return c}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},FA=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,n=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let a=e.buffers.active.ydisp,c=t[1]-a,u=r[1]-a,f=Math.max(c,0),m=Math.min(u,e.rows-1);if(f>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=c,this.viewportEndRow=u,this.viewportCappedStartRow=f,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r=this.startCol&&t=this.startCol):!1}};function WA(){return new FA}var Kf="xterm-dom-renderer-owner-",rr="xterm-rows",ou="xterm-fg-",sb="xterm-bg-",ol="xterm-focus",au="xterm-selection",qA=1,Fm=class extends Be{constructor(e,t,r,n,a,c,u,f,m,d,g,_,S,w){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=n,this._viewportElement=a,this._helperContainer=c,this._linkifier2=u,this._charSizeService=m,this._optionsService=d,this._bufferService=g,this._coreService=_,this._coreBrowserService=S,this._themeService=w,this._terminalClass=qA++,this._rowElements=[],this._selectionRenderModel=WA(),this.onRequestRedraw=this._register(new fe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(rr),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(au),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=IA(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance($m,document),this._element.classList.add(Kf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(ft(()=>{this._element.classList.remove(Kf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $A(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${rr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${rr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${rr} .xterm-dim { color: ${ht.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${rr}.${ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${rr}.${ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${rr}.${ol} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${rr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${rr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${rr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${rr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${rr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${au} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${au} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${au} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,u]of e.ansi.entries())t+=`${this._terminalSelector} .${ou}${c} { color: ${u.css}; }${this._terminalSelector} .${ou}${c}.xterm-dim { color: ${ht.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${sb}${c} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${ou}257 { color: ${ht.opaque(e.background).css}; }${this._terminalSelector} .${ou}257.xterm-dim { color: ${ht.multiplyOpacity(ht.opaque(e.background),.5).css}; }${this._terminalSelector} .${sb}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(ol),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ol),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];f.appendChild(this._createSelectionElement(c,m?t[0]:e[0],m?e[0]:t[0],u-c+1))}else{let m=n===c?e[0]:0,d=c===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,m,d));let g=u-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,g)),c!==u){let _=a===u?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(u,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,r,n=1){let a=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(r-t);return c+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-c),a.style.height=`${n*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${c}px`,a.style.width=`${u}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,n=r.ybase+r.y,a=Math.min(r.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let d=m+r.ydisp,g=this._rowElements[m],_=r.lines.get(d);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,d,d===n,u,f,a,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Kf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,n,a,c){r<0&&(e=0),n<0&&(t=0);let u=this._bufferService.rows-1;r=Math.max(Math.min(r,u),0),n=Math.max(Math.min(n,u),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,m=f.ybase+f.y,d=Math.min(f.x,a-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=r;w<=n;++w){let x=w+f.ydisp,C=this._rowElements[w],k=f.lines.get(x);if(!C||!k)break;C.replaceChildren(...this._rowFactory.createRow(k,x,x===m,_,S,d,g,this.dimensions.css.cell.width,this._widthCache,c?w===r?e:0:-1,c?(w===n?t:a)-1:-1))}}};Fm=xt([pe(7,Mp),pe(8,rh),pe(9,gi),pe(10,_i),pe(11,eo),pe(12,Ts),pe(13,aa)],Fm);var Wm=class extends Be{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new fe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new YA(this._optionsService))}catch{this._measureStrategy=this._register(new VA(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Wm=xt([pe(2,gi)],Wm);var w1=class extends Be{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},VA=class extends w1{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},YA=class extends w1{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},KA=class extends Be{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new GA(this._window)),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new fe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(ai.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ee(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ee(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},GA=class extends Be{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ra),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ft(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ee(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},XA=class extends Be{constructor(){super(),this.linkProviders=[],this._register(ft(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Pp(e,t,r){let n=r.getBoundingClientRect(),a=e.getComputedStyle(r),c=parseInt(a.getPropertyValue("padding-left")),u=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-c,t.clientY-n.top-u]}function ZA(e,t,r,n,a,c,u,f,m){if(!c)return;let d=Pp(e,t,r);if(d)return d[0]=Math.ceil((d[0]+(m?u/2:0))/u),d[1]=Math.ceil(d[1]/f),d[0]=Math.min(Math.max(d[0],1),n+(m?1:0)),d[1]=Math.min(Math.max(d[1],1),a),d}var qm=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,a){return ZA(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let r=Pp(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};qm=xt([pe(0,As),pe(1,rh)],qm);var QA=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},x1={};lT(x1,{getSafariVersion:()=>eD,isChromeOS:()=>k1,isFirefox:()=>C1,isIpad:()=>tD,isIphone:()=>iD,isLegacyEdge:()=>JA,isLinux:()=>Up,isMac:()=>ju,isNode:()=>sh,isSafari:()=>E1,isWindows:()=>R1});var sh=typeof process<"u"&&"title"in process,Nl=sh?"node":navigator.userAgent,Ol=sh?"node":navigator.platform,C1=Nl.includes("Firefox"),JA=Nl.includes("Edge"),E1=/^((?!chrome|android).)*safari/i.test(Nl);function eD(){if(!E1)return 0;let e=Nl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ju=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ol),tD=Ol==="iPad",iD=Ol==="iPhone",R1=["Windows","Win16","Win32","WinCE"].includes(Ol),Up=Ol.indexOf("Linux")>=0,k1=/\bCrOS\b/.test(Nl),T1=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ia){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},rD=class extends T1{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},sD=class extends T1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Hu=!sh&&"requestIdleCallback"in window?sD:rD,nD=class{constructor(){this._queue=new Hu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Vm=class extends Be{constructor(e,t,r,n,a,c,u,f,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=n,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new ra),this._pausedResizeTask=new nD,this._observerDisposable=this._register(new ra),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 fe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new fe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new fe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new QA((d,g)=>this._renderRows(d,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new oD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ft(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=ft(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,r){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,this._renderer.value?.handleSelectionChanged(e,t,r)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Vm=xt([pe(2,gi),pe(3,rh),pe(4,eo),pe(5,Ml),pe(6,_i),pe(7,Ts),pe(8,aa)],Vm);var oD=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function aD(e,t,r,n){let a=r.buffer.x,c=r.buffer.y;if(!r.buffer.hasScrollback)return uD(a,c,e,t,r,n)+nh(c,t,r,n)+hD(a,c,e,t,r,n);let u;if(c===t)return u=a>e?"D":"C",Cl(Math.abs(a-e),xl(u,n));u=c>t?"D":"C";let f=Math.abs(c-t),m=cD(c>t?e:a,r)+(f-1)*r.cols+1+lD(c>t?a:e);return Cl(m,xl(u,n))}function lD(e,t){return e-1}function cD(e,t){return t.cols-e}function uD(e,t,r,n,a,c){return nh(t,n,a,c).length===0?"":Cl(D1(e,t,e,t-Gn(t,a),!1,a).length,xl("D",c))}function nh(e,t,r,n){let a=e-Gn(e,r),c=t-Gn(t,r),u=Math.abs(a-c)-dD(e,t,r);return Cl(u,xl(A1(e,t),n))}function hD(e,t,r,n,a,c){let u;nh(t,n,a,c).length>0?u=n-Gn(n,a):u=t;let f=n,m=fD(e,t,r,n,a,c);return Cl(D1(e,u,r,f,m==="C",a).length,xl(m,c))}function dD(e,t,r){let n=0,a=e-Gn(e,r),c=t-Gn(t,r);for(let u=0;u=0&&e0?u=n-Gn(n,a):u=t,e=r&&ut?"A":"B"}function D1(e,t,r,n,a,c){let u=e,f=t,m="";for(;(u!==r||f!==n)&&f>=0&&fc.cols-1?(m+=c.buffer.translateBufferLineToString(f,!1,e,u),u=0,e=0,f++):!a&&u<0&&(m+=c.buffer.translateBufferLineToString(f,!1,0,e+1),u=c.cols-1,e=u,f--);return m+c.buffer.translateBufferLineToString(f,!1,e,u)}function xl(e,t){let r=t?"O":"[";return oe.ESC+r+e}function Cl(e,t){e=Math.floor(e);let r="";for(let n=0;nthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function nb(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Gf=50,pD=15,_D=50,gD=500,vD=" ",yD=new RegExp(vD,"g"),Ym=class extends Be{constructor(e,t,r,n,a,c,u,f,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=a,this._mouseService=c,this._optionsService=u,this._renderService=f,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new lr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new fe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new fe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new mD(this._bufferService),this._activeSelectionMode=0,this._register(ft(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]a.replace(yD," ")).join(R1?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Up&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n||!t?!1:this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!r||!n?!1:this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let r=this._linkifier.currentLink?.link?.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=nb(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Pp(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-Gf),Gf),t/=Gf,t/Math.abs(t)+Math.round(t*(pD-1)))}shouldForceSelection(e){return ju?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),_D)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(ju&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){let a=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:a>1&&t!==n&&(r+=a-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,c=a.lines.get(e[1]);if(!c)return;let u=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),m=f,d=e[0]-f,g=0,_=0,S=0,w=0;if(u.charAt(f)===" "){for(;f>0&&u.charAt(f-1)===" ";)f--;for(;m1&&(w+=$-1,m+=$-1);k>0&&f>0&&!this._isCharWordSeparator(c.loadCell(k-1,this._workCell));){c.loadCell(k-1,this._workCell);let z=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,k--):z>1&&(S+=z-1,f-=z-1),f--,k--}for(;T1&&(w+=z-1,m+=z-1),m++,T++}}m++;let x=f+d-g+S,C=Math.min(this._bufferService.cols,m-f+g+_-S-w);if(!(!t&&u.slice(f,m).trim()==="")){if(r&&x===0&&c.getCodePoint(0)!==32){let k=a.lines.get(e[1]-1);if(k&&c.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let T=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(T){let $=this._bufferService.cols-T.start;x-=$,C+=$}}}if(n&&x+C===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let k=a.lines.get(e[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let T=this._getWordAt([0,e[1]+1],!1,!1,!0);T&&(C+=T.length)}}return{start:x,length:C}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=nb(r,this._bufferService.cols)}};Ym=xt([pe(3,_i),pe(4,eo),pe(5,Np),pe(6,gi),pe(7,As),pe(8,Ts)],Ym);var ob=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ab=class{constructor(){this._color=new ob,this._css=new ob}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},zt=Object.freeze((()=>{let e=[_t.toColor("#2e3436"),_t.toColor("#cc0000"),_t.toColor("#4e9a06"),_t.toColor("#c4a000"),_t.toColor("#3465a4"),_t.toColor("#75507b"),_t.toColor("#06989a"),_t.toColor("#d3d7cf"),_t.toColor("#555753"),_t.toColor("#ef2929"),_t.toColor("#8ae234"),_t.toColor("#fce94f"),_t.toColor("#729fcf"),_t.toColor("#ad7fa8"),_t.toColor("#34e2e2"),_t.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],c=t[r%6];e.push({css:Nt.toCss(n,a,c),rgba:Nt.toRgba(n,a,c)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:Nt.toCss(n,n,n),rgba:Nt.toRgba(n,n,n)})}return e})()),Fn=_t.toColor("#ffffff"),ml=_t.toColor("#000000"),lb=_t.toColor("#ffffff"),cb=ml,al={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},bD=Fn,Km=class extends Be{constructor(e){super(),this._optionsService=e,this._contrastCache=new ab,this._halfContrastCache=new ab,this._onChangeColors=this._register(new fe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Fn,background:ml,cursor:lb,cursorAccent:cb,selectionForeground:void 0,selectionBackgroundTransparent:al,selectionBackgroundOpaque:ht.blend(ml,al),selectionInactiveBackgroundTransparent:al,selectionInactiveBackgroundOpaque:ht.blend(ml,al),scrollbarSliderBackground:ht.opacity(Fn,.2),scrollbarSliderHoverBackground:ht.opacity(Fn,.4),scrollbarSliderActiveBackground:ht.opacity(Fn,.5),overviewRulerBorder:Fn,ansi:zt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=rt(e.foreground,Fn),t.background=rt(e.background,ml),t.cursor=ht.blend(t.background,rt(e.cursor,lb)),t.cursorAccent=ht.blend(t.background,rt(e.cursorAccent,cb)),t.selectionBackgroundTransparent=rt(e.selectionBackground,al),t.selectionBackgroundOpaque=ht.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=rt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ht.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?rt(e.selectionForeground,ib):void 0,t.selectionForeground===ib&&(t.selectionForeground=void 0),ht.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ht.opacity(t.selectionBackgroundTransparent,.3)),ht.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ht.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=rt(e.scrollbarSliderBackground,ht.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=rt(e.scrollbarSliderHoverBackground,ht.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=rt(e.scrollbarSliderActiveBackground,ht.opacity(t.foreground,.5)),t.overviewRulerBorder=rt(e.overviewRulerBorder,bD),t.ansi=zt.slice(),t.ansi[0]=rt(e.black,zt[0]),t.ansi[1]=rt(e.red,zt[1]),t.ansi[2]=rt(e.green,zt[2]),t.ansi[3]=rt(e.yellow,zt[3]),t.ansi[4]=rt(e.blue,zt[4]),t.ansi[5]=rt(e.magenta,zt[5]),t.ansi[6]=rt(e.cyan,zt[6]),t.ansi[7]=rt(e.white,zt[7]),t.ansi[8]=rt(e.brightBlack,zt[8]),t.ansi[9]=rt(e.brightRed,zt[9]),t.ansi[10]=rt(e.brightGreen,zt[10]),t.ansi[11]=rt(e.brightYellow,zt[11]),t.ansi[12]=rt(e.brightBlue,zt[12]),t.ansi[13]=rt(e.brightMagenta,zt[13]),t.ansi[14]=rt(e.brightCyan,zt[14]),t.ansi[15]=rt(e.brightWhite,zt[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;nc.index-u.index),n=[];for(let c of r){let u=this._services.get(c.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);n.push(u)}let a=r.length>0?r[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},xD={trace:0,debug:1,info:2,warn:3,error:4,off:5},CD="xterm.js: ",Gm=class extends Be{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=xD[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;nthis._maxLength){let n=this._length+r.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let a=t-1;a>=0;a--)this.set(e+a+r,this.get(e+a));let n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,r){this._data[t*Ne+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*Ne+0]=t|2097152|r[2]<<22):this._data[t*Ne+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*Ne+0]>>22}hasWidth(t){return this._data[t*Ne+0]&12582912}getFg(t){return this._data[t*Ne+1]}getBg(t){return this._data[t*Ne+2]}hasContent(t){return this._data[t*Ne+0]&4194303}getCodePoint(t){let r=this._data[t*Ne+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*Ne+0]&2097152}getString(t){let r=this._data[t*Ne+0];return r&2097152?this._combined[t]:r&2097151?un(r&2097151):""}isProtected(t){return this._data[t*Ne+2]&536870912}loadCell(t,r){return lu=t*Ne,r.content=this._data[lu+0],r.fg=this._data[lu+1],r.bg=this._data[lu+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*Ne+0]=r.content,this._data[t*Ne+1]=r.fg,this._data[t*Ne+2]=r.bg}setCellFromCodepoint(t,r,n,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Ne+0]=r|n<<22,this._data[t*Ne+1]=a.fg,this._data[t*Ne+2]=a.bg}addCodepointToCell(t,r,n){let a=this._data[t*Ne+0];a&2097152?this._combined[t]+=un(r):a&2097151?(this._combined[t]=un(a&2097151)+un(r),a&=-2097152,a|=2097152):a=r|1<<22,n&&(a&=-12582913,a|=n<<22),this._data[t*Ne+0]=a}insertCells(t,r,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),r=0;--c)this.setCell(t+r+c,this.loadCell(t+c,a));for(let c=0;cthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let a=new Uint32Array(n);a.set(this._data),this._data=a}for(let a=this.length;a=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let u=0;u=t&&delete this._extendedAttrs[f]}}return this.length=t,n*4*Xf=0;--t)if(this._data[t*Ne+0]&4194303)return t+(this._data[t*Ne+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ne+0]&4194303||this._data[t*Ne+2]&50331648)return t+(this._data[t*Ne+0]>>22);return 0}copyCellsFrom(t,r,n,a,c){let u=t._data;if(c)for(let m=a-1;m>=0;m--){for(let d=0;d=r&&(this._combined[d-r+n]=t._combined[d])}}translateToString(t,r,n,a){r=r??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let c="";for(;r>22||1}return a&&a.push(r),c}};function ED(e,t,r,n,a,c){let u=[];for(let f=0;f=f&&n0&&(k>_||g[k].getTrimmedLength()===0);k--)C++;C>0&&(u.push(f+g.length-C),u.push(C)),f+=g.length-1}return u}function RD(e,t){let r=[],n=0,a=t[n],c=0;for(let u=0;uEl(e,d,t)).reduce((m,d)=>m+d),c=0,u=0,f=0;for(;fm&&(c-=m,u++);let d=e[u].getWidth(c-1)===2;d&&c--;let g=d?r-1:r;n.push(g),f+=g}return n}function El(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,a=e[t+1].getWidth(0)===2;return n&&a?r-1:r}var N1=class O1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=O1._nextId++,this._onDispose=this.register(new fe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Kn(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};N1._nextId=1;var AD=N1,Ht={},Wn=Ht.B;Ht[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ht.A={"#":"£"};Ht.B=void 0;Ht[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ht.C=Ht[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ht.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ht.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ht.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ht.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ht.E=Ht[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ht.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ht.H=Ht[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ht["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var hb=4294967295,db=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Mt.clone(),this.savedCharset=Wn,this.markers=[],this._nullCell=lr.fromCharData([0,XS,1,0]),this._whitespaceCell=lr.fromCharData([0,hn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Hu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ub(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Bu),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Bu),this._whitespaceCell}getBlankLine(e,t){return new pl(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&ehb?hb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Mt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new ub(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(Mt),n=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new pl(e,r)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let c=0;c.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,n=ED(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Mt),r);if(n.length>0){let a=RD(this.lines,n);kD(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let n=this.getNullCell(Mt),a=r;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;u--){let f=this.lines.get(u);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&u>0;)f=this.lines.get(--u),m.unshift(f);if(!r){let z=this.ybase+this.y;if(z>=u&&z0&&(a.push({start:u+m.length+c,newLines:w}),c+=w.length),m.push(...w);let x=g.length-1,C=g[x];C===0&&(x--,C=g[x]);let k=m.length-_-1,T=d;for(;k>=0;){let z=Math.min(T,C);if(m[x]===void 0)break;if(m[x].copyCellsFrom(m[k],T-z,C-z,z,!0),C-=z,C===0&&(x--,C=g[x]),T-=z,T===0){k--;let A=Math.max(k,0);T=El(m,A,this._cols)}}for(let z=0;z0;)this.ybase===0?this.y0){let u=[],f=[];for(let C=0;C=0;C--)if(_&&_.start>d+S){for(let k=_.newLines.length-1;k>=0;k--)this.lines.set(C--,_.newLines[k]);C++,u.push({index:d+1,amount:_.newLines.length}),S+=_.newLines.length,_=a[++g]}else this.lines.set(C,f[d--]);let w=0;for(let C=u.length-1;C>=0;C--)u[C].index+=w,this.lines.onInsertEmitter.fire(u[C]),w+=u[C].amount;let x=Math.max(0,m+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,r=0,n){let a=this.lines.get(e);return a?a.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.liner.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},DD=class extends Be{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new fe),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 db(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new db(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},B1=2,L1=1,Xm=class extends Be{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,B1),this.rows=Math.max(e.rawOptions.rows||0,L1),this.buffers=this._register(new DD(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let a=r.ybase+r.scrollTop,c=r.ybase+r.scrollBottom;if(r.scrollTop===0){let u=r.lines.isFull;c===r.lines.length-1?u?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(c+1,0,n.clone()),u?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let u=c-a+1;r.lines.shiftElements(a+1,u-1,-1),r.lines.set(c,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let n=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),n!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};Xm=xt([pe(0,gi)],Xm);var Wo={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ju,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},MD=["normal","bold","100","200","300","400","500","600","700","800","900"],ND=class extends Be{constructor(e){super(),this._onOptionChange=this._register(new fe),this.onOptionChange=this._onOptionChange.event;let t={...Wo};for(let r in e)if(r in t)try{let n=e[r];t[r]=this._sanitizeAndValidateOption(r,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ft(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in Wo))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,n)=>{if(!(r in Wo))throw new Error(`No option with key "${r}"`);n=this._sanitizeAndValidateOption(r,n),this.rawOptions[r]!==n&&(this.rawOptions[r]=n,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let n={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Wo[e]),!OD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Wo[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=MD.includes(t)?t:Wo[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function OD(e){return e==="block"||e==="underline"||e==="bar"}function _l(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let n in e)r[n]=t<=1?e[n]:e[n]&&_l(e[n],t-1);return r}var fb=Object.freeze({insertMode:!1}),mb=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Zm=class extends Be{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new fe),this.onData=this._onData.event,this._onUserInput=this._register(new fe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new fe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=_l(fb),this.decPrivateModes=_l(mb)}reset(){this.modes=_l(fb),this.decPrivateModes=_l(mb)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Zm=xt([pe(0,_i),pe(1,t1),pe(2,gi)],Zm);var pb={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Zf(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var Qf=String.fromCharCode,_b={DEFAULT:e=>{let t=[Zf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Qf(t[0])}${Qf(t[1])}${Qf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Zf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Zf(e,!0)};${e.x};${e.y}${t}`}},Qm=class extends Be{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new fe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(pb))this.addProtocol(n,pb[n]);for(let n of Object.keys(_b))this.addEncoding(n,_b[n]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let n=t/r,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=n+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Qm=xt([pe(0,_i),pe(1,eo),pe(2,gi)],Qm);var Jf=[[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]],BD=[[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]],jt;function LD(e,t){let r=0,n=t.length-1,a;if(et[n][1])return!1;for(;n>=r;)if(a=r+n>>1,e>t[a][1])r=a+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),n=r===0&&t!==0;if(n){let a=qn.extractWidth(t);a===0?n=!1:a>r&&(r=a)}return qn.createPropertyValue(0,r,n)}},qn=class Eu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new fe,this.onChange=this._onChange.event;let t=new zD;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,n=!1){return(t&16777215)<<3|(r&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,n=0,a=t.length;for(let c=0;c=a)return r+this.wcwidth(u);let d=t.charCodeAt(c);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:r+=this.wcwidth(d)}let f=this.charProperties(u,n),m=Eu.extractWidth(f);Eu.extractShouldJoin(f)&&(m-=Eu.extractWidth(n)),r+=m,n=f}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jD=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function gb(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var ll=2147483647,HD=256,z1=class Jm{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>HD)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new Jm;if(!t.length)return r;for(let n=Array.isArray(t[0])?1:0;n>8,a=this._subParamsIdx[r]&255;a-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ll?ll:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ll?ll:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-r>0?this._subParams.subarray(r,n):null}getSubParamsAll(){let t={};for(let r=0;r>8,a=this._subParamsIdx[r]&255;a-n>0&&(t[r]=this._subParams.slice(n,a))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,a=n[r-1];n[r-1]=~a?Math.min(a*10+t,ll):t}},cl=[],PD=class{constructor(){this._state=0,this._active=cl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=cl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=cl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||cl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",ih(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&r===!1){for(;n>=0&&(r=this._active[n].end(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=cl,this._id=-1,this._state=0}}},Ii=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,r,n){this._hitLimit||(this._data+=ih(t,r,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let r=!1;if(this._hitLimit)r=!1;else if(t&&(r=this._handler(this._data),r instanceof Promise))return r.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,r}},ul=[],UD=class{constructor(){this._handlers=Object.create(null),this._active=ul,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ul}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=ul,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ul,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",ih(e,t,r));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&r===!1){for(;n>=0&&(r=this._active[n].unhook(e),r!==!0);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}this._active=ul,this._ident=0}},gl=new z1;gl.addParam(0);var vb=class{constructor(e){this._handler=e,this._data="",this._params=gl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():gl,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=ih(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=gl,this._data="",this._hitLimit=!1,r));return this._params=gl,this._data="",this._hitLimit=!1,t}},ID=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let a=0;am),r=(f,m)=>t.slice(f,m),n=r(32,127),a=r(0,24);a.push(25),a.push.apply(a,r(28,32));let c=r(0,14),u;e.setDefault(1,0),e.addMany(n,0,2,0);for(u in c)e.addMany([24,26,153,154],u,3,0),e.addMany(r(128,144),u,3,0),e.addMany(r(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ar,0,2,0),e.add(ar,8,5,8),e.add(ar,6,0,6),e.add(ar,11,0,11),e.add(ar,13,13,13),e})(),FD=class extends Be{constructor(e=$D){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new z1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ft(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new PD),this._dcsParser=this._register(new UD),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;ac||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let n=this._escHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let n=this._csiHandlers[r];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=a}parse(e,t,r){let n=0,a=0,c=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(u=f[m](this._params),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(u=f[m](),u!==!0);m--)if(u instanceof Promise)return this._parseStack.handlerPos=m,u}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(n!==24&&n!==26,r),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],u=this._oscParser.end(n!==24&&n!==26,r),u)return u;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=c;f>4){case 2:for(let S=f+1;;++S){if(S>=t||(n=e[S])<32||n>126&&n=t||(n=e[S])<32||n>126&&n=t||(n=e[S])<32||n>126&&n=t||(n=e[S])<32||n>126&&n=0&&(u=m[d](this._params),u!==!0);d--)if(u instanceof Promise)return this._preserveStack(3,m,d,a,f),u;d<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++f47&&n<60);f--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let g=this._escHandlers[this._collect<<8|n],_=g?g.length-1:-1;for(;_>=0&&(u=g[_](),u!==!0);_--)if(u instanceof Promise)return this._preserveStack(4,g,_,a,f),u;_<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let S=f+1;;++S)if(S>=t||(n=e[S])===24||n===26||n===27||n>127&&n=t||(n=e[S])<32||n>127&&n>4:c>>8}return n}}function em(e,t){let r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function VD(e,t=16){let[r,n,a]=e;return`rgb:${em(r,t)}/${em(n,t)}/${em(a,t)}`}var YD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},an=131072,bb=10;function Sb(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var wb=5e3,xb=0,KD=class extends Be{constructor(e,t,r,n,a,c,u,f,m=new FD){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=a,this._oscLinkService=c,this._coreMouseService=u,this._unicodeService=f,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new fT,this._utf8Decoder=new mT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Mt.clone(),this._eraseAttrDataInternal=Mt.clone(),this._onRequestBell=this._register(new fe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new fe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new fe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new fe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new fe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new fe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new fe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new fe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new fe),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 ep(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:g.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:g,data:_})}),this._parser.setDcsHandlerFallback((d,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:g,payload:_})}),this._parser.setPrintHandler((d,g,_)=>this.print(d,g,_)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(oe.BEL,()=>this.bell()),this._parser.setExecuteHandler(oe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(oe.BS,()=>this.backspace()),this._parser.setExecuteHandler(oe.HT,()=>this.tab()),this._parser.setExecuteHandler(oe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(oe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(xu.IND,()=>this.index()),this._parser.setExecuteHandler(xu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(xu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ii(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Ii(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Ii(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Ii(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Ii(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Ii(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Ii(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Ii(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Ii(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Ii(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Ii(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Ii(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in Ht)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new vb((d,g)=>this.requestStatusString(d,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),wb))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${wb} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,a=this._activeBuffer.y,c=0,u=this._parseStack.paused;if(u){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>an&&(c=this._parseStack.position+an)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.lengthan)for(let d=c;d0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let S=this._parser.precedingJoinState;for(let w=t;wf){if(m){let T=_,$=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&_ instanceof pl&&_.copyCellsFrom(T,$,0,k,!1);$=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(_.insertCells(this._activeBuffer.x,a-k,this._activeBuffer.getNullCell(g)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,n,a,g),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=S,this._activeBuffer.x0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Sb(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new vb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ii(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,a=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),a),n&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+r)?.getTrimmedLength(););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let m=f;for(let d=1;d0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(oe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(oe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(oe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(oe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(oe.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(r||={});let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:c}=this._coreMouseService,u=this._coreService,{buffers:f,cols:m}=this._bufferService,{active:d,alt:g}=f,_=this._optionsService.rawOptions,S=(C,k)=>(u.triggerDataEvent(`${oe.ESC}[${t?"":"?"}${C};${k}$y`),!0),w=C=>C?1:2,x=e.params[0];return t?x===2?S(x,4):x===4?S(x,w(u.modes.insertMode)):x===12?S(x,3):x===20?S(x,w(_.convertEol)):S(x,0):x===1?S(x,w(n.applicationCursorKeys)):x===3?S(x,_.windowOptions.setWinLines?m===80?2:m===132?1:0:0):x===6?S(x,w(n.origin)):x===7?S(x,w(n.wraparound)):x===8?S(x,3):x===9?S(x,w(a==="X10")):x===12?S(x,w(_.cursorBlink)):x===25?S(x,w(!u.isCursorHidden)):x===45?S(x,w(n.reverseWraparound)):x===66?S(x,w(n.applicationKeypad)):x===67?S(x,4):x===1e3?S(x,w(a==="VT200")):x===1002?S(x,w(a==="DRAG")):x===1003?S(x,w(a==="ANY")):x===1004?S(x,w(n.sendFocus)):x===1005?S(x,4):x===1006?S(x,w(c==="SGR")):x===1015?S(x,4):x===1016?S(x,w(c==="SGR_PIXELS")):x===1048?S(x,1):x===47||x===1047||x===1049?S(x,w(d===g)):x===2004?S(x,w(n.bracketedPasteMode)):x===2026?S(x,w(n.synchronizedOutput)):S(x,0)}_updateAttrColor(e,t,r,n,a){return t===2?(e|=50331648,e&=-16777216,e|=Dl.fromColorRGB([r,n,a])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let n=[0,0,-1,0,0,0],a=0,c=0;do{if(n[c+a]=e.params[t+c],e.hasSubParams(t+c)){let u=e.getSubParams(t+c),f=0;do n[1]===5&&(a=1),n[c+f+1+a]=u[f];while(++f=2||n[1]===2&&c+a>=5)break;n[1]&&(a=1)}while(++c+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Mt.fg,e.bg=Mt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,n=this._curAttrData;for(let a=0;a=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777216|r-90|8):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777216|r-100|8):r===0?this._processSGR0(n):r===1?n.fg|=134217728:r===3?n.bg|=67108864:r===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,n)):r===5?n.fg|=536870912:r===7?n.fg|=67108864:r===8?n.fg|=1073741824:r===9?n.fg|=2147483648:r===2?n.bg|=134217728:r===21?this._processUnderline(2,n):r===22?(n.fg&=-134217729,n.bg&=-134217729):r===23?n.bg&=-67108865:r===24?(n.fg&=-268435457,this._processUnderline(0,n)):r===25?n.fg&=-536870913:r===27?n.fg&=-67108865:r===28?n.fg&=-1073741825:r===29?n.fg&=2147483647:r===39?(n.fg&=-67108864,n.fg|=Mt.fg&16777215):r===49?(n.bg&=-67108864,n.bg|=Mt.bg&16777215):r===38||r===48||r===58?a+=this._extractColor(e,a,n):r===53?n.bg|=1073741824:r===55?n.bg&=-1073741825:r===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):r===100?(n.fg&=-67108864,n.fg|=Mt.fg&16777215,n.bg&=-67108864,n.bg|=Mt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${oe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${oe.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${oe.ESC}[?${t};${r}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Mt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Sb(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${oe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>bb&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>bb&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let n=r.shift(),a=r.shift();if(/^\d+$/.exec(n)){let c=parseInt(n);if(Cb(c))if(a==="?")t.push({type:0,index:c});else{let u=yb(a);u&&t.push({type:1,index:c,color:u})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(r,n):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),n,a=r.findIndex(c=>c.startsWith("id="));return a!==-1&&(n=r[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let n=0;n=this._specialColors.length);++n,++t)if(r[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=yb(r[n]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let n=0;n=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Mt.clone(),this._eraseAttrDataInternal=Mt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new lr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${oe.ESC}${u}${oe.ESC}\\`),!0),n=this._bufferService.buffer,a=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ep=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(xb=e,e=t,t=xb),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ep=xt([pe(0,_i)],ep);function Cb(e){return 0<=e&&e<256}var GD=5e7,Eb=12,XD=50,ZD=class extends Be{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new fe),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>GD)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],a=this._action(n,t);if(a){let u=f=>performance.now()-r>=Eb?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(r,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(u);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-r>=Eb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>XD&&(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()}},tp=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(m,f)),this._dataByLinkId.set(m.id,m),m.id}let r=e,n=this._getEntryIdKey(r),a=this._entriesWithId.get(n);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let c=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(u,c)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);r.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(r,n))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};tp=xt([pe(0,_i)],tp);var Rb=!1,QD=class extends Be{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ra),this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onData=this._register(new fe),this.onData=this._onData.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new fe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new fe),this._instantiationService=new wD,this.optionsService=this._register(new ND(e)),this._instantiationService.setService(gi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Xm)),this._instantiationService.setService(_i,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Gm)),this._instantiationService.setService(t1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Zm)),this._instantiationService.setService(eo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Qm)),this._instantiationService.setService(e1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(qn)),this._instantiationService.setService(vT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(jD),this._instantiationService.setService(gT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tp),this._instantiationService.setService(i1,this._oscLinkService),this._inputHandler=this._register(new KD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ai.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ai.forward(this._bufferService.onResize,this._onResize)),this._register(ai.forward(this.coreService.onData,this._onData)),this._register(ai.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new ZD((t,r)=>this._inputHandler.parse(t,r))),this._register(ai.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new fe),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Rb&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Rb=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,B1),t=Math.max(t,L1),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(gb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(gb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ft(()=>{for(let t of e)t.dispose()})}}},JD={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function e5(e,t,r,n){let a={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=oe.ESC+"OA":a.key=oe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=oe.ESC+"OD":a.key=oe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=oe.ESC+"OC":a.key=oe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=oe.ESC+"OB":a.key=oe.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":oe.DEL,e.altKey&&(a.key=oe.ESC+a.key);break;case 9:if(e.shiftKey){a.key=oe.ESC+"[Z";break}a.key=oe.HT,a.cancel=!0;break;case 13:a.key=e.altKey?oe.ESC+oe.CR:oe.CR,a.cancel=!0;break;case 27:a.key=oe.ESC,e.altKey&&(a.key=oe.ESC+oe.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;c?a.key=oe.ESC+"[1;"+(c+1)+"D":t?a.key=oe.ESC+"OD":a.key=oe.ESC+"[D";break;case 39:if(e.metaKey)break;c?a.key=oe.ESC+"[1;"+(c+1)+"C":t?a.key=oe.ESC+"OC":a.key=oe.ESC+"[C";break;case 38:if(e.metaKey)break;c?a.key=oe.ESC+"[1;"+(c+1)+"A":t?a.key=oe.ESC+"OA":a.key=oe.ESC+"[A";break;case 40:if(e.metaKey)break;c?a.key=oe.ESC+"[1;"+(c+1)+"B":t?a.key=oe.ESC+"OB":a.key=oe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=oe.ESC+"[2~");break;case 46:c?a.key=oe.ESC+"[3;"+(c+1)+"~":a.key=oe.ESC+"[3~";break;case 36:c?a.key=oe.ESC+"[1;"+(c+1)+"H":t?a.key=oe.ESC+"OH":a.key=oe.ESC+"[H";break;case 35:c?a.key=oe.ESC+"[1;"+(c+1)+"F":t?a.key=oe.ESC+"OF":a.key=oe.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=oe.ESC+"[5;"+(c+1)+"~":a.key=oe.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=oe.ESC+"[6;"+(c+1)+"~":a.key=oe.ESC+"[6~";break;case 112:c?a.key=oe.ESC+"[1;"+(c+1)+"P":a.key=oe.ESC+"OP";break;case 113:c?a.key=oe.ESC+"[1;"+(c+1)+"Q":a.key=oe.ESC+"OQ";break;case 114:c?a.key=oe.ESC+"[1;"+(c+1)+"R":a.key=oe.ESC+"OR";break;case 115:c?a.key=oe.ESC+"[1;"+(c+1)+"S":a.key=oe.ESC+"OS";break;case 116:c?a.key=oe.ESC+"[15;"+(c+1)+"~":a.key=oe.ESC+"[15~";break;case 117:c?a.key=oe.ESC+"[17;"+(c+1)+"~":a.key=oe.ESC+"[17~";break;case 118:c?a.key=oe.ESC+"[18;"+(c+1)+"~":a.key=oe.ESC+"[18~";break;case 119:c?a.key=oe.ESC+"[19;"+(c+1)+"~":a.key=oe.ESC+"[19~";break;case 120:c?a.key=oe.ESC+"[20;"+(c+1)+"~":a.key=oe.ESC+"[20~";break;case 121:c?a.key=oe.ESC+"[21;"+(c+1)+"~":a.key=oe.ESC+"[21~";break;case 122:c?a.key=oe.ESC+"[23;"+(c+1)+"~":a.key=oe.ESC+"[23~";break;case 123:c?a.key=oe.ESC+"[24;"+(c+1)+"~":a.key=oe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=oe.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=oe.DEL:e.keyCode===219?a.key=oe.ESC:e.keyCode===220?a.key=oe.FS:e.keyCode===221&&(a.key=oe.GS);else if((!r||n)&&e.altKey&&!e.metaKey){let u=JD[e.keyCode]?.[e.shiftKey?1:0];if(u)a.key=oe.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(f);e.shiftKey&&(m=m.toUpperCase()),a.key=oe.ESC+m}else if(e.keyCode===32)a.key=oe.ESC+(e.ctrlKey?oe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),a.key=oe.ESC+f,a.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=oe.US),e.key==="@"&&(a.key=oe.NUL));break}return a}var Rt=0,t5=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Hu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Hu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,c)=>this._getKey(a)-this._getKey(c)),t=0,r=0,n=new Array(this._array.length+this._insertedValues.length);for(let a=0;a=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(n[a]=e[t],t++):n[a]=this._array[r++];this._array=n,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Rt=this._search(t),Rt===-1)||this._getKey(this._array[Rt])!==t)return!1;do if(this._array[Rt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Rt),!0;while(++Rta-c),t=0,r=new Array(this._array.length-e.length),n=0;for(let a=0;a0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Rt=this._search(e),!(Rt<0||Rt>=this._array.length)&&this._getKey(this._array[Rt])===e))do yield this._array[Rt];while(++Rt=this._array.length)&&this._getKey(this._array[Rt])===e))do t(this._array[Rt]);while(++Rt=t;){let n=t+r>>1,a=this._getKey(this._array[n]);if(a>e)r=n-1;else if(a0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},tm=0,kb=0,i5=class extends Be{constructor(){super(),this._decorations=new t5(e=>e?.marker.line),this._onDecorationRegistered=this._register(new fe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new fe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ft(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new r5(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let n=0,a=0;for(let c of this._decorations.getKeyIterator(t))n=c.options.x??0,a=n+(c.options.width??1),e>=n&&e{tm=a.options.x??0,kb=tm+(a.options.width??1),e>=tm&&e=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=n-this._lastRefreshMs,c=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Tb=20,Pu=class extends Be{constructor(e,t,r,n){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;cthis._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new n5(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(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ee(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ft(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Tb+1&&(this._liveRegion.textContent+=Sm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,n=r.lines.length.toString();for(let a=e;a<=t;a++){let c=r.lines.get(r.ydisp+a),u=[],f=c?.translateToString(!0,void 0,void 0,u)||"",m=(r.ydisp+a+1).toString(),d=this._rowElements[a];d&&(f.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=f,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",m),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],a=r.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===c||e.relatedTarget!==n)return;let u,f;if(t===0?(u=r,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(u=this._rowElements.shift(),f=r,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let n=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let a=({node:f,offset:m})=>{let d=f instanceof Text?f.parentNode:f,g=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(d);if(!_)return console.warn("columns is null. Race condition?"),null;let S=m<_.length?_[m]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++g,S=0),{row:g,column:S}},c=a(t),u=a(r);if(!(!c||!u)){if(c.row>u.row||c.row===u.row&&c.column>=u.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(u.row-c.row)*this._terminal.cols-c.column+u.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;te;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{Kn(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ee(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ee(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ee(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ee(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let n=0;n{n?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[n,a]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(n)&&(r=this._checkLinkProviderResult(n,e,r)):a.provideLinks(e.y,c=>{if(this._isMouseOut)return;let u=c?.map(f=>({link:f}));this._activeProviderReplies?.set(n,u),r=this._checkLinkProviderResult(n,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let n=0;ne?this._bufferService.cols:u.link.range.end.x;for(let d=f;d<=m;d++){if(r.has(d)){a.splice(c--,1);break}r.add(d)}}}}_checkLinkProviderResult(e,t,r){if(!this._activeProviderReplies)return r;let n=this._activeProviderReplies.get(e),a=!1;for(let c=0;cthis._linkAtPosition(u.link,t));c&&(r=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let c=0;cthis._linkAtPosition(f.link,t));if(u){r=!0,this._handleNewLink(u);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&o5(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Kn(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let n=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(n,a),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,n=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,r){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return r<=a&&a<=n}_positionFromMouseEvent(e,t,r){let n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,a){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:a}}};ip=xt([pe(1,Np),pe(2,As),pe(3,_i),pe(4,s1)],ip);function o5(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var a5=class extends QD{constructor(e={}){super(e),this._linkifier=this._register(new ra),this.browser=x1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ra),this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new fe),this.onKey=this._onKey.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new fe),this.onBell=this._onBell.event,this._onFocus=this._register(new fe),this._onBlur=this._register(new fe),this._onA11yCharEmitter=this._register(new fe),this._onA11yTabEmitter=this._register(new fe),this._onWillOpen=this._register(new fe),this._setup(),this._decorationService=this._instantiationService.createInstance(i5),this._instantiationService.setService(Ml,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(XA),this._instantiationService.setService(s1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(xm)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ai.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ai.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ai.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ai.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ft(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,n="";switch(t.index){case 256:r="foreground",n="10";break;case 257:r="background",n="11";break;case 258:r="cursor",n="12";break;default:r="ansi",n="4;"+t.index}switch(t.type){case 0:let a=ht.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${oe.ESC}]${n};${VD(a)}${S1.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Nt.toColor(...t.color));else{let c=r;this._themeService.modifyColors(u=>u[c]=Nt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Pu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(oe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(oe.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,a=t.getWidth(r),c=this._renderService.dimensions.css.cell.width*a,u=this.buffer.y*this._renderService.dimensions.css.cell.height,f=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=u+"px",this.textarea.style.width=c+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ee(this.element,"copy",t=>{this.hasSelection()&&hT(t,this._selectionService)}));let e=t=>dT(t,this.textarea,this.coreService,this.optionsService);this._register(Ee(this.textarea,"paste",e)),this._register(Ee(this.element,"paste",e)),C1?this._register(Ee(this.element,"mousedown",t=>{t.button===2&&Hy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ee(this.element,"contextmenu",t=>{Hy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Up&&this._register(Ee(this.element,"auxclick",t=>{t.button===1&&GS(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ee(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ee(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ee(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ee(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ee(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ee(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ee(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ee(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",bm.get()),k1||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(KA,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ts,this._coreBrowserService),this._register(Ee(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Ee(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wm,this._document,this._helperContainer),this._instantiationService.setService(rh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Km),this._instantiationService.setService(aa,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(zu),this._instantiationService.setService(r1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Vm,this.rows,this.screenElement)),this._instantiationService.setService(As,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Im,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(qm),this._instantiationService.setService(Np,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(ip,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Pm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Ym,this.element,this.screenElement,n)),this._instantiationService.setService(bT,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(ai.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Um,this.screenElement)),this._register(Ee(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Pu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Fm,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(c){let u=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!u)return!1;let f,m;switch(c.overrideType||c.type){case"mousemove":m=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":m=0,f=c.button<3?c.button:3;break;case"mousedown":m=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let d=c.deltaY;if(d===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=d<0?0:1,f=4;break;default:return!1}return m===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:f,action:m,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:c=>(r(c),c.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(c)),wheel:c=>(r(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&r(c)},mousemove:c=>{c.buttons||r(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?n.mousemove||(t.addEventListener("mousemove",a.mousemove),n.mousemove=a.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),c&16?n.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),n.wheel=a.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),c&2?n.mouseup||(n.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),c&4?n.mousedrag||(n.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ee(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return r(c),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(c)})),this._register(Ee(t,"wheel",c=>{if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let u=oe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){KS(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=e5(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let n=this.rows-1;return this.scrollLines(r.type===2?-n:n),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===oe.ETX||r.key===oe.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(l5(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new lr)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Ab=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new u5(t)}getNullCell(){return new lr}},h5=class extends Be{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new fe),this.onBufferChange=this._onBufferChange.event,this._normal=new Ab(this._core.buffers.normal,"normal"),this._alternate=new Ab(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)}},d5=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,n)=>t(r,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},f5=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},m5=["cols","rows"],Mr=0,j1=class extends Be{constructor(e){super(),this._core=this._register(new a5(e)),this._addonManager=this._register(new c5),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],r=(n,a)=>{this._checkReadonlyOptions(n),this._core.options[n]=a};for(let n in this._core.options){let a={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,a)}}_checkReadonlyOptions(e){if(m5.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new d5(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new f5(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 h5(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r +`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return bm.get()},set promptLabel(e){bm.set(e)},get tooMuchOutput(){return Sm.get()},set tooMuchOutput(e){Sm.set(e)}}}_verifyIntegers(...e){for(Mr of e)if(Mr===1/0||isNaN(Mr)||Mr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Mr of e)if(Mr&&(Mr===1/0||isNaN(Mr)||Mr%1!==0||Mr<0))throw new Error("This API only accepts positive integers")}};var p5=2,_5=1,H1=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,r=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(r.getPropertyValue("height")),a=Math.max(0,parseInt(r.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),u={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=u.top+u.bottom,m=u.right+u.left,d=n-f,g=a-m-t;return{cols:Math.max(p5,Math.floor(g/e.css.cell.width)),rows:Math.max(_5,Math.floor(d/e.css.cell.height))}}};var g5=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Db.isErrorNoTelemetry(t)?new Db(t.message+` + +`+t.stack):new Error(t.message+` + +`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(r=>{r(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},v5=new g5;function im(e){y5(e)||v5.onUnexpectedError(e)}var rp="Canceled";function y5(e){return e instanceof b5?!0:e instanceof Error&&e.name===rp&&e.message===rp}var b5=class extends Error{constructor(){super(rp),this.name=this.message}},Db=class sp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof sp)return t;let r=new sp;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},S5;(e=>{function t(c){return c<0}e.isLessThan=t;function r(c){return c<=0}e.isLessThanOrEqual=r;function n(c){return c>0}e.isGreaterThan=n;function a(c){return c===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(S5||={});function w5(e,t){let r=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(r,arguments))),a}}var P1;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function n(){return r}e.empty=n;function*a(A){yield A}e.single=a;function c(A){return t(A)?A:a(A)}e.wrap=c;function u(A){return A||r}e.from=u;function*f(A){for(let j=A.length-1;j>=0;j--)yield A[j]}e.reverse=f;function m(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=m;function d(A){return A[Symbol.iterator]().next().value}e.first=d;function g(A,j){let P=0;for(let F of A)if(j(F,P++))return!0;return!1}e.some=g;function _(A,j){for(let P of A)if(j(P))return P}e.find=_;function*S(A,j){for(let P of A)j(P)&&(yield P)}e.filter=S;function*w(A,j){let P=0;for(let F of A)yield j(F,P++)}e.map=w;function*x(A,j){let P=0;for(let F of A)yield*j(F,P++)}e.flatMap=x;function*C(...A){for(let j of A)yield*j}e.concat=C;function k(A,j,P){let F=P;for(let G of A)F=j(F,G);return F}e.reduce=k;function*T(A,j,P=A.length){for(j<0&&(j+=A.length),P<0?P+=A.length:P>A.length&&(P=A.length);j1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function U1(...e){return ca(()=>Sl(e))}function ca(e){return{dispose:w5(()=>{e()})}}var I1=class $1{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Sl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?$1.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};I1.DISABLE_DISPOSED_WARNING=!1;var Ip=I1,mn=class{constructor(){this._store=new Ip,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};mn.None=Object.freeze({dispose(){}});var Uu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},x5=globalThis.performance&&typeof globalThis.performance.now=="function",C5=class F1{static create(t){return new F1(t)}constructor(t){this._now=x5&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},$p;(e=>{e.None=()=>mn.None;function t(W,M){return _(W,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function r(W){return(M,H=null,N)=>{let R=!1,L;return L=W(U=>{if(!R)return L?L.dispose():R=!0,M.call(H,U)},null,N),R&&L.dispose(),L}}e.once=r;function n(W,M,H){return d((N,R=null,L)=>W(U=>N.call(R,M(U)),null,L),H)}e.map=n;function a(W,M,H){return d((N,R=null,L)=>W(U=>{M(U),N.call(R,U)},null,L),H)}e.forEach=a;function c(W,M,H){return d((N,R=null,L)=>W(U=>M(U)&&N.call(R,U),null,L),H)}e.filter=c;function u(W){return W}e.signal=u;function f(...W){return(M,H=null,N)=>{let R=U1(...W.map(L=>L(U=>M.call(H,U))));return g(R,N)}}e.any=f;function m(W,M,H,N){let R=H;return n(W,L=>(R=M(R,L),R),N)}e.reduce=m;function d(W,M){let H,N={onWillAddFirstListener(){H=W(R.fire,R)},onDidRemoveLastListener(){H?.dispose()}},R=new Br(N);return M?.add(R),R.event}function g(W,M){return M instanceof Array?M.push(W):M&&M.add(W),W}function _(W,M,H=100,N=!1,R=!1,L,U){let se,ee,D,O=0,q,Q={leakWarningThreshold:L,onWillAddFirstListener(){se=W(ae=>{O++,ee=M(ee,ae),N&&!D&&(X.fire(ee),ee=void 0),q=()=>{let de=ee;ee=void 0,D=void 0,(!N||O>1)&&X.fire(de),O=0},typeof H=="number"?(clearTimeout(D),D=setTimeout(q,H)):D===void 0&&(D=0,queueMicrotask(q))})},onWillRemoveListener(){R&&O>0&&q?.()},onDidRemoveLastListener(){q=void 0,se.dispose()}},X=new Br(Q);return U?.add(X),X.event}e.debounce=_;function S(W,M=0,H){return e.debounce(W,(N,R)=>N?(N.push(R),N):[R],M,void 0,!0,void 0,H)}e.accumulate=S;function w(W,M=(N,R)=>N===R,H){let N=!0,R;return c(W,L=>{let U=N||!M(L,R);return N=!1,R=L,U},H)}e.latch=w;function x(W,M,H){return[e.filter(W,M,H),e.filter(W,N=>!M(N),H)]}e.split=x;function C(W,M=!1,H=[],N){let R=H.slice(),L=W(ee=>{R?R.push(ee):se.fire(ee)});N&&N.add(L);let U=()=>{R?.forEach(ee=>se.fire(ee)),R=null},se=new Br({onWillAddFirstListener(){L||(L=W(ee=>se.fire(ee)),N&&N.add(L))},onDidAddFirstListener(){R&&(M?setTimeout(U):U())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return N&&N.add(se),se.event}e.buffer=C;function k(W,M){return(H,N,R)=>{let L=M(new $);return W(function(U){let se=L.evaluate(U);se!==T&&H.call(N,se)},void 0,R)}}e.chain=k;let T=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(H=>(M(H),H)),this}filter(M){return this.steps.push(H=>M(H)?H:T),this}reduce(M,H){let N=H;return this.steps.push(R=>(N=M(N,R),N)),this}latch(M=(H,N)=>H===N){let H=!0,N;return this.steps.push(R=>{let L=H||!M(R,N);return H=!1,N=R,L?R:T}),this}evaluate(M){for(let H of this.steps)if(M=H(M),M===T)break;return M}}function z(W,M,H=N=>N){let N=(...se)=>U.fire(H(...se)),R=()=>W.on(M,N),L=()=>W.removeListener(M,N),U=new Br({onWillAddFirstListener:R,onDidRemoveLastListener:L});return U.event}e.fromNodeEventEmitter=z;function A(W,M,H=N=>N){let N=(...se)=>U.fire(H(...se)),R=()=>W.addEventListener(M,N),L=()=>W.removeEventListener(M,N),U=new Br({onWillAddFirstListener:R,onDidRemoveLastListener:L});return U.event}e.fromDOMEventEmitter=A;function j(W){return new Promise(M=>r(W)(M))}e.toPromise=j;function P(W){let M=new Br;return W.then(H=>{M.fire(H)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=P;function F(W,M){return W(H=>M.fire(H))}e.forward=F;function G(W,M,H){return M(H),W(N=>M(N))}e.runAndSubscribe=G;class re{constructor(M,H){this._observable=M,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new Br(N),H&&H.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,H){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(W,M){return new re(W,M).emitter.event}e.fromObservable=le;function ce(W){return(M,H,N)=>{let R=0,L=!1,U={beginUpdate(){R++},endUpdate(){R--,R===0&&(W.reportChanges(),L&&(L=!1,M.call(H)))},handlePossibleChange(){},handleChange(){L=!0}};W.addObserver(U),W.reportChanges();let se={dispose(){W.removeObserver(U)}};return N instanceof Ip?N.add(se):Array.isArray(N)&&N.push(se),se}}e.fromObservableLight=ce})($p||={});var np=class op{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${op._idPool++}`,op.all.add(this)}start(t){this._stopWatch=new C5,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};np.all=new Set,np._idPool=0;var E5=np,R5=-1,W1=class q1{constructor(t,r,n=(q1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,r){let n=this.threshold;if(n<=0||r{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[n,a]of this._stacks)(!t||r{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new D5(`${u}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||im)(m),mn.None}if(this._disposed)return mn.None;t&&(e=e.bind(t));let n=new rm(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=T5.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof rm?(this._deliveryQueue??=new B5,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=ca(()=>{a?.(),this._removeListener(n)});return r instanceof Ip?r.add(c):Array.isArray(r)&&r.push(c),c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let n=this._deliveryQueue.current===this;if(this._size*N5<=t.length){let a=0;for(let c=0;c0}},B5=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Y1=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),L5;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof z5?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$p.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Y1})})(L5||={});var z5=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Y1:(this._emitter||(this._emitter=new Br),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Jo="en",sm=!1,cu,Ru=Jo,Mb=Jo,j5,bs,Yn=globalThis,Fi;typeof Yn.vscode<"u"&&typeof Yn.vscode.process<"u"?Fi=Yn.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Fi=process);var H5=typeof Fi?.versions?.electron=="string",P5=H5&&Fi?.type==="renderer";if(typeof Fi=="object"){Fi.platform,Fi.platform,sm=Fi.platform==="linux",sm&&Fi.env.SNAP&&Fi.env.SNAP_REVISION,Fi.env.CI||Fi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,cu=Jo,Ru=Jo;let e=Fi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);cu=t.userLocale,Mb=t.osLocale,Ru=t.resolvedLanguage||Jo,j5=t.languagePack?.translationsConfigFile}catch{}}else typeof navigator=="object"&&!P5?(bs=navigator.userAgent,bs.indexOf("Windows")>=0,bs.indexOf("Macintosh")>=0,(bs.indexOf("Macintosh")>=0||bs.indexOf("iPad")>=0||bs.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,sm=bs.indexOf("Linux")>=0,bs?.indexOf("Mobi")>=0,Ru=globalThis._VSCODE_NLS_LANGUAGE||Jo,cu=navigator.language.toLowerCase(),Mb=cu):console.error("Unable to resolve platform.");var Fr=bs,ln=Ru,U5;(e=>{function t(){return ln}e.value=t;function r(){return ln.length===2?ln==="en":ln.length>=3?ln[0]==="e"&&ln[1]==="n"&&ln[2]==="-":!1}e.isDefaultVariant=r;function n(){return ln==="en"}e.isDefault=n})(U5||={});var I5=typeof Yn.postMessage=="function"&&!Yn.importScripts;(()=>{if(I5){let e=[];Yn.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,a=e.length;n{let n=++t;e.push({id:n,callback:r}),Yn.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var $5=!!(Fr&&Fr.indexOf("Chrome")>=0);Fr&&Fr.indexOf("Firefox")>=0;!$5&&Fr&&Fr.indexOf("Safari")>=0;Fr&&Fr.indexOf("Edg/")>=0;Fr&&Fr.indexOf("Android")>=0;function K1(e,t=0,r){let n=setTimeout(()=>{e()},t);return ca(()=>{clearTimeout(n)})}var F5;(e=>{async function t(n){let a,c=await Promise.all(n.map(u=>u.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return c}e.settled=t;function r(n){return new Promise(async(a,c)=>{try{await n(a,c)}catch(u){c(u)}})}e.withAsyncBody=r})(F5||={});var Nb=class nr{static fromArray(t){return new nr(r=>{r.emitMany(t)})}static fromPromise(t){return new nr(async r=>{r.emitMany(await t)})}static fromPromises(t){return new nr(async r=>{await Promise.all(t.map(async n=>r.emitOne(await n)))})}static merge(t){return new nr(async r=>{await Promise.all(t.map(async n=>{for await(let a of n)r.emitOne(a)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Br,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,r){return new nr(async n=>{for await(let a of t)n.emitOne(r(a))})}map(t){return nr.map(this,t)}static filter(t,r){return new nr(async n=>{for await(let a of t)r(a)&&n.emitOne(a)})}filter(t){return nr.filter(this,t)}static coalesce(t){return nr.filter(t,r=>!!r)}coalesce(){return nr.coalesce(this)}static async toPromise(t){let r=[];for await(let n of t)r.push(n);return r}toPromise(){return nr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Nb.EMPTY=Nb.fromArray([]);var W5=class extends mn{constructor(t){super(),this._terminal=t,this._linesCacheTimeout=this._register(new Uu),this._linesCacheDisposables=this._register(new Uu),this._register(ca(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=U1(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=K1(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(t){return this._linesCache?.[t]}setLineInCache(t,r){this._linesCache&&(this._linesCache[t]=r)}translateBufferLineToStringWithWrap(t,r){let n=[],a=[0],c=this._terminal.buffer.active.getLine(t);for(;c;){let u=this._terminal.buffer.active.getLine(t+1),f=u?u.isWrapped:!1,m=c.translateToString(!f&&r);if(f&&u){let d=c.getCell(c.length-1);d&&d.getCode()===0&&d.getWidth()===1&&u.getCell(0)?.getWidth()===2&&(m=m.slice(0,-1))}if(n.push(m),f)a.push(a[a.length-1]+m.length);else break;t++,c=u}return[n.join(""),a]}},q5=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(t){this._cachedSearchTerm=t}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(t){this._lastSearchOptions=t}isValidSearchTerm(t){return!!(t&&t.length>0)}didOptionsChange(t){return this._lastSearchOptions?t?this._lastSearchOptions.caseSensitive!==t.caseSensitive||this._lastSearchOptions.regex!==t.regex||this._lastSearchOptions.wholeWord!==t.wholeWord:!1:!0}shouldUpdateHighlighting(t,r){return r?.decorations?this._cachedSearchTerm===void 0||t!==this._cachedSearchTerm||this.didOptionsChange(r):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},V5=class{constructor(t,r){this._terminal=t,this._lineCache=r}find(t,r,n,a){if(!t||t.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw new Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let c={startRow:r,startCol:n},u=this._findInLine(t,c,a);if(!u)for(let f=r+1;f=0&&(m.startRow=g,d=this._findInLine(t,m,r,f),!d);g--);}if(!d&&c!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let g=this._terminal.buffer.active.baseY+this._terminal.rows-1;g>=c&&(m.startRow=g,d=this._findInLine(t,m,r,f),!d);g--);return d}_isWholeWord(t,r,n){return(t===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t-1]))&&(t+n.length===r.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(r[t+n.length]))}_findInLine(t,r,n={},a=!1){let c=r.startRow,u=r.startCol;if(this._terminal.buffer.active.getLine(c)?.isWrapped){if(a){r.startCol+=this._terminal.cols;return}return r.startRow--,r.startCol+=this._terminal.cols,this._findInLine(t,r,n)}let f=this._lineCache.getLineFromCache(c);f||(f=this._lineCache.translateBufferLineToStringWithWrap(c,!0),this._lineCache.setLineInCache(c,f));let[m,d]=f,g=this._bufferColsToStringOffset(c,u),_=t,S=m;n.regex||(_=n.caseSensitive?t:t.toLowerCase(),S=n.caseSensitive?m:m.toLowerCase());let w=-1;if(n.regex){let x=RegExp(_,n.caseSensitive?"g":"gi"),C;if(a)for(;C=x.exec(S.slice(0,g));)w=x.lastIndex-C[0].length,t=C[0],x.lastIndex-=t.length-1;else C=x.exec(S.slice(g)),C&&C[0].length>0&&(w=g+(x.lastIndex-C[0].length),t=C[0])}else a?g-_.length>=0&&(w=S.lastIndexOf(_,g-_.length)):w=S.indexOf(_,g);if(w>=0){if(n.wholeWord&&!this._isWholeWord(w,S,t))return;let x=0;for(;x=d[x+1];)x++;let C=x;for(;C=d[C+1];)C++;let k=w-d[x],T=w+t.length-d[C],$=this._stringLengthToBufferSize(c+x,k),z=this._stringLengthToBufferSize(c+C,T)-$+this._terminal.cols*(C-x);return{term:t,col:$,row:c+x,size:z}}}_stringLengthToBufferSize(t,r){let n=this._terminal.buffer.active.getLine(t);if(!n)return 0;for(let a=0;a1&&(r-=u.length-1);let f=n.getCell(a+1);f&&f.getWidth()===0&&r++}return r}_bufferColsToStringOffset(t,r){let n=t,a=0,c=this._terminal.buffer.active.getLine(n);for(;r>0&&c;){for(let u=0;uthis.clearHighlightDecorations()))}createHighlightDecorations(t,r){this.clearHighlightDecorations();for(let n of t){let a=this._createResultDecorations(n,r,!1);if(a)for(let c of a)this._storeDecoration(c,n)}}createActiveDecoration(t,r){let n=this._createResultDecorations(t,r,!0);if(n)return{decorations:n,match:t,dispose(){Sl(n)}}}clearHighlightDecorations(){Sl(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,r){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:r,dispose(){t.dispose()}})}_applyStyles(t,r,n){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),r&&(t.style.outline=`1px solid ${r}`)),n&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,r,n){let a=[],c=t.col,u=t.size,f=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;u>0;){let d=Math.min(this._terminal.cols-c,u);a.push([f,c,d]),c=0,u-=d,f++}let m=[];for(let d of a){let g=this._terminal.registerMarker(d[0]),_=this._terminal.registerDecoration({marker:g,x:d[1],width:d[2],backgroundColor:n?r.activeMatchBackground:r.matchBackground,overviewRulerOptions:this._highlightedLines.has(g.line)?void 0:{color:n?r.activeMatchColorOverviewRuler:r.matchOverviewRuler,position:"center"}});if(_){let S=[];S.push(g),S.push(_.onRender(w=>this._applyStyles(w,n?r.activeMatchBorder:r.matchBorder,!1))),S.push(_.onDispose(()=>Sl(S))),m.push(_)}}return m.length===0?void 0:m}},K5=class extends mn{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new Br)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,r){this._searchResults=t.slice(0,r)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let r=0;rthis._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(ca(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=K1(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findNextAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let r=[],n,a=this._engine.find(e,0,0,t);for(;a&&(n?.row!==a.row||n?.col!==a.col)&&!(r.length>=this._highlightLimit);)n=a,r.push(n),a=this._engine.find(e,n.col+n.term.length>=this._terminal.cols?n.row+1:n.row,n.col+n.term.length>=this._terminal.cols?0:n.col+1,t);this._resultTracker.updateResults(r,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(r,t.decorations)}_findNextAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,r?.noScroll)}findPrevious(e,t,r){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let n=this._findPreviousAndSelect(e,t,r);return this._fireResults(t),this._state.cachedSearchTerm=e,n}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,r){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let n=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(n,t?.decorations,r?.noScroll)}_selectResult(e,t,r){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!r&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row{function t(a,c,u,f){return f!==void 0?`#${$n(a)}${$n(c)}${$n(u)}${$n(f)}`:`#${$n(a)}${$n(c)}${$n(u)}`}e.toCss=t;function r(a,c,u,f=255){return(a<<24|c<<16|u<<8|f)>>>0}e.toRgba=r;function n(a,c,u,f){return{css:e.toCss(a,c,u,f),rgba:e.toRgba(a,c,u,f)}}e.toColor=n})(hi||={});var X5;(e=>{function t(m,d){if(St=(d.rgba&255)/255,St===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,_=d.rgba>>16&255,S=d.rgba>>8&255,w=m.rgba>>24&255,x=m.rgba>>16&255,C=m.rgba>>8&255;Gt=w+Math.round((g-w)*St),Xt=x+Math.round((_-x)*St),Zt=C+Math.round((S-C)*St);let k=hi.toCss(Gt,Xt,Zt),T=hi.toRgba(Gt,Xt,Zt);return{css:k,rgba:T}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function n(m,d,g){let _=ku.ensureContrastRatio(m.rgba,d.rgba,g);if(_)return hi.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=n;function a(m){let d=(m.rgba|255)>>>0;return[Gt,Xt,Zt]=ku.toChannels(d),{css:hi.toCss(Gt,Xt,Zt),rgba:d}}e.opaque=a;function c(m,d){return St=Math.round(d*255),[Gt,Xt,Zt]=ku.toChannels(m.rgba),{css:hi.toCss(Gt,Xt,Zt,St),rgba:hi.toRgba(Gt,Xt,Zt,St)}}e.opacity=c;function u(m,d){return St=m.rgba&255,c(m,St*d/255)}e.multiplyOpacity=u;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(X5||={});var oi;(e=>{let t,r;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Gt=parseInt(a.slice(1,2).repeat(2),16),Xt=parseInt(a.slice(2,3).repeat(2),16),Zt=parseInt(a.slice(3,4).repeat(2),16),hi.toColor(Gt,Xt,Zt);case 5:return Gt=parseInt(a.slice(1,2).repeat(2),16),Xt=parseInt(a.slice(2,3).repeat(2),16),Zt=parseInt(a.slice(3,4).repeat(2),16),St=parseInt(a.slice(4,5).repeat(2),16),hi.toColor(Gt,Xt,Zt,St);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.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 Gt=parseInt(c[1]),Xt=parseInt(c[2]),Zt=parseInt(c[3]),St=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),hi.toColor(Gt,Xt,Zt,St);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Gt,Xt,Zt,St]=t.getImageData(0,0,1,1).data,St!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:hi.toRgba(Gt,Xt,Zt,St),css:a}}e.toColor=n})(oi||={});var pi;(e=>{function t(n){return r(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function r(n,a,c){let u=n/255,f=a/255,m=c/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return d*.2126+g*.7152+_*.0722}e.relativeLuminance2=r})(pi||={});var ku;(e=>{function t(u,f){if(St=(f&255)/255,St===1)return f;let m=f>>24&255,d=f>>16&255,g=f>>8&255,_=u>>24&255,S=u>>16&255,w=u>>8&255;return Gt=_+Math.round((m-_)*St),Xt=S+Math.round((d-S)*St),Zt=w+Math.round((g-w)*St),hi.toRgba(Gt,Xt,Zt)}e.blend=t;function r(u,f,m){let d=pi.relativeLuminance(u>>8),g=pi.relativeLuminance(f>>8);if(vs(d,g)>8));if(x>8));return x>k?w:C}return w}let _=a(u,f,m),S=vs(d,pi.relativeLuminance(_>>8));if(S>8));return S>x?_:w}return _}}e.ensureContrastRatio=r;function n(u,f,m){let d=u>>24&255,g=u>>16&255,_=u>>8&255,S=f>>24&255,w=f>>16&255,x=f>>8&255,C=vs(pi.relativeLuminance2(S,w,x),pi.relativeLuminance2(d,g,_));for(;C0||w>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C=vs(pi.relativeLuminance2(S,w,x),pi.relativeLuminance2(d,g,_));return(S<<24|w<<16|x<<8|255)>>>0}e.reduceLuminance=n;function a(u,f,m){let d=u>>24&255,g=u>>16&255,_=u>>8&255,S=f>>24&255,w=f>>16&255,x=f>>8&255,C=vs(pi.relativeLuminance2(S,w,x),pi.relativeLuminance2(d,g,_));for(;C>>0}e.increaseLuminance=a;function c(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=c})(ku||={});function $n(e){let t=e.toString(16);return t.length<2?"0"+t:t}function vs(e,t){return e{let e=[oi.toColor("#2e3436"),oi.toColor("#cc0000"),oi.toColor("#4e9a06"),oi.toColor("#c4a000"),oi.toColor("#3465a4"),oi.toColor("#75507b"),oi.toColor("#06989a"),oi.toColor("#d3d7cf"),oi.toColor("#555753"),oi.toColor("#ef2929"),oi.toColor("#8ae234"),oi.toColor("#fce94f"),oi.toColor("#729fcf"),oi.toColor("#ad7fa8"),oi.toColor("#34e2e2"),oi.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let n=t[r/36%6|0],a=t[r/6%6|0],c=t[r%6];e.push({css:hi.toCss(n,a,c),rgba:hi.toRgba(n,a,c)})}for(let r=0;r<24;r++){let n=8+r*10;e.push({css:hi.toCss(n,n,n),rgba:hi.toRgba(n,n,n)})}return e})());function Ob(e,t,r){return Math.max(t,Math.min(e,r))}function Q5(e){switch(e){case"&":return"&";case"<":return"<"}return e}var G1=class{constructor(e){this._buffer=e}serialize(e,t){let r=this._buffer.getNullCell(),n=this._buffer.getNullCell(),a=r,c=e.start.y,u=e.end.y,f=e.start.x,m=e.end.x;this._beforeSerialize(u-c,c,u);for(let d=c;d<=u;d++){let g=this._buffer.getLine(d);if(g){let _=d===e.start.y?f:0,S=d===e.end.y?m:g.length;for(let w=_;w0&&!Ss(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!r){t-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let a=this._buffer.getLine(t),c=this._buffer.getLine(t+1);if(!c.isWrapped)n=`\r +`,this._lastCursorRow=t+1,this._lastCursorCol=0;else{n="";let u=a.getCell(a.length-1,this._thisRowLastChar),f=a.getCell(a.length-2,this._thisRowLastSecondChar),m=c.getCell(0,this._nextRowFirstChar),d=m.getWidth()>1,g=!1;(m.getChars()&&d?this._nullCellCount<=1:this._nullCellCount<=0)&&((u.getChars()||u.getWidth()===0)&&Ss(u,m)&&(g=!0),d&&(f.getChars()||f.getWidth()===0)&&Ss(u,m)&&Ss(f,m)&&(g=!0)),g||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=t+1,this._lastContentCursorCol=0,this._lastCursorRow=t+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(t,r){let n=[],a=!X1(t,r),c=!Ss(t,r),u=!Z1(t,r);if(a||c||u)if(t.isAttributeDefault())r.isAttributeDefault()||n.push(0);else{if(a){let f=t.getFgColor();t.isFgRGB()?n.push(38,2,f>>>16&255,f>>>8&255,f&255):t.isFgPalette()?f>=16?n.push(38,5,f):n.push(f&8?90+(f&7):30+(f&7)):n.push(39)}if(c){let f=t.getBgColor();t.isBgRGB()?n.push(48,2,f>>>16&255,f>>>8&255,f&255):t.isBgPalette()?f>=16?n.push(48,5,f):n.push(f&8?100+(f&7):40+(f&7)):n.push(49)}u&&(t.isInverse()!==r.isInverse()&&n.push(t.isInverse()?7:27),t.isBold()!==r.isBold()&&n.push(t.isBold()?1:22),t.isUnderline()!==r.isUnderline()&&n.push(t.isUnderline()?4:24),t.isOverline()!==r.isOverline()&&n.push(t.isOverline()?53:55),t.isBlink()!==r.isBlink()&&n.push(t.isBlink()?5:25),t.isInvisible()!==r.isInvisible()&&n.push(t.isInvisible()?8:28),t.isItalic()!==r.isItalic()&&n.push(t.isItalic()?3:23),t.isDim()!==r.isDim()&&n.push(t.isDim()?2:22),t.isStrikethrough()!==r.isStrikethrough()&&n.push(t.isStrikethrough()?9:29))}return n}_nextCell(t,r,n,a){if(t.getWidth()===0)return;let c=t.getChars()==="",u=this._diffStyle(t,this._cursorStyle);if(c?!Ss(this._cursorStyle,t):u.length>0){this._nullCellCount>0&&(Ss(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a,this._currentRow+=`\x1B[${u.join(";")}m`;let f=this._buffer.getLine(n);f!==void 0&&(f.getCell(a,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=a)}c?this._nullCellCount+=t.getWidth():(this._nullCellCount>0&&(Ss(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=t.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=a+t.getWidth())}_serializeString(t){let r=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(r=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let u=0;u{g>0?n+=`\x1B[${g}C`:g<0&&(n+=`\x1B[${-g}D`)};m&&((g=>{g>0?n+=`\x1B[${g}B`:g<0&&(n+=`\x1B[${-g}A`)})(u-this._lastCursorRow),d(f-this._lastCursorCol))}let a=this._terminal._core._inputHandler._curAttrData,c=this._diffStyle(a,this._cursorStyle);return c.length>0&&(n+=`\x1B[${c.join(";")}m`),n}},eM=class{activate(t){this._terminal=t}_serializeBufferByScrollback(t,r,n){let a=r.length,c=n===void 0?a:Ob(n+t.rows,0,a);return this._serializeBufferByRange(t,r,{start:a-c,end:a-1},!1)}_serializeBufferByRange(t,r,n,a){return new J5(r,t).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:t.cols,y:typeof n.end=="number"?n.end:n.end.line}},a)}_serializeBufferAsHTML(t,r){let n=t.buffer.active,a=new tM(n,t,r),c=r.onlySelection??!1,u=r.range;if(u)return a.serialize({start:{x:u.startCol,y:(u.startLine,u.startLine)},end:{x:t.cols,y:(u.endLine,u.endLine)}});if(!c){let m=n.length,d=r.scrollback,g=d===void 0?m:Ob(d+t.rows,0,m);return a.serialize({start:{x:0,y:m-g},end:{x:t.cols,y:m-1}})}let f=this._terminal?.getSelectionPosition();return f!==void 0?a.serialize({start:{x:f.start.x,y:f.start.y},end:{x:f.end.x,y:f.end.y}}):""}_serializeModes(t){let r="",n=t.modes;if(n.applicationCursorKeysMode&&(r+="\x1B[?1h"),n.applicationKeypadMode&&(r+="\x1B[?66h"),n.bracketedPasteMode&&(r+="\x1B[?2004h"),n.insertMode&&(r+="\x1B[4h"),n.originMode&&(r+="\x1B[?6h"),n.reverseWraparoundMode&&(r+="\x1B[?45h"),n.sendFocusMode&&(r+="\x1B[?1004h"),n.wraparoundMode===!1&&(r+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":r+="\x1B[?9h";break;case"vt200":r+="\x1B[?1000h";break;case"drag":r+="\x1B[?1002h";break;case"any":r+="\x1B[?1003h";break}return r}serialize(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let r=t?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,t.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,t?.scrollback);if(!t?.excludeAltBuffer&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);r+=`\x1B[?1049h\x1B[H${n}`}return t?.excludeModes||(r+=this._serializeModes(this._terminal)),r}serializeAsHTML(t){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,t||{})}dispose(){}},tM=class extends G1{constructor(e,t,r){super(e),this._terminal=t,this._options=r,this._currentRow="",this._htmlContent="",t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=Z5}_padStart(e,t,r){return t=t>>0,r=r??" ",e.length>t?e:(t-=e.length,t>r.length&&(r+=r.repeat(t/r.length)),r.slice(0,t)+e)}_beforeSerialize(e,t,r){this._htmlContent+="
";let n="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(n=this._terminal.options.theme?.foreground??"#ffffff",a=this._terminal.options.theme?.background??"#000000");let c=[];c.push("color: "+n+";"),c.push("background-color: "+a+";"),c.push("font-family: "+this._terminal.options.fontFamily+";"),c.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="
"}_afterSerialize(){this._htmlContent+="
",this._htmlContent+="
"}_rowEnd(e,t){this._htmlContent+="
"+this._currentRow+"
",this._currentRow=""}_getHexColor(e,t){let r=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return"#"+[r>>16&255,r>>8&255,r&255].map(n=>this._padStart(n.toString(16),2,"0")).join("");if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[r].css}_diffStyle(e,t){let r=[],n=!X1(e,t),a=!Ss(e,t),c=!Z1(e,t);if(n||a||c){let u=this._getHexColor(e,!0);u&&r.push("color: "+u+";");let f=this._getHexColor(e,!1);return f&&r.push("background-color: "+f+";"),e.isInverse()&&r.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&r.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?r.push("text-decoration: overline underline;"):e.isUnderline()?r.push("text-decoration: underline;"):e.isOverline()&&r.push("text-decoration: overline;"),e.isBlink()&&r.push("text-decoration: blink;"),e.isInvisible()&&r.push("visibility: hidden;"),e.isItalic()&&r.push("font-style: italic;"),e.isDim()&&r.push("opacity: 0.5;"),e.isStrikethrough()&&r.push("text-decoration: line-through;"),r}}_nextCell(e,t,r,n){if(e.getWidth()===0)return;let a=e.getChars()==="",c=this._diffStyle(e,t);c&&(this._currentRow+=c.length===0?"":""),a?this._currentRow+=" ":this._currentRow+=Q5(e.getChars())}_serializeString(){return this._htmlContent}};const Q1=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();const iM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const rM=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());const Bb=e=>{const t=rM(e);return t.charAt(0).toUpperCase()+t.slice(1)};var sM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nM=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const oM=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:c,iconNode:u,...f},m)=>y.createElement("svg",{ref:m,...sM,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Q1("lucide",a),...!c&&!nM(f)&&{"aria-hidden":"true"},...f},[...u.map(([d,g])=>y.createElement(d,g)),...Array.isArray(c)?c:[c]]));const Qe=(e,t)=>{const r=y.forwardRef(({className:n,...a},c)=>y.createElement(oM,{ref:c,iconNode:t,className:Q1(`lucide-${iM(Bb(e))}`,`lucide-${e}`,n),...a}));return r.displayName=Bb(e),r};const aM=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],lM=Qe("activity",aM);const cM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],uM=Qe("arrow-right",cM);const hM=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],dM=Qe("brush",hM);const fM=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],mM=Qe("chevron-down",fM);const pM=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_M=Qe("chevron-up",pM);const gM=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],vM=Qe("cloud-download",gM);const yM=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],bM=Qe("cpu",yM);const SM=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],wM=Qe("download",SM);const xM=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],CM=Qe("external-link",xM);const EM=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],RM=Qe("hard-drive",EM);const kM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],TM=Qe("house",kM);const AM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],DM=Qe("log-out",AM);const MM=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],NM=Qe("memory-stick",MM);const OM=[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],Lb=Qe("monitor-x",OM);const BM=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],LM=Qe("moon",BM);const zM=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],J1=Qe("network",zM);const jM=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],HM=Qe("package-minus",jM);const PM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],UM=Qe("pencil",PM);const IM=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],zb=Qe("play",IM);const $M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ew=Qe("plus",$M);const FM=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],WM=Qe("rotate-cw",FM);const qM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],VM=Qe("save",qM);const YM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],tw=Qe("search",YM);const KM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],iw=Qe("square",KM);const GM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],XM=Qe("sun",GM);const ZM=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ap=Qe("terminal",ZM);const QM=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],rw=Qe("trash-2",QM);const JM=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],eN=Qe("triangle-alert",JM);const tN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Fp=Qe("x",tN);function iN({stackName:e}){const t=y.useRef(null),r=y.useRef(null),n=y.useRef(null),a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),f=y.useRef(null),[m,d]=y.useState(!1),[g,_]=y.useState("");y.useEffect(()=>{if(!t.current){console.error("Terminal ref not ready");return}if(r.current)try{r.current.dispose()}catch{}if(f.current)try{f.current.close()}catch{}let k=!0;const $=setTimeout(()=>{if(!(!k||!t.current))try{const j=new j1({cursorBlink:!0,convertEol:!0,allowProposedApi:!0,theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#58a6ff",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#ffffff"},fontFamily:"'JetBrains Mono', Consolas, Monaco, monospace",fontSize:13,scrollback:1e4}),P=new H1,F=new G5,G=new eM;j.loadAddon(P),j.loadAddon(F),j.loadAddon(G),n.current=P,a.current=F,c.current=G,j.open(t.current),r.current=j,j.attachCustomKeyEventHandler(M=>M.ctrlKey&&M.key==="f"&&M.type==="keydown"?(M.preventDefault(),d(H=>{const N=!H;return N&&setTimeout(()=>u.current?.focus(),50),N}),!1):!0),requestAnimationFrame(()=>{if(!(!k||!n.current||!t.current))try{n.current.fit()}catch(M){console.error("Error fitting terminal:",M)}});const re=window.location.protocol==="https:"?"wss:":"ws:",le=e?.replace(/\.(yml|yaml)$/,""),ce=le?`${re}//${window.location.host}/api/stacks/${le}/logs`:`${re}//${window.location.host}`,W=new WebSocket(ce);f.current=W,W.onopen=()=>{k&&(le||W.send(JSON.stringify({action:"connectTerminal"})))},W.onmessage=M=>{if(k&&r.current){const H=typeof M.data=="string"?M.data:M.data.toString();r.current.write(H.replace(/\r?\n/g,`\r +`))}},W.onerror=M=>{console.error("WebSocket error:",M)}}catch(j){console.error("Error initializing terminal:",j)}},50);let z;const A=new ResizeObserver(()=>{z&&clearTimeout(z),z=setTimeout(()=>{if(n.current&&t.current&&k)try{n.current.fit()}catch{}},50)});return t.current.parentElement&&A.observe(t.current.parentElement),()=>{if(k=!1,clearTimeout($),A.disconnect(),f.current){try{f.current.close()}catch{}f.current=null}if(r.current){try{r.current.dispose()}catch{}r.current=null}n.current=null,a.current=null,c.current=null}},[e]);const S=()=>{if(!c.current)return;const k=c.current.serialize(),T=new Blob([k],{type:"text/plain"}),$=URL.createObjectURL(T),z=document.createElement("a");z.href=$;const A=new Date().toISOString().replace(/[:.]/g,"-");z.download=`logs-${e||"terminal"}-${A}.txt`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL($)},w=()=>{!a.current||!g||a.current.findNext(g)},x=()=>{!a.current||!g||a.current.findPrevious(g)},C=k=>{k.key==="Enter"?k.shiftKey?x():w():k.key==="Escape"&&d(!1)};return v.jsxs("div",{className:"flex flex-col h-full w-full relative group",children:[v.jsxs("div",{className:`absolute top-2 right-6 z-10 flex gap-2 transition-opacity duration-200 ${m?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"}`,children:[m?v.jsxs("div",{className:"flex flex-row items-center p-1 pr-1 bg-background/95 backdrop-blur-sm border border-border shadow-md rounded-md",children:[v.jsx(xs,{ref:u,value:g,onChange:k=>_(k.target.value),onKeyDown:C,placeholder:"Find in terminal...",className:"h-7 w-48 border-none focus-visible:ring-0 bg-transparent text-sm min-h-0"}),v.jsx(Ie,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:x,title:"Previous (Shift+Enter)",children:v.jsx(_M,{className:"w-4 h-4"})}),v.jsx(Ie,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:w,title:"Next (Enter)",children:v.jsx(mM,{className:"w-4 h-4"})}),v.jsx("div",{className:"w-px h-4 bg-border mx-1"}),v.jsx(Ie,{variant:"ghost",size:"icon",className:"h-6 w-6 hover:bg-destructive/10 hover:text-destructive",onClick:()=>d(!1),title:"Close (Esc)",children:v.jsx(Fp,{className:"w-4 h-4"})})]}):v.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>{d(!0),setTimeout(()=>u.current?.focus(),50)},className:"h-8 bg-background/80 backdrop-blur-sm shadow-sm",title:"Search (Ctrl+F)",children:[v.jsx(tw,{className:"w-4 h-4 mr-2"}),"Search"]}),v.jsxs(Ie,{variant:"outline",size:"sm",onClick:S,className:"h-8 bg-background/80 backdrop-blur-sm shadow-sm",title:"Download Logs",children:[v.jsx(wM,{className:"w-4 h-4 mr-2"}),"Download"]})]}),v.jsx("div",{ref:t,className:"flex-1 w-full overflow-hidden"})]})}class jb extends y.Component{state={hasError:!1,error:null};static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){console.error("ErrorBoundary caught an error:",t,r)}render(){return this.state.hasError?v.jsxs("div",{className:"p-6 bg-red-900/20 border border-red-500 rounded-xl m-4",children:[v.jsx("h2",{className:"text-lg font-bold text-red-500 mb-2",children:"Something went wrong"}),v.jsx("p",{className:"text-red-300 text-sm mb-4",children:this.state.error?.message||"Unknown error"}),v.jsx("button",{className:"px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}function Ve(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}function rN(e,t){const r=y.createContext(t),n=c=>{const{children:u,...f}=c,m=y.useMemo(()=>f,Object.values(f));return v.jsx(r.Provider,{value:m,children:u})};n.displayName=e+"Provider";function a(c){const u=y.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[n,a]}function yn(e,t=[]){let r=[];function n(c,u){const f=y.createContext(u),m=r.length;r=[...r,u];const d=_=>{const{scope:S,children:w,...x}=_,C=S?.[e]?.[m]||f,k=y.useMemo(()=>x,Object.values(x));return v.jsx(C.Provider,{value:k,children:w})};d.displayName=c+"Provider";function g(_,S){const w=S?.[e]?.[m]||f,x=y.useContext(w);if(x)return x;if(u!==void 0)return u;throw new Error(`\`${_}\` must be used within \`${c}\``)}return[d,g]}const a=()=>{const c=r.map(u=>y.createContext(u));return function(f){const m=f?.[e]||c;return y.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return a.scopeName=e,[n,sN(a,...t)]}function sN(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(c){const u=n.reduce((f,{useScope:m,scopeName:d})=>{const _=m(c)[`__scope${d}`];return{...f,..._}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Es=globalThis?.document?y.useLayoutEffect:()=>{},nN=xp[" useId ".trim().toString()]||(()=>{}),oN=0;function cr(e){const[t,r]=y.useState(nN());return Es(()=>{r(n=>n??String(oN++))},[e]),t?`radix-${t}`:""}var aN=xp[" useInsertionEffect ".trim().toString()]||Es;function oh({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,c,u]=lN({defaultProp:t,onChange:r}),f=e!==void 0,m=f?e:a;{const g=y.useRef(e!==void 0);y.useEffect(()=>{const _=g.current;_!==f&&console.warn(`${n} is changing from ${_?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=f},[f,n])}const d=y.useCallback(g=>{if(f){const _=cN(g)?g(e):g;_!==e&&u.current?.(_)}else c(g)},[f,e,c,u]);return[m,d]}function lN({defaultProp:e,onChange:t}){const[r,n]=y.useState(e),a=y.useRef(r),c=y.useRef(t);return aN(()=>{c.current=t},[t]),y.useEffect(()=>{a.current!==r&&(c.current?.(r),a.current=r)},[r,a]),[r,n,c]}function cN(e){return typeof e=="function"}function uN(e){const t=hN(e),r=y.forwardRef((n,a)=>{const{children:c,...u}=n,f=y.Children.toArray(c),m=f.find(fN);if(m){const d=m.props.children,g=f.map(_=>_===m?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:_);return v.jsx(t,{...u,ref:a,children:y.isValidElement(d)?y.cloneElement(d,void 0,g):null})}return v.jsx(t,{...u,ref:a,children:c})});return r.displayName=`${e}.Slot`,r}function hN(e){const t=y.forwardRef((r,n)=>{const{children:a,...c}=r;if(y.isValidElement(a)){const u=pN(a),f=mN(c,a.props);return a.type!==y.Fragment&&(f.ref=n?Ir(n,u):u),y.cloneElement(a,f)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dN=Symbol("radix.slottable");function fN(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dN}function mN(e,t){const r={...t};for(const n in t){const a=e[n],c=t[n];/^on[A-Z]/.test(n)?a&&c?r[n]=(...f)=>{const m=c(...f);return a(...f),m}:a&&(r[n]=a):n==="style"?r[n]={...a,...c}:n==="className"&&(r[n]=[a,c].filter(Boolean).join(" "))}return{...e,...r}}function pN(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var _N=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=_N.reduce((e,t)=>{const r=uN(`Primitive.${t}`),n=y.forwardRef((a,c)=>{const{asChild:u,...f}=a,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(m,{...f,ref:c})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function gN(e,t){e&&Dp.flushSync(()=>e.dispatchEvent(t))}function Ti(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...r)=>t.current?.(...r),[])}function vN(e,t=globalThis?.document){const r=Ti(e);y.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var yN="DismissableLayer",lp="dismissableLayer.update",bN="dismissableLayer.pointerDownOutside",SN="dismissableLayer.focusOutside",Hb,sw=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wp=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...m}=e,d=y.useContext(sw),[g,_]=y.useState(null),S=g?.ownerDocument??globalThis?.document,[,w]=y.useState({}),x=wt(t,F=>_(F)),C=Array.from(d.layers),[k]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),T=C.indexOf(k),$=g?C.indexOf(g):-1,z=d.layersWithOutsidePointerEventsDisabled.size>0,A=$>=T,j=CN(F=>{const G=F.target,re=[...d.branches].some(le=>le.contains(G));!A||re||(a?.(F),u?.(F),F.defaultPrevented||f?.())},S),P=EN(F=>{const G=F.target;[...d.branches].some(le=>le.contains(G))||(c?.(F),u?.(F),F.defaultPrevented||f?.())},S);return vN(F=>{$===d.layers.size-1&&(n?.(F),!F.defaultPrevented&&f&&(F.preventDefault(),f()))},S),y.useEffect(()=>{if(g)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Hb=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),Pb(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=Hb)}},[g,S,r,d]),y.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),Pb())},[g,d]),y.useEffect(()=>{const F=()=>w({});return document.addEventListener(lp,F),()=>document.removeEventListener(lp,F)},[]),v.jsx($e.div,{...m,ref:x,style:{pointerEvents:z?A?"auto":"none":void 0,...e.style},onFocusCapture:Ve(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ve(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ve(e.onPointerDownCapture,j.onPointerDownCapture)})});Wp.displayName=yN;var wN="DismissableLayerBranch",xN=y.forwardRef((e,t)=>{const r=y.useContext(sw),n=y.useRef(null),a=wt(t,n);return y.useEffect(()=>{const c=n.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),v.jsx($e.div,{...e,ref:a})});xN.displayName=wN;function CN(e,t=globalThis?.document){const r=Ti(e),n=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const c=f=>{if(f.target&&!n.current){let m=function(){nw(bN,r,d,{discrete:!0})};const d={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=m,t.addEventListener("click",a.current,{once:!0})):m()}else t.removeEventListener("click",a.current);n.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function EN(e,t=globalThis?.document){const r=Ti(e),n=y.useRef(!1);return y.useEffect(()=>{const a=c=>{c.target&&!n.current&&nw(SN,r,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Pb(){const e=new CustomEvent(lp);document.dispatchEvent(e)}function nw(e,t,r,{discrete:n}){const a=r.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?gN(a,c):a.dispatchEvent(c)}var nm="focusScope.autoFocusOnMount",om="focusScope.autoFocusOnUnmount",Ub={bubbles:!1,cancelable:!0},RN="FocusScope",ow=y.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:c,...u}=e,[f,m]=y.useState(null),d=Ti(a),g=Ti(c),_=y.useRef(null),S=wt(t,C=>m(C)),w=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(n){let C=function(z){if(w.paused||!f)return;const A=z.target;f.contains(A)?_.current=A:cn(_.current,{select:!0})},k=function(z){if(w.paused||!f)return;const A=z.relatedTarget;A!==null&&(f.contains(A)||cn(_.current,{select:!0}))},T=function(z){if(document.activeElement===document.body)for(const j of z)j.removedNodes.length>0&&cn(f)};document.addEventListener("focusin",C),document.addEventListener("focusout",k);const $=new MutationObserver(T);return f&&$.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",k),$.disconnect()}}},[n,f,w.paused]),y.useEffect(()=>{if(f){$b.add(w);const C=document.activeElement;if(!f.contains(C)){const T=new CustomEvent(nm,Ub);f.addEventListener(nm,d),f.dispatchEvent(T),T.defaultPrevented||(kN(NN(aw(f)),{select:!0}),document.activeElement===C&&cn(f))}return()=>{f.removeEventListener(nm,d),setTimeout(()=>{const T=new CustomEvent(om,Ub);f.addEventListener(om,g),f.dispatchEvent(T),T.defaultPrevented||cn(C??document.body,{select:!0}),f.removeEventListener(om,g),$b.remove(w)},0)}}},[f,d,g,w]);const x=y.useCallback(C=>{if(!r&&!n||w.paused)return;const k=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,T=document.activeElement;if(k&&T){const $=C.currentTarget,[z,A]=TN($);z&&A?!C.shiftKey&&T===A?(C.preventDefault(),r&&cn(z,{select:!0})):C.shiftKey&&T===z&&(C.preventDefault(),r&&cn(A,{select:!0})):T===$&&C.preventDefault()}},[r,n,w.paused]);return v.jsx($e.div,{tabIndex:-1,...u,ref:S,onKeyDown:x})});ow.displayName=RN;function kN(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(cn(n,{select:t}),document.activeElement!==r)return}function TN(e){const t=aw(e),r=Ib(t,e),n=Ib(t.reverse(),e);return[r,n]}function aw(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Ib(e,t){for(const r of e)if(!AN(r,{upTo:t}))return r}function AN(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function DN(e){return e instanceof HTMLInputElement&&"select"in e}function cn(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&DN(e)&&t&&e.select()}}var $b=MN();function MN(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Fb(e,t),e.unshift(t)},remove(t){e=Fb(e,t),e[0]?.resume()}}}function Fb(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function NN(e){return e.filter(t=>t.tagName!=="A")}var ON="Portal",qp=y.forwardRef((e,t)=>{const{container:r,...n}=e,[a,c]=y.useState(!1);Es(()=>c(!0),[]);const u=r||a&&globalThis?.document?.body;return u?zS.createPortal(v.jsx($e.div,{...n,ref:t}),u):null});qp.displayName=ON;function BN(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var wr=e=>{const{present:t,children:r}=e,n=LN(t),a=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),c=wt(n.ref,zN(a));return typeof r=="function"||n.isPresent?y.cloneElement(a,{ref:c}):null};wr.displayName="Presence";function LN(e){const[t,r]=y.useState(),n=y.useRef(null),a=y.useRef(e),c=y.useRef("none"),u=e?"mounted":"unmounted",[f,m]=BN(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const d=uu(n.current);c.current=f==="mounted"?d:"none"},[f]),Es(()=>{const d=n.current,g=a.current;if(g!==e){const S=c.current,w=uu(d);e?m("MOUNT"):w==="none"||d?.display==="none"?m("UNMOUNT"):m(g&&S!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,m]),Es(()=>{if(t){let d;const g=t.ownerDocument.defaultView??window,_=w=>{const C=uu(n.current).includes(CSS.escape(w.animationName));if(w.target===t&&C&&(m("ANIMATION_END"),!a.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",d=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},S=w=>{w.target===t&&(c.current=uu(n.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",_),t.addEventListener("animationend",_),()=>{g.clearTimeout(d),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",_),t.removeEventListener("animationend",_)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:y.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function uu(e){return e?.animationName||"none"}function zN(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var am=0;function jN(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wb()),document.body.insertAdjacentElement("beforeend",e[1]??Wb()),am++,()=>{am===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),am--}},[])}function Wb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Lr=function(){return Lr=Object.assign||function(t){for(var r,n=1,a=arguments.length;n"u")return eO;var t=tO(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},rO=hw(),ea="data-scroll-locked",sO=function(e,t,r,n){var a=e.left,c=e.top,u=e.right,f=e.gap;return r===void 0&&(r="margin"),` + .`.concat(PN,` { + overflow: hidden `).concat(n,`; + padding-right: `).concat(f,"px ").concat(n,`; + } + body[`).concat(ea,`] { + overflow: hidden `).concat(n,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` + padding-left: `.concat(a,`px; + padding-top: `).concat(c,`px; + padding-right: `).concat(u,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(f,"px ").concat(n,`; + `),r==="padding"&&"padding-right: ".concat(f,"px ").concat(n,";")].filter(Boolean).join(""),` + } + + .`).concat(Tu,` { + right: `).concat(f,"px ").concat(n,`; + } + + .`).concat(Au,` { + margin-right: `).concat(f,"px ").concat(n,`; + } + + .`).concat(Tu," .").concat(Tu,` { + right: 0 `).concat(n,`; + } + + .`).concat(Au," .").concat(Au,` { + margin-right: 0 `).concat(n,`; + } + + body[`).concat(ea,`] { + `).concat(UN,": ").concat(f,`px; + } +`)},Vb=function(){var e=parseInt(document.body.getAttribute(ea)||"0",10);return isFinite(e)?e:0},nO=function(){y.useEffect(function(){return document.body.setAttribute(ea,(Vb()+1).toString()),function(){var e=Vb()-1;e<=0?document.body.removeAttribute(ea):document.body.setAttribute(ea,e.toString())}},[])},oO=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;nO();var c=y.useMemo(function(){return iO(a)},[a]);return y.createElement(rO,{styles:sO(c,!t,a,r?"":"!important")})},cp=!1;if(typeof window<"u")try{var hu=Object.defineProperty({},"passive",{get:function(){return cp=!0,!0}});window.addEventListener("test",hu,hu),window.removeEventListener("test",hu,hu)}catch{cp=!1}var qo=cp?{passive:!1}:!1,aO=function(e){return e.tagName==="TEXTAREA"},dw=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!aO(e)&&r[t]==="visible")},lO=function(e){return dw(e,"overflowY")},cO=function(e){return dw(e,"overflowX")},Yb=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=fw(e,n);if(a){var c=mw(e,n),u=c[1],f=c[2];if(u>f)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},uO=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},hO=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},fw=function(e,t){return e==="v"?lO(t):cO(t)},mw=function(e,t){return e==="v"?uO(t):hO(t)},dO=function(e,t){return e==="h"&&t==="rtl"?-1:1},fO=function(e,t,r,n,a){var c=dO(e,window.getComputedStyle(t).direction),u=c*n,f=r.target,m=t.contains(f),d=!1,g=u>0,_=0,S=0;do{if(!f)break;var w=mw(e,f),x=w[0],C=w[1],k=w[2],T=C-k-c*x;(x||T)&&fw(e,f)&&(_+=T,S+=x);var $=f.parentNode;f=$&&$.nodeType===Node.DOCUMENT_FRAGMENT_NODE?$.host:$}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(g&&Math.abs(_)<1||!g&&Math.abs(S)<1)&&(d=!0),d},du=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Kb=function(e){return[e.deltaX,e.deltaY]},Gb=function(e){return e&&"current"in e?e.current:e},mO=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pO=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},_O=0,Vo=[];function gO(e){var t=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),a=y.useState(_O++)[0],c=y.useState(hw)[0],u=y.useRef(e);y.useEffect(function(){u.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var C=HN([e.lockRef.current],(e.shards||[]).map(Gb),!0).filter(Boolean);return C.forEach(function(k){return k.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),C.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var f=y.useCallback(function(C,k){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var T=du(C),$=r.current,z="deltaX"in C?C.deltaX:$[0]-T[0],A="deltaY"in C?C.deltaY:$[1]-T[1],j,P=C.target,F=Math.abs(z)>Math.abs(A)?"h":"v";if("touches"in C&&F==="h"&&P.type==="range")return!1;var G=window.getSelection(),re=G&&G.anchorNode,le=re?re===P||re.contains(P):!1;if(le)return!1;var ce=Yb(F,P);if(!ce)return!0;if(ce?j=F:(j=F==="v"?"h":"v",ce=Yb(F,P)),!ce)return!1;if(!n.current&&"changedTouches"in C&&(z||A)&&(n.current=j),!j)return!0;var W=n.current||j;return fO(W,k,C,W==="h"?z:A)},[]),m=y.useCallback(function(C){var k=C;if(!(!Vo.length||Vo[Vo.length-1]!==c)){var T="deltaY"in k?Kb(k):du(k),$=t.current.filter(function(j){return j.name===k.type&&(j.target===k.target||k.target===j.shadowParent)&&mO(j.delta,T)})[0];if($&&$.should){k.cancelable&&k.preventDefault();return}if(!$){var z=(u.current.shards||[]).map(Gb).filter(Boolean).filter(function(j){return j.contains(k.target)}),A=z.length>0?f(k,z[0]):!u.current.noIsolation;A&&k.cancelable&&k.preventDefault()}}},[]),d=y.useCallback(function(C,k,T,$){var z={name:C,delta:k,target:T,should:$,shadowParent:vO(T)};t.current.push(z),setTimeout(function(){t.current=t.current.filter(function(A){return A!==z})},1)},[]),g=y.useCallback(function(C){r.current=du(C),n.current=void 0},[]),_=y.useCallback(function(C){d(C.type,Kb(C),C.target,f(C,e.lockRef.current))},[]),S=y.useCallback(function(C){d(C.type,du(C),C.target,f(C,e.lockRef.current))},[]);y.useEffect(function(){return Vo.push(c),e.setCallbacks({onScrollCapture:_,onWheelCapture:_,onTouchMoveCapture:S}),document.addEventListener("wheel",m,qo),document.addEventListener("touchmove",m,qo),document.addEventListener("touchstart",g,qo),function(){Vo=Vo.filter(function(C){return C!==c}),document.removeEventListener("wheel",m,qo),document.removeEventListener("touchmove",m,qo),document.removeEventListener("touchstart",g,qo)}},[]);var w=e.removeScrollBar,x=e.inert;return y.createElement(y.Fragment,null,x?y.createElement(c,{styles:pO(a)}):null,w?y.createElement(oO,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function vO(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yO=YN(uw,gO);var pw=y.forwardRef(function(e,t){return y.createElement(ah,Lr({},e,{ref:t,sideCar:yO}))});pw.classNames=ah.classNames;var bO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,fu=new WeakMap,mu={},hm=0,_w=function(e){return e&&(e.host||_w(e.parentNode))},SO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=_w(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},wO=function(e,t,r,n){var a=SO(t,Array.isArray(e)?e:[e]);mu[r]||(mu[r]=new WeakMap);var c=mu[r],u=[],f=new Set,m=new Set(a),d=function(_){!_||f.has(_)||(f.add(_),d(_.parentNode))};a.forEach(d);var g=function(_){!_||m.has(_)||Array.prototype.forEach.call(_.children,function(S){if(f.has(S))g(S);else try{var w=S.getAttribute(n),x=w!==null&&w!=="false",C=(Yo.get(S)||0)+1,k=(c.get(S)||0)+1;Yo.set(S,C),c.set(S,k),u.push(S),C===1&&x&&fu.set(S,!0),k===1&&S.setAttribute(r,"true"),x||S.setAttribute(n,"true")}catch(T){console.error("aria-hidden: cannot operate on ",S,T)}})};return g(t),f.clear(),hm++,function(){u.forEach(function(_){var S=Yo.get(_)-1,w=c.get(_)-1;Yo.set(_,S),c.set(_,w),S||(fu.has(_)||_.removeAttribute(n),fu.delete(_)),w||_.removeAttribute(r)}),hm--,hm||(Yo=new WeakMap,Yo=new WeakMap,fu=new WeakMap,mu={})}},xO=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=bO(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),wO(n,a,r,"aria-hidden")):function(){return null}};function CO(e){const t=EO(e),r=y.forwardRef((n,a)=>{const{children:c,...u}=n,f=y.Children.toArray(c),m=f.find(kO);if(m){const d=m.props.children,g=f.map(_=>_===m?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:_);return v.jsx(t,{...u,ref:a,children:y.isValidElement(d)?y.cloneElement(d,void 0,g):null})}return v.jsx(t,{...u,ref:a,children:c})});return r.displayName=`${e}.Slot`,r}function EO(e){const t=y.forwardRef((r,n)=>{const{children:a,...c}=r;if(y.isValidElement(a)){const u=AO(a),f=TO(c,a.props);return a.type!==y.Fragment&&(f.ref=n?Ir(n,u):u),y.cloneElement(a,f)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var RO=Symbol("radix.slottable");function kO(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===RO}function TO(e,t){const r={...t};for(const n in t){const a=e[n],c=t[n];/^on[A-Z]/.test(n)?a&&c?r[n]=(...f)=>{const m=c(...f);return a(...f),m}:a&&(r[n]=a):n==="style"?r[n]={...a,...c}:n==="className"&&(r[n]=[a,c].filter(Boolean).join(" "))}return{...e,...r}}function AO(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var lh="Dialog",[gw,vw]=yn(lh),[DO,xr]=gw(lh),yw=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:c,modal:u=!0}=e,f=y.useRef(null),m=y.useRef(null),[d,g]=oh({prop:n,defaultProp:a??!1,onChange:c,caller:lh});return v.jsx(DO,{scope:t,triggerRef:f,contentRef:m,contentId:cr(),titleId:cr(),descriptionId:cr(),open:d,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(_=>!_),[g]),modal:u,children:r})};yw.displayName=lh;var bw="DialogTrigger",Sw=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=xr(bw,r),c=wt(t,a.triggerRef);return v.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Kp(a.open),...n,ref:c,onClick:Ve(e.onClick,a.onOpenToggle)})});Sw.displayName=bw;var Vp="DialogPortal",[MO,ww]=gw(Vp,{forceMount:void 0}),xw=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,c=xr(Vp,t);return v.jsx(MO,{scope:t,forceMount:r,children:y.Children.map(n,u=>v.jsx(wr,{present:r||c.open,children:v.jsx(qp,{asChild:!0,container:a,children:u})}))})};xw.displayName=Vp;var Iu="DialogOverlay",Cw=y.forwardRef((e,t)=>{const r=ww(Iu,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,c=xr(Iu,e.__scopeDialog);return c.modal?v.jsx(wr,{present:n||c.open,children:v.jsx(OO,{...a,ref:t})}):null});Cw.displayName=Iu;var NO=CO("DialogOverlay.RemoveScroll"),OO=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=xr(Iu,r);return v.jsx(pw,{as:NO,allowPinchZoom:!0,shards:[a.contentRef],children:v.jsx($e.div,{"data-state":Kp(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Xn="DialogContent",Ew=y.forwardRef((e,t)=>{const r=ww(Xn,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,c=xr(Xn,e.__scopeDialog);return v.jsx(wr,{present:n||c.open,children:c.modal?v.jsx(BO,{...a,ref:t}):v.jsx(LO,{...a,ref:t})})});Ew.displayName=Xn;var BO=y.forwardRef((e,t)=>{const r=xr(Xn,e.__scopeDialog),n=y.useRef(null),a=wt(t,r.contentRef,n);return y.useEffect(()=>{const c=n.current;if(c)return xO(c)},[]),v.jsx(Rw,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(e.onCloseAutoFocus,c=>{c.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ve(e.onPointerDownOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&c.preventDefault()}),onFocusOutside:Ve(e.onFocusOutside,c=>c.preventDefault())})}),LO=y.forwardRef((e,t)=>{const r=xr(Xn,e.__scopeDialog),n=y.useRef(!1),a=y.useRef(!1);return v.jsx(Rw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(n.current||r.triggerRef.current?.focus(),c.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(n.current=!0,c.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const u=c.target;r.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&a.current&&c.preventDefault()}})}),Rw=y.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:c,...u}=e,f=xr(Xn,r),m=y.useRef(null),d=wt(t,m);return jN(),v.jsxs(v.Fragment,{children:[v.jsx(ow,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:c,children:v.jsx(Wp,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Kp(f.open),...u,ref:d,onDismiss:()=>f.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(jO,{titleId:f.titleId}),v.jsx(PO,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Yp="DialogTitle",kw=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=xr(Yp,r);return v.jsx($e.h2,{id:a.titleId,...n,ref:t})});kw.displayName=Yp;var Tw="DialogDescription",Aw=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=xr(Tw,r);return v.jsx($e.p,{id:a.descriptionId,...n,ref:t})});Aw.displayName=Tw;var Dw="DialogClose",Mw=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=xr(Dw,r);return v.jsx($e.button,{type:"button",...n,ref:t,onClick:Ve(e.onClick,()=>a.onOpenChange(!1))})});Mw.displayName=Dw;function Kp(e){return e?"open":"closed"}var Nw="DialogTitleWarning",[zO,Ow]=rN(Nw,{contentName:Xn,titleName:Yp,docsSlug:"dialog"}),jO=({titleId:e})=>{const t=Ow(Nw),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},HO="DialogDescriptionWarning",PO=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ow(HO).contentName}}.`;return y.useEffect(()=>{const a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Gp=yw,Bw=Sw,Xp=xw,ch=Cw,uh=Ew,Zp=kw,Qp=Aw,Jp=Mw;const hh=Gp,UO=Bw,IO=Xp,Lw=y.forwardRef(({className:e,...t},r)=>v.jsx(ch,{ref:r,className:Le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Lw.displayName=ch.displayName;const Bl=y.forwardRef(({className:e,children:t,...r},n)=>v.jsxs(IO,{children:[v.jsx(Lw,{}),v.jsxs(uh,{ref:n,className:Le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,v.jsxs(Jp,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(Fp,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bl.displayName=uh.displayName;const Ll=({className:e,...t})=>v.jsx("div",{className:Le("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ll.displayName="DialogHeader";const e_=({className:e,...t})=>v.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});e_.displayName="DialogFooter";const zl=y.forwardRef(({className:e,...t},r)=>v.jsx(Zp,{ref:r,className:Le("text-lg font-semibold leading-none tracking-tight",e),...t}));zl.displayName=Zp.displayName;const t_=y.forwardRef(({className:e,...t},r)=>v.jsx(Qp,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));t_.displayName=Qp.displayName;const $O="/api";async function at(e,t={}){const r=`${$O}${e}`,n={credentials:"include",headers:{"Content-Type":"application/json",...t.headers}},a=await fetch(r,{...n,...t});if(a.status===401)throw window.location.href="/",new Error("Unauthorized");return a}function FO(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const WO=e=>{switch(e){case"success":return YO;case"info":return GO;case"warning":return KO;case"error":return XO;default:return null}},qO=Array(12).fill(0),VO=({visible:e,className:t})=>ue.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ue.createElement("div",{className:"sonner-spinner"},qO.map((r,n)=>ue.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),YO=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),KO=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),GO=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),XO=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ue.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ZO=ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ue.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ue.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),QO=()=>{const[e,t]=ue.useState(document.hidden);return ue.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let up=1;class JO{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...a}=t,c=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:up++,u=this.toasts.find(m=>m.id===c),f=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),u?this.toasts=this.toasts.map(m=>m.id===c?(this.publish({...m,...t,id:c,title:n}),{...m,...t,id:c,dismissible:f,title:n}):m):this.addToast({title:n,...a,dismissible:f,id:c}),c},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let c=n!==void 0,u;const f=a.then(async d=>{if(u=["resolve",d],ue.isValidElement(d))c=!1,this.create({id:n,type:"default",message:d});else if(t3(d)&&!d.ok){c=!1;const _=typeof r.error=="function"?await r.error(`HTTP error! status: ${d.status}`):r.error,S=typeof r.description=="function"?await r.description(`HTTP error! status: ${d.status}`):r.description,x=typeof _=="object"&&!ue.isValidElement(_)?_:{message:_};this.create({id:n,type:"error",description:S,...x})}else if(d instanceof Error){c=!1;const _=typeof r.error=="function"?await r.error(d):r.error,S=typeof r.description=="function"?await r.description(d):r.description,x=typeof _=="object"&&!ue.isValidElement(_)?_:{message:_};this.create({id:n,type:"error",description:S,...x})}else if(r.success!==void 0){c=!1;const _=typeof r.success=="function"?await r.success(d):r.success,S=typeof r.description=="function"?await r.description(d):r.description,x=typeof _=="object"&&!ue.isValidElement(_)?_:{message:_};this.create({id:n,type:"success",description:S,...x})}}).catch(async d=>{if(u=["reject",d],r.error!==void 0){c=!1;const g=typeof r.error=="function"?await r.error(d):r.error,_=typeof r.description=="function"?await r.description(d):r.description,w=typeof g=="object"&&!ue.isValidElement(g)?g:{message:g};this.create({id:n,type:"error",description:_,...w})}}).finally(()=>{c&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((d,g)=>f.then(()=>u[0]==="reject"?g(u[1]):d(u[1])).catch(g));return typeof n!="string"&&typeof n!="number"?{unwrap:m}:Object.assign(n,{unwrap:m})},this.custom=(t,r)=>{const n=r?.id||up++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ki=new JO,e3=(e,t)=>{const r=t?.id||up++;return ki.addToast({title:e,...t,id:r}),r},t3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",i3=e3,r3=()=>ki.toasts,s3=()=>ki.getActiveToasts(),jr=Object.assign(i3,{success:ki.success,info:ki.info,warning:ki.warning,error:ki.error,custom:ki.custom,message:ki.message,promise:ki.promise,dismiss:ki.dismiss,loading:ki.loading},{getHistory:r3,getToasts:s3});FO("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function pu(e){return e.label!==void 0}const n3=3,o3="24px",a3="16px",Xb=4e3,l3=356,c3=14,u3=45,h3=200;function Nr(...e){return e.filter(Boolean).join(" ")}function d3(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const f3=e=>{var t,r,n,a,c,u,f,m,d;const{invert:g,toast:_,unstyled:S,interacting:w,setHeights:x,visibleToasts:C,heights:k,index:T,toasts:$,expanded:z,removeToast:A,defaultRichColors:j,closeButton:P,style:F,cancelButtonStyle:G,actionButtonStyle:re,className:le="",descriptionClassName:ce="",duration:W,position:M,gap:H,expandByDefault:N,classNames:R,icons:L,closeButtonAriaLabel:U="Close toast"}=e,[se,ee]=ue.useState(null),[D,O]=ue.useState(null),[q,Q]=ue.useState(!1),[X,ae]=ue.useState(!1),[de,_e]=ue.useState(!1),[me,Je]=ue.useState(!1),[ot,Ke]=ue.useState(!1),[Re,mt]=ue.useState(0),[vi,Yr]=ue.useState(0),Kr=ue.useRef(_.duration||W||Xb),bn=ue.useRef(null),di=ue.useRef(null),Sn=T===0,wn=T+1<=C,Jt=_.type,Cr=_.dismissible!==!1,ei=_.className||"",da=_.descriptionClassName||"",Gr=ue.useMemo(()=>k.findIndex(xe=>xe.toastId===_.id)||0,[k,_.id]),to=ue.useMemo(()=>{var xe;return(xe=_.closeButton)!=null?xe:P},[_.closeButton,P]),Xr=ue.useMemo(()=>_.duration||W||Xb,[_.duration,W]),hr=ue.useRef(0),dr=ue.useRef(0),io=ue.useRef(0),fr=ue.useRef(null),[Zr,Pt]=M.split("-"),Di=ue.useMemo(()=>k.reduce((xe,Ge,gt)=>gt>=Gr?xe:xe+Ge.height,0),[k,Gr]),Ut=QO(),ro=_.invert||g,he=Jt==="loading";dr.current=ue.useMemo(()=>Gr*H+Di,[Gr,Di]),ue.useEffect(()=>{Kr.current=Xr},[Xr]),ue.useEffect(()=>{Q(!0)},[]),ue.useEffect(()=>{const xe=di.current;if(xe){const Ge=xe.getBoundingClientRect().height;return Yr(Ge),x(gt=>[{toastId:_.id,height:Ge,position:_.position},...gt]),()=>x(gt=>gt.filter(It=>It.toastId!==_.id))}},[x,_.id]),ue.useLayoutEffect(()=>{if(!q)return;const xe=di.current,Ge=xe.style.height;xe.style.height="auto";const gt=xe.getBoundingClientRect().height;xe.style.height=Ge,Yr(gt),x(It=>It.find(st=>st.toastId===_.id)?It.map(st=>st.toastId===_.id?{...st,height:gt}:st):[{toastId:_.id,height:gt,position:_.position},...It])},[q,_.title,_.description,x,_.id,_.jsx,_.action,_.cancel]);const Se=ue.useCallback(()=>{ae(!0),mt(dr.current),x(xe=>xe.filter(Ge=>Ge.toastId!==_.id)),setTimeout(()=>{A(_)},h3)},[_,A,x,dr]);ue.useEffect(()=>{if(_.promise&&Jt==="loading"||_.duration===1/0||_.type==="loading")return;let xe;return z||w||Ut?(()=>{if(io.current{_.onAutoClose==null||_.onAutoClose.call(_,_),Se()},Kr.current)),()=>clearTimeout(xe)},[z,w,_,Jt,Ut,Se]),ue.useEffect(()=>{_.delete&&(Se(),_.onDismiss==null||_.onDismiss.call(_,_))},[Se,_.delete]);function Te(){var xe;if(L?.loading){var Ge;return ue.createElement("div",{className:Nr(R?.loader,_==null||(Ge=_.classNames)==null?void 0:Ge.loader,"sonner-loader"),"data-visible":Jt==="loading"},L.loading)}return ue.createElement(VO,{className:Nr(R?.loader,_==null||(xe=_.classNames)==null?void 0:xe.loader),visible:Jt==="loading"})}const Me=_.icon||L?.[Jt]||WO(Jt);var lt,Ye;return ue.createElement("li",{tabIndex:0,ref:di,className:Nr(le,ei,R?.toast,_==null||(t=_.classNames)==null?void 0:t.toast,R?.default,R?.[Jt],_==null||(r=_.classNames)==null?void 0:r[Jt]),"data-sonner-toast":"","data-rich-colors":(lt=_.richColors)!=null?lt:j,"data-styled":!(_.jsx||_.unstyled||S),"data-mounted":q,"data-promise":!!_.promise,"data-swiped":ot,"data-removed":X,"data-visible":wn,"data-y-position":Zr,"data-x-position":Pt,"data-index":T,"data-front":Sn,"data-swiping":de,"data-dismissible":Cr,"data-type":Jt,"data-invert":ro,"data-swipe-out":me,"data-swipe-direction":D,"data-expanded":!!(z||N&&q),"data-testid":_.testId,style:{"--index":T,"--toasts-before":T,"--z-index":$.length-T,"--offset":`${X?Re:dr.current}px`,"--initial-height":N?"auto":`${vi}px`,...F,..._.style},onDragEnd:()=>{_e(!1),ee(null),fr.current=null},onPointerDown:xe=>{xe.button!==2&&(he||!Cr||(bn.current=new Date,mt(dr.current),xe.target.setPointerCapture(xe.pointerId),xe.target.tagName!=="BUTTON"&&(_e(!0),fr.current={x:xe.clientX,y:xe.clientY})))},onPointerUp:()=>{var xe,Ge,gt;if(me||!Cr)return;fr.current=null;const It=Number(((xe=di.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Er=Number(((Ge=di.current)==null?void 0:Ge.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),st=new Date().getTime()-((gt=bn.current)==null?void 0:gt.getTime()),$t=se==="x"?It:Er,Mi=Math.abs($t)/st;if(Math.abs($t)>=u3||Mi>.11){mt(dr.current),_.onDismiss==null||_.onDismiss.call(_,_),O(se==="x"?It>0?"right":"left":Er>0?"down":"up"),Se(),Je(!0);return}else{var Ot,li;(Ot=di.current)==null||Ot.style.setProperty("--swipe-amount-x","0px"),(li=di.current)==null||li.style.setProperty("--swipe-amount-y","0px")}Ke(!1),_e(!1),ee(null)},onPointerMove:xe=>{var Ge,gt,It;if(!fr.current||!Cr||((Ge=window.getSelection())==null?void 0:Ge.toString().length)>0)return;const st=xe.clientY-fr.current.y,$t=xe.clientX-fr.current.x;var Mi;const Ot=(Mi=e.swipeDirections)!=null?Mi:d3(M);!se&&(Math.abs($t)>1||Math.abs(st)>1)&&ee(Math.abs($t)>Math.abs(st)?"x":"y");let li={x:0,y:0};const Ms=Ni=>1/(1.5+Math.abs(Ni)/20);if(se==="y"){if(Ot.includes("top")||Ot.includes("bottom"))if(Ot.includes("top")&&st<0||Ot.includes("bottom")&&st>0)li.y=st;else{const Ni=st*Ms(st);li.y=Math.abs(Ni)0)li.x=$t;else{const Ni=$t*Ms($t);li.x=Math.abs(Ni)0||Math.abs(li.y)>0)&&Ke(!0),(gt=di.current)==null||gt.style.setProperty("--swipe-amount-x",`${li.x}px`),(It=di.current)==null||It.style.setProperty("--swipe-amount-y",`${li.y}px`)}},to&&!_.jsx&&Jt!=="loading"?ue.createElement("button",{"aria-label":U,"data-disabled":he,"data-close-button":!0,onClick:he||!Cr?()=>{}:()=>{Se(),_.onDismiss==null||_.onDismiss.call(_,_)},className:Nr(R?.closeButton,_==null||(n=_.classNames)==null?void 0:n.closeButton)},(Ye=L?.close)!=null?Ye:ZO):null,(Jt||_.icon||_.promise)&&_.icon!==null&&(L?.[Jt]!==null||_.icon)?ue.createElement("div",{"data-icon":"",className:Nr(R?.icon,_==null||(a=_.classNames)==null?void 0:a.icon)},_.promise||_.type==="loading"&&!_.icon?_.icon||Te():null,_.type!=="loading"?Me:null):null,ue.createElement("div",{"data-content":"",className:Nr(R?.content,_==null||(c=_.classNames)==null?void 0:c.content)},ue.createElement("div",{"data-title":"",className:Nr(R?.title,_==null||(u=_.classNames)==null?void 0:u.title)},_.jsx?_.jsx:typeof _.title=="function"?_.title():_.title),_.description?ue.createElement("div",{"data-description":"",className:Nr(ce,da,R?.description,_==null||(f=_.classNames)==null?void 0:f.description)},typeof _.description=="function"?_.description():_.description):null),ue.isValidElement(_.cancel)?_.cancel:_.cancel&&pu(_.cancel)?ue.createElement("button",{"data-button":!0,"data-cancel":!0,style:_.cancelButtonStyle||G,onClick:xe=>{pu(_.cancel)&&Cr&&(_.cancel.onClick==null||_.cancel.onClick.call(_.cancel,xe),Se())},className:Nr(R?.cancelButton,_==null||(m=_.classNames)==null?void 0:m.cancelButton)},_.cancel.label):null,ue.isValidElement(_.action)?_.action:_.action&&pu(_.action)?ue.createElement("button",{"data-button":!0,"data-action":!0,style:_.actionButtonStyle||re,onClick:xe=>{pu(_.action)&&(_.action.onClick==null||_.action.onClick.call(_.action,xe),!xe.defaultPrevented&&Se())},className:Nr(R?.actionButton,_==null||(d=_.classNames)==null?void 0:d.actionButton)},_.action.label):null)};function Zb(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function m3(e,t){const r={};return[e,t].forEach((n,a)=>{const c=a===1,u=c?"--mobile-offset":"--offset",f=c?a3:o3;function m(d){["top","right","bottom","left"].forEach(g=>{r[`${u}-${g}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?m(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${u}-${d}`]=f:r[`${u}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):m(f)}),r}const p3=ue.forwardRef(function(t,r){const{id:n,invert:a,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:f,closeButton:m,className:d,offset:g,mobileOffset:_,theme:S="light",richColors:w,duration:x,style:C,visibleToasts:k=n3,toastOptions:T,dir:$=Zb(),gap:z=c3,icons:A,containerAriaLabel:j="Notifications"}=t,[P,F]=ue.useState([]),G=ue.useMemo(()=>n?P.filter(q=>q.toasterId===n):P.filter(q=>!q.toasterId),[P,n]),re=ue.useMemo(()=>Array.from(new Set([c].concat(G.filter(q=>q.position).map(q=>q.position)))),[G,c]),[le,ce]=ue.useState([]),[W,M]=ue.useState(!1),[H,N]=ue.useState(!1),[R,L]=ue.useState(S!=="system"?S:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),U=ue.useRef(null),se=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),ee=ue.useRef(null),D=ue.useRef(!1),O=ue.useCallback(q=>{F(Q=>{var X;return(X=Q.find(ae=>ae.id===q.id))!=null&&X.delete||ki.dismiss(q.id),Q.filter(({id:ae})=>ae!==q.id)})},[]);return ue.useEffect(()=>ki.subscribe(q=>{if(q.dismiss){requestAnimationFrame(()=>{F(Q=>Q.map(X=>X.id===q.id?{...X,delete:!0}:X))});return}setTimeout(()=>{zS.flushSync(()=>{F(Q=>{const X=Q.findIndex(ae=>ae.id===q.id);return X!==-1?[...Q.slice(0,X),{...Q[X],...q},...Q.slice(X+1)]:[q,...Q]})})})}),[P]),ue.useEffect(()=>{if(S!=="system"){L(S);return}if(S==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;const q=window.matchMedia("(prefers-color-scheme: dark)");try{q.addEventListener("change",({matches:Q})=>{L(Q?"dark":"light")})}catch{q.addListener(({matches:X})=>{try{L(X?"dark":"light")}catch(ae){console.error(ae)}})}},[S]),ue.useEffect(()=>{P.length<=1&&M(!1)},[P]),ue.useEffect(()=>{const q=Q=>{var X;if(u.every(_e=>Q[_e]||Q.code===_e)){var de;M(!0),(de=U.current)==null||de.focus()}Q.code==="Escape"&&(document.activeElement===U.current||(X=U.current)!=null&&X.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[u]),ue.useEffect(()=>{if(U.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,D.current=!1)}},[U.current]),ue.createElement("section",{ref:r,"aria-label":`${j} ${se}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},re.map((q,Q)=>{var X;const[ae,de]=q.split("-");return G.length?ue.createElement("ol",{key:q,dir:$==="auto"?Zb():$,tabIndex:-1,ref:U,className:d,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":ae,"data-x-position":de,style:{"--front-toast-height":`${((X=le[0])==null?void 0:X.height)||0}px`,"--width":`${l3}px`,"--gap":`${z}px`,...C,...m3(g,_)},onBlur:_e=>{D.current&&!_e.currentTarget.contains(_e.relatedTarget)&&(D.current=!1,ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null))},onFocus:_e=>{_e.target instanceof HTMLElement&&_e.target.dataset.dismissible==="false"||D.current||(D.current=!0,ee.current=_e.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{H||M(!1)},onDragEnd:()=>M(!1),onPointerDown:_e=>{_e.target instanceof HTMLElement&&_e.target.dataset.dismissible==="false"||N(!0)},onPointerUp:()=>N(!1)},G.filter(_e=>!_e.position&&Q===0||_e.position===q).map((_e,me)=>{var Je,ot;return ue.createElement(f3,{key:_e.id,icons:A,index:me,toast:_e,defaultRichColors:w,duration:(Je=T?.duration)!=null?Je:x,className:T?.className,descriptionClassName:T?.descriptionClassName,invert:a,visibleToasts:k,closeButton:(ot=T?.closeButton)!=null?ot:m,interacting:H,position:q,style:T?.style,unstyled:T?.unstyled,classNames:T?.classNames,cancelButtonStyle:T?.cancelButtonStyle,actionButtonStyle:T?.actionButtonStyle,closeButtonAriaLabel:T?.closeButtonAriaLabel,removeToast:O,toasts:G.filter(Ke=>Ke.position==_e.position),heights:le.filter(Ke=>Ke.position==_e.position),setHeights:ce,expandByDefault:f,gap:z,expanded:W,swipeDirections:t.swipeDirections})})):null}))}),Ko=e=>{if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(2))+" "+r[n]};function _3(){const[e,t]=y.useState(""),[r,n]=y.useState(!1),[a,c]=y.useState(""),[u,f]=y.useState(!1),[m,d]=y.useState(""),[g,_]=y.useState({active:0,exited:0,total:0,inactive:0}),[S,w]=y.useState(null);y.useEffect(()=>{const T=async()=>{try{const A=await(await at("/stats")).json();_(A)}catch(z){console.error("Failed to fetch stats:",z)}};T();const $=setInterval(T,5e3);return()=>clearInterval($)},[]),y.useEffect(()=>{const T=async()=>{try{const A=await(await at("/system/stats")).json();w(A)}catch(z){console.error("Failed to fetch system stats:",z)}};T();const $=setInterval(T,5e3);return()=>clearInterval($)},[]);const x=async()=>{if(e.trim()){n(!0);try{const T=await at("/convert",{method:"POST",body:JSON.stringify({dockerRun:e})});if(!T.ok)throw new Error("Conversion failed");const $=await T.json();c($.yaml)}catch(T){console.error("Conversion error:",T),jr.error("Failed to convert docker run command")}finally{n(!1)}}},C=async()=>{if(!m.trim()||!a)return;const T=m.trim();try{if(!(await at("/stacks",{method:"POST",body:JSON.stringify({stackName:T})})).ok)throw new Error("Failed to create stack");if(!(await at(`/stacks/${T}`,{method:"PUT",body:JSON.stringify({content:a})})).ok)throw new Error("Failed to save stack content");f(!1),d(""),c(""),t(""),window.location.reload()}catch($){console.error("Failed to create stack:",$),jr.error("Failed to create stack")}},k=()=>{f(!0)};return v.jsxs("div",{className:"flex-1 p-6 space-y-6",children:[v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Active Containers"}),v.jsx(lM,{className:"h-4 w-4 text-green-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-3xl font-bold text-green-500",children:g.active}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Currently running"})]})]}),v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Exited Containers"}),v.jsx(iw,{className:"h-4 w-4 text-red-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-3xl font-bold text-red-500",children:g.exited}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Stopped or crashed"})]})]}),v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Host Network"}),v.jsx(J1,{className:"h-4 w-4 text-cyan-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-xl font-bold text-cyan-500 whitespace-nowrap",children:S?.network?`${Ko(S.network.rxSec)}/s ↓`:"..."}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1 whitespace-nowrap",children:S?.network?`${Ko(S.network.txSec)}/s ↑`:"Loading..."})]})]})]}),v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Host CPU"}),v.jsx(bM,{className:"h-4 w-4 text-blue-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-3xl font-bold text-blue-500",children:S?`${S.cpu.usage}%`:"..."}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S?`${S.cpu.cores} cores`:"Loading..."})]})]}),v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Host RAM"}),v.jsx(NM,{className:"h-4 w-4 text-purple-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-3xl font-bold text-purple-500",children:S?`${S.memory.usagePercent}%`:"..."}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S?`${Ko(S.memory.used)} / ${Ko(S.memory.total)}`:"Loading..."})]})]}),v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[v.jsx(vr,{className:"text-sm font-medium text-muted-foreground",children:"Host Disk"}),v.jsx(RM,{className:"h-4 w-4 text-orange-500"})]}),v.jsxs(yr,{children:[v.jsx("div",{className:"text-3xl font-bold text-orange-500",children:S?.disk?`${S.disk.usagePercent}%`:"..."}),v.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S?.disk?`${Ko(S.disk.used)} / ${Ko(S.disk.total)}`:"Loading..."})]})]})]}),v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsxs(gr,{children:[v.jsx(vr,{className:"text-lg",children:"Convert Docker Run to Compose"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Paste your ",v.jsx("code",{className:"bg-muted px-1 rounded",children:"docker run"})," command below to convert it to a Docker Compose YAML file."]})]}),v.jsxs(yr,{className:"space-y-4",children:[v.jsx("textarea",{className:"w-full h-32 p-3 rounded-lg border border-muted bg-background text-foreground font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"docker run -d --name my-app -p 8080:80 -e TZ=UTC nginx:latest",value:e,onChange:T=>t(T.target.value)}),v.jsx("div",{className:"flex gap-2",children:v.jsxs(Ie,{onClick:x,disabled:r||!e.trim(),children:[r?"Converting...":"Convert",v.jsx(uM,{className:"w-4 h-4 ml-2"})]})}),a&&v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"p-3 rounded-lg bg-muted/50 font-mono text-sm whitespace-pre-wrap overflow-auto max-h-64",children:a}),v.jsxs(Ie,{onClick:k,children:[v.jsx(ew,{className:"w-4 h-4 mr-2"}),"Create Stack from YAML"]})]})]})]}),v.jsx(hh,{open:u,onOpenChange:f,children:v.jsxs(Bl,{children:[v.jsx(Ll,{children:v.jsx(zl,{children:"Create New Stack"})}),v.jsxs("div",{className:"py-4 space-y-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx(Cs,{htmlFor:"stack-name",children:"Stack Name"}),v.jsx(xs,{id:"stack-name",placeholder:"e.g., myapp",value:m,onChange:T=>d(T.target.value)})]}),a&&v.jsxs("div",{className:"space-y-2",children:[v.jsx(Cs,{children:"Converted Compose File (Preview)"}),v.jsx("div",{className:"p-3 rounded-lg bg-muted/50 font-mono text-sm whitespace-pre-wrap overflow-auto max-h-48",children:a})]})]}),v.jsxs(e_,{children:[v.jsx(Ie,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),v.jsx(Ie,{onClick:C,disabled:!m.trim(),children:"Create Stack"})]})]})})]})}function g3({isOpen:e,onClose:t,containerId:r,containerName:n}){const a=y.useRef(null),c=y.useRef(null),u=y.useRef(null),f=y.useRef(null),m=y.useRef(null),[d,g]=y.useState(!1),_=y.useCallback(()=>{m.current&&(clearTimeout(m.current),m.current=null),f.current&&(f.current.close(),f.current=null),c.current&&(c.current.dispose(),c.current=null),u.current=null,g(!1)},[]);y.useEffect(()=>{if(!e){_();return}let w=0;const x=15,C=()=>{if(c.current)return;const T=a.current;if(!T){w++{try{z.fit()}catch{}});const A=window.location.protocol==="https:"?"wss:":"ws:",j=new WebSocket(`${A}//${window.location.host}`);f.current=j,j.onopen=()=>{j.send(JSON.stringify({action:"execContainer",containerId:r})),g(!0),$.focus(),setTimeout(()=>{try{z.fit()}catch{}j.readyState===WebSocket.OPEN&&$.rows>0&&$.cols>0&&j.send(JSON.stringify({type:"resize",rows:$.rows,cols:$.cols}))},100)},j.onmessage=F=>{$.write(F.data)},j.onerror=()=>{$.write(`\r +\x1B[31mConnection error\x1B[0m\r +`),g(!1)},j.onclose=()=>{$.write(`\r +\x1B[33mSession ended\x1B[0m\r +`),g(!1)},$.onData(F=>{j.readyState===WebSocket.OPEN&&j.send(JSON.stringify({type:"input",data:F}))});const P=new ResizeObserver(()=>{if(!(!u.current||!f.current)){try{u.current.fit()}catch{return}f.current.readyState===WebSocket.OPEN&&$.rows>0&&$.cols>0&&f.current.send(JSON.stringify({type:"resize",rows:$.rows,cols:$.cols}))}});P.observe(T),T.__resizeObserver=P}return()=>{a.current&&a.current.__resizeObserver&&(a.current.__resizeObserver.disconnect(),delete a.current.__resizeObserver)}},[e,r,_]);const S=()=>{_(),t()};return v.jsx(hh,{open:e,onOpenChange:S,children:v.jsxs(Bl,{className:"max-w-4xl h-[600px] flex flex-col",children:[v.jsxs(Ll,{children:[v.jsxs(zl,{className:"flex items-center gap-2",children:[v.jsx(ap,{className:"w-5 h-5"}),"Bash: ",n,d&&v.jsx("span",{className:"ml-2 text-xs bg-green-500/20 text-green-500 px-2 py-0.5 rounded-full",children:"Connected"})]}),v.jsxs(t_,{className:"hidden",children:["Interactive bash terminal session for ",n]})]}),v.jsx("div",{className:"flex-1 rounded-lg bg-[#1e1e1e] p-1 min-h-0",style:{overflow:"hidden"},children:v.jsx("div",{ref:a,style:{width:"100%",height:"100%"}})})]})})}var v3=Symbol("radix.slottable");function y3(e){const t=({children:r})=>v.jsx(v.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=v3,t}var zw="AlertDialog",[b3]=yn(zw,[vw]),Ds=vw(),jw=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ds(t);return v.jsx(Gp,{...n,...r,modal:!0})};jw.displayName=zw;var S3="AlertDialogTrigger",w3=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ds(r);return v.jsx(Bw,{...a,...n,ref:t})});w3.displayName=S3;var x3="AlertDialogPortal",Hw=e=>{const{__scopeAlertDialog:t,...r}=e,n=Ds(t);return v.jsx(Xp,{...n,...r})};Hw.displayName=x3;var C3="AlertDialogOverlay",Pw=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ds(r);return v.jsx(ch,{...a,...n,ref:t})});Pw.displayName=C3;var ta="AlertDialogContent",[E3,R3]=b3(ta),k3=y3("AlertDialogContent"),Uw=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...a}=e,c=Ds(r),u=y.useRef(null),f=wt(t,u),m=y.useRef(null);return v.jsx(zO,{contentName:ta,titleName:Iw,docsSlug:"alert-dialog",children:v.jsx(E3,{scope:r,cancelRef:m,children:v.jsxs(uh,{role:"alertdialog",...c,...a,ref:f,onOpenAutoFocus:Ve(a.onOpenAutoFocus,d=>{d.preventDefault(),m.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[v.jsx(k3,{children:n}),v.jsx(A3,{contentRef:u})]})})})});Uw.displayName=ta;var Iw="AlertDialogTitle",$w=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ds(r);return v.jsx(Zp,{...a,...n,ref:t})});$w.displayName=Iw;var Fw="AlertDialogDescription",Ww=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ds(r);return v.jsx(Qp,{...a,...n,ref:t})});Ww.displayName=Fw;var T3="AlertDialogAction",qw=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=Ds(r);return v.jsx(Jp,{...a,...n,ref:t})});qw.displayName=T3;var Vw="AlertDialogCancel",Yw=y.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=R3(Vw,r),c=Ds(r),u=wt(t,a);return v.jsx(Jp,{...c,...n,ref:u})});Yw.displayName=Vw;var A3=({contentRef:e})=>{const t=`\`${ta}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${ta}\` by passing a \`${Fw}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ta}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},D3=jw,M3=Hw,Kw=Pw,Gw=Uw,Xw=qw,Zw=Yw,Qw=$w,Jw=Ww;const hp=D3,N3=M3,ex=y.forwardRef(({className:e,...t},r)=>v.jsx(Kw,{className:Le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));ex.displayName=Kw.displayName;const $u=y.forwardRef(({className:e,...t},r)=>v.jsxs(N3,{children:[v.jsx(ex,{}),v.jsx(Gw,{ref:r,className:Le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));$u.displayName=Gw.displayName;const Fu=({className:e,...t})=>v.jsx("div",{className:Le("flex flex-col space-y-2 text-center sm:text-left",e),...t});Fu.displayName="AlertDialogHeader";const Wu=({className:e,...t})=>v.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Wu.displayName="AlertDialogFooter";const qu=y.forwardRef(({className:e,...t},r)=>v.jsx(Qw,{ref:r,className:Le("text-lg font-semibold",e),...t}));qu.displayName=Qw.displayName;const Vu=y.forwardRef(({className:e,...t},r)=>v.jsx(Jw,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Vu.displayName=Jw.displayName;const Yu=y.forwardRef(({className:e,...t},r)=>v.jsx(Xw,{ref:r,className:Le(Tp(),e),...t}));Yu.displayName=Xw.displayName;const Ku=y.forwardRef(({className:e,...t},r)=>v.jsx(Zw,{ref:r,className:Le(Tp({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ku.displayName=Zw.displayName;function Qb(e){const t=O3(e),r=y.forwardRef((n,a)=>{const{children:c,...u}=n,f=y.Children.toArray(c),m=f.find(L3);if(m){const d=m.props.children,g=f.map(_=>_===m?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:_);return v.jsx(t,{...u,ref:a,children:y.isValidElement(d)?y.cloneElement(d,void 0,g):null})}return v.jsx(t,{...u,ref:a,children:c})});return r.displayName=`${e}.Slot`,r}function O3(e){const t=y.forwardRef((r,n)=>{const{children:a,...c}=r;if(y.isValidElement(a)){const u=j3(a),f=z3(c,a.props);return a.type!==y.Fragment&&(f.ref=n?Ir(n,u):u),y.cloneElement(a,f)}return y.Children.count(a)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var B3=Symbol("radix.slottable");function L3(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B3}function z3(e,t){const r={...t};for(const n in t){const a=e[n],c=t[n];/^on[A-Z]/.test(n)?a&&c?r[n]=(...f)=>{const m=c(...f);return a(...f),m}:a&&(r[n]=a):n==="style"?r[n]={...a,...c}:n==="className"&&(r[n]=[a,c].filter(Boolean).join(" "))}return{...e,...r}}function j3(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function H3(e){const t=e+"CollectionProvider",[r,n]=yn(t),[a,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:k,children:T}=C,$=ue.useRef(null),z=ue.useRef(new Map).current;return v.jsx(a,{scope:k,itemMap:z,collectionRef:$,children:T})};u.displayName=t;const f=e+"CollectionSlot",m=Qb(f),d=ue.forwardRef((C,k)=>{const{scope:T,children:$}=C,z=c(f,T),A=wt(k,z.collectionRef);return v.jsx(m,{ref:A,children:$})});d.displayName=f;const g=e+"CollectionItemSlot",_="data-radix-collection-item",S=Qb(g),w=ue.forwardRef((C,k)=>{const{scope:T,children:$,...z}=C,A=ue.useRef(null),j=wt(k,A),P=c(g,T);return ue.useEffect(()=>(P.itemMap.set(A,{ref:A,...z}),()=>{P.itemMap.delete(A)})),v.jsx(S,{[_]:"",ref:j,children:$})});w.displayName=g;function x(C){const k=c(e+"CollectionConsumer",C);return ue.useCallback(()=>{const $=k.collectionRef.current;if(!$)return[];const z=Array.from($.querySelectorAll(`[${_}]`));return Array.from(k.itemMap.values()).sort((P,F)=>z.indexOf(P.ref.current)-z.indexOf(F.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:u,Slot:d,ItemSlot:w},x,n]}var P3=y.createContext(void 0);function i_(e){const t=y.useContext(P3);return e||t||"ltr"}var dm="rovingFocusGroup.onEntryFocus",U3={bubbles:!1,cancelable:!0},jl="RovingFocusGroup",[dp,tx,I3]=H3(jl),[$3,ix]=yn(jl,[I3]),[F3,W3]=$3(jl),rx=y.forwardRef((e,t)=>v.jsx(dp.Provider,{scope:e.__scopeRovingFocusGroup,children:v.jsx(dp.Slot,{scope:e.__scopeRovingFocusGroup,children:v.jsx(q3,{...e,ref:t})})}));rx.displayName=jl;var q3=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:m,onEntryFocus:d,preventScrollOnEntryFocus:g=!1,..._}=e,S=y.useRef(null),w=wt(t,S),x=i_(c),[C,k]=oh({prop:u,defaultProp:f??null,onChange:m,caller:jl}),[T,$]=y.useState(!1),z=Ti(d),A=tx(r),j=y.useRef(!1),[P,F]=y.useState(0);return y.useEffect(()=>{const G=S.current;if(G)return G.addEventListener(dm,z),()=>G.removeEventListener(dm,z)},[z]),v.jsx(F3,{scope:r,orientation:n,dir:x,loop:a,currentTabStopId:C,onItemFocus:y.useCallback(G=>k(G),[k]),onItemShiftTab:y.useCallback(()=>$(!0),[]),onFocusableItemAdd:y.useCallback(()=>F(G=>G+1),[]),onFocusableItemRemove:y.useCallback(()=>F(G=>G-1),[]),children:v.jsx($e.div,{tabIndex:T||P===0?-1:0,"data-orientation":n,..._,ref:w,style:{outline:"none",...e.style},onMouseDown:Ve(e.onMouseDown,()=>{j.current=!0}),onFocus:Ve(e.onFocus,G=>{const re=!j.current;if(G.target===G.currentTarget&&re&&!T){const le=new CustomEvent(dm,U3);if(G.currentTarget.dispatchEvent(le),!le.defaultPrevented){const ce=A().filter(R=>R.focusable),W=ce.find(R=>R.active),M=ce.find(R=>R.id===C),N=[W,M,...ce].filter(Boolean).map(R=>R.ref.current);ox(N,g)}}j.current=!1}),onBlur:Ve(e.onBlur,()=>$(!1))})})}),sx="RovingFocusGroupItem",nx=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:c,children:u,...f}=e,m=cr(),d=c||m,g=W3(sx,r),_=g.currentTabStopId===d,S=tx(r),{onFocusableItemAdd:w,onFocusableItemRemove:x,currentTabStopId:C}=g;return y.useEffect(()=>{if(n)return w(),()=>x()},[n,w,x]),v.jsx(dp.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:v.jsx($e.span,{tabIndex:_?0:-1,"data-orientation":g.orientation,...f,ref:t,onMouseDown:Ve(e.onMouseDown,k=>{n?g.onItemFocus(d):k.preventDefault()}),onFocus:Ve(e.onFocus,()=>g.onItemFocus(d)),onKeyDown:Ve(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){g.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const T=K3(k,g.orientation,g.dir);if(T!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let z=S().filter(A=>A.focusable).map(A=>A.ref.current);if(T==="last")z.reverse();else if(T==="prev"||T==="next"){T==="prev"&&z.reverse();const A=z.indexOf(k.currentTarget);z=g.loop?G3(z,A+1):z.slice(A+1)}setTimeout(()=>ox(z))}}),children:typeof u=="function"?u({isCurrentTabStop:_,hasTabStop:C!=null}):u})})});nx.displayName=sx;var V3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Y3(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function K3(e,t,r){const n=Y3(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return V3[n]}function ox(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function G3(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var X3=rx,Z3=nx,dh="Tabs",[Q3]=yn(dh,[ix]),ax=ix(),[J3,r_]=Q3(dh),lx=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:a,defaultValue:c,orientation:u="horizontal",dir:f,activationMode:m="automatic",...d}=e,g=i_(f),[_,S]=oh({prop:n,onChange:a,defaultProp:c??"",caller:dh});return v.jsx(J3,{scope:r,baseId:cr(),value:_,onValueChange:S,orientation:u,dir:g,activationMode:m,children:v.jsx($e.div,{dir:g,"data-orientation":u,...d,ref:t})})});lx.displayName=dh;var cx="TabsList",ux=y.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...a}=e,c=r_(cx,r),u=ax(r);return v.jsx(X3,{asChild:!0,...u,orientation:c.orientation,dir:c.dir,loop:n,children:v.jsx($e.div,{role:"tablist","aria-orientation":c.orientation,...a,ref:t})})});ux.displayName=cx;var hx="TabsTrigger",dx=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:a=!1,...c}=e,u=r_(hx,r),f=ax(r),m=px(u.baseId,n),d=_x(u.baseId,n),g=n===u.value;return v.jsx(Z3,{asChild:!0,...f,focusable:!a,active:g,children:v.jsx($e.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":d,"data-state":g?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:m,...c,ref:t,onMouseDown:Ve(e.onMouseDown,_=>{!a&&_.button===0&&_.ctrlKey===!1?u.onValueChange(n):_.preventDefault()}),onKeyDown:Ve(e.onKeyDown,_=>{[" ","Enter"].includes(_.key)&&u.onValueChange(n)}),onFocus:Ve(e.onFocus,()=>{const _=u.activationMode!=="manual";!g&&!a&&_&&u.onValueChange(n)})})})});dx.displayName=hx;var fx="TabsContent",mx=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:a,children:c,...u}=e,f=r_(fx,r),m=px(f.baseId,n),d=_x(f.baseId,n),g=n===f.value,_=y.useRef(g);return y.useEffect(()=>{const S=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(S)},[]),v.jsx(wr,{present:a||g,children:({present:S})=>v.jsx($e.div,{"data-state":g?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":m,hidden:!S,id:d,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:_.current?"0s":void 0},children:S&&c})})});mx.displayName=fx;function px(e,t){return`${e}-trigger-${t}`}function _x(e,t){return`${e}-content-${t}`}var e4=lx,gx=ux,vx=dx,yx=mx;const bx=e4,s_=y.forwardRef(({className:e,...t},r)=>v.jsx(gx,{ref:r,className:Le("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));s_.displayName=gx.displayName;const Rl=y.forwardRef(({className:e,...t},r)=>v.jsx(vx,{ref:r,className:Le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Rl.displayName=vx.displayName;const fp=y.forwardRef(({className:e,...t},r)=>v.jsx(yx,{ref:r,className:Le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));fp.displayName=yx.displayName;const t4=kp("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function mp({className:e,variant:t,...r}){return v.jsx("div",{className:Le(t4({variant:t}),e),...r})}function i4({isOpen:e,onClose:t}){const[r,n]=y.useState("ghosts"),[a,c]=y.useState({}),[u,f]=y.useState(!1),[m,d]=y.useState([]),[g,_]=y.useState(!1),[S,w]=y.useState(!1),[x,C]=y.useState(null),[k,T]=y.useState(!1),[$,z]=y.useState(!1),[A,j]=y.useState(null);y.useEffect(()=>{e&&r==="ghosts"?P():C(null)},[e,r]);const P=async()=>{f(!0);try{const N=await(await at("/system/orphans")).json();c(N),d([])}catch(H){console.error("Failed to fetch orphans:",H)}finally{f(!1)}},F=H=>{d(N=>N.includes(H)?N.filter(R=>R!==H):[...N,H])},G=()=>{const H=Object.values(a).flat().map(N=>N.Id);m.length===H.length?d([]):d(H)},re=()=>{m.length!==0&&T(!0)},le=async()=>{T(!1),_(!0);try{if(!(await at("/system/prune/orphans",{method:"POST",body:JSON.stringify({containerIds:m})})).ok)throw new Error("Purge failed");await P(),jr.success(`Purged ${m.length} ghost container(s)`)}catch(H){console.error("Failed to purge orphans:",H),jr.error("Failed to purge selected containers.")}finally{_(!1)}},ce=H=>{j(H),z(!0)},W=async()=>{if(A){z(!1),w(!0),C(null);try{const N=await(await at("/system/prune/system",{method:"POST",body:JSON.stringify({target:A})})).json();C(N),jr.success(`Successfully pruned ${A}`)}catch(H){console.error(`Failed to prune ${A}: `,H),jr.error(`Failed to prune ${A}.`)}finally{w(!1),j(null)}}},M=Object.values(a).flat().length;return v.jsxs(hh,{open:e,onOpenChange:H=>!H&&t(),children:[v.jsxs(Bl,{className:"max-w-4xl h-[80vh] flex flex-col",children:[v.jsxs(Ll,{children:[v.jsxs(zl,{className:"flex items-center gap-2",children:[v.jsx(eN,{className:"w-5 h-5 text-yellow-500"}),"System Janitor"]}),v.jsx(t_,{children:"Clean up orphaned containers and perform generic system maintenance."})]}),v.jsxs(bx,{value:r,onValueChange:H=>n(H),className:"flex-1 flex flex-col min-h-0 mt-4",children:[v.jsxs(s_,{className:"grid w-full grid-cols-2",children:[v.jsx(Rl,{value:"ghosts",children:"Ghost Hunter"}),v.jsx(Rl,{value:"system",children:"System Cleanup"})]}),v.jsxs(fp,{value:"ghosts",className:"flex-1 overflow-auto flex flex-col mt-4 border rounded-lg p-4 bg-muted/20",children:[v.jsxs("div",{className:"flex justify-between items-center mb-4",children:[v.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:["Detected Orphan Stacks ",v.jsx(mp,{variant:"secondary",children:M})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx(Ie,{variant:"outline",size:"sm",onClick:P,disabled:u,children:"Refresh"}),v.jsxs(Ie,{variant:"destructive",size:"sm",onClick:re,disabled:m.length===0||g,children:[v.jsx(rw,{className:"w-4 h-4 mr-2"}),g?"Purging...":`Purge Selected(${m.length})`]})]})]}),u?v.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Hunting for ghosts..."}):M===0?v.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground",children:[v.jsx(Lb,{className:"w-12 h-12 mb-2 opacity-50"}),v.jsx("p",{children:"No orphaned containers detected."}),v.jsx("p",{className:"text-xs mt-1",children:"Your system is clean!"})]}):v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-2 px-2",children:[v.jsx("input",{type:"checkbox",onChange:G,checked:m.length===M&&M>0,className:"rounded border-gray-300 focus:ring-primary"}),v.jsx("span",{className:"text-sm font-medium",children:"Select All"})]}),Object.entries(a).map(([H,N])=>v.jsxs("div",{className:"mb-6 last:mb-0 bg-card rounded-lg border shadow-sm overflow-hidden",children:[v.jsxs("div",{className:"bg-muted px-4 py-2 border-b font-medium text-sm flex items-center gap-2",children:[v.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500/80"}),"Project: ",H]}),v.jsx("div",{className:"divide-y",children:N.map(R=>v.jsxs("div",{className:"flex items-center gap-4 p-3 hover:bg-muted/50 transition-colors",children:[v.jsx("input",{type:"checkbox",checked:m.includes(R.Id),onChange:()=>F(R.Id),className:"rounded border-gray-300"}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"font-mono text-sm font-semibold truncate",children:R.Names[0]?.replace(/^\//,"")||R.Id.substring(0,12)}),v.jsx(mp,{variant:R.State==="running"?"default":"secondary",className:"text-[10px] h-4",children:R.State})]}),v.jsxs("div",{className:"text-xs text-muted-foreground truncate mt-1",children:["Image: ",R.Image]})]})]},R.Id))})]},H))]})]}),v.jsxs(fp,{value:"system",className:"flex-1 mt-4 p-4 border rounded-lg bg-card",children:[v.jsx("h3",{className:"text-lg font-semibold mb-6",children:"Global Docker Pruning"}),v.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[v.jsxs(Ie,{variant:"outline",className:"h-24 flex flex-col items-center justify-center gap-2",onClick:()=>ce("containers"),disabled:S,children:[v.jsx(Lb,{className:"w-6 h-6 text-orange-500"}),v.jsxs("div",{className:"text-center",children:[v.jsx("div",{className:"font-bold",children:"Prune Containers"}),v.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:"Removes all stopped containers"})]})]}),v.jsxs(Ie,{variant:"outline",className:"h-24 flex flex-col items-center justify-center gap-2",onClick:()=>ce("images"),disabled:S,children:[v.jsx(HM,{className:"w-6 h-6 text-blue-500"}),v.jsxs("div",{className:"text-center",children:[v.jsx("div",{className:"font-bold",children:"Prune Images"}),v.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:"Removes unused & dangling images"})]})]}),v.jsxs(Ie,{variant:"outline",className:"h-24 flex flex-col items-center justify-center gap-2",onClick:()=>ce("networks"),disabled:S,children:[v.jsx(J1,{className:"w-6 h-6 text-green-500"}),v.jsxs("div",{className:"text-center",children:[v.jsx("div",{className:"font-bold",children:"Prune Networks"}),v.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:"Removes all unused networks"})]})]})]}),x&&v.jsxs("div",{className:"bg-muted p-4 rounded-lg font-mono text-sm overflow-x-auto whitespace-pre-wrap",children:[v.jsx("div",{className:"font-bold mb-2",children:"Result:"}),v.jsx("div",{className:"text-green-600 dark:text-green-400",children:x.message}),x.stdout&&v.jsx("div",{className:"mt-2 text-foreground",children:x.stdout}),x.stderr&&v.jsx("div",{className:"mt-2 text-red-500",children:x.stderr})]})]})]})]}),v.jsx(hp,{open:k,onOpenChange:T,children:v.jsxs($u,{children:[v.jsxs(Fu,{children:[v.jsx(qu,{children:"Forcefully Remove Containers"}),v.jsxs(Vu,{children:["Are you sure you want to forcefully remove ",m.length," ghost container(s)?"]})]}),v.jsxs(Wu,{children:[v.jsx(Ku,{onClick:()=>T(!1),children:"Cancel"}),v.jsx(Yu,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:le,children:"Remove"})]})]})}),v.jsx(hp,{open:$,onOpenChange:z,children:v.jsxs($u,{children:[v.jsxs(Fu,{children:[v.jsxs(qu,{children:["Prune ",A]}),v.jsxs(Vu,{children:["Are you sure you want to prune all unused ",A,"? This cannot be undone."]})]}),v.jsxs(Wu,{children:[v.jsx(Ku,{onClick:()=>z(!1),children:"Cancel"}),v.jsx(Yu,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:W,children:"Prune"})]})]})})]})}var Jb=1,r4=.9,s4=.8,n4=.17,fm=.1,mm=.999,o4=.9999,a4=.99,l4=/[\\\/_+.#"@\[\(\{&]/,c4=/[\\\/_+.#"@\[\(\{&]/g,u4=/[\s-]/,Sx=/[\s-]/g;function pp(e,t,r,n,a,c,u){if(c===t.length)return a===e.length?Jb:a4;var f=`${a},${c}`;if(u[f]!==void 0)return u[f];for(var m=n.charAt(c),d=r.indexOf(m,a),g=0,_,S,w,x;d>=0;)_=pp(e,t,r,n,d+1,c+1,u),_>g&&(d===a?_*=Jb:l4.test(e.charAt(d-1))?(_*=s4,w=e.slice(a,d-1).match(c4),w&&a>0&&(_*=Math.pow(mm,w.length))):u4.test(e.charAt(d-1))?(_*=r4,x=e.slice(a,d-1).match(Sx),x&&a>0&&(_*=Math.pow(mm,x.length))):(_*=n4,a>0&&(_*=Math.pow(mm,d-a))),e.charAt(d)!==t.charAt(c)&&(_*=o4)),(__&&(_=S*fm)),_>g&&(g=_),d=r.indexOf(m,d+1);return u[f]=g,g}function eS(e){return e.toLowerCase().replace(Sx," ")}function h4(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,pp(e,t,eS(e),eS(t),0,0,{})}var hl='[cmdk-group=""]',pm='[cmdk-group-items=""]',d4='[cmdk-group-heading=""]',wx='[cmdk-item=""]',tS=`${wx}:not([aria-disabled="true"])`,_p="cmdk-item-select",Go="data-value",f4=(e,t,r)=>h4(e,t,r),xx=y.createContext(void 0),Hl=()=>y.useContext(xx),Cx=y.createContext(void 0),n_=()=>y.useContext(Cx),Ex=y.createContext(void 0),Rx=y.forwardRef((e,t)=>{let r=Xo(()=>{var O,q;return{search:"",value:(q=(O=e.value)!=null?O:e.defaultValue)!=null?q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Xo(()=>new Set),a=Xo(()=>new Map),c=Xo(()=>new Map),u=Xo(()=>new Set),f=kx(e),{label:m,children:d,value:g,onValueChange:_,filter:S,shouldFilter:w,loop:x,disablePointerSelection:C=!1,vimBindings:k=!0,...T}=e,$=cr(),z=cr(),A=cr(),j=y.useRef(null),P=C4();Zn(()=>{if(g!==void 0){let O=g.trim();r.current.value=O,F.emit()}},[g]),Zn(()=>{P(6,M)},[]);let F=y.useMemo(()=>({subscribe:O=>(u.current.add(O),()=>u.current.delete(O)),snapshot:()=>r.current,setState:(O,q,Q)=>{var X,ae,de,_e;if(!Object.is(r.current[O],q)){if(r.current[O]=q,O==="search")W(),le(),P(1,ce);else if(O==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let me=document.getElementById(A);me?me.focus():(X=document.getElementById($))==null||X.focus()}if(P(7,()=>{var me;r.current.selectedItemId=(me=H())==null?void 0:me.id,F.emit()}),Q||P(5,M),((ae=f.current)==null?void 0:ae.value)!==void 0){let me=q??"";(_e=(de=f.current).onValueChange)==null||_e.call(de,me);return}}F.emit()}},emit:()=>{u.current.forEach(O=>O())}}),[]),G=y.useMemo(()=>({value:(O,q,Q)=>{var X;q!==((X=c.current.get(O))==null?void 0:X.value)&&(c.current.set(O,{value:q,keywords:Q}),r.current.filtered.items.set(O,re(q,Q)),P(2,()=>{le(),F.emit()}))},item:(O,q)=>(n.current.add(O),q&&(a.current.has(q)?a.current.get(q).add(O):a.current.set(q,new Set([O]))),P(3,()=>{W(),le(),r.current.value||ce(),F.emit()}),()=>{c.current.delete(O),n.current.delete(O),r.current.filtered.items.delete(O);let Q=H();P(4,()=>{W(),Q?.getAttribute("id")===O&&ce(),F.emit()})}),group:O=>(a.current.has(O)||a.current.set(O,new Set),()=>{c.current.delete(O),a.current.delete(O)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:$,inputId:A,labelId:z,listInnerRef:j}),[]);function re(O,q){var Q,X;let ae=(X=(Q=f.current)==null?void 0:Q.filter)!=null?X:f4;return O?ae(O,r.current.search,q):0}function le(){if(!r.current.search||f.current.shouldFilter===!1)return;let O=r.current.filtered.items,q=[];r.current.filtered.groups.forEach(X=>{let ae=a.current.get(X),de=0;ae.forEach(_e=>{let me=O.get(_e);de=Math.max(me,de)}),q.push([X,de])});let Q=j.current;N().sort((X,ae)=>{var de,_e;let me=X.getAttribute("id"),Je=ae.getAttribute("id");return((de=O.get(Je))!=null?de:0)-((_e=O.get(me))!=null?_e:0)}).forEach(X=>{let ae=X.closest(pm);ae?ae.appendChild(X.parentElement===ae?X:X.closest(`${pm} > *`)):Q.appendChild(X.parentElement===Q?X:X.closest(`${pm} > *`))}),q.sort((X,ae)=>ae[1]-X[1]).forEach(X=>{var ae;let de=(ae=j.current)==null?void 0:ae.querySelector(`${hl}[${Go}="${encodeURIComponent(X[0])}"]`);de?.parentElement.appendChild(de)})}function ce(){let O=N().find(Q=>Q.getAttribute("aria-disabled")!=="true"),q=O?.getAttribute(Go);F.setState("value",q||void 0)}function W(){var O,q,Q,X;if(!r.current.search||f.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ae=0;for(let de of n.current){let _e=(q=(O=c.current.get(de))==null?void 0:O.value)!=null?q:"",me=(X=(Q=c.current.get(de))==null?void 0:Q.keywords)!=null?X:[],Je=re(_e,me);r.current.filtered.items.set(de,Je),Je>0&&ae++}for(let[de,_e]of a.current)for(let me of _e)if(r.current.filtered.items.get(me)>0){r.current.filtered.groups.add(de);break}r.current.filtered.count=ae}function M(){var O,q,Q;let X=H();X&&(((O=X.parentElement)==null?void 0:O.firstChild)===X&&((Q=(q=X.closest(hl))==null?void 0:q.querySelector(d4))==null||Q.scrollIntoView({block:"nearest"})),X.scrollIntoView({block:"nearest"}))}function H(){var O;return(O=j.current)==null?void 0:O.querySelector(`${wx}[aria-selected="true"]`)}function N(){var O;return Array.from(((O=j.current)==null?void 0:O.querySelectorAll(tS))||[])}function R(O){let q=N()[O];q&&F.setState("value",q.getAttribute(Go))}function L(O){var q;let Q=H(),X=N(),ae=X.findIndex(_e=>_e===Q),de=X[ae+O];(q=f.current)!=null&&q.loop&&(de=ae+O<0?X[X.length-1]:ae+O===X.length?X[0]:X[ae+O]),de&&F.setState("value",de.getAttribute(Go))}function U(O){let q=H(),Q=q?.closest(hl),X;for(;Q&&!X;)Q=O>0?w4(Q,hl):x4(Q,hl),X=Q?.querySelector(tS);X?F.setState("value",X.getAttribute(Go)):L(O)}let se=()=>R(N().length-1),ee=O=>{O.preventDefault(),O.metaKey?se():O.altKey?U(1):L(1)},D=O=>{O.preventDefault(),O.metaKey?R(0):O.altKey?U(-1):L(-1)};return y.createElement($e.div,{ref:t,tabIndex:-1,...T,"cmdk-root":"",onKeyDown:O=>{var q;(q=T.onKeyDown)==null||q.call(T,O);let Q=O.nativeEvent.isComposing||O.keyCode===229;if(!(O.defaultPrevented||Q))switch(O.key){case"n":case"j":{k&&O.ctrlKey&&ee(O);break}case"ArrowDown":{ee(O);break}case"p":case"k":{k&&O.ctrlKey&&D(O);break}case"ArrowUp":{D(O);break}case"Home":{O.preventDefault(),R(0);break}case"End":{O.preventDefault(),se();break}case"Enter":{O.preventDefault();let X=H();if(X){let ae=new Event(_p);X.dispatchEvent(ae)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:G.inputId,id:G.labelId,style:R4},m),fh(e,O=>y.createElement(Cx.Provider,{value:F},y.createElement(xx.Provider,{value:G},O))))}),m4=y.forwardRef((e,t)=>{var r,n;let a=cr(),c=y.useRef(null),u=y.useContext(Ex),f=Hl(),m=kx(e),d=(n=(r=m.current)==null?void 0:r.forceMount)!=null?n:u?.forceMount;Zn(()=>{if(!d)return f.item(a,u?.id)},[d]);let g=Tx(a,c,[e.value,e.children,c],e.keywords),_=n_(),S=pn(P=>P.value&&P.value===g.current),w=pn(P=>d||f.filter()===!1?!0:P.search?P.filtered.items.get(a)>0:!0);y.useEffect(()=>{let P=c.current;if(!(!P||e.disabled))return P.addEventListener(_p,x),()=>P.removeEventListener(_p,x)},[w,e.onSelect,e.disabled]);function x(){var P,F;C(),(F=(P=m.current).onSelect)==null||F.call(P,g.current)}function C(){_.setState("value",g.current,!0)}if(!w)return null;let{disabled:k,value:T,onSelect:$,forceMount:z,keywords:A,...j}=e;return y.createElement($e.div,{ref:Ir(c,t),...j,id:a,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!S,"data-disabled":!!k,"data-selected":!!S,onPointerMove:k||f.getDisablePointerSelection()?void 0:C,onClick:k?void 0:x},e.children)}),p4=y.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...c}=e,u=cr(),f=y.useRef(null),m=y.useRef(null),d=cr(),g=Hl(),_=pn(w=>a||g.filter()===!1?!0:w.search?w.filtered.groups.has(u):!0);Zn(()=>g.group(u),[]),Tx(u,f,[e.value,e.heading,m]);let S=y.useMemo(()=>({id:u,forceMount:a}),[a]);return y.createElement($e.div,{ref:Ir(f,t),...c,"cmdk-group":"",role:"presentation",hidden:_?void 0:!0},r&&y.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),fh(e,w=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},y.createElement(Ex.Provider,{value:S},w))))}),_4=y.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=y.useRef(null),c=pn(u=>!u.search);return!r&&!c?null:y.createElement($e.div,{ref:Ir(a,t),...n,"cmdk-separator":"",role:"separator"})}),g4=y.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,c=n_(),u=pn(d=>d.search),f=pn(d=>d.selectedItemId),m=Hl();return y.useEffect(()=>{e.value!=null&&c.setState("search",e.value)},[e.value]),y.createElement($e.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:a?e.value:u,onChange:d=>{a||c.setState("search",d.target.value),r?.(d.target.value)}})}),v4=y.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,c=y.useRef(null),u=y.useRef(null),f=pn(d=>d.selectedItemId),m=Hl();return y.useEffect(()=>{if(u.current&&c.current){let d=u.current,g=c.current,_,S=new ResizeObserver(()=>{_=requestAnimationFrame(()=>{let w=d.offsetHeight;g.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return S.observe(d),()=>{cancelAnimationFrame(_),S.unobserve(d)}}},[]),y.createElement($e.div,{ref:Ir(c,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":n,id:m.listId},fh(e,d=>y.createElement("div",{ref:Ir(u,m.listInnerRef),"cmdk-list-sizer":""},d)))}),y4=y.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:c,container:u,...f}=e;return y.createElement(Gp,{open:r,onOpenChange:n},y.createElement(Xp,{container:u},y.createElement(ch,{"cmdk-overlay":"",className:a}),y.createElement(uh,{"aria-label":e.label,"cmdk-dialog":"",className:c},y.createElement(Rx,{ref:t,...f}))))}),b4=y.forwardRef((e,t)=>pn(r=>r.filtered.count===0)?y.createElement($e.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),S4=y.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...c}=e;return y.createElement($e.div,{ref:t,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},fh(e,u=>y.createElement("div",{"aria-hidden":!0},u)))}),Ai=Object.assign(Rx,{List:v4,Item:m4,Input:g4,Group:p4,Separator:_4,Dialog:y4,Empty:b4,Loading:S4});function w4(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function x4(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function kx(e){let t=y.useRef(e);return Zn(()=>{t.current=e}),t}var Zn=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Xo(e){let t=y.useRef();return t.current===void 0&&(t.current=e()),t}function pn(e){let t=n_(),r=()=>e(t.snapshot());return y.useSyncExternalStore(t.subscribe,r,r)}function Tx(e,t,r,n=[]){let a=y.useRef(),c=Hl();return Zn(()=>{var u;let f=(()=>{var d;for(let g of r){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(d=g.current.textContent)==null?void 0:d.trim():a.current}})(),m=n.map(d=>d.trim());c.value(e,f,m),(u=t.current)==null||u.setAttribute(Go,f),a.current=f}),a}var C4=()=>{let[e,t]=y.useState(),r=Xo(()=>new Map);return Zn(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function E4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function fh({asChild:e,children:t},r){return e&&y.isValidElement(t)?y.cloneElement(E4(t),{ref:t.ref},r(t.props.children)):r(t)}var R4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ax=y.forwardRef(({className:e,...t},r)=>v.jsx(Ai,{ref:r,className:Le("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ax.displayName=Ai.displayName;const Dx=y.forwardRef(({className:e,...t},r)=>v.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[v.jsx(tw,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),v.jsx(Ai.Input,{ref:r,className:Le("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));Dx.displayName=Ai.Input.displayName;const Mx=y.forwardRef(({className:e,...t},r)=>v.jsx(Ai.List,{ref:r,className:Le("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Mx.displayName=Ai.List.displayName;const k4=y.forwardRef((e,t)=>v.jsx(Ai.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));k4.displayName=Ai.Empty.displayName;const T4=y.forwardRef(({className:e,...t},r)=>v.jsx(Ai.Group,{ref:r,className:Le("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));T4.displayName=Ai.Group.displayName;const A4=y.forwardRef(({className:e,...t},r)=>v.jsx(Ai.Separator,{ref:r,className:Le("-mx-1 h-px bg-border",e),...t}));A4.displayName=Ai.Separator.displayName;const Nx=y.forwardRef(({className:e,...t},r)=>v.jsx(Ai.Item,{ref:r,className:Le("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));Nx.displayName=Ai.Item.displayName;function D4(e,[t,r]){return Math.min(r,Math.max(t,e))}function M4(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var o_="ScrollArea",[Ox]=yn(o_),[N4,ur]=Ox(o_),Bx=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:c=600,...u}=e,[f,m]=y.useState(null),[d,g]=y.useState(null),[_,S]=y.useState(null),[w,x]=y.useState(null),[C,k]=y.useState(null),[T,$]=y.useState(0),[z,A]=y.useState(0),[j,P]=y.useState(!1),[F,G]=y.useState(!1),re=wt(t,ce=>m(ce)),le=i_(a);return v.jsx(N4,{scope:r,type:n,dir:le,scrollHideDelay:c,scrollArea:f,viewport:d,onViewportChange:g,content:_,onContentChange:S,scrollbarX:w,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:P,scrollbarY:C,onScrollbarYChange:k,scrollbarYEnabled:F,onScrollbarYEnabledChange:G,onCornerWidthChange:$,onCornerHeightChange:A,children:v.jsx($e.div,{dir:le,...u,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":T+"px","--radix-scroll-area-corner-height":z+"px",...e.style}})})});Bx.displayName=o_;var Lx="ScrollAreaViewport",zx=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...c}=e,u=ur(Lx,r),f=y.useRef(null),m=wt(t,f,u.onViewportChange);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),v.jsx($e.div,{"data-radix-scroll-area-viewport":"",...c,ref:m,style:{overflowX:u.scrollbarXEnabled?"scroll":"hidden",overflowY:u.scrollbarYEnabled?"scroll":"hidden",...e.style},children:v.jsx("div",{ref:u.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});zx.displayName=Lx;var qr="ScrollAreaScrollbar",a_=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=ur(qr,e.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:u}=a,f=e.orientation==="horizontal";return y.useEffect(()=>(f?c(!0):u(!0),()=>{f?c(!1):u(!1)}),[f,c,u]),a.type==="hover"?v.jsx(O4,{...n,ref:t,forceMount:r}):a.type==="scroll"?v.jsx(B4,{...n,ref:t,forceMount:r}):a.type==="auto"?v.jsx(jx,{...n,ref:t,forceMount:r}):a.type==="always"?v.jsx(l_,{...n,ref:t}):null});a_.displayName=qr;var O4=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=ur(qr,e.__scopeScrollArea),[c,u]=y.useState(!1);return y.useEffect(()=>{const f=a.scrollArea;let m=0;if(f){const d=()=>{window.clearTimeout(m),u(!0)},g=()=>{m=window.setTimeout(()=>u(!1),a.scrollHideDelay)};return f.addEventListener("pointerenter",d),f.addEventListener("pointerleave",g),()=>{window.clearTimeout(m),f.removeEventListener("pointerenter",d),f.removeEventListener("pointerleave",g)}}},[a.scrollArea,a.scrollHideDelay]),v.jsx(wr,{present:r||c,children:v.jsx(jx,{"data-state":c?"visible":"hidden",...n,ref:t})})}),B4=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=ur(qr,e.__scopeScrollArea),c=e.orientation==="horizontal",u=ph(()=>m("SCROLL_END"),100),[f,m]=M4("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(f==="idle"){const d=window.setTimeout(()=>m("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[f,a.scrollHideDelay,m]),y.useEffect(()=>{const d=a.viewport,g=c?"scrollLeft":"scrollTop";if(d){let _=d[g];const S=()=>{const w=d[g];_!==w&&(m("SCROLL"),u()),_=w};return d.addEventListener("scroll",S),()=>d.removeEventListener("scroll",S)}},[a.viewport,c,m,u]),v.jsx(wr,{present:r||f!=="hidden",children:v.jsx(l_,{"data-state":f==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Ve(e.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:Ve(e.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),jx=y.forwardRef((e,t)=>{const r=ur(qr,e.__scopeScrollArea),{forceMount:n,...a}=e,[c,u]=y.useState(!1),f=e.orientation==="horizontal",m=ph(()=>{if(r.viewport){const d=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,a=ur(qr,e.__scopeScrollArea),c=y.useRef(null),u=y.useRef(0),[f,m]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=$x(f.viewport,f.content),g={...n,sizes:f,onSizesChange:m,hasThumb:d>0&&d<1,onThumbChange:S=>c.current=S,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:S=>u.current=S};function _(S,w){return U4(S,u.current,f,w)}return r==="horizontal"?v.jsx(L4,{...g,ref:t,onThumbPositionChange:()=>{if(a.viewport&&c.current){const S=a.viewport.scrollLeft,w=iS(S,f,a.dir);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:S=>{a.viewport&&(a.viewport.scrollLeft=S)},onDragScroll:S=>{a.viewport&&(a.viewport.scrollLeft=_(S,a.dir))}}):r==="vertical"?v.jsx(z4,{...g,ref:t,onThumbPositionChange:()=>{if(a.viewport&&c.current){const S=a.viewport.scrollTop,w=iS(S,f);c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:S=>{a.viewport&&(a.viewport.scrollTop=S)},onDragScroll:S=>{a.viewport&&(a.viewport.scrollTop=_(S))}}):null}),L4=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,c=ur(qr,e.__scopeScrollArea),[u,f]=y.useState(),m=y.useRef(null),d=wt(t,m,c.onScrollbarXChange);return y.useEffect(()=>{m.current&&f(getComputedStyle(m.current))},[m]),v.jsx(Px,{"data-orientation":"horizontal",...a,ref:d,sizes:r,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":mh(r)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,_)=>{if(c.viewport){const S=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(S),Wx(S,_)&&g.preventDefault()}},onResize:()=>{m.current&&c.viewport&&u&&n({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:Xu(u.paddingLeft),paddingEnd:Xu(u.paddingRight)}})}})}),z4=y.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,c=ur(qr,e.__scopeScrollArea),[u,f]=y.useState(),m=y.useRef(null),d=wt(t,m,c.onScrollbarYChange);return y.useEffect(()=>{m.current&&f(getComputedStyle(m.current))},[m]),v.jsx(Px,{"data-orientation":"vertical",...a,ref:d,sizes:r,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":mh(r)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,_)=>{if(c.viewport){const S=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(S),Wx(S,_)&&g.preventDefault()}},onResize:()=>{m.current&&c.viewport&&u&&n({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:Xu(u.paddingTop),paddingEnd:Xu(u.paddingBottom)}})}})}),[j4,Hx]=Ox(qr),Px=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:c,onThumbPointerUp:u,onThumbPointerDown:f,onThumbPositionChange:m,onDragScroll:d,onWheelScroll:g,onResize:_,...S}=e,w=ur(qr,r),[x,C]=y.useState(null),k=wt(t,re=>C(re)),T=y.useRef(null),$=y.useRef(""),z=w.viewport,A=n.content-n.viewport,j=Ti(g),P=Ti(m),F=ph(_,10);function G(re){if(T.current){const le=re.clientX-T.current.left,ce=re.clientY-T.current.top;d({x:le,y:ce})}}return y.useEffect(()=>{const re=le=>{const ce=le.target;x?.contains(ce)&&j(le,A)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[z,x,A,j]),y.useEffect(P,[n,P]),sa(x,F),sa(w.content,F),v.jsx(j4,{scope:r,scrollbar:x,hasThumb:a,onThumbChange:Ti(c),onThumbPointerUp:Ti(u),onThumbPositionChange:P,onThumbPointerDown:Ti(f),children:v.jsx($e.div,{...S,ref:k,style:{position:"absolute",...S.style},onPointerDown:Ve(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),T.current=x.getBoundingClientRect(),$.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),G(re))}),onPointerMove:Ve(e.onPointerMove,G),onPointerUp:Ve(e.onPointerUp,re=>{const le=re.target;le.hasPointerCapture(re.pointerId)&&le.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=$.current,w.viewport&&(w.viewport.style.scrollBehavior=""),T.current=null})})})}),Gu="ScrollAreaThumb",Ux=y.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Hx(Gu,e.__scopeScrollArea);return v.jsx(wr,{present:r||a.hasThumb,children:v.jsx(H4,{ref:t,...n})})}),H4=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,c=ur(Gu,r),u=Hx(Gu,r),{onThumbPositionChange:f}=u,m=wt(t,_=>u.onThumbChange(_)),d=y.useRef(void 0),g=ph(()=>{d.current&&(d.current(),d.current=void 0)},100);return y.useEffect(()=>{const _=c.viewport;if(_){const S=()=>{if(g(),!d.current){const w=I4(_,f);d.current=w,f()}};return f(),_.addEventListener("scroll",S),()=>_.removeEventListener("scroll",S)}},[c.viewport,g,f]),v.jsx($e.div,{"data-state":u.hasThumb?"visible":"hidden",...a,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ve(e.onPointerDownCapture,_=>{const w=_.target.getBoundingClientRect(),x=_.clientX-w.left,C=_.clientY-w.top;u.onThumbPointerDown({x,y:C})}),onPointerUp:Ve(e.onPointerUp,u.onThumbPointerUp)})});Ux.displayName=Gu;var c_="ScrollAreaCorner",Ix=y.forwardRef((e,t)=>{const r=ur(c_,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?v.jsx(P4,{...e,ref:t}):null});Ix.displayName=c_;var P4=y.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=ur(c_,r),[c,u]=y.useState(0),[f,m]=y.useState(0),d=!!(c&&f);return sa(a.scrollbarX,()=>{const g=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(g),m(g)}),sa(a.scrollbarY,()=>{const g=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(g),u(g)}),d?v.jsx($e.div,{...n,ref:t,style:{width:c,height:f,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Xu(e){return e?parseInt(e,10):0}function $x(e,t){const r=e/t;return isNaN(r)?0:r}function mh(e){const t=$x(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function U4(e,t,r,n="ltr"){const a=mh(r),c=a/2,u=t||c,f=a-u,m=r.scrollbar.paddingStart+u,d=r.scrollbar.size-r.scrollbar.paddingEnd-f,g=r.content-r.viewport,_=n==="ltr"?[0,g]:[g*-1,0];return Fx([m,d],_)(e)}function iS(e,t,r="ltr"){const n=mh(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,c=t.scrollbar.size-a,u=t.content-t.viewport,f=c-n,m=r==="ltr"?[0,u]:[u*-1,0],d=D4(e,m);return Fx([0,u],[0,f])(d)}function Fx(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Wx(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function a(){const c={left:e.scrollLeft,top:e.scrollTop},u=r.left!==c.left,f=r.top!==c.top;(u||f)&&t(),r=c,n=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(n)};function ph(e,t){const r=Ti(e),n=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),y.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function sa(e,t){const r=Ti(t);Es(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var qx=Bx,$4=zx,F4=Ix;const Vx=y.forwardRef(({className:e,children:t,...r},n)=>v.jsxs(qx,{ref:n,className:Le("relative overflow-hidden",e),...r,children:[v.jsx($4,{className:"h-full w-full rounded-[inherit]",children:t}),v.jsx(Yx,{}),v.jsx(F4,{})]}));Vx.displayName=qx.displayName;const Yx=y.forwardRef(({className:e,orientation:t="vertical",...r},n)=>v.jsx(a_,{ref:n,orientation:t,className:Le("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:v.jsx(Ux,{className:"relative flex-1 rounded-full bg-border"})}));Yx.displayName=a_.displayName;function _m({className:e,...t}){return v.jsx("div",{className:Le("animate-pulse rounded-md bg-primary/10",e),...t})}const W4=["top","right","bottom","left"],_n=Math.min,qi=Math.max,Zu=Math.round,_u=Math.floor,Ur=e=>({x:e,y:e}),q4={left:"right",right:"left",bottom:"top",top:"bottom"},V4={start:"end",end:"start"};function gp(e,t,r){return qi(e,_n(t,r))}function Rs(e,t){return typeof e=="function"?e(t):e}function ks(e){return e.split("-")[0]}function ua(e){return e.split("-")[1]}function u_(e){return e==="x"?"y":"x"}function h_(e){return e==="y"?"height":"width"}const Y4=new Set(["top","bottom"]);function Hr(e){return Y4.has(ks(e))?"y":"x"}function d_(e){return u_(Hr(e))}function K4(e,t,r){r===void 0&&(r=!1);const n=ua(e),a=d_(e),c=h_(a);let u=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Qu(u)),[u,Qu(u)]}function G4(e){const t=Qu(e);return[vp(e),t,vp(t)]}function vp(e){return e.replace(/start|end/g,t=>V4[t])}const rS=["left","right"],sS=["right","left"],X4=["top","bottom"],Z4=["bottom","top"];function Q4(e,t,r){switch(e){case"top":case"bottom":return r?t?sS:rS:t?rS:sS;case"left":case"right":return t?X4:Z4;default:return[]}}function J4(e,t,r,n){const a=ua(e);let c=Q4(ks(e),r==="start",n);return a&&(c=c.map(u=>u+"-"+a),t&&(c=c.concat(c.map(vp)))),c}function Qu(e){return e.replace(/left|right|bottom|top/g,t=>q4[t])}function eB(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kx(e){return typeof e!="number"?eB(e):{top:e,right:e,bottom:e,left:e}}function Ju(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function nS(e,t,r){let{reference:n,floating:a}=e;const c=Hr(t),u=d_(t),f=h_(u),m=ks(t),d=c==="y",g=n.x+n.width/2-a.width/2,_=n.y+n.height/2-a.height/2,S=n[f]/2-a[f]/2;let w;switch(m){case"top":w={x:g,y:n.y-a.height};break;case"bottom":w={x:g,y:n.y+n.height};break;case"right":w={x:n.x+n.width,y:_};break;case"left":w={x:n.x-a.width,y:_};break;default:w={x:n.x,y:n.y}}switch(ua(t)){case"start":w[u]-=S*(r&&d?-1:1);break;case"end":w[u]+=S*(r&&d?-1:1);break}return w}async function tB(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:c,rects:u,elements:f,strategy:m}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:_="floating",altBoundary:S=!1,padding:w=0}=Rs(t,e),x=Kx(w),k=f[S?_==="floating"?"reference":"floating":_],T=Ju(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(k)))==null||r?k:k.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:d,rootBoundary:g,strategy:m})),$=_==="floating"?{x:n,y:a,width:u.floating.width,height:u.floating.height}:u.reference,z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),A=await(c.isElement==null?void 0:c.isElement(z))?await(c.getScale==null?void 0:c.getScale(z))||{x:1,y:1}:{x:1,y:1},j=Ju(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:$,offsetParent:z,strategy:m}):$);return{top:(T.top-j.top+x.top)/A.y,bottom:(j.bottom-T.bottom+x.bottom)/A.y,left:(T.left-j.left+x.left)/A.x,right:(j.right-T.right+x.right)/A.x}}const iB=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:c=[],platform:u}=r,f=c.filter(Boolean),m=await(u.isRTL==null?void 0:u.isRTL(t));let d=await u.getElementRects({reference:e,floating:t,strategy:a}),{x:g,y:_}=nS(d,n,m),S=n,w={},x=0;for(let k=0;k({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:c,platform:u,elements:f,middlewareData:m}=t,{element:d,padding:g=0}=Rs(e,t)||{};if(d==null)return{};const _=Kx(g),S={x:r,y:n},w=d_(a),x=h_(w),C=await u.getDimensions(d),k=w==="y",T=k?"top":"left",$=k?"bottom":"right",z=k?"clientHeight":"clientWidth",A=c.reference[x]+c.reference[w]-S[w]-c.floating[x],j=S[w]-c.reference[w],P=await(u.getOffsetParent==null?void 0:u.getOffsetParent(d));let F=P?P[z]:0;(!F||!await(u.isElement==null?void 0:u.isElement(P)))&&(F=f.floating[z]||c.floating[x]);const G=A/2-j/2,re=F/2-C[x]/2-1,le=_n(_[T],re),ce=_n(_[$],re),W=le,M=F-C[x]-ce,H=F/2-C[x]/2+G,N=gp(W,H,M),R=!m.arrow&&ua(a)!=null&&H!==N&&c.reference[x]/2-(HH<=0)){var ce,W;const H=(((ce=c.flip)==null?void 0:ce.index)||0)+1,N=F[H];if(N&&(!(_==="alignment"?$!==Hr(N):!1)||le.every(U=>Hr(U.placement)===$?U.overflows[0]>0:!0)))return{data:{index:H,overflows:le},reset:{placement:N}};let R=(W=le.filter(L=>L.overflows[0]<=0).sort((L,U)=>L.overflows[1]-U.overflows[1])[0])==null?void 0:W.placement;if(!R)switch(w){case"bestFit":{var M;const L=(M=le.filter(U=>{if(P){const se=Hr(U.placement);return se===$||se==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(se=>se>0).reduce((se,ee)=>se+ee,0)]).sort((U,se)=>U[1]-se[1])[0])==null?void 0:M[0];L&&(R=L);break}case"initialPlacement":R=f;break}if(a!==R)return{reset:{placement:R}}}return{}}}};function oS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aS(e){return W4.some(t=>e[t]>=0)}const nB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...c}=Rs(e,t);switch(a){case"referenceHidden":{const u=await n.detectOverflow(t,{...c,elementContext:"reference"}),f=oS(u,r.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:aS(f)}}}case"escaped":{const u=await n.detectOverflow(t,{...c,altBoundary:!0}),f=oS(u,r.floating);return{data:{escapedOffsets:f,escaped:aS(f)}}}default:return{}}}}},Gx=new Set(["left","top"]);async function oB(e,t){const{placement:r,platform:n,elements:a}=e,c=await(n.isRTL==null?void 0:n.isRTL(a.floating)),u=ks(r),f=ua(r),m=Hr(r)==="y",d=Gx.has(u)?-1:1,g=c&&m?-1:1,_=Rs(t,e);let{mainAxis:S,crossAxis:w,alignmentAxis:x}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return f&&typeof x=="number"&&(w=f==="end"?x*-1:x),m?{x:w*g,y:S*d}:{x:S*d,y:w*g}}const aB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:c,placement:u,middlewareData:f}=t,m=await oB(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(n=f.arrow)!=null&&n.alignmentOffset?{}:{x:a+m.x,y:c+m.y,data:{...m,placement:u}}}}},lB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:c}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:m={fn:T=>{let{x:$,y:z}=T;return{x:$,y:z}}},...d}=Rs(e,t),g={x:r,y:n},_=await c.detectOverflow(t,d),S=Hr(ks(a)),w=u_(S);let x=g[w],C=g[S];if(u){const T=w==="y"?"top":"left",$=w==="y"?"bottom":"right",z=x+_[T],A=x-_[$];x=gp(z,x,A)}if(f){const T=S==="y"?"top":"left",$=S==="y"?"bottom":"right",z=C+_[T],A=C-_[$];C=gp(z,C,A)}const k=m.fn({...t,[w]:x,[S]:C});return{...k,data:{x:k.x-r,y:k.y-n,enabled:{[w]:u,[S]:f}}}}}},cB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:m=!0,crossAxis:d=!0}=Rs(e,t),g={x:r,y:n},_=Hr(a),S=u_(_);let w=g[S],x=g[_];const C=Rs(f,t),k=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(m){const z=S==="y"?"height":"width",A=c.reference[S]-c.floating[z]+k.mainAxis,j=c.reference[S]+c.reference[z]-k.mainAxis;wj&&(w=j)}if(d){var T,$;const z=S==="y"?"width":"height",A=Gx.has(ks(a)),j=c.reference[_]-c.floating[z]+(A&&((T=u.offset)==null?void 0:T[_])||0)+(A?0:k.crossAxis),P=c.reference[_]+c.reference[z]+(A?0:(($=u.offset)==null?void 0:$[_])||0)-(A?k.crossAxis:0);xP&&(x=P)}return{[S]:w,[_]:x}}}},uB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:c,platform:u,elements:f}=t,{apply:m=()=>{},...d}=Rs(e,t),g=await u.detectOverflow(t,d),_=ks(a),S=ua(a),w=Hr(a)==="y",{width:x,height:C}=c.floating;let k,T;_==="top"||_==="bottom"?(k=_,T=S===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(T=_,k=S==="end"?"top":"bottom");const $=C-g.top-g.bottom,z=x-g.left-g.right,A=_n(C-g[k],$),j=_n(x-g[T],z),P=!t.middlewareData.shift;let F=A,G=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(G=z),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(F=$),P&&!S){const le=qi(g.left,0),ce=qi(g.right,0),W=qi(g.top,0),M=qi(g.bottom,0);w?G=x-2*(le!==0||ce!==0?le+ce:qi(g.left,g.right)):F=C-2*(W!==0||M!==0?W+M:qi(g.top,g.bottom))}await m({...t,availableWidth:G,availableHeight:F});const re=await u.getDimensions(f.floating);return x!==re.width||C!==re.height?{reset:{rects:!0}}:{}}}};function _h(){return typeof window<"u"}function ha(e){return Xx(e)?(e.nodeName||"").toLowerCase():"#document"}function Vi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Vr(e){var t;return(t=(Xx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xx(e){return _h()?e instanceof Node||e instanceof Vi(e).Node:!1}function br(e){return _h()?e instanceof Element||e instanceof Vi(e).Element:!1}function Wr(e){return _h()?e instanceof HTMLElement||e instanceof Vi(e).HTMLElement:!1}function lS(e){return!_h()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vi(e).ShadowRoot}const hB=new Set(["inline","contents"]);function Pl(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Sr(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!hB.has(a)}const dB=new Set(["table","td","th"]);function fB(e){return dB.has(ha(e))}const mB=[":popover-open",":modal"];function gh(e){return mB.some(t=>{try{return e.matches(t)}catch{return!1}})}const pB=["transform","translate","scale","rotate","perspective"],_B=["transform","translate","scale","rotate","perspective","filter"],gB=["paint","layout","strict","content"];function f_(e){const t=m_(),r=br(e)?Sr(e):e;return pB.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||_B.some(n=>(r.willChange||"").includes(n))||gB.some(n=>(r.contain||"").includes(n))}function vB(e){let t=gn(e);for(;Wr(t)&&!na(t);){if(f_(t))return t;if(gh(t))return null;t=gn(t)}return null}function m_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yB=new Set(["html","body","#document"]);function na(e){return yB.has(ha(e))}function Sr(e){return Vi(e).getComputedStyle(e)}function vh(e){return br(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gn(e){if(ha(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lS(e)&&e.host||Vr(e);return lS(t)?t.host:t}function Zx(e){const t=gn(e);return na(t)?e.ownerDocument?e.ownerDocument.body:e.body:Wr(t)&&Pl(t)?t:Zx(t)}function kl(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=Zx(e),c=a===((n=e.ownerDocument)==null?void 0:n.body),u=Vi(a);if(c){const f=yp(u);return t.concat(u,u.visualViewport||[],Pl(a)?a:[],f&&r?kl(f):[])}return t.concat(a,kl(a,[],r))}function yp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qx(e){const t=Sr(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Wr(e),c=a?e.offsetWidth:r,u=a?e.offsetHeight:n,f=Zu(r)!==c||Zu(n)!==u;return f&&(r=c,n=u),{width:r,height:n,$:f}}function p_(e){return br(e)?e:e.contextElement}function ia(e){const t=p_(e);if(!Wr(t))return Ur(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:c}=Qx(t);let u=(c?Zu(r.width):r.width)/n,f=(c?Zu(r.height):r.height)/a;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const bB=Ur(0);function Jx(e){const t=Vi(e);return!m_()||!t.visualViewport?bB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SB(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Vi(e)?!1:t}function Qn(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),c=p_(e);let u=Ur(1);t&&(n?br(n)&&(u=ia(n)):u=ia(e));const f=SB(c,r,n)?Jx(c):Ur(0);let m=(a.left+f.x)/u.x,d=(a.top+f.y)/u.y,g=a.width/u.x,_=a.height/u.y;if(c){const S=Vi(c),w=n&&br(n)?Vi(n):n;let x=S,C=yp(x);for(;C&&n&&w!==x;){const k=ia(C),T=C.getBoundingClientRect(),$=Sr(C),z=T.left+(C.clientLeft+parseFloat($.paddingLeft))*k.x,A=T.top+(C.clientTop+parseFloat($.paddingTop))*k.y;m*=k.x,d*=k.y,g*=k.x,_*=k.y,m+=z,d+=A,x=Vi(C),C=yp(x)}}return Ju({width:g,height:_,x:m,y:d})}function yh(e,t){const r=vh(e).scrollLeft;return t?t.left+r:Qn(Vr(e)).left+r}function eC(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-yh(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function wB(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const c=a==="fixed",u=Vr(n),f=t?gh(t.floating):!1;if(n===u||f&&c)return r;let m={scrollLeft:0,scrollTop:0},d=Ur(1);const g=Ur(0),_=Wr(n);if((_||!_&&!c)&&((ha(n)!=="body"||Pl(u))&&(m=vh(n)),Wr(n))){const w=Qn(n);d=ia(n),g.x=w.x+n.clientLeft,g.y=w.y+n.clientTop}const S=u&&!_&&!c?eC(u,m):Ur(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-m.scrollLeft*d.x+g.x+S.x,y:r.y*d.y-m.scrollTop*d.y+g.y+S.y}}function xB(e){return Array.from(e.getClientRects())}function CB(e){const t=Vr(e),r=vh(e),n=e.ownerDocument.body,a=qi(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),c=qi(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let u=-r.scrollLeft+yh(e);const f=-r.scrollTop;return Sr(n).direction==="rtl"&&(u+=qi(t.clientWidth,n.clientWidth)-a),{width:a,height:c,x:u,y:f}}const cS=25;function EB(e,t){const r=Vi(e),n=Vr(e),a=r.visualViewport;let c=n.clientWidth,u=n.clientHeight,f=0,m=0;if(a){c=a.width,u=a.height;const g=m_();(!g||g&&t==="fixed")&&(f=a.offsetLeft,m=a.offsetTop)}const d=yh(n);if(d<=0){const g=n.ownerDocument,_=g.body,S=getComputedStyle(_),w=g.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,x=Math.abs(n.clientWidth-_.clientWidth-w);x<=cS&&(c-=x)}else d<=cS&&(c+=d);return{width:c,height:u,x:f,y:m}}const RB=new Set(["absolute","fixed"]);function kB(e,t){const r=Qn(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,c=Wr(e)?ia(e):Ur(1),u=e.clientWidth*c.x,f=e.clientHeight*c.y,m=a*c.x,d=n*c.y;return{width:u,height:f,x:m,y:d}}function uS(e,t,r){let n;if(t==="viewport")n=EB(e,r);else if(t==="document")n=CB(Vr(e));else if(br(t))n=kB(t,r);else{const a=Jx(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ju(n)}function tC(e,t){const r=gn(e);return r===t||!br(r)||na(r)?!1:Sr(r).position==="fixed"||tC(r,t)}function TB(e,t){const r=t.get(e);if(r)return r;let n=kl(e,[],!1).filter(f=>br(f)&&ha(f)!=="body"),a=null;const c=Sr(e).position==="fixed";let u=c?gn(e):e;for(;br(u)&&!na(u);){const f=Sr(u),m=f_(u);!m&&f.position==="fixed"&&(a=null),(c?!m&&!a:!m&&f.position==="static"&&!!a&&RB.has(a.position)||Pl(u)&&!m&&tC(e,u))?n=n.filter(g=>g!==u):a=f,u=gn(u)}return t.set(e,n),n}function AB(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const u=[...r==="clippingAncestors"?gh(t)?[]:TB(t,this._c):[].concat(r),n],f=u[0],m=u.reduce((d,g)=>{const _=uS(t,g,a);return d.top=qi(_.top,d.top),d.right=_n(_.right,d.right),d.bottom=_n(_.bottom,d.bottom),d.left=qi(_.left,d.left),d},uS(t,f,a));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function DB(e){const{width:t,height:r}=Qx(e);return{width:t,height:r}}function MB(e,t,r){const n=Wr(t),a=Vr(t),c=r==="fixed",u=Qn(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const m=Ur(0);function d(){m.x=yh(a)}if(n||!n&&!c)if((ha(t)!=="body"||Pl(a))&&(f=vh(t)),n){const w=Qn(t,!0,c,t);m.x=w.x+t.clientLeft,m.y=w.y+t.clientTop}else a&&d();c&&!n&&a&&d();const g=a&&!n&&!c?eC(a,f):Ur(0),_=u.left+f.scrollLeft-m.x-g.x,S=u.top+f.scrollTop-m.y-g.y;return{x:_,y:S,width:u.width,height:u.height}}function gm(e){return Sr(e).position==="static"}function hS(e,t){if(!Wr(e)||Sr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Vr(e)===r&&(r=r.ownerDocument.body),r}function iC(e,t){const r=Vi(e);if(gh(e))return r;if(!Wr(e)){let a=gn(e);for(;a&&!na(a);){if(br(a)&&!gm(a))return a;a=gn(a)}return r}let n=hS(e,t);for(;n&&fB(n)&&gm(n);)n=hS(n,t);return n&&na(n)&&gm(n)&&!f_(n)?r:n||vB(e)||r}const NB=async function(e){const t=this.getOffsetParent||iC,r=this.getDimensions,n=await r(e.floating);return{reference:MB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function OB(e){return Sr(e).direction==="rtl"}const BB={convertOffsetParentRelativeRectToViewportRelativeRect:wB,getDocumentElement:Vr,getClippingRect:AB,getOffsetParent:iC,getElementRects:NB,getClientRects:xB,getDimensions:DB,getScale:ia,isElement:br,isRTL:OB};function rC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function LB(e,t){let r=null,n;const a=Vr(e);function c(){var f;clearTimeout(n),(f=r)==null||f.disconnect(),r=null}function u(f,m){f===void 0&&(f=!1),m===void 0&&(m=1),c();const d=e.getBoundingClientRect(),{left:g,top:_,width:S,height:w}=d;if(f||t(),!S||!w)return;const x=_u(_),C=_u(a.clientWidth-(g+S)),k=_u(a.clientHeight-(_+w)),T=_u(g),z={rootMargin:-x+"px "+-C+"px "+-k+"px "+-T+"px",threshold:qi(0,_n(1,m))||1};let A=!0;function j(P){const F=P[0].intersectionRatio;if(F!==m){if(!A)return u();F?u(!1,F):n=setTimeout(()=>{u(!1,1e-7)},1e3)}F===1&&!rC(d,e.getBoundingClientRect())&&u(),A=!1}try{r=new IntersectionObserver(j,{...z,root:a.ownerDocument})}catch{r=new IntersectionObserver(j,z)}r.observe(e)}return u(!0),c}function zB(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=n,d=p_(e),g=a||c?[...d?kl(d):[],...kl(t)]:[];g.forEach(T=>{a&&T.addEventListener("scroll",r,{passive:!0}),c&&T.addEventListener("resize",r)});const _=d&&f?LB(d,r):null;let S=-1,w=null;u&&(w=new ResizeObserver(T=>{let[$]=T;$&&$.target===d&&w&&(w.unobserve(t),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var z;(z=w)==null||z.observe(t)})),r()}),d&&!m&&w.observe(d),w.observe(t));let x,C=m?Qn(e):null;m&&k();function k(){const T=Qn(e);C&&!rC(C,T)&&r(),C=T,x=requestAnimationFrame(k)}return r(),()=>{var T;g.forEach($=>{a&&$.removeEventListener("scroll",r),c&&$.removeEventListener("resize",r)}),_?.(),(T=w)==null||T.disconnect(),w=null,m&&cancelAnimationFrame(x)}}const jB=aB,HB=lB,PB=sB,UB=uB,IB=nB,dS=rB,$B=cB,FB=(e,t,r)=>{const n=new Map,a={platform:BB,...r},c={...a.platform,_c:n};return iB(e,t,{...a,platform:c})};var WB=typeof document<"u",qB=function(){},Du=WB?y.useLayoutEffect:qB;function eh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!eh(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const c=a[n];if(!(c==="_owner"&&e.$$typeof)&&!eh(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function sC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fS(e,t){const r=sC(e);return Math.round(t*r)/r}function vm(e){const t=y.useRef(e);return Du(()=>{t.current=e}),t}function VB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:m,open:d}=e,[g,_]=y.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[S,w]=y.useState(n);eh(S,n)||w(n);const[x,C]=y.useState(null),[k,T]=y.useState(null),$=y.useCallback(U=>{U!==P.current&&(P.current=U,C(U))},[]),z=y.useCallback(U=>{U!==F.current&&(F.current=U,T(U))},[]),A=c||x,j=u||k,P=y.useRef(null),F=y.useRef(null),G=y.useRef(g),re=m!=null,le=vm(m),ce=vm(a),W=vm(d),M=y.useCallback(()=>{if(!P.current||!F.current)return;const U={placement:t,strategy:r,middleware:S};ce.current&&(U.platform=ce.current),FB(P.current,F.current,U).then(se=>{const ee={...se,isPositioned:W.current!==!1};H.current&&!eh(G.current,ee)&&(G.current=ee,Dp.flushSync(()=>{_(ee)}))})},[S,t,r,ce,W]);Du(()=>{d===!1&&G.current.isPositioned&&(G.current.isPositioned=!1,_(U=>({...U,isPositioned:!1})))},[d]);const H=y.useRef(!1);Du(()=>(H.current=!0,()=>{H.current=!1}),[]),Du(()=>{if(A&&(P.current=A),j&&(F.current=j),A&&j){if(le.current)return le.current(A,j,M);M()}},[A,j,M,le,re]);const N=y.useMemo(()=>({reference:P,floating:F,setReference:$,setFloating:z}),[$,z]),R=y.useMemo(()=>({reference:A,floating:j}),[A,j]),L=y.useMemo(()=>{const U={position:r,left:0,top:0};if(!R.floating)return U;const se=fS(R.floating,g.x),ee=fS(R.floating,g.y);return f?{...U,transform:"translate("+se+"px, "+ee+"px)",...sC(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:se,top:ee}},[r,f,R.floating,g.x,g.y]);return y.useMemo(()=>({...g,update:M,refs:N,elements:R,floatingStyles:L}),[g,M,N,R,L])}const YB=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?dS({element:n.current,padding:a}).fn(r):{}:n?dS({element:n,padding:a}).fn(r):{}}}},KB=(e,t)=>({...jB(e),options:[e,t]}),GB=(e,t)=>({...HB(e),options:[e,t]}),XB=(e,t)=>({...$B(e),options:[e,t]}),ZB=(e,t)=>({...PB(e),options:[e,t]}),QB=(e,t)=>({...UB(e),options:[e,t]}),JB=(e,t)=>({...IB(e),options:[e,t]}),eL=(e,t)=>({...YB(e),options:[e,t]});var tL="Arrow",nC=y.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...c}=e;return v.jsx($e.svg,{...c,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});nC.displayName=tL;var iL=nC;function rL(e){const[t,r]=y.useState(void 0);return Es(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const c=a[0];let u,f;if("borderBoxSize"in c){const m=c.borderBoxSize,d=Array.isArray(m)?m[0]:m;u=d.inlineSize,f=d.blockSize}else u=e.offsetWidth,f=e.offsetHeight;r({width:u,height:f})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var __="Popper",[oC,aC]=yn(__),[sL,lC]=oC(__),cC=e=>{const{__scopePopper:t,children:r}=e,[n,a]=y.useState(null);return v.jsx(sL,{scope:t,anchor:n,onAnchorChange:a,children:r})};cC.displayName=__;var uC="PopperAnchor",hC=y.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,c=lC(uC,r),u=y.useRef(null),f=wt(t,u),m=y.useRef(null);return y.useEffect(()=>{const d=m.current;m.current=n?.current||u.current,d!==m.current&&c.onAnchorChange(m.current)}),n?null:v.jsx($e.div,{...a,ref:f})});hC.displayName=uC;var g_="PopperContent",[nL,oL]=oC(g_),dC=y.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:c="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:m=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:_="partial",hideWhenDetached:S=!1,updatePositionStrategy:w="optimized",onPlaced:x,...C}=e,k=lC(g_,r),[T,$]=y.useState(null),z=wt(t,de=>$(de)),[A,j]=y.useState(null),P=rL(A),F=P?.width??0,G=P?.height??0,re=n+(c!=="center"?"-"+c:""),le=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},ce=Array.isArray(d)?d:[d],W=ce.length>0,M={padding:le,boundary:ce.filter(lL),altBoundary:W},{refs:H,floatingStyles:N,placement:R,isPositioned:L,middlewareData:U}=VB({strategy:"fixed",placement:re,whileElementsMounted:(...de)=>zB(...de,{animationFrame:w==="always"}),elements:{reference:k.anchor},middleware:[KB({mainAxis:a+G,alignmentAxis:u}),m&&GB({mainAxis:!0,crossAxis:!1,limiter:_==="partial"?XB():void 0,...M}),m&&ZB({...M}),QB({...M,apply:({elements:de,rects:_e,availableWidth:me,availableHeight:Je})=>{const{width:ot,height:Ke}=_e.reference,Re=de.floating.style;Re.setProperty("--radix-popper-available-width",`${me}px`),Re.setProperty("--radix-popper-available-height",`${Je}px`),Re.setProperty("--radix-popper-anchor-width",`${ot}px`),Re.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),A&&eL({element:A,padding:f}),cL({arrowWidth:F,arrowHeight:G}),S&&JB({strategy:"referenceHidden",...M})]}),[se,ee]=pC(R),D=Ti(x);Es(()=>{L&&D?.()},[L,D]);const O=U.arrow?.x,q=U.arrow?.y,Q=U.arrow?.centerOffset!==0,[X,ae]=y.useState();return Es(()=>{T&&ae(window.getComputedStyle(T).zIndex)},[T]),v.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:L?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(nL,{scope:r,placedSide:se,onArrowChange:j,arrowX:O,arrowY:q,shouldHideArrow:Q,children:v.jsx($e.div,{"data-side":se,"data-align":ee,...C,ref:z,style:{...C.style,animation:L?void 0:"none"}})})})});dC.displayName=g_;var fC="PopperArrow",aL={top:"bottom",right:"left",bottom:"top",left:"right"},mC=y.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,c=oL(fC,n),u=aL[c.placedSide];return v.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:v.jsx(iL,{...a,ref:r,style:{...a.style,display:"block"}})})});mC.displayName=fC;function lL(e){return e!==null}var cL=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,u=a.arrow?.centerOffset!==0,f=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[d,g]=pC(r),_={start:"0%",center:"50%",end:"100%"}[g],S=(a.arrow?.x??0)+f/2,w=(a.arrow?.y??0)+m/2;let x="",C="";return d==="bottom"?(x=u?_:`${S}px`,C=`${-m}px`):d==="top"?(x=u?_:`${S}px`,C=`${n.floating.height+m}px`):d==="right"?(x=`${-m}px`,C=u?_:`${w}px`):d==="left"&&(x=`${n.floating.width+m}px`,C=u?_:`${w}px`),{data:{x,y:C}}}});function pC(e){const[t,r="center"]=e.split("-");return[t,r]}var uL=cC,hL=hC,dL=dC,fL=mC,mL=Symbol("radix.slottable");function pL(e){const t=({children:r})=>v.jsx(v.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=mL,t}var _L=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),gL="VisuallyHidden",_C=y.forwardRef((e,t)=>v.jsx($e.span,{...e,ref:t,style:{..._L,...e.style}}));_C.displayName=gL;var vL=_C,[bh]=yn("Tooltip",[aC]),Sh=aC(),gC="TooltipProvider",yL=700,bp="tooltip.open",[bL,v_]=bh(gC),vC=e=>{const{__scopeTooltip:t,delayDuration:r=yL,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:c}=e,u=y.useRef(!0),f=y.useRef(!1),m=y.useRef(0);return y.useEffect(()=>{const d=m.current;return()=>window.clearTimeout(d)},[]),v.jsx(bL,{scope:t,isOpenDelayedRef:u,delayDuration:r,onOpen:y.useCallback(()=>{window.clearTimeout(m.current),u.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>u.current=!0,n)},[n]),isPointerInTransitRef:f,onPointerInTransitChange:y.useCallback(d=>{f.current=d},[]),disableHoverableContent:a,children:c})};vC.displayName=gC;var Tl="Tooltip",[SL,Ul]=bh(Tl),yC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:c,disableHoverableContent:u,delayDuration:f}=e,m=v_(Tl,e.__scopeTooltip),d=Sh(t),[g,_]=y.useState(null),S=cr(),w=y.useRef(0),x=u??m.disableHoverableContent,C=f??m.delayDuration,k=y.useRef(!1),[T,$]=oh({prop:n,defaultProp:a??!1,onChange:F=>{F?(m.onOpen(),document.dispatchEvent(new CustomEvent(bp))):m.onClose(),c?.(F)},caller:Tl}),z=y.useMemo(()=>T?k.current?"delayed-open":"instant-open":"closed",[T]),A=y.useCallback(()=>{window.clearTimeout(w.current),w.current=0,k.current=!1,$(!0)},[$]),j=y.useCallback(()=>{window.clearTimeout(w.current),w.current=0,$(!1)},[$]),P=y.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{k.current=!0,$(!0),w.current=0},C)},[C,$]);return y.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),v.jsx(uL,{...d,children:v.jsx(SL,{scope:t,contentId:S,open:T,stateAttribute:z,trigger:g,onTriggerChange:_,onTriggerEnter:y.useCallback(()=>{m.isOpenDelayedRef.current?P():A()},[m.isOpenDelayedRef,P,A]),onTriggerLeave:y.useCallback(()=>{x?j():(window.clearTimeout(w.current),w.current=0)},[j,x]),onOpen:A,onClose:j,disableHoverableContent:x,children:r})})};yC.displayName=Tl;var Sp="TooltipTrigger",bC=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Ul(Sp,r),c=v_(Sp,r),u=Sh(r),f=y.useRef(null),m=wt(t,f,a.onTriggerChange),d=y.useRef(!1),g=y.useRef(!1),_=y.useCallback(()=>d.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",_),[_]),v.jsx(hL,{asChild:!0,...u,children:v.jsx($e.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:m,onPointerMove:Ve(e.onPointerMove,S=>{S.pointerType!=="touch"&&!g.current&&!c.isPointerInTransitRef.current&&(a.onTriggerEnter(),g.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{a.onTriggerLeave(),g.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",_,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:Ve(e.onBlur,a.onClose),onClick:Ve(e.onClick,a.onClose)})})});bC.displayName=Sp;var y_="TooltipPortal",[wL,xL]=bh(y_,{forceMount:void 0}),SC=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:a}=e,c=Ul(y_,t);return v.jsx(wL,{scope:t,forceMount:r,children:v.jsx(wr,{present:r||c.open,children:v.jsx(qp,{asChild:!0,container:a,children:n})})})};SC.displayName=y_;var oa="TooltipContent",wC=y.forwardRef((e,t)=>{const r=xL(oa,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...c}=e,u=Ul(oa,e.__scopeTooltip);return v.jsx(wr,{present:n||u.open,children:u.disableHoverableContent?v.jsx(xC,{side:a,...c,ref:t}):v.jsx(CL,{side:a,...c,ref:t})})}),CL=y.forwardRef((e,t)=>{const r=Ul(oa,e.__scopeTooltip),n=v_(oa,e.__scopeTooltip),a=y.useRef(null),c=wt(t,a),[u,f]=y.useState(null),{trigger:m,onClose:d}=r,g=a.current,{onPointerInTransitChange:_}=n,S=y.useCallback(()=>{f(null),_(!1)},[_]),w=y.useCallback((x,C)=>{const k=x.currentTarget,T={x:x.clientX,y:x.clientY},$=AL(T,k.getBoundingClientRect()),z=DL(T,$),A=ML(C.getBoundingClientRect()),j=OL([...z,...A]);f(j),_(!0)},[_]);return y.useEffect(()=>()=>S(),[S]),y.useEffect(()=>{if(m&&g){const x=k=>w(k,g),C=k=>w(k,m);return m.addEventListener("pointerleave",x),g.addEventListener("pointerleave",C),()=>{m.removeEventListener("pointerleave",x),g.removeEventListener("pointerleave",C)}}},[m,g,w,S]),y.useEffect(()=>{if(u){const x=C=>{const k=C.target,T={x:C.clientX,y:C.clientY},$=m?.contains(k)||g?.contains(k),z=!NL(T,u);$?S():z&&(S(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[m,g,u,d,S]),v.jsx(xC,{...e,ref:c})}),[EL,RL]=bh(Tl,{isInside:!1}),kL=pL("TooltipContent"),xC=y.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:c,onPointerDownOutside:u,...f}=e,m=Ul(oa,r),d=Sh(r),{onClose:g}=m;return y.useEffect(()=>(document.addEventListener(bp,g),()=>document.removeEventListener(bp,g)),[g]),y.useEffect(()=>{if(m.trigger){const _=S=>{S.target?.contains(m.trigger)&&g()};return window.addEventListener("scroll",_,{capture:!0}),()=>window.removeEventListener("scroll",_,{capture:!0})}},[m.trigger,g]),v.jsx(Wp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:_=>_.preventDefault(),onDismiss:g,children:v.jsxs(dL,{"data-state":m.stateAttribute,...d,...f,ref:t,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[v.jsx(kL,{children:n}),v.jsx(EL,{scope:r,isInside:!0,children:v.jsx(vL,{id:m.contentId,role:"tooltip",children:a||n})})]})})});wC.displayName=oa;var CC="TooltipArrow",TL=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Sh(r);return RL(CC,r).isInside?null:v.jsx(fL,{...a,...n,ref:t})});TL.displayName=CC;function AL(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),c=Math.abs(t.left-e.x);switch(Math.min(r,n,a,c)){case c:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function DL(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function ML(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function NL(e,t){const{x:r,y:n}=e;let a=!1;for(let c=0,u=t.length-1;cn!=S>n&&r<(_-d)*(n-g)/(S-g)+d&&(a=!a)}return a}function OL(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),BL(t)}function BL(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const c=t[t.length-1],u=t[t.length-2];if((c.x-u.x)*(a.y-u.y)>=(c.y-u.y)*(a.x-u.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const c=r[r.length-1],u=r[r.length-2];if((c.x-u.x)*(a.y-u.y)>=(c.y-u.y)*(a.x-u.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var LL=vC,zL=yC,jL=bC,HL=SC,EC=wC;const gu=LL,vu=zL,yu=jL,vl=y.forwardRef(({className:e,sideOffset:t=4,...r},n)=>v.jsx(HL,{children:v.jsx(EC,{ref:n,sideOffset:t,className:Le("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r})}));vl.displayName=EC.displayName;const mS=e=>{if(e===0)return"0 B";const t=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(2))+" "+r[n]};function PL(){const{logout:e}=Cp(),[t,r]=y.useState([]),[n,a]=y.useState(null),[c,u]=y.useState(""),[f,m]=y.useState(""),[d,g]=y.useState(""),[_,S]=y.useState(""),[w,x]=y.useState(!1),[C,k]=y.useState([]),[T,$]=y.useState({}),[z,A]=y.useState("compose"),[j,P]=y.useState(!1),[F,G]=y.useState(!1),[re,le]=y.useState(""),[ce,W]=y.useState(null),[M,H]=y.useState(!1),[N,R]=y.useState(!1),[L,U]=y.useState(!1),[se,ee]=y.useState(()=>{const he=localStorage.getItem("sencho-theme");return he!==null?he==="dark":!0}),[D,O]=y.useState(!0),[q,Q]=y.useState(!1),[X,ae]=y.useState(""),[de,_e]=y.useState({}),[me,Je]=y.useState(!1),[ot,Ke]=y.useState(null),[Re,mt]=y.useState(!1);y.useEffect(()=>{const he=document.documentElement;se?(he.classList.add("dark"),localStorage.setItem("sencho-theme","dark")):(he.classList.remove("dark"),localStorage.setItem("sencho-theme","light"))},[se]);const vi=async(he=!1)=>{he||H(!0);try{const Te=await(await at("/stacks")).json();r(Array.isArray(Te)?Te:[]);const Me={};for(const lt of Te)try{const xe=await(await at(`/stacks/${lt}/containers`)).json(),Ge=Array.isArray(xe)&&xe.some(gt=>gt.State==="running");Me[lt]=Ge?"running":Array.isArray(xe)&&xe.length>0?"exited":"unknown"}catch{Me[lt]="unknown"}_e(Me)}catch(Se){console.error("Failed to refresh stacks:",Se),r([])}finally{H(!1)}};y.useEffect(()=>{vi()},[]),y.useEffect(()=>{const he={};return(C||[]).forEach(Se=>{if(Se?.Id)try{const Te=window.location.protocol==="https:"?"wss:":"ws:",Me=new WebSocket(`${Te}//${window.location.host}`);he[Se.Id]=Me,Me.onopen=()=>Me.send(JSON.stringify({action:"streamStats",containerId:Se.Id})),Me.onmessage=lt=>{try{const Ye=JSON.parse(lt.data);if(!Ye.cpu_stats?.cpu_usage||!Ye.precpu_stats?.cpu_usage||!Ye.memory_stats?.usage)return;const xe=Ye.cpu_stats.cpu_usage.total_usage-Ye.precpu_stats.cpu_usage.total_usage,Ge=(Ye.cpu_stats.system_cpu_usage||0)-(Ye.precpu_stats.system_cpu_usage||0),gt=Ye.cpu_stats.online_cpus||1,It=Ge>0?(xe/Ge*gt*100).toFixed(2):"0.00",Er=(Ye.memory_stats.usage/(1024*1024)).toFixed(2)+" MB";let st=0,$t=0;Ye.networks&&Object.values(Ye.networks).forEach(Mi=>{st+=Mi.rx_bytes||0,$t+=Mi.tx_bytes||0}),$(Mi=>{const Ot=Mi[Se.Id],li=Ot?.lastRx!==void 0?Math.max(0,st-Ot.lastRx):0,Ms=Ot?.lastTx!==void 0?Math.max(0,$t-Ot.lastTx):0,Ni=`${mS(li)}/s ↓ / ${mS(Ms)}/s ↑`;return{...Mi,[Se.Id]:{cpu:It+"%",ram:Er,net:Ni,lastRx:st,lastTx:$t}}})}catch{}}}catch{}}),()=>{Object.values(he).forEach(Se=>{try{Se.close()}catch{}})}},[C]);const Yr=async he=>{if(he){U(!0),Q(!1);try{const Te=await(await at(`/stacks/${he}`)).text();a(he),u(Te||""),m(Te||"");try{const Me=await at(`/stacks/${he}/env`);if(Me.ok){const lt=await Me.text();g(lt||""),S(lt||""),x(!0)}else g(""),S(""),x(!1)}catch{g(""),S(""),x(!1)}try{const lt=await(await at(`/stacks/${he}/containers`)).json();k(Array.isArray(lt)?lt:[])}catch(Me){console.error("Failed to load containers:",Me),k([])}}catch(Se){console.error("Failed to load file:",Se),a(null),u(""),m(""),g(""),S(""),k([])}finally{U(!1)}}},Kr=async()=>{if(!n)return;const he=z==="compose"?c||"":d||"",Se=z==="compose"?`/stacks/${n}`:`/stacks/${n}/env`;try{const Te=await at(Se,{method:"PUT",body:JSON.stringify({content:he})});if(!Te.ok)throw new Error(`HTTP ${Te.status}: ${await Te.text()}`);z==="compose"?m(c):S(d),Q(!1),jr.success("File saved successfully!")}catch(Te){console.error("Failed to save file:",Te),jr.error(`Failed to save file: ${Te.message}`)}},bn=()=>{z==="compose"?u(f):g(_),Q(!1)},di=()=>{Q(!0)},Sn=async he=>{if(he.preventDefault(),he.stopPropagation(),!n||N)return;const Se=n.replace(/\.(yml|yaml)$/,"");R(!0);try{await at(`/stacks/${Se}/up`,{method:"POST"});const Me=await(await at(`/stacks/${Se}/containers`)).json();k(Array.isArray(Me)?Me:[]),await vi(!0)}catch(Te){console.error("Failed to deploy:",Te)}finally{R(!1)}},wn=async he=>{if(he.preventDefault(),he.stopPropagation(),!n||N)return;const Se=n.replace(/\.(yml|yaml)$/,"");R(!0);try{await at(`/stacks/${Se}/stop`,{method:"POST"});const Me=await(await at(`/stacks/${Se}/containers`)).json();k(Array.isArray(Me)?Me:[]),await vi(!0)}catch(Te){console.error("Failed to stop:",Te)}finally{R(!1)}},Jt=async he=>{if(he.preventDefault(),he.stopPropagation(),!n||N)return;const Se=n.replace(/\.(yml|yaml)$/,"");R(!0);try{await at(`/stacks/${Se}/start`,{method:"POST"});const Me=await(await at(`/stacks/${Se}/containers`)).json();k(Array.isArray(Me)?Me:[]),await vi(!0)}catch(Te){console.error("Failed to start:",Te)}finally{R(!1)}},Cr=async he=>{if(he.preventDefault(),he.stopPropagation(),!n||N)return;const Se=n.replace(/\.(yml|yaml)$/,"");R(!0);try{await at(`/stacks/${Se}/restart`,{method:"POST"});const Me=await(await at(`/stacks/${Se}/containers`)).json();k(Array.isArray(Me)?Me:[]),await vi(!0)}catch(Te){console.error("Failed to restart:",Te)}finally{R(!1)}},ei=async he=>{if(he.preventDefault(),he.stopPropagation(),!n||N)return;const Se=n.replace(/\.(yml|yaml)$/,"");R(!0);try{await at(`/stacks/${Se}/update`,{method:"POST"});const Me=await(await at(`/stacks/${Se}/containers`)).json();k(Array.isArray(Me)?Me:[]),await vi(!0)}catch(Te){console.error("Failed to update:",Te)}finally{R(!1)}},da=async()=>{if(ce){R(!0);try{if(!(await at(`/stacks/${ce}`,{method:"DELETE"})).ok)throw new Error("Failed to delete stack");G(!1),W(null),n===ce&&(a(null),u(""),m(""),g(""),S(""),x(!1),k([]),Q(!1)),await vi()}catch(he){console.error("Failed to delete stack:",he),jr.error("Failed to delete stack")}finally{R(!1)}}},Gr=async()=>{if(!re.trim())return;const he=re.trim();try{const Se=await at("/stacks",{method:"POST",body:JSON.stringify({stackName:he})});if(!Se.ok)throw Se.status===409?new Error("Stack already exists"):Se.status===400?new Error("Invalid stack name (use alphanumeric characters and hyphens only)"):new Error("Failed to create stack");P(!1),le(""),await vi(),await Yr(he)}catch(Se){console.error("Failed to create stack:",Se),jr.error(Se.message||"Failed to create stack")}},to=(he,Se)=>{Ke({id:he,name:Se}),Je(!0)},Xr=()=>{Je(!1),Ke(null)},hr=C||[],dr=c||"",io=d||"",fr=hr&&hr.length>0,Zr=hr?.some(he=>he.State==="running"),Pt=n||"",Di=t.filter(he=>he.toLowerCase().includes(X.toLowerCase())),Ut=he=>he,ro=he=>{const Se=(he.Status||"").toLowerCase(),Te=(he.State||"").toLowerCase();return Se.includes("(unhealthy)")||Te==="exited"||Te==="dead"?{variant:"destructive",text:he.State}:Se.includes("(starting)")?{variant:"secondary",text:he.State}:{variant:"default",text:he.State}};return v.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[v.jsxs("div",{className:"w-64 border-r border-border bg-card flex flex-col",children:[v.jsxs("div",{className:"h-16 flex items-center justify-between px-4 border-b border-border",children:[v.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Sencho"}),v.jsx(gu,{children:v.jsxs(vu,{children:[v.jsx(yu,{asChild:!0,children:v.jsx(Ie,{variant:"ghost",size:"icon",onClick:e,className:"text-muted-foreground hover:text-foreground",children:v.jsx(DM,{className:"w-5 h-5"})})}),v.jsx(vl,{children:"Logout"})]})})]}),v.jsx("div",{className:"p-4",children:v.jsxs(hh,{open:j,onOpenChange:P,children:[v.jsx(UO,{asChild:!0,children:v.jsxs(Ie,{className:"w-full rounded-lg",children:[v.jsx(ew,{className:"w-4 h-4 mr-2"}),"Create Stack"]})}),v.jsxs(Bl,{children:[v.jsx(Ll,{children:v.jsx(zl,{children:"Create New Stack"})}),v.jsxs("div",{className:"py-4 space-y-2",children:[v.jsx(Cs,{htmlFor:"create-stack-name",children:"Stack Name"}),v.jsx(xs,{id:"create-stack-name",placeholder:"Stack name (e.g., myapp)",value:re,onChange:he=>le(he.target.value)})]}),v.jsx(e_,{children:v.jsx(Ie,{onClick:Gr,children:"Create"})})]})]})}),v.jsxs(Ax,{className:"bg-transparent flex-1 flex flex-col overflow-hidden",children:[v.jsx("div",{className:"px-4 py-2 border-b border-border flex-none",children:v.jsx(Dx,{placeholder:"Search stacks...",value:X,onValueChange:ae,className:"h-9"})}),v.jsx("h3",{className:"text-sm font-semibold text-muted-foreground px-4 py-2 mt-2 flex-none",children:"STACKS"}),v.jsx(Vx,{className:"flex-1 px-2 pb-2",children:v.jsx(Mx,{className:"max-h-none overflow-visible",children:M?v.jsxs("div",{className:"space-y-2 px-2 mt-2",children:[v.jsx(_m,{className:"h-12 w-full"}),v.jsx(_m,{className:"h-12 w-full"}),v.jsx(_m,{className:"h-12 w-full"})]}):(Di||[]).map(he=>v.jsx(Nx,{value:he,onSelect:()=>Yr(he),className:`justify-start rounded-lg mb-1 cursor-pointer ${n===he?"bg-accent text-accent-foreground":""}`,children:v.jsxs("div",{className:"flex items-center gap-2 w-full",children:[v.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${de[he]==="running"?"bg-green-500":de[he]==="exited"?"bg-red-500":"bg-gray-400"}`}),Ut(he)]})},he))})})]})]}),v.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v.jsxs("div",{className:"h-16 flex items-center justify-end px-6 border-b border-border gap-4",children:[v.jsxs(Ie,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>{a(null),u(""),m(""),g(""),S(""),x(!1),k([]),Q(!1)},title:"Go to Home Dashboard",children:[v.jsx(TM,{className:"w-4 h-4 mr-2"}),"Home"]}),v.jsxs(Ie,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>O(!D),children:[v.jsx(ap,{className:"w-4 h-4 mr-2"}),"Console"]}),v.jsxs(Ie,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>mt(!0),title:"System Maintenance",children:[v.jsx(dM,{className:"w-4 h-4 mr-2"}),"Janitor"]}),v.jsx(Ie,{variant:"outline",size:"sm",className:"rounded-lg",onClick:()=>ee(!se),children:se?v.jsxs(v.Fragment,{children:[v.jsx(XM,{className:"w-4 h-4 mr-2"}),"Light"]}):v.jsxs(v.Fragment,{children:[v.jsx(LM,{className:"w-4 h-4 mr-2"}),"Dark"]})})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:!M&&n?v.jsx(jb,{children:v.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-stretch",children:[v.jsxs("div",{className:"flex flex-col h-full gap-6",children:[v.jsxs(or,{className:"rounded-xl border-muted bg-card",children:[v.jsx(gr,{className:"p-4 pb-2",children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(vr,{className:"text-2xl font-bold",children:Pt}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[!fr&&v.jsxs(Ie,{type:"button",size:"sm",className:"rounded-lg",onClick:Sn,disabled:N,children:[v.jsx(zb,{className:"w-4 h-4 mr-2"}),N?"Working...":"Deploy"]}),fr&&v.jsxs(v.Fragment,{children:[Zr?v.jsxs(Ie,{type:"button",size:"sm",variant:"outline",className:"rounded-lg",onClick:wn,disabled:N,children:[v.jsx(iw,{className:"w-4 h-4 mr-2"}),N?"Working...":"Stop"]}):v.jsxs(Ie,{type:"button",size:"sm",className:"rounded-lg",onClick:Jt,disabled:N,children:[v.jsx(zb,{className:"w-4 h-4 mr-2"}),N?"Working...":"Start"]}),v.jsxs(Ie,{type:"button",size:"sm",variant:"outline",className:"rounded-lg",onClick:Cr,disabled:N,children:[v.jsx(WM,{className:"w-4 h-4 mr-2"}),"Restart"]}),v.jsxs(Ie,{type:"button",size:"sm",variant:"outline",className:"rounded-lg",onClick:ei,disabled:N,children:[v.jsx(vM,{className:"w-4 h-4 mr-2"}),"Update"]})]}),v.jsxs(Ie,{type:"button",size:"sm",variant:"destructive",className:"rounded-lg",disabled:N,onClick:()=>{W(n),G(!0)},children:[v.jsx(rw,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})}),v.jsx(yr,{className:"p-4 pt-2",children:v.jsxs("div",{className:"mt-4",children:[v.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"CONTAINERS"}),hr.length===0?v.jsx("div",{className:"text-muted-foreground text-sm",children:"No containers running for this stack."}):v.jsx("div",{className:"flex flex-col gap-3",children:hr.map(he=>{let Se;if(he.Ports&&he.Ports.length>0){const Te=[32400,8989,7878,9696,5055,8080,80,443,3e3,9e3],Me=[1900,53,22];let lt=he.Ports.find(Ye=>Te.includes(Ye.PrivatePort));lt||(lt=he.Ports.find(Ye=>Te.includes(Ye.PublicPort))),lt||(lt=he.Ports.find(Ye=>!Me.includes(Ye.PrivatePort)&&!Me.includes(Ye.PublicPort))),Se=(lt||he.Ports[0]).PublicPort}return v.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[v.jsx("div",{className:"flex flex-col gap-1",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(gu,{children:v.jsxs(vu,{children:[v.jsx(yu,{asChild:!0,children:v.jsx("div",{className:"cursor-help inline-flex",children:v.jsx(mp,{variant:ro(he).variant,className:"text-xs",children:ro(he).text||"unknown"})})}),v.jsx(vl,{children:v.jsx("p",{children:he?.Status||"No status details available"})})]})}),v.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["CPU: ",T[he?.Id]?.cpu||"N/A"," | RAM: ",T[he?.Id]?.ram||"N/A"," | NET: ",T[he?.Id]?.net||"0 B ↓ / 0 B ↑"]})]})}),v.jsxs("div",{className:"flex gap-1",children:[Se&&v.jsx(gu,{children:v.jsxs(vu,{children:[v.jsx(yu,{asChild:!0,children:v.jsxs(Ie,{size:"sm",variant:"outline",className:"rounded-lg h-8 px-2 mr-1",onClick:()=>window.open(`http://${window.location.hostname}:${Se}`,"_blank"),children:[v.jsx(CM,{className:"w-3 h-3 mr-1"}),Se]})}),v.jsxs(vl,{children:["Open App (",Se,")"]})]})}),v.jsx(gu,{children:v.jsxs(vu,{children:[v.jsx(yu,{asChild:!0,children:v.jsx(Ie,{size:"icon",variant:"ghost",className:"rounded-lg h-8 w-8",onClick:()=>to(he?.Id,he?.Names?.[0]?.replace("/","")||"container"),disabled:he?.State!=="running",children:v.jsx(ap,{className:"w-4 h-4"})})}),v.jsx(vl,{children:"Open Bash Terminal"})]})})]})]},he?.Id||Math.random())})})]})})]}),D&&v.jsxs("div",{className:"flex-1 rounded-xl overflow-hidden border border-muted bg-black p-3 min-h-[300px]",children:[v.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Terminal"}),v.jsx("div",{className:"h-[calc(100%-24px)]",children:v.jsx(jb,{children:v.jsx(iN,{stackName:Pt})})})]})]}),v.jsxs(or,{className:"rounded-xl border-muted overflow-hidden flex flex-col h-full min-h-[600px] bg-card",children:[v.jsxs("div",{className:"p-4 border-b border-muted flex items-center justify-between",children:[v.jsx(bx,{value:z,onValueChange:he=>A(he),children:v.jsxs(s_,{className:"bg-muted",children:[v.jsx(Rl,{value:"compose",className:"rounded-lg",children:"compose.yaml"}),v.jsx(Rl,{value:"env",disabled:!w,className:"rounded-lg",children:".env"})]})}),v.jsx("div",{className:"flex gap-2",children:q?v.jsxs(v.Fragment,{children:[v.jsxs(Ie,{size:"sm",variant:"outline",className:"rounded-lg",onClick:bn,children:[v.jsx(Fp,{className:"w-4 h-4 mr-2"}),"Discard"]}),v.jsxs(Ie,{size:"sm",variant:"default",className:"rounded-lg",onClick:Kr,children:[v.jsx(VM,{className:"w-4 h-4 mr-2"}),"Save"]})]}):v.jsxs(Ie,{size:"sm",variant:"default",className:"rounded-lg",onClick:di,children:[v.jsx(UM,{className:"w-4 h-4 mr-2"}),"Edit"]})})]}),v.jsxs("div",{className:"flex-1 min-h-0",children:[!L&&v.jsx(oT,{height:"100%",language:z==="compose"?"yaml":"plaintext",theme:se?"vs-dark":"vs",value:z==="compose"?dr:io,onChange:he=>{q&&(z==="compose"?u(he||""):g(he||""))},options:{minimap:{enabled:!1},fontSize:14,padding:{top:10},scrollBeyondLastLine:!1,readOnly:!q}}),L&&v.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Loading..."})]})]})]})}):v.jsx(_3,{})})]}),v.jsx(hp,{open:F,onOpenChange:G,children:v.jsxs($u,{children:[v.jsxs(Fu,{children:[v.jsx(qu,{children:"Delete Stack"}),v.jsxs(Vu,{children:["Are you sure you want to delete ",ce,"? This action cannot be undone."]})]}),v.jsxs(Wu,{children:[v.jsx(Ku,{onClick:()=>G(!1),children:"Cancel"}),v.jsx(Yu,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:da,children:"Delete"})]})]})}),ot&&v.jsx(g3,{isOpen:me,onClose:Xr,containerId:ot.id,containerName:ot.name}),v.jsx(i4,{isOpen:Re,onClose:()=>mt(!1)})]})}function UL(){const{appStatus:e,isAuthenticated:t,needsSetup:r,completeSetup:n}=Cp();return e==="loading"?v.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:v.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}):r?v.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:v.jsx(ZR,{className:"w-full max-w-sm",onComplete:n})}):t?v.jsx(PL,{}):v.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:v.jsx(XR,{className:"w-full max-w-sm"})})}function IL(){return v.jsxs(YE,{children:[v.jsx(UL,{}),v.jsx(p3,{position:"bottom-right",richColors:!0})]})}VE.createRoot(document.getElementById("root")).render(v.jsx(y.StrictMode,{children:v.jsx(IL,{})})); diff --git a/backend/public/assets/index-dtrnzjcf.css b/backend/public/assets/index-dtrnzjcf.css new file mode 100644 index 00000000..4c7e1bf3 --- /dev/null +++ b/backend/public/assets/index-dtrnzjcf.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-space-x-reverse:0}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-900:oklch(39.6% .141 25.723);--color-orange-500:oklch(70.5% .213 47.604);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-cyan-500:oklch(71.5% .143 215.221);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-500:oklch(62.7% .265 303.9);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-lg:32rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-widest:.1em;--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--shadow:var(--shadow)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);color:var(--foreground)}}@layer components;@layer utilities{.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-2{top:calc(var(--spacing) * 2)}.top-4{top:calc(var(--spacing) * 4)}.top-\[50\%\]{top:50%}.right-4{right:calc(var(--spacing) * 4)}.right-6{right:calc(var(--spacing) * 6)}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-50{z-index:50}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-4{margin:calc(var(--spacing) * 4)}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-\[1px\]{height:1px}.h-\[80vh\]{height:80vh}.h-\[600px\]{height:600px}.h-\[calc\(100\%-24px\)\]{height:calc(100% - 24px)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-\[300px\]{max-height:300px}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[300px\]{min-height:300px}.min-h-\[600px\]{min-height:600px}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-48{width:calc(var(--spacing) * 48)}.w-64{width:calc(var(--spacing) * 64)}.w-\[1px\]{width:1px}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.max-w-4xl{max-width:var(--container-4xl)}.max-w-lg{max-width:var(--container-lg)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:--radix-tooltip-content-transform-origin}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 0) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 0) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-border{border-color:var(--border)}.border-gray-300{border-color:var(--color-gray-300)}.border-input{border-color:var(--input)}.border-muted{border-color:var(--muted)}.border-red-500{border-color:var(--color-red-500)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\[\#1e1e1e\]{background-color:#1e1e1e}.bg-accent{background-color:var(--accent)}.bg-background,.bg-background\/80{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,var(--background) 80%,transparent)}}.bg-background\/95{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/95{background-color:color-mix(in oklab,var(--background) 95%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black) 80%,transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500) 20%,transparent)}}.bg-muted,.bg-muted\/20{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,var(--muted) 20%,transparent)}}.bg-muted\/50{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.bg-popover{background-color:var(--popover)}.bg-primary,.bg-primary\/10{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--primary) 10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-red-900\/20{background-color:#82181a33}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/20{background-color:color-mix(in oklab,var(--color-red-900) 20%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-\[1px\]{padding:1px}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent-foreground{color:var(--accent-foreground)}.text-blue-500{color:var(--color-blue-500)}.text-card-foreground{color:var(--card-foreground)}.text-cyan-500{color:var(--color-cyan-500)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-muted-foreground{color:var(--muted-foreground)}.text-orange-500{color:var(--color-orange-500)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-purple-500{color:var(--color-purple-500)}.text-red-300{color:var(--color-red-300)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{color:var(--color-white)}.text-yellow-500{color:var(--color-yellow-500)}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:var(--shadow-sm);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-offset-background{--tw-ring-offset-color:var(--background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.duration-200{animation-duration:.2s}.fade-in-0{--tw-enter-opacity:0}.running{animation-play-state:running}.zoom-in{--tw-enter-scale:0}.zoom-in-95{--tw-enter-scale:.95}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-\[\.toast\]\:bg-muted:is(:where(.group).toast *){background-color:var(--muted)}.group-\[\.toast\]\:bg-primary:is(:where(.group).toast *){background-color:var(--primary)}.group-\[\.toast\]\:text-muted-foreground:is(:where(.group).toast *){color:var(--muted-foreground)}.group-\[\.toast\]\:text-primary-foreground:is(:where(.group).toast *){color:var(--primary-foreground)}.group-\[\.toaster\]\:border-border:is(:where(.group).toaster *){border-color:var(--border)}.group-\[\.toaster\]\:bg-background:is(:where(.group).toaster *){background-color:var(--background)}.group-\[\.toaster\]\:text-foreground:is(:where(.group).toaster *){color:var(--foreground)}.group-\[\.toaster\]\:shadow-lg:is(:where(.group).toaster *){--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.focus-within\:opacity-100:focus-within{opacity:1}@media(hover:hover){.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-destructive\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/10:hover{background-color:color-mix(in oklab,var(--destructive) 10%,transparent)}}.hover\:bg-destructive\/80:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/80:hover{background-color:color-mix(in oklab,var(--destructive) 80%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--muted) 50%,transparent)}}.hover\:bg-primary\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/80:hover{background-color:color-mix(in oklab,var(--primary) 80%,transparent)}}.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary) 80%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-destructive:hover{color:var(--destructive)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus{--tw-ring-color:var(--primary)}.focus\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:var(--accent)}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:var(--accent-foreground)}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:var(--background)}.data-\[state\=active\]\:text-foreground[data-state=active]{color:var(--foreground)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=closed\]\:animate-out[data-state=closed]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:var(--accent)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}@media(min-width:40rem){.sm\:mt-0{margin-top:calc(var(--spacing) * 0)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}:where(.sm\:space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.dark\:text-green-400:is(.dark *){color:var(--color-green-400)}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-block:calc(var(--spacing) * 1.5)}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:var(--muted-foreground)}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:calc(var(--spacing) * 0)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:calc(var(--spacing) * 12)}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-block:calc(var(--spacing) * 3)}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:calc(var(--spacing) * 5)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}}:root{--background:oklch(100% 0 0);--foreground:oklch(0% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(0% 0 0);--popover:oklch(99% 0 0);--popover-foreground:oklch(0% 0 0);--primary:oklch(0% 0 0);--primary-foreground:oklch(100% 0 0);--secondary:oklch(94% 0 0);--secondary-foreground:oklch(0% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(44% 0 0);--accent:oklch(94% 0 0);--accent-foreground:oklch(0% 0 0);--destructive:oklch(63% .19 23.03);--destructive-foreground:oklch(100% 0 0);--border:oklch(92% 0 0);--input:oklch(94% 0 0);--ring:oklch(0% 0 0);--chart-1:oklch(81% .17 75.35);--chart-2:oklch(55% .22 264.53);--chart-3:oklch(72% 0 0);--chart-4:oklch(92% 0 0);--chart-5:oklch(56% 0 0);--sidebar:oklch(99% 0 0);--sidebar-foreground:oklch(0% 0 0);--sidebar-primary:oklch(0% 0 0);--sidebar-primary-foreground:oklch(100% 0 0);--sidebar-accent:oklch(94% 0 0);--sidebar-accent-foreground:oklch(0% 0 0);--sidebar-border:oklch(94% 0 0);--sidebar-ring:oklch(0% 0 0);--font-sans:Geist, sans-serif;--font-serif:Georgia, serif;--font-mono:Geist Mono, monospace;--radius:.5rem;--shadow-x:0px;--shadow-y:1px;--shadow-blur:2px;--shadow-spread:0px;--shadow-opacity:.18;--shadow-color:#000;--shadow-2xs:0px 1px 2px 0px #00000017;--shadow-xs:0px 1px 2px 0px #00000017;--shadow-sm:0px 1px 2px 0px #0000002e, 0px 1px 2px -1px #0000002e;--shadow:0px 1px 2px 0px #0000002e, 0px 1px 2px -1px #0000002e;--shadow-md:0px 1px 2px 0px #0000002e, 0px 2px 4px -1px #0000002e;--shadow-lg:0px 1px 2px 0px #0000002e, 0px 4px 6px -1px #0000002e;--shadow-xl:0px 1px 2px 0px #0000002e, 0px 8px 10px -1px #0000002e;--shadow-2xl:0px 1px 2px 0px #00000073;--tracking-normal:0em;--spacing:.25rem}.dark{--background:oklch(14% 0 0);--foreground:oklch(100% 0 0);--card:oklch(14% 0 0);--card-foreground:oklch(100% 0 0);--popover:oklch(18% 0 0);--popover-foreground:oklch(100% 0 0);--primary:oklch(100% 0 0);--primary-foreground:oklch(0% 0 0);--secondary:oklch(25% 0 0);--secondary-foreground:oklch(100% 0 0);--muted:oklch(23% 0 0);--muted-foreground:oklch(72% 0 0);--accent:oklch(32% 0 0);--accent-foreground:oklch(100% 0 0);--destructive:oklch(69% .2 23.91);--destructive-foreground:oklch(0% 0 0);--border:oklch(26% 0 0);--input:oklch(32% 0 0);--ring:oklch(72% 0 0);--chart-1:oklch(81% .17 75.35);--chart-2:oklch(58% .21 260.84);--chart-3:oklch(56% 0 0);--chart-4:oklch(44% 0 0);--chart-5:oklch(92% 0 0);--sidebar:oklch(18% 0 0);--sidebar-foreground:oklch(100% 0 0);--sidebar-primary:oklch(100% 0 0);--sidebar-primary-foreground:oklch(0% 0 0);--sidebar-accent:oklch(32% 0 0);--sidebar-accent-foreground:oklch(100% 0 0);--sidebar-border:oklch(32% 0 0);--sidebar-ring:oklch(72% 0 0);--font-sans:Geist, sans-serif;--font-serif:Georgia, serif;--font-mono:Geist Mono, monospace;--radius:.5rem;--shadow-x:0px;--shadow-y:1px;--shadow-blur:2px;--shadow-spread:0px;--shadow-opacity:.18;--shadow-color:#000;--shadow-2xs:0px 1px 2px 0px #00000017;--shadow-xs:0px 1px 2px 0px #00000017;--shadow-sm:0px 1px 2px 0px #0000002e, 0px 1px 2px -1px #0000002e;--shadow:0px 1px 2px 0px #0000002e, 0px 1px 2px -1px #0000002e;--shadow-md:0px 1px 2px 0px #0000002e, 0px 2px 4px -1px #0000002e;--shadow-lg:0px 1px 2px 0px #0000002e, 0px 4px 6px -1px #0000002e;--shadow-xl:0px 1px 2px 0px #0000002e, 0px 8px 10px -1px #0000002e;--shadow-2xl:0px 1px 2px 0px #00000073}html,body,#root{width:100%;height:100%;overflow:hidden}body{font-family:var(--font-sans),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;line-height:1.5}.xterm{padding:0}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes pulse{50%{opacity:.5}}.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset} diff --git a/backend/public/index.html b/backend/public/index.html new file mode 100644 index 00000000..2c176942 --- /dev/null +++ b/backend/public/index.html @@ -0,0 +1,26 @@ + + + + + + + frontend + + + + + +
+ + diff --git a/backend/public/vite.svg b/backend/public/vite.svg new file mode 100644 index 00000000..e7b8dfb1 --- /dev/null +++ b/backend/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/backend/src/index.ts b/backend/src/index.ts index dc21b996..2500e066 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -578,12 +578,25 @@ app.get('/api/stats', async (req: Request, res: Response) => { // Get host system stats app.get('/api/system/stats', async (req: Request, res: Response) => { try { - const [currentLoad, mem, fsSize] = await Promise.all([ + const [currentLoad, mem, fsSize, networkStats] = await Promise.all([ si.currentLoad(), si.mem(), si.fsSize(), + si.networkStats(), ]); + let rxBytes = 0; + let txBytes = 0; + let rxSec = 0; + let txSec = 0; + + networkStats.forEach(net => { + rxBytes += net.rx_bytes || 0; + txBytes += net.tx_bytes || 0; + rxSec += net.rx_sec || 0; + txSec += net.tx_sec || 0; + }); + // Find the main mount (usually the largest or root mount) const mainDisk = fsSize.find(fs => fs.mount === '/' || fs.mount === 'C:') || fsSize[0]; @@ -606,6 +619,12 @@ app.get('/api/system/stats', async (req: Request, res: Response) => { free: mainDisk.available, usagePercent: mainDisk.use ? mainDisk.use.toFixed(1) : '0', } : null, + network: { + rxBytes, + txBytes, + rxSec, + txSec + } }); } catch (error) { console.error('Failed to fetch system stats:', error); diff --git a/frontend/src/components/EditorLayout.tsx b/frontend/src/components/EditorLayout.tsx index 7baa250e..3d99c96f 100644 --- a/frontend/src/components/EditorLayout.tsx +++ b/frontend/src/components/EditorLayout.tsx @@ -34,6 +34,14 @@ interface StackStatus { [key: string]: 'running' | 'exited' | 'unknown'; } +const formatBytes = (bytes: number) => { + if (bytes === 0) return '0 B'; + const k = 1024; + const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; +}; + export default function EditorLayout() { const { logout } = useAuth(); const [files, setFiles] = useState([]); @@ -44,7 +52,7 @@ export default function EditorLayout() { const [originalEnvContent, setOriginalEnvContent] = useState(''); const [envExists, setEnvExists] = useState(false); const [containers, setContainers] = useState([]); - const [containerStats, setContainerStats] = useState>({}); + const [containerStats, setContainerStats] = useState>({}); const [activeTab, setActiveTab] = useState<'compose' | 'env'>('compose'); const [createDialogOpen, setCreateDialogOpen] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); @@ -135,7 +143,35 @@ export default function EditorLayout() { const onlineCpus = data.cpu_stats.online_cpus || 1; const cpuPercent = systemDelta > 0 ? ((cpuDelta / systemDelta) * onlineCpus * 100).toFixed(2) : '0.00'; const ramUsage = (data.memory_stats.usage / (1024 * 1024)).toFixed(2) + ' MB'; - setContainerStats(prev => ({ ...prev, [container.Id]: { cpu: cpuPercent + '%', ram: ramUsage } })); + + let currentRx = 0; + let currentTx = 0; + if (data.networks) { + Object.values(data.networks).forEach((net: any) => { + currentRx += net.rx_bytes || 0; + currentTx += net.tx_bytes || 0; + }); + } + + setContainerStats(prev => { + const prevStat = prev[container.Id]; + // Calculate rate if we have a previous value + const rxRate = prevStat?.lastRx !== undefined ? Math.max(0, currentRx - prevStat.lastRx) : 0; + const txRate = prevStat?.lastTx !== undefined ? Math.max(0, currentTx - prevStat.lastTx) : 0; + + const netIO = `${formatBytes(rxRate)}/s ↓ / ${formatBytes(txRate)}/s ↑`; + + return { + ...prev, + [container.Id]: { + cpu: cpuPercent + '%', + ram: ramUsage, + net: netIO, + lastRx: currentRx, + lastTx: currentTx + } + }; + }); } catch { // Ignore parse errors } @@ -724,8 +760,8 @@ export default function EditorLayout() { - - CPU: {containerStats[container?.Id]?.cpu || 'N/A'} | RAM: {containerStats[container?.Id]?.ram || 'N/A'} + + CPU: {containerStats[container?.Id]?.cpu || 'N/A'} | RAM: {containerStats[container?.Id]?.ram || 'N/A'} | NET: {containerStats[container?.Id]?.net || '0 B ↓ / 0 B ↑'} diff --git a/frontend/src/components/HomeDashboard.tsx b/frontend/src/components/HomeDashboard.tsx index 80e0e887..a989d28d 100644 --- a/frontend/src/components/HomeDashboard.tsx +++ b/frontend/src/components/HomeDashboard.tsx @@ -3,7 +3,7 @@ import { Card, CardContent, CardHeader, CardTitle } from './ui/card'; import { Button } from './ui/button'; import { Input } from './ui/input'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './ui/dialog'; -import { Activity, Square, PauseCircle, ArrowRight, Plus, Cpu, HardDrive, MemoryStick } from 'lucide-react'; +import { Activity, Square, ArrowRight, Plus, Cpu, HardDrive, MemoryStick, Network } from 'lucide-react'; import { apiFetch } from '@/lib/api'; import { toast } from 'sonner'; import { Label } from './ui/label'; @@ -34,15 +34,21 @@ interface SystemStats { free: number; usagePercent: string; } | null; + network?: { + rxBytes: number; + txBytes: number; + rxSec: number; + txSec: number; + }; } -function formatBytes(bytes: number): string { - const gb = bytes / (1024 * 1024 * 1024); - if (gb >= 1024) { - return (gb / 1024).toFixed(1) + ' TB'; - } - return gb.toFixed(1) + ' GB'; -} +const formatBytes = (bytes: number) => { + if (bytes === 0) return '0 B'; + const k = 1024; + const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + const i = Math.floor(Math.log(bytes) / Math.log(k)); + return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; +}; export default function HomeDashboard() { const [dockerRunInput, setDockerRunInput] = useState(''); @@ -166,12 +172,20 @@ export default function HomeDashboard() { - Inactive Stacks - + Host Network + -
{Math.max(0, stats.inactive)}
-

Not deployed

+
+ {systemStats?.network + ? `${formatBytes(systemStats.network.rxSec)}/s ↓` + : '...'} +
+

+ {systemStats?.network + ? `${formatBytes(systemStats.network.txSec)}/s ↑` + : 'Loading...'} +