@worca/ui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var Ig=Object.defineProperty;var Pa=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ma=(e,t)=>{for(var s in t)Ig(e,s,{get:t[s],enumerable:!0})};var fc={};Ma(fc,{Terminal:()=>sy});function S_(e){return e.replace(/\r?\n/g,"\r")}function C_(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function x_(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function k_(e,t,s,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");yu(r,t,s,i)}}function yu(e,t,s,i){e=S_(e),e=C_(e,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function wu(e,t,s){let i=s.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function vd(e,t,s,i,r){wu(e,t,s),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function qs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function zn(e,t=0,s=e.length){let i="";for(let r=t;r<s;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}function T_(e){return e[Sl]||[]}function je(e){if(rl.has(e))return rl.get(e);let t=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");A_(t,s,r)};return t._id=e,rl.set(e,t),t}function A_(e,t,s){t[bd]===t?t[Sl].push({id:e,index:s}):(t[Sl]=[{id:e,index:s}],t[bd]=t)}function D_(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ var Ig=Object.defineProperty;var Ra=(e,t)=>()=>(e&&(t=e(e=0)),t);var La=(e,t)=>{for(var s in t)Ig(e,s,{get:t[s],enumerable:!0})};var pc={};La(pc,{Terminal:()=>sy});function S_(e){return e.replace(/\r?\n/g,"\r")}function C_(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function x_(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function k_(e,t,s,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");yu(r,t,s,i)}}function yu(e,t,s,i){e=S_(e),e=C_(e,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function wu(e,t,s){let i=s.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function vd(e,t,s,i,r){wu(e,t,s),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function qs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function On(e,t=0,s=e.length){let i="";for(let r=t;r<s;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}function T_(e){return e[wl]||[]}function je(e){if(il.has(e))return il.get(e);let t=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");A_(t,s,r)};return t._id=e,il.set(e,t),t}function A_(e,t,s){t[bd]===t?t[wl].push({id:e,index:s}):(t[wl]=[{id:e,index:s}],t[bd]=t)}function D_(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
- WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}function bn(e){O_(e)||B_.onUnexpectedError(e)}function O_(e){return e instanceof I_?!0:e instanceof Error&&e.name===xl&&e.message===xl}function z_(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function N_(e,t,s=0,i=e.length){let r=s,o=i;for(;r<o;){let n=Math.floor((r+o)/2);t(e[n])?r=n+1:o=n}return r-1}function St(e,t=0){return e[e.length-(1+t)]}function H_(e,t){return(s,i)=>t(e(s),e(i))}function j_(e,t){let s=Object.create(null);for(let i of e){let r=t(i),o=s[r];o||(o=s[r]=[]),o.push(i)}return s}function U_(e,t){let s=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=e.apply(s,arguments)}finally{t()}else r=e.apply(s,arguments);return r}}function G_(e){Si=e}function Fn(e){return Si?.trackDisposable(e),e}function Hn(e){Si?.markAsDisposed(e)}function ao(e,t){Si?.setParent(e,t)}function Y_(e,t){if(Si)for(let s of e)Si.setParent(s,t)}function xd(e){return Si?.markAsSingleton(e),e}function Ci(e){if(Mu.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function X_(...e){let t=_e(()=>Ci(e));return Y_(e,t),t}function _e(e){let t=Fn({dispose:U_(()=>{Hn(t),e()})});return t}function cv(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}function hv(e){return nc.INSTANCE.getZoomFactor(e)}function dv(){return Cn}function Tv(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Ku.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Ml)switch(t){case 59:return 85;case 60:if(bv)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ss)return 57;break}else if(Sn&&(ss&&t===93||!ss&&t===92))return 57;return kv[t]||0}function Pv(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}function Fv(e){return 55296<=e&&e<=56319}function Md(e){return 56320<=e&&e<=57343}function Hv(e,t){return(e-55296<<10)+(t-56320)+65536}function Wv(e){return hc(e,0)}function hc(e,t){switch(typeof e){case"object":return e===null?Cs(349,t):Array.isArray(e)?Vv(e,t):Uv(e,t);case"string":return Xu(e,t);case"boolean":return jv(e,t);case"number":return Cs(e,t);case"undefined":return Cs(937,t);default:return Cs(617,t)}}function Cs(e,t){return(t<<5)-t+e|0}function jv(e,t){return Cs(e?433:863,t)}function Xu(e,t){t=Cs(149417,t);for(let s=0,i=e.length;s<i;s++)t=Cs(e.charCodeAt(s),t);return t}function Vv(e,t){return t=Cs(104579,t),e.reduce((s,i)=>hc(i,s),t)}function Uv(e,t){return t=Cs(181387,t),Object.keys(e).sort().reduce((s,i)=>(s=Xu(i,s),hc(e[i],s)),t)}function cl(e,t,s=32){let i=s-t,r=~((1<<i)-1);return(e<<t|(r&e)>>>i)>>>0}function Bd(e,t=0,s=e.byteLength,i=0){for(let r=0;r<s;r++)e[t+r]=i}function qv(e,t,s="0"){for(;e.length<t;)e=s+e;return e}function qr(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(s=>s.toString(16).padStart(2,"0")).join(""):qv((e>>>0).toString(16),t/4)}function K(e,t,s,i){return new Yv(e,t,s,i)}function Xv(e,t){return function(s){return t(new Qr(e,s))}}function Jv(e){return function(t){return e(new Bl(t))}}function eb(e){let t=e.getBoundingClientRect(),s=qt(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}function Zu(e,t,s,...i){let r=tb.exec(t);if(!r)throw new Error("Bad use of emmet");let o=r[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,o):n=document.createElement(o),r[3]&&(n.id=r[3]),r[4]&&(n.className=r[4].replace(/\./g," ").trim()),s&&Object.entries(s).forEach(([a,c])=>{typeof c>"u"||(/^on\w+$/.test(a)?n[a]=c:a==="selected"?c&&n.setAttribute(a,"true"):n.setAttribute(a,c))}),n.append(...i),n}function sb(e,t,...s){return Zu("http://www.w3.org/1999/xhtml",e,t,...s)}function mt(e){return typeof e=="number"?`${e}px`:e}function no(e){return new ib(e)}function rb(e,t,s){let i=null,r=null;if(typeof s.value=="function"?(i="value",r=s.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(i="get",r=s.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;s[i]=function(...n){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,n)}),this[o]}}function dl(e,t){let s=t-e;return function(i){return e+s*db(i)}}function cb(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}function hb(e){return Math.pow(e,3)}function db(e){return 1-hb(1-e)}function wb(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,ss&&(t.className+=" mac"),t}function vi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ws(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function xb(e){return 57508<=e&&e<=57558}function kb(e){return 9472<=e&&e<=9631}function $b(e){return xb(e)||kb(e)}function Eb(){return{css:{canvas:mn(),cell:mn()},device:{canvas:mn(),cell:mn(),char:{width:0,height:0,left:0,top:0}}}}function mn(){return{width:0,height:0}}function Ud(e,t,s){for(;e.length<s;)e=t+e;return e}function Rb(){return new Ab}function uc(e,t,s){let i=s.getBoundingClientRect(),r=e.getComputedStyle(s),o=parseInt(r.getPropertyValue("padding-left")),n=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-n]}function Ib(e,t,s,i,r,o,n,a,c){if(!o)return;let l=uc(e,t,s);if(l)return l[0]=Math.ceil((l[0]+(c?n/2:0))/n),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),r),l}function Fb(){if(!np)return 0;let e=fo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}function Kb(e,t,s,i){let r=s.buffer.x,o=s.buffer.y;if(!s.buffer.hasScrollback)return Xb(r,o,e,t,s,i)+jn(o,t,s,i)+Jb(r,o,e,t,s,i);let n;if(o===t)return n=r>e?"D":"C",co(Math.abs(r-e),lo(n,i));n=o>t?"D":"C";let a=Math.abs(o-t),c=Yb(o>t?e:r,s)+(a-1)*s.cols+1+Gb(o>t?r:e,s);return co(c,lo(n,i))}function Gb(e,t){return e-1}function Yb(e,t){return t.cols-e}function Xb(e,t,s,i,r,o){return jn(t,i,r,o).length===0?"":co(dp(e,t,e,t-xi(t,r),!1,r).length,lo("D",o))}function jn(e,t,s,i){let r=e-xi(e,s),o=t-xi(t,s),n=Math.abs(r-o)-Zb(e,t,s);return co(n,lo(hp(e,t),i))}function Jb(e,t,s,i,r,o){let n;jn(t,i,r,o).length>0?n=i-xi(i,r):n=t;let a=i,c=Qb(e,t,s,i,r,o);return co(dp(e,n,s,a,c==="C",r).length,lo(c,o))}function Zb(e,t,s){let i=0,r=e-xi(e,s),o=t-xi(t,s);for(let n=0;n<Math.abs(r-o);n++){let a=hp(e,t)==="A"?-1:1;s.buffer.lines.get(r+a*n)?.isWrapped&&i++}return i}function xi(e,t){let s=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)s++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return s}function Qb(e,t,s,i,r,o){let n;return jn(s,i,r,o).length>0?n=i-xi(i,r):n=t,e<s&&n<=i||e>=s&&n<i?"C":"D"}function hp(e,t){return e>t?"A":"B"}function dp(e,t,s,i,r,o){let n=e,a=t,c="";for(;(n!==s||a!==i)&&a>=0&&a<o.buffer.lines.length;)n+=r?1:-1,r&&n>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,n),n=0,e=0,a++):!r&&n<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),n=o.cols-1,e=n,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,n)}function lo(e,t){let s=t?"O":"[";return B.ESC+s+e}function co(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}function Kd(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)}function fe(e,t){if(e!==void 0)try{return Se.toColor(e)}catch{}return t}function u0(e,t,s,i,r,o){let n=[];for(let a=0;a<e.length-1;a++){let c=a,l=e.get(++c);if(!l.isWrapped)continue;let h=[e.get(a)];for(;c<e.length&&l.isWrapped;)h.push(l),l=e.get(++c);if(!o&&i>=a&&i<c){a+=h.length-1;continue}let d=0,m=ho(h,d,t),p=1,f=0;for(;p<h.length;){let S=ho(h,p,t),$=S-f,x=s-m,v=Math.min($,x);h[d].copyCellsFrom(h[p],f,m,v,!1),m+=v,m===s&&(d++,m=0),f+=v,f===S&&(p++,f=0),m===0&&d!==0&&h[d-1].getWidth(s-1)===2&&(h[d].copyCellsFrom(h[d-1],s-1,m++,1,!1),h[d-1].setCell(s-1,r))}h[d].replaceCells(m,s,r);let _=0;for(let S=h.length-1;S>0&&(S>d||h[S].getTrimmedLength()===0);S--)_++;_>0&&(n.push(a+h.length-_),n.push(_)),a+=h.length-1}return n}function p0(e,t){let s=[],i=0,r=t[i],o=0;for(let n=0;n<e.length;n++)if(r===n){let a=t[++i];e.onDeleteEmitter.fire({index:n-o,amount:a}),n+=a-1,o+=a,r=t[++i]}else s.push(n);return{layout:s,countRemoved:o}}function f0(e,t){let s=[];for(let i=0;i<t.length;i++)s.push(e.get(t[i]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=t.length}function m0(e,t,s){let i=[],r=e.map((c,l)=>ho(e,l,t)).reduce((c,l)=>c+l),o=0,n=0,a=0;for(;a<r;){if(r-a<s){i.push(r-a);break}o+=s;let c=ho(e,n,t);o>c&&(o-=c,n++);let l=e[n].getWidth(o-1)===2;l&&o--;let h=l?s-1:s;i.push(h),a+=h}return i}function ho(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?s-1:s}function y0(e){return e==="block"||e==="underline"||e==="bar"}function io(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let i in e)s[i]=t<=1?e[i]:e[i]&&io(e[i],t-1);return s}function ml(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}function S0(e,t){let s=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=s;)if(r=s+i>>1,e>t[r][1])s=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}function ou(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}function au(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=L0.exec(t);if(s){let i=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/i*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/i*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),D0.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(s*r,s*r+s),16);i[r]=s===1?o<<4:s===2?o:s===3?o>>4:o>>8}return i}}function vl(e,t){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function P0(e,t=16){let[s,i,r]=e;return`rgb:${vl(s,t)}/${vl(i,t)}/${vl(r,t)}`}function cu(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}function uu(e){return 0<=e&&e<256}function H0(e,t,s,i){let r={type:0,cancel:!1,key:void 0},o=(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?r.key=B.ESC+"OA":r.key=B.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=B.ESC+"OD":r.key=B.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=B.ESC+"OC":r.key=B.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=B.ESC+"OB":r.key=B.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":B.DEL,e.altKey&&(r.key=B.ESC+r.key);break;case 9:if(e.shiftKey){r.key=B.ESC+"[Z";break}r.key=B.HT,r.cancel=!0;break;case 13:r.key=e.altKey?B.ESC+B.CR:B.CR,r.cancel=!0;break;case 27:r.key=B.ESC,e.altKey&&(r.key=B.ESC+B.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"D":t?r.key=B.ESC+"OD":r.key=B.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"C":t?r.key=B.ESC+"OC":r.key=B.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"A":t?r.key=B.ESC+"OA":r.key=B.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"B":t?r.key=B.ESC+"OB":r.key=B.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=B.ESC+"[2~");break;case 46:o?r.key=B.ESC+"[3;"+(o+1)+"~":r.key=B.ESC+"[3~";break;case 36:o?r.key=B.ESC+"[1;"+(o+1)+"H":t?r.key=B.ESC+"OH":r.key=B.ESC+"[H";break;case 35:o?r.key=B.ESC+"[1;"+(o+1)+"F":t?r.key=B.ESC+"OF":r.key=B.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=B.ESC+"[5;"+(o+1)+"~":r.key=B.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=B.ESC+"[6;"+(o+1)+"~":r.key=B.ESC+"[6~";break;case 112:o?r.key=B.ESC+"[1;"+(o+1)+"P":r.key=B.ESC+"OP";break;case 113:o?r.key=B.ESC+"[1;"+(o+1)+"Q":r.key=B.ESC+"OQ";break;case 114:o?r.key=B.ESC+"[1;"+(o+1)+"R":r.key=B.ESC+"OR";break;case 115:o?r.key=B.ESC+"[1;"+(o+1)+"S":r.key=B.ESC+"OS";break;case 116:o?r.key=B.ESC+"[15;"+(o+1)+"~":r.key=B.ESC+"[15~";break;case 117:o?r.key=B.ESC+"[17;"+(o+1)+"~":r.key=B.ESC+"[17~";break;case 118:o?r.key=B.ESC+"[18;"+(o+1)+"~":r.key=B.ESC+"[18~";break;case 119:o?r.key=B.ESC+"[19;"+(o+1)+"~":r.key=B.ESC+"[19~";break;case 120:o?r.key=B.ESC+"[20;"+(o+1)+"~":r.key=B.ESC+"[20~";break;case 121:o?r.key=B.ESC+"[21;"+(o+1)+"~":r.key=B.ESC+"[21~";break;case 122:o?r.key=B.ESC+"[23;"+(o+1)+"~":r.key=B.ESC+"[23~";break;case 123:o?r.key=B.ESC+"[24;"+(o+1)+"~":r.key=B.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=B.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=B.DEL:e.keyCode===219?r.key=B.ESC:e.keyCode===220?r.key=B.FS:e.keyCode===221&&(r.key=B.GS);else if((!s||i)&&e.altKey&&!e.metaKey){let n=F0[e.keyCode]?.[e.shiftKey?1:0];if(n)r.key=B.ESC+n;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),r.key=B.ESC+c}else if(e.keyCode===32)r.key=B.ESC+(e.ctrlKey?B.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),r.key=B.ESC+a,r.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=B.US),e.key==="@"&&(r.key=B.NUL));break}return r}function K0(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}function Y0(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var bu,y_,w_,xe,F,gd,yl,_d,wl,$_,E_,Su,Ks,uo,An,Mt,bd,Sl,rl,lt,$u,ki,R_,rc,Eu,ct,Tu,L_,po,Cl,Nn,ks,oc,$s,P_,Au,tr,Ru,M_,B_,xl,I_,yd,$l,F_,Pu,W_,wd,Sd,Cd,Yk,V_,Mu,q_,Si,K_,Ou,Gs,ie,er,kt,Tl,we,kd,J_,Z_,Q_,$d,ev,Ze,Rl,tv,Ed,Nu,sv,Dl,iv,rv,ov,yn,nv,av,wn,z,lv,Pl,nc,Jk,Zk,sr,Ml,Sn,ac,Wu,Qk,e2,Cn,Qi,Rn,Ln,oo,uv,ju,Vu,pv,fv,mv,gv,fn,xn,Td,_v,Ss,xs,xt,Uu,vv,ol,qu,ss,bv,nl,yv,t2,is,Ws,wv,Sv,Cv,xv,s2,i2,r2,o2,js,n2,lc,al,Ad,Rd,kv,Ku,$v,Ev,Av,Rv,Lv,Dv,Bl,Ld,Mv,Qr,Dd,Yu,Bv,Ov,cc,Iv,zv,ll,Nv,Pd,Kv,a2,qt,l2,c2,h2,Od,d2,u2,Gv,p2,f2,Yv,Id,Zv,Dn,Qv,hl,zd,m2,Ne,tb,ib,Qu,ts,eo,ob,dc,Nd,nb,ab,lb,Fd,Hd,ub,pb,ep,tp,fb,mb,gb,Wd,jd,_b,Nl,vb,bb,yb,Fl,Hl,Sb,Qt,Vs,Kr,Pn,B,$n,sp,Wl,Fe,He,We,Ce,Vd,Ae,ge,Se,at,En,Cb,Mn,jl,Tb,Ab,ul,Lt,gn,qd,Gr,_n,Lb,Vl,Ul,ip,Db,Pb,Mb,Bb,Ob,ql,zb,rp,Wn,fo,mo,op,Nb,np,Bn,Hb,Wb,ap,pc,lp,cp,jb,Vb,On,Ub,Kl,qb,e0,pl,t0,s0,i0,r0,o0,Gl,Gd,Yd,Me,bi,to,Xd,Jd,Yr,n0,Yl,a0,l0,c0,h0,Xl,d0,Zd,oe,Te,vn,fl,so,pp,g0,Oe,yi,Qd,eu,_0,mp,gp,Jl,Zi,v0,b0,tu,su,Zl,iu,gl,ru,Ql,_l,w0,Be,C0,wi,x0,Xr,k0,_p,Jr,$0,Ct,Zr,E0,ro,nu,T0,Pt,A0,R0,L0,D0,M0,Us,lu,hu,du,B0,tc,O0,pu,I0,z0,sc,fu,N0,F0,$e,W0,bl,mu,j0,V0,U0,q0,gu,_u,In,ic,G0,X0,J0,vu,Z0,Q0,ey,ty,es,sy,mc=Pa(()=>{bu=Object.defineProperty,y_=Object.getOwnPropertyDescriptor,w_=(e,t)=>{for(var s in t)bu(e,s,{get:t[s],enumerable:!0})},xe=(e,t,s,i)=>{for(var r=i>1?void 0:i?y_(t,s):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(i?n(t,s,r):n(r))||r);return i&&r&&bu(t,s,r),r},F=(e,t)=>(s,i)=>t(s,i,e),gd="Terminal input",yl={get:()=>gd,set:e=>gd=e},_d="Too much output to announce, navigate to rows manually to read",wl={get:()=>_d,set:e=>_d=e};$_=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<s;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=s)return this._interim=n,i;let a=e.charCodeAt(o);56320<=a&&a<=57343?t[i++]=(n-55296)*1024+a-56320+65536:(t[i++]=n,t[i++]=a);continue}n!==65279&&(t[i++]=n)}return i}},E_=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let i=0,r,o,n,a,c=0,l=0;if(this.interim[0]){let m=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,_;for(;(_=this.interim[++f]&63)&&f<4;)p<<=6,p|=_;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,$=S-f;for(;l<$;){if(l>=s)return 0;if(_=e[l++],(_&192)!==128){l--,m=!0;break}else this.interim[f++]=_,p<<=6,p|=_&63}m||(S===2?p<128?l--:t[i++]=p:S===3?p<2048||p>=55296&&p<=57343||p===65279||(t[i++]=p):p<65536||p>1114111||(t[i++]=p)),this.interim.fill(0)}let h=s-4,d=l;for(;d<s;){for(;d<h&&!((r=e[d])&128)&&!((o=e[d+1])&128)&&!((n=e[d+2])&128)&&!((a=e[d+3])&128);)t[i++]=r,t[i++]=o,t[i++]=n,t[i++]=a,d+=4;if(r=e[d++],r<128)t[i++]=r;else if((r&224)===192){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(c=(r&31)<<6|o&63,c<128){d--;continue}t[i++]=c}else if((r&240)===224){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,i;if(n=e[d++],(n&192)!==128){d--;continue}if(c=(r&15)<<12|(o&63)<<6|n&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[i++]=c}else if((r&248)===240){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,i;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=n,i;if(a=e[d++],(a&192)!==128){d--;continue}if(c=(r&7)<<18|(o&63)<<12|(n&63)<<6|a&63,c<65536||c>1114111)continue;t[i++]=c}}return i}},Su="",Ks=" ",uo=class Cu{constructor(){this.fg=0,this.bg=0,this.extended=new An}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 Cu;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}},An=class xu{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 xu(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Mt=class ku extends uo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new An,this.combinedData=""}static fromCharData(t){let s=new ku;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?qs(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 s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bd="di$target",Sl="di$dependencies",rl=new Map;lt=je("BufferService"),$u=je("CoreMouseService"),ki=je("CoreService"),R_=je("CharsetService"),rc=je("InstantiationService"),Eu=je("LogService"),ct=je("OptionsService"),Tu=je("OscLinkService"),L_=je("UnicodeService"),po=je("DecorationService"),Cl=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Mt,n=s.getTrimmedLength(),a=-1,c=-1,l=!1;for(let h=0;h<n;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=h,a=o.extended.urlId;continue}else l=o.extended.urlId!==a;else c!==-1&&(l=!0);if(l||c!==-1&&h===n-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let m={start:{x:c+1,y:e},end:{x:h+(!l&&h===n-1?1:0),y:e}},p=!1;if(!r?.allowNonHttpProtocols)try{let f=new URL(d);["http:","https:"].includes(f.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:m,activate:(f,_)=>r?r.activate(f,_,m):D_(f,_),hover:(f,_)=>r?.hover?.(f,_,m),leave:(f,_)=>r?.leave?.(f,_,m)})}l=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=h,a=o.extended.urlId):(c=-1,a=-1)}}t(i)}};Cl=xe([F(0,lt),F(1,ct),F(2,Tu)],Cl);Nn=je("CharSizeService"),ks=je("CoreBrowserService"),oc=je("MouseService"),$s=je("RenderService"),P_=je("SelectionService"),Au=je("CharacterJoinerService"),tr=je("ThemeService"),Ru=je("LinkProviderService"),M_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yd.isErrorNoTelemetry(e)?new yd(e.message+`
3
+ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}function _n(e){O_(e)||B_.onUnexpectedError(e)}function O_(e){return e instanceof I_?!0:e instanceof Error&&e.name===Cl&&e.message===Cl}function z_(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function N_(e,t,s=0,i=e.length){let r=s,o=i;for(;r<o;){let n=Math.floor((r+o)/2);t(e[n])?r=n+1:o=n}return r-1}function St(e,t=0){return e[e.length-(1+t)]}function H_(e,t){return(s,i)=>t(e(s),e(i))}function j_(e,t){let s=Object.create(null);for(let i of e){let r=t(i),o=s[r];o||(o=s[r]=[]),o.push(i)}return s}function U_(e,t){let s=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=e.apply(s,arguments)}finally{t()}else r=e.apply(s,arguments);return r}}function G_(e){Si=e}function zn(e){return Si?.trackDisposable(e),e}function Nn(e){Si?.markAsDisposed(e)}function no(e,t){Si?.setParent(e,t)}function Y_(e,t){if(Si)for(let s of e)Si.setParent(s,t)}function xd(e){return Si?.markAsSingleton(e),e}function Ci(e){if(Mu.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function X_(...e){let t=_e(()=>Ci(e));return Y_(e,t),t}function _e(e){let t=zn({dispose:U_(()=>{Nn(t),e()})});return t}function cv(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}function hv(e){return oc.INSTANCE.getZoomFactor(e)}function dv(){return wn}function Tv(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return Ku.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Pl)switch(t){case 59:return 85;case 60:if(bv)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ss)return 57;break}else if(yn&&(ss&&t===93||!ss&&t===92))return 57;return kv[t]||0}function Pv(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}function Fv(e){return 55296<=e&&e<=56319}function Md(e){return 56320<=e&&e<=57343}function Hv(e,t){return(e-55296<<10)+(t-56320)+65536}function Wv(e){return cc(e,0)}function cc(e,t){switch(typeof e){case"object":return e===null?Cs(349,t):Array.isArray(e)?Vv(e,t):Uv(e,t);case"string":return Xu(e,t);case"boolean":return jv(e,t);case"number":return Cs(e,t);case"undefined":return Cs(937,t);default:return Cs(617,t)}}function Cs(e,t){return(t<<5)-t+e|0}function jv(e,t){return Cs(e?433:863,t)}function Xu(e,t){t=Cs(149417,t);for(let s=0,i=e.length;s<i;s++)t=Cs(e.charCodeAt(s),t);return t}function Vv(e,t){return t=Cs(104579,t),e.reduce((s,i)=>cc(i,s),t)}function Uv(e,t){return t=Cs(181387,t),Object.keys(e).sort().reduce((s,i)=>(s=Xu(i,s),cc(e[i],s)),t)}function ll(e,t,s=32){let i=s-t,r=~((1<<i)-1);return(e<<t|(r&e)>>>i)>>>0}function Bd(e,t=0,s=e.byteLength,i=0){for(let r=0;r<s;r++)e[t+r]=i}function qv(e,t,s="0"){for(;e.length<t;)e=s+e;return e}function Ur(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(s=>s.toString(16).padStart(2,"0")).join(""):qv((e>>>0).toString(16),t/4)}function K(e,t,s,i){return new Yv(e,t,s,i)}function Xv(e,t){return function(s){return t(new Zr(e,s))}}function Jv(e){return function(t){return e(new Ml(t))}}function eb(e){let t=e.getBoundingClientRect(),s=qt(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}function Zu(e,t,s,...i){let r=tb.exec(t);if(!r)throw new Error("Bad use of emmet");let o=r[1]||"div",n;return e!=="http://www.w3.org/1999/xhtml"?n=document.createElementNS(e,o):n=document.createElement(o),r[3]&&(n.id=r[3]),r[4]&&(n.className=r[4].replace(/\./g," ").trim()),s&&Object.entries(s).forEach(([a,c])=>{typeof c>"u"||(/^on\w+$/.test(a)?n[a]=c:a==="selected"?c&&n.setAttribute(a,"true"):n.setAttribute(a,c))}),n.append(...i),n}function sb(e,t,...s){return Zu("http://www.w3.org/1999/xhtml",e,t,...s)}function mt(e){return typeof e=="number"?`${e}px`:e}function oo(e){return new ib(e)}function rb(e,t,s){let i=null,r=null;if(typeof s.value=="function"?(i="value",r=s.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(i="get",r=s.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;s[i]=function(...n){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,n)}),this[o]}}function hl(e,t){let s=t-e;return function(i){return e+s*db(i)}}function cb(e,t,s){return function(i){return i<s?e(i/s):t((i-s)/(1-s))}}function hb(e){return Math.pow(e,3)}function db(e){return 1-hb(1-e)}function wb(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,ss&&(t.className+=" mac"),t}function vi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ws(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function xb(e){return 57508<=e&&e<=57558}function kb(e){return 9472<=e&&e<=9631}function $b(e){return xb(e)||kb(e)}function Eb(){return{css:{canvas:pn(),cell:pn()},device:{canvas:pn(),cell:pn(),char:{width:0,height:0,left:0,top:0}}}}function pn(){return{width:0,height:0}}function Ud(e,t,s){for(;e.length<s;)e=t+e;return e}function Rb(){return new Ab}function dc(e,t,s){let i=s.getBoundingClientRect(),r=e.getComputedStyle(s),o=parseInt(r.getPropertyValue("padding-left")),n=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-n]}function Ib(e,t,s,i,r,o,n,a,c){if(!o)return;let l=dc(e,t,s);if(l)return l[0]=Math.ceil((l[0]+(c?n/2:0))/n),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),i+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),r),l}function Fb(){if(!np)return 0;let e=po.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}function Kb(e,t,s,i){let r=s.buffer.x,o=s.buffer.y;if(!s.buffer.hasScrollback)return Xb(r,o,e,t,s,i)+Hn(o,t,s,i)+Jb(r,o,e,t,s,i);let n;if(o===t)return n=r>e?"D":"C",lo(Math.abs(r-e),ao(n,i));n=o>t?"D":"C";let a=Math.abs(o-t),c=Yb(o>t?e:r,s)+(a-1)*s.cols+1+Gb(o>t?r:e,s);return lo(c,ao(n,i))}function Gb(e,t){return e-1}function Yb(e,t){return t.cols-e}function Xb(e,t,s,i,r,o){return Hn(t,i,r,o).length===0?"":lo(dp(e,t,e,t-xi(t,r),!1,r).length,ao("D",o))}function Hn(e,t,s,i){let r=e-xi(e,s),o=t-xi(t,s),n=Math.abs(r-o)-Zb(e,t,s);return lo(n,ao(hp(e,t),i))}function Jb(e,t,s,i,r,o){let n;Hn(t,i,r,o).length>0?n=i-xi(i,r):n=t;let a=i,c=Qb(e,t,s,i,r,o);return lo(dp(e,n,s,a,c==="C",r).length,ao(c,o))}function Zb(e,t,s){let i=0,r=e-xi(e,s),o=t-xi(t,s);for(let n=0;n<Math.abs(r-o);n++){let a=hp(e,t)==="A"?-1:1;s.buffer.lines.get(r+a*n)?.isWrapped&&i++}return i}function xi(e,t){let s=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)s++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return s}function Qb(e,t,s,i,r,o){let n;return Hn(s,i,r,o).length>0?n=i-xi(i,r):n=t,e<s&&n<=i||e>=s&&n<i?"C":"D"}function hp(e,t){return e>t?"A":"B"}function dp(e,t,s,i,r,o){let n=e,a=t,c="";for(;(n!==s||a!==i)&&a>=0&&a<o.buffer.lines.length;)n+=r?1:-1,r&&n>o.cols-1?(c+=o.buffer.translateBufferLineToString(a,!1,e,n),n=0,e=0,a++):!r&&n<0&&(c+=o.buffer.translateBufferLineToString(a,!1,0,e+1),n=o.cols-1,e=n,a--);return c+o.buffer.translateBufferLineToString(a,!1,e,n)}function ao(e,t){let s=t?"O":"[";return B.ESC+s+e}function lo(e,t){e=Math.floor(e);let s="";for(let i=0;i<e;i++)s+=t;return s}function Kd(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)}function fe(e,t){if(e!==void 0)try{return Se.toColor(e)}catch{}return t}function u0(e,t,s,i,r,o){let n=[];for(let a=0;a<e.length-1;a++){let c=a,l=e.get(++c);if(!l.isWrapped)continue;let h=[e.get(a)];for(;c<e.length&&l.isWrapped;)h.push(l),l=e.get(++c);if(!o&&i>=a&&i<c){a+=h.length-1;continue}let d=0,m=co(h,d,t),p=1,f=0;for(;p<h.length;){let S=co(h,p,t),k=S-f,x=s-m,v=Math.min(k,x);h[d].copyCellsFrom(h[p],f,m,v,!1),m+=v,m===s&&(d++,m=0),f+=v,f===S&&(p++,f=0),m===0&&d!==0&&h[d-1].getWidth(s-1)===2&&(h[d].copyCellsFrom(h[d-1],s-1,m++,1,!1),h[d-1].setCell(s-1,r))}h[d].replaceCells(m,s,r);let _=0;for(let S=h.length-1;S>0&&(S>d||h[S].getTrimmedLength()===0);S--)_++;_>0&&(n.push(a+h.length-_),n.push(_)),a+=h.length-1}return n}function p0(e,t){let s=[],i=0,r=t[i],o=0;for(let n=0;n<e.length;n++)if(r===n){let a=t[++i];e.onDeleteEmitter.fire({index:n-o,amount:a}),n+=a-1,o+=a,r=t[++i]}else s.push(n);return{layout:s,countRemoved:o}}function f0(e,t){let s=[];for(let i=0;i<t.length;i++)s.push(e.get(t[i]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=t.length}function m0(e,t,s){let i=[],r=e.map((c,l)=>co(e,l,t)).reduce((c,l)=>c+l),o=0,n=0,a=0;for(;a<r;){if(r-a<s){i.push(r-a);break}o+=s;let c=co(e,n,t);o>c&&(o-=c,n++);let l=e[n].getWidth(o-1)===2;l&&o--;let h=l?s-1:s;i.push(h),a+=h}return i}function co(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?s-1:s}function y0(e){return e==="block"||e==="underline"||e==="bar"}function so(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let i in e)s[i]=t<=1?e[i]:e[i]&&so(e[i],t-1);return s}function fl(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}function S0(e,t){let s=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=s;)if(r=s+i>>1,e>t[r][1])s=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}function ou(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}function au(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=L0.exec(t);if(s){let i=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/i*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/i*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),D0.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(s*r,s*r+s),16);i[r]=s===1?o<<4:s===2?o:s===3?o>>4:o>>8}return i}}function _l(e,t){let s=e.toString(16),i=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function P0(e,t=16){let[s,i,r]=e;return`rgb:${_l(s,t)}/${_l(i,t)}/${_l(r,t)}`}function cu(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}function uu(e){return 0<=e&&e<256}function H0(e,t,s,i){let r={type:0,cancel:!1,key:void 0},o=(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?r.key=B.ESC+"OA":r.key=B.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=B.ESC+"OD":r.key=B.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=B.ESC+"OC":r.key=B.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=B.ESC+"OB":r.key=B.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":B.DEL,e.altKey&&(r.key=B.ESC+r.key);break;case 9:if(e.shiftKey){r.key=B.ESC+"[Z";break}r.key=B.HT,r.cancel=!0;break;case 13:r.key=e.altKey?B.ESC+B.CR:B.CR,r.cancel=!0;break;case 27:r.key=B.ESC,e.altKey&&(r.key=B.ESC+B.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"D":t?r.key=B.ESC+"OD":r.key=B.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"C":t?r.key=B.ESC+"OC":r.key=B.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"A":t?r.key=B.ESC+"OA":r.key=B.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=B.ESC+"[1;"+(o+1)+"B":t?r.key=B.ESC+"OB":r.key=B.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=B.ESC+"[2~");break;case 46:o?r.key=B.ESC+"[3;"+(o+1)+"~":r.key=B.ESC+"[3~";break;case 36:o?r.key=B.ESC+"[1;"+(o+1)+"H":t?r.key=B.ESC+"OH":r.key=B.ESC+"[H";break;case 35:o?r.key=B.ESC+"[1;"+(o+1)+"F":t?r.key=B.ESC+"OF":r.key=B.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=B.ESC+"[5;"+(o+1)+"~":r.key=B.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=B.ESC+"[6;"+(o+1)+"~":r.key=B.ESC+"[6~";break;case 112:o?r.key=B.ESC+"[1;"+(o+1)+"P":r.key=B.ESC+"OP";break;case 113:o?r.key=B.ESC+"[1;"+(o+1)+"Q":r.key=B.ESC+"OQ";break;case 114:o?r.key=B.ESC+"[1;"+(o+1)+"R":r.key=B.ESC+"OR";break;case 115:o?r.key=B.ESC+"[1;"+(o+1)+"S":r.key=B.ESC+"OS";break;case 116:o?r.key=B.ESC+"[15;"+(o+1)+"~":r.key=B.ESC+"[15~";break;case 117:o?r.key=B.ESC+"[17;"+(o+1)+"~":r.key=B.ESC+"[17~";break;case 118:o?r.key=B.ESC+"[18;"+(o+1)+"~":r.key=B.ESC+"[18~";break;case 119:o?r.key=B.ESC+"[19;"+(o+1)+"~":r.key=B.ESC+"[19~";break;case 120:o?r.key=B.ESC+"[20;"+(o+1)+"~":r.key=B.ESC+"[20~";break;case 121:o?r.key=B.ESC+"[21;"+(o+1)+"~":r.key=B.ESC+"[21~";break;case 122:o?r.key=B.ESC+"[23;"+(o+1)+"~":r.key=B.ESC+"[23~";break;case 123:o?r.key=B.ESC+"[24;"+(o+1)+"~":r.key=B.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=B.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=B.DEL:e.keyCode===219?r.key=B.ESC:e.keyCode===220?r.key=B.FS:e.keyCode===221&&(r.key=B.GS);else if((!s||i)&&e.altKey&&!e.metaKey){let n=F0[e.keyCode]?.[e.shiftKey?1:0];if(n)r.key=B.ESC+n;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(a);e.shiftKey&&(c=c.toUpperCase()),r.key=B.ESC+c}else if(e.keyCode===32)r.key=B.ESC+(e.ctrlKey?B.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),r.key=B.ESC+a,r.cancel=!0}}else s&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=B.US),e.key==="@"&&(r.key=B.NUL));break}return r}function K0(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}function Y0(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var bu,y_,w_,xe,F,gd,bl,_d,yl,$_,E_,Su,Ks,ho,En,Mt,bd,wl,il,lt,$u,ki,R_,ic,Eu,ct,Tu,L_,uo,Sl,In,ks,rc,$s,P_,Au,tr,Ru,M_,B_,Cl,I_,yd,kl,F_,Pu,W_,wd,Sd,Cd,Yk,V_,Mu,q_,Si,K_,Ou,Gs,ie,er,kt,El,we,kd,J_,Z_,Q_,$d,ev,Ze,Al,tv,Ed,Nu,sv,Ll,iv,rv,ov,vn,nv,av,bn,z,lv,Dl,oc,Jk,Zk,sr,Pl,yn,nc,Wu,Qk,e2,wn,Qi,Tn,An,ro,uv,ju,Vu,pv,fv,mv,gv,un,Sn,Td,_v,Ss,xs,xt,Uu,vv,rl,qu,ss,bv,ol,yv,t2,is,Ws,wv,Sv,Cv,xv,s2,i2,r2,o2,js,n2,ac,nl,Ad,Rd,kv,Ku,$v,Ev,Av,Rv,Lv,Dv,Ml,Ld,Mv,Zr,Dd,Yu,Bv,Ov,lc,Iv,zv,al,Nv,Pd,Kv,a2,qt,l2,c2,h2,Od,d2,u2,Gv,p2,f2,Yv,Id,Zv,Rn,Qv,cl,zd,m2,Ne,tb,ib,Qu,ts,Qr,ob,hc,Nd,nb,ab,lb,Fd,Hd,ub,pb,ep,tp,fb,mb,gb,Wd,jd,_b,zl,vb,bb,yb,Nl,Fl,Sb,Qt,Vs,qr,Ln,B,xn,sp,Hl,Fe,He,We,Ce,Vd,Ae,ge,Se,at,kn,Cb,Dn,Wl,Tb,Ab,dl,Lt,fn,qd,Kr,mn,Lb,jl,Vl,ip,Db,Pb,Mb,Bb,Ob,Ul,zb,rp,Fn,po,fo,op,Nb,np,Pn,Hb,Wb,ap,uc,lp,cp,jb,Vb,Mn,Ub,ql,qb,e0,ul,t0,s0,i0,r0,o0,Kl,Gd,Yd,Me,bi,eo,Xd,Jd,Gr,n0,Gl,a0,l0,c0,h0,Yl,d0,Zd,oe,Te,gn,pl,to,pp,g0,Oe,yi,Qd,eu,_0,mp,gp,Xl,Zi,v0,b0,tu,su,Jl,iu,ml,ru,Zl,gl,w0,Be,C0,wi,x0,Yr,k0,_p,Xr,$0,Ct,Jr,E0,io,nu,T0,Pt,A0,R0,L0,D0,M0,Us,lu,hu,du,B0,ec,O0,pu,I0,z0,tc,fu,N0,F0,$e,W0,vl,mu,j0,V0,U0,q0,gu,_u,Bn,sc,G0,X0,J0,vu,Z0,Q0,ey,ty,es,sy,fc=Ra(()=>{bu=Object.defineProperty,y_=Object.getOwnPropertyDescriptor,w_=(e,t)=>{for(var s in t)bu(e,s,{get:t[s],enumerable:!0})},xe=(e,t,s,i)=>{for(var r=i>1?void 0:i?y_(t,s):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(i?n(t,s,r):n(r))||r);return i&&r&&bu(t,s,r),r},F=(e,t)=>(s,i)=>t(s,i,e),gd="Terminal input",bl={get:()=>gd,set:e=>gd=e},_d="Too much output to announce, navigate to rows manually to read",yl={get:()=>_d,set:e=>_d=e};$_=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<s;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=s)return this._interim=n,i;let a=e.charCodeAt(o);56320<=a&&a<=57343?t[i++]=(n-55296)*1024+a-56320+65536:(t[i++]=n,t[i++]=a);continue}n!==65279&&(t[i++]=n)}return i}},E_=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let i=0,r,o,n,a,c=0,l=0;if(this.interim[0]){let m=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,_;for(;(_=this.interim[++f]&63)&&f<4;)p<<=6,p|=_;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=S-f;for(;l<k;){if(l>=s)return 0;if(_=e[l++],(_&192)!==128){l--,m=!0;break}else this.interim[f++]=_,p<<=6,p|=_&63}m||(S===2?p<128?l--:t[i++]=p:S===3?p<2048||p>=55296&&p<=57343||p===65279||(t[i++]=p):p<65536||p>1114111||(t[i++]=p)),this.interim.fill(0)}let h=s-4,d=l;for(;d<s;){for(;d<h&&!((r=e[d])&128)&&!((o=e[d+1])&128)&&!((n=e[d+2])&128)&&!((a=e[d+3])&128);)t[i++]=r,t[i++]=o,t[i++]=n,t[i++]=a,d+=4;if(r=e[d++],r<128)t[i++]=r;else if((r&224)===192){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(c=(r&31)<<6|o&63,c<128){d--;continue}t[i++]=c}else if((r&240)===224){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,i;if(n=e[d++],(n&192)!==128){d--;continue}if(c=(r&15)<<12|(o&63)<<6|n&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[i++]=c}else if((r&248)===240){if(d>=s)return this.interim[0]=r,i;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,i;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=n,i;if(a=e[d++],(a&192)!==128){d--;continue}if(c=(r&7)<<18|(o&63)<<12|(n&63)<<6|a&63,c<65536||c>1114111)continue;t[i++]=c}}return i}},Su="",Ks=" ",ho=class Cu{constructor(){this.fg=0,this.bg=0,this.extended=new En}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 Cu;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}},En=class xu{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 xu(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Mt=class ku extends ho{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new En,this.combinedData=""}static fromCharData(t){let s=new ku;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?qs(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 s=!1;if(t[1].length>2)s=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bd="di$target",wl="di$dependencies",il=new Map;lt=je("BufferService"),$u=je("CoreMouseService"),ki=je("CoreService"),R_=je("CharsetService"),ic=je("InstantiationService"),Eu=je("LogService"),ct=je("OptionsService"),Tu=je("OscLinkService"),L_=je("UnicodeService"),uo=je("DecorationService"),Sl=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Mt,n=s.getTrimmedLength(),a=-1,c=-1,l=!1;for(let h=0;h<n;h++)if(!(c===-1&&!s.hasContent(h))){if(s.loadCell(h,o),o.hasExtendedAttrs()&&o.extended.urlId)if(c===-1){c=h,a=o.extended.urlId;continue}else l=o.extended.urlId!==a;else c!==-1&&(l=!0);if(l||c!==-1&&h===n-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let m={start:{x:c+1,y:e},end:{x:h+(!l&&h===n-1?1:0),y:e}},p=!1;if(!r?.allowNonHttpProtocols)try{let f=new URL(d);["http:","https:"].includes(f.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:m,activate:(f,_)=>r?r.activate(f,_,m):D_(f,_),hover:(f,_)=>r?.hover?.(f,_,m),leave:(f,_)=>r?.leave?.(f,_,m)})}l=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=h,a=o.extended.urlId):(c=-1,a=-1)}}t(i)}};Sl=xe([F(0,lt),F(1,ct),F(2,Tu)],Sl);In=je("CharSizeService"),ks=je("CoreBrowserService"),rc=je("MouseService"),$s=je("RenderService"),P_=je("SelectionService"),Au=je("CharacterJoinerService"),tr=je("ThemeService"),Ru=je("LinkProviderService"),M_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yd.isErrorNoTelemetry(e)?new yd(e.message+`
4
4
 
5
5
  `+e.stack):new Error(e.message+`
6
6
 
7
- `+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)}},B_=new M_;xl="Canceled";I_=class extends Error{constructor(){super(xl),this.name=this.message}};yd=class kl extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kl)return t;let s=new kl;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},$l=class Lu extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Lu.prototype)}};F_=class Du{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Du.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=N_(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};F_.assertInvariants=!1;(e=>{function t(o){return o<0}e.isLessThan=t;function s(o){return o<=0}e.isLessThanOrEqual=s;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Pu||(Pu={}));W_=(e,t)=>e-t,wd=class El{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new El(s=>this.iterate(i=>t(i)?s(i):!0))}map(t){return new El(s=>this.iterate(i=>s(t(i))))}some(t){let s=!1;return this.iterate(i=>(s=t(i),!s)),s}findFirst(t){let s;return this.iterate(i=>t(i)?(s=i,!1):!0),s}findLast(t){let s;return this.iterate(i=>(t(i)&&(s=i),!0)),s}findLastMaxBy(t){let s,i=!0;return this.iterate(r=>((i||Pu.isGreaterThan(t(r,s)))&&(i=!1,s=r),!0)),s}};wd.empty=new wd(e=>{});Yk=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Sd]="SetWithKey";for(let s of e)this.add(s)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(s=>e.call(t,s,s,this))}[(Cd=Symbol.iterator,Sd=Symbol.toStringTag,Cd)](){return this.values()}},V_=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*r(y){yield y}e.single=r;function o(y){return t(y)?y:r(y)}e.wrap=o;function n(y){return y||s}e.from=n;function*a(y){for(let A=y.length-1;A>=0;A--)yield y[A]}e.reverse=a;function c(y){return!y||y[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(y){return y[Symbol.iterator]().next().value}e.first=l;function h(y,A){let M=0;for(let H of y)if(A(H,M++))return!0;return!1}e.some=h;function d(y,A){for(let M of y)if(A(M))return M}e.find=d;function*m(y,A){for(let M of y)A(M)&&(yield M)}e.filter=m;function*p(y,A){let M=0;for(let H of y)yield A(H,M++)}e.map=p;function*f(y,A){let M=0;for(let H of y)yield*A(H,M++)}e.flatMap=f;function*_(...y){for(let A of y)yield*A}e.concat=_;function S(y,A,M){let H=M;for(let q of y)H=A(H,q);return H}e.reduce=S;function*$(y,A,M=y.length){for(A<0&&(A+=y.length),M<0?M+=y.length:M>y.length&&(M=y.length);A<M;A++)yield y[A]}e.slice=$;function x(y,A=Number.POSITIVE_INFINITY){let M=[];if(A===0)return[M,y];let H=y[Symbol.iterator]();for(let q=0;q<A;q++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=x;async function v(y){let A=[];for await(let M of y)A.push(M);return Promise.resolve(A)}e.asyncToArray=v})(Mu||(Mu={}));q_=!1,Si=null,K_=class Bu{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Bu.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let i=this.getDisposableData(t);i.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let i=s.get(t);if(i)return i;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let i;if(s)i=s;else{let c=new Map,l=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,c).isSingleton);if(l.length===0)return;let h=new Set(l.map(d=>d.value));if(i=l.filter(d=>!(d.parent&&h.has(d.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(c){function l(d,m){for(;d.length>0&&m.some(p=>typeof p=="string"?p===d[0]:d[0].match(p));)d.shift()}let h=c.source.split(`
7
+ `+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)}},B_=new M_;Cl="Canceled";I_=class extends Error{constructor(){super(Cl),this.name=this.message}};yd=class xl extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof xl)return t;let s=new xl;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},kl=class Lu extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Lu.prototype)}};F_=class Du{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Du.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=N_(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};F_.assertInvariants=!1;(e=>{function t(o){return o<0}e.isLessThan=t;function s(o){return o<=0}e.isLessThanOrEqual=s;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Pu||(Pu={}));W_=(e,t)=>e-t,wd=class $l{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new $l(s=>this.iterate(i=>t(i)?s(i):!0))}map(t){return new $l(s=>this.iterate(i=>s(t(i))))}some(t){let s=!1;return this.iterate(i=>(s=t(i),!s)),s}findFirst(t){let s;return this.iterate(i=>t(i)?(s=i,!1):!0),s}findLast(t){let s;return this.iterate(i=>(t(i)&&(s=i),!0)),s}findLastMaxBy(t){let s,i=!0;return this.iterate(r=>((i||Pu.isGreaterThan(t(r,s)))&&(i=!1,s=r),!0)),s}};wd.empty=new wd(e=>{});Yk=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Sd]="SetWithKey";for(let s of e)this.add(s)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(s=>e.call(t,s,s,this))}[(Cd=Symbol.iterator,Sd=Symbol.toStringTag,Cd)](){return this.values()}},V_=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*r(y){yield y}e.single=r;function o(y){return t(y)?y:r(y)}e.wrap=o;function n(y){return y||s}e.from=n;function*a(y){for(let A=y.length-1;A>=0;A--)yield y[A]}e.reverse=a;function c(y){return!y||y[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(y){return y[Symbol.iterator]().next().value}e.first=l;function h(y,A){let M=0;for(let H of y)if(A(H,M++))return!0;return!1}e.some=h;function d(y,A){for(let M of y)if(A(M))return M}e.find=d;function*m(y,A){for(let M of y)A(M)&&(yield M)}e.filter=m;function*p(y,A){let M=0;for(let H of y)yield A(H,M++)}e.map=p;function*f(y,A){let M=0;for(let H of y)yield*A(H,M++)}e.flatMap=f;function*_(...y){for(let A of y)yield*A}e.concat=_;function S(y,A,M){let H=M;for(let q of y)H=A(H,q);return H}e.reduce=S;function*k(y,A,M=y.length){for(A<0&&(A+=y.length),M<0?M+=y.length:M>y.length&&(M=y.length);A<M;A++)yield y[A]}e.slice=k;function x(y,A=Number.POSITIVE_INFINITY){let M=[];if(A===0)return[M,y];let H=y[Symbol.iterator]();for(let q=0;q<A;q++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=x;async function v(y){let A=[];for await(let M of y)A.push(M);return Promise.resolve(A)}e.asyncToArray=v})(Mu||(Mu={}));q_=!1,Si=null,K_=class Bu{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Bu.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let i=this.getDisposableData(t);i.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let i=s.get(t);if(i)return i;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let i;if(s)i=s;else{let c=new Map,l=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,c).isSingleton);if(l.length===0)return;let h=new Set(l.map(d=>d.value));if(i=l.filter(d=>!(d.parent&&h.has(d.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(c){function l(d,m){for(;d.length>0&&m.some(p=>typeof p=="string"?p===d[0]:d[0].match(p));)d.shift()}let h=c.source.split(`
8
8
  `).map(d=>d.trim().replace("at ","")).filter(d=>d!=="");return l(h,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),h.reverse()}let o=new V_;for(let c of i){let l=r(c);for(let h=0;h<=l.length;h++)o.add(l.slice(0,h).join(`
9
9
  `),c)}i.sort(H_(c=>c.idx,W_));let n="",a=0;for(let c of i.slice(0,t)){a++;let l=r(c),h=[];for(let d=0;d<l.length;d++){let m=l[d];m=`(shared with ${o.get(l.slice(0,d+1).join(`
10
10
  `)).size}/${i.length} leaks) at ${m}`;let p=o.get(l.slice(0,d).join(`
@@ -21,23 +21,23 @@ ${h.join(`
21
21
 
22
22
  ... and ${i.length-t} more leaking disposables
23
23
 
24
- `),{leaks:i,details:n}}};K_.idx=0;if(q_){let e="__is_disposable_tracked__";G_(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==ie.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==ie.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}Ou=class Iu{constructor(){this._toDispose=new Set,this._isDisposed=!1,Fn(this)}dispose(){this._isDisposed||(Hn(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ci(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 ao(t,this),this._isDisposed?Iu.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),ao(t,null))}};Ou.DISABLE_DISPOSED_WARNING=!1;Gs=Ou,ie=class{constructor(){this._store=new Gs,Fn(this),ao(this._store,this)}dispose(){Hn(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ie.None=Object.freeze({dispose(){}});er=class{constructor(){this._isDisposed=!1,Fn(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ao(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Hn(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ao(e,null),e}},kt=typeof window=="object"?window:globalThis,Tl=class Al{constructor(t){this.element=t,this.next=Al.Undefined,this.prev=Al.Undefined}};Tl.Undefined=new Tl(void 0);we=Tl,kd=class{constructor(){this._first=we.Undefined,this._last=we.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===we.Undefined}clear(){let e=this._first;for(;e!==we.Undefined;){let t=e.next;e.prev=we.Undefined,e.next=we.Undefined,e=t}this._first=we.Undefined,this._last=we.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new we(e);if(this._first===we.Undefined)this._first=s,this._last=s;else if(t){let r=this._last;this._last=s,s.prev=r,r.next=s}else{let r=this._first;this._first=s,s.next=r,r.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==we.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==we.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==we.Undefined&&e.next!==we.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===we.Undefined&&e.next===we.Undefined?(this._first=we.Undefined,this._last=we.Undefined):e.next===we.Undefined?(this._last=this._last.prev,this._last.next=we.Undefined):e.prev===we.Undefined&&(this._first=this._first.next,this._first.prev=we.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==we.Undefined;)yield e.element,e=e.next}},J_=globalThis.performance&&typeof globalThis.performance.now=="function",Z_=class zu{static create(t){return new zu(t)}constructor(t){this._now=J_&&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}},Q_=!1,$d=!1,ev=!1;(e=>{e.None=()=>ie.None;function t(E){if(ev){let{onDidAddListener:w}=E,L=Dl.create(),T=0;E.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),L.print()),w?.()}}}function s(E,w){return m(E,()=>{},0,void 0,!0,void 0,w)}e.defer=s;function i(E){return(w,L=null,T)=>{let P=!1,D;return D=E(N=>{if(!P)return D?D.dispose():P=!0,w.call(L,N)},null,T),P&&D.dispose(),D}}e.once=i;function r(E,w,L){return h((T,P=null,D)=>E(N=>T.call(P,w(N)),null,D),L)}e.map=r;function o(E,w,L){return h((T,P=null,D)=>E(N=>{w(N),T.call(P,N)},null,D),L)}e.forEach=o;function n(E,w,L){return h((T,P=null,D)=>E(N=>w(N)&&T.call(P,N),null,D),L)}e.filter=n;function a(E){return E}e.signal=a;function c(...E){return(w,L=null,T)=>{let P=X_(...E.map(D=>D(N=>w.call(L,N))));return d(P,T)}}e.any=c;function l(E,w,L,T){let P=L;return r(E,D=>(P=w(P,D),P),T)}e.reduce=l;function h(E,w){let L,T={onWillAddFirstListener(){L=E(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}};w||t(T);let P=new z(T);return w?.add(P),P.event}function d(E,w){return w instanceof Array?w.push(E):w&&w.add(E),E}function m(E,w,L=100,T=!1,P=!1,D,N){let Z,le,Xe,ut=0,be,Ft={leakWarningThreshold:D,onWillAddFirstListener(){Z=E(ps=>{ut++,le=w(le,ps),T&&!Xe&&(Ee.fire(le),le=void 0),be=()=>{let ci=le;le=void 0,Xe=void 0,(!T||ut>1)&&Ee.fire(ci),ut=0},typeof L=="number"?(clearTimeout(Xe),Xe=setTimeout(be,L)):Xe===void 0&&(Xe=0,queueMicrotask(be))})},onWillRemoveListener(){P&&ut>0&&be?.()},onDidRemoveLastListener(){be=void 0,Z.dispose()}};N||t(Ft);let Ee=new z(Ft);return N?.add(Ee),Ee.event}e.debounce=m;function p(E,w=0,L){return e.debounce(E,(T,P)=>T?(T.push(P),T):[P],w,void 0,!0,void 0,L)}e.accumulate=p;function f(E,w=(T,P)=>T===P,L){let T=!0,P;return n(E,D=>{let N=T||!w(D,P);return T=!1,P=D,N},L)}e.latch=f;function _(E,w,L){return[e.filter(E,w,L),e.filter(E,T=>!w(T),L)]}e.split=_;function S(E,w=!1,L=[],T){let P=L.slice(),D=E(le=>{P?P.push(le):Z.fire(le)});T&&T.add(D);let N=()=>{P?.forEach(le=>Z.fire(le)),P=null},Z=new z({onWillAddFirstListener(){D||(D=E(le=>Z.fire(le)),T&&T.add(D))},onDidAddFirstListener(){P&&(w?setTimeout(N):N())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return T&&T.add(Z),Z.event}e.buffer=S;function $(E,w){return(L,T,P)=>{let D=w(new v);return E(function(N){let Z=D.evaluate(N);Z!==x&&L.call(T,Z)},void 0,P)}}e.chain=$;let x=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(L=>(w(L),L)),this}filter(w){return this.steps.push(L=>w(L)?L:x),this}reduce(w,L){let T=L;return this.steps.push(P=>(T=w(T,P),T)),this}latch(w=(L,T)=>L===T){let L=!0,T;return this.steps.push(P=>{let D=L||!w(P,T);return L=!1,T=P,D?P:x}),this}evaluate(w){for(let L of this.steps)if(w=L(w),w===x)break;return w}}function y(E,w,L=T=>T){let T=(...Z)=>N.fire(L(...Z)),P=()=>E.on(w,T),D=()=>E.removeListener(w,T),N=new z({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromNodeEventEmitter=y;function A(E,w,L=T=>T){let T=(...Z)=>N.fire(L(...Z)),P=()=>E.addEventListener(w,T),D=()=>E.removeEventListener(w,T),N=new z({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromDOMEventEmitter=A;function M(E){return new Promise(w=>i(E)(w))}e.toPromise=M;function H(E){let w=new z;return E.then(L=>{w.fire(L)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}e.fromPromise=H;function q(E,w){return E(L=>w.fire(L))}e.forward=q;function ee(E,w,L){return w(L),E(T=>w(T))}e.runAndSubscribe=ee;class ce{constructor(w,L){this._observable=w,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};L||t(T),this.emitter=new z(T),L&&L.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,L){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(E,w){return new ce(E,w).emitter.event}e.fromObservable=V;function ve(E){return(w,L,T)=>{let P=0,D=!1,N={beginUpdate(){P++},endUpdate(){P--,P===0&&(E.reportChanges(),D&&(D=!1,w.call(L)))},handlePossibleChange(){},handleChange(){D=!0}};E.addObserver(N),E.reportChanges();let Z={dispose(){E.removeObserver(N)}};return T instanceof Gs?T.add(Z):Array.isArray(T)&&T.push(Z),Z}}e.fromObservableLight=ve})(Ze||(Ze={}));Rl=class Ll{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ll._idPool++}`,Ll.all.add(this)}start(t){this._stopWatch=new Z_,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}}};Rl.all=new Set,Rl._idPool=0;tv=Rl,Ed=-1,Nu=class Fu{constructor(t,s,i=(Fu._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(o);let c=new iv(a,o);this._errorHandler(c)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,r]of this._stacks)(!t||s<r)&&(t=[i,r],s=r);return t}};Nu._idPool=1;sv=Nu,Dl=class Hu{constructor(t){this.value=t}static create(){let t=new Error;return new Hu(t.stack??"")}print(){console.warn(this.value.split(`
24
+ `),{leaks:i,details:n}}};K_.idx=0;if(q_){let e="__is_disposable_tracked__";G_(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==ie.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==ie.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}Ou=class Iu{constructor(){this._toDispose=new Set,this._isDisposed=!1,zn(this)}dispose(){this._isDisposed||(Nn(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ci(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 no(t,this),this._isDisposed?Iu.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),no(t,null))}};Ou.DISABLE_DISPOSED_WARNING=!1;Gs=Ou,ie=class{constructor(){this._store=new Gs,zn(this),no(this._store,this)}dispose(){Nn(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ie.None=Object.freeze({dispose(){}});er=class{constructor(){this._isDisposed=!1,zn(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&no(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Nn(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&no(e,null),e}},kt=typeof window=="object"?window:globalThis,El=class Tl{constructor(t){this.element=t,this.next=Tl.Undefined,this.prev=Tl.Undefined}};El.Undefined=new El(void 0);we=El,kd=class{constructor(){this._first=we.Undefined,this._last=we.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===we.Undefined}clear(){let e=this._first;for(;e!==we.Undefined;){let t=e.next;e.prev=we.Undefined,e.next=we.Undefined,e=t}this._first=we.Undefined,this._last=we.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new we(e);if(this._first===we.Undefined)this._first=s,this._last=s;else if(t){let r=this._last;this._last=s,s.prev=r,r.next=s}else{let r=this._first;this._first=s,s.next=r,r.prev=s}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(s))}}shift(){if(this._first!==we.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==we.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==we.Undefined&&e.next!==we.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===we.Undefined&&e.next===we.Undefined?(this._first=we.Undefined,this._last=we.Undefined):e.next===we.Undefined?(this._last=this._last.prev,this._last.next=we.Undefined):e.prev===we.Undefined&&(this._first=this._first.next,this._first.prev=we.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==we.Undefined;)yield e.element,e=e.next}},J_=globalThis.performance&&typeof globalThis.performance.now=="function",Z_=class zu{static create(t){return new zu(t)}constructor(t){this._now=J_&&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}},Q_=!1,$d=!1,ev=!1;(e=>{e.None=()=>ie.None;function t($){if(ev){let{onDidAddListener:w}=$,L=Ll.create(),E=0;$.onDidAddListener=()=>{++E===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),L.print()),w?.()}}}function s($,w){return m($,()=>{},0,void 0,!0,void 0,w)}e.defer=s;function i($){return(w,L=null,E)=>{let P=!1,D;return D=$(N=>{if(!P)return D?D.dispose():P=!0,w.call(L,N)},null,E),P&&D.dispose(),D}}e.once=i;function r($,w,L){return h((E,P=null,D)=>$(N=>E.call(P,w(N)),null,D),L)}e.map=r;function o($,w,L){return h((E,P=null,D)=>$(N=>{w(N),E.call(P,N)},null,D),L)}e.forEach=o;function n($,w,L){return h((E,P=null,D)=>$(N=>w(N)&&E.call(P,N),null,D),L)}e.filter=n;function a($){return $}e.signal=a;function c(...$){return(w,L=null,E)=>{let P=X_(...$.map(D=>D(N=>w.call(L,N))));return d(P,E)}}e.any=c;function l($,w,L,E){let P=L;return r($,D=>(P=w(P,D),P),E)}e.reduce=l;function h($,w){let L,E={onWillAddFirstListener(){L=$(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}};w||t(E);let P=new z(E);return w?.add(P),P.event}function d($,w){return w instanceof Array?w.push($):w&&w.add($),$}function m($,w,L=100,E=!1,P=!1,D,N){let Z,le,Xe,ut=0,be,Ft={leakWarningThreshold:D,onWillAddFirstListener(){Z=$(ps=>{ut++,le=w(le,ps),E&&!Xe&&(Ee.fire(le),le=void 0),be=()=>{let ci=le;le=void 0,Xe=void 0,(!E||ut>1)&&Ee.fire(ci),ut=0},typeof L=="number"?(clearTimeout(Xe),Xe=setTimeout(be,L)):Xe===void 0&&(Xe=0,queueMicrotask(be))})},onWillRemoveListener(){P&&ut>0&&be?.()},onDidRemoveLastListener(){be=void 0,Z.dispose()}};N||t(Ft);let Ee=new z(Ft);return N?.add(Ee),Ee.event}e.debounce=m;function p($,w=0,L){return e.debounce($,(E,P)=>E?(E.push(P),E):[P],w,void 0,!0,void 0,L)}e.accumulate=p;function f($,w=(E,P)=>E===P,L){let E=!0,P;return n($,D=>{let N=E||!w(D,P);return E=!1,P=D,N},L)}e.latch=f;function _($,w,L){return[e.filter($,w,L),e.filter($,E=>!w(E),L)]}e.split=_;function S($,w=!1,L=[],E){let P=L.slice(),D=$(le=>{P?P.push(le):Z.fire(le)});E&&E.add(D);let N=()=>{P?.forEach(le=>Z.fire(le)),P=null},Z=new z({onWillAddFirstListener(){D||(D=$(le=>Z.fire(le)),E&&E.add(D))},onDidAddFirstListener(){P&&(w?setTimeout(N):N())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return E&&E.add(Z),Z.event}e.buffer=S;function k($,w){return(L,E,P)=>{let D=w(new v);return $(function(N){let Z=D.evaluate(N);Z!==x&&L.call(E,Z)},void 0,P)}}e.chain=k;let x=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(L=>(w(L),L)),this}filter(w){return this.steps.push(L=>w(L)?L:x),this}reduce(w,L){let E=L;return this.steps.push(P=>(E=w(E,P),E)),this}latch(w=(L,E)=>L===E){let L=!0,E;return this.steps.push(P=>{let D=L||!w(P,E);return L=!1,E=P,D?P:x}),this}evaluate(w){for(let L of this.steps)if(w=L(w),w===x)break;return w}}function y($,w,L=E=>E){let E=(...Z)=>N.fire(L(...Z)),P=()=>$.on(w,E),D=()=>$.removeListener(w,E),N=new z({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromNodeEventEmitter=y;function A($,w,L=E=>E){let E=(...Z)=>N.fire(L(...Z)),P=()=>$.addEventListener(w,E),D=()=>$.removeEventListener(w,E),N=new z({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromDOMEventEmitter=A;function M($){return new Promise(w=>i($)(w))}e.toPromise=M;function H($){let w=new z;return $.then(L=>{w.fire(L)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}e.fromPromise=H;function q($,w){return $(L=>w.fire(L))}e.forward=q;function ee($,w,L){return w(L),$(E=>w(E))}e.runAndSubscribe=ee;class ce{constructor(w,L){this._observable=w,this._counter=0,this._hasChanged=!1;let E={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};L||t(E),this.emitter=new z(E),L&&L.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,L){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V($,w){return new ce($,w).emitter.event}e.fromObservable=V;function ve($){return(w,L,E)=>{let P=0,D=!1,N={beginUpdate(){P++},endUpdate(){P--,P===0&&($.reportChanges(),D&&(D=!1,w.call(L)))},handlePossibleChange(){},handleChange(){D=!0}};$.addObserver(N),$.reportChanges();let Z={dispose(){$.removeObserver(N)}};return E instanceof Gs?E.add(Z):Array.isArray(E)&&E.push(Z),Z}}e.fromObservableLight=ve})(Ze||(Ze={}));Al=class Rl{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Rl._idPool++}`,Rl.all.add(this)}start(t){this._stopWatch=new Z_,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}}};Al.all=new Set,Al._idPool=0;tv=Al,Ed=-1,Nu=class Fu{constructor(t,s,i=(Fu._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(o);let c=new iv(a,o);this._errorHandler(c)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,r]of this._stacks)(!t||s<r)&&(t=[i,r],s=r);return t}};Nu._idPool=1;sv=Nu,Ll=class Hu{constructor(t){this.value=t}static create(){let t=new Error;return new Hu(t.stack??"")}print(){console.warn(this.value.split(`
25
25
  `).slice(2).join(`
26
- `))}},iv=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},rv=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ov=0,yn=class{constructor(e){this.value=e,this.id=ov++}},nv=2,av=(e,t)=>{if(e instanceof yn)t(e);else for(let s=0;s<e.length;s++){let i=e[s];i&&t(i)}};if(Q_){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
27
- `)),e.length=0)},3e3),wn=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ed>0||this._options?.leakWarningThreshold?new sv(e?.onListenerError??bn,this._options?.leakWarningThreshold??Ed):void 0,this._perfMon=this._options?._profName?new tv(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if($d){let e=this._listeners;queueMicrotask(()=>{av(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new rv(`${a}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||bn)(l),ie.None}if(this._disposed)return ie.None;t&&(e=e.bind(t));let i=new yn(e),r,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Dl.create(),r=this._leakageMon.check(i.stack,this._size+1)),$d&&(i.stack=o??Dl.create()),this._listeners?this._listeners instanceof yn?(this._deliveryQueue??(this._deliveryQueue=new lv),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=_e(()=>{wn?.unregister(n),r?.(),this._removeListener(i)});if(s instanceof Gs?s.add(n):Array.isArray(s)&&s.push(n),wn){let a=new Error().stack.split(`
26
+ `))}},iv=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},rv=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ov=0,vn=class{constructor(e){this.value=e,this.id=ov++}},nv=2,av=(e,t)=>{if(e instanceof vn)t(e);else for(let s=0;s<e.length;s++){let i=e[s];i&&t(i)}};if(Q_){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
27
+ `)),e.length=0)},3e3),bn=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ed>0||this._options?.leakWarningThreshold?new sv(e?.onListenerError??_n,this._options?.leakWarningThreshold??Ed):void 0,this._perfMon=this._options?._profName?new tv(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if($d){let e=this._listeners;queueMicrotask(()=>{av(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new rv(`${a}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||_n)(l),ie.None}if(this._disposed)return ie.None;t&&(e=e.bind(t));let i=new vn(e),r,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Ll.create(),r=this._leakageMon.check(i.stack,this._size+1)),$d&&(i.stack=o??Ll.create()),this._listeners?this._listeners instanceof vn?(this._deliveryQueue??(this._deliveryQueue=new lv),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=_e(()=>{bn?.unregister(n),r?.(),this._removeListener(i)});if(s instanceof Gs?s.add(n):Array.isArray(s)&&s.push(n),bn){let a=new Error().stack.split(`
28
28
  `).slice(2,3).join(`
29
- `).trim(),c=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);wn.register(n,c?.[2]??a,n)}return n}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*nv<=t.length){let r=0;for(let o=0;o<t.length;o++)t[o]?t[r++]=t[o]:i&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||bn;if(!s){e.value(t);return}try{e.value(t)}catch(i){s(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof yn)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},lv=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Pl=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Pl.INSTANCE=new Pl;nc=Pl;Jk=nc.INSTANCE.onDidChangeZoomLevel;Zk=nc.INSTANCE.onDidChangeFullscreen,sr=typeof navigator=="object"?navigator.userAgent:"",Ml=sr.indexOf("Firefox")>=0,Sn=sr.indexOf("AppleWebKit")>=0,ac=sr.indexOf("Chrome")>=0,Wu=!ac&&sr.indexOf("Safari")>=0,Qk=sr.indexOf("Electron/")>=0,e2=sr.indexOf("Android")>=0,Cn=!1;if(typeof kt.matchMedia=="function"){let e=kt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=kt.matchMedia("(display-mode: fullscreen)");Cn=e.matches,cv(kt,e,({matches:s})=>{Cn&&t.matches||(Cn=s)})}Qi="en",Rn=!1,Ln=!1,oo=!1,uv=!1,ju=!1,Vu=!1,pv=!1,fv=!1,mv=!1,gv=!1,xn=Qi,Td=Qi,xs=globalThis;typeof xs.vscode<"u"&&typeof xs.vscode.process<"u"?xt=xs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(xt=process);Uu=typeof xt?.versions?.electron=="string",vv=Uu&&xt?.type==="renderer";if(typeof xt=="object"){Rn=xt.platform==="win32",Ln=xt.platform==="darwin",oo=xt.platform==="linux",uv=oo&&!!xt.env.SNAP&&!!xt.env.SNAP_REVISION,pv=Uu,mv=!!xt.env.CI||!!xt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,fn=Qi,xn=Qi;let e=xt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);fn=t.userLocale,Td=t.osLocale,xn=t.resolvedLanguage||Qi,_v=t.languagePack?.translationsConfigFile}catch{}ju=!0}else typeof navigator=="object"&&!vv?(Ss=navigator.userAgent,Rn=Ss.indexOf("Windows")>=0,Ln=Ss.indexOf("Macintosh")>=0,fv=(Ss.indexOf("Macintosh")>=0||Ss.indexOf("iPad")>=0||Ss.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,oo=Ss.indexOf("Linux")>=0,gv=Ss?.indexOf("Mobi")>=0,Vu=!0,xn=globalThis._VSCODE_NLS_LANGUAGE||Qi,fn=navigator.language.toLowerCase(),Td=fn):console.error("Unable to resolve platform.");ol=0;Ln?ol=1:Rn?ol=3:oo&&(ol=2);qu=Rn,ss=Ln,bv=oo,nl=ju,yv=Vu&&typeof xs.importScripts=="function",t2=yv?xs.origin:void 0,is=Ss,Ws=xn;(e=>{function t(){return Ws}e.value=t;function s(){return Ws.length===2?Ws==="en":Ws.length>=3?Ws[0]==="e"&&Ws[1]==="n"&&Ws[2]==="-":!1}e.isDefaultVariant=s;function i(){return Ws==="en"}e.isDefault=i})(wv||(wv={}));Sv=typeof xs.postMessage=="function"&&!xs.importScripts,Cv=(()=>{if(Sv){let e=[];xs.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),xs.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),xv=!!(is&&is.indexOf("Chrome")>=0),s2=!!(is&&is.indexOf("Firefox")>=0),i2=!!(!xv&&is&&is.indexOf("Safari")>=0),r2=!!(is&&is.indexOf("Edg/")>=0),o2=!!(is&&is.indexOf("Android")>=0),js=typeof navigator=="object"?navigator:{},n2={clipboard:{writeText:nl||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(js&&js.clipboard&&js.clipboard.writeText),readText:nl||!!(js&&js.clipboard&&js.clipboard.readText)},keyboard:nl||dv()?0:js.keyboard||Wu?1:2,touch:"ontouchstart"in kt||js.maxTouchPoints>0,pointerEvents:kt.PointerEvent&&("ontouchstart"in kt||navigator.maxTouchPoints>0)},lc=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}},al=new lc,Ad=new lc,Rd=new lc,kv=new Array(230);(e=>{function t(a){return al.keyCodeToStr(a)}e.toString=t;function s(a){return al.strToKeyCode(a)}e.fromString=s;function i(a){return Ad.keyCodeToStr(a)}e.toUserSettingsUS=i;function r(a){return Rd.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function o(a){return Ad.strToKeyCode(a)||Rd.strToKeyCode(a)}e.fromUserSettings=o;function n(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return al.keyCodeToStr(a)}e.toElectronAccelerator=n})(Ku||(Ku={}));$v=class Gu{constructor(t,s,i,r,o){this.ctrlKey=t,this.shiftKey=s,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof Gu&&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",s=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${s}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Ev([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Ev=class{constructor(e){if(e.length===0)throw z_("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};Av=ss?256:2048,Rv=512,Lv=1024,Dv=ss?2048:256,Bl=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=Tv(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Av),this.altKey&&(t|=Rv),this.shiftKey&&(t|=Lv),this.metaKey&&(t|=Dv),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new $v(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ld=new WeakMap;Mv=class{static getSameOriginWindowChain(e){let t=Ld.get(e);if(!t){t=[],Ld.set(e,t);let s=e,i;do i=Pv(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let n=o.window.deref();if(s+=n?.scrollY??0,i+=n?.scrollX??0,n===t||!o.iframeElement)break;let a=o.iframeElement.getBoundingClientRect();s+=a.top,i+=a.left}return{top:s,left:i}}},Qr=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=Mv.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Dd=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let i=!1;if(ac){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,n=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*n):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Ml&&!ss?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Wu&&qu?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*n):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Ml&&!ss?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*n):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Yu=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}});(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof Ov?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ze.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Yu})})(Bv||(Bv={}));Ov=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?Yu:(this._emitter||(this._emitter=new z),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},cc=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 $l("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $l("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Iv=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new $l("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this.disposable=_e(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?ll=(e,t)=>{Cv(()=>{if(s)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:ll=(e,t,s)=>{let i=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(i))}}},zv=e=>ll(globalThis,e)})();(e=>{async function t(i){let r,o=await Promise.all(i.map(n=>n.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return o}e.settled=t;function s(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(n){o(n)}})}e.withAsyncBody=s})(Nv||(Nv={}));Pd=class Dt{static fromArray(t){return new Dt(s=>{s.emitMany(t)})}static fromPromise(t){return new Dt(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Dt(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new Dt(async s=>{await Promise.all(t.map(async i=>{for await(let r of i)s.emitOne(r)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new z,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ze.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Dt(async i=>{for await(let r of t)i.emitOne(s(r))})}map(t){return Dt.map(this,t)}static filter(t,s){return new Dt(async i=>{for await(let r of t)s(r)&&i.emitOne(r)})}filter(t){return Dt.filter(this,t)}static coalesce(t){return Dt.filter(t,s=>!!s)}coalesce(){return Dt.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return Dt.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())}};Pd.EMPTY=Pd.fromArray([]);Kv=class Ju{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let s=t.length;if(s===0)return;let i=this._buff,r=this._buffLen,o=this._leftoverHighSurrogate,n,a;for(o!==0?(n=o,a=-1,o=0):(n=t.charCodeAt(0),a=0);;){let c=n;if(Fv(n))if(a+1<s){let l=t.charCodeAt(a+1);Md(l)?(a++,c=Hv(n,l)):c=65533}else{o=n;break}else Md(n)&&(c=65533);if(r=this._push(i,r,c),a++,a<s)n=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=o}_push(t,s,i){return i<128?t[s++]=i:i<2048?(t[s++]=192|(i&1984)>>>6,t[s++]=128|(i&63)>>>0):i<65536?(t[s++]=224|(i&61440)>>>12,t[s++]=128|(i&4032)>>>6,t[s++]=128|(i&63)>>>0):(t[s++]=240|(i&1835008)>>>18,t[s++]=128|(i&258048)>>>12,t[s++]=128|(i&4032)>>>6,t[s++]=128|(i&63)>>>0),s>=64&&(this._step(),s-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),s}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),qr(this._h0)+qr(this._h1)+qr(this._h2)+qr(this._h3)+qr(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Bd(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Bd(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Ju._bigBlock32,s=this._buffDV;for(let d=0;d<64;d+=4)t.setUint32(d,s.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)t.setUint32(d,cl(t.getUint32(d-12,!1)^t.getUint32(d-32,!1)^t.getUint32(d-56,!1)^t.getUint32(d-64,!1),1),!1);let i=this._h0,r=this._h1,o=this._h2,n=this._h3,a=this._h4,c,l,h;for(let d=0;d<80;d++)d<20?(c=r&o|~r&n,l=1518500249):d<40?(c=r^o^n,l=1859775393):d<60?(c=r&o|r&n|o&n,l=2400959708):(c=r^o^n,l=3395469782),h=cl(i,5)+c+a+l+t.getUint32(d*4,!1)&4294967295,a=n,n=o,o=cl(r,30),r=i,i=h;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};Kv._bigBlock32=new DataView(new ArrayBuffer(320));({registerWindow:a2,getWindow:qt,getDocument:l2,getWindows:c2,getWindowsCount:h2,getWindowId:Od,getWindowById:d2,hasWindow:u2,onDidRegisterWindow:Gv,onWillUnregisterWindow:p2,onDidUnregisterWindow:f2}=(function(){let e=new Map,t={window:kt,disposables:new Gs};e.set(kt.vscodeWindowId,t);let s=new z,i=new z,r=new z;function o(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(n){if(e.has(n.vscodeWindowId))return ie.None;let a=new Gs,c={window:n,disposables:a.add(new Gs)};return e.set(n.vscodeWindowId,c),a.add(_e(()=>{e.delete(n.vscodeWindowId),i.fire(n)})),a.add(K(n,Ne.BEFORE_UNLOAD,()=>{r.fire(n)})),s.fire(c),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:o,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let c=n;return c?.view?c.view.window:kt},getDocument(n){return qt(n).document}}})()),Yv=class{constructor(e,t,s,i){this._node=e,this._type=t,this._handler=s,this._options=i||!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)}};Id=function(e,t,s,i){let r=s;return t==="click"||t==="mousedown"||t==="contextmenu"?r=Xv(qt(e),s):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=Jv(s)),K(e,t,r,i)},Qv=class extends Iv{constructor(e){super(),this.defaultTarget=e&&qt(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},hl=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){bn(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,i=new Map,r=o=>{s.set(o,!1);let n=e.get(o)??[];for(t.set(o,n),e.set(o,[]),i.set(o,!0);n.length>0;)n.sort(hl.sort),n.shift().execute();i.set(o,!1)};Dn=(o,n,a=0)=>{let c=Od(o),l=new hl(n,a),h=e.get(c);return h||(h=[],e.set(c,h)),h.push(l),s.get(c)||(s.set(c,!0),o.requestAnimationFrame(()=>r(c))),l},Zv=(o,n,a)=>{let c=Od(o);if(i.get(c)){let l=new hl(n,a),h=t.get(c);return h||(h=[],t.set(c,h)),h.push(l),l}else return Dn(o,n,a)}})();zd=class kn{constructor(t,s){this.width=t,this.height=s}with(t=this.width,s=this.height){return t!==this.width||s!==this.height?new kn(t,s):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof kn?t:new kn(t.width,t.height)}static equals(t,s){return t===s?!0:!t||!s?!1:t.width===s.width&&t.height===s.height}};zd.None=new zd(0,0);m2=new class{constructor(){this.mutationObservers=new Map}observe(e,t,s){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let r=Wv(s),o=i.get(r);if(o)o.users+=1;else{let n=new z,a=new MutationObserver(l=>n.fire(l));a.observe(e,s);let c=o={users:1,observer:a,onDidMutate:n.event};t.add(_e(()=>{c.users-=1,c.users===0&&(n.dispose(),a.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(e))})),i.set(r,o)}return o.onDidMutate}},Ne={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Sn?"webkitAnimationStart":"animationstart",ANIMATION_END:Sn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Sn?"webkitAnimationIteration":"animationiteration"},tb=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;sb.SVG=function(e,t,...s){return Zu("http://www.w3.org/2000/svg",e,t,...s)};ib=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=mt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=mt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=mt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=mt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=mt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=mt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=mt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=mt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=mt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=mt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=mt(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=mt(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=mt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=mt(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)}};Qu=class{constructor(){this._hooks=new Gs,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(_e(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=qt(e)}this._hooks.add(K(o,Ne.POINTER_MOVE,n=>{if(n.buttons!==s){this.stopMonitoring(!0);return}n.preventDefault(),this._pointerMoveCallback(n)})),this._hooks.add(K(o,Ne.POINTER_UP,n=>this.stopMonitoring(!0)))}};(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ts||(ts={}));eo=class ot extends ie{constructor(){super(),this.dispatched=!1,this.targets=new kd,this.ignoreTargets=new kd,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ze.runAndSubscribe(Gv,({window:t,disposables:s})=>{s.add(K(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(K(t.document,"touchend",i=>this.onTouchEnd(t,i))),s.add(K(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:kt,disposables:this._store}))}static addTarget(t){if(!ot.isTouchDevice())return ie.None;ot.INSTANCE||(ot.INSTANCE=xd(new ot));let s=ot.INSTANCE.targets.push(t);return _e(s)}static ignoreTarget(t){if(!ot.isTouchDevice())return ie.None;ot.INSTANCE||(ot.INSTANCE=xd(new ot));let s=ot.INSTANCE.ignoreTargets.push(t);return _e(s)}static isTouchDevice(){return"ontouchstart"in kt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:s,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[s],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let n=this.newGestureEvent(ts.Start,o.target);n.pageX=o.pageX,n.pageY=o.pageY,this.dispatchEvent(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,n=s.changedTouches.length;o<n;o++){let a=s.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],l=Date.now()-c.initialTimeStamp;if(l<ot.HOLD_DELAY&&Math.abs(c.initialPageX-St(c.rollingPageX))<30&&Math.abs(c.initialPageY-St(c.rollingPageY))<30){let h=this.newGestureEvent(ts.Tap,c.initialTarget);h.pageX=St(c.rollingPageX),h.pageY=St(c.rollingPageY),this.dispatchEvent(h)}else if(l>=ot.HOLD_DELAY&&Math.abs(c.initialPageX-St(c.rollingPageX))<30&&Math.abs(c.initialPageY-St(c.rollingPageY))<30){let h=this.newGestureEvent(ts.Contextmenu,c.initialTarget);h.pageX=St(c.rollingPageX),h.pageY=St(c.rollingPageY),this.dispatchEvent(h)}else if(r===1){let h=St(c.rollingPageX),d=St(c.rollingPageY),m=St(c.rollingTimestamps)-c.rollingTimestamps[0],p=h-c.rollingPageX[0],f=d-c.rollingPageY[0],_=[...this.targets].filter(S=>c.initialTarget instanceof Node&&S.contains(c.initialTarget));this.inertia(t,_,i,Math.abs(p)/m,p>0?1:-1,h,Math.abs(f)/m,f>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ts.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=s,i.tapCount=0,i}dispatchEvent(t){if(t.type===ts.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>ot.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===ts.Change||t.type===ts.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let s=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;s.push([r,i])}s.sort((i,r)=>i[0]-r[0]);for(let[i,r]of s)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,i,r,o,n,a,c,l){this.handle=Dn(t,()=>{let h=Date.now(),d=h-i,m=0,p=0,f=!0;r+=ot.SCROLL_FRICTION*d,a+=ot.SCROLL_FRICTION*d,r>0&&(f=!1,m=o*r*d),a>0&&(f=!1,p=c*a*d);let _=this.newGestureEvent(ts.Change);_.translationX=m,_.translationY=p,s.forEach(S=>S.dispatchEvent(_)),f||this.inertia(t,s,h,r,o,n+m,a,c,l+p)})}onTouchMove(t){let s=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let n=this.activeTouches[o.identifier],a=this.newGestureEvent(ts.Change,n.initialTarget);a.translationX=o.pageX-St(n.rollingPageX),a.translationY=o.pageY-St(n.rollingPageY),a.pageX=o.pageX,a.pageY=o.pageY,this.dispatchEvent(a),n.rollingPageX.length>3&&(n.rollingPageX.shift(),n.rollingPageY.shift(),n.rollingTimestamps.shift()),n.rollingPageX.push(o.pageX),n.rollingPageY.push(o.pageY),n.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};eo.SCROLL_FRICTION=-.005,eo.HOLD_DELAY=700,eo.CLEAR_TAP_COUNT_TIME=400,xe([rb],eo,"isTouchDevice",1);ob=eo,dc=class extends ie{onclick(e,t){this._register(K(e,Ne.CLICK,s=>t(new Qr(qt(e),s))))}onmousedown(e,t){this._register(K(e,Ne.MOUSE_DOWN,s=>t(new Qr(qt(e),s))))}onmouseover(e,t){this._register(K(e,Ne.MOUSE_OVER,s=>t(new Qr(qt(e),s))))}onmouseleave(e,t){this._register(K(e,Ne.MOUSE_LEAVE,s=>t(new Qr(qt(e),s))))}onkeydown(e,t){this._register(K(e,Ne.KEY_DOWN,s=>t(new Bl(s))))}onkeyup(e,t){this._register(K(e,Ne.KEY_UP,s=>t(new Bl(s))))}oninput(e,t){this._register(K(e,Ne.INPUT,t))}onblur(e,t){this._register(K(e,Ne.BLUR,t))}onfocus(e,t){this._register(K(e,Ne.FOCUS,t))}onchange(e,t){this._register(K(e,Ne.CHANGE,t))}ignoreGesture(e){return ob.ignoreTarget(e)}},Nd=11,nb=class extends dc{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=Nd+"px",this.domNode.style.height=Nd+"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 Qu),this._register(Id(this.bgDomNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Id(this.domNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Qv),this._pointerdownScheduleRepeatTimer=this._register(new cc)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qt(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ab=class Ol{constructor(t,s,i,r,o,n,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,r=r|0,o=o|0,n=n|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,s<0&&(s=0),r+s>i&&(r=i-s),r<0&&(r=0),o<0&&(o=0),a+o>n&&(a=n-o),a<0&&(a=0),this.width=s,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=n,this.scrollTop=a}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,s){return new Ol(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ol(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,s){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,n=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,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:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:n,scrollHeightChanged:a,scrollTopChanged:c}}},lb=class extends ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ab(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 s=this._state.withScrollDimensions(e,t);this._setState(s,!!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 s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let i;t?i=new Hd(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=Hd.start(this._state,s,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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},Fd=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};Hd=class Il{constructor(t,s,i,r){this.from=t,this.to=s,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,i){if(Math.abs(t-s)>2.5*i){let r,o;return t<s?(r=t+.75*i,o=s-.75*i):(r=t-.75*i,o=s+.75*i),cb(dl(t,r),dl(o,s),.33)}return dl(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let i=this.scrollLeft(s),r=this.scrollTop(s);return new Fd(i,r,!1)}return new Fd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,i){return Il.start(t,s,i)}static start(t,s,i){i=i+10;let r=Date.now()-10;return new Il(t,s,r,i)}};ub=class extends ie{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new cc)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},pb=140,ep=class extends dc{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 ub(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Qu),this._shouldRender=!0,this.domNode=no(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(K(this.domNode.domNode,Ne.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new nb(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,i){this.slider=no(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(K(this.slider.domNode,Ne.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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,s=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);s<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let r=eb(this.domNode.domNode);t=e.pageX-r.left,s=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),n=Math.abs(o-s);if(qu&&n>pb){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(a))},()=>{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()}},tp=class zl{constructor(t,s,i,r,o,n){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new zl(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,i,r,o){let n=Math.max(0,i-t),a=Math.max(0,n-2*s),c=r>0&&r>i;if(!c)return{computedAvailableSize:Math.round(n),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*a/r))),h=(a-l)/(r-i),d=o*h;return{computedAvailableSize:Math.round(n),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=zl._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 s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,i=this._scrollPosition;return s<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},fb=class extends ep{constructor(e,t,s){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new tp(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},mb=class extends ep{constructor(e,t,s){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new tp(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},gb=500,Wd=50,jd=!0,_b=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Nl=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,s+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(ac){let s=qt(t.browserEvent),i=hv(s);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,i){let r=null,o=new _b(t,s,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),s){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),n=Math.abs(s.deltaX),a=Math.abs(s.deltaY),c=Math.max(Math.min(r,n),1),l=Math.max(Math.min(o,a),1),h=Math.max(r,n),d=Math.max(o,a);h%c===0&&d%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Nl.INSTANCE=new Nl;vb=Nl,bb=class extends dc{constructor(e,t,s){super(),this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new z),this.onWillScroll=this._onWillScroll.event,this._options=wb(t),this._scrollable=s,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new mb(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new fb(this._scrollable,this._options,i)),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=no(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=no(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=no(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new cc),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ci(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,ss&&(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 Dd(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ci(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new Dd(s))};this._mouseWheelToDispose.push(K(this._listenOnDomNode,Ne.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=vb.INSTANCE;jd&&t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let n=!ss&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(r){let l=Wd*r,h=a.scrollTop-(l<0?Math.floor(l):Math.ceil(l));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let l=Wd*o,h=a.scrollLeft-(l<0?Math.floor(l):Math.ceil(l));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(jd&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(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,s=e.scrollLeft>0,i=s?" left":"",r=t?" top":"",o=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_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(),gb)}},yb=class extends bb{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};Fl=class extends ie{constructor(e,t,s,i,r,o,n,a){super(),this._bufferService=s,this._optionsService=n,this._renderService=a,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new lb({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:l=>Dn(i.window,l)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new yb(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(l=>{this._scrollableElement.updateOptions({handleMouseWheel:!(l&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ze.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(_e(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(_e(()=>this._styleElement.remove())),this._register(Ze.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
30
- `)})),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(l=>this._handleScroll(l)))}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),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Fl=xe([F(2,lt),F(3,ks),F(4,$u),F(5,tr),F(6,ct),F(7,$s)],Fl);Hl=class extends ie{constructor(e,t,s,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=i,this._renderService=r,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(o=>this._removeDecoration(o))),this._register(_e(()=>{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 s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Hl=xe([F(1,lt),F(2,ks),F(3,po),F(4,$s)],Hl);Sb=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<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Qt={full:0,left:0,center:0,right:0},Vs={full:0,left:0,center:0,right:0},Kr={full:0,left:0,center:0,right:0},Pn=class extends ie{constructor(e,t,s,i,r,o,n,a){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=n,this._coreBrowserService=a,this._colorZoneStore=new Sb,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(_e(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;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);Vs.full=this._canvas.width,Vs.left=e,Vs.center=t,Vs.right=e,this._refreshDrawHeightConstants(),Kr.full=1,Kr.left=1,Kr.center=1+Vs.left,Kr.right=1+Vs.left+Vs.center}_refreshDrawHeightConstants(){Qt.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);Qt.left=t,Qt.center=t,Qt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.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(Kr[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Qt[e.position||"full"]/2),Vs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Qt[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}))}};Pn=xe([F(2,lt),F(3,po),F(4,$s),F(5,ct),F(6,tr),F(7,ks)],Pn);(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=`
31
- `,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="\x7F"))(B||(B={}));(e=>(e.PAD="\x80",e.HOP="\x81",e.BPH="\x82",e.NBH="\x83",e.IND="\x84",e.NEL="\x85",e.SSA="\x86",e.ESA="\x87",e.HTS="\x88",e.HTJ="\x89",e.VTS="\x8A",e.PLD="\x8B",e.PLU="\x8C",e.RI="\x8D",e.SS2="\x8E",e.SS3="\x8F",e.DCS="\x90",e.PU1="\x91",e.PU2="\x92",e.STS="\x93",e.CCH="\x94",e.MW="\x95",e.SPA="\x96",e.EPA="\x97",e.SOS="\x98",e.SGCI="\x99",e.SCI="\x9A",e.CSI="\x9B",e.ST="\x9C",e.OSC="\x9D",e.PM="\x9E",e.APC="\x9F"))($n||($n={}));(e=>e.ST=`${B.ESC}\\`)(sp||(sp={}));Wl=class{constructor(e,t,s,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=i,this._coreService=r,this._renderService=o,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 s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${B.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Wl=xe([F(2,lt),F(3,ct),F(4,ki),F(5,$s)],Wl);Fe=0,He=0,We=0,Ce=0,Vd={css:"#00000000",rgba:0};(e=>{function t(r,o,n,a){return a!==void 0?`#${vi(r)}${vi(o)}${vi(n)}${vi(a)}`:`#${vi(r)}${vi(o)}${vi(n)}`}e.toCss=t;function s(r,o,n,a=255){return(r<<24|o<<16|n<<8|a)>>>0}e.toRgba=s;function i(r,o,n,a){return{css:e.toCss(r,o,n,a),rgba:e.toRgba(r,o,n,a)}}e.toColor=i})(Ae||(Ae={}));(e=>{function t(c,l){if(Ce=(l.rgba&255)/255,Ce===1)return{css:l.css,rgba:l.rgba};let h=l.rgba>>24&255,d=l.rgba>>16&255,m=l.rgba>>8&255,p=c.rgba>>24&255,f=c.rgba>>16&255,_=c.rgba>>8&255;Fe=p+Math.round((h-p)*Ce),He=f+Math.round((d-f)*Ce),We=_+Math.round((m-_)*Ce);let S=Ae.toCss(Fe,He,We),$=Ae.toRgba(Fe,He,We);return{css:S,rgba:$}}e.blend=t;function s(c){return(c.rgba&255)===255}e.isOpaque=s;function i(c,l,h){let d=En.ensureContrastRatio(c.rgba,l.rgba,h);if(d)return Ae.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=i;function r(c){let l=(c.rgba|255)>>>0;return[Fe,He,We]=En.toChannels(l),{css:Ae.toCss(Fe,He,We),rgba:l}}e.opaque=r;function o(c,l){return Ce=Math.round(l*255),[Fe,He,We]=En.toChannels(c.rgba),{css:Ae.toCss(Fe,He,We,Ce),rgba:Ae.toRgba(Fe,He,We,Ce)}}e.opacity=o;function n(c,l){return Ce=c.rgba&255,o(c,Ce*l/255)}e.multiplyOpacity=n;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=a})(ge||(ge={}));(e=>{let t,s;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Ae.toColor(Fe,He,We);case 5:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Ce=parseInt(r.slice(4,5).repeat(2),16),Ae.toColor(Fe,He,We,Ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Fe=parseInt(o[1]),He=parseInt(o[2]),We=parseInt(o[3]),Ce=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ae.toColor(Fe,He,We,Ce);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fe,He,We,Ce]=t.getImageData(0,0,1,1).data,Ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ae.toRgba(Fe,He,We,Ce),css:r}}e.toColor=i})(Se||(Se={}));(e=>{function t(i){return s(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function s(i,r,o){let n=i/255,a=r/255,c=o/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return l*.2126+h*.7152+d*.0722}e.relativeLuminance2=s})(at||(at={}));(e=>{function t(n,a){if(Ce=(a&255)/255,Ce===1)return a;let c=a>>24&255,l=a>>16&255,h=a>>8&255,d=n>>24&255,m=n>>16&255,p=n>>8&255;return Fe=d+Math.round((c-d)*Ce),He=m+Math.round((l-m)*Ce),We=p+Math.round((h-p)*Ce),Ae.toRgba(Fe,He,We)}e.blend=t;function s(n,a,c){let l=at.relativeLuminance(n>>8),h=at.relativeLuminance(a>>8);if(ws(l,h)<c){if(h<l){let p=i(n,a,c),f=ws(l,at.relativeLuminance(p>>8));if(f<c){let _=r(n,a,c),S=ws(l,at.relativeLuminance(_>>8));return f>S?p:_}return p}let d=r(n,a,c),m=ws(l,at.relativeLuminance(d>>8));if(m<c){let p=i(n,a,c),f=ws(l,at.relativeLuminance(p>>8));return m>f?d:p}return d}}e.ensureContrastRatio=s;function i(n,a,c){let l=n>>24&255,h=n>>16&255,d=n>>8&255,m=a>>24&255,p=a>>16&255,f=a>>8&255,_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));for(;_<c&&(m>0||p>0||f>0);)m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));return(m<<24|p<<16|f<<8|255)>>>0}e.reduceLuminance=i;function r(n,a,c){let l=n>>24&255,h=n>>16&255,d=n>>8&255,m=a>>24&255,p=a>>16&255,f=a>>8&255,_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));for(;_<c&&(m<255||p<255||f<255);)m=Math.min(255,m+Math.ceil((255-m)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));return(m<<24|p<<16|f<<8|255)>>>0}e.increaseLuminance=r;function o(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=o})(En||(En={}));Cb=class extends uo{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Mn=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Mt}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],i=t.translateToString(!0),r=0,o=0,n=0,a=t.getFg(0),c=t.getBg(0);for(let l=0;l<t.getTrimmedLength();l++)if(t.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==c){if(l-r>1){let h=this._getJoinedRanges(i,n,o,t,r);for(let d=0;d<h.length;d++)s.push(h[d])}r=l,n=o,a=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||Ks.length}if(this._bufferService.cols-r>1){let l=this._getJoinedRanges(i,n,o,t,r);for(let h=0;h<l.length;h++)s.push(l[h])}return s}_getJoinedRanges(e,t,s,i,r){let o=e.substring(t,s),n=[];try{n=this._characterJoiners[0].handler(o)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(o);for(let l=0;l<c.length;l++)Mn._mergeRanges(n,c[l])}catch(c){console.error(c)}return this._stringRangesToCellRanges(n,i,r),n}_stringRangesToCellRanges(e,t,s){let i=0,r=!1,o=0,n=e[i];if(n){for(let a=s;a<this._bufferService.cols;a++){let c=t.getWidth(a),l=t.getString(a).length||Ks.length;if(c!==0){if(!r&&n[0]<=o&&(n[0]=a,r=!0),n[1]<=o){if(n[1]=a,n=e[++i],!n)break;n[0]<=o?(n[0]=a,r=!0):r=!1}o+=l}}n&&(n[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let i=0;i<e.length;i++){let r=e[i];if(s){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Mn=xe([F(0,lt)],Mn);jl=class{constructor(e,t,s,i,r,o,n){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=n,this._workCell=new Mt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,i,r,o,n,a,c,l,h){let d=[],m=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,f=e.getNoBgTrimmedLength();s&&f<o+1&&(f=o+1);let _,S=0,$="",x=0,v=0,y=0,A=0,M=!1,H=0,q=!1,ee=0,ce=0,V=[],ve=l!==-1&&h!==-1;for(let E=0;E<f;E++){e.loadCell(E,this._workCell);let w=this._workCell.getWidth();if(w===0)continue;let L=!1,T=E>=ce,P=E,D=this._workCell;if(m.length>0&&E===m[0][0]&&T){let ue=m.shift(),Da=this._isCellInSelection(ue[0],t);for(x=ue[0]+1;x<ue[1];x++)T&&(T=Da===this._isCellInSelection(x,t));T&&(T=!s||o<ue[0]||o>=ue[1]),T?(L=!0,D=new Cb(this._workCell,e.translateToString(!0,ue[0],ue[1]),ue[1]-ue[0]),P=ue[1]-1,w=D.getWidth()):ce=ue[1]}let N=this._isCellInSelection(E,t),Z=s&&E===o,le=ve&&E>=l&&E<=h,Xe=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ue=>{Xe=!0});let ut=D.getChars()||Ks;if(ut===" "&&(D.isUnderline()||D.isOverline())&&(ut="\xA0"),ee=w*a-c.get(ut,D.isBold(),D.isItalic()),!_)_=this._document.createElement("span");else if(S&&(N&&q||!N&&!q&&D.bg===v)&&(N&&q&&p.selectionForeground||D.fg===y)&&D.extended.ext===A&&le===M&&ee===H&&!Z&&!L&&!Xe&&T){D.isInvisible()?$+=Ks:$+=ut,S++;continue}else S&&(_.textContent=$),_=this._document.createElement("span"),S=0,$="";if(v=D.bg,y=D.fg,A=D.extended.ext,M=le,H=ee,q=N,L&&o>=E&&o<=P&&(o=E),!this._coreService.isCursorHidden&&Z&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)n&&V.push("xterm-cursor-blink"),V.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break;default:break}}if(D.isBold()&&V.push("xterm-bold"),D.isItalic()&&V.push("xterm-italic"),D.isDim()&&V.push("xterm-dim"),D.isInvisible()?$=Ks:$=D.getChars()||Ks,D.isUnderline()&&(V.push(`xterm-underline-${D.extended.underlineStyle}`),$===" "&&($="\xA0"),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${uo.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let ue=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&ue<8&&(ue+=8),_.style.textDecorationColor=p.ansi[ue].css}D.isOverline()&&(V.push("xterm-overline"),$===" "&&($="\xA0")),D.isStrikethrough()&&V.push("xterm-strikethrough"),le&&(_.style.textDecoration="underline");let be=D.getFgColor(),Ft=D.getFgColorMode(),Ee=D.getBgColor(),ps=D.getBgColorMode(),ci=!!D.isInverse();if(ci){let ue=be;be=Ee,Ee=ue;let Da=Ft;Ft=ps,ps=Da}let Is,Yo,Ar=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,ue=>{ue.options.layer!=="top"&&Ar||(ue.backgroundColorRGB&&(ps=50331648,Ee=ue.backgroundColorRGB.rgba>>8&16777215,Is=ue.backgroundColorRGB),ue.foregroundColorRGB&&(Ft=50331648,be=ue.foregroundColorRGB.rgba>>8&16777215,Yo=ue.foregroundColorRGB),Ar=ue.options.layer==="top")}),!Ar&&N&&(Is=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Ee=Is.rgba>>8&16777215,ps=50331648,Ar=!0,p.selectionForeground&&(Ft=50331648,be=p.selectionForeground.rgba>>8&16777215,Yo=p.selectionForeground)),Ar&&V.push("xterm-decoration-top");let zs;switch(ps){case 16777216:case 33554432:zs=p.ansi[Ee],V.push(`xterm-bg-${Ee}`);break;case 50331648:zs=Ae.toColor(Ee>>16,Ee>>8&255,Ee&255),this._addStyle(_,`background-color:#${Ud((Ee>>>0).toString(16),"0",6)}`);break;default:ci?(zs=p.foreground,V.push("xterm-bg-257")):zs=p.background}switch(Is||D.isDim()&&(Is=ge.multiplyOpacity(zs,.5)),Ft){case 16777216:case 33554432:D.isBold()&&be<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(be+=8),this._applyMinimumContrast(_,zs,p.ansi[be],D,Is,void 0)||V.push(`xterm-fg-${be}`);break;case 50331648:let ue=Ae.toColor(be>>16&255,be>>8&255,be&255);this._applyMinimumContrast(_,zs,ue,D,Is,Yo)||this._addStyle(_,`color:#${Ud(be.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(_,zs,p.foreground,D,Is,Yo)||ci&&V.push("xterm-fg-257")}V.length&&(_.className=V.join(" "),V.length=0),!Z&&!L&&!Xe&&T?S++:_.textContent=$,ee!==this.defaultSpacing&&(_.style.letterSpacing=`${ee}px`),d.push(_),E=P}return _&&S&&(_.textContent=$),d}_applyMinimumContrast(e,t,s,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||$b(i.getCode()))return!1;let n=this._getContrastCache(i),a;if(!r&&!o&&(a=n.getColor(t.rgba,s.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);a=ge.ensureContrastRatio(r||t,o||s,c),n.setColor((r||t).rgba,(o||s).rgba,a??null)}return a?(this._addStyle(e,`color:${a.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 s=this._selectionStart,i=this._selectionEnd;return!s||!i?!1:this._columnSelectMode?s[0]<=i[0]?e>=s[0]&&t>=s[1]&&e<i[0]&&t<=i[1]:e<s[0]&&t>=s[1]&&e>=i[0]&&t<=i[1]:t>s[1]&&t<i[1]||s[1]===i[1]&&t===s[1]&&e>=s[0]&&e<i[0]||s[1]<i[1]&&t===i[1]&&e<i[0]||s[1]<i[1]&&t===s[1]&&e>=s[0]}};jl=xe([F(1,Au),F(2,ct),F(3,ks),F(4,ki),F(5,po),F(6,tr)],jl);Tb=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,i,r,o],this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,i){e===this._font&&t===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,s){let i=0;if(!t&&!s&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let n=this._measure(e,0);return n>0&&(this._flat[i]=n),n}let r=e;t&&(r+="B"),s&&(r+="I");let o=this._holey.get(r);if(o===void 0){let n=0;t&&(n|=1),s&&(n|=2),o=this._measure(e,n),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},Ab=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,s,i=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,n=s[1]-r,a=Math.max(o,0),c=Math.min(n,e.rows-1);if(a>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};ul="xterm-dom-renderer-owner-",Lt="xterm-rows",gn="xterm-fg-",qd="xterm-bg-",Gr="xterm-focus",_n="xterm-selection",Lb=1,Vl=class extends ie{constructor(e,t,s,i,r,o,n,a,c,l,h,d,m,p){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=n,this._charSizeService=c,this._optionsService=l,this._bufferService=h,this._coreService=d,this._coreBrowserService=m,this._themeService=p,this._terminalClass=Lb++,this._rowElements=[],this._selectionRenderModel=Rb(),this.onRequestRedraw=this._register(new z).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Lt),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(_n),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Eb(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(jl,document),this._element.classList.add(ul+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(_e(()=>{this._element.classList.remove(ul+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Tb(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Lt} 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} .${Lt} { 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} .${Lt} .xterm-dim { color: ${ge.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 s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Lt}.${Gr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Lt}.${Gr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Lt}.${Gr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${_n} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${_n} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${_n} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,n]of e.ansi.entries())t+=`${this._terminalSelector} .${gn}${o} { color: ${n.css}; }${this._terminalSelector} .${gn}${o}.xterm-dim { color: ${ge.multiplyOpacity(n,.5).css}; }${this._terminalSelector} .${qd}${o} { background-color: ${n.css}; }`;t+=`${this._terminalSelector} .${gn}257 { color: ${ge.opaque(e.background).css}; }${this._terminalSelector} .${gn}257.xterm-dim { color: ${ge.multiplyOpacity(ge.opaque(e.background),.5).css}; }${this._terminalSelector} .${qd}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 s=this._rowElements.length;s<=t;s++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(Gr),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Gr),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,n=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(s){let c=e[0]>t[0];a.appendChild(this._createSelectionElement(o,c?t[0]:e[0],c?e[0]:t[0],n-o+1))}else{let c=i===o?e[0]:0,l=o===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));let h=n-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==n){let d=r===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,s,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,n=this.dimensions.css.cell.width*(s-t);return o+n>this.dimensions.css.canvas.width&&(n=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${n}px`,r}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 s=this._bufferService.buffer,i=s.ybase+s.y,r=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,n=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let l=c+s.ydisp,h=this._rowElements[c],d=s.lines.get(l);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,l,l===i,n,a,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ul}${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,s,i,r,o){s<0&&(e=0),i<0&&(t=0);let n=this._bufferService.rows-1;s=Math.max(Math.min(s,n),0),i=Math.max(Math.min(i,n),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,l=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,m=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=s;p<=i;++p){let f=p+a.ydisp,_=this._rowElements[p],S=a.lines.get(f);if(!_||!S)break;_.replaceChildren(...this._rowFactory.createRow(S,f,f===c,d,m,l,h,this.dimensions.css.cell.width,this._widthCache,o?p===s?e:0:-1,o?(p===i?t:r)-1:-1))}}};Vl=xe([F(7,rc),F(8,Nn),F(9,ct),F(10,lt),F(11,ki),F(12,ks),F(13,tr)],Vl);Ul=class extends ie{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Pb(this._optionsService))}catch{this._measureStrategy=this._register(new Db(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())}};Ul=xe([F(2,ct)],Ul);ip=class extends ie{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)}},Db=class extends ip{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},Pb=class extends ip{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}},Mb=class extends ie{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Bb(this._window)),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Ze.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(K(this._textarea,"focus",()=>this._isFocused=!0)),this._register(K(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}},Bb=class extends ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new er),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(_e(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=K(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)}},Ob=class extends ie{constructor(){super(),this.linkProviders=[],this._register(_e(()=>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)}}}};ql=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,i,r){return Ib(window,e,t,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let s=uc(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};ql=xe([F(0,$s),F(1,Nn)],ql);zb=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,s){this._rowCount=s,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=[]}},rp={};w_(rp,{getSafariVersion:()=>Fb,isChromeOS:()=>lp,isFirefox:()=>op,isIpad:()=>Hb,isIphone:()=>Wb,isLegacyEdge:()=>Nb,isLinux:()=>pc,isMac:()=>Bn,isNode:()=>Wn,isSafari:()=>np,isWindows:()=>ap});Wn=typeof process<"u"&&"title"in process,fo=Wn?"node":navigator.userAgent,mo=Wn?"node":navigator.platform,op=fo.includes("Firefox"),Nb=fo.includes("Edge"),np=/^((?!chrome|android).)*safari/i.test(fo);Bn=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(mo),Hb=mo==="iPad",Wb=mo==="iPhone",ap=["Windows","Win16","Win32","WinCE"].includes(mo),pc=mo.indexOf("Linux")>=0,lp=/\bCrOS\b/.test(fo),cp=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),r=e.timeRemaining(),s*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},jb=class extends cp{_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())}}},Vb=class extends cp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},On=!Wn&&"requestIdleCallback"in window?Vb:jb,Ub=class{constructor(){this._queue=new On}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Kl=class extends ie{constructor(e,t,s,i,r,o,n,a,c){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=i,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new er),this._pausedResizeTask=new Ub,this._observerDisposable=this._register(new er),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 z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new zb((l,h)=>this._renderRows(l,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new qb(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(_e(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(n.onResize(()=>this._fullRefresh())),this._register(n.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(n.cols,n.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(n.buffer.y,n.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(l=>this._registerIntersectionObserver(l,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=_e(()=>s.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,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),s||(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,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Kl=xe([F(2,ct),F(3,Nn),F(4,ki),F(5,po),F(6,lt),F(7,ks),F(8,tr)],Kl);qb=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,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)}};e0=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._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)}};pl=50,t0=15,s0=50,i0=500,r0="\xA0",o0=new RegExp(r0,"g"),Gl=class extends ie{constructor(e,t,s,i,r,o,n,a,c){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=n,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Mt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=l=>this._handleMouseMove(l),this._mouseUpListener=l=>this._handleMouseUp(l),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(l=>this._handleTrim(l)),this._register(this._bufferService.buffers.onBufferActivate(l=>this._handleBufferActivate(l))),this.enable(),this._model=new e0(this._bufferService),this._activeSelectionMode=0,this._register(_e(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(l=>{l.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 s=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let n=e[1];n<=t[1];n++){let a=s.translateBufferLineToString(n,!0,r,o);i.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(s.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let n=s.lines.get(o),a=s.translateBufferLineToString(o,!0);n?.isWrapped?i[i.length-1]+=a:i.push(a)}if(e[1]!==t[1]){let o=s.lines.get(t[1]),n=s.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=n:i.push(n)}}return i.map(r=>r.replace(o0," ")).join(ap?`\r
29
+ `).trim(),c=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);bn.register(n,c?.[2]??a,n)}return n}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*nv<=t.length){let r=0;for(let o=0;o<t.length;o++)t[o]?t[r++]=t[o]:i&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||_n;if(!s){e.value(t);return}try{e.value(t)}catch(i){s(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof vn)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},lv=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Dl=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let i=this.getWindowId(s);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Dl.INSTANCE=new Dl;oc=Dl;Jk=oc.INSTANCE.onDidChangeZoomLevel;Zk=oc.INSTANCE.onDidChangeFullscreen,sr=typeof navigator=="object"?navigator.userAgent:"",Pl=sr.indexOf("Firefox")>=0,yn=sr.indexOf("AppleWebKit")>=0,nc=sr.indexOf("Chrome")>=0,Wu=!nc&&sr.indexOf("Safari")>=0,Qk=sr.indexOf("Electron/")>=0,e2=sr.indexOf("Android")>=0,wn=!1;if(typeof kt.matchMedia=="function"){let e=kt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=kt.matchMedia("(display-mode: fullscreen)");wn=e.matches,cv(kt,e,({matches:s})=>{wn&&t.matches||(wn=s)})}Qi="en",Tn=!1,An=!1,ro=!1,uv=!1,ju=!1,Vu=!1,pv=!1,fv=!1,mv=!1,gv=!1,Sn=Qi,Td=Qi,xs=globalThis;typeof xs.vscode<"u"&&typeof xs.vscode.process<"u"?xt=xs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(xt=process);Uu=typeof xt?.versions?.electron=="string",vv=Uu&&xt?.type==="renderer";if(typeof xt=="object"){Tn=xt.platform==="win32",An=xt.platform==="darwin",ro=xt.platform==="linux",uv=ro&&!!xt.env.SNAP&&!!xt.env.SNAP_REVISION,pv=Uu,mv=!!xt.env.CI||!!xt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,un=Qi,Sn=Qi;let e=xt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);un=t.userLocale,Td=t.osLocale,Sn=t.resolvedLanguage||Qi,_v=t.languagePack?.translationsConfigFile}catch{}ju=!0}else typeof navigator=="object"&&!vv?(Ss=navigator.userAgent,Tn=Ss.indexOf("Windows")>=0,An=Ss.indexOf("Macintosh")>=0,fv=(Ss.indexOf("Macintosh")>=0||Ss.indexOf("iPad")>=0||Ss.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ro=Ss.indexOf("Linux")>=0,gv=Ss?.indexOf("Mobi")>=0,Vu=!0,Sn=globalThis._VSCODE_NLS_LANGUAGE||Qi,un=navigator.language.toLowerCase(),Td=un):console.error("Unable to resolve platform.");rl=0;An?rl=1:Tn?rl=3:ro&&(rl=2);qu=Tn,ss=An,bv=ro,ol=ju,yv=Vu&&typeof xs.importScripts=="function",t2=yv?xs.origin:void 0,is=Ss,Ws=Sn;(e=>{function t(){return Ws}e.value=t;function s(){return Ws.length===2?Ws==="en":Ws.length>=3?Ws[0]==="e"&&Ws[1]==="n"&&Ws[2]==="-":!1}e.isDefaultVariant=s;function i(){return Ws==="en"}e.isDefault=i})(wv||(wv={}));Sv=typeof xs.postMessage=="function"&&!xs.importScripts,Cv=(()=>{if(Sv){let e=[];xs.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),xs.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),xv=!!(is&&is.indexOf("Chrome")>=0),s2=!!(is&&is.indexOf("Firefox")>=0),i2=!!(!xv&&is&&is.indexOf("Safari")>=0),r2=!!(is&&is.indexOf("Edg/")>=0),o2=!!(is&&is.indexOf("Android")>=0),js=typeof navigator=="object"?navigator:{},n2={clipboard:{writeText:ol||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(js&&js.clipboard&&js.clipboard.writeText),readText:ol||!!(js&&js.clipboard&&js.clipboard.readText)},keyboard:ol||dv()?0:js.keyboard||Wu?1:2,touch:"ontouchstart"in kt||js.maxTouchPoints>0,pointerEvents:kt.PointerEvent&&("ontouchstart"in kt||navigator.maxTouchPoints>0)},ac=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}},nl=new ac,Ad=new ac,Rd=new ac,kv=new Array(230);(e=>{function t(a){return nl.keyCodeToStr(a)}e.toString=t;function s(a){return nl.strToKeyCode(a)}e.fromString=s;function i(a){return Ad.keyCodeToStr(a)}e.toUserSettingsUS=i;function r(a){return Rd.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function o(a){return Ad.strToKeyCode(a)||Rd.strToKeyCode(a)}e.fromUserSettings=o;function n(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return nl.keyCodeToStr(a)}e.toElectronAccelerator=n})(Ku||(Ku={}));$v=class Gu{constructor(t,s,i,r,o){this.ctrlKey=t,this.shiftKey=s,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof Gu&&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",s=this.shiftKey?"1":"0",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${s}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Ev([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Ev=class{constructor(e){if(e.length===0)throw z_("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};Av=ss?256:2048,Rv=512,Lv=1024,Dv=ss?2048:256,Ml=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=Tv(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Av),this.altKey&&(t|=Rv),this.shiftKey&&(t|=Lv),this.metaKey&&(t|=Dv),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new $v(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ld=new WeakMap;Mv=class{static getSameOriginWindowChain(e){let t=Ld.get(e);if(!t){t=[],Ld.set(e,t);let s=e,i;do i=Pv(s),i?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=i;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let n=o.window.deref();if(s+=n?.scrollY??0,i+=n?.scrollX??0,n===t||!o.iframeElement)break;let a=o.iframeElement.getBoundingClientRect();s+=a.top,i+=a.left}return{top:s,left:i}}},Zr=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let s=Mv.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Dd=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let i=!1;if(nc){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,n=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*n):this.deltaY=r.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Pl&&!ss?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Wu&&qu?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*n):this.deltaX=r.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Pl&&!ss?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*n):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Yu=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}});(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof Ov?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ze.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Yu})})(Bv||(Bv={}));Ov=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?Yu:(this._emitter||(this._emitter=new z),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},lc=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 kl("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new kl("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Iv=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new kl("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=s.setInterval(()=>{e()},t);this.disposable=_e(()=>{s.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?al=(e,t)=>{Cv(()=>{if(s)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:al=(e,t,s)=>{let i=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(i))}}},zv=e=>al(globalThis,e)})();(e=>{async function t(i){let r,o=await Promise.all(i.map(n=>n.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return o}e.settled=t;function s(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(n){o(n)}})}e.withAsyncBody=s})(Nv||(Nv={}));Pd=class Dt{static fromArray(t){return new Dt(s=>{s.emitMany(t)})}static fromPromise(t){return new Dt(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Dt(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new Dt(async s=>{await Promise.all(t.map(async i=>{for await(let r of i)s.emitOne(r)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new z,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ze.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Dt(async i=>{for await(let r of t)i.emitOne(s(r))})}map(t){return Dt.map(this,t)}static filter(t,s){return new Dt(async i=>{for await(let r of t)s(r)&&i.emitOne(r)})}filter(t){return Dt.filter(this,t)}static coalesce(t){return Dt.filter(t,s=>!!s)}coalesce(){return Dt.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return Dt.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())}};Pd.EMPTY=Pd.fromArray([]);Kv=class Ju{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let s=t.length;if(s===0)return;let i=this._buff,r=this._buffLen,o=this._leftoverHighSurrogate,n,a;for(o!==0?(n=o,a=-1,o=0):(n=t.charCodeAt(0),a=0);;){let c=n;if(Fv(n))if(a+1<s){let l=t.charCodeAt(a+1);Md(l)?(a++,c=Hv(n,l)):c=65533}else{o=n;break}else Md(n)&&(c=65533);if(r=this._push(i,r,c),a++,a<s)n=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=o}_push(t,s,i){return i<128?t[s++]=i:i<2048?(t[s++]=192|(i&1984)>>>6,t[s++]=128|(i&63)>>>0):i<65536?(t[s++]=224|(i&61440)>>>12,t[s++]=128|(i&4032)>>>6,t[s++]=128|(i&63)>>>0):(t[s++]=240|(i&1835008)>>>18,t[s++]=128|(i&258048)>>>12,t[s++]=128|(i&4032)>>>6,t[s++]=128|(i&63)>>>0),s>=64&&(this._step(),s-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),s}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ur(this._h0)+Ur(this._h1)+Ur(this._h2)+Ur(this._h3)+Ur(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Bd(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Bd(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=Ju._bigBlock32,s=this._buffDV;for(let d=0;d<64;d+=4)t.setUint32(d,s.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)t.setUint32(d,ll(t.getUint32(d-12,!1)^t.getUint32(d-32,!1)^t.getUint32(d-56,!1)^t.getUint32(d-64,!1),1),!1);let i=this._h0,r=this._h1,o=this._h2,n=this._h3,a=this._h4,c,l,h;for(let d=0;d<80;d++)d<20?(c=r&o|~r&n,l=1518500249):d<40?(c=r^o^n,l=1859775393):d<60?(c=r&o|r&n|o&n,l=2400959708):(c=r^o^n,l=3395469782),h=ll(i,5)+c+a+l+t.getUint32(d*4,!1)&4294967295,a=n,n=o,o=ll(r,30),r=i,i=h;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+o&4294967295,this._h3=this._h3+n&4294967295,this._h4=this._h4+a&4294967295}};Kv._bigBlock32=new DataView(new ArrayBuffer(320));({registerWindow:a2,getWindow:qt,getDocument:l2,getWindows:c2,getWindowsCount:h2,getWindowId:Od,getWindowById:d2,hasWindow:u2,onDidRegisterWindow:Gv,onWillUnregisterWindow:p2,onDidUnregisterWindow:f2}=(function(){let e=new Map,t={window:kt,disposables:new Gs};e.set(kt.vscodeWindowId,t);let s=new z,i=new z,r=new z;function o(n,a){return(typeof n=="number"?e.get(n):void 0)??(a?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(n){if(e.has(n.vscodeWindowId))return ie.None;let a=new Gs,c={window:n,disposables:a.add(new Gs)};return e.set(n.vscodeWindowId,c),a.add(_e(()=>{e.delete(n.vscodeWindowId),i.fire(n)})),a.add(K(n,Ne.BEFORE_UNLOAD,()=>{r.fire(n)})),s.fire(c),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:o,getWindow(n){let a=n;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let c=n;return c?.view?c.view.window:kt},getDocument(n){return qt(n).document}}})()),Yv=class{constructor(e,t,s,i){this._node=e,this._type=t,this._handler=s,this._options=i||!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)}};Id=function(e,t,s,i){let r=s;return t==="click"||t==="mousedown"||t==="contextmenu"?r=Xv(qt(e),s):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=Jv(s)),K(e,t,r,i)},Qv=class extends Iv{constructor(e){super(),this.defaultTarget=e&&qt(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},cl=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){_n(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,i=new Map,r=o=>{s.set(o,!1);let n=e.get(o)??[];for(t.set(o,n),e.set(o,[]),i.set(o,!0);n.length>0;)n.sort(cl.sort),n.shift().execute();i.set(o,!1)};Rn=(o,n,a=0)=>{let c=Od(o),l=new cl(n,a),h=e.get(c);return h||(h=[],e.set(c,h)),h.push(l),s.get(c)||(s.set(c,!0),o.requestAnimationFrame(()=>r(c))),l},Zv=(o,n,a)=>{let c=Od(o);if(i.get(c)){let l=new cl(n,a),h=t.get(c);return h||(h=[],t.set(c,h)),h.push(l),l}else return Rn(o,n,a)}})();zd=class Cn{constructor(t,s){this.width=t,this.height=s}with(t=this.width,s=this.height){return t!==this.width||s!==this.height?new Cn(t,s):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof Cn?t:new Cn(t.width,t.height)}static equals(t,s){return t===s?!0:!t||!s?!1:t.width===s.width&&t.height===s.height}};zd.None=new zd(0,0);m2=new class{constructor(){this.mutationObservers=new Map}observe(e,t,s){let i=this.mutationObservers.get(e);i||(i=new Map,this.mutationObservers.set(e,i));let r=Wv(s),o=i.get(r);if(o)o.users+=1;else{let n=new z,a=new MutationObserver(l=>n.fire(l));a.observe(e,s);let c=o={users:1,observer:a,onDidMutate:n.event};t.add(_e(()=>{c.users-=1,c.users===0&&(n.dispose(),a.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(e))})),i.set(r,o)}return o.onDidMutate}},Ne={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:yn?"webkitAnimationStart":"animationstart",ANIMATION_END:yn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:yn?"webkitAnimationIteration":"animationiteration"},tb=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;sb.SVG=function(e,t,...s){return Zu("http://www.w3.org/2000/svg",e,t,...s)};ib=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=mt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=mt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=mt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=mt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=mt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=mt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=mt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=mt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=mt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=mt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=mt(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=mt(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=mt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=mt(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)}};Qu=class{constructor(){this._hooks=new Gs,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(_e(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=qt(e)}this._hooks.add(K(o,Ne.POINTER_MOVE,n=>{if(n.buttons!==s){this.stopMonitoring(!0);return}n.preventDefault(),this._pointerMoveCallback(n)})),this._hooks.add(K(o,Ne.POINTER_UP,n=>this.stopMonitoring(!0)))}};(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ts||(ts={}));Qr=class ot extends ie{constructor(){super(),this.dispatched=!1,this.targets=new kd,this.ignoreTargets=new kd,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ze.runAndSubscribe(Gv,({window:t,disposables:s})=>{s.add(K(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),s.add(K(t.document,"touchend",i=>this.onTouchEnd(t,i))),s.add(K(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:kt,disposables:this._store}))}static addTarget(t){if(!ot.isTouchDevice())return ie.None;ot.INSTANCE||(ot.INSTANCE=xd(new ot));let s=ot.INSTANCE.targets.push(t);return _e(s)}static ignoreTarget(t){if(!ot.isTouchDevice())return ie.None;ot.INSTANCE||(ot.INSTANCE=xd(new ot));let s=ot.INSTANCE.ignoreTargets.push(t);return _e(s)}static isTouchDevice(){return"ontouchstart"in kt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:s,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[s],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let n=this.newGestureEvent(ts.Start,o.target);n.pageX=o.pageX,n.pageY=o.pageY,this.dispatchEvent(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,s){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,n=s.changedTouches.length;o<n;o++){let a=s.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],l=Date.now()-c.initialTimeStamp;if(l<ot.HOLD_DELAY&&Math.abs(c.initialPageX-St(c.rollingPageX))<30&&Math.abs(c.initialPageY-St(c.rollingPageY))<30){let h=this.newGestureEvent(ts.Tap,c.initialTarget);h.pageX=St(c.rollingPageX),h.pageY=St(c.rollingPageY),this.dispatchEvent(h)}else if(l>=ot.HOLD_DELAY&&Math.abs(c.initialPageX-St(c.rollingPageX))<30&&Math.abs(c.initialPageY-St(c.rollingPageY))<30){let h=this.newGestureEvent(ts.Contextmenu,c.initialTarget);h.pageX=St(c.rollingPageX),h.pageY=St(c.rollingPageY),this.dispatchEvent(h)}else if(r===1){let h=St(c.rollingPageX),d=St(c.rollingPageY),m=St(c.rollingTimestamps)-c.rollingTimestamps[0],p=h-c.rollingPageX[0],f=d-c.rollingPageY[0],_=[...this.targets].filter(S=>c.initialTarget instanceof Node&&S.contains(c.initialTarget));this.inertia(t,_,i,Math.abs(p)/m,p>0?1:-1,h,Math.abs(f)/m,f>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ts.End,c.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=s,i.tapCount=0,i}dispatchEvent(t){if(t.type===ts.Tap){let s=new Date().getTime(),i=0;s-this._lastSetTapCountTime>ot.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=s,t.tapCount=i}else(t.type===ts.Change||t.type===ts.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let s=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;s.push([r,i])}s.sort((i,r)=>i[0]-r[0]);for(let[i,r]of s)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,i,r,o,n,a,c,l){this.handle=Rn(t,()=>{let h=Date.now(),d=h-i,m=0,p=0,f=!0;r+=ot.SCROLL_FRICTION*d,a+=ot.SCROLL_FRICTION*d,r>0&&(f=!1,m=o*r*d),a>0&&(f=!1,p=c*a*d);let _=this.newGestureEvent(ts.Change);_.translationX=m,_.translationY=p,s.forEach(S=>S.dispatchEvent(_)),f||this.inertia(t,s,h,r,o,n+m,a,c,l+p)})}onTouchMove(t){let s=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let n=this.activeTouches[o.identifier],a=this.newGestureEvent(ts.Change,n.initialTarget);a.translationX=o.pageX-St(n.rollingPageX),a.translationY=o.pageY-St(n.rollingPageY),a.pageX=o.pageX,a.pageY=o.pageY,this.dispatchEvent(a),n.rollingPageX.length>3&&(n.rollingPageX.shift(),n.rollingPageY.shift(),n.rollingTimestamps.shift()),n.rollingPageX.push(o.pageX),n.rollingPageY.push(o.pageY),n.rollingTimestamps.push(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Qr.SCROLL_FRICTION=-.005,Qr.HOLD_DELAY=700,Qr.CLEAR_TAP_COUNT_TIME=400,xe([rb],Qr,"isTouchDevice",1);ob=Qr,hc=class extends ie{onclick(e,t){this._register(K(e,Ne.CLICK,s=>t(new Zr(qt(e),s))))}onmousedown(e,t){this._register(K(e,Ne.MOUSE_DOWN,s=>t(new Zr(qt(e),s))))}onmouseover(e,t){this._register(K(e,Ne.MOUSE_OVER,s=>t(new Zr(qt(e),s))))}onmouseleave(e,t){this._register(K(e,Ne.MOUSE_LEAVE,s=>t(new Zr(qt(e),s))))}onkeydown(e,t){this._register(K(e,Ne.KEY_DOWN,s=>t(new Ml(s))))}onkeyup(e,t){this._register(K(e,Ne.KEY_UP,s=>t(new Ml(s))))}oninput(e,t){this._register(K(e,Ne.INPUT,t))}onblur(e,t){this._register(K(e,Ne.BLUR,t))}onfocus(e,t){this._register(K(e,Ne.FOCUS,t))}onchange(e,t){this._register(K(e,Ne.CHANGE,t))}ignoreGesture(e){return ob.ignoreTarget(e)}},Nd=11,nb=class extends hc{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=Nd+"px",this.domNode.style.height=Nd+"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 Qu),this._register(Id(this.bgDomNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Id(this.domNode,Ne.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Qv),this._pointerdownScheduleRepeatTimer=this._register(new lc)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qt(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ab=class Bl{constructor(t,s,i,r,o,n,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,i=i|0,r=r|0,o=o|0,n=n|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,s<0&&(s=0),r+s>i&&(r=i-s),r<0&&(r=0),o<0&&(o=0),a+o>n&&(a=n-o),a<0&&(a=0),this.width=s,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=n,this.scrollTop=a}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,s){return new Bl(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Bl(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,s){let i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,n=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,c=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,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:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:n,scrollHeightChanged:a,scrollTopChanged:c}}},lb=class extends ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ab(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 s=this._state.withScrollDimensions(e,t);this._setState(s,!!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 s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let i;t?i=new Hd(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=Hd.start(this._state,s,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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},Fd=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};Hd=class Ol{constructor(t,s,i,r){this.from=t,this.to=s,this.duration=r,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,s,i){if(Math.abs(t-s)>2.5*i){let r,o;return t<s?(r=t+.75*i,o=s-.75*i):(r=t-.75*i,o=s+.75*i),cb(hl(t,r),hl(o,s),.33)}return hl(t,s)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let s=(t-this.startTime)/this.duration;if(s<1){let i=this.scrollLeft(s),r=this.scrollTop(s);return new Fd(i,r,!1)}return new Fd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,i){return Ol.start(t,s,i)}static start(t,s,i){i=i+10;let r=Date.now()-10;return new Ol(t,s,r,i)}};ub=class extends ie{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new lc)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},pb=140,ep=class extends hc{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 ub(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Qu),this._shouldRender=!0,this.domNode=oo(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(K(this.domNode.domNode,Ne.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new nb(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,i){this.slider=oo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(K(this.slider.domNode,Ne.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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,s=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);s<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let r=eb(this.domNode.domNode);t=e.pageX-r.left,s=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),n=Math.abs(o-s);if(qu&&n>pb){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(a))},()=>{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()}},tp=class Il{constructor(t,s,i,r,o,n){this._scrollbarSize=Math.round(s),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=n,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Il(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,i,r,o){let n=Math.max(0,i-t),a=Math.max(0,n-2*s),c=r>0&&r>i;if(!c)return{computedAvailableSize:Math.round(n),computedIsNeeded:c,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(i*a/r))),h=(a-l)/(r-i),d=o*h;return{computedAvailableSize:Math.round(n),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Il._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 s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,i=this._scrollPosition;return s<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},fb=class extends ep{constructor(e,t,s){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new tp(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},mb=class extends ep{constructor(e,t,s){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new tp(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},gb=500,Wd=50,jd=!0,_b=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},zl=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,s=0,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,s+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(nc){let s=qt(t.browserEvent),i=hv(s);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,i){let r=null,o=new _b(t,s,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,s){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),s){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),n=Math.abs(s.deltaX),a=Math.abs(s.deltaY),c=Math.max(Math.min(r,n),1),l=Math.max(Math.min(o,a),1),h=Math.max(r,n),d=Math.max(o,a);h%c===0&&d%l===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};zl.INSTANCE=new zl;vb=zl,bb=class extends hc{constructor(e,t,s){super(),this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new z),this.onWillScroll=this._onWillScroll.event,this._options=wb(t),this._scrollable=s,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new mb(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new fb(this._scrollable,this._options,i)),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=oo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=oo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=oo(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new lc),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ci(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,ss&&(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 Dd(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Ci(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new Dd(s))};this._mouseWheelToDispose.push(K(this._listenOnDomNode,Ne.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=vb.INSTANCE;jd&&t.acceptStandardWheelEvent(e);let s=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let n=!ss&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||n)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),c={};if(r){let l=Wd*r,h=a.scrollTop-(l<0?Math.floor(l):Math.ceil(l));this._verticalScrollbar.writeScrollPosition(c,h)}if(o){let l=Wd*o,h=a.scrollLeft-(l<0?Math.floor(l):Math.ceil(l));this._horizontalScrollbar.writeScrollPosition(c,h)}c=this._scrollable.validateScrollPosition(c),(a.scrollLeft!==c.scrollLeft||a.scrollTop!==c.scrollTop)&&(jd&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),s=!0)}let i=s;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(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,s=e.scrollLeft>0,i=s?" left":"",r=t?" top":"",o=s||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_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(),gb)}},yb=class extends bb{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};Nl=class extends ie{constructor(e,t,s,i,r,o,n,a){super(),this._bufferService=s,this._optionsService=n,this._renderService=a,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new lb({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:l=>Rn(i.window,l)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new yb(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(l=>{this._scrollableElement.updateOptions({handleMouseWheel:!(l&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ze.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(_e(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(_e(()=>this._styleElement.remove())),this._register(Ze.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
30
+ `)})),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(l=>this._handleScroll(l)))}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),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Nl=xe([F(2,lt),F(3,ks),F(4,$u),F(5,tr),F(6,ct),F(7,$s)],Nl);Fl=class extends ie{constructor(e,t,s,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=i,this._renderService=r,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(o=>this._removeDecoration(o))),this._register(_e(()=>{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 s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Fl=xe([F(1,lt),F(2,ks),F(3,uo),F(4,$s)],Fl);Sb=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<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Qt={full:0,left:0,center:0,right:0},Vs={full:0,left:0,center:0,right:0},qr={full:0,left:0,center:0,right:0},Ln=class extends ie{constructor(e,t,s,i,r,o,n,a){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=n,this._coreBrowserService=a,this._colorZoneStore=new Sb,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(_e(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;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);Vs.full=this._canvas.width,Vs.left=e,Vs.center=t,Vs.right=e,this._refreshDrawHeightConstants(),qr.full=1,qr.left=1,qr.center=1+Vs.left,qr.right=1+Vs.left+Vs.center}_refreshDrawHeightConstants(){Qt.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);Qt.left=t,Qt.center=t,Qt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qt.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(qr[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Qt[e.position||"full"]/2),Vs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Qt[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}))}};Ln=xe([F(2,lt),F(3,uo),F(4,$s),F(5,ct),F(6,tr),F(7,ks)],Ln);(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=`
31
+ `,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="\x7F"))(B||(B={}));(e=>(e.PAD="\x80",e.HOP="\x81",e.BPH="\x82",e.NBH="\x83",e.IND="\x84",e.NEL="\x85",e.SSA="\x86",e.ESA="\x87",e.HTS="\x88",e.HTJ="\x89",e.VTS="\x8A",e.PLD="\x8B",e.PLU="\x8C",e.RI="\x8D",e.SS2="\x8E",e.SS3="\x8F",e.DCS="\x90",e.PU1="\x91",e.PU2="\x92",e.STS="\x93",e.CCH="\x94",e.MW="\x95",e.SPA="\x96",e.EPA="\x97",e.SOS="\x98",e.SGCI="\x99",e.SCI="\x9A",e.CSI="\x9B",e.ST="\x9C",e.OSC="\x9D",e.PM="\x9E",e.APC="\x9F"))(xn||(xn={}));(e=>e.ST=`${B.ESC}\\`)(sp||(sp={}));Hl=class{constructor(e,t,s,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=i,this._coreService=r,this._renderService=o,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 s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${B.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),s=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Hl=xe([F(2,lt),F(3,ct),F(4,ki),F(5,$s)],Hl);Fe=0,He=0,We=0,Ce=0,Vd={css:"#00000000",rgba:0};(e=>{function t(r,o,n,a){return a!==void 0?`#${vi(r)}${vi(o)}${vi(n)}${vi(a)}`:`#${vi(r)}${vi(o)}${vi(n)}`}e.toCss=t;function s(r,o,n,a=255){return(r<<24|o<<16|n<<8|a)>>>0}e.toRgba=s;function i(r,o,n,a){return{css:e.toCss(r,o,n,a),rgba:e.toRgba(r,o,n,a)}}e.toColor=i})(Ae||(Ae={}));(e=>{function t(c,l){if(Ce=(l.rgba&255)/255,Ce===1)return{css:l.css,rgba:l.rgba};let h=l.rgba>>24&255,d=l.rgba>>16&255,m=l.rgba>>8&255,p=c.rgba>>24&255,f=c.rgba>>16&255,_=c.rgba>>8&255;Fe=p+Math.round((h-p)*Ce),He=f+Math.round((d-f)*Ce),We=_+Math.round((m-_)*Ce);let S=Ae.toCss(Fe,He,We),k=Ae.toRgba(Fe,He,We);return{css:S,rgba:k}}e.blend=t;function s(c){return(c.rgba&255)===255}e.isOpaque=s;function i(c,l,h){let d=kn.ensureContrastRatio(c.rgba,l.rgba,h);if(d)return Ae.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=i;function r(c){let l=(c.rgba|255)>>>0;return[Fe,He,We]=kn.toChannels(l),{css:Ae.toCss(Fe,He,We),rgba:l}}e.opaque=r;function o(c,l){return Ce=Math.round(l*255),[Fe,He,We]=kn.toChannels(c.rgba),{css:Ae.toCss(Fe,He,We,Ce),rgba:Ae.toRgba(Fe,He,We,Ce)}}e.opacity=o;function n(c,l){return Ce=c.rgba&255,o(c,Ce*l/255)}e.multiplyOpacity=n;function a(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}e.toColorRGB=a})(ge||(ge={}));(e=>{let t,s;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",s=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Ae.toColor(Fe,He,We);case 5:return Fe=parseInt(r.slice(1,2).repeat(2),16),He=parseInt(r.slice(2,3).repeat(2),16),We=parseInt(r.slice(3,4).repeat(2),16),Ce=parseInt(r.slice(4,5).repeat(2),16),Ae.toColor(Fe,He,We,Ce);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Fe=parseInt(o[1]),He=parseInt(o[2]),We=parseInt(o[3]),Ce=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Ae.toColor(Fe,He,We,Ce);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Fe,He,We,Ce]=t.getImageData(0,0,1,1).data,Ce!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ae.toRgba(Fe,He,We,Ce),css:r}}e.toColor=i})(Se||(Se={}));(e=>{function t(i){return s(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function s(i,r,o){let n=i/255,a=r/255,c=o/255,l=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),h=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return l*.2126+h*.7152+d*.0722}e.relativeLuminance2=s})(at||(at={}));(e=>{function t(n,a){if(Ce=(a&255)/255,Ce===1)return a;let c=a>>24&255,l=a>>16&255,h=a>>8&255,d=n>>24&255,m=n>>16&255,p=n>>8&255;return Fe=d+Math.round((c-d)*Ce),He=m+Math.round((l-m)*Ce),We=p+Math.round((h-p)*Ce),Ae.toRgba(Fe,He,We)}e.blend=t;function s(n,a,c){let l=at.relativeLuminance(n>>8),h=at.relativeLuminance(a>>8);if(ws(l,h)<c){if(h<l){let p=i(n,a,c),f=ws(l,at.relativeLuminance(p>>8));if(f<c){let _=r(n,a,c),S=ws(l,at.relativeLuminance(_>>8));return f>S?p:_}return p}let d=r(n,a,c),m=ws(l,at.relativeLuminance(d>>8));if(m<c){let p=i(n,a,c),f=ws(l,at.relativeLuminance(p>>8));return m>f?d:p}return d}}e.ensureContrastRatio=s;function i(n,a,c){let l=n>>24&255,h=n>>16&255,d=n>>8&255,m=a>>24&255,p=a>>16&255,f=a>>8&255,_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));for(;_<c&&(m>0||p>0||f>0);)m-=Math.max(0,Math.ceil(m*.1)),p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));return(m<<24|p<<16|f<<8|255)>>>0}e.reduceLuminance=i;function r(n,a,c){let l=n>>24&255,h=n>>16&255,d=n>>8&255,m=a>>24&255,p=a>>16&255,f=a>>8&255,_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));for(;_<c&&(m<255||p<255||f<255);)m=Math.min(255,m+Math.ceil((255-m)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),_=ws(at.relativeLuminance2(m,p,f),at.relativeLuminance2(l,h,d));return(m<<24|p<<16|f<<8|255)>>>0}e.increaseLuminance=r;function o(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=o})(kn||(kn={}));Cb=class extends ho{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Dn=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Mt}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let s=[],i=t.translateToString(!0),r=0,o=0,n=0,a=t.getFg(0),c=t.getBg(0);for(let l=0;l<t.getTrimmedLength();l++)if(t.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==c){if(l-r>1){let h=this._getJoinedRanges(i,n,o,t,r);for(let d=0;d<h.length;d++)s.push(h[d])}r=l,n=o,a=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||Ks.length}if(this._bufferService.cols-r>1){let l=this._getJoinedRanges(i,n,o,t,r);for(let h=0;h<l.length;h++)s.push(l[h])}return s}_getJoinedRanges(e,t,s,i,r){let o=e.substring(t,s),n=[];try{n=this._characterJoiners[0].handler(o)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let c=this._characterJoiners[a].handler(o);for(let l=0;l<c.length;l++)Dn._mergeRanges(n,c[l])}catch(c){console.error(c)}return this._stringRangesToCellRanges(n,i,r),n}_stringRangesToCellRanges(e,t,s){let i=0,r=!1,o=0,n=e[i];if(n){for(let a=s;a<this._bufferService.cols;a++){let c=t.getWidth(a),l=t.getString(a).length||Ks.length;if(c!==0){if(!r&&n[0]<=o&&(n[0]=a,r=!0),n[1]<=o){if(n[1]=a,n=e[++i],!n)break;n[0]<=o?(n[0]=a,r=!0):r=!1}o+=l}}n&&(n[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let s=!1;for(let i=0;i<e.length;i++){let r=e[i];if(s){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Dn=xe([F(0,lt)],Dn);Wl=class{constructor(e,t,s,i,r,o,n){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=n,this._workCell=new Mt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,i,r,o,n,a,c,l,h){let d=[],m=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,f=e.getNoBgTrimmedLength();s&&f<o+1&&(f=o+1);let _,S=0,k="",x=0,v=0,y=0,A=0,M=!1,H=0,q=!1,ee=0,ce=0,V=[],ve=l!==-1&&h!==-1;for(let $=0;$<f;$++){e.loadCell($,this._workCell);let w=this._workCell.getWidth();if(w===0)continue;let L=!1,E=$>=ce,P=$,D=this._workCell;if(m.length>0&&$===m[0][0]&&E){let ue=m.shift(),Aa=this._isCellInSelection(ue[0],t);for(x=ue[0]+1;x<ue[1];x++)E&&(E=Aa===this._isCellInSelection(x,t));E&&(E=!s||o<ue[0]||o>=ue[1]),E?(L=!0,D=new Cb(this._workCell,e.translateToString(!0,ue[0],ue[1]),ue[1]-ue[0]),P=ue[1]-1,w=D.getWidth()):ce=ue[1]}let N=this._isCellInSelection($,t),Z=s&&$===o,le=ve&&$>=l&&$<=h,Xe=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,ue=>{Xe=!0});let ut=D.getChars()||Ks;if(ut===" "&&(D.isUnderline()||D.isOverline())&&(ut="\xA0"),ee=w*a-c.get(ut,D.isBold(),D.isItalic()),!_)_=this._document.createElement("span");else if(S&&(N&&q||!N&&!q&&D.bg===v)&&(N&&q&&p.selectionForeground||D.fg===y)&&D.extended.ext===A&&le===M&&ee===H&&!Z&&!L&&!Xe&&E){D.isInvisible()?k+=Ks:k+=ut,S++;continue}else S&&(_.textContent=k),_=this._document.createElement("span"),S=0,k="";if(v=D.bg,y=D.fg,A=D.extended.ext,M=le,H=ee,q=N,L&&o>=$&&o<=P&&(o=$),!this._coreService.isCursorHidden&&Z&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)n&&V.push("xterm-cursor-blink"),V.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break;default:break}}if(D.isBold()&&V.push("xterm-bold"),D.isItalic()&&V.push("xterm-italic"),D.isDim()&&V.push("xterm-dim"),D.isInvisible()?k=Ks:k=D.getChars()||Ks,D.isUnderline()&&(V.push(`xterm-underline-${D.extended.underlineStyle}`),k===" "&&(k="\xA0"),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())_.style.textDecorationColor=`rgb(${ho.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let ue=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&ue<8&&(ue+=8),_.style.textDecorationColor=p.ansi[ue].css}D.isOverline()&&(V.push("xterm-overline"),k===" "&&(k="\xA0")),D.isStrikethrough()&&V.push("xterm-strikethrough"),le&&(_.style.textDecoration="underline");let be=D.getFgColor(),Ft=D.getFgColorMode(),Ee=D.getBgColor(),ps=D.getBgColorMode(),ci=!!D.isInverse();if(ci){let ue=be;be=Ee,Ee=ue;let Aa=Ft;Ft=ps,ps=Aa}let Is,Go,Ar=!1;this._decorationService.forEachDecorationAtCell($,t,void 0,ue=>{ue.options.layer!=="top"&&Ar||(ue.backgroundColorRGB&&(ps=50331648,Ee=ue.backgroundColorRGB.rgba>>8&16777215,Is=ue.backgroundColorRGB),ue.foregroundColorRGB&&(Ft=50331648,be=ue.foregroundColorRGB.rgba>>8&16777215,Go=ue.foregroundColorRGB),Ar=ue.options.layer==="top")}),!Ar&&N&&(Is=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Ee=Is.rgba>>8&16777215,ps=50331648,Ar=!0,p.selectionForeground&&(Ft=50331648,be=p.selectionForeground.rgba>>8&16777215,Go=p.selectionForeground)),Ar&&V.push("xterm-decoration-top");let zs;switch(ps){case 16777216:case 33554432:zs=p.ansi[Ee],V.push(`xterm-bg-${Ee}`);break;case 50331648:zs=Ae.toColor(Ee>>16,Ee>>8&255,Ee&255),this._addStyle(_,`background-color:#${Ud((Ee>>>0).toString(16),"0",6)}`);break;default:ci?(zs=p.foreground,V.push("xterm-bg-257")):zs=p.background}switch(Is||D.isDim()&&(Is=ge.multiplyOpacity(zs,.5)),Ft){case 16777216:case 33554432:D.isBold()&&be<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(be+=8),this._applyMinimumContrast(_,zs,p.ansi[be],D,Is,void 0)||V.push(`xterm-fg-${be}`);break;case 50331648:let ue=Ae.toColor(be>>16&255,be>>8&255,be&255);this._applyMinimumContrast(_,zs,ue,D,Is,Go)||this._addStyle(_,`color:#${Ud(be.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(_,zs,p.foreground,D,Is,Go)||ci&&V.push("xterm-fg-257")}V.length&&(_.className=V.join(" "),V.length=0),!Z&&!L&&!Xe&&E?S++:_.textContent=k,ee!==this.defaultSpacing&&(_.style.letterSpacing=`${ee}px`),d.push(_),$=P}return _&&S&&(_.textContent=k),d}_applyMinimumContrast(e,t,s,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||$b(i.getCode()))return!1;let n=this._getContrastCache(i),a;if(!r&&!o&&(a=n.getColor(t.rgba,s.rgba)),a===void 0){let c=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);a=ge.ensureContrastRatio(r||t,o||s,c),n.setColor((r||t).rgba,(o||s).rgba,a??null)}return a?(this._addStyle(e,`color:${a.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 s=this._selectionStart,i=this._selectionEnd;return!s||!i?!1:this._columnSelectMode?s[0]<=i[0]?e>=s[0]&&t>=s[1]&&e<i[0]&&t<=i[1]:e<s[0]&&t>=s[1]&&e>=i[0]&&t<=i[1]:t>s[1]&&t<i[1]||s[1]===i[1]&&t===s[1]&&e>=s[0]&&e<i[0]||s[1]<i[1]&&t===i[1]&&e<i[0]||s[1]<i[1]&&t===s[1]&&e>=s[0]}};Wl=xe([F(1,Au),F(2,ct),F(3,ks),F(4,ki),F(5,uo),F(6,tr)],Wl);Tb=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let s=e.createElement("span");s.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,i,r,o],this._container.appendChild(s),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,i){e===this._font&&t===this._fontSize&&s===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,s){let i=0;if(!t&&!s&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let n=this._measure(e,0);return n>0&&(this._flat[i]=n),n}let r=e;t&&(r+="B"),s&&(r+="I");let o=this._holey.get(r);if(o===void 0){let n=0;t&&(n|=1),s&&(n|=2),o=this._measure(e,n),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},Ab=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,s,i=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,n=s[1]-r,a=Math.max(o,0),c=Math.min(n,e.rows-1);if(a>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=n,this.viewportCappedStartRow=a,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};dl="xterm-dom-renderer-owner-",Lt="xterm-rows",fn="xterm-fg-",qd="xterm-bg-",Kr="xterm-focus",mn="xterm-selection",Lb=1,jl=class extends ie{constructor(e,t,s,i,r,o,n,a,c,l,h,d,m,p){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=n,this._charSizeService=c,this._optionsService=l,this._bufferService=h,this._coreService=d,this._coreBrowserService=m,this._themeService=p,this._terminalClass=Lb++,this._rowElements=[],this._selectionRenderModel=Rb(),this.onRequestRedraw=this._register(new z).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Lt),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(mn),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Eb(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(f=>this._injectCss(f))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Wl,document),this._element.classList.add(dl+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(f=>this._handleLinkHover(f))),this._register(this._linkifier2.onHideLinkUnderline(f=>this._handleLinkLeave(f))),this._register(_e(()=>{this._element.classList.remove(dl+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Tb(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Lt} 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} .${Lt} { 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} .${Lt} .xterm-dim { color: ${ge.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 s=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Lt}.${Kr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Lt}.${Kr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Lt}.${Kr} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Lt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${mn} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${mn} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${mn} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,n]of e.ansi.entries())t+=`${this._terminalSelector} .${fn}${o} { color: ${n.css}; }${this._terminalSelector} .${fn}${o}.xterm-dim { color: ${ge.multiplyOpacity(n,.5).css}; }${this._terminalSelector} .${qd}${o} { background-color: ${n.css}; }`;t+=`${this._terminalSelector} .${fn}257 { color: ${ge.opaque(e.background).css}; }${this._terminalSelector} .${fn}257.xterm-dim { color: ${ge.multiplyOpacity(ge.opaque(e.background),.5).css}; }${this._terminalSelector} .${qd}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 s=this._rowElements.length;s<=t;s++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(Kr),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Kr),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,n=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(s){let c=e[0]>t[0];a.appendChild(this._createSelectionElement(o,c?t[0]:e[0],c?e[0]:t[0],n-o+1))}else{let c=i===o?e[0]:0,l=o===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,c,l));let h=n-o-1;if(a.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,h)),o!==n){let d=r===n?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,s,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,n=this.dimensions.css.cell.width*(s-t);return o+n>this.dimensions.css.canvas.width&&(n=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${n}px`,r}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 s=this._bufferService.buffer,i=s.ybase+s.y,r=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,n=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let l=c+s.ydisp,h=this._rowElements[c],d=s.lines.get(l);if(!h||!d)break;h.replaceChildren(...this._rowFactory.createRow(d,l,l===i,n,a,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${dl}${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,s,i,r,o){s<0&&(e=0),i<0&&(t=0);let n=this._bufferService.rows-1;s=Math.max(Math.min(s,n),0),i=Math.max(Math.min(i,n),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,c=a.ybase+a.y,l=Math.min(a.x,r-1),h=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,m=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=s;p<=i;++p){let f=p+a.ydisp,_=this._rowElements[p],S=a.lines.get(f);if(!_||!S)break;_.replaceChildren(...this._rowFactory.createRow(S,f,f===c,d,m,l,h,this.dimensions.css.cell.width,this._widthCache,o?p===s?e:0:-1,o?(p===i?t:r)-1:-1))}}};jl=xe([F(7,ic),F(8,In),F(9,ct),F(10,lt),F(11,ki),F(12,ks),F(13,tr)],jl);Vl=class extends ie{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Pb(this._optionsService))}catch{this._measureStrategy=this._register(new Db(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())}};Vl=xe([F(2,ct)],Vl);ip=class extends ie{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)}},Db=class extends ip{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},Pb=class extends ip{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}},Mb=class extends ie{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Bb(this._window)),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Ze.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(K(this._textarea,"focus",()=>this._isFocused=!0)),this._register(K(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}},Bb=class extends ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new er),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(_e(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=K(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)}},Ob=class extends ie{constructor(){super(),this.linkProviders=[],this._register(_e(()=>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)}}}};Ul=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,i,r){return Ib(window,e,t,s,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let s=dc(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Ul=xe([F(0,$s),F(1,In)],Ul);zb=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,s){this._rowCount=s,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=[]}},rp={};w_(rp,{getSafariVersion:()=>Fb,isChromeOS:()=>lp,isFirefox:()=>op,isIpad:()=>Hb,isIphone:()=>Wb,isLegacyEdge:()=>Nb,isLinux:()=>uc,isMac:()=>Pn,isNode:()=>Fn,isSafari:()=>np,isWindows:()=>ap});Fn=typeof process<"u"&&"title"in process,po=Fn?"node":navigator.userAgent,fo=Fn?"node":navigator.platform,op=po.includes("Firefox"),Nb=po.includes("Edge"),np=/^((?!chrome|android).)*safari/i.test(po);Pn=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(fo),Hb=fo==="iPad",Wb=fo==="iPhone",ap=["Windows","Win16","Win32","WinCE"].includes(fo),uc=fo.indexOf("Linux")>=0,lp=/\bCrOS\b/.test(po),cp=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,s=0,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),s=Math.max(t,s),r=e.timeRemaining(),s*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},jb=class extends cp{_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())}}},Vb=class extends cp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Mn=!Fn&&"requestIdleCallback"in window?Vb:jb,Ub=class{constructor(){this._queue=new Mn}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ql=class extends ie{constructor(e,t,s,i,r,o,n,a,c){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=i,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new er),this._pausedResizeTask=new Ub,this._observerDisposable=this._register(new er),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 z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new zb((l,h)=>this._renderRows(l,h),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new qb(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(_e(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(n.onResize(()=>this._fullRefresh())),this._register(n.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(n.cols,n.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(n.buffer.y,n.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(l=>this._registerIntersectionObserver(l,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=_e(()=>s.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,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),s||(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,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ql=xe([F(2,ct),F(3,In),F(4,ki),F(5,uo),F(6,lt),F(7,ks),F(8,tr)],ql);qb=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,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)}};e0=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._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)}};ul=50,t0=15,s0=50,i0=500,r0="\xA0",o0=new RegExp(r0,"g"),Kl=class extends ie{constructor(e,t,s,i,r,o,n,a,c){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=n,this._renderService=a,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Mt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=l=>this._handleMouseMove(l),this._mouseUpListener=l=>this._handleMouseUp(l),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(l=>this._handleTrim(l)),this._register(this._bufferService.buffers.onBufferActivate(l=>this._handleBufferActivate(l))),this.enable(),this._model=new e0(this._bufferService),this._activeSelectionMode=0,this._register(_e(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(l=>{l.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 s=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let n=e[1];n<=t[1];n++){let a=s.translateBufferLineToString(n,!0,r,o);i.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(s.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let n=s.lines.get(o),a=s.translateBufferLineToString(o,!0);n?.isWrapped?i[i.length-1]+=a:i.push(a)}if(e[1]!==t[1]){let o=s.lines.get(t[1]),n=s.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=n:i.push(n)}}return i.map(r=>r.replace(o0," ")).join(ap?`\r
32
32
  `:`
33
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),pc&&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),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i||!t?!1:this._areCoordsInSelection(t,s,i)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i?!1:this._areCoordsInSelection([e,t],s,i)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Kd(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,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=uc(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-pl),pl),t/=pl,t/Math.abs(t)+Math.round(t*(t0-1)))}shouldForceSelection(e){return Bn?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(),s0)}_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&&!(Bn&&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]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let i=s.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<i0&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let i=Kb(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:r>1&&t!==i&&(s+=r-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let n=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e[0]),c=a,l=e[0]-a,h=0,d=0,m=0,p=0;if(n.charAt(a)===" "){for(;a>0&&n.charAt(a-1)===" ";)a--;for(;c<n.length&&n.charAt(c+1)===" ";)c++}else{let S=e[0],$=e[0];o.getWidth(S)===0&&(h++,S--),o.getWidth($)===2&&(d++,$++);let x=o.getString($).length;for(x>1&&(p+=x-1,c+=x-1);S>0&&a>0&&!this._isCharWordSeparator(o.loadCell(S-1,this._workCell));){o.loadCell(S-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,S--):v>1&&(m+=v-1,a-=v-1),a--,S--}for(;$<o.length&&c+1<n.length&&!this._isCharWordSeparator(o.loadCell($+1,this._workCell));){o.loadCell($+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,$++):v>1&&(p+=v-1,c+=v-1),c++,$++}}c++;let f=a+l-h+m,_=Math.min(this._bufferService.cols,c-a+h+d-m-p);if(!(!t&&n.slice(a,c).trim()==="")){if(s&&f===0&&o.getCodePoint(0)!==32){let S=r.lines.get(e[1]-1);if(S&&o.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let $=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if($){let x=this._bufferService.cols-$.start;f-=x,_+=x}}}if(i&&f+_===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let S=r.lines.get(e[1]+1);if(S?.isWrapped&&S.getCodePoint(0)!==32){let $=this._getWordAt([0,e[1]+1],!1,!1,!0);$&&(_+=$.length)}}return{start:f,length:_}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=Kd(s,this._bufferService.cols)}};Gl=xe([F(3,lt),F(4,ki),F(5,oc),F(6,ct),F(7,$s),F(8,ks)],Gl);Gd=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yd=class{constructor(){this._color=new Gd,this._css=new Gd}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Me=Object.freeze((()=>{let e=[Se.toColor("#2e3436"),Se.toColor("#cc0000"),Se.toColor("#4e9a06"),Se.toColor("#c4a000"),Se.toColor("#3465a4"),Se.toColor("#75507b"),Se.toColor("#06989a"),Se.toColor("#d3d7cf"),Se.toColor("#555753"),Se.toColor("#ef2929"),Se.toColor("#8ae234"),Se.toColor("#fce94f"),Se.toColor("#729fcf"),Se.toColor("#ad7fa8"),Se.toColor("#34e2e2"),Se.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=t[s/36%6|0],r=t[s/6%6|0],o=t[s%6];e.push({css:Ae.toCss(i,r,o),rgba:Ae.toRgba(i,r,o)})}for(let s=0;s<24;s++){let i=8+s*10;e.push({css:Ae.toCss(i,i,i),rgba:Ae.toRgba(i,i,i)})}return e})()),bi=Se.toColor("#ffffff"),to=Se.toColor("#000000"),Xd=Se.toColor("#ffffff"),Jd=to,Yr={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},n0=bi,Yl=class extends ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yd,this._halfContrastCache=new Yd,this._onChangeColors=this._register(new z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:bi,background:to,cursor:Xd,cursorAccent:Jd,selectionForeground:void 0,selectionBackgroundTransparent:Yr,selectionBackgroundOpaque:ge.blend(to,Yr),selectionInactiveBackgroundTransparent:Yr,selectionInactiveBackgroundOpaque:ge.blend(to,Yr),scrollbarSliderBackground:ge.opacity(bi,.2),scrollbarSliderHoverBackground:ge.opacity(bi,.4),scrollbarSliderActiveBackground:ge.opacity(bi,.5),overviewRulerBorder:bi,ansi:Me.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=fe(e.foreground,bi),t.background=fe(e.background,to),t.cursor=ge.blend(t.background,fe(e.cursor,Xd)),t.cursorAccent=ge.blend(t.background,fe(e.cursorAccent,Jd)),t.selectionBackgroundTransparent=fe(e.selectionBackground,Yr),t.selectionBackgroundOpaque=ge.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=fe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ge.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?fe(e.selectionForeground,Vd):void 0,t.selectionForeground===Vd&&(t.selectionForeground=void 0),ge.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ge.opacity(t.selectionBackgroundTransparent,.3)),ge.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ge.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=fe(e.scrollbarSliderBackground,ge.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=fe(e.scrollbarSliderHoverBackground,ge.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=fe(e.scrollbarSliderActiveBackground,ge.opacity(t.foreground,.5)),t.overviewRulerBorder=fe(e.overviewRulerBorder,n0),t.ansi=Me.slice(),t.ansi[0]=fe(e.black,Me[0]),t.ansi[1]=fe(e.red,Me[1]),t.ansi[2]=fe(e.green,Me[2]),t.ansi[3]=fe(e.yellow,Me[3]),t.ansi[4]=fe(e.blue,Me[4]),t.ansi[5]=fe(e.magenta,Me[5]),t.ansi[6]=fe(e.cyan,Me[6]),t.ansi[7]=fe(e.white,Me[7]),t.ansi[8]=fe(e.brightBlack,Me[8]),t.ansi[9]=fe(e.brightRed,Me[9]),t.ansi[10]=fe(e.brightGreen,Me[10]),t.ansi[11]=fe(e.brightYellow,Me[11]),t.ansi[12]=fe(e.brightBlue,Me[12]),t.ansi[13]=fe(e.brightMagenta,Me[13]),t.ansi[14]=fe(e.brightCyan,Me[14]),t.ansi[15]=fe(e.brightWhite,Me[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)t.ansi[i+16]=fe(e.extendedAnsi[i],Me[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Yl=xe([F(0,ct)],Yl);a0=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},l0=class{constructor(){this._services=new a0,this._services.set(rc,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=T_(e).sort((o,n)=>o.index-n.index),i=[];for(let o of s){let n=this._services.get(o.id);if(!n)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(n)}let r=s.length>0?s[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},c0={trace:0,debug:1,info:2,warn:3,error:4,off:5},h0="xterm.js: ",Xl=class extends ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),d0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=c0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":h0)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Xl=xe([F(0,ct)],Xl);Zd=class extends ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new z),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let i=this._length+s.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let r=t-1;r>=0;r--)this.set(e+r+s,this.get(e+r));let i=e+t+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},oe=3,Te=Object.freeze(new uo),vn=0,fl=2,so=class up{constructor(t,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*oe);let r=s||Mt.fromCharData([0,Su,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let s=this._data[t*oe+0],i=s&2097151;return[this._data[t*oe+1],s&2097152?this._combined[t]:i?qs(i):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,s){this._data[t*oe+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*oe+0]=t|2097152|s[2]<<22):this._data[t*oe+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*oe+0]>>22}hasWidth(t){return this._data[t*oe+0]&12582912}getFg(t){return this._data[t*oe+1]}getBg(t){return this._data[t*oe+2]}hasContent(t){return this._data[t*oe+0]&4194303}getCodePoint(t){let s=this._data[t*oe+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*oe+0]&2097152}getString(t){let s=this._data[t*oe+0];return s&2097152?this._combined[t]:s&2097151?qs(s&2097151):""}isProtected(t){return this._data[t*oe+2]&536870912}loadCell(t,s){return vn=t*oe,s.content=this._data[vn+0],s.fg=this._data[vn+1],s.bg=this._data[vn+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*oe+0]=s.content,this._data[t*oe+1]=s.fg,this._data[t*oe+2]=s.bg}setCellFromCodepoint(t,s,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*oe+0]=s|i<<22,this._data[t*oe+1]=r.fg,this._data[t*oe+2]=r.bg}addCodepointToCell(t,s,i){let r=this._data[t*oe+0];r&2097152?this._combined[t]+=qs(s):r&2097151?(this._combined[t]=qs(r&2097151)+qs(s),r&=-2097152,r|=2097152):r=s|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*oe+0]=r}insertCells(t,s,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length-t){let r=new Mt;for(let o=this.length-t-s-1;o>=0;--o)this.setCell(t+s+o,this.loadCell(t+o,r));for(let o=0;o<s;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,s,i){if(t%=this.length,s<this.length-t){let r=new Mt;for(let o=0;o<this.length-t-s;++o)this.setCell(t+o,this.loadCell(t+s+o,r));for(let o=this.length-s;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,s,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.setCell(t++,i)}resize(t,s){if(t===this.length)return this._data.length*4*fl<this._data.buffer.byteLength;let i=t*oe;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,s)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let n=0;n<r.length;n++){let a=parseInt(r[n],10);a>=t&&delete this._combined[a]}let o=Object.keys(this._extendedAttrs);for(let n=0;n<o.length;n++){let a=parseInt(o[n],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,i*4*fl<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*fl<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new up(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*oe+0]&4194303)return t+(this._data[t*oe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*oe+0]&4194303||this._data[t*oe+2]&50331648)return t+(this._data[t*oe+0]>>22);return 0}copyCellsFrom(t,s,i,r,o){let n=t._data;if(o)for(let c=r-1;c>=0;c--){for(let l=0;l<oe;l++)this._data[(i+c)*oe+l]=n[(s+c)*oe+l];n[(s+c)*oe+2]&268435456&&(this._extendedAttrs[i+c]=t._extendedAttrs[s+c])}else for(let c=0;c<r;c++){for(let l=0;l<oe;l++)this._data[(i+c)*oe+l]=n[(s+c)*oe+l];n[(s+c)*oe+2]&268435456&&(this._extendedAttrs[i+c]=t._extendedAttrs[s+c])}let a=Object.keys(t._combined);for(let c=0;c<a.length;c++){let l=parseInt(a[c],10);l>=s&&(this._combined[l-s+i]=t._combined[l])}}translateToString(t,s,i,r){s=s??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;s<i;){let n=this._data[s*oe+0],a=n&2097151,c=n&2097152?this._combined[s]:a?qs(a):Ks;if(o+=c,r)for(let l=0;l<c.length;++l)r.push(s);s+=n>>22||1}return r&&r.push(s),o}};pp=class fp{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=fp._nextId++,this._onDispose=this.register(new z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ci(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};pp._nextId=1;g0=pp,Oe={},yi=Oe.B;Oe[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};Oe.A={"#":"\xA3"};Oe.B=void 0;Oe[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};Oe.C=Oe[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};Oe.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};Oe.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};Oe.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};Oe.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};Oe.E=Oe[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};Oe.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};Oe.H=Oe[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};Oe["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};Qd=4294967295,eu=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Te.clone(),this.savedCharset=yi,this.markers=[],this._nullCell=Mt.fromCharData([0,Su,1,0]),this._whitespaceCell=Mt.fromCharData([0,Ks,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new On,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Zd(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 An),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 An),this._whitespaceCell}getBlankLine(e,t){return new so(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&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Qd?Qd:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Te);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 Zd(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(Te),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let n=0;n<this.lines.length;n++)i+=+this.lines.get(n).resize(e,s);let o=0;if(this._rows<t)for(let n=this._rows;n<t;n++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new so(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new so(e,s)));else for(let n=this._rows;n>t;n--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let n=this.lines.length-r;n>0&&(this.lines.trimStart(n),this.ybase=Math.max(this.ybase-n,0),this.ydisp=Math.max(this.ydisp-n,0),this.savedY=Math.max(this.savedY-n,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.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._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)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 s=this._optionsService.rawOptions.reflowCursorLine,i=u0(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Te),s);if(i.length>0){let r=p0(this.lines,i);f0(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let i=this.getNullCell(Te),r=s;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new so(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Te),r=[],o=0;for(let n=this.lines.length-1;n>=0;n--){let a=this.lines.get(n);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let c=[a];for(;a.isWrapped&&n>0;)a=this.lines.get(--n),c.unshift(a);if(!s){let v=this.ybase+this.y;if(v>=n&&v<n+c.length)continue}let l=c[c.length-1].getTrimmedLength(),h=m0(c,this._cols,e),d=h.length-c.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+d):m=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let v=0;v<d;v++){let y=this.getBlankLine(Te,!0);p.push(y)}p.length>0&&(r.push({start:n+c.length+o,newLines:p}),o+=p.length),c.push(...p);let f=h.length-1,_=h[f];_===0&&(f--,_=h[f]);let S=c.length-d-1,$=l;for(;S>=0;){let v=Math.min($,_);if(c[f]===void 0)break;if(c[f].copyCellsFrom(c[S],$-v,_-v,v,!0),_-=v,_===0&&(f--,_=h[f]),$-=v,$===0){S--;let y=Math.max(S,0);$=ho(c,y,this._cols)}}for(let v=0;v<c.length;v++)h[v]<e&&c[v].setCell(h[v],i);let x=d-m;for(;x-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(r.length>0){let n=[],a=[];for(let _=0;_<this.lines.length;_++)a.push(this.lines.get(_));let c=this.lines.length,l=c-1,h=0,d=r[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let m=0;for(let _=Math.min(this.lines.maxLength-1,c+o-1);_>=0;_--)if(d&&d.start>l+m){for(let S=d.newLines.length-1;S>=0;S--)this.lines.set(_--,d.newLines[S]);_++,n.push({index:l+1,amount:d.newLines.length}),m+=d.newLines.length,d=r[++h]}else this.lines.set(_,a[l--]);let p=0;for(let _=n.length-1;_>=0;_--)n[_].index+=p,this.lines.onInsertEmitter.fire(n[_]),p+=n[_].amount;let f=Math.max(0,c+o-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(e,t,s=0,i){let r=this.lines.get(e);return r?r.translateToString(t,s,i):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);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;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new g0(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},_0=class extends ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new z),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 eu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new eu(!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)}},mp=2,gp=1,Jl=class extends ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,mp),this.rows=Math.max(e.rawOptions.rows||0,gp),this.buffers=this._register(new _0(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(s.scrollTop===0){let n=s.lines.isFull;o===s.lines.length-1?n?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(o+1,0,i.clone()),n?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let n=o-r+1;s.lines.shiftElements(r+1,n-1,-1),s.lines.set(o,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};Jl=xe([F(0,ct)],Jl);Zi={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:Bn,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},v0=["normal","bold","100","200","300","400","500","600","700","800","900"],b0=class extends ie{constructor(e){super(),this._onOptionChange=this._register(new z),this.onOptionChange=this._onOptionChange.event;let t={...Zi};for(let s in e)if(s in t)try{let i=e[s];t[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(_e(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Zi))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,i)=>{if(!(s in Zi))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let i={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Zi[e]),!y0(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Zi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=v0.includes(t)?t:Zi[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}};tu=Object.freeze({insertMode:!1}),su=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Zl=class extends ie{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new z),this.onData=this._onData.event,this._onUserInput=this._register(new z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=io(tu),this.decPrivateModes=io(su)}reset(){this.modes=io(tu),this.decPrivateModes=io(su)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.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))}};Zl=xe([F(0,lt),F(1,Eu),F(2,ct)],Zl);iu={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}};gl=String.fromCharCode,ru={DEFAULT:e=>{let t=[ml(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${gl(t[0])}${gl(t[1])}${gl(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ml(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ml(e,!0)};${e.x};${e.y}${t}`}},Ql=class extends ie{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new z),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(iu))this.addProtocol(i,iu[i]);for(let i of Object.keys(ru))this.addEncoding(i,ru[i]);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,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let i=t/s,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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,s){if(s){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)}};Ql=xe([F(0,lt),F(1,ki),F(2,ct)],Ql);_l=[[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]],w0=[[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]];C0=class{constructor(){if(this.version="6",!Be){Be=new Uint8Array(65536),Be.fill(1),Be[0]=0,Be.fill(0,1,32),Be.fill(0,127,160),Be.fill(2,4352,4448),Be[9001]=2,Be[9002]=2,Be.fill(2,11904,42192),Be[12351]=1,Be.fill(2,44032,55204),Be.fill(2,63744,64256),Be.fill(2,65040,65050),Be.fill(2,65072,65136),Be.fill(2,65280,65377),Be.fill(2,65504,65511);for(let e=0;e<_l.length;++e)Be.fill(0,_l[e][0],_l[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Be[e]:S0(e,w0)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),i=s===0&&t!==0;if(i){let r=wi.extractWidth(t);r===0?i=!1:r>s&&(s=r)}return wi.createPropertyValue(0,s,i)}},wi=class Tn{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new z,this.onChange=this._onChange.event;let t=new C0;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,s,i=!1){return(t&16777215)<<3|(s&3)<<1|(i?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 s=0,i=0,r=t.length;for(let o=0;o<r;++o){let n=t.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=r)return s+this.wcwidth(n);let l=t.charCodeAt(o);56320<=l&&l<=57343?n=(n-55296)*1024+l-56320+65536:s+=this.wcwidth(l)}let a=this.charProperties(n,i),c=Tn.extractWidth(a);Tn.extractShouldJoin(a)&&(c-=Tn.extractWidth(i)),s+=c,i=a}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},x0=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)}};Xr=2147483647,k0=256,_p=class ec{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>k0)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new ec;if(!t.length)return s;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)s.addSubParam(r[o]);else s.addParam(r)}return s}clone(){let t=new ec(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}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>Xr?Xr: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>Xr?Xr:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-s>0?this._subParams.subarray(s,i):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&(t[s]=this._subParams.slice(i,r))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[s-1];i[s-1]=~r?Math.min(r*10+t,Xr):t}},Jr=[],$0=class{constructor(){this._state=0,this._active=Jr,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,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=Jr}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=Jr,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Jr,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",zn(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&s-t>0&&this._put(e,t,s)}}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 s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].end(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Jr,this._id=-1,this._state=0}}},Ct=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=zn(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Zr=[],E0=class{constructor(){this._handlers=Object.create(null),this._active=Zr,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Zr}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,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=Zr,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Zr,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",zn(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].unhook(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Zr,this._ident=0}},ro=new _p;ro.addParam(0);nu=class{constructor(e){this._handler=e,this._data="",this._params=ro,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ro,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=zn(e,t,s),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(s=>(this._params=ro,this._data="",this._hitLimit=!1,s));return this._params=ro,this._data="",this._hitLimit=!1,t}},T0=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,i){this.table[t<<8|e]=s<<4|i}addMany(e,t,s,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=s<<4|i}},Pt=160,A0=(function(){let e=new T0(4095),t=Array.apply(null,Array(256)).map((a,c)=>c),s=(a,c)=>t.slice(a,c),i=s(32,127),r=s(0,24);r.push(25),r.push.apply(r,s(28,32));let o=s(0,14),n;e.setDefault(1,0),e.addMany(i,0,2,0);for(n in o)e.addMany([24,26,153,154],n,3,0),e.addMany(s(128,144),n,3,0),e.addMany(s(144,152),n,3,0),e.add(156,n,0,0),e.add(27,n,11,1),e.add(157,n,4,8),e.addMany([152,158,159],n,0,7),e.add(155,n,11,3),e.add(144,n,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Pt,0,2,0),e.add(Pt,8,5,8),e.add(Pt,6,0,6),e.add(Pt,11,0,11),e.add(Pt,13,13,13),e})(),R0=class extends ie{constructor(e=A0){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 _p,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(_e(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $0),this._dcsParser=this._register(new E0),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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 r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=i,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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,s,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,s){let i=0,r=0,o=0,n;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&c>-1){for(;c>=0&&(n=a[c](this._params),n!==!0);c--)if(n instanceof Promise)return this._parseStack.handlerPos=c,n}this._parseStack.handlers=[];break;case 4:if(s===!1&&c>-1){for(;c>=0&&(n=a[c](),n!==!0);c--)if(n instanceof Promise)return this._parseStack.handlerPos=c,n}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(i!==24&&i!==26,s),n)return n;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],n=this._oscParser.end(i!==24&&i!==26,s),n)return n;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=o;a<t;++a){switch(i=e[a],r=this._transitions.table[this.currentState<<8|(i<160?i:Pt)],r>>4){case 2:for(let m=a+1;;++m){if(m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(n=c[l](this._params),n!==!0);l--)if(n instanceof Promise)return this._preserveStack(3,c,l,r,a),n;l<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++a<t&&(i=e[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let h=this._escHandlers[this._collect<<8|i],d=h?h.length-1:-1;for(;d>=0&&(n=h[d](),n!==!0);d--)if(n instanceof Promise)return this._preserveStack(4,h,d,r,a),n;d<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let m=a+1;;++m)if(m>=t||(i=e[m])===24||i===26||i===27||i>127&&i<Pt){this._dcsParser.put(e,a,m),a=m-1;break}break;case 14:if(n=this._dcsParser.unhook(i!==24&&i!==26),n)return this._preserveStack(6,[],0,r,a),n;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=a+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<Pt){this._oscParser.put(e,a,m),a=m-1;break}break;case 6:if(n=this._oscParser.end(i!==24&&i!==26),n)return this._preserveStack(5,[],0,r,a),n;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},L0=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,D0=/^[\da-f]+$/;M0={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Us=131072,lu=10;hu=5e3,du=0,B0=class extends ie{constructor(e,t,s,i,r,o,n,a,c=new R0){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=n,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new $_,this._utf8Decoder=new E_,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Te.clone(),this._eraseAttrDataInternal=Te.clone(),this._onRequestBell=this._register(new z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new z),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 tc(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:h.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:h,data:d})}),this._parser.setDcsHandlerFallback((l,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:h,payload:d})}),this._parser.setPrintHandler((l,h,d)=>this.print(l,h,d)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler(B.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.HT,()=>this.tab()),this._parser.setExecuteHandler(B.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.SI,()=>this.shiftIn()),this._parser.setExecuteHandler($n.IND,()=>this.index()),this._parser.setExecuteHandler($n.NEL,()=>this.nextLine()),this._parser.setExecuteHandler($n.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ct(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new Ct(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new Ct(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new Ct(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new Ct(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new Ct(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new Ct(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new Ct(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new Ct(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new Ct(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new Ct(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new Ct(l=>this.restoreCursorColor(l))),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 l in Oe)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nu((l,h)=>this.requestStatusString(l,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),hu))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${hu} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,n=this._parseStack.paused;if(n){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Us&&(o=this._parseStack.position+Us)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(l=>l.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Us&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Us))),n||this._dirtyRowTracker.clearRange(),e.length>Us)for(let l=o;l<e.length;l+=Us){let h=l+Us<e.length?l+Us:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(l,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(l,h),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,r,d,l),this._logSlowResolvingAsync(s),s}else if(!n){let l=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,l))return this._preserveStack(i,r,l,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,s){let i,r,o=this._charsetService.charset,n=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,h=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let m=this._parser.precedingJoinState;for(let p=t;p<s;++p){if(i=e[p],i<127&&o){let $=o[String.fromCharCode(i)];$&&(i=$.charCodeAt(0))}let f=this._unicodeService.charProperties(i,m);r=wi.extractWidth(f);let _=wi.extractShouldJoin(f),S=_?wi.extractWidth(m):0;if(m=f,n&&this._onA11yChar.fire(qs(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-S>a){if(c){let $=d,x=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&d instanceof so&&d.copyCellsFrom($,x,0,S,!1);x<a;)$.setCellFromCodepoint(x++,0,1,h)}else if(this._activeBuffer.x=a-1,r===2)continue}if(_&&this._activeBuffer.x){let $=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-$,i,r);for(let x=r-S;--x>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(l&&(d.insertCells(this._activeBuffer.x,r-S,this._activeBuffer.getNullCell(h)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,i,r,h),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=m,this._activeBuffer.x<a&&s-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>cu(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new nu(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ct(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,s,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Te));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,i=wi.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),n=new Uint32Array(o.length*s),a=0;for(let l=0;l<o.length;){let h=o.codePointAt(l)||0;n[a++]=h,l+=h>65535?2:1}let c=a;for(let l=1;l<s;++l)n.copyWithin(c,0,a),c+=a;return this.print(n,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,yi),this._charsetService.setgCharset(1,yi),this._charsetService.setgCharset(2,yi),this._charsetService.setgCharset(3,yi);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(s={}));let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,n=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:l,alt:h}=a,d=this._optionsService.rawOptions,m=(_,S)=>(n.triggerDataEvent(`${B.ESC}[${t?"":"?"}${_};${S}$y`),!0),p=_=>_?1:2,f=e.params[0];return t?f===2?m(f,4):f===4?m(f,p(n.modes.insertMode)):f===12?m(f,3):f===20?m(f,p(d.convertEol)):m(f,0):f===1?m(f,p(i.applicationCursorKeys)):f===3?m(f,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):f===6?m(f,p(i.origin)):f===7?m(f,p(i.wraparound)):f===8?m(f,3):f===9?m(f,p(r==="X10")):f===12?m(f,p(d.cursorBlink)):f===25?m(f,p(!n.isCursorHidden)):f===45?m(f,p(i.reverseWraparound)):f===66?m(f,p(i.applicationKeypad)):f===67?m(f,4):f===1e3?m(f,p(r==="VT200")):f===1002?m(f,p(r==="DRAG")):f===1003?m(f,p(r==="ANY")):f===1004?m(f,p(i.sendFocus)):f===1005?m(f,4):f===1006?m(f,p(o==="SGR")):f===1015?m(f,4):f===1016?m(f,p(o==="SGR_PIXELS")):f===1048?m(f,1):f===47||f===1047||f===1049?m(f,p(l===h)):f===2004?m(f,p(i.bracketedPasteMode)):f===2026?m(f,p(i.synchronizedOutput)):m(f,0)}_updateAttrColor(e,t,s,i,r){return t===2?(e|=50331648,e&=-16777216,e|=uo.fromColorRGB([s,i,r])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let n=e.getSubParams(t+o),a=0;do i[1]===5&&(r=1),i[o+a+1+r]=n[a];while(++a<n.length&&a+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let n=2;n<i.length;++n)i[n]===-1&&(i[n]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Te.fg,e.bg=Te.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,s,i=this._curAttrData;for(let r=0;r<t;r++)s=e.params[r],s>=30&&s<=37?(i.fg&=-50331904,i.fg|=16777216|s-30):s>=40&&s<=47?(i.bg&=-50331904,i.bg|=16777216|s-40):s>=90&&s<=97?(i.fg&=-50331904,i.fg|=16777216|s-90|8):s>=100&&s<=107?(i.bg&=-50331904,i.bg|=16777216|s-100|8):s===0?this._processSGR0(i):s===1?i.fg|=134217728:s===3?i.bg|=67108864:s===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):s===5?i.fg|=536870912:s===7?i.fg|=67108864:s===8?i.fg|=1073741824:s===9?i.fg|=2147483648:s===2?i.bg|=134217728:s===21?this._processUnderline(2,i):s===22?(i.fg&=-134217729,i.bg&=-134217729):s===23?i.bg&=-67108865:s===24?(i.fg&=-268435457,this._processUnderline(0,i)):s===25?i.fg&=-536870913:s===27?i.fg&=-67108865:s===28?i.fg&=-1073741825:s===29?i.fg&=2147483647:s===39?(i.fg&=-67108864,i.fg|=Te.fg&16777215):s===49?(i.bg&=-67108864,i.bg|=Te.bg&16777215):s===38||s===48||s===58?r+=this._extractColor(e,r,i):s===53?i.bg|=1073741824:s===55?i.bg&=-1073741825:s===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):s===100?(i.fg&=-67108864,i.fg|=Te.fg&16777215,i.bg&=-67108864,i.bg|=Te.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${B.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[?${t};${s}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=Te.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 s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!cu(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(`${B.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>lu&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>lu&&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=[],s=e.split(";");for(;s.length>1;){let i=s.shift(),r=s.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(uu(o))if(r==="?")t.push({type:0,index:o});else{let n=au(r);n&&t.push({type:1,index:o,color:n})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(s,i):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),i,r=s.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=s[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 s=e.split(";");for(let i=0;i<s.length&&!(t>=this._specialColors.length);++i,++t)if(s[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=au(s[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],s=e.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let r=parseInt(s[i]);uu(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,yi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(M0[e[0]],Oe[e[1]]||yi),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){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=Te.clone(),this._eraseAttrDataInternal=Te.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 Mt;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._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=n=>(this._coreService.triggerDataEvent(`${B.ESC}${n}${B.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},tc=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(du=e,e=t,t=du),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};tc=xe([F(0,lt)],tc);O0=5e7,pu=12,I0=50,z0=class extends ie{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 z),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 s;for(;s=this._writeBuffer.shift();){this._action(s);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>O0)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let n=a=>performance.now()-s>=pu?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(s,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(n);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=pu)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>I0&&(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()}},sc=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 a=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.id}let s=e,i=this._getEntryIdKey(s),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),n={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(n,o)),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);s.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(s,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};sc=xe([F(0,lt)],sc);fu=!1,N0=class extends ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new er),this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onData=this._register(new z),this.onData=this._onData.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new z),this._instantiationService=new l0,this.optionsService=this._register(new b0(e)),this._instantiationService.setService(ct,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Jl)),this._instantiationService.setService(lt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Xl)),this._instantiationService.setService(Eu,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Zl)),this._instantiationService.setService(ki,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ql)),this._instantiationService.setService($u,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(wi)),this._instantiationService.setService(L_,this.unicodeService),this._charsetService=this._instantiationService.createInstance(x0),this._instantiationService.setService(R_,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sc),this._instantiationService.setService(Tu,this._oscLinkService),this._inputHandler=this._register(new B0(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ze.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ze.forward(this._bufferService.onResize,this._onResize)),this._register(Ze.forward(this.coreService.onData,this._onData)),this._register(Ze.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 z0((t,s)=>this._inputHandler.parse(t,s))),this._register(Ze.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new z),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&&!fu&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fu=!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,mp),t=Math.max(t,gp),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(ou.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ou(this._bufferService),!1))),this._windowsWrappingHeuristics.value=_e(()=>{for(let t of e)t.dispose()})}}},F0={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:["'",'"']};$e=0,W0=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new On,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new On,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((r,o)=>this._getKey(r)-this._getKey(o)),t=0,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(i[r]=e[t],t++):i[r]=this._array[s++];this._array=i,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||($e=this._search(t),$e===-1)||this._getKey(this._array[$e])!==t)return!1;do if(this._array[$e]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push($e),!0;while(++$e<this._array.length&&this._getKey(this._array[$e])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,s=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:s[i++]=this._array[r];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&($e=this._search(e),!($e<0||$e>=this._array.length)&&this._getKey(this._array[$e])===e))do yield this._array[$e];while(++$e<this._array.length&&this._getKey(this._array[$e])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&($e=this._search(e),!($e<0||$e>=this._array.length)&&this._getKey(this._array[$e])===e))do t(this._array[$e]);while(++$e<this._array.length&&this._getKey(this._array[$e])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let i=t+s>>1,r=this._getKey(this._array[i]);if(r>e)s=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},bl=0,mu=0,j0=class extends ie{constructor(){super(),this._decorations=new W0(e=>e?.marker.line),this._onDecorationRegistered=this._register(new z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(_e(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new V0(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.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,s){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!s||(o.options.layer??"bottom")===s)&&(yield o)}forEachDecorationAtCell(e,t,s,i){this._decorations.forEachByKey(t,r=>{bl=r.options.x??0,mu=bl+(r.options.width??1),e>=bl&&e<mu&&(!s||(r.options.layer??"bottom")===s)&&i(r)})}},V0=class extends Gs{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Se.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Se.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},U0=1e3,q0=class{constructor(e,t=U0){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,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;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},gu=20,_u=!1,In=class extends ie{constructor(e,t,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new q0(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");_u?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
33
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),uc&&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),s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i||!t?!1:this._areCoordsInSelection(t,s,i)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!s||!i?!1:this._areCoordsInSelection([e,t],s,i)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=Kd(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,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=dc(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-ul),ul),t/=ul,t/Math.abs(t)+Math.round(t*(t0-1)))}shouldForceSelection(e){return Pn?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(),s0)}_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&&!(Pn&&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]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let i=s.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<i0&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let i=Kb(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:r>1&&t!==i&&(s+=r-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let n=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e[0]),c=a,l=e[0]-a,h=0,d=0,m=0,p=0;if(n.charAt(a)===" "){for(;a>0&&n.charAt(a-1)===" ";)a--;for(;c<n.length&&n.charAt(c+1)===" ";)c++}else{let S=e[0],k=e[0];o.getWidth(S)===0&&(h++,S--),o.getWidth(k)===2&&(d++,k++);let x=o.getString(k).length;for(x>1&&(p+=x-1,c+=x-1);S>0&&a>0&&!this._isCharWordSeparator(o.loadCell(S-1,this._workCell));){o.loadCell(S-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(h++,S--):v>1&&(m+=v-1,a-=v-1),a--,S--}for(;k<o.length&&c+1<n.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,k++):v>1&&(p+=v-1,c+=v-1),c++,k++}}c++;let f=a+l-h+m,_=Math.min(this._bufferService.cols,c-a+h+d-m-p);if(!(!t&&n.slice(a,c).trim()==="")){if(s&&f===0&&o.getCodePoint(0)!==32){let S=r.lines.get(e[1]-1);if(S&&o.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let x=this._bufferService.cols-k.start;f-=x,_+=x}}}if(i&&f+_===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let S=r.lines.get(e[1]+1);if(S?.isWrapped&&S.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(_+=k.length)}}return{start:f,length:_}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=Kd(s,this._bufferService.cols)}};Kl=xe([F(3,lt),F(4,ki),F(5,rc),F(6,ct),F(7,$s),F(8,ks)],Kl);Gd=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Yd=class{constructor(){this._color=new Gd,this._css=new Gd}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Me=Object.freeze((()=>{let e=[Se.toColor("#2e3436"),Se.toColor("#cc0000"),Se.toColor("#4e9a06"),Se.toColor("#c4a000"),Se.toColor("#3465a4"),Se.toColor("#75507b"),Se.toColor("#06989a"),Se.toColor("#d3d7cf"),Se.toColor("#555753"),Se.toColor("#ef2929"),Se.toColor("#8ae234"),Se.toColor("#fce94f"),Se.toColor("#729fcf"),Se.toColor("#ad7fa8"),Se.toColor("#34e2e2"),Se.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let i=t[s/36%6|0],r=t[s/6%6|0],o=t[s%6];e.push({css:Ae.toCss(i,r,o),rgba:Ae.toRgba(i,r,o)})}for(let s=0;s<24;s++){let i=8+s*10;e.push({css:Ae.toCss(i,i,i),rgba:Ae.toRgba(i,i,i)})}return e})()),bi=Se.toColor("#ffffff"),eo=Se.toColor("#000000"),Xd=Se.toColor("#ffffff"),Jd=eo,Gr={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},n0=bi,Gl=class extends ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yd,this._halfContrastCache=new Yd,this._onChangeColors=this._register(new z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:bi,background:eo,cursor:Xd,cursorAccent:Jd,selectionForeground:void 0,selectionBackgroundTransparent:Gr,selectionBackgroundOpaque:ge.blend(eo,Gr),selectionInactiveBackgroundTransparent:Gr,selectionInactiveBackgroundOpaque:ge.blend(eo,Gr),scrollbarSliderBackground:ge.opacity(bi,.2),scrollbarSliderHoverBackground:ge.opacity(bi,.4),scrollbarSliderActiveBackground:ge.opacity(bi,.5),overviewRulerBorder:bi,ansi:Me.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=fe(e.foreground,bi),t.background=fe(e.background,eo),t.cursor=ge.blend(t.background,fe(e.cursor,Xd)),t.cursorAccent=ge.blend(t.background,fe(e.cursorAccent,Jd)),t.selectionBackgroundTransparent=fe(e.selectionBackground,Gr),t.selectionBackgroundOpaque=ge.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=fe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ge.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?fe(e.selectionForeground,Vd):void 0,t.selectionForeground===Vd&&(t.selectionForeground=void 0),ge.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ge.opacity(t.selectionBackgroundTransparent,.3)),ge.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ge.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=fe(e.scrollbarSliderBackground,ge.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=fe(e.scrollbarSliderHoverBackground,ge.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=fe(e.scrollbarSliderActiveBackground,ge.opacity(t.foreground,.5)),t.overviewRulerBorder=fe(e.overviewRulerBorder,n0),t.ansi=Me.slice(),t.ansi[0]=fe(e.black,Me[0]),t.ansi[1]=fe(e.red,Me[1]),t.ansi[2]=fe(e.green,Me[2]),t.ansi[3]=fe(e.yellow,Me[3]),t.ansi[4]=fe(e.blue,Me[4]),t.ansi[5]=fe(e.magenta,Me[5]),t.ansi[6]=fe(e.cyan,Me[6]),t.ansi[7]=fe(e.white,Me[7]),t.ansi[8]=fe(e.brightBlack,Me[8]),t.ansi[9]=fe(e.brightRed,Me[9]),t.ansi[10]=fe(e.brightGreen,Me[10]),t.ansi[11]=fe(e.brightYellow,Me[11]),t.ansi[12]=fe(e.brightBlue,Me[12]),t.ansi[13]=fe(e.brightMagenta,Me[13]),t.ansi[14]=fe(e.brightCyan,Me[14]),t.ansi[15]=fe(e.brightWhite,Me[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<s;i++)t.ansi[i+16]=fe(e.extendedAnsi[i],Me[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Gl=xe([F(0,ct)],Gl);a0=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},l0=class{constructor(){this._services=new a0,this._services.set(ic,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=T_(e).sort((o,n)=>o.index-n.index),i=[];for(let o of s){let n=this._services.get(o.id);if(!n)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(n)}let r=s.length>0?s[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},c0={trace:0,debug:1,info:2,warn:3,error:4,off:5},h0="xterm.js: ",Yl=class extends ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),d0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=c0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":h0)+t,...s)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Yl=xe([F(0,ct)],Yl);Zd=class extends ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new z),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...s){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let i=this._length+s.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let r=t-1;r>=0;r--)this.set(e+r+s,this.get(e+r));let i=e+t+s-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+s,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},oe=3,Te=Object.freeze(new ho),gn=0,pl=2,to=class up{constructor(t,s,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*oe);let r=s||Mt.fromCharData([0,Su,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let s=this._data[t*oe+0],i=s&2097151;return[this._data[t*oe+1],s&2097152?this._combined[t]:i?qs(i):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,s){this._data[t*oe+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*oe+0]=t|2097152|s[2]<<22):this._data[t*oe+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*oe+0]>>22}hasWidth(t){return this._data[t*oe+0]&12582912}getFg(t){return this._data[t*oe+1]}getBg(t){return this._data[t*oe+2]}hasContent(t){return this._data[t*oe+0]&4194303}getCodePoint(t){let s=this._data[t*oe+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*oe+0]&2097152}getString(t){let s=this._data[t*oe+0];return s&2097152?this._combined[t]:s&2097151?qs(s&2097151):""}isProtected(t){return this._data[t*oe+2]&536870912}loadCell(t,s){return gn=t*oe,s.content=this._data[gn+0],s.fg=this._data[gn+1],s.bg=this._data[gn+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*oe+0]=s.content,this._data[t*oe+1]=s.fg,this._data[t*oe+2]=s.bg}setCellFromCodepoint(t,s,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*oe+0]=s|i<<22,this._data[t*oe+1]=r.fg,this._data[t*oe+2]=r.bg}addCodepointToCell(t,s,i){let r=this._data[t*oe+0];r&2097152?this._combined[t]+=qs(s):r&2097151?(this._combined[t]=qs(r&2097151)+qs(s),r&=-2097152,r|=2097152):r=s|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*oe+0]=r}insertCells(t,s,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length-t){let r=new Mt;for(let o=this.length-t-s-1;o>=0;--o)this.setCell(t+s+o,this.loadCell(t+o,r));for(let o=0;o<s;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,s,i){if(t%=this.length,s<this.length-t){let r=new Mt;for(let o=0;o<this.length-t-s;++o)this.setCell(t+o,this.loadCell(t+s+o,r));for(let o=this.length-s;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,s,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,i);t<s&&t<this.length;)this.setCell(t++,i)}resize(t,s){if(t===this.length)return this._data.length*4*pl<this._data.buffer.byteLength;let i=t*oe;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,s)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let n=0;n<r.length;n++){let a=parseInt(r[n],10);a>=t&&delete this._combined[a]}let o=Object.keys(this._extendedAttrs);for(let n=0;n<o.length;n++){let a=parseInt(o[n],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,i*4*pl<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*pl<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new up(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*oe+0]&4194303)return t+(this._data[t*oe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*oe+0]&4194303||this._data[t*oe+2]&50331648)return t+(this._data[t*oe+0]>>22);return 0}copyCellsFrom(t,s,i,r,o){let n=t._data;if(o)for(let c=r-1;c>=0;c--){for(let l=0;l<oe;l++)this._data[(i+c)*oe+l]=n[(s+c)*oe+l];n[(s+c)*oe+2]&268435456&&(this._extendedAttrs[i+c]=t._extendedAttrs[s+c])}else for(let c=0;c<r;c++){for(let l=0;l<oe;l++)this._data[(i+c)*oe+l]=n[(s+c)*oe+l];n[(s+c)*oe+2]&268435456&&(this._extendedAttrs[i+c]=t._extendedAttrs[s+c])}let a=Object.keys(t._combined);for(let c=0;c<a.length;c++){let l=parseInt(a[c],10);l>=s&&(this._combined[l-s+i]=t._combined[l])}}translateToString(t,s,i,r){s=s??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;s<i;){let n=this._data[s*oe+0],a=n&2097151,c=n&2097152?this._combined[s]:a?qs(a):Ks;if(o+=c,r)for(let l=0;l<c.length;++l)r.push(s);s+=n>>22||1}return r&&r.push(s),o}};pp=class fp{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=fp._nextId++,this._onDispose=this.register(new z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ci(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};pp._nextId=1;g0=pp,Oe={},yi=Oe.B;Oe[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"};Oe.A={"#":"\xA3"};Oe.B=void 0;Oe[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"};Oe.C=Oe[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};Oe.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"};Oe.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"};Oe.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"};Oe.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"};Oe.E=Oe[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"};Oe.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"};Oe.H=Oe[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"};Oe["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"};Qd=4294967295,eu=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Te.clone(),this.savedCharset=yi,this.markers=[],this._nullCell=Mt.fromCharData([0,Su,1,0]),this._whitespaceCell=Mt.fromCharData([0,Ks,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Mn,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Zd(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 En),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 En),this._whitespaceCell}getBlankLine(e,t){return new to(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&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Qd?Qd:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Te);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 Zd(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(Te),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let n=0;n<this.lines.length;n++)i+=+this.lines.get(n).resize(e,s);let o=0;if(this._rows<t)for(let n=this._rows;n<t;n++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new to(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new to(e,s)));else for(let n=this._rows;n>t;n--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let n=this.lines.length-r;n>0&&(this.lines.trimStart(n),this.ybase=Math.max(this.ybase-n,0),this.ydisp=Math.max(this.ydisp-n,0),this.savedY=Math.max(this.savedY-n,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,s);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.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._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)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 s=this._optionsService.rawOptions.reflowCursorLine,i=u0(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Te),s);if(i.length>0){let r=p0(this.lines,i);f0(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let i=this.getNullCell(Te),r=s;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new to(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Te),r=[],o=0;for(let n=this.lines.length-1;n>=0;n--){let a=this.lines.get(n);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let c=[a];for(;a.isWrapped&&n>0;)a=this.lines.get(--n),c.unshift(a);if(!s){let v=this.ybase+this.y;if(v>=n&&v<n+c.length)continue}let l=c[c.length-1].getTrimmedLength(),h=m0(c,this._cols,e),d=h.length-c.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+d):m=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let v=0;v<d;v++){let y=this.getBlankLine(Te,!0);p.push(y)}p.length>0&&(r.push({start:n+c.length+o,newLines:p}),o+=p.length),c.push(...p);let f=h.length-1,_=h[f];_===0&&(f--,_=h[f]);let S=c.length-d-1,k=l;for(;S>=0;){let v=Math.min(k,_);if(c[f]===void 0)break;if(c[f].copyCellsFrom(c[S],k-v,_-v,v,!0),_-=v,_===0&&(f--,_=h[f]),k-=v,k===0){S--;let y=Math.max(S,0);k=co(c,y,this._cols)}}for(let v=0;v<c.length;v++)h[v]<e&&c[v].setCell(h[v],i);let x=d-m;for(;x-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(r.length>0){let n=[],a=[];for(let _=0;_<this.lines.length;_++)a.push(this.lines.get(_));let c=this.lines.length,l=c-1,h=0,d=r[h];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let m=0;for(let _=Math.min(this.lines.maxLength-1,c+o-1);_>=0;_--)if(d&&d.start>l+m){for(let S=d.newLines.length-1;S>=0;S--)this.lines.set(_--,d.newLines[S]);_++,n.push({index:l+1,amount:d.newLines.length}),m+=d.newLines.length,d=r[++h]}else this.lines.set(_,a[l--]);let p=0;for(let _=n.length-1;_>=0;_--)n[_].index+=p,this.lines.onInsertEmitter.fire(n[_]),p+=n[_].amount;let f=Math.max(0,c+o-this.lines.maxLength);f>0&&this.lines.onTrimEmitter.fire(f)}}translateBufferLineToString(e,t,s=0,i){let r=this.lines.get(e);return r?r.translateToString(t,s,i):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);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;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new g0(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},_0=class extends ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new z),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 eu(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new eu(!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)}},mp=2,gp=1,Xl=class extends ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,mp),this.rows=Math.max(e.rawOptions.rows||0,gp),this.buffers=this._register(new _0(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:s,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=s.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(s.scrollTop===0){let n=s.lines.isFull;o===s.lines.length-1?n?s.lines.recycle().copyFrom(i):s.lines.push(i.clone()):s.lines.splice(o+1,0,i.clone()),n?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let n=o-r+1;s.lines.shiftElements(r+1,n-1,-1),s.lines.set(o,i.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let i=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),i!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};Xl=xe([F(0,ct)],Xl);Zi={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:Pn,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},v0=["normal","bold","100","200","300","400","500","600","700","800","900"],b0=class extends ie{constructor(e){super(),this._onOptionChange=this._register(new z),this.onOptionChange=this._onOptionChange.event;let t={...Zi};for(let s in e)if(s in t)try{let i=e[s];t[s]=this._sanitizeAndValidateOption(s,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(_e(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Zi))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,i)=>{if(!(s in Zi))throw new Error(`No option with key "${s}"`);i=this._sanitizeAndValidateOption(s,i),this.rawOptions[s]!==i&&(this.rawOptions[s]=i,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let i={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Zi[e]),!y0(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Zi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=v0.includes(t)?t:Zi[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}};tu=Object.freeze({insertMode:!1}),su=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Jl=class extends ie{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new z),this.onData=this._onData.event,this._onUserInput=this._register(new z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=so(tu),this.decPrivateModes=so(su)}reset(){this.modes=so(tu),this.decPrivateModes=so(su)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.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))}};Jl=xe([F(0,lt),F(1,Eu),F(2,ct)],Jl);iu={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}};ml=String.fromCharCode,ru={DEFAULT:e=>{let t=[fl(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ml(t[0])}${ml(t[1])}${ml(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${fl(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${fl(e,!0)};${e.x};${e.y}${t}`}},Zl=class extends ie{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new z),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(iu))this.addProtocol(i,iu[i]);for(let i of Object.keys(ru))this.addEncoding(i,ru[i]);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,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let i=t/s,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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,s){if(s){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)}};Zl=xe([F(0,lt),F(1,ki),F(2,ct)],Zl);gl=[[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]],w0=[[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]];C0=class{constructor(){if(this.version="6",!Be){Be=new Uint8Array(65536),Be.fill(1),Be[0]=0,Be.fill(0,1,32),Be.fill(0,127,160),Be.fill(2,4352,4448),Be[9001]=2,Be[9002]=2,Be.fill(2,11904,42192),Be[12351]=1,Be.fill(2,44032,55204),Be.fill(2,63744,64256),Be.fill(2,65040,65050),Be.fill(2,65072,65136),Be.fill(2,65280,65377),Be.fill(2,65504,65511);for(let e=0;e<gl.length;++e)Be.fill(0,gl[e][0],gl[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Be[e]:S0(e,w0)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),i=s===0&&t!==0;if(i){let r=wi.extractWidth(t);r===0?i=!1:r>s&&(s=r)}return wi.createPropertyValue(0,s,i)}},wi=class $n{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new z,this.onChange=this._onChange.event;let t=new C0;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,s,i=!1){return(t&16777215)<<3|(s&3)<<1|(i?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 s=0,i=0,r=t.length;for(let o=0;o<r;++o){let n=t.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=r)return s+this.wcwidth(n);let l=t.charCodeAt(o);56320<=l&&l<=57343?n=(n-55296)*1024+l-56320+65536:s+=this.wcwidth(l)}let a=this.charProperties(n,i),c=$n.extractWidth(a);$n.extractShouldJoin(a)&&(c-=$n.extractWidth(i)),s+=c,i=a}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},x0=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)}};Yr=2147483647,k0=256,_p=class Ql{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>k0)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new Ql;if(!t.length)return s;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)s.addSubParam(r[o]);else s.addParam(r)}return s}clone(){let t=new Ql(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let s=0;s<this.length;++s){t.push(this.params[s]);let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}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>Yr?Yr: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>Yr?Yr:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-s>0?this._subParams.subarray(s,i):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let i=this._subParamsIdx[s]>>8,r=this._subParamsIdx[s]&255;r-i>0&&(t[s]=this._subParams.slice(i,r))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[s-1];i[s-1]=~r?Math.min(r*10+t,Yr):t}},Xr=[],$0=class{constructor(){this._state=0,this._active=Xr,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,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=Xr}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=Xr,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Xr,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",On(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&s-t>0&&this._put(e,t,s)}}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 s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].end(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Xr,this._id=-1,this._state=0}}},Ct=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=On(e,t,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Jr=[],E0=class{constructor(){this._handlers=Object.create(null),this._active=Jr,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Jr}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let i=s.indexOf(t);i!==-1&&s.splice(i,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=Jr,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Jr,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",On(e,t,s));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,s=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;i>=0&&(s=this._active[i].unhook(e),s!==!0);i--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,s;i--}for(;i>=0;i--)if(s=this._active[i].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,s}this._active=Jr,this._ident=0}},io=new _p;io.addParam(0);nu=class{constructor(e){this._handler=e,this._data="",this._params=io,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():io,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=On(e,t,s),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(s=>(this._params=io,this._data="",this._hitLimit=!1,s));return this._params=io,this._data="",this._hitLimit=!1,t}},T0=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,i){this.table[t<<8|e]=s<<4|i}addMany(e,t,s,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=s<<4|i}},Pt=160,A0=(function(){let e=new T0(4095),t=Array.apply(null,Array(256)).map((a,c)=>c),s=(a,c)=>t.slice(a,c),i=s(32,127),r=s(0,24);r.push(25),r.push.apply(r,s(28,32));let o=s(0,14),n;e.setDefault(1,0),e.addMany(i,0,2,0);for(n in o)e.addMany([24,26,153,154],n,3,0),e.addMany(s(128,144),n,3,0),e.addMany(s(144,152),n,3,0),e.add(156,n,0,0),e.add(27,n,11,1),e.add(157,n,4,8),e.addMany([152,158,159],n,0,7),e.add(155,n,11,3),e.add(144,n,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Pt,0,2,0),e.add(Pt,8,5,8),e.add(Pt,6,0,6),e.add(Pt,11,0,11),e.add(Pt,13,13,13),e})(),R0=class extends ie{constructor(e=A0){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 _p,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(_e(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new $0),this._dcsParser=this._register(new E0),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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 r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=i,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let i=this._escHandlers[s];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let i=this._csiHandlers[s];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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,s,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,s){let i=0,r=0,o=0,n;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,c=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&c>-1){for(;c>=0&&(n=a[c](this._params),n!==!0);c--)if(n instanceof Promise)return this._parseStack.handlerPos=c,n}this._parseStack.handlers=[];break;case 4:if(s===!1&&c>-1){for(;c>=0&&(n=a[c](),n!==!0);c--)if(n instanceof Promise)return this._parseStack.handlerPos=c,n}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(i!==24&&i!==26,s),n)return n;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],n=this._oscParser.end(i!==24&&i!==26,s),n)return n;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=o;a<t;++a){switch(i=e[a],r=this._transitions.table[this.currentState<<8|(i<160?i:Pt)],r>>4){case 2:for(let m=a+1;;++m){if(m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}if(++m>=t||(i=e[m])<32||i>126&&i<Pt){this._printHandler(e,a,m),a=m-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let c=this._csiHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(n=c[l](this._params),n!==!0);l--)if(n instanceof Promise)return this._preserveStack(3,c,l,r,a),n;l<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++a<t&&(i=e[a])>47&&i<60);a--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let h=this._escHandlers[this._collect<<8|i],d=h?h.length-1:-1;for(;d>=0&&(n=h[d](),n!==!0);d--)if(n instanceof Promise)return this._preserveStack(4,h,d,r,a),n;d<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let m=a+1;;++m)if(m>=t||(i=e[m])===24||i===26||i===27||i>127&&i<Pt){this._dcsParser.put(e,a,m),a=m-1;break}break;case 14:if(n=this._dcsParser.unhook(i!==24&&i!==26),n)return this._preserveStack(6,[],0,r,a),n;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=a+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<Pt){this._oscParser.put(e,a,m),a=m-1;break}break;case 6:if(n=this._oscParser.end(i!==24&&i!==26),n)return this._preserveStack(5,[],0,r,a),n;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},L0=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,D0=/^[\da-f]+$/;M0={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Us=131072,lu=10;hu=5e3,du=0,B0=class extends ie{constructor(e,t,s,i,r,o,n,a,c=new R0){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=n,this._unicodeService=a,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new $_,this._utf8Decoder=new E_,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Te.clone(),this._eraseAttrDataInternal=Te.clone(),this._onRequestBell=this._register(new z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new z),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 ec(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,h)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:h.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,h,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:h,data:d})}),this._parser.setDcsHandlerFallback((l,h,d)=>{h==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:h,payload:d})}),this._parser.setPrintHandler((l,h,d)=>this.print(l,h,d)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler(B.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.HT,()=>this.tab()),this._parser.setExecuteHandler(B.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(xn.IND,()=>this.index()),this._parser.setExecuteHandler(xn.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(xn.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ct(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new Ct(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new Ct(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new Ct(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new Ct(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new Ct(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new Ct(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new Ct(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new Ct(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new Ct(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new Ct(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new Ct(l=>this.restoreCursorColor(l))),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 l in Oe)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nu((l,h)=>this.requestStatusString(l,h)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),hu))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${hu} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,n=this._parseStack.paused;if(n){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Us&&(o=this._parseStack.position+Us)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(l=>l.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Us&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Us))),n||this._dirtyRowTracker.clearRange(),e.length>Us)for(let l=o;l<e.length;l+=Us){let h=l+Us<e.length?l+Us:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(l,h),this._parseBuffer):this._utf8Decoder.decode(e.subarray(l,h),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,r,d,l),this._logSlowResolvingAsync(s),s}else if(!n){let l=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,l))return this._preserveStack(i,r,l,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,s){let i,r,o=this._charsetService.charset,n=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,h=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let m=this._parser.precedingJoinState;for(let p=t;p<s;++p){if(i=e[p],i<127&&o){let k=o[String.fromCharCode(i)];k&&(i=k.charCodeAt(0))}let f=this._unicodeService.charProperties(i,m);r=wi.extractWidth(f);let _=wi.extractShouldJoin(f),S=_?wi.extractWidth(m):0;if(m=f,n&&this._onA11yChar.fire(qs(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-S>a){if(c){let k=d,x=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&d instanceof to&&d.copyCellsFrom(k,x,0,S,!1);x<a;)k.setCellFromCodepoint(x++,0,1,h)}else if(this._activeBuffer.x=a-1,r===2)continue}if(_&&this._activeBuffer.x){let k=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-k,i,r);for(let x=r-S;--x>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(l&&(d.insertCells(this._activeBuffer.x,r-S,this._activeBuffer.getNullCell(h)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,h)),d.setCellFromCodepoint(this._activeBuffer.x++,i,r,h),r>0)for(;--r;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=m,this._activeBuffer.x<a&&s-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,s=>cu(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new nu(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ct(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,s,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,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.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Te));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let s=e.params[0]||1,i=wi.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),n=new Uint32Array(o.length*s),a=0;for(let l=0;l<o.length;){let h=o.codePointAt(l)||0;n[a++]=h,l+=h>65535?2:1}let c=a;for(let l=1;l<s;++l)n.copyWithin(c,0,a),c+=a;return this.print(n,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,yi),this._charsetService.setgCharset(1,yi),this._charsetService.setgCharset(2,yi),this._charsetService.setgCharset(3,yi);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(s={}));let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,n=this._coreService,{buffers:a,cols:c}=this._bufferService,{active:l,alt:h}=a,d=this._optionsService.rawOptions,m=(_,S)=>(n.triggerDataEvent(`${B.ESC}[${t?"":"?"}${_};${S}$y`),!0),p=_=>_?1:2,f=e.params[0];return t?f===2?m(f,4):f===4?m(f,p(n.modes.insertMode)):f===12?m(f,3):f===20?m(f,p(d.convertEol)):m(f,0):f===1?m(f,p(i.applicationCursorKeys)):f===3?m(f,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):f===6?m(f,p(i.origin)):f===7?m(f,p(i.wraparound)):f===8?m(f,3):f===9?m(f,p(r==="X10")):f===12?m(f,p(d.cursorBlink)):f===25?m(f,p(!n.isCursorHidden)):f===45?m(f,p(i.reverseWraparound)):f===66?m(f,p(i.applicationKeypad)):f===67?m(f,4):f===1e3?m(f,p(r==="VT200")):f===1002?m(f,p(r==="DRAG")):f===1003?m(f,p(r==="ANY")):f===1004?m(f,p(i.sendFocus)):f===1005?m(f,4):f===1006?m(f,p(o==="SGR")):f===1015?m(f,4):f===1016?m(f,p(o==="SGR_PIXELS")):f===1048?m(f,1):f===47||f===1047||f===1049?m(f,p(l===h)):f===2004?m(f,p(i.bracketedPasteMode)):f===2026?m(f,p(i.synchronizedOutput)):m(f,0)}_updateAttrColor(e,t,s,i,r){return t===2?(e|=50331648,e&=-16777216,e|=ho.fromColorRGB([s,i,r])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let n=e.getSubParams(t+o),a=0;do i[1]===5&&(r=1),i[o+a+1+r]=n[a];while(++a<n.length&&a+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let n=2;n<i.length;++n)i[n]===-1&&(i[n]=0);switch(i[0]){case 38:s.fg=this._updateAttrColor(s.fg,i[1],i[3],i[4],i[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,i[1],i[3],i[4],i[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Te.fg,e.bg=Te.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,s,i=this._curAttrData;for(let r=0;r<t;r++)s=e.params[r],s>=30&&s<=37?(i.fg&=-50331904,i.fg|=16777216|s-30):s>=40&&s<=47?(i.bg&=-50331904,i.bg|=16777216|s-40):s>=90&&s<=97?(i.fg&=-50331904,i.fg|=16777216|s-90|8):s>=100&&s<=107?(i.bg&=-50331904,i.bg|=16777216|s-100|8):s===0?this._processSGR0(i):s===1?i.fg|=134217728:s===3?i.bg|=67108864:s===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):s===5?i.fg|=536870912:s===7?i.fg|=67108864:s===8?i.fg|=1073741824:s===9?i.fg|=2147483648:s===2?i.bg|=134217728:s===21?this._processUnderline(2,i):s===22?(i.fg&=-134217729,i.bg&=-134217729):s===23?i.bg&=-67108865:s===24?(i.fg&=-268435457,this._processUnderline(0,i)):s===25?i.fg&=-536870913:s===27?i.fg&=-67108865:s===28?i.fg&=-1073741825:s===29?i.fg&=2147483647:s===39?(i.fg&=-67108864,i.fg|=Te.fg&16777215):s===49?(i.bg&=-67108864,i.bg|=Te.bg&16777215):s===38||s===48||s===58?r+=this._extractColor(e,r,i):s===53?i.bg|=1073741824:s===55?i.bg&=-1073741825:s===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):s===100?(i.fg&=-67108864,i.fg|=Te.fg&16777215,i.bg&=-67108864,i.bg|=Te.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${B.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[?${t};${s}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=Te.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 s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!cu(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(`${B.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>lu&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>lu&&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=[],s=e.split(";");for(;s.length>1;){let i=s.shift(),r=s.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(uu(o))if(r==="?")t.push({type:0,index:o});else{let n=au(r);n&&t.push({type:1,index:o,color:n})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let s=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(s,i):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),i,r=s.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=s[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 s=e.split(";");for(let i=0;i<s.length&&!(t>=this._specialColors.length);++i,++t)if(s[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=au(s[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],s=e.split(";");for(let i=0;i<s.length;++i)if(/^\d+$/.exec(s[i])){let r=parseInt(s[i]);uu(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,yi),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(M0[e[0]],Oe[e[1]]||yi),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){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=Te.clone(),this._eraseAttrDataInternal=Te.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 Mt;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._bufferService.rows;++t){let s=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(s);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=n=>(this._coreService.triggerDataEvent(`${B.ESC}${n}${B.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return s(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ec=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(du=e,e=t,t=du),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ec=xe([F(0,lt)],ec);O0=5e7,pu=12,I0=50,z0=class extends ie{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 z),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 s;for(;s=this._writeBuffer.shift();){this._action(s);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>O0)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let n=a=>performance.now()-s>=pu?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(s,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(n);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-s>=pu)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>I0&&(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()}},tc=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 a=t.addMarker(t.ybase+t.y),c={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._dataByLinkId.set(c.id,c),c.id}let s=e,i=this._getEntryIdKey(s),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),n={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(n,o)),this._entriesWithId.set(n.key,n),this._dataByLinkId.set(n.id,n),n.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);s.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(s,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};tc=xe([F(0,lt)],tc);fu=!1,N0=class extends ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new er),this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onData=this._register(new z),this.onData=this._onData.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new z),this._instantiationService=new l0,this.optionsService=this._register(new b0(e)),this._instantiationService.setService(ct,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Xl)),this._instantiationService.setService(lt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Yl)),this._instantiationService.setService(Eu,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Jl)),this._instantiationService.setService(ki,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Zl)),this._instantiationService.setService($u,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(wi)),this._instantiationService.setService(L_,this.unicodeService),this._charsetService=this._instantiationService.createInstance(x0),this._instantiationService.setService(R_,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tc),this._instantiationService.setService(Tu,this._oscLinkService),this._inputHandler=this._register(new B0(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ze.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ze.forward(this._bufferService.onResize,this._onResize)),this._register(Ze.forward(this.coreService.onData,this._onData)),this._register(Ze.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 z0((t,s)=>this._inputHandler.parse(t,s))),this._register(Ze.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new z),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&&!fu&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fu=!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,mp),t=Math.max(t,gp),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(ou.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ou(this._bufferService),!1))),this._windowsWrappingHeuristics.value=_e(()=>{for(let t of e)t.dispose()})}}},F0={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:["'",'"']};$e=0,W0=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Mn,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Mn,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((r,o)=>this._getKey(r)-this._getKey(o)),t=0,s=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(i[r]=e[t],t++):i[r]=this._array[s++];this._array=i,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||($e=this._search(t),$e===-1)||this._getKey(this._array[$e])!==t)return!1;do if(this._array[$e]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push($e),!0;while(++$e<this._array.length&&this._getKey(this._array[$e])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,s=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:s[i++]=this._array[r];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&($e=this._search(e),!($e<0||$e>=this._array.length)&&this._getKey(this._array[$e])===e))do yield this._array[$e];while(++$e<this._array.length&&this._getKey(this._array[$e])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&($e=this._search(e),!($e<0||$e>=this._array.length)&&this._getKey(this._array[$e])===e))do t(this._array[$e]);while(++$e<this._array.length&&this._getKey(this._array[$e])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let i=t+s>>1,r=this._getKey(this._array[i]);if(r>e)s=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},vl=0,mu=0,j0=class extends ie{constructor(){super(),this._decorations=new W0(e=>e?.marker.line),this._onDecorationRegistered=this._register(new z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(_e(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new V0(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.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,s){let i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!s||(o.options.layer??"bottom")===s)&&(yield o)}forEachDecorationAtCell(e,t,s,i){this._decorations.forEachByKey(t,r=>{vl=r.options.x??0,mu=vl+(r.options.width??1),e>=vl&&e<mu&&(!s||(r.options.layer??"bottom")===s)&&i(r)})}},V0=class extends Gs{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Se.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Se.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},U0=1e3,q0=class{constructor(e,t=U0){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,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;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},gu=20,_u=!1,Bn=class extends ie{constructor(e,t,s,i){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new q0(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");_u?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
34
34
  `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(K(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(_e(()=>{_u?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<gu+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
35
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===gu+1&&(this._liveRegion.textContent+=wl.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,i=s.lines.length.toString();for(let r=e;r<=t;r++){let o=s.lines.get(s.ydisp+r),n=[],a=o?.translateToString(!0,void 0,void 0,n)||"",c=(s.ydisp+r+1).toString(),l=this._rowElements[r];l&&(a.length===0?(l.textContent="\xA0",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,n)),l.setAttribute("aria-posinset",c),l.setAttribute("aria-setsize",i),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=s.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let n,a;if(t===0?(n=s,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(n=this._rowElements.shift(),a=s,this._rowContainer.removeChild(n)),n.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}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},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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 i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let r=({node:a,offset:c})=>{let l=a instanceof Text?a.parentNode:a,h=parseInt(l?.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(l);if(!d)return console.warn("columns is null. Race condition?"),null;let m=c<d.length?d[c]:d.slice(-1)[0]+1;return m>=this._terminal.cols&&(++h,m=0),{row:h,column:m}},o=r(t),n=r(s);if(!(!o||!n)){if(o.row>n.row||o.row===n.row&&o.column>=n.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(n.row-o.row)*this._terminal.cols-o.column+n.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)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<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};In=xe([F(1,rc),F(2,ks),F(3,$s)],In);ic=class extends ie{constructor(e,t,s,i,r){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(_e(()=>{Ci(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(K(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(K(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(K(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(K(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 s=e.composedPath();for(let i=0;i<s.length;i++){let r=s[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(s=this._checkLinkProviderResult(i,e,s)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let n=o?.map(a=>({link:a}));this._activeProviderReplies?.set(i,n),s=this._checkLinkProviderResult(i,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let n=r[o],a=n.link.range.start.y<e?0:n.link.range.start.x,c=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let l=a;l<=c;l++){if(s.has(l)){r.splice(o--,1);break}s.add(l)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(n=>this._linkAtPosition(n.link,t));o&&(s=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let o=0;o<this._activeProviderReplies.size;o++){let n=this._activeProviderReplies.get(o)?.find(a=>this._linkAtPosition(a.link,t));if(n){s=!0,this._handleNewLink(n);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&K0(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,Ci(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:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let i=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,s){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(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,s){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(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return s<=r&&r<=i}_positionFromMouseEvent(e,t,s){let i=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,i,r){return{x1:e,y1:t,x2:s,y2:i,cols:this._bufferService.cols,fg:r}}};ic=xe([F(1,oc),F(2,$s),F(3,lt),F(4,Ru)],ic);G0=class extends N0{constructor(e={}){super(e),this._linkifier=this._register(new er),this.browser=rp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new er),this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new z),this.onKey=this._onKey.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new z),this.onBell=this._onBell.event,this._onFocus=this._register(new z),this._onBlur=this._register(new z),this._onA11yCharEmitter=this._register(new z),this._onA11yTabEmitter=this._register(new z),this._onWillOpen=this._register(new z),this._setup(),this._decorationService=this._instantiationService.createInstance(j0),this._instantiationService.setService(po,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ob),this._instantiationService.setService(Ru,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Cl)),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(Ze.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ze.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ze.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ze.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(_e(()=>{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 s,i="";switch(t.index){case 256:s="foreground",i="10";break;case 257:s="background",i="11";break;case 258:s="cursor",i="12";break;default:s="ansi",i="4;"+t.index}switch(t.type){case 0:let r=ge.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${B.ESC}]${i};${P0(r)}${sp.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Ae.toColor(...t.color));else{let o=s;this._themeService.modifyColors(n=>n[o]=Ae.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(In,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.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(B.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 s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(s),o=this._renderService.dimensions.css.cell.width*r,n=this.buffer.y*this._renderService.dimensions.css.cell.height,a=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=n+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(K(this.element,"copy",t=>{this.hasSelection()&&x_(t,this._selectionService)}));let e=t=>k_(t,this.textarea,this.coreService,this.optionsService);this._register(K(this.textarea,"paste",e)),this._register(K(this.element,"paste",e)),op?this._register(K(this.element,"mousedown",t=>{t.button===2&&vd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(K(this.element,"contextmenu",t=>{vd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),pc&&this._register(K(this.element,"auxclick",t=>{t.button===1&&wu(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(K(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(K(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(K(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(K(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(K(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(K(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(K(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(K(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",yl.get()),lp||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Mb,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ks,this._coreBrowserService),this._register(K(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(K(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ul,this._document,this._helperContainer),this._instantiationService.setService(Nn,this._charSizeService),this._themeService=this._instantiationService.createInstance(Yl),this._instantiationService.setService(tr,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Mn),this._instantiationService.setService(Au,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Kl,this.rows,this.screenElement)),this._instantiationService.setService($s,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Wl,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ql),this._instantiationService.setService(oc,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(ic,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(Fl,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Gl,this.element,this.screenElement,i)),this._instantiationService.setService(P_,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(Ze.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Hl,this.screenElement)),this._register(K(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),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(In,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Pn,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Pn,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Vl,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(o){let n=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!n)return!1;let a,c;switch(o.overrideType||o.type){case"mousemove":c=32,o.buttons===void 0?(a=3,o.button!==void 0&&(a=o.button<3?o.button:3)):a=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":c=0,a=o.button<3?o.button:3;break;case"mousedown":c=1,a=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let l=o.deltaY;if(l===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;c=l<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:a,action:c,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(K(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(K(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let n=B.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(n,!0),this.cancel(o,!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){yu(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,s){this._selectionService.setSelection(e,t,s)}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 s=H0(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let i=this.rows-1;return this.scrollLines(s.type===2?-i:i),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===B.ETX||s.key===B.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Y0(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<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Te));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(B.ESC+"[I"):this.coreService.triggerDataEvent(B.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[4;${s};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};X0=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},J0=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Mt)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},vu=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 J0(t)}getNullCell(){return new Mt}},Z0=class extends ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new z),this.onBufferChange=this._onBufferChange.event,this._normal=new vu(this._core.buffers.normal,"normal"),this._alternate=new vu(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)}},Q0=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,i)=>t(s,i.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)}},ey=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}},ty=["cols","rows"],es=0,sy=class extends ie{constructor(e){super(),this._core=this._register(new G0(e)),this._addonManager=this._register(new X0),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],s=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(ty.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 Q0(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new ey(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 Z0(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}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
36
- `,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 yl.get()},set promptLabel(e){yl.set(e)},get tooMuchOutput(){return wl.get()},set tooMuchOutput(e){wl.set(e)}}}_verifyIntegers(...e){for(es of e)if(es===1/0||isNaN(es)||es%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(es of e)if(es&&(es===1/0||isNaN(es)||es%1!==0||es<0))throw new Error("This API only accepts positive integers")}}});var gc={};Ma(gc,{FitAddon:()=>oy});var iy,ry,oy,_c=Pa(()=>{iy=2,ry=1,oy=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,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),n={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},a=n.top+n.bottom,c=n.right+n.left,l=i-a,h=r-c-t;return{cols:Math.max(iy,Math.floor(h/e.css.cell.width)),rows:Math.max(ry,Math.floor(l/e.css.cell.height))}}}});var Gp={};Ma(Gp,{SearchAddon:()=>ow});function xc(e){uy(e)||dy.onUnexpectedError(e)}function uy(e){return e instanceof py?!0:e instanceof Error&&e.name===Ec&&e.message===Ec}function fy(e,t,s=0,i=e.length){let r=s,o=i;for(;r<o;){let n=Math.floor((r+o)/2);t(e[n])?r=n+1:o=n}return r-1}function gy(e,t){return(s,i)=>t(e(s),e(i))}function vy(e,t){let s=Object.create(null);for(let i of e){let r=t(i),o=s[r];o||(o=s[r]=[]),o.push(i)}return s}function yy(e,t){let s=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=e.apply(s,arguments)}finally{t()}else r=e.apply(s,arguments);return r}}function Cy(e){or=e}function Zn(e){return or?.trackDisposable(e),e}function Qn(e){or?.markAsDisposed(e)}function vo(e,t){or?.setParent(e,t)}function xy(e,t){if(or)for(let s of e)or.setParent(s,t)}function _o(e){if(Bp.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ip(...e){let t=nr(()=>_o(e));return xy(e,t),t}function nr(e){let t=Zn({dispose:yy(()=>{Qn(t),e()})});return t}function Kp(e,t=0,s){let i=setTimeout(()=>{e(),s&&r.dispose()},t),r=nr(()=>{clearTimeout(i),s?.deleteAndLeak(r)});return s?.add(r),r}var hy,dy,Ec,py,xp,my,Mp,_y,kp,$p,Ep,$E,by,Bp,wy,or,Sy,zp,Oc,os,Jn,Tp,ky,$y,Ey,Ap,Ty,Ic,Lc,Ay,Rp,Hp,Ry,Pc,Ly,Dy,Py,Kn,My,By,Gn,rs,Oy,Vp,Iy,zy,rr,Mc,Bc,Yn,Ny,Fy,Up,Hy,Wy,jy,Vy,qn,Xn,Lp,Uy,Es,Ts,$t,qp,qy,kc,Ky,EE,ns,Xs,Gy,Yy,Xy,Jy,TE,AE,RE,LE,Zy,$c,Qy,Dp,ew,tw,sw,iw,rw,ow,Yp=Pa(()=>{hy=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xp.isErrorNoTelemetry(e)?new xp(e.message+`
35
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===gu+1&&(this._liveRegion.textContent+=yl.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let s=this._terminal.buffer,i=s.lines.length.toString();for(let r=e;r<=t;r++){let o=s.lines.get(s.ydisp+r),n=[],a=o?.translateToString(!0,void 0,void 0,n)||"",c=(s.ydisp+r+1).toString(),l=this._rowElements[r];l&&(a.length===0?(l.textContent="\xA0",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,n)),l.setAttribute("aria-posinset",c),l.setAttribute("aria-setsize",i),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let s=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=s.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let n,a;if(t===0?(n=s,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(n=this._rowElements.shift(),a=s,this._rowContainer.removeChild(n)),n.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}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},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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 i=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let r=({node:a,offset:c})=>{let l=a instanceof Text?a.parentNode:a,h=parseInt(l?.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(l);if(!d)return console.warn("columns is null. Race condition?"),null;let m=c<d.length?d[c]:d.slice(-1)[0]+1;return m>=this._terminal.cols&&(++h,m=0),{row:h,column:m}},o=r(t),n=r(s);if(!(!o||!n)){if(o.row>n.row||o.row===n.row&&o.column>=n.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(n.row-o.row)*this._terminal.cols-o.column+n.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)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<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let i=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};Bn=xe([F(1,ic),F(2,ks),F(3,$s)],Bn);sc=class extends ie{constructor(e,t,s,i,r){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(_e(()=>{Ci(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(K(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(K(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(K(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(K(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 s=e.composedPath();for(let i=0;i<s.length;i++){let r=s[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(s=this._checkLinkProviderResult(i,e,s)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let n=o?.map(a=>({link:a}));this._activeProviderReplies?.set(i,n),s=this._checkLinkProviderResult(i,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let n=r[o],a=n.link.range.start.y<e?0:n.link.range.start.x,c=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let l=a;l<=c;l++){if(s.has(l)){r.splice(o--,1);break}s.add(l)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(n=>this._linkAtPosition(n.link,t));o&&(s=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let o=0;o<this._activeProviderReplies.size;o++){let n=this._activeProviderReplies.get(o)?.find(a=>this._linkAtPosition(a.link,t));if(n){s=!0,this._handleNewLink(n);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&K0(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,Ci(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:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let i=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,s){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(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-i-1,s.end.x,s.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,s){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(s,t.text)}_linkAtPosition(e,t){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return s<=r&&r<=i}_positionFromMouseEvent(e,t,s){let i=s.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,s,i,r){return{x1:e,y1:t,x2:s,y2:i,cols:this._bufferService.cols,fg:r}}};sc=xe([F(1,rc),F(2,$s),F(3,lt),F(4,Ru)],sc);G0=class extends N0{constructor(e={}){super(e),this._linkifier=this._register(new er),this.browser=rp,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new er),this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new z),this.onKey=this._onKey.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new z),this.onBell=this._onBell.event,this._onFocus=this._register(new z),this._onBlur=this._register(new z),this._onA11yCharEmitter=this._register(new z),this._onA11yTabEmitter=this._register(new z),this._onWillOpen=this._register(new z),this._setup(),this._decorationService=this._instantiationService.createInstance(j0),this._instantiationService.setService(uo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ob),this._instantiationService.setService(Ru,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Sl)),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(Ze.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ze.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ze.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ze.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(_e(()=>{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 s,i="";switch(t.index){case 256:s="foreground",i="10";break;case 257:s="background",i="11";break;case 258:s="cursor",i="12";break;default:s="ansi",i="4;"+t.index}switch(t.type){case 0:let r=ge.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${B.ESC}]${i};${P0(r)}${sp.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Ae.toColor(...t.color));else{let o=s;this._themeService.modifyColors(n=>n[o]=Ae.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(Bn,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.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(B.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 s=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(s),o=this._renderService.dimensions.css.cell.width*r,n=this.buffer.y*this._renderService.dimensions.css.cell.height,a=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=n+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(K(this.element,"copy",t=>{this.hasSelection()&&x_(t,this._selectionService)}));let e=t=>k_(t,this.textarea,this.coreService,this.optionsService);this._register(K(this.textarea,"paste",e)),this._register(K(this.element,"paste",e)),op?this._register(K(this.element,"mousedown",t=>{t.button===2&&vd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(K(this.element,"contextmenu",t=>{vd(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),uc&&this._register(K(this.element,"auxclick",t=>{t.button===1&&wu(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(K(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(K(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(K(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(K(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(K(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(K(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(K(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(K(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",bl.get()),lp||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Mb,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ks,this._coreBrowserService),this._register(K(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(K(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Vl,this._document,this._helperContainer),this._instantiationService.setService(In,this._charSizeService),this._themeService=this._instantiationService.createInstance(Gl),this._instantiationService.setService(tr,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Dn),this._instantiationService.setService(Au,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ql,this.rows,this.screenElement)),this._instantiationService.setService($s,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Hl,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ul),this._instantiationService.setService(rc,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(sc,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(Nl,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Kl,this.element,this.screenElement,i)),this._instantiationService.setService(P_,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(Ze.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Fl,this.screenElement)),this._register(K(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),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(Bn,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ln,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ln,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(jl,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(o){let n=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!n)return!1;let a,c;switch(o.overrideType||o.type){case"mousemove":c=32,o.buttons===void 0?(a=3,o.button!==void 0&&(a=o.button<3?o.button:3)):a=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":c=0,a=o.button<3?o.button:3;break;case"mousedown":c=1,a=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let l=o.deltaY;if(l===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;c=l<0?0:1,a=4;break;default:return!1}return c===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:a,action:c,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(K(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(K(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let n=B.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(n,!0),this.cancel(o,!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){yu(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,s){this._selectionService.setSelection(e,t,s)}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 s=H0(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let i=this.rows-1;return this.scrollLines(s.type===2?-i:i),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===B.ETX||s.key===B.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Y0(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<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Te));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(B.ESC+"[I"):this.coreService.triggerDataEvent(B.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[4;${s};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};X0=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},J0=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Mt)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},vu=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 J0(t)}getNullCell(){return new Mt}},Z0=class extends ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new z),this.onBufferChange=this._onBufferChange.event,this._normal=new vu(this._core.buffers.normal,"normal"),this._alternate=new vu(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)}},Q0=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,i)=>t(s,i.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)}},ey=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}},ty=["cols","rows"],es=0,sy=class extends ie{constructor(e){super(),this._core=this._register(new G0(e)),this._addonManager=this._register(new X0),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],s=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:s.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(ty.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 Q0(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new ey(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 Z0(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}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
36
+ `,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 bl.get()},set promptLabel(e){bl.set(e)},get tooMuchOutput(){return yl.get()},set tooMuchOutput(e){yl.set(e)}}}_verifyIntegers(...e){for(es of e)if(es===1/0||isNaN(es)||es%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(es of e)if(es&&(es===1/0||isNaN(es)||es%1!==0||es<0))throw new Error("This API only accepts positive integers")}}});var mc={};La(mc,{FitAddon:()=>oy});var iy,ry,oy,gc=Ra(()=>{iy=2,ry=1,oy=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,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),r=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),n={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},a=n.top+n.bottom,c=n.right+n.left,l=i-a,h=r-c-t;return{cols:Math.max(iy,Math.floor(h/e.css.cell.width)),rows:Math.max(ry,Math.floor(l/e.css.cell.height))}}}});var Gp={};La(Gp,{SearchAddon:()=>ow});function Cc(e){uy(e)||dy.onUnexpectedError(e)}function uy(e){return e instanceof py?!0:e instanceof Error&&e.name===$c&&e.message===$c}function fy(e,t,s=0,i=e.length){let r=s,o=i;for(;r<o;){let n=Math.floor((r+o)/2);t(e[n])?r=n+1:o=n}return r-1}function gy(e,t){return(s,i)=>t(e(s),e(i))}function vy(e,t){let s=Object.create(null);for(let i of e){let r=t(i),o=s[r];o||(o=s[r]=[]),o.push(i)}return s}function yy(e,t){let s=this,i=!1,r;return function(){if(i)return r;if(i=!0,t)try{r=e.apply(s,arguments)}finally{t()}else r=e.apply(s,arguments);return r}}function Cy(e){or=e}function Xn(e){return or?.trackDisposable(e),e}function Jn(e){or?.markAsDisposed(e)}function _o(e,t){or?.setParent(e,t)}function xy(e,t){if(or)for(let s of e)or.setParent(s,t)}function go(e){if(Bp.is(e)){let t=[];for(let s of e)if(s)try{s.dispose()}catch(i){t.push(i)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ip(...e){let t=nr(()=>go(e));return xy(e,t),t}function nr(e){let t=Xn({dispose:yy(()=>{Jn(t),e()})});return t}function Kp(e,t=0,s){let i=setTimeout(()=>{e(),s&&r.dispose()},t),r=nr(()=>{clearTimeout(i),s?.deleteAndLeak(r)});return s?.add(r),r}var hy,dy,$c,py,xp,my,Mp,_y,kp,$p,Ep,$E,by,Bp,wy,or,Sy,zp,Bc,os,Yn,Tp,ky,$y,Ey,Ap,Ty,Oc,Rc,Ay,Rp,Hp,Ry,Dc,Ly,Dy,Py,Un,My,By,qn,rs,Oy,Vp,Iy,zy,rr,Pc,Mc,Kn,Ny,Fy,Up,Hy,Wy,jy,Vy,Vn,Gn,Lp,Uy,Es,Ts,$t,qp,qy,xc,Ky,EE,ns,Xs,Gy,Yy,Xy,Jy,TE,AE,RE,LE,Zy,kc,Qy,Dp,ew,tw,sw,iw,rw,ow,Yp=Ra(()=>{hy=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xp.isErrorNoTelemetry(e)?new xp(e.message+`
37
37
 
38
38
  `+e.stack):new Error(e.message+`
39
39
 
40
- `+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)}},dy=new hy;Ec="Canceled";py=class extends Error{constructor(){super(Ec),this.name=this.message}},xp=class Tc extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Tc)return t;let s=new Tc;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};my=class Pp{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Pp.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=fy(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};my.assertInvariants=!1;(e=>{function t(o){return o<0}e.isLessThan=t;function s(o){return o<=0}e.isLessThanOrEqual=s;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Mp||(Mp={}));_y=(e,t)=>e-t,kp=class Ac{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new Ac(s=>this.iterate(i=>t(i)?s(i):!0))}map(t){return new Ac(s=>this.iterate(i=>s(t(i))))}some(t){let s=!1;return this.iterate(i=>(s=t(i),!s)),s}findFirst(t){let s;return this.iterate(i=>t(i)?(s=i,!1):!0),s}findLast(t){let s;return this.iterate(i=>(t(i)&&(s=i),!0)),s}findLastMaxBy(t){let s,i=!0;return this.iterate(r=>((i||Mp.isGreaterThan(t(r,s)))&&(i=!1,s=r),!0)),s}};kp.empty=new kp(e=>{});$E=class{constructor(e,t){this.toKey=t,this._map=new Map,this[$p]="SetWithKey";for(let s of e)this.add(s)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(s=>e.call(t,s,s,this))}[(Ep=Symbol.iterator,$p=Symbol.toStringTag,Ep)](){return this.values()}},by=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*r(y){yield y}e.single=r;function o(y){return t(y)?y:r(y)}e.wrap=o;function n(y){return y||s}e.from=n;function*a(y){for(let A=y.length-1;A>=0;A--)yield y[A]}e.reverse=a;function c(y){return!y||y[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(y){return y[Symbol.iterator]().next().value}e.first=l;function h(y,A){let M=0;for(let H of y)if(A(H,M++))return!0;return!1}e.some=h;function d(y,A){for(let M of y)if(A(M))return M}e.find=d;function*m(y,A){for(let M of y)A(M)&&(yield M)}e.filter=m;function*p(y,A){let M=0;for(let H of y)yield A(H,M++)}e.map=p;function*f(y,A){let M=0;for(let H of y)yield*A(H,M++)}e.flatMap=f;function*_(...y){for(let A of y)yield*A}e.concat=_;function S(y,A,M){let H=M;for(let q of y)H=A(H,q);return H}e.reduce=S;function*$(y,A,M=y.length){for(A<0&&(A+=y.length),M<0?M+=y.length:M>y.length&&(M=y.length);A<M;A++)yield y[A]}e.slice=$;function x(y,A=Number.POSITIVE_INFINITY){let M=[];if(A===0)return[M,y];let H=y[Symbol.iterator]();for(let q=0;q<A;q++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=x;async function v(y){let A=[];for await(let M of y)A.push(M);return Promise.resolve(A)}e.asyncToArray=v})(Bp||(Bp={}));wy=!1,or=null,Sy=class Op{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Op.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let i=this.getDisposableData(t);i.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let i=s.get(t);if(i)return i;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let i;if(s)i=s;else{let c=new Map,l=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,c).isSingleton);if(l.length===0)return;let h=new Set(l.map(d=>d.value));if(i=l.filter(d=>!(d.parent&&h.has(d.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(c){function l(d,m){for(;d.length>0&&m.some(p=>typeof p=="string"?p===d[0]:d[0].match(p));)d.shift()}let h=c.source.split(`
40
+ `+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)}},dy=new hy;$c="Canceled";py=class extends Error{constructor(){super($c),this.name=this.message}},xp=class Ec extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ec)return t;let s=new Ec;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};my=class Pp{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Pp.assertInvariants){if(this._prevFindLastPredicate){for(let i of this._array)if(this._prevFindLastPredicate(i)&&!t(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let s=fy(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=s+1,s===-1?void 0:this._array[s]}};my.assertInvariants=!1;(e=>{function t(o){return o<0}e.isLessThan=t;function s(o){return o<=0}e.isLessThanOrEqual=s;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Mp||(Mp={}));_y=(e,t)=>e-t,kp=class Tc{constructor(t){this.iterate=t}forEach(t){this.iterate(s=>(t(s),!0))}toArray(){let t=[];return this.iterate(s=>(t.push(s),!0)),t}filter(t){return new Tc(s=>this.iterate(i=>t(i)?s(i):!0))}map(t){return new Tc(s=>this.iterate(i=>s(t(i))))}some(t){let s=!1;return this.iterate(i=>(s=t(i),!s)),s}findFirst(t){let s;return this.iterate(i=>t(i)?(s=i,!1):!0),s}findLast(t){let s;return this.iterate(i=>(t(i)&&(s=i),!0)),s}findLastMaxBy(t){let s,i=!0;return this.iterate(r=>((i||Mp.isGreaterThan(t(r,s)))&&(i=!1,s=r),!0)),s}};kp.empty=new kp(e=>{});$E=class{constructor(e,t){this.toKey=t,this._map=new Map,this[$p]="SetWithKey";for(let s of e)this.add(s)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(s=>e.call(t,s,s,this))}[(Ep=Symbol.iterator,$p=Symbol.toStringTag,Ep)](){return this.values()}},by=class{constructor(){this.map=new Map}add(e,t){let s=this.map.get(e);s||(s=new Set,this.map.set(e,s)),s.add(t)}delete(e,t){let s=this.map.get(e);s&&(s.delete(t),s.size===0&&this.map.delete(e))}forEach(e,t){let s=this.map.get(e);s&&s.forEach(t)}get(e){return this.map.get(e)||new Set}};(e=>{function t(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function i(){return s}e.empty=i;function*r(y){yield y}e.single=r;function o(y){return t(y)?y:r(y)}e.wrap=o;function n(y){return y||s}e.from=n;function*a(y){for(let A=y.length-1;A>=0;A--)yield y[A]}e.reverse=a;function c(y){return!y||y[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(y){return y[Symbol.iterator]().next().value}e.first=l;function h(y,A){let M=0;for(let H of y)if(A(H,M++))return!0;return!1}e.some=h;function d(y,A){for(let M of y)if(A(M))return M}e.find=d;function*m(y,A){for(let M of y)A(M)&&(yield M)}e.filter=m;function*p(y,A){let M=0;for(let H of y)yield A(H,M++)}e.map=p;function*f(y,A){let M=0;for(let H of y)yield*A(H,M++)}e.flatMap=f;function*_(...y){for(let A of y)yield*A}e.concat=_;function S(y,A,M){let H=M;for(let q of y)H=A(H,q);return H}e.reduce=S;function*k(y,A,M=y.length){for(A<0&&(A+=y.length),M<0?M+=y.length:M>y.length&&(M=y.length);A<M;A++)yield y[A]}e.slice=k;function x(y,A=Number.POSITIVE_INFINITY){let M=[];if(A===0)return[M,y];let H=y[Symbol.iterator]();for(let q=0;q<A;q++){let ee=H.next();if(ee.done)return[M,e.empty()];M.push(ee.value)}return[M,{[Symbol.iterator](){return H}}]}e.consume=x;async function v(y){let A=[];for await(let M of y)A.push(M);return Promise.resolve(A)}e.asyncToArray=v})(Bp||(Bp={}));wy=!1,or=null,Sy=class Op{constructor(){this.livingDisposables=new Map}getDisposableData(t){let s=this.livingDisposables.get(t);return s||(s={parent:null,source:null,isSingleton:!1,value:t,idx:Op.idx++},this.livingDisposables.set(t,s)),s}trackDisposable(t){let s=this.getDisposableData(t);s.source||(s.source=new Error().stack)}setParent(t,s){let i=this.getDisposableData(t);i.parent=s}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,s){let i=s.get(t);if(i)return i;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),s):t;return s.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,s])=>s.source!==null&&!this.getRootParent(s,t).isSingleton).flatMap(([s])=>s)}computeLeakingDisposables(t=10,s){let i;if(s)i=s;else{let c=new Map,l=[...this.livingDisposables.values()].filter(d=>d.source!==null&&!this.getRootParent(d,c).isSingleton);if(l.length===0)return;let h=new Set(l.map(d=>d.value));if(i=l.filter(d=>!(d.parent&&h.has(d.parent))),i.length===0)throw new Error("There are cyclic diposable chains!")}if(!i)return;function r(c){function l(d,m){for(;d.length>0&&m.some(p=>typeof p=="string"?p===d[0]:d[0].match(p));)d.shift()}let h=c.source.split(`
41
41
  `).map(d=>d.trim().replace("at ","")).filter(d=>d!=="");return l(h,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),h.reverse()}let o=new by;for(let c of i){let l=r(c);for(let h=0;h<=l.length;h++)o.add(l.slice(0,h).join(`
42
42
  `),c)}i.sort(gy(c=>c.idx,_y));let n="",a=0;for(let c of i.slice(0,t)){a++;let l=r(c),h=[];for(let d=0;d<l.length;d++){let m=l[d];m=`(shared with ${o.get(l.slice(0,d+1).join(`
43
43
  `)).size}/${i.length} leaks) at ${m}`;let p=o.get(l.slice(0,d).join(`
@@ -54,15 +54,15 @@ ${h.join(`
54
54
 
55
55
  ... and ${i.length-t} more leaking disposables
56
56
 
57
- `),{leaks:i,details:n}}};Sy.idx=0;if(wy){let e="__is_disposable_tracked__";Cy(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==os.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==os.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}zp=class Np{constructor(){this._toDispose=new Set,this._isDisposed=!1,Zn(this)}dispose(){this._isDisposed||(Qn(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{_o(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 vo(t,this),this._isDisposed?Np.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),vo(t,null))}};zp.DISABLE_DISPOSED_WARNING=!1;Oc=zp,os=class{constructor(){this._store=new Oc,Zn(this),vo(this._store,this)}dispose(){Qn(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});Jn=class{constructor(){this._isDisposed=!1,Zn(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&vo(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Qn(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vo(e,null),e}},Tp=class Rc{constructor(t){this.element=t,this.next=Rc.Undefined,this.prev=Rc.Undefined}};Tp.Undefined=new Tp(void 0);ky=globalThis.performance&&typeof globalThis.performance.now=="function",$y=class Fp{static create(t){return new Fp(t)}constructor(t){this._now=ky&&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}},Ey=!1,Ap=!1,Ty=!1;(e=>{e.None=()=>os.None;function t(E){if(Ty){let{onDidAddListener:w}=E,L=Pc.create(),T=0;E.onDidAddListener=()=>{++T===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),L.print()),w?.()}}}function s(E,w){return m(E,()=>{},0,void 0,!0,void 0,w)}e.defer=s;function i(E){return(w,L=null,T)=>{let P=!1,D;return D=E(N=>{if(!P)return D?D.dispose():P=!0,w.call(L,N)},null,T),P&&D.dispose(),D}}e.once=i;function r(E,w,L){return h((T,P=null,D)=>E(N=>T.call(P,w(N)),null,D),L)}e.map=r;function o(E,w,L){return h((T,P=null,D)=>E(N=>{w(N),T.call(P,N)},null,D),L)}e.forEach=o;function n(E,w,L){return h((T,P=null,D)=>E(N=>w(N)&&T.call(P,N),null,D),L)}e.filter=n;function a(E){return E}e.signal=a;function c(...E){return(w,L=null,T)=>{let P=Ip(...E.map(D=>D(N=>w.call(L,N))));return d(P,T)}}e.any=c;function l(E,w,L,T){let P=L;return r(E,D=>(P=w(P,D),P),T)}e.reduce=l;function h(E,w){let L,T={onWillAddFirstListener(){L=E(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}};w||t(T);let P=new rs(T);return w?.add(P),P.event}function d(E,w){return w instanceof Array?w.push(E):w&&w.add(E),E}function m(E,w,L=100,T=!1,P=!1,D,N){let Z,le,Xe,ut=0,be,Ft={leakWarningThreshold:D,onWillAddFirstListener(){Z=E(ps=>{ut++,le=w(le,ps),T&&!Xe&&(Ee.fire(le),le=void 0),be=()=>{let ci=le;le=void 0,Xe=void 0,(!T||ut>1)&&Ee.fire(ci),ut=0},typeof L=="number"?(clearTimeout(Xe),Xe=setTimeout(be,L)):Xe===void 0&&(Xe=0,queueMicrotask(be))})},onWillRemoveListener(){P&&ut>0&&be?.()},onDidRemoveLastListener(){be=void 0,Z.dispose()}};N||t(Ft);let Ee=new rs(Ft);return N?.add(Ee),Ee.event}e.debounce=m;function p(E,w=0,L){return e.debounce(E,(T,P)=>T?(T.push(P),T):[P],w,void 0,!0,void 0,L)}e.accumulate=p;function f(E,w=(T,P)=>T===P,L){let T=!0,P;return n(E,D=>{let N=T||!w(D,P);return T=!1,P=D,N},L)}e.latch=f;function _(E,w,L){return[e.filter(E,w,L),e.filter(E,T=>!w(T),L)]}e.split=_;function S(E,w=!1,L=[],T){let P=L.slice(),D=E(le=>{P?P.push(le):Z.fire(le)});T&&T.add(D);let N=()=>{P?.forEach(le=>Z.fire(le)),P=null},Z=new rs({onWillAddFirstListener(){D||(D=E(le=>Z.fire(le)),T&&T.add(D))},onDidAddFirstListener(){P&&(w?setTimeout(N):N())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return T&&T.add(Z),Z.event}e.buffer=S;function $(E,w){return(L,T,P)=>{let D=w(new v);return E(function(N){let Z=D.evaluate(N);Z!==x&&L.call(T,Z)},void 0,P)}}e.chain=$;let x=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(L=>(w(L),L)),this}filter(w){return this.steps.push(L=>w(L)?L:x),this}reduce(w,L){let T=L;return this.steps.push(P=>(T=w(T,P),T)),this}latch(w=(L,T)=>L===T){let L=!0,T;return this.steps.push(P=>{let D=L||!w(P,T);return L=!1,T=P,D?P:x}),this}evaluate(w){for(let L of this.steps)if(w=L(w),w===x)break;return w}}function y(E,w,L=T=>T){let T=(...Z)=>N.fire(L(...Z)),P=()=>E.on(w,T),D=()=>E.removeListener(w,T),N=new rs({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromNodeEventEmitter=y;function A(E,w,L=T=>T){let T=(...Z)=>N.fire(L(...Z)),P=()=>E.addEventListener(w,T),D=()=>E.removeEventListener(w,T),N=new rs({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromDOMEventEmitter=A;function M(E){return new Promise(w=>i(E)(w))}e.toPromise=M;function H(E){let w=new rs;return E.then(L=>{w.fire(L)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}e.fromPromise=H;function q(E,w){return E(L=>w.fire(L))}e.forward=q;function ee(E,w,L){return w(L),E(T=>w(T))}e.runAndSubscribe=ee;class ce{constructor(w,L){this._observable=w,this._counter=0,this._hasChanged=!1;let T={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};L||t(T),this.emitter=new rs(T),L&&L.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,L){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(E,w){return new ce(E,w).emitter.event}e.fromObservable=V;function ve(E){return(w,L,T)=>{let P=0,D=!1,N={beginUpdate(){P++},endUpdate(){P--,P===0&&(E.reportChanges(),D&&(D=!1,w.call(L)))},handlePossibleChange(){},handleChange(){D=!0}};E.addObserver(N),E.reportChanges();let Z={dispose(){E.removeObserver(N)}};return T instanceof Oc?T.add(Z):Array.isArray(T)&&T.push(Z),Z}}e.fromObservableLight=ve})(Ic||(Ic={}));Lc=class Dc{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Dc._idPool++}`,Dc.all.add(this)}start(t){this._stopWatch=new $y,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}}};Lc.all=new Set,Lc._idPool=0;Ay=Lc,Rp=-1,Hp=class Wp{constructor(t,s,i=(Wp._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(o);let c=new Ly(a,o);this._errorHandler(c)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,r]of this._stacks)(!t||s<r)&&(t=[i,r],s=r);return t}};Hp._idPool=1;Ry=Hp,Pc=class jp{constructor(t){this.value=t}static create(){let t=new Error;return new jp(t.stack??"")}print(){console.warn(this.value.split(`
57
+ `),{leaks:i,details:n}}};Sy.idx=0;if(wy){let e="__is_disposable_tracked__";Cy(new class{trackDisposable(t){let s=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(s)},3e3)}setParent(t,s){if(t&&t!==os.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==os.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}zp=class Np{constructor(){this._toDispose=new Set,this._isDisposed=!1,Xn(this)}dispose(){this._isDisposed||(Jn(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{go(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 _o(t,this),this._isDisposed?Np.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),_o(t,null))}};zp.DISABLE_DISPOSED_WARNING=!1;Bc=zp,os=class{constructor(){this._store=new Bc,Xn(this),_o(this._store,this)}dispose(){Jn(this),this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};os.None=Object.freeze({dispose(){}});Yn=class{constructor(){this._isDisposed=!1,Xn(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&_o(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Jn(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&_o(e,null),e}},Tp=class Ac{constructor(t){this.element=t,this.next=Ac.Undefined,this.prev=Ac.Undefined}};Tp.Undefined=new Tp(void 0);ky=globalThis.performance&&typeof globalThis.performance.now=="function",$y=class Fp{static create(t){return new Fp(t)}constructor(t){this._now=ky&&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}},Ey=!1,Ap=!1,Ty=!1;(e=>{e.None=()=>os.None;function t($){if(Ty){let{onDidAddListener:w}=$,L=Dc.create(),E=0;$.onDidAddListener=()=>{++E===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),L.print()),w?.()}}}function s($,w){return m($,()=>{},0,void 0,!0,void 0,w)}e.defer=s;function i($){return(w,L=null,E)=>{let P=!1,D;return D=$(N=>{if(!P)return D?D.dispose():P=!0,w.call(L,N)},null,E),P&&D.dispose(),D}}e.once=i;function r($,w,L){return h((E,P=null,D)=>$(N=>E.call(P,w(N)),null,D),L)}e.map=r;function o($,w,L){return h((E,P=null,D)=>$(N=>{w(N),E.call(P,N)},null,D),L)}e.forEach=o;function n($,w,L){return h((E,P=null,D)=>$(N=>w(N)&&E.call(P,N),null,D),L)}e.filter=n;function a($){return $}e.signal=a;function c(...$){return(w,L=null,E)=>{let P=Ip(...$.map(D=>D(N=>w.call(L,N))));return d(P,E)}}e.any=c;function l($,w,L,E){let P=L;return r($,D=>(P=w(P,D),P),E)}e.reduce=l;function h($,w){let L,E={onWillAddFirstListener(){L=$(P.fire,P)},onDidRemoveLastListener(){L?.dispose()}};w||t(E);let P=new rs(E);return w?.add(P),P.event}function d($,w){return w instanceof Array?w.push($):w&&w.add($),$}function m($,w,L=100,E=!1,P=!1,D,N){let Z,le,Xe,ut=0,be,Ft={leakWarningThreshold:D,onWillAddFirstListener(){Z=$(ps=>{ut++,le=w(le,ps),E&&!Xe&&(Ee.fire(le),le=void 0),be=()=>{let ci=le;le=void 0,Xe=void 0,(!E||ut>1)&&Ee.fire(ci),ut=0},typeof L=="number"?(clearTimeout(Xe),Xe=setTimeout(be,L)):Xe===void 0&&(Xe=0,queueMicrotask(be))})},onWillRemoveListener(){P&&ut>0&&be?.()},onDidRemoveLastListener(){be=void 0,Z.dispose()}};N||t(Ft);let Ee=new rs(Ft);return N?.add(Ee),Ee.event}e.debounce=m;function p($,w=0,L){return e.debounce($,(E,P)=>E?(E.push(P),E):[P],w,void 0,!0,void 0,L)}e.accumulate=p;function f($,w=(E,P)=>E===P,L){let E=!0,P;return n($,D=>{let N=E||!w(D,P);return E=!1,P=D,N},L)}e.latch=f;function _($,w,L){return[e.filter($,w,L),e.filter($,E=>!w(E),L)]}e.split=_;function S($,w=!1,L=[],E){let P=L.slice(),D=$(le=>{P?P.push(le):Z.fire(le)});E&&E.add(D);let N=()=>{P?.forEach(le=>Z.fire(le)),P=null},Z=new rs({onWillAddFirstListener(){D||(D=$(le=>Z.fire(le)),E&&E.add(D))},onDidAddFirstListener(){P&&(w?setTimeout(N):N())},onDidRemoveLastListener(){D&&D.dispose(),D=null}});return E&&E.add(Z),Z.event}e.buffer=S;function k($,w){return(L,E,P)=>{let D=w(new v);return $(function(N){let Z=D.evaluate(N);Z!==x&&L.call(E,Z)},void 0,P)}}e.chain=k;let x=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(L=>(w(L),L)),this}filter(w){return this.steps.push(L=>w(L)?L:x),this}reduce(w,L){let E=L;return this.steps.push(P=>(E=w(E,P),E)),this}latch(w=(L,E)=>L===E){let L=!0,E;return this.steps.push(P=>{let D=L||!w(P,E);return L=!1,E=P,D?P:x}),this}evaluate(w){for(let L of this.steps)if(w=L(w),w===x)break;return w}}function y($,w,L=E=>E){let E=(...Z)=>N.fire(L(...Z)),P=()=>$.on(w,E),D=()=>$.removeListener(w,E),N=new rs({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromNodeEventEmitter=y;function A($,w,L=E=>E){let E=(...Z)=>N.fire(L(...Z)),P=()=>$.addEventListener(w,E),D=()=>$.removeEventListener(w,E),N=new rs({onWillAddFirstListener:P,onDidRemoveLastListener:D});return N.event}e.fromDOMEventEmitter=A;function M($){return new Promise(w=>i($)(w))}e.toPromise=M;function H($){let w=new rs;return $.then(L=>{w.fire(L)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}e.fromPromise=H;function q($,w){return $(L=>w.fire(L))}e.forward=q;function ee($,w,L){return w(L),$(E=>w(E))}e.runAndSubscribe=ee;class ce{constructor(w,L){this._observable=w,this._counter=0,this._hasChanged=!1;let E={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};L||t(E),this.emitter=new rs(E),L&&L.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,L){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V($,w){return new ce($,w).emitter.event}e.fromObservable=V;function ve($){return(w,L,E)=>{let P=0,D=!1,N={beginUpdate(){P++},endUpdate(){P--,P===0&&($.reportChanges(),D&&(D=!1,w.call(L)))},handlePossibleChange(){},handleChange(){D=!0}};$.addObserver(N),$.reportChanges();let Z={dispose(){$.removeObserver(N)}};return E instanceof Bc?E.add(Z):Array.isArray(E)&&E.push(Z),Z}}e.fromObservableLight=ve})(Oc||(Oc={}));Rc=class Lc{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lc._idPool++}`,Lc.all.add(this)}start(t){this._stopWatch=new $y,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}}};Rc.all=new Set,Rc._idPool=0;Ay=Rc,Rp=-1,Hp=class Wp{constructor(t,s,i=(Wp._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let i=this.threshold;if(i<=0||s<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,n]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${s} listeners already. MOST frequent listener (${n}):`;console.warn(a),console.warn(o);let c=new Ly(a,o);this._errorHandler(c)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[i,r]of this._stacks)(!t||s<r)&&(t=[i,r],s=r);return t}};Hp._idPool=1;Ry=Hp,Dc=class jp{constructor(t){this.value=t}static create(){let t=new Error;return new jp(t.stack??"")}print(){console.warn(this.value.split(`
58
58
  `).slice(2).join(`
59
- `))}},Ly=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Dy=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Py=0,Kn=class{constructor(e){this.value=e,this.id=Py++}},My=2,By=(e,t)=>{if(e instanceof Kn)t(e);else for(let s=0;s<e.length;s++){let i=e[s];i&&t(i)}};if(Ey){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
60
- `)),e.length=0)},3e3),Gn=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}rs=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Rp>0||this._options?.leakWarningThreshold?new Ry(e?.onListenerError??xc,this._options?.leakWarningThreshold??Rp):void 0,this._perfMon=this._options?._profName?new Ay(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ap){let e=this._listeners;queueMicrotask(()=>{By(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Dy(`${a}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||xc)(l),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let i=new Kn(e),r,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Pc.create(),r=this._leakageMon.check(i.stack,this._size+1)),Ap&&(i.stack=o??Pc.create()),this._listeners?this._listeners instanceof Kn?(this._deliveryQueue??(this._deliveryQueue=new Oy),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=nr(()=>{Gn?.unregister(n),r?.(),this._removeListener(i)});if(s instanceof Oc?s.add(n):Array.isArray(s)&&s.push(n),Gn){let a=new Error().stack.split(`
59
+ `))}},Ly=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Dy=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Py=0,Un=class{constructor(e){this.value=e,this.id=Py++}},My=2,By=(e,t)=>{if(e instanceof Un)t(e);else for(let s=0;s<e.length;s++){let i=e[s];i&&t(i)}};if(Ey){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
60
+ `)),e.length=0)},3e3),qn=new FinalizationRegistry(t=>{typeof t=="string"&&e.push(t)})}rs=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Rp>0||this._options?.leakWarningThreshold?new Ry(e?.onListenerError??Cc,this._options?.leakWarningThreshold??Rp):void 0,this._perfMon=this._options?._profName?new Ay(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ap){let e=this._listeners;queueMicrotask(()=>{By(e,t=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??(this._event=(e,t,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Dy(`${a}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0]);return(this._options?.onListenerError||Cc)(l),os.None}if(this._disposed)return os.None;t&&(e=e.bind(t));let i=new Un(e),r,o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=Dc.create(),r=this._leakageMon.check(i.stack,this._size+1)),Ap&&(i.stack=o??Dc.create()),this._listeners?this._listeners instanceof Un?(this._deliveryQueue??(this._deliveryQueue=new Oy),this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=nr(()=>{qn?.unregister(n),r?.(),this._removeListener(i)});if(s instanceof Bc?s.add(n):Array.isArray(s)&&s.push(n),qn){let a=new Error().stack.split(`
61
61
  `).slice(2,3).join(`
62
- `).trim(),c=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Gn.register(n,c?.[2]??a,n)}return n}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*My<=t.length){let r=0;for(let o=0;o<t.length;o++)t[o]?t[r++]=t[o]:i&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||xc;if(!s){e.value(t);return}try{e.value(t)}catch(i){s(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Kn)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Oy=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vp=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}});(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof zy?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ic.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vp})})(Iy||(Iy={}));zy=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?Vp:(this._emitter||(this._emitter=new rs),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},rr="en",Mc=!1,Bc=!1,Yn=!1,Ny=!1,Fy=!1,Up=!1,Hy=!1,Wy=!1,jy=!1,Vy=!1,Xn=rr,Lp=rr,Ts=globalThis;typeof Ts.vscode<"u"&&typeof Ts.vscode.process<"u"?$t=Ts.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&($t=process);qp=typeof $t?.versions?.electron=="string",qy=qp&&$t?.type==="renderer";if(typeof $t=="object"){Mc=$t.platform==="win32",Bc=$t.platform==="darwin",Yn=$t.platform==="linux",Ny=Yn&&!!$t.env.SNAP&&!!$t.env.SNAP_REVISION,Hy=qp,jy=!!$t.env.CI||!!$t.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qn=rr,Xn=rr;let e=$t.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);qn=t.userLocale,Lp=t.osLocale,Xn=t.resolvedLanguage||rr,Uy=t.languagePack?.translationsConfigFile}catch{}Fy=!0}else typeof navigator=="object"&&!qy?(Es=navigator.userAgent,Mc=Es.indexOf("Windows")>=0,Bc=Es.indexOf("Macintosh")>=0,Wy=(Es.indexOf("Macintosh")>=0||Es.indexOf("iPad")>=0||Es.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Yn=Es.indexOf("Linux")>=0,Vy=Es?.indexOf("Mobi")>=0,Up=!0,Xn=globalThis._VSCODE_NLS_LANGUAGE||rr,qn=navigator.language.toLowerCase(),Lp=qn):console.error("Unable to resolve platform.");kc=0;Bc?kc=1:Mc?kc=3:Yn&&(kc=2);Ky=Up&&typeof Ts.importScripts=="function",EE=Ky?Ts.origin:void 0,ns=Es,Xs=Xn;(e=>{function t(){return Xs}e.value=t;function s(){return Xs.length===2?Xs==="en":Xs.length>=3?Xs[0]==="e"&&Xs[1]==="n"&&Xs[2]==="-":!1}e.isDefaultVariant=s;function i(){return Xs==="en"}e.isDefault=i})(Gy||(Gy={}));Yy=typeof Ts.postMessage=="function"&&!Ts.importScripts,Xy=(()=>{if(Yy){let e=[];Ts.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),Ts.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Jy=!!(ns&&ns.indexOf("Chrome")>=0),TE=!!(ns&&ns.indexOf("Firefox")>=0),AE=!!(!Jy&&ns&&ns.indexOf("Safari")>=0),RE=!!(ns&&ns.indexOf("Edg/")>=0),LE=!!(ns&&ns.indexOf("Android")>=0);(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?$c=(e,t)=>{Xy(()=>{if(s)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:$c=(e,t,s)=>{let i=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(i))}}},Zy=e=>$c(globalThis,e)})();(e=>{async function t(i){let r,o=await Promise.all(i.map(n=>n.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return o}e.settled=t;function s(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(n){o(n)}})}e.withAsyncBody=s})(Qy||(Qy={}));Dp=class Bt{static fromArray(t){return new Bt(s=>{s.emitMany(t)})}static fromPromise(t){return new Bt(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Bt(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new Bt(async s=>{await Promise.all(t.map(async i=>{for await(let r of i)s.emitOne(r)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new rs,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ic.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Bt(async i=>{for await(let r of t)i.emitOne(s(r))})}map(t){return Bt.map(this,t)}static filter(t,s){return new Bt(async i=>{for await(let r of t)s(r)&&i.emitOne(r)})}filter(t){return Bt.filter(this,t)}static coalesce(t){return Bt.filter(t,s=>!!s)}coalesce(){return Bt.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return Bt.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())}};Dp.EMPTY=Dp.fromArray([]);ew=class extends os{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Jn),this._linesCacheDisposables=this._register(new Jn),this._register(nr(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ip(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Kp(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let s=[],i=[0],r=this._terminal.buffer.active.getLine(e);for(;r;){let o=this._terminal.buffer.active.getLine(e+1),n=o?o.isWrapped:!1,a=r.translateToString(!n&&t);if(n&&o){let c=r.getCell(r.length-1);c&&c.getCode()===0&&c.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(s.push(a),n)i.push(i[i.length-1]+a.length);else break;e++,r=o}return[s.join(""),i]}},tw=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},sw=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,s,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let r={startRow:t,startCol:s},o=this._findInLine(e,r,i);if(!o)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=n,r.startCol=0,o=this._findInLine(e,r,i),!o);n++);return o}findNextWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,o=0;i&&(s===e?(r=i.end.x,o=i.end.y):(r=i.start.x,o=i.start.y)),this._lineCache.initLinesCache();let n={startRow:o,startCol:r},a=this._findInLine(e,n,t);if(!a)for(let c=o+1;c<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=c,n.startCol=0,a=this._findInLine(e,n,t),!a);c++);if(!a&&o!==0)for(let c=0;c<o&&(n.startRow=c,n.startCol=0,a=this._findInLine(e,n,t),!a);c++);return!a&&i&&(n.startRow=i.start.y,n.startCol=0,a=this._findInLine(e,n,t)),a}findPreviousWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,o=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:r,startCol:o},c;if(i&&(a.startRow=r=i.start.y,a.startCol=o=i.start.x,s!==e&&(c=this._findInLine(e,a,t,!1),c||(a.startRow=r=i.end.y,a.startCol=o=i.end.x))),c||(c=this._findInLine(e,a,t,n)),!c){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=r-1;l>=0&&(a.startRow=l,c=this._findInLine(e,a,t,n),!c);l--);}if(!c&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=r&&(a.startRow=l,c=this._findInLine(e,a,t,n),!c);l--);return c}_isWholeWord(e,t,s){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+s.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+s.length]))}_findInLine(e,t,s={},i=!1){let r=t.startRow,o=t.startCol;if(this._terminal.buffer.active.getLine(r)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,s)}let n=this._lineCache.getLineFromCache(r);n||(n=this._lineCache.translateBufferLineToStringWithWrap(r,!0),this._lineCache.setLineInCache(r,n));let[a,c]=n,l=this._bufferColsToStringOffset(r,o),h=e,d=a;s.regex||(h=s.caseSensitive?e:e.toLowerCase(),d=s.caseSensitive?a:a.toLowerCase());let m=-1;if(s.regex){let p=RegExp(h,s.caseSensitive?"g":"gi"),f;if(i)for(;f=p.exec(d.slice(0,l));)m=p.lastIndex-f[0].length,e=f[0],p.lastIndex-=e.length-1;else f=p.exec(d.slice(l)),f&&f[0].length>0&&(m=l+(p.lastIndex-f[0].length),e=f[0])}else i?l-h.length>=0&&(m=d.lastIndexOf(h,l-h.length)):m=d.indexOf(h,l);if(m>=0){if(s.wholeWord&&!this._isWholeWord(m,d,e))return;let p=0;for(;p<c.length-1&&m>=c[p+1];)p++;let f=p;for(;f<c.length-1&&m+e.length>=c[f+1];)f++;let _=m-c[p],S=m+e.length-c[f],$=this._stringLengthToBufferSize(r+p,_),x=this._stringLengthToBufferSize(r+f,S)-$+this._terminal.cols*(f-p);return{term:e,col:$,row:r+p,size:x}}}_stringLengthToBufferSize(e,t){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let i=0;i<t;i++){let r=s.getCell(i);if(!r)break;let o=r.getChars();o.length>1&&(t-=o.length-1);let n=s.getCell(i+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let s=e,i=0,r=this._terminal.buffer.active.getLine(s);for(;t>0&&r;){for(let o=0;o<t&&o<this._terminal.cols;o++){let n=r.getCell(o);if(!n)break;n.getWidth()&&(i+=n.getCode()===0?1:n.getChars().length)}if(s++,r=this._terminal.buffer.active.getLine(s),r&&!r.isWrapped)break;t-=this._terminal.cols}return i}},iw=class extends os{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(nr(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let s of e){let i=this._createResultDecorations(s,t,!1);if(i)for(let r of i)this._storeDecoration(r,s)}}createActiveDecoration(e,t){let s=this._createResultDecorations(e,t,!0);if(s)return{decorations:s,match:e,dispose(){_o(s)}}}clearHighlightDecorations(){_o(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,s){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),s&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,s){let i=[],r=e.col,o=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;o>0;){let c=Math.min(this._terminal.cols-r,o);i.push([n,r,c]),r=0,o-=c,n++}let a=[];for(let c of i){let l=this._terminal.registerMarker(c[0]),h=this._terminal.registerDecoration({marker:l,x:c[1],width:c[2],backgroundColor:s?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:s?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(h){let d=[];d.push(l),d.push(h.onRender(m=>this._applyStyles(m,s?t.activeMatchBorder:t.matchBorder,!1))),d.push(h.onDispose(()=>_o(d))),a.push(h)}}return a.length===0?void 0:a}},rw=class extends os{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new rs)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let s=this._searchResults[t];if(s.row===e.row&&s.col===e.col&&s.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},ow=class extends os{constructor(e){super(),this._highlightTimeout=this._register(new Jn),this._lineCache=this._register(new Jn),this._state=new tw,this._resultTracker=this._register(new rw),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new ew(e),this._engine=new sw(e,this._lineCache.value),this._decorationManager=new iw(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(nr(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Kp(()=>{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,s){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 i=this._findNextAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_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 s=[],i,r=this._engine.find(e,0,0,t);for(;r&&(i?.row!==r.row||i?.col!==r.col)&&!(s.length>=this._highlightLimit);)i=r,s.push(i),r=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(s,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(s,t.decorations)}_findNextAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,s?.noScroll)}findPrevious(e,t,s){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 i=this._findPreviousAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,s?.noScroll)}_selectResult(e,t,s){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 i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!s&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}}});var Lr=globalThis,Nh=e=>e,Xo=Lr.trustedTypes,Fh=Xo?Xo.createPolicy("lit-html",{createHTML:e=>e}):void 0,Oa="$lit$",fs=`lit$${Math.random().toFixed(9).slice(2)}$`,Ia="?"+fs,zg=`<${Ia}>`,ui=document,Dr=()=>ui.createComment(""),Pr=e=>e===null||typeof e!="object"&&typeof e!="function",za=Array.isArray,qh=e=>za(e)||typeof e?.[Symbol.iterator]=="function",Ba=`[
63
- \f\r]`,Rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hh=/-->/g,Wh=/>/g,hi=RegExp(`>|${Ba}(?:([^\\s"'>=/]+)(${Ba}*=${Ba}*(?:[^
64
- \f\r"'\`<>=]|("|')|))|$)`,"g"),jh=/'/g,Vh=/"/g,Kh=/^(?:script|style|textarea|title)$/i,Na=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),u=Na(1),Gh=Na(2),Yh=Na(3),it=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),Uh=new WeakMap,di=ui.createTreeWalker(ui,129);function Xh(e,t){if(!za(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fh!==void 0?Fh.createHTML(t):t}var Jh=(e,t)=>{let s=e.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=Rr;for(let a=0;a<s;a++){let c=e[a],l,h,d=-1,m=0;for(;m<c.length&&(n.lastIndex=m,h=n.exec(c),h!==null);)m=n.lastIndex,n===Rr?h[1]==="!--"?n=Hh:h[1]!==void 0?n=Wh:h[2]!==void 0?(Kh.test(h[2])&&(r=RegExp("</"+h[2],"g")),n=hi):h[3]!==void 0&&(n=hi):n===hi?h[0]===">"?(n=r??Rr,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,l=h[1],n=h[3]===void 0?hi:h[3]==='"'?Vh:jh):n===Vh||n===jh?n=hi:n===Hh||n===Wh?n=Rr:(n=hi,r=void 0);let p=n===hi&&e[a+1].startsWith("/>")?" ":"";o+=n===Rr?c+zg:d>=0?(i.push(l),c.slice(0,d)+Oa+c.slice(d)+fs+p):c+fs+(d===-2?a:p)}return[Xh(e,o+(e[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},Mr=class e{constructor({strings:t,_$litType$:s},i){let r;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[l,h]=Jh(t,s);if(this.el=e.createElement(l,i),di.currentNode=this.el.content,s===2||s===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=di.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Oa)){let m=h[n++],p=r.getAttribute(d).split(fs),f=/([.?@])?(.*)/.exec(m);c.push({type:1,index:o,name:f[2],strings:p,ctor:f[1]==="."?Zo:f[1]==="?"?Qo:f[1]==="@"?en:fi}),r.removeAttribute(d)}else d.startsWith(fs)&&(c.push({type:6,index:o}),r.removeAttribute(d));if(Kh.test(r.tagName)){let d=r.textContent.split(fs),m=d.length-1;if(m>0){r.textContent=Xo?Xo.emptyScript:"";for(let p=0;p<m;p++)r.append(d[p],Dr()),di.nextNode(),c.push({type:2,index:++o});r.append(d[m],Dr())}}}else if(r.nodeType===8)if(r.data===Ia)c.push({type:2,index:o});else{let d=-1;for(;(d=r.data.indexOf(fs,d+1))!==-1;)c.push({type:7,index:o}),d+=fs.length-1}o++}}static createElement(t,s){let i=ui.createElement("template");return i.innerHTML=t,i}};function pi(e,t,s=e,i){if(t===it)return t;let r=i!==void 0?s._$Co?.[i]:s._$Cl,o=Pr(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(e),r._$AT(e,s,i)),i!==void 0?(s._$Co??(s._$Co=[]))[i]=r:s._$Cl=r),r!==void 0&&(t=pi(e,r._$AS(e,t.values),r,i)),t}var Jo=class{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:s},parts:i}=this._$AD,r=(t?.creationScope??ui).importNode(s,!0);di.currentNode=r;let o=di.nextNode(),n=0,a=0,c=i[0];for(;c!==void 0;){if(n===c.index){let l;c.type===2?l=new ji(o,o.nextSibling,this,t):c.type===1?l=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(l=new tn(o,this,t)),this._$AV.push(l),c=i[++a]}n!==c?.index&&(o=di.nextNode(),n++)}return di.currentNode=ui,r}p(t){let s=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}},ji=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,r){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=pi(this,t,s),Pr(t)?t===C||t==null||t===""?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qh(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==C&&Pr(this._$AH)?this._$AA.nextSibling.data=t:this.T(ui.createTextNode(t)),this._$AH=t}$(t){let{values:s,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Mr.createElement(Xh(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new Jo(r,this),n=o.u(this.options);o.p(s),this.T(n),this._$AH=o}}_$AC(t){let s=Uh.get(t.strings);return s===void 0&&Uh.set(t.strings,s=new Mr(t)),s}k(t){za(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,i,r=0;for(let o of t)r===s.length?s.push(i=new e(this.O(Dr()),this.O(Dr()),this,this.options)):i=s[r],i._$AI(o),r++;r<s.length&&(this._$AR(i&&i._$AB.nextSibling,r),s.length=r)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){let i=Nh(t).nextSibling;Nh(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},fi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,r,o){this.type=1,this._$AH=C,this._$AN=void 0,this.element=t,this.name=s,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=C}_$AI(t,s=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=pi(this,t,s,0),n=!Pr(t)||t!==this._$AH&&t!==it,n&&(this._$AH=t);else{let a=t,c,l;for(t=o[0],c=0;c<o.length-1;c++)l=pi(this,a[i+c],s,c),l===it&&(l=this._$AH[c]),n||(n=!Pr(l)||l!==this._$AH[c]),l===C?t=C:t!==C&&(t+=(l??"")+o[c+1]),this._$AH[c]=l}n&&!r&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Zo=class extends fi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}},Qo=class extends fi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}},en=class extends fi{constructor(t,s,i,r,o){super(t,s,i,r,o),this.type=5}_$AI(t,s=this){if((t=pi(this,t,s,0)??C)===it)return;let i=this._$AH,r=t===C&&i!==C||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==C&&(i===C||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},tn=class{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){pi(this,t)}},Zh={M:Oa,P:fs,A:Ia,C:1,L:Jh,R:Jo,D:qh,V:pi,I:ji,H:fi,N:Qo,U:en,B:Zo,F:tn},Ng=Lr.litHtmlPolyfillSupport;Ng?.(Mr,ji),(Lr.litHtmlVersions??(Lr.litHtmlVersions=[])).push("3.3.2");var sn=(e,t,s)=>{let i=s?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=s?.renderBefore??null;i._$litPart$=r=new ji(t.insertBefore(Dr(),o),o,void 0,s??{})}return r._$AI(e),r};var Ht={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Vi=e=>(...t)=>({_$litDirective$:e,values:t}),Ns=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,i){this._$Ct=t,this._$AM=s,this._$Ci=i}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}};var Br=class extends Ns{constructor(t){if(super(t),this.it=C,t.type!==Ht.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===C||t==null)return this._t=void 0,this.it=t;if(t===it)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};Br.directiveName="unsafeHTML",Br.resultType=1;var k=Vi(Br);function Fa(e){let t=(e||"").replace(/^#\/?/,""),[s,i]=t.split("?"),r=s.split("/").filter(Boolean);if(r[0]==="project"&&r.length>=3)return{section:r[2],runId:r[3]||null,projectId:r[1]};let o=r[0]||"active",n=r[1]||null,a=new URLSearchParams(i||"");return{section:o,runId:n||a.get("run")||null,projectId:a.get("project")||null}}function Fg(e,t,s){if(s){let r=`#/project/${s}/${e}`;return t?`${r}/${t}`:r}let i=`#/${e}`;return t?`${i}/${t}`:i}function Qh(e){let t=()=>e(Fa(location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Ie(e,t,s){location.hash=Fg(e,t,s)}var Ui={run_completed:{severity:"info",title:"Pipeline Complete",requireInteraction:!1},run_failed:{severity:"critical",title:"Pipeline Failed",requireInteraction:!1},approval_needed:{severity:"critical",title:"Approval Required",requireInteraction:!0},test_failures:{severity:"warning",title:"Tests Failed",requireInteraction:!1},loop_limit_warning:{severity:"warning",title:"Loop Limit Warning",requireInteraction:!1}};function Hg(e,t,s,i){if(!s||!t)return null;let r=s.active===!0,o=t.active===!1;if(!r||!o)return null;let n=t.stages||{};if(Object.values(n).some(h=>h.status==="error"))return null;let c=Or(t),l=i?`[${i}] "${c}" finished successfully`:`"${c}" finished successfully`;return{event:"run_completed",title:Ui.run_completed.title,body:l,tag:`worca-complete-${e}`,requireInteraction:!1,runId:e}}function Wg(e,t,s,i){if(!s||!t)return null;let r=s.active===!0,o=t.active===!1;if(!r||!o)return null;let n=t.stages||{},a=Object.entries(n).find(([,h])=>h.status==="error");if(!a)return null;let c=Or(t),l=i?`[${i}] "${c}" failed at ${a[0]} stage`:`"${c}" failed at ${a[0]} stage`;return{event:"run_failed",title:Ui.run_failed.title,body:l,tag:`worca-failed-${e}`,requireInteraction:!1,runId:e}}function jg(e,t,s,i){if(!t)return null;let r=t.stages||{},o=s?.stages||{};for(let[n,a]of Object.entries(r))if(a.status==="waiting_approval"&&o[n]?.status!=="waiting_approval"){let l=Or(t),h=n==="pr"?"PR":n,d=i?`[${i}] "${l}" is waiting for ${h} approval`:`"${l}" is waiting for ${h} approval`;return{event:"approval_needed",title:Ui.approval_needed.title,body:d,tag:`worca-approval-${e}-${n}`,requireInteraction:!0,runId:e}}return null}function Vg(e,t,s,i){if(!t)return null;let r=t.stages?.test;if(!r)return null;let o=r.iterations||[],n=s?.stages?.test?.iterations||[];if(o.length>n.length){let a=o[o.length-1];if(a&&a.result==="failed"){let c=Or(t),l=i?`[${i}] "${c}" test iteration ${o.length} failed`:`"${c}" test iteration ${o.length} failed`;return{event:"test_failures",title:Ui.test_failures.title,body:l,tag:`worca-test-${e}-iter${o.length}`,requireInteraction:!1,runId:e}}}return null}function Ug(e,t,s,i,r){if(!t||!i)return null;let o=i?.worca?.loops;if(!o)return null;let n=t.stages||{},a={implement_test:["implement","test"],pr_changes:["pr"],restart_planning:["plan"],plan_review:["plan_review"]};for(let[c,l]of Object.entries(o)){if(!l||l<2)continue;let h=a[c];if(h)for(let d of h){let m=n[d];if(!m)continue;let p=(m.iterations||[]).filter(f=>f.trigger!=="initial").length;if(p>0&&p===l-1){let f=`${e}-${d}`;if(r.has(f))continue;r.add(f);let _=Or(t);return{event:"loop_limit_warning",title:Ui.loop_limit_warning.title,body:`"${_}" ${d} stage approaching loop limit (${p}/${l})`,tag:`worca-loop-${e}-${d}`,requireInteraction:!1,runId:e}}}}return null}function Or(e){let s=(e?.work_request?.title||e?.id||"Pipeline").split(`
65
- `)[0];return s.length>60?`${s.slice(0,60)}\u2026`:s}var ms=null;function qg(){try{ms||(ms=new AudioContext);let e=ms.createOscillator(),t=ms.createGain();e.type="sine",e.frequency.value=440,t.gain.value=.3,e.connect(t),t.connect(ms.destination),e.start(),e.stop(ms.currentTime+.2)}catch{}}var rn={enabled:!0,sound:!1,events:{run_completed:!0,run_failed:!0,approval_needed:!0,test_failures:!0,loop_limit_warning:!0}};function ed({store:e,ws:t,getSettings:s}){let i=typeof Notification<"u"?Notification.permission:"denied",r=new Set,o=!1,n=null;function a(_){n=_}function c(){return typeof Notification<"u"&&(i=Notification.permission),i}async function l(){if(typeof Notification>"u")return"denied";let _=await Notification.requestPermission();return i=_,n&&n(),_}function h(){let _=e.getState().preferences.notifications;return _?{enabled:_.enabled??rn.enabled,sound:_.sound??rn.sound,events:{...rn.events,..._.events||{}}}:{...rn}}function d({event:_,title:S,body:$,tag:x,requireInteraction:v,runId:y}){if(typeof Notification>"u")return;let A=new Notification(S,{body:$,icon:"/favicon.svg",tag:x,requireInteraction:v});A.onclick=()=>{window.focus(),Ie("active",y),A.close()};let M=h(),H=Ui[_];M.sound&&H&&H.severity==="critical"&&qg()}function m(_,S,$){if(typeof Notification>"u"||Notification.permission!=="granted")return;let x=h();if(!x.enabled)return;let v=s(),y=e.getState(),A=y.projects?.length>1?y.projectName:null,M=[Hg,Wg,jg,Vg];for(let q of M){let ee=q(_,S,$,A);ee&&x.events[ee.event]&&d(ee)}let H=Ug(_,S,$,v,r);H&&x.events[H.event]&&d(H)}function p(){return typeof Notification>"u"?C:(c(),i==="default"?u`
62
+ `).trim(),c=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);qn.register(n,c?.[2]??a,n)}return n}),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,s=t.indexOf(e);if(s===-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[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*My<=t.length){let r=0;for(let o=0;o<t.length;o++)t[o]?t[r++]=t[o]:i&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let s=this._options?.onListenerError||Cc;if(!s){e.value(t);return}try{e.value(t)}catch(i){s(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Un)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Oy=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vp=Object.freeze(function(e,t){let s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}});(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof zy?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Oc.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vp})})(Iy||(Iy={}));zy=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?Vp:(this._emitter||(this._emitter=new rs),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},rr="en",Pc=!1,Mc=!1,Kn=!1,Ny=!1,Fy=!1,Up=!1,Hy=!1,Wy=!1,jy=!1,Vy=!1,Gn=rr,Lp=rr,Ts=globalThis;typeof Ts.vscode<"u"&&typeof Ts.vscode.process<"u"?$t=Ts.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&($t=process);qp=typeof $t?.versions?.electron=="string",qy=qp&&$t?.type==="renderer";if(typeof $t=="object"){Pc=$t.platform==="win32",Mc=$t.platform==="darwin",Kn=$t.platform==="linux",Ny=Kn&&!!$t.env.SNAP&&!!$t.env.SNAP_REVISION,Hy=qp,jy=!!$t.env.CI||!!$t.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Vn=rr,Gn=rr;let e=$t.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Vn=t.userLocale,Lp=t.osLocale,Gn=t.resolvedLanguage||rr,Uy=t.languagePack?.translationsConfigFile}catch{}Fy=!0}else typeof navigator=="object"&&!qy?(Es=navigator.userAgent,Pc=Es.indexOf("Windows")>=0,Mc=Es.indexOf("Macintosh")>=0,Wy=(Es.indexOf("Macintosh")>=0||Es.indexOf("iPad")>=0||Es.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Kn=Es.indexOf("Linux")>=0,Vy=Es?.indexOf("Mobi")>=0,Up=!0,Gn=globalThis._VSCODE_NLS_LANGUAGE||rr,Vn=navigator.language.toLowerCase(),Lp=Vn):console.error("Unable to resolve platform.");xc=0;Mc?xc=1:Pc?xc=3:Kn&&(xc=2);Ky=Up&&typeof Ts.importScripts=="function",EE=Ky?Ts.origin:void 0,ns=Es,Xs=Gn;(e=>{function t(){return Xs}e.value=t;function s(){return Xs.length===2?Xs==="en":Xs.length>=3?Xs[0]==="e"&&Xs[1]==="n"&&Xs[2]==="-":!1}e.isDefaultVariant=s;function i(){return Xs==="en"}e.isDefault=i})(Gy||(Gy={}));Yy=typeof Ts.postMessage=="function"&&!Ts.importScripts,Xy=(()=>{if(Yy){let e=[];Ts.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===s.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return s=>{let i=++t;e.push({id:i,callback:s}),Ts.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})(),Jy=!!(ns&&ns.indexOf("Chrome")>=0),TE=!!(ns&&ns.indexOf("Firefox")>=0),AE=!!(!Jy&&ns&&ns.indexOf("Safari")>=0),RE=!!(ns&&ns.indexOf("Edg/")>=0),LE=!!(ns&&ns.indexOf("Android")>=0);(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?kc=(e,t)=>{Xy(()=>{if(s)return;let i=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let s=!1;return{dispose(){s||(s=!0)}}}:kc=(e,t,s)=>{let i=e.requestIdleCallback(t,typeof s=="number"?{timeout:s}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(i))}}},Zy=e=>kc(globalThis,e)})();(e=>{async function t(i){let r,o=await Promise.all(i.map(n=>n.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return o}e.settled=t;function s(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(n){o(n)}})}e.withAsyncBody=s})(Qy||(Qy={}));Dp=class Bt{static fromArray(t){return new Bt(s=>{s.emitMany(t)})}static fromPromise(t){return new Bt(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Bt(async s=>{await Promise.all(t.map(async i=>s.emitOne(await i)))})}static merge(t){return new Bt(async s=>{await Promise.all(t.map(async i=>{for await(let r of i)s.emitOne(r)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new rs,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Oc.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Bt(async i=>{for await(let r of t)i.emitOne(s(r))})}map(t){return Bt.map(this,t)}static filter(t,s){return new Bt(async i=>{for await(let r of t)s(r)&&i.emitOne(r)})}filter(t){return Bt.filter(this,t)}static coalesce(t){return Bt.filter(t,s=>!!s)}coalesce(){return Bt.coalesce(this)}static async toPromise(t){let s=[];for await(let i of t)s.push(i);return s}toPromise(){return Bt.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())}};Dp.EMPTY=Dp.fromArray([]);ew=class extends os{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new Yn),this._linesCacheDisposables=this._register(new Yn),this._register(nr(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Ip(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Kp(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let s=[],i=[0],r=this._terminal.buffer.active.getLine(e);for(;r;){let o=this._terminal.buffer.active.getLine(e+1),n=o?o.isWrapped:!1,a=r.translateToString(!n&&t);if(n&&o){let c=r.getCell(r.length-1);c&&c.getCode()===0&&c.getWidth()===1&&o.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(s.push(a),n)i.push(i[i.length-1]+a.length);else break;e++,r=o}return[s.join(""),i]}},tw=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},sw=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,s,i){if(!e||e.length===0){this._terminal.clearSelection();return}if(s>this._terminal.cols)throw new Error(`Invalid col: ${s} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let r={startRow:t,startCol:s},o=this._findInLine(e,r,i);if(!o)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=n,r.startCol=0,o=this._findInLine(e,r,i),!o);n++);return o}findNextWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,o=0;i&&(s===e?(r=i.end.x,o=i.end.y):(r=i.start.x,o=i.start.y)),this._lineCache.initLinesCache();let n={startRow:o,startCol:r},a=this._findInLine(e,n,t);if(!a)for(let c=o+1;c<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=c,n.startCol=0,a=this._findInLine(e,n,t),!a);c++);if(!a&&o!==0)for(let c=0;c<o&&(n.startRow=c,n.startCol=0,a=this._findInLine(e,n,t),!a);c++);return!a&&i&&(n.startRow=i.start.y,n.startCol=0,a=this._findInLine(e,n,t)),a}findPreviousWithSelection(e,t,s){if(!e||e.length===0){this._terminal.clearSelection();return}let i=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,o=this._terminal.cols,n=!0;this._lineCache.initLinesCache();let a={startRow:r,startCol:o},c;if(i&&(a.startRow=r=i.start.y,a.startCol=o=i.start.x,s!==e&&(c=this._findInLine(e,a,t,!1),c||(a.startRow=r=i.end.y,a.startCol=o=i.end.x))),c||(c=this._findInLine(e,a,t,n)),!c){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=r-1;l>=0&&(a.startRow=l,c=this._findInLine(e,a,t,n),!c);l--);}if(!c&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=r&&(a.startRow=l,c=this._findInLine(e,a,t,n),!c);l--);return c}_isWholeWord(e,t,s){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+s.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+s.length]))}_findInLine(e,t,s={},i=!1){let r=t.startRow,o=t.startCol;if(this._terminal.buffer.active.getLine(r)?.isWrapped){if(i){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,s)}let n=this._lineCache.getLineFromCache(r);n||(n=this._lineCache.translateBufferLineToStringWithWrap(r,!0),this._lineCache.setLineInCache(r,n));let[a,c]=n,l=this._bufferColsToStringOffset(r,o),h=e,d=a;s.regex||(h=s.caseSensitive?e:e.toLowerCase(),d=s.caseSensitive?a:a.toLowerCase());let m=-1;if(s.regex){let p=RegExp(h,s.caseSensitive?"g":"gi"),f;if(i)for(;f=p.exec(d.slice(0,l));)m=p.lastIndex-f[0].length,e=f[0],p.lastIndex-=e.length-1;else f=p.exec(d.slice(l)),f&&f[0].length>0&&(m=l+(p.lastIndex-f[0].length),e=f[0])}else i?l-h.length>=0&&(m=d.lastIndexOf(h,l-h.length)):m=d.indexOf(h,l);if(m>=0){if(s.wholeWord&&!this._isWholeWord(m,d,e))return;let p=0;for(;p<c.length-1&&m>=c[p+1];)p++;let f=p;for(;f<c.length-1&&m+e.length>=c[f+1];)f++;let _=m-c[p],S=m+e.length-c[f],k=this._stringLengthToBufferSize(r+p,_),x=this._stringLengthToBufferSize(r+f,S)-k+this._terminal.cols*(f-p);return{term:e,col:k,row:r+p,size:x}}}_stringLengthToBufferSize(e,t){let s=this._terminal.buffer.active.getLine(e);if(!s)return 0;for(let i=0;i<t;i++){let r=s.getCell(i);if(!r)break;let o=r.getChars();o.length>1&&(t-=o.length-1);let n=s.getCell(i+1);n&&n.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let s=e,i=0,r=this._terminal.buffer.active.getLine(s);for(;t>0&&r;){for(let o=0;o<t&&o<this._terminal.cols;o++){let n=r.getCell(o);if(!n)break;n.getWidth()&&(i+=n.getCode()===0?1:n.getChars().length)}if(s++,r=this._terminal.buffer.active.getLine(s),r&&!r.isWrapped)break;t-=this._terminal.cols}return i}},iw=class extends os{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(nr(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let s of e){let i=this._createResultDecorations(s,t,!1);if(i)for(let r of i)this._storeDecoration(r,s)}}createActiveDecoration(e,t){let s=this._createResultDecorations(e,t,!0);if(s)return{decorations:s,match:e,dispose(){go(s)}}}clearHighlightDecorations(){go(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,s){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),s&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,s){let i=[],r=e.col,o=e.size,n=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;o>0;){let c=Math.min(this._terminal.cols-r,o);i.push([n,r,c]),r=0,o-=c,n++}let a=[];for(let c of i){let l=this._terminal.registerMarker(c[0]),h=this._terminal.registerDecoration({marker:l,x:c[1],width:c[2],backgroundColor:s?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:s?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(h){let d=[];d.push(l),d.push(h.onRender(m=>this._applyStyles(m,s?t.activeMatchBorder:t.matchBorder,!1))),d.push(h.onDispose(()=>go(d))),a.push(h)}}return a.length===0?void 0:a}},rw=class extends os{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new rs)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let s=this._searchResults[t];if(s.row===e.row&&s.col===e.col&&s.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},ow=class extends os{constructor(e){super(),this._highlightTimeout=this._register(new Yn),this._lineCache=this._register(new Yn),this._state=new tw,this._resultTracker=this._register(new rw),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new ew(e),this._engine=new sw(e,this._lineCache.value),this._decorationManager=new iw(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(nr(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Kp(()=>{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,s){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 i=this._findNextAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_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 s=[],i,r=this._engine.find(e,0,0,t);for(;r&&(i?.row!==r.row||i?.col!==r.col)&&!(s.length>=this._highlightLimit);)i=r,s.push(i),r=this._engine.find(e,i.col+i.term.length>=this._terminal.cols?i.row+1:i.row,i.col+i.term.length>=this._terminal.cols?0:i.col+1,t);this._resultTracker.updateResults(s,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(s,t.decorations)}_findNextAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,s?.noScroll)}findPrevious(e,t,s){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 i=this._findPreviousAndSelect(e,t,s);return this._fireResults(t),this._state.cachedSearchTerm=e,i}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,s){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let i=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(i,t?.decorations,s?.noScroll)}_selectResult(e,t,s){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 i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!s&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let i=e.row-this._terminal.buffer.active.viewportY;i-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(i)}return!0}}});var Lr=globalThis,Nh=e=>e,Yo=Lr.trustedTypes,Fh=Yo?Yo.createPolicy("lit-html",{createHTML:e=>e}):void 0,Pa="$lit$",fs=`lit$${Math.random().toFixed(9).slice(2)}$`,Ma="?"+fs,zg=`<${Ma}>`,ui=document,Dr=()=>ui.createComment(""),Pr=e=>e===null||typeof e!="object"&&typeof e!="function",Ba=Array.isArray,qh=e=>Ba(e)||typeof e?.[Symbol.iterator]=="function",Da=`[
63
+ \f\r]`,Rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hh=/-->/g,Wh=/>/g,hi=RegExp(`>|${Da}(?:([^\\s"'>=/]+)(${Da}*=${Da}*(?:[^
64
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),jh=/'/g,Vh=/"/g,Kh=/^(?:script|style|textarea|title)$/i,Oa=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),u=Oa(1),Gh=Oa(2),Yh=Oa(3),it=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),Uh=new WeakMap,di=ui.createTreeWalker(ui,129);function Xh(e,t){if(!Ba(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fh!==void 0?Fh.createHTML(t):t}var Jh=(e,t)=>{let s=e.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=Rr;for(let a=0;a<s;a++){let c=e[a],l,h,d=-1,m=0;for(;m<c.length&&(n.lastIndex=m,h=n.exec(c),h!==null);)m=n.lastIndex,n===Rr?h[1]==="!--"?n=Hh:h[1]!==void 0?n=Wh:h[2]!==void 0?(Kh.test(h[2])&&(r=RegExp("</"+h[2],"g")),n=hi):h[3]!==void 0&&(n=hi):n===hi?h[0]===">"?(n=r??Rr,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,l=h[1],n=h[3]===void 0?hi:h[3]==='"'?Vh:jh):n===Vh||n===jh?n=hi:n===Hh||n===Wh?n=Rr:(n=hi,r=void 0);let p=n===hi&&e[a+1].startsWith("/>")?" ":"";o+=n===Rr?c+zg:d>=0?(i.push(l),c.slice(0,d)+Pa+c.slice(d)+fs+p):c+fs+(d===-2?a:p)}return[Xh(e,o+(e[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},Mr=class e{constructor({strings:t,_$litType$:s},i){let r;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[l,h]=Jh(t,s);if(this.el=e.createElement(l,i),di.currentNode=this.el.content,s===2||s===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(r=di.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Pa)){let m=h[n++],p=r.getAttribute(d).split(fs),f=/([.?@])?(.*)/.exec(m);c.push({type:1,index:o,name:f[2],strings:p,ctor:f[1]==="."?Jo:f[1]==="?"?Zo:f[1]==="@"?Qo:fi}),r.removeAttribute(d)}else d.startsWith(fs)&&(c.push({type:6,index:o}),r.removeAttribute(d));if(Kh.test(r.tagName)){let d=r.textContent.split(fs),m=d.length-1;if(m>0){r.textContent=Yo?Yo.emptyScript:"";for(let p=0;p<m;p++)r.append(d[p],Dr()),di.nextNode(),c.push({type:2,index:++o});r.append(d[m],Dr())}}}else if(r.nodeType===8)if(r.data===Ma)c.push({type:2,index:o});else{let d=-1;for(;(d=r.data.indexOf(fs,d+1))!==-1;)c.push({type:7,index:o}),d+=fs.length-1}o++}}static createElement(t,s){let i=ui.createElement("template");return i.innerHTML=t,i}};function pi(e,t,s=e,i){if(t===it)return t;let r=i!==void 0?s._$Co?.[i]:s._$Cl,o=Pr(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(e),r._$AT(e,s,i)),i!==void 0?(s._$Co??(s._$Co=[]))[i]=r:s._$Cl=r),r!==void 0&&(t=pi(e,r._$AS(e,t.values),r,i)),t}var Xo=class{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:s},parts:i}=this._$AD,r=(t?.creationScope??ui).importNode(s,!0);di.currentNode=r;let o=di.nextNode(),n=0,a=0,c=i[0];for(;c!==void 0;){if(n===c.index){let l;c.type===2?l=new ji(o,o.nextSibling,this,t):c.type===1?l=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(l=new en(o,this,t)),this._$AV.push(l),c=i[++a]}n!==c?.index&&(o=di.nextNode(),n++)}return di.currentNode=ui,r}p(t){let s=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}},ji=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,r){this.type=2,this._$AH=C,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=pi(this,t,s),Pr(t)?t===C||t==null||t===""?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):qh(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==C&&Pr(this._$AH)?this._$AA.nextSibling.data=t:this.T(ui.createTextNode(t)),this._$AH=t}$(t){let{values:s,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Mr.createElement(Xh(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new Xo(r,this),n=o.u(this.options);o.p(s),this.T(n),this._$AH=o}}_$AC(t){let s=Uh.get(t.strings);return s===void 0&&Uh.set(t.strings,s=new Mr(t)),s}k(t){Ba(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,i,r=0;for(let o of t)r===s.length?s.push(i=new e(this.O(Dr()),this.O(Dr()),this,this.options)):i=s[r],i._$AI(o),r++;r<s.length&&(this._$AR(i&&i._$AB.nextSibling,r),s.length=r)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){let i=Nh(t).nextSibling;Nh(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},fi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,r,o){this.type=1,this._$AH=C,this._$AN=void 0,this.element=t,this.name=s,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=C}_$AI(t,s=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=pi(this,t,s,0),n=!Pr(t)||t!==this._$AH&&t!==it,n&&(this._$AH=t);else{let a=t,c,l;for(t=o[0],c=0;c<o.length-1;c++)l=pi(this,a[i+c],s,c),l===it&&(l=this._$AH[c]),n||(n=!Pr(l)||l!==this._$AH[c]),l===C?t=C:t!==C&&(t+=(l??"")+o[c+1]),this._$AH[c]=l}n&&!r&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Jo=class extends fi{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}},Zo=class extends fi{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}},Qo=class extends fi{constructor(t,s,i,r,o){super(t,s,i,r,o),this.type=5}_$AI(t,s=this){if((t=pi(this,t,s,0)??C)===it)return;let i=this._$AH,r=t===C&&i!==C||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==C&&(i===C||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},en=class{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){pi(this,t)}},Zh={M:Pa,P:fs,A:Ma,C:1,L:Jh,R:Xo,D:qh,V:pi,I:ji,H:fi,N:Zo,U:Qo,B:Jo,F:en},Ng=Lr.litHtmlPolyfillSupport;Ng?.(Mr,ji),(Lr.litHtmlVersions??(Lr.litHtmlVersions=[])).push("3.3.2");var tn=(e,t,s)=>{let i=s?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=s?.renderBefore??null;i._$litPart$=r=new ji(t.insertBefore(Dr(),o),o,void 0,s??{})}return r._$AI(e),r};var Ht={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Vi=e=>(...t)=>({_$litDirective$:e,values:t}),Ns=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,i){this._$Ct=t,this._$AM=s,this._$Ci=i}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}};var Br=class extends Ns{constructor(t){if(super(t),this.it=C,t.type!==Ht.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===C||t==null)return this._t=void 0,this.it=t;if(t===it)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};Br.directiveName="unsafeHTML",Br.resultType=1;var T=Vi(Br);function Ia(e){let t=(e||"").replace(/^#\/?/,""),[s,i]=t.split("?"),r=s.split("/").filter(Boolean);if(r[0]==="project"&&r.length>=3)return{section:r[2],runId:r[3]||null,projectId:r[1]};let o=r[0]||"active",n=r[1]||null,a=new URLSearchParams(i||"");return{section:o,runId:n||a.get("run")||null,projectId:a.get("project")||null}}function Fg(e,t,s){if(s){let r=`#/project/${s}/${e}`;return t?`${r}/${t}`:r}let i=`#/${e}`;return t?`${i}/${t}`:i}function Qh(e){let t=()=>e(Ia(location.hash));return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function Ie(e,t,s){location.hash=Fg(e,t,s)}var Ui={run_completed:{severity:"info",title:"Pipeline Complete",requireInteraction:!1},run_failed:{severity:"critical",title:"Pipeline Failed",requireInteraction:!1},approval_needed:{severity:"critical",title:"Approval Required",requireInteraction:!0},test_failures:{severity:"warning",title:"Tests Failed",requireInteraction:!1},loop_limit_warning:{severity:"warning",title:"Loop Limit Warning",requireInteraction:!1}};function Hg(e,t,s,i){if(!s||!t)return null;let r=s.active===!0,o=t.active===!1;if(!r||!o)return null;let n=t.stages||{};if(Object.values(n).some(h=>h.status==="error"))return null;let c=Or(t),l=i?`[${i}] "${c}" finished successfully`:`"${c}" finished successfully`;return{event:"run_completed",title:Ui.run_completed.title,body:l,tag:`worca-complete-${e}`,requireInteraction:!1,runId:e}}function Wg(e,t,s,i){if(!s||!t)return null;let r=s.active===!0,o=t.active===!1;if(!r||!o)return null;let n=t.stages||{},a=Object.entries(n).find(([,h])=>h.status==="error");if(!a)return null;let c=Or(t),l=i?`[${i}] "${c}" failed at ${a[0]} stage`:`"${c}" failed at ${a[0]} stage`;return{event:"run_failed",title:Ui.run_failed.title,body:l,tag:`worca-failed-${e}`,requireInteraction:!1,runId:e}}function jg(e,t,s,i){if(!t)return null;let r=t.stages||{},o=s?.stages||{};for(let[n,a]of Object.entries(r))if(a.status==="waiting_approval"&&o[n]?.status!=="waiting_approval"){let l=Or(t),h=n==="pr"?"PR":n,d=i?`[${i}] "${l}" is waiting for ${h} approval`:`"${l}" is waiting for ${h} approval`;return{event:"approval_needed",title:Ui.approval_needed.title,body:d,tag:`worca-approval-${e}-${n}`,requireInteraction:!0,runId:e}}return null}function Vg(e,t,s,i){if(!t)return null;let r=t.stages?.test;if(!r)return null;let o=r.iterations||[],n=s?.stages?.test?.iterations||[];if(o.length>n.length){let a=o[o.length-1];if(a&&a.result==="failed"){let c=Or(t),l=i?`[${i}] "${c}" test iteration ${o.length} failed`:`"${c}" test iteration ${o.length} failed`;return{event:"test_failures",title:Ui.test_failures.title,body:l,tag:`worca-test-${e}-iter${o.length}`,requireInteraction:!1,runId:e}}}return null}function Ug(e,t,s,i,r){if(!t||!i)return null;let o=i?.worca?.loops;if(!o)return null;let n=t.stages||{},a={implement_test:["implement","test"],pr_changes:["pr"],restart_planning:["plan"],plan_review:["plan_review"]};for(let[c,l]of Object.entries(o)){if(!l||l<2)continue;let h=a[c];if(h)for(let d of h){let m=n[d];if(!m)continue;let p=(m.iterations||[]).filter(f=>f.trigger!=="initial").length;if(p>0&&p===l-1){let f=`${e}-${d}`;if(r.has(f))continue;r.add(f);let _=Or(t);return{event:"loop_limit_warning",title:Ui.loop_limit_warning.title,body:`"${_}" ${d} stage approaching loop limit (${p}/${l})`,tag:`worca-loop-${e}-${d}`,requireInteraction:!1,runId:e}}}}return null}function Or(e){let s=(e?.work_request?.title||e?.id||"Pipeline").split(`
65
+ `)[0];return s.length>60?`${s.slice(0,60)}\u2026`:s}var ms=null;function qg(){try{ms||(ms=new AudioContext);let e=ms.createOscillator(),t=ms.createGain();e.type="sine",e.frequency.value=440,t.gain.value=.3,e.connect(t),t.connect(ms.destination),e.start(),e.stop(ms.currentTime+.2)}catch{}}var sn={enabled:!0,sound:!1,events:{run_completed:!0,run_failed:!0,approval_needed:!0,test_failures:!0,loop_limit_warning:!0}};function ed({store:e,ws:t,getSettings:s}){let i=typeof Notification<"u"?Notification.permission:"denied",r=new Set,o=!1,n=null;function a(_){n=_}function c(){return typeof Notification<"u"&&(i=Notification.permission),i}async function l(){if(typeof Notification>"u")return"denied";let _=await Notification.requestPermission();return i=_,n&&n(),_}function h(){let _=e.getState().preferences.notifications;return _?{enabled:_.enabled??sn.enabled,sound:_.sound??sn.sound,events:{...sn.events,..._.events||{}}}:{...sn}}function d({event:_,title:S,body:k,tag:x,requireInteraction:v,runId:y}){if(typeof Notification>"u")return;let A=new Notification(S,{body:k,icon:"/favicon.svg",tag:x,requireInteraction:v});A.onclick=()=>{window.focus(),Ie("active",y),A.close()};let M=h(),H=Ui[_];M.sound&&H&&H.severity==="critical"&&qg()}function m(_,S,k){if(typeof Notification>"u"||Notification.permission!=="granted")return;let x=h();if(!x.enabled)return;let v=s(),y=e.getState(),A=y.projects?.length>1?y.projectName:null,M=[Hg,Wg,jg,Vg];for(let q of M){let ee=q(_,S,k,A);ee&&x.events[ee.event]&&d(ee)}let H=Ug(_,S,k,v,r);H&&x.events[H.event]&&d(H)}function p(){return typeof Notification>"u"?C:(c(),i==="default"?u`
66
66
  <div class="notification-banner notification-banner--info">
67
67
  <span class="notification-banner-text">
68
68
  Enable browser notifications to stay informed about pipeline events
@@ -78,15 +78,15 @@ ${h.join(`
78
78
  </span>
79
79
  <button class="notification-banner-dismiss" @click=${()=>{o=!0,n&&n()}}>&times;</button>
80
80
  </div>
81
- `:C)}function f(){ms&&(ms.close().catch(()=>{}),ms=null)}return{checkPermission:c,requestPermission:l,handleRunUpdate:m,renderBanner:p,getPreferences:h,setRerender:a,dispose:f}}function on(e,t){return e.archived_at?(t||Date.now())-new Date(e.archived_at).getTime()>7776e6:!1}function td(e={}){let t={activeRunId:e.activeRunId??null,projectName:e.projectName??"",currentProjectId:e.currentProjectId??null,projects:e.projects??[],runs:e.runs??{},archivedRuns:e.archivedRuns??{},pipelines:e.pipelines??{},logLines:e.logLines??[],preferences:{theme:e.preferences?.theme??"light",sidebarCollapsed:e.preferences?.sidebarCollapsed??!1,notifications:e.preferences?.notifications??null},beads:e.beads??{issues:[],dbExists:!1,loading:!1},webhookInbox:e.webhookInbox??{events:[],controlAction:"continue"},runsLoaded:e.runsLoaded??!1,addProjectDialogOpen:e.addProjectDialogOpen??!1},s=new Set;function i(){for(let r of Array.from(s))try{r(t)}catch{}}return{getState(){return t},setState(r){let o={...t,...r,preferences:{...t.preferences,...r.preferences||{}}};o.activeRunId===t.activeRunId&&o.projectName===t.projectName&&o.currentProjectId===t.currentProjectId&&o.projects===t.projects&&o.runs===t.runs&&o.archivedRuns===t.archivedRuns&&o.pipelines===t.pipelines&&o.logLines===t.logLines&&o.preferences.theme===t.preferences.theme&&o.preferences.sidebarCollapsed===t.preferences.sidebarCollapsed&&o.preferences.notifications===t.preferences.notifications&&o.beads===t.beads&&o.webhookInbox===t.webhookInbox&&o.addProjectDialogOpen===t.addProjectDialogOpen||(t=o,i())},setRun(r,o){if(o.archived===!0){let n={...t.archivedRuns,[r]:o};if(r in t.runs){let a={...t.runs};delete a[r],t={...t,runs:a,archivedRuns:n}}else t={...t,archivedRuns:n}}else{let a=!(r in t.runs)&&!(r in t.archivedRuns)?{...o,_addedAt:Date.now()}:o,c={...t.runs,[r]:a};if(r in t.archivedRuns){let l={...t.archivedRuns};delete l[r],t={...t,runs:c,archivedRuns:l}}else t={...t,runs:c}}i()},setRunsBulk(r){let o={},n={},a=Date.now();for(let c of r)if(c.archived===!0){if(on(c,a))continue;n[c.id]=c}else o[c.id]=c;for(let[c,l]of Object.entries(t.runs))l._addedAt&&a-l._addedAt<5e3&&!(c in o)&&(o[c]=l);t={...t,runs:o,archivedRuns:n,runsLoaded:!0},i()},getRunById(r){return t.runs[r]??t.archivedRuns[r]},appendLog(r){let o=[...t.logLines,r];o.length>5e3&&o.splice(0,o.length-5e3),t={...t,logLines:o},i()},clearLog(){t={...t,logLines:[]},i()},subscribe(r){return s.add(r),()=>s.delete(r)}}}function sd({showConfirm:e,showActionError:t,projectUrl:s,store:i,rerender:r,fetchFn:o=fetch}){function n(c){e({label:"Archive Pipeline Run",message:"This run will be hidden from the dashboard and history. You can find it later using the 'archived' filter.",confirmLabel:"Archive",confirmVariant:"danger",onConfirm:async()=>{try{let h=await(await o(s(`/runs/${c}/archive`),{method:"POST"})).json();if(!h.ok){t(h.error||"Failed to archive run");return}let d=i.getRunById(c);d&&i.setRun(c,{...d,archived:!0,archived_at:new Date().toISOString()})}catch(l){t(l?.message||"Failed to archive run")}}},r)}async function a(c){try{let h=await(await o(s(`/runs/${c}/unarchive`),{method:"POST"})).json();if(!h.ok){t(h.error||"Failed to unarchive run");return}let d=i.getRunById(c);if(d){let{archived:m,archived_at:p,...f}=d;i.setRun(c,f)}}catch(l){t(l?.message||"Failed to unarchive run")}}return{archiveRun:n,unarchiveRun:a}}var nn=null;function At({label:e,message:t,confirmLabel:s,confirmVariant:i="danger",cancelLabel:r,onConfirm:o,onCancel:n},a){nn={label:e,message:t,confirmLabel:s,confirmVariant:i,cancelLabel:r,onConfirm:o,onCancel:n},a(),requestAnimationFrame(()=>{document.getElementById("global-confirm-dialog")?.show()})}function Ha(e){let t=document.getElementById("global-confirm-dialog");t&&t.hide();let s=e;nn=null,s?.()}function Ir(){if(!nn)return C;let{label:e,message:t,confirmLabel:s,confirmVariant:i,cancelLabel:r,onConfirm:o,onCancel:n}=nn;return u`
82
- <sl-dialog id="global-confirm-dialog" label=${e} @sl-after-hide=${()=>Ha(n)}>
81
+ `:C)}function f(){ms&&(ms.close().catch(()=>{}),ms=null)}return{checkPermission:c,requestPermission:l,handleRunUpdate:m,renderBanner:p,getPreferences:h,setRerender:a,dispose:f}}function rn(e,t){return e.archived_at?(t||Date.now())-new Date(e.archived_at).getTime()>7776e6:!1}function td(e={}){let t={activeRunId:e.activeRunId??null,projectName:e.projectName??"",currentProjectId:e.currentProjectId??null,projects:e.projects??[],runs:e.runs??{},archivedRuns:e.archivedRuns??{},pipelines:e.pipelines??{},logLines:e.logLines??[],preferences:{theme:e.preferences?.theme??"light",sidebarCollapsed:e.preferences?.sidebarCollapsed??!1,notifications:e.preferences?.notifications??null},beads:e.beads??{issues:[],dbExists:!1,loading:!1},webhookInbox:e.webhookInbox??{events:[],controlAction:"continue"},runsLoaded:e.runsLoaded??!1,addProjectDialogOpen:e.addProjectDialogOpen??!1},s=new Set;function i(){for(let r of Array.from(s))try{r(t)}catch{}}return{getState(){return t},setState(r){let o={...t,...r,preferences:{...t.preferences,...r.preferences||{}}};o.activeRunId===t.activeRunId&&o.projectName===t.projectName&&o.currentProjectId===t.currentProjectId&&o.projects===t.projects&&o.runs===t.runs&&o.archivedRuns===t.archivedRuns&&o.pipelines===t.pipelines&&o.logLines===t.logLines&&o.preferences.theme===t.preferences.theme&&o.preferences.sidebarCollapsed===t.preferences.sidebarCollapsed&&o.preferences.notifications===t.preferences.notifications&&o.beads===t.beads&&o.webhookInbox===t.webhookInbox&&o.addProjectDialogOpen===t.addProjectDialogOpen||(t=o,i())},setRun(r,o){if(o.archived===!0){let n={...t.archivedRuns,[r]:o};if(r in t.runs){let a={...t.runs};delete a[r],t={...t,runs:a,archivedRuns:n}}else t={...t,archivedRuns:n}}else{let a=!(r in t.runs)&&!(r in t.archivedRuns)?{...o,_addedAt:Date.now()}:o,c={...t.runs,[r]:a};if(r in t.archivedRuns){let l={...t.archivedRuns};delete l[r],t={...t,runs:c,archivedRuns:l}}else t={...t,runs:c}}i()},setRunsBulk(r){let o={},n={},a=Date.now();for(let c of r)if(c.archived===!0){if(rn(c,a))continue;n[c.id]=c}else o[c.id]=c;for(let[c,l]of Object.entries(t.runs))l._addedAt&&a-l._addedAt<5e3&&!(c in o)&&(o[c]=l);t={...t,runs:o,archivedRuns:n,runsLoaded:!0},i()},getRunById(r){return t.runs[r]??t.archivedRuns[r]},appendLog(r){let o=[...t.logLines,r];o.length>5e3&&o.splice(0,o.length-5e3),t={...t,logLines:o},i()},clearLog(){t={...t,logLines:[]},i()},subscribe(r){return s.add(r),()=>s.delete(r)}}}function sd({showConfirm:e,showActionError:t,projectUrl:s,store:i,rerender:r,fetchFn:o=fetch}){function n(c){e({label:"Archive Pipeline Run",message:"This run will be hidden from the dashboard and history. You can find it later using the 'archived' filter.",confirmLabel:"Archive",confirmVariant:"danger",onConfirm:async()=>{try{let h=await(await o(s(`/runs/${c}/archive`),{method:"POST"})).json();if(!h.ok){t(h.error||"Failed to archive run");return}let d=i.getRunById(c);d&&i.setRun(c,{...d,archived:!0,archived_at:new Date().toISOString()})}catch(l){t(l?.message||"Failed to archive run")}}},r)}async function a(c){try{let h=await(await o(s(`/runs/${c}/unarchive`),{method:"POST"})).json();if(!h.ok){t(h.error||"Failed to unarchive run");return}let d=i.getRunById(c);if(d){let{archived:m,archived_at:p,...f}=d;i.setRun(c,f)}}catch(l){t(l?.message||"Failed to unarchive run")}}return{archiveRun:n,unarchiveRun:a}}var on=null;function At({label:e,message:t,confirmLabel:s,confirmVariant:i="danger",cancelLabel:r,onConfirm:o,onCancel:n},a){on={label:e,message:t,confirmLabel:s,confirmVariant:i,cancelLabel:r,onConfirm:o,onCancel:n},a(),requestAnimationFrame(()=>{document.getElementById("global-confirm-dialog")?.show()})}function za(e){let t=document.getElementById("global-confirm-dialog");t&&t.hide();let s=e;on=null,s?.()}function Ir(){if(!on)return C;let{label:e,message:t,confirmLabel:s,confirmVariant:i,cancelLabel:r,onConfirm:o,onCancel:n}=on;return u`
82
+ <sl-dialog id="global-confirm-dialog" label=${e} @sl-after-hide=${()=>za(n)}>
83
83
  ${typeof t=="string"?u`<p>${t}</p>`:t}
84
84
  <div slot="footer" style="display:flex; justify-content:center; gap:0.75rem; width:100%">
85
- <sl-button variant="default" autofocus @click=${()=>Ha(n)}>${r||"Cancel"}</sl-button>
86
- <sl-button variant=${i} @click=${()=>Ha(o)}>${s}</sl-button>
85
+ <sl-button variant="default" autofocus @click=${()=>za(n)}>${r||"Cancel"}</sl-button>
86
+ <sl-button variant=${i} @click=${()=>za(o)}>${s}</sl-button>
87
87
  </div>
88
88
  </sl-dialog>
89
- `}var mi=[["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"}]];var Wa=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}],["path",{d:"M10 12h4"}]];var ja=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];var Va=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];var Ua=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"}]];var qa=[["path",{d:"m9 18 6-6-6-6"}]];var gs=[["circle",{cx:"12",cy:"12",r:"10"}]];var _s=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];var vs=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];var zr=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9"}]];var ze=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var Wt=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];var Rt=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48"}],["path",{d:"M15 6h1v4"}],["path",{d:"m6.134 14.768.866-.5 2 3.464"}],["circle",{cx:"16",cy:"8",r:"6"}]];var qi=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];var Ka=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]];var Nr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];var Fr=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];var Hr=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];var Ga=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];var Ya=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}],["path",{d:"M9 18h6"}],["path",{d:"M10 22h4"}]];var Ki=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];var De=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];var Xa=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];var rt=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];var bs=[["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"}]];var Zt=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];var Pe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];var Ja=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];var Wr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];var ys=[["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"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]];var Fs=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var jr=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Za=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}]];var Qa=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];var Hs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];var el=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]];var Vr=[["line",{x1:"10",x2:"14",y1:"2",y2:"2"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11"}],["circle",{cx:"12",cy:"14",r:"8"}]];var gi=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var Gi=[["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"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];var an=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];var Yi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var pt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];function Kg(e){return e.map(([t,s])=>{let i=Object.entries(s).map(([r,o])=>`${r}="${o}"`).join(" ");return`<${t} ${i}/>`}).join("")}function R(e,t=16,s=""){let i=s?` class="${s}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"${i}>${Kg(e)}</svg>`}function yt(e){return[...e].sort((t,s)=>{let i=t.started_at||"",r=s.started_at||"";return!i&&!r?0:i?r?r.localeCompare(i):-1:1})}var Gg={pending:"status-pending",running:"status-running",paused:"status-paused",completed:"status-completed",failed:"status-failed",resuming:"status-resuming",skipped:"status-skipped",in_progress:"status-in-progress",error:"status-error",interrupted:"status-interrupted"},Yg={pending:gs,running:De,paused:rt,completed:vs,failed:_s,resuming:Wr,skipped:zr,in_progress:De,error:_s,interrupted:rt};function Xi(e,t){return e==="in_progress"&&t===!1?"interrupted":e}function Ji(e){return Gg[e]||"status-unknown"}function jt(e,t=14){let s=Yg[e];return s?R(s,t,e==="in_progress"||e==="running"||e==="resuming"?"icon-spin":""):"?"}function Ur(e){document.documentElement.setAttribute("data-theme",e),document.documentElement.classList.toggle("sl-theme-dark",e==="dark")}function id(e){return e?`${e} \u2014 worca`:"worca"}var ln="",tl=!1;function _i(e){ln=e;let t=document.getElementById("add-project-error");t&&(t.textContent=e,t.style.display=e?"block":"none")}function rd(e,{onProjectAdd:t,onClose:s,rerender:i}){let{addProjectDialogOpen:r}=e;if(!r)return C;function o(d){d.preventDefault();let m=document.getElementById("add-project-name"),p=document.getElementById("add-project-path"),f=m?.value?.trim()||"",_=p?.value?.trim()||"";if(!f){_i("Name is required");return}if(!_||!_.startsWith("/")){_i("Path must be an absolute path");return}let S=_.replace(/\/+$/,""),x=(e.projects||[]).find(v=>(v.path||"").replace(/\/+$/,"")===S);if(x){_i(`A project with this path already exists: "${x.name}"`);return}_i(""),fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f,path:_})}).then(v=>v.json()).then(v=>{v.ok?(_i(""),t?.(v.project),Xg(f,i)):_i(v.error||"Failed to add project")}).catch(v=>{_i(v.message||"Network error")})}function n(d){if(tl)return;let m=document.getElementById("add-project-name");if(!m)return;let p=d.replace(/\/+$/,"").split("/"),_=(p[p.length-1]||"").toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/^-+/,"").replace(/-+$/,"");m.value=_}function a(d){n(d.target.value||"")}function c(){tl=!0}async function l(){try{let m=await(await fetch("/api/choose-directory",{method:"POST"})).json();if(m.ok&&m.path){let p=document.getElementById("add-project-path");p&&(p.value=m.path),n(m.path)}}catch{}}function h(d){d.target.isConnected&&(ln="",tl=!1,s?.())}return u`
89
+ `}var mi=[["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"}]];var Na=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}],["path",{d:"M10 12h4"}]];var Fa=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];var Ha=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];var Wa=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"}]];var gs=[["circle",{cx:"12",cy:"12",r:"10"}]];var _s=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];var vs=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];var zr=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9"}]];var ze=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var Wt=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];var Rt=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48"}],["path",{d:"M15 6h1v4"}],["path",{d:"m6.134 14.768.866-.5 2 3.464"}],["circle",{cx:"16",cy:"8",r:"6"}]];var qi=[["path",{d:"M12 20v2"}],["path",{d:"M12 2v2"}],["path",{d:"M17 20v2"}],["path",{d:"M17 2v2"}],["path",{d:"M2 12h2"}],["path",{d:"M2 17h2"}],["path",{d:"M2 7h2"}],["path",{d:"M20 12h2"}],["path",{d:"M20 17h2"}],["path",{d:"M20 7h2"}],["path",{d:"M7 20v2"}],["path",{d:"M7 2v2"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1"}]];var ja=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]];var Nr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];var Fr=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];var Va=[["path",{d:"M15 6a9 9 0 0 0-9 9V3"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}]];var Ua=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];var qa=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}],["path",{d:"M9 18h6"}],["path",{d:"M10 22h4"}]];var Ki=[["path",{d:"M3 5h.01"}],["path",{d:"M3 12h.01"}],["path",{d:"M3 19h.01"}],["path",{d:"M8 5h13"}],["path",{d:"M8 12h13"}],["path",{d:"M8 19h13"}]];var De=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];var Ka=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];var rt=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];var bs=[["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"}]];var Zt=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];var Pe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];var Ga=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]];var Hr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];var ys=[["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"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]];var Fs=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Wr=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Ya=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}]];var Xa=[["path",{d:"M10 5H3"}],["path",{d:"M12 19H3"}],["path",{d:"M14 3v4"}],["path",{d:"M16 17v4"}],["path",{d:"M21 12h-9"}],["path",{d:"M21 19h-5"}],["path",{d:"M21 5h-7"}],["path",{d:"M8 10v4"}],["path",{d:"M8 12H3"}]];var Hs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];var Ja=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]];var jr=[["line",{x1:"10",x2:"14",y1:"2",y2:"2"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11"}],["circle",{cx:"12",cy:"14",r:"8"}]];var gi=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var Gi=[["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"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];var Za=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}],["circle",{cx:"9",cy:"7",r:"4"}]];var Qa=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]];var Yi=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var pt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];function Kg(e){return e.map(([t,s])=>{let i=Object.entries(s).map(([r,o])=>`${r}="${o}"`).join(" ");return`<${t} ${i}/>`}).join("")}function R(e,t=16,s=""){let i=s?` class="${s}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"${i}>${Kg(e)}</svg>`}function yt(e){return[...e].sort((t,s)=>{let i=t.started_at||"",r=s.started_at||"";return!i&&!r?0:i?r?r.localeCompare(i):-1:1})}var Gg={pending:"status-pending",running:"status-running",paused:"status-paused",completed:"status-completed",failed:"status-failed",resuming:"status-resuming",skipped:"status-skipped",in_progress:"status-in-progress",error:"status-error",interrupted:"status-interrupted"},Yg={pending:gs,running:De,paused:rt,completed:vs,failed:_s,resuming:Hr,skipped:zr,in_progress:De,error:_s,interrupted:rt};function Xi(e,t){return e==="in_progress"&&t===!1?"interrupted":e}function Ji(e){return Gg[e]||"status-unknown"}function jt(e,t=14){let s=Yg[e];return s?R(s,t,e==="in_progress"||e==="running"||e==="resuming"?"icon-spin":""):"?"}function Vr(e){document.documentElement.setAttribute("data-theme",e),document.documentElement.classList.toggle("sl-theme-dark",e==="dark")}function id(e){return e?`${e} \u2014 worca`:"worca"}var nn="",el=!1;function _i(e){nn=e;let t=document.getElementById("add-project-error");t&&(t.textContent=e,t.style.display=e?"block":"none")}function rd(e,{onProjectAdd:t,onClose:s,rerender:i}){let{addProjectDialogOpen:r}=e;if(!r)return C;function o(d){d.preventDefault();let m=document.getElementById("add-project-name"),p=document.getElementById("add-project-path"),f=m?.value?.trim()||"",_=p?.value?.trim()||"";if(!f){_i("Name is required");return}if(!_||!_.startsWith("/")){_i("Path must be an absolute path");return}let S=_.replace(/\/+$/,""),x=(e.projects||[]).find(v=>(v.path||"").replace(/\/+$/,"")===S);if(x){_i(`A project with this path already exists: "${x.name}"`);return}_i(""),fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f,path:_})}).then(v=>v.json()).then(v=>{v.ok?(_i(""),t?.(v.project),Xg(f,i)):_i(v.error||"Failed to add project")}).catch(v=>{_i(v.message||"Network error")})}function n(d){if(el)return;let m=document.getElementById("add-project-name");if(!m)return;let p=d.replace(/\/+$/,"").split("/"),_=(p[p.length-1]||"").toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/^-+/,"").replace(/-+$/,"");m.value=_}function a(d){n(d.target.value||"")}function c(){el=!0}async function l(){try{let m=await(await fetch("/api/choose-directory",{method:"POST"})).json();if(m.ok&&m.path){let p=document.getElementById("add-project-path");p&&(p.value=m.path),n(m.path)}}catch{}}function h(d){d.target.isConnected&&(nn="",el=!1,s?.())}return u`
90
90
  <sl-dialog
91
91
  label="Add Project"
92
92
  open
@@ -104,7 +104,7 @@ ${h.join(`
104
104
  @sl-input=${a}
105
105
  ></sl-input>
106
106
  <sl-button size="medium" @click=${l} title="Browse…" style="--sl-input-height-medium:100%">
107
- ${k(R(Fr,16))}
107
+ ${T(R(Fr,16))}
108
108
  </sl-button>
109
109
  </div>
110
110
  </div>
@@ -120,21 +120,21 @@ ${h.join(`
120
120
  </div>
121
121
  <div
122
122
  id="add-project-error"
123
- style="color: var(--status-failed); font-size: 0.85rem; margin-bottom: 12px; display: ${ln?"block":"none"};"
124
- >${ln}</div>
123
+ style="color: var(--status-failed); font-size: 0.85rem; margin-bottom: 12px; display: ${nn?"block":"none"};"
124
+ >${nn}</div>
125
125
  <div slot="footer" style="display:flex; justify-content:center; gap:0.75rem; width:100%">
126
126
  <sl-button autofocus @click=${h}>Cancel</sl-button>
127
127
  <sl-button variant="primary" @click=${o}>Add Project</sl-button>
128
128
  </div>
129
129
  </form>
130
130
  </sl-dialog>
131
- `}function Xg(e,t){t&&fetch(`/api/projects/${e}/worca-status`).then(s=>s.json()).then(s=>{if(!s.ok)return;let i=s.installed,r=i?"Update Worca":"Install Worca",o=i?`Update worca in "${e}" with the latest pipeline files?`:`Install worca pipeline in "${e}"?`;At({label:r,message:o,confirmLabel:"Yes",cancelLabel:"No",confirmVariant:"primary",onConfirm:()=>{fetch(`/api/projects/${e}/worca-setup`,{method:"POST"}).catch(()=>{})}},t)}).catch(()=>{})}function ye(e){let t=Math.floor(e/1e3),s=Math.floor(t/3600),i=Math.floor(t%3600/60),r=t%60;return s>0?`${s}h ${i}m ${r}s`:i>0?`${i}m ${r}s`:`${r}s`}function Je(e,t){let s=new Date(e).getTime();return(t?new Date(t).getTime():Date.now())-s}function ft(e){if(!e)return"N/A";let t=new Date(e),s=i=>String(i).padStart(2,"0");return`${t.getFullYear()}.${s(t.getMonth()+1)}.${s(t.getDate())} ${s(t.getHours())}:${s(t.getMinutes())}`}var wt=["preflight","plan","plan_review","coordinate","implement","test","review","pr","learn"],yk=["orchestrator",...wt];function cn(e){return[...e].sort(([t],[s])=>{let i=wt.indexOf(t),r=wt.indexOf(s);return(i===-1?999:i)-(r===-1?999:r)})}function od(e){return[...e].sort((t,s)=>{let i=wt.indexOf(t),r=wt.indexOf(s);return(i===-1?999:i)-(r===-1?999:r)})}function Jg(e){return Object.entries(e).sort(([s],[i])=>{let r=wt.indexOf(s),o=wt.indexOf(i);return(r===-1?999:r)-(o===-1?999:o)})}var Zg={completed:"success",in_progress:"warning",error:"danger",interrupted:"warning",pending:"neutral"};function Qg(e,t){let s=e.status_changed_at||(t==="completed"||t==="failed"?e.completed_at:null)||e.started_at;if(!s)return null;let i=Je(s,null),r=ye(i);return t==="running"||t==="resuming"?`Running for ${r}`:`${t.charAt(0).toUpperCase()+t.slice(1)} ${r} ago`}function e_(e){if(!e)return null;let t=null;for(let s of Object.values(e))s.completed_at&&(!t||s.completed_at>t)&&(t=s.completed_at);return t}function t_(e){let t=0;for(let s of Object.values(e.stages||{}))for(let i of s.iterations||[])t+=i.cost_usd||0;return t}function nd(e){return e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Vt(e,{onClick:t,beadsCount:s,onPause:i,onResume:r,onArchive:o,onUnarchive:n}={}){let a=e.work_request?.title||"Untitled",c=e.active,l=e.pipeline_status||(c?"running":e.stage==="error"?"failed":"completed"),h=Qg(e,l),d=e.completed_at||(c?null:e_(e.stages)),m=e.started_at&&c?ye(Je(e.started_at,null)):e.started_at&&d?ye(Je(e.started_at,d)):"N/A",p=e.branch||e.work_request?.branch||"",f=e.stages?Jg(e.stages):[],_=t_(e),S=i&&(l==="running"||l==="resuming")?u`
131
+ `}function Xg(e,t){t&&fetch(`/api/projects/${e}/worca-status`).then(s=>s.json()).then(s=>{if(!s.ok)return;let i=s.installed,r=i?"Update Worca":"Install Worca",o=i?`Update worca in "${e}" with the latest pipeline files?`:`Install worca pipeline in "${e}"?`;At({label:r,message:o,confirmLabel:"Yes",cancelLabel:"No",confirmVariant:"primary",onConfirm:()=>{fetch(`/api/projects/${e}/worca-setup`,{method:"POST"}).catch(()=>{})}},t)}).catch(()=>{})}function ye(e){let t=Math.floor(e/1e3),s=Math.floor(t/3600),i=Math.floor(t%3600/60),r=t%60;return s>0?`${s}h ${i}m ${r}s`:i>0?`${i}m ${r}s`:`${r}s`}function Je(e,t){let s=new Date(e).getTime();return(t?new Date(t).getTime():Date.now())-s}function ft(e){if(!e)return"N/A";let t=new Date(e),s=i=>String(i).padStart(2,"0");return`${t.getFullYear()}.${s(t.getMonth()+1)}.${s(t.getDate())} ${s(t.getHours())}:${s(t.getMinutes())}`}var wt=["preflight","plan","plan_review","coordinate","implement","test","review","pr","learn"],yk=["orchestrator",...wt];function an(e){return[...e].sort(([t],[s])=>{let i=wt.indexOf(t),r=wt.indexOf(s);return(i===-1?999:i)-(r===-1?999:r)})}function od(e){return[...e].sort((t,s)=>{let i=wt.indexOf(t),r=wt.indexOf(s);return(i===-1?999:i)-(r===-1?999:r)})}function Jg(e){return Object.entries(e).sort(([s],[i])=>{let r=wt.indexOf(s),o=wt.indexOf(i);return(r===-1?999:r)-(o===-1?999:o)})}var Zg={completed:"success",in_progress:"warning",error:"danger",interrupted:"warning",pending:"neutral"};function Qg(e,t){let s=e.status_changed_at||(t==="completed"||t==="failed"?e.completed_at:null)||e.started_at;if(!s)return null;let i=Je(s,null),r=ye(i);return t==="running"||t==="resuming"?`Running for ${r}`:`${t.charAt(0).toUpperCase()+t.slice(1)} ${r} ago`}function e_(e){if(!e)return null;let t=null;for(let s of Object.values(e))s.completed_at&&(!t||s.completed_at>t)&&(t=s.completed_at);return t}function t_(e){let t=0;for(let s of Object.values(e.stages||{}))for(let i of s.iterations||[])t+=i.cost_usd||0;return t}function nd(e){return e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Vt(e,{onClick:t,beadsCount:s,onPause:i,onResume:r,onArchive:o,onUnarchive:n}={}){let a=e.work_request?.title||"Untitled",c=e.active,l=e.pipeline_status||(c?"running":e.stage==="error"?"failed":"completed"),h=Qg(e,l),d=e.completed_at||(c?null:e_(e.stages)),m=e.started_at&&c?ye(Je(e.started_at,null)):e.started_at&&d?ye(Je(e.started_at,d)):"N/A",p=e.branch||e.work_request?.branch||"",f=e.stages?Jg(e.stages):[],_=t_(e),S=i&&(l==="running"||l==="resuming")?u`
132
132
  <div class="run-card-actions">
133
133
  <sl-button size="small" variant="warning" outline class="btn-quick-pause" @click=${A=>{A.stopPropagation(),i(e.id)}}>
134
- ${k(R(rt,12))} Pause
134
+ ${T(R(rt,12))} Pause
135
135
  </sl-button>
136
136
  </div>
137
- `:C,$=r&&(l==="paused"||l==="failed")?u`
137
+ `:C,k=r&&(l==="paused"||l==="failed")?u`
138
138
  <div class="run-card-actions">
139
139
  <button class="btn-quick-resume" @click=${A=>{A.stopPropagation(),r(e.id)}}>
140
140
  Resume
@@ -155,7 +155,7 @@ ${h.join(`
155
155
  `:C,y=e.pipeline_template?e.pipeline_template.startsWith("builtin:")?`worca:${e.pipeline_template.slice(8)}`:e.pipeline_template:null;return u`
156
156
  <div class="run-card ${Ji(l)}" @click=${t?()=>t(e.id):null}>
157
157
  <div class="run-card-top">
158
- ${h?u`<span class="run-card-status" title=${h}>${k(jt(l,16))}</span>`:u`<span class="run-card-status">${k(jt(l,16))}</span>`}
158
+ ${h?u`<span class="run-card-status" title=${h}>${T(jt(l,16))}</span>`:u`<span class="run-card-status">${T(jt(l,16))}</span>`}
159
159
  <span class="run-card-title">${a}</span>
160
160
  </div>
161
161
  ${p?u`<div class="run-card-meta"><span class="run-card-meta-item"><span class="meta-label">Branch:</span> <span class="meta-value">${p}</span></span></div>`:C}
@@ -177,11 +177,11 @@ ${h.join(`
177
177
  </div>
178
178
  `:C}
179
179
  ${S}
180
- ${$}
180
+ ${k}
181
181
  ${x}
182
182
  ${v}
183
183
  </div>
184
- `}function hn(e){return e===0||e===1?"danger":e===2?"warning":"neutral"}function sl(e,t=null){return t?.blocked_by&&t.blocked_by.length>0?"warning":e==="open"?"success":e==="in_progress"?"primary":"neutral"}function ld(e){return e.status==="closed"?"closed":e.blocked_by&&e.blocked_by.length>0?"blocked":e.status}var ad={open:{icon:gs,color:"var(--status-completed)"},in_progress:{icon:De,color:"var(--status-in-progress)"},closed:{icon:vs,color:"var(--status-completed)"},blocked:{icon:Xa,color:"var(--status-blocked)"}};function s_(e,t){let s=t.get(e);if(!s)return R(gs,10);let i=ld(s),r=ad[i]||ad.open,o=i==="in_progress"?"icon-spin":"";return`<span style="color:${r.color};display:inline-flex">${R(r.icon,10,o)}</span>`}function i_(e){let t=new Set(e.map(r=>r.id)),s=new Map(e.map(r=>[r.id,0])),i=!0;for(;i;){i=!1;for(let r of e)for(let o of r.depends_on){if(!t.has(o))continue;let n=(s.get(o)??0)+1;n>s.get(r.id)&&(s.set(r.id,n),i=!0)}}return s}function cd(e){if(!e||e.length===0)return{svg:"",nodes:[]};let t=140,s=40,i=60,r=24,o=16,n=new Map(e.map(x=>[x.id,x])),a=i_(e),c=Math.max(...a.values(),0),l=new Map;for(let x of e){let v=a.get(x.id)??0;l.has(v)||l.set(v,[]),l.get(v).push(x)}let h=Math.max(...[...l.values()].map(x=>x.length),1),d=Math.round(o*2+(c+1)*(t+i)),m=Math.round(o*2+h*(s+r)),p=new Map;for(let[x,v]of l)for(let y=0;y<v.length;y++)p.set(v[y].id,{x:Math.round(o+x*(t+i)),y:Math.round(o+y*(s+r))});let f="";for(let x of e){let v=p.get(x.id);if(v)for(let y of x.depends_on){let A=p.get(y);if(!A)continue;let M=A.x+t,H=A.y+s/2,q=v.x,ee=v.y+s/2,ce=Math.round((M+q)/2),V=n.get(y),ve=V&&V.status==="closed";f+=`<path class="${ve?"beads-graph-edge beads-graph-edge--satisfied":"beads-graph-edge beads-graph-edge--blocking"}" d="M${M},${H} C${ce},${H} ${ce},${ee} ${q},${ee}" marker-end="${ve?"url(#beads-arrow-satisfied)":"url(#beads-arrow-blocking)"}"/>`}}let _="",S=[];for(let x of e){let v=p.get(x.id);if(!v)continue;let y=ld(x),A=x.title||"",M=A.length>18?`${A.slice(0,18)}...`:A;_+=`<g class="beads-graph-node beads-graph-node--${y}" transform="translate(${v.x},${v.y})">
184
+ `}function ln(e){return e===0||e===1?"danger":e===2?"warning":"neutral"}function tl(e,t=null){return t?.blocked_by&&t.blocked_by.length>0?"warning":e==="open"?"success":e==="in_progress"?"primary":"neutral"}function ld(e){return e.status==="closed"?"closed":e.blocked_by&&e.blocked_by.length>0?"blocked":e.status}var ad={open:{icon:gs,color:"var(--status-completed)"},in_progress:{icon:De,color:"var(--status-in-progress)"},closed:{icon:vs,color:"var(--status-completed)"},blocked:{icon:Ka,color:"var(--status-blocked)"}};function s_(e,t){let s=t.get(e);if(!s)return R(gs,10);let i=ld(s),r=ad[i]||ad.open,o=i==="in_progress"?"icon-spin":"";return`<span style="color:${r.color};display:inline-flex">${R(r.icon,10,o)}</span>`}function i_(e){let t=new Set(e.map(r=>r.id)),s=new Map(e.map(r=>[r.id,0])),i=!0;for(;i;){i=!1;for(let r of e)for(let o of r.depends_on){if(!t.has(o))continue;let n=(s.get(o)??0)+1;n>s.get(r.id)&&(s.set(r.id,n),i=!0)}}return s}function cd(e){if(!e||e.length===0)return{svg:"",nodes:[]};let t=140,s=40,i=60,r=24,o=16,n=new Map(e.map(x=>[x.id,x])),a=i_(e),c=Math.max(...a.values(),0),l=new Map;for(let x of e){let v=a.get(x.id)??0;l.has(v)||l.set(v,[]),l.get(v).push(x)}let h=Math.max(...[...l.values()].map(x=>x.length),1),d=Math.round(o*2+(c+1)*(t+i)),m=Math.round(o*2+h*(s+r)),p=new Map;for(let[x,v]of l)for(let y=0;y<v.length;y++)p.set(v[y].id,{x:Math.round(o+x*(t+i)),y:Math.round(o+y*(s+r))});let f="";for(let x of e){let v=p.get(x.id);if(v)for(let y of x.depends_on){let A=p.get(y);if(!A)continue;let M=A.x+t,H=A.y+s/2,q=v.x,ee=v.y+s/2,ce=Math.round((M+q)/2),V=n.get(y),ve=V&&V.status==="closed";f+=`<path class="${ve?"beads-graph-edge beads-graph-edge--satisfied":"beads-graph-edge beads-graph-edge--blocking"}" d="M${M},${H} C${ce},${H} ${ce},${ee} ${q},${ee}" marker-end="${ve?"url(#beads-arrow-satisfied)":"url(#beads-arrow-blocking)"}"/>`}}let _="",S=[];for(let x of e){let v=p.get(x.id);if(!v)continue;let y=ld(x),A=x.title||"",M=A.length>18?`${A.slice(0,18)}...`:A;_+=`<g class="beads-graph-node beads-graph-node--${y}" transform="translate(${v.x},${v.y})">
185
185
  <rect width="${t}" height="${s}" rx="6"/>
186
186
  <text x="8" y="14" class="beads-graph-node-id">#${x.id}</text>
187
187
  <text x="8" y="28">${r_(M)}</text>
@@ -201,13 +201,13 @@ ${h.join(`
201
201
  **Title:** ${e.title}`,e.body&&(t+=`
202
202
 
203
203
  **Description:**
204
- ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget;navigator.clipboard.writeText(o_(e)).then(()=>{i.textContent="Copied!",setTimeout(()=>{i.textContent="Copy"},1500)})};return u`
204
+ ${e.body}`),t}function cn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget;navigator.clipboard.writeText(o_(e)).then(()=>{i.textContent="Copied!",setTimeout(()=>{i.textContent="Copy"},1500)})};return u`
205
205
  <div class="bead-tooltip-content">
206
206
  <div class="bead-tooltip-header">
207
207
  <span class="bead-tooltip-id">Bead ID: ${e.id}</span>
208
208
  <span class="bead-tooltip-badges">
209
- <sl-badge variant="${hn(e.priority)}" pill>P${e.priority}</sl-badge>
210
- <sl-badge variant="${sl(e.status,e)}" pill>${e.status}</sl-badge>
209
+ <sl-badge variant="${ln(e.priority)}" pill>P${e.priority}</sl-badge>
210
+ <sl-badge variant="${tl(e.status,e)}" pill>${e.status}</sl-badge>
211
211
  ${e.blocked_by&&e.blocked_by.length>0?u`<sl-badge variant="warning" pill>blocked</sl-badge>`:""}
212
212
  </span>
213
213
  </div>
@@ -216,7 +216,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
216
216
  <div class="bead-tooltip-title">${e.title}</div>
217
217
  ${e.body?u`<div class="bead-tooltip-label">Description:</div><div class="bead-tooltip-excerpt">${e.body}</div>`:""}
218
218
  <div class="bead-tooltip-footer">
219
- <button class="bead-tooltip-copy" @click=${t}>${k(R(ze,12))} Copy</button>
219
+ <button class="bead-tooltip-copy" @click=${t}>${T(R(ze,12))} Copy</button>
220
220
  </div>
221
221
  </div>
222
222
  `}function hd(e,{onSelectRun:t,beadsCounts:s={}}){let i=e||[],r=yt(i.filter(a=>a.active)),o=yt(i.filter(a=>!a.active)),n=[...r,...o];return n.length===0?u`<div class="empty-state">No pipeline runs yet.</div>`:u`
@@ -236,10 +236,10 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
236
236
  `:""}
237
237
  ${n.items.map(a=>{let c=a.blocked_by&&a.blocked_by.length>0;return u`
238
238
  <sl-tooltip class="bead-tooltip" hoist placement="bottom" distance="4">
239
- <div slot="content">${dn(a)}</div>
239
+ <div slot="content">${cn(a)}</div>
240
240
  <div class="beads-kanban-card ${c?"beads-kanban-card--blocked":a.status==="in_progress"?"beads-kanban-card--in_progress":""}">
241
241
  <div class="beads-kanban-card-header">
242
- <sl-badge variant="${hn(a.priority)}" pill>P${a.priority}</sl-badge>
242
+ <sl-badge variant="${ln(a.priority)}" pill>P${a.priority}</sl-badge>
243
243
  <span class="beads-kanban-card-id">#${a.id}</span>
244
244
  </div>
245
245
  <div class="beads-kanban-card-title">${a.title}</div>
@@ -247,7 +247,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
247
247
  <div class="beads-kanban-card-deps">
248
248
  ${a.blocked_by.map(l=>u`
249
249
  <span class="beads-dep-chip beads-dep-chip--blocking">
250
- ${k(s_(l,i))}
250
+ ${T(s_(l,i))}
251
251
  #${l}
252
252
  </span>
253
253
  `)}
@@ -259,17 +259,17 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
259
259
  </div>
260
260
  `)}
261
261
  </div>
262
- `}function dd(e,{statusFilter:t,priorityFilter:s,starting:i,startError:r,onStatusFilter:o,onPriorityFilter:n,onStartIssue:a,onDismissError:c,loading:l=!1,run:h,runId:d}){if(l)return u`<div class="empty-state">Loading issues...</div>`;let m=e||[],p=m;t!=="all"&&(p=p.filter(v=>v.status===t)),s!=="all"&&(p=p.filter(v=>String(v.priority)===s));let f=h?.branch||h?.work_request?.branch||"",_=d||h?.run_id||"",S=h?.pr_url||null,$=f||_?u`
262
+ `}function dd(e,{statusFilter:t,priorityFilter:s,starting:i,startError:r,onStatusFilter:o,onPriorityFilter:n,onStartIssue:a,onDismissError:c,loading:l=!1,run:h,runId:d}){if(l)return u`<div class="empty-state">Loading issues...</div>`;let m=e||[],p=m;t!=="all"&&(p=p.filter(v=>v.status===t)),s!=="all"&&(p=p.filter(v=>String(v.priority)===s));let f=h?.branch||h?.work_request?.branch||"",_=d||h?.run_id||"",S=h?.pr_url||null,k=f||_?u`
263
263
  <div class="run-info-section">
264
264
  ${_?u`
265
265
  <div class="run-branch">
266
- <span class="stage-meta-icon">${k(R(Ga,14))}</span>
266
+ <span class="stage-meta-icon">${T(R(Ua,14))}</span>
267
267
  <span>Run ${_}</span>
268
268
  </div>
269
269
  `:C}
270
270
  ${f?u`
271
271
  <div class="run-branch">
272
- <span class="stage-meta-icon">${k(R(Hr,14))}</span>
272
+ <span class="stage-meta-icon">${T(R(Va,14))}</span>
273
273
  <span>${f}</span>
274
274
  ${S?u`<a class="run-pr-link" href="${S}" target="_blank">View PR</a>`:C}
275
275
  </div>
@@ -295,13 +295,13 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
295
295
  </div>
296
296
  `;return p.length===0?u`
297
297
  <div class="beads-panel">
298
- ${$}
298
+ ${k}
299
299
  ${x}
300
300
  <div class="empty-state">${m.length===0?"No issues found for this run.":"No issues match the current filters."}</div>
301
301
  </div>
302
302
  `:u`
303
303
  <div class="beads-panel">
304
- ${$}
304
+ ${k}
305
305
  ${x}
306
306
  ${n_(p,{starting:i,onStartIssue:a})}
307
307
  ${r?u`
@@ -313,7 +313,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
313
313
  </sl-dialog>
314
314
  `:""}
315
315
  </div>
316
- `}function a_(e){let t=0;for(let s of e)for(let i of Object.values(s.stages||{}))for(let r of i.iterations||[])t+=r.cost_usd||0;return t}function l_(e){return e==null||e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function il(e,t){return e.filter(s=>t.includes(s.pipeline_status))}function c_(e,t,s){let i={},r={};for(let o of e)i[o.name]=0,r[o.name]=null;for(let o of t){let n=o.projectId||e[0]?.name;n&&i[n]!==void 0&&(o.active&&i[n]++,(!r[n]||(o.started_at||"")>(r[n].started_at||""))&&(r[n]=o))}return u`
316
+ `}function a_(e){let t=0;for(let s of e)for(let i of Object.values(s.stages||{}))for(let r of i.iterations||[])t+=r.cost_usd||0;return t}function l_(e){return e==null||e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function sl(e,t){return e.filter(s=>t.includes(s.pipeline_status))}function c_(e,t,s){let i={},r={};for(let o of e)i[o.name]=0,r[o.name]=null;for(let o of t){let n=o.projectId||e[0]?.name;n&&i[n]!==void 0&&(o.active&&i[n]++,(!r[n]||(o.started_at||"")>(r[n].started_at||""))&&(r[n]=o))}return u`
317
317
  <div class="project-cards">
318
318
  ${e.map(o=>{let n=i[o.name]||0,a=r[o.name],c=a?a.pipeline_status||"unknown":"no runs";return u`
319
319
  <div class="project-card" @click=${()=>s?.("active",null,o.name)}>
@@ -324,40 +324,40 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
324
324
  </div>
325
325
  `})}
326
326
  </div>
327
- `}function ud(e,{onSelectRun:t,onNavigate:s,onPause:i,onResume:r,onArchive:o}={}){let n=Object.values(e.runs),a=n.filter(M=>M.active),c=n.filter(M=>!M.active),l=n.filter(M=>(M.stages?Object.values(M.stages):[]).some(q=>q.status==="error")),h=n.length,d=a_(n),m=yt(a),p=yt(il(n,["paused"])),f=3,_=yt(il(n,["failed"])),S=_.slice(0,f),$=yt(il(n,["completed"])),x=$.slice(0,f),v=e.projects||[],y=e.currentProjectId,A=v.length>1&&!y;return u`
327
+ `}function ud(e,{onSelectRun:t,onNavigate:s,onPause:i,onResume:r,onArchive:o}={}){let n=Object.values(e.runs),a=n.filter(M=>M.active),c=n.filter(M=>!M.active),l=n.filter(M=>(M.stages?Object.values(M.stages):[]).some(q=>q.status==="error")),h=n.length,d=a_(n),m=yt(a),p=yt(sl(n,["paused"])),f=3,_=yt(sl(n,["failed"])),S=_.slice(0,f),k=yt(sl(n,["completed"])),x=k.slice(0,f),v=e.projects||[],y=e.currentProjectId,A=v.length>1&&!y;return u`
328
328
  <div class="dashboard">
329
329
  ${A?c_(v,n,s):C}
330
330
  <div class="dashboard-stats">
331
331
  <div class="stat-card stat-total">
332
- <div class="stat-icon-ring">${k(R(pt,20))}</div>
332
+ <div class="stat-icon-ring">${T(R(pt,20))}</div>
333
333
  <div class="stat-body">
334
334
  <span class="stat-number">${h}</span>
335
335
  <span class="stat-label">Total Runs</span>
336
336
  </div>
337
337
  </div>
338
338
  <div class="stat-card stat-active">
339
- <div class="stat-icon-ring">${k(R(mi,20))}</div>
339
+ <div class="stat-icon-ring">${T(R(mi,20))}</div>
340
340
  <div class="stat-body">
341
341
  <span class="stat-number">${a.length}</span>
342
342
  <span class="stat-label">Active</span>
343
343
  </div>
344
344
  </div>
345
345
  <div class="stat-card stat-completed">
346
- <div class="stat-icon-ring">${k(R(vs,20))}</div>
346
+ <div class="stat-icon-ring">${T(R(vs,20))}</div>
347
347
  <div class="stat-body">
348
348
  <span class="stat-number">${c.length}</span>
349
349
  <span class="stat-label">Completed</span>
350
350
  </div>
351
351
  </div>
352
352
  <div class="stat-card stat-errors">
353
- <div class="stat-icon-ring">${k(R(_s,20))}</div>
353
+ <div class="stat-icon-ring">${T(R(_s,20))}</div>
354
354
  <div class="stat-body">
355
355
  <span class="stat-number">${l.length}</span>
356
356
  <span class="stat-label">Errors</span>
357
357
  </div>
358
358
  </div>
359
359
  <div class="stat-card stat-cost-total" style="cursor:pointer" @click=${()=>s?.("costs")}>
360
- <div class="stat-icon-ring">${k(R(Rt,20))}</div>
360
+ <div class="stat-icon-ring">${T(R(Rt,20))}</div>
361
361
  <div class="stat-body">
362
362
  <span class="stat-number">${l_(d)}</span>
363
363
  <span class="stat-label">Total Cost</span>
@@ -403,8 +403,8 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
403
403
  ${x.length>0?u`
404
404
  <h3 class="dashboard-section-title">
405
405
  Recent Completed
406
- ${$.length>f?u`
407
- <a class="dashboard-view-all" @click=${()=>s?.("history",{statusFilter:"completed"})}>View all ${$.length}</a>
406
+ ${k.length>f?u`
407
+ <a class="dashboard-view-all" @click=${()=>s?.("history",{statusFilter:"completed"})}>View all ${k.length}</a>
408
408
  `:C}
409
409
  </h3>
410
410
  <div class="active-group active-group-completed">
@@ -414,7 +414,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
414
414
  </div>
415
415
  `:C}
416
416
  </div>
417
- `}function Ut(e){let t=e.target;if(!t)return;let s=t.closest(".main-content")||t.closest(".run-detail-layout__logs");if(!s){t.scrollIntoView({behavior:"smooth",block:"nearest"});return}let i=t.getBoundingClientRect(),r=s.getBoundingClientRect();if(i.bottom>r.bottom){let o=s.scrollTop+(i.top-r.top)-12;s.scrollTo({top:o,behavior:"smooth"})}}function h_(e){switch(e){case"critical":return"danger";case"high":return"warning";case"medium":return"primary";case"low":return"neutral";default:return"neutral"}}function un(e,t){let s=e?ye(Je(e,t||null)):"";return u`
417
+ `}function Ut(e){let t=e.target;if(!t)return;let s=t.closest(".main-content")||t.closest(".run-detail-layout__logs");if(!s){t.scrollIntoView({behavior:"smooth",block:"nearest"});return}let i=t.getBoundingClientRect(),r=s.getBoundingClientRect();if(i.bottom>r.bottom){let o=s.scrollTop+(i.top-r.top)-12;s.scrollTo({top:o,behavior:"smooth"})}}function h_(e){switch(e){case"critical":return"danger";case"high":return"warning";case"medium":return"primary";case"low":return"neutral";default:return"neutral"}}function hn(e,t){let s=e?ye(Je(e,t||null)):"";return u`
418
418
  <div class="timing-strip">
419
419
  ${e?u`<span class="timing-strip-item"><span class="meta-label">Started:</span> <span class="meta-value">${ft(e)}</span></span>`:C}
420
420
  ${t?u`<span class="timing-strip-item"><span class="meta-label">Finished:</span> <span class="meta-value">${ft(t)}</span></span>`:C}
@@ -462,7 +462,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
462
462
  <span>Description</span>
463
463
  <span>Evidence</span>
464
464
  <span class="col-center">Count</span>
465
- <span class="col-center">${k(R(pt,12))}</span>
465
+ <span class="col-center">${T(R(pt,12))}</span>
466
466
  </div>
467
467
  ${t.map(s=>u`
468
468
  <div class="learnings-table-row">
@@ -477,7 +477,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
477
477
  <span class="col-center">${s.occurrences||1}</span>
478
478
  <sl-tooltip content="Copy investigation prompt">
479
479
  <button class="learnings-copy-btn" @click=${i=>fd(d_(s),i.currentTarget)}>
480
- <span class="copy-icon">${k(R(ze,14))}</span>
480
+ <span class="copy-icon">${T(R(ze,14))}</span>
481
481
  </button>
482
482
  </sl-tooltip>
483
483
  </div>
@@ -490,7 +490,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
490
490
  <span>Target</span>
491
491
  <span>Suggestion</span>
492
492
  <span>Rationale</span>
493
- <span class="col-center">${k(R(pt,12))}</span>
493
+ <span class="col-center">${T(R(pt,12))}</span>
494
494
  </div>
495
495
  ${e.map(t=>u`
496
496
  <div class="learnings-table-row learnings-table-row--suggestions">
@@ -499,7 +499,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
499
499
  <span class="learnings-rationale">${t.rationale}</span>
500
500
  <sl-tooltip content="Copy implementation prompt">
501
501
  <button class="learnings-copy-btn" @click=${s=>fd(u_(t),s.currentTarget)}>
502
- <span class="copy-icon">${k(R(ze,14))}</span>
502
+ <span class="copy-icon">${T(R(ze,14))}</span>
503
503
  </button>
504
504
  </sl-tooltip>
505
505
  </div>
@@ -565,42 +565,42 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
565
565
  `}var v_=900*1e3;function md(e,t={}){let s=e?.status,i=e?.iterations?.[0]?.output,r=i?.observations,o=e?.error||e?.iterations?.[0]?.error,n=e?.started_at||e?.iterations?.[0]?.started_at,a=e?.completed_at||e?.iterations?.[0]?.completed_at,c;if(s==="in_progress"||s==="pending"){let m=n?new Date(n):null;(m?Date.now()-m.getTime():0)>v_?c=u`
566
566
  <div class="learnings-error">
567
567
  <div class="learnings-error-icon">
568
- ${k(R(Gi,20))}
568
+ ${T(R(Gi,20))}
569
569
  </div>
570
570
  <div class="learnings-error-text">
571
571
  <p class="learnings-error-title">Learning analysis appears to have stalled</p>
572
- ${un(n,null)}
572
+ ${hn(n,null)}
573
573
  </div>
574
574
  <sl-button variant="warning" size="small" @click=${t.onRunLearn}>
575
- ${k(R(Pe,14))} Retry
575
+ ${T(R(Pe,14))} Retry
576
576
  </sl-button>
577
577
  </div>
578
578
  `:c=u`
579
579
  <div class="learnings-in-progress">
580
580
  <div class="learnings-in-progress-spinner">
581
- ${k(R(De,20,"icon-spin"))}
581
+ ${T(R(De,20,"icon-spin"))}
582
582
  </div>
583
583
  <div class="learnings-in-progress-text">
584
584
  <p class="learnings-in-progress-title">Learning analysis in progress...</p>
585
- ${un(n,null)}
585
+ ${hn(n,null)}
586
586
  </div>
587
587
  </div>
588
588
  `}else if(s==="error")c=u`
589
589
  <div class="learnings-error">
590
590
  <div class="learnings-error-icon">
591
- ${k(R(Gi,20))}
591
+ ${T(R(Gi,20))}
592
592
  </div>
593
593
  <div class="learnings-error-text">
594
594
  <p class="learnings-error-title">Learning analysis failed</p>
595
595
  ${o?u`<p class="learnings-error-detail">${o}</p>`:C}
596
- ${un(n,a)}
596
+ ${hn(n,a)}
597
597
  </div>
598
598
  <sl-button variant="warning" size="small" @click=${t.onRunLearn}>
599
- ${k(R(Pe,14))} Retry Learning Analysis
599
+ ${T(R(Pe,14))} Retry Learning Analysis
600
600
  </sl-button>
601
601
  </div>
602
602
  `;else if(r){let m=e?.iterations?.[0],p=m?.turns,f=m?.cost_usd,_=m?.duration_api_ms,S=n&&a?Je(n,a):0;c=u`
603
- ${un(n,a)}
603
+ ${hn(n,a)}
604
604
  <div class="stage-info-strip">
605
605
  ${p?u`<span class="stage-info-item"><span class="meta-label">Turns:</span> <span class="meta-value">${p}</span></span>`:C}
606
606
  ${_?u`<span class="stage-info-item"><span class="meta-label">API Duration:</span> <span class="meta-value">${ye(_)}${S>0?` (${Math.round(_/S*100)}%)`:""}</span></span>`:C}
@@ -612,7 +612,7 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
612
612
  ${__(i.recurring_patterns)}
613
613
  <div class="learnings-rerun">
614
614
  <sl-button variant="text" size="small" @click=${t.onRunLearn}>
615
- ${k(R(Pe,12))} Re-run Analysis
615
+ ${T(R(Pe,12))} Re-run Analysis
616
616
  </sl-button>
617
617
  </div>
618
618
  `}else c=u`
@@ -626,11 +626,11 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
626
626
  <div class="learnings-section">
627
627
  <sl-details class="learnings-panel" ?open=${d} @sl-after-show=${Ut}>
628
628
  <div slot="summary" class="learnings-header">
629
- <span class="learnings-icon">${k(R(Ya,16))}</span>
629
+ <span class="learnings-icon">${T(R(qa,16))}</span>
630
630
  <span class="learnings-title">Learnings</span>
631
631
  ${d?u`
632
632
  <sl-badge variant="warning" pill>
633
- ${k(R(De,10,"icon-spin"))} Analyzing
633
+ ${T(R(De,10,"icon-spin"))} Analyzing
634
634
  </sl-badge>
635
635
  `:C}
636
636
  ${r?u`<span class="learnings-count">${h}</span>`:C}
@@ -640,20 +640,20 @@ ${e.body}`),t}function dn(e){let t=s=>{s.stopPropagation();let i=s.currentTarget
640
640
  </sl-details>
641
641
  </div>
642
642
  `}function b_(e){if(!e)return"";let t=e.buffer.active,s=[];for(let i=0;i<t.length;i++){let r=t.getLine(i);s.push(r?r.translateToString(!0):"")}for(;s.length>0&&s[s.length-1].trim()==="";)s.pop();return s.join(`
643
- `)}async function pn(e,t){let s=b_(e);try{await navigator.clipboard.writeText(s),t.classList.add("copy-success"),setTimeout(()=>t.classList.remove("copy-success"),1500)}catch{}}var vp=["\x1B[36m","\x1B[33m","\x1B[35m","\x1B[32m","\x1B[34m","\x1B[91m","\x1B[96m","\x1B[93m"],Vn="\x1B[0m",yc="\x1B[2m",vc=new Map,bp=0;function ny(e){return e?new Date(e).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function ay(e){return vc.has(e)||(vc.set(e,vp[bp%vp.length]),bp++),vc.get(e)}var Qe=null,$i=null,go=null,bc=null,ir=null,Ys=null;async function ly(e){if(Qe&&e.querySelector(".xterm")){$i.fit();return}if(ir){await ir;return}ir=(async()=>{let[{Terminal:t},{FitAddon:s}]=await Promise.all([Promise.resolve().then(()=>(mc(),fc)),Promise.resolve().then(()=>(_c(),gc))]);Qe=new t({theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#60a5fa",selectionBackground:"rgba(96, 165, 250, 0.3)"},fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:13,lineHeight:1.4,scrollback:1e4,convertEol:!0,cursorBlink:!1,disableStdin:!0}),$i=new s,Qe.loadAddon($i),Qe.open(e),$i.fit(),go=new ResizeObserver(()=>{$i&&$i.fit()}),go.observe(e)})(),await ir,ir=null}function wc(e){if(!Qe||!Ys||e.stage!==Ys)return;let t=e.timestamp?`${yc}${ny(e.timestamp)}${Vn} `:"",s=e.stage?`${ay(e.stage)}[${e.stage.toUpperCase()}]${Vn} `:"",i=e.line||e;Qe.writeln(`${t}${s}${i}`)}function yp(e){Qe&&Qe.writeln(`
644
- ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
645
- `)}function Sc(){Qe&&Qe.clear()}function wp(){go&&go.disconnect(),Qe&&Qe.dispose(),Qe=null,$i=null,go=null,ir=null,bc=null,Ys=null}function cy(e){if(!e)return null;for(let[i,r]of Object.entries(e))if(r.status==="in_progress")return i;let t=null,s=null;for(let[i,r]of Object.entries(e))r.started_at&&(!s||r.started_at>s)&&(s=r.started_at,t=i);return t}function Un(e){let t=e?.stages,s=cy(t);if(s!==Ys){let i=Ys;return Ys=s,Qe&&i!==null&&(Qe.clear(),s&&Qe.writeln(`${yc}--- Switched to stage: ${s.toUpperCase()} ---${Vn}
646
- `)),{changed:!0,activeStage:s}}return{changed:!1,activeStage:Ys}}function Cc(){return Ys}async function Sp(e){let t=document.getElementById("live-output-terminal");t&&(e!==bc&&(Sc(),bc=e),await ly(t))}function Cp(e,t){if(!t)return C;let s=e?e.replace(/_/g," ").toUpperCase():"WAITING";return u`
643
+ `)}async function dn(e,t){let s=b_(e);try{await navigator.clipboard.writeText(s),t.classList.add("copy-success"),setTimeout(()=>t.classList.remove("copy-success"),1500)}catch{}}var vp=["\x1B[36m","\x1B[33m","\x1B[35m","\x1B[32m","\x1B[34m","\x1B[91m","\x1B[96m","\x1B[93m"],Wn="\x1B[0m",bc="\x1B[2m",_c=new Map,bp=0;function ny(e){return e?new Date(e).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function ay(e){return _c.has(e)||(_c.set(e,vp[bp%vp.length]),bp++),_c.get(e)}var Qe=null,$i=null,mo=null,vc=null,ir=null,Ys=null;async function ly(e){if(Qe&&e.querySelector(".xterm")){$i.fit();return}if(ir){await ir;return}ir=(async()=>{let[{Terminal:t},{FitAddon:s}]=await Promise.all([Promise.resolve().then(()=>(fc(),pc)),Promise.resolve().then(()=>(gc(),mc))]);Qe=new t({theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#60a5fa",selectionBackground:"rgba(96, 165, 250, 0.3)"},fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:13,lineHeight:1.4,scrollback:1e4,convertEol:!0,cursorBlink:!1,disableStdin:!0}),$i=new s,Qe.loadAddon($i),Qe.open(e),$i.fit(),mo=new ResizeObserver(()=>{$i&&$i.fit()}),mo.observe(e)})(),await ir,ir=null}function yc(e){if(!Qe||!Ys||e.stage!==Ys)return;let t=e.timestamp?`${bc}${ny(e.timestamp)}${Wn} `:"",s=e.stage?`${ay(e.stage)}[${e.stage.toUpperCase()}]${Wn} `:"",i=e.line||e;Qe.writeln(`${t}${s}${i}`)}function yp(e){Qe&&Qe.writeln(`
644
+ ${bc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Wn}
645
+ `)}function wc(){Qe&&Qe.clear()}function wp(){mo&&mo.disconnect(),Qe&&Qe.dispose(),Qe=null,$i=null,mo=null,ir=null,vc=null,Ys=null}function cy(e){if(!e)return null;for(let[i,r]of Object.entries(e))if(r.status==="in_progress")return i;let t=null,s=null;for(let[i,r]of Object.entries(e))r.started_at&&(!s||r.started_at>s)&&(s=r.started_at,t=i);return t}function jn(e){let t=e?.stages,s=cy(t);if(s!==Ys){let i=Ys;return Ys=s,Qe&&i!==null&&(Qe.clear(),s&&Qe.writeln(`${bc}--- Switched to stage: ${s.toUpperCase()} ---${Wn}
646
+ `)),{changed:!0,activeStage:s}}return{changed:!1,activeStage:Ys}}function Sc(){return Ys}async function Sp(e){let t=document.getElementById("live-output-terminal");t&&(e!==vc&&(wc(),vc=e),await ly(t))}function Cp(e,t){if(!t)return C;let s=e?e.replace(/_/g," ").toUpperCase():"WAITING";return u`
647
647
  <div class="live-output-container">
648
648
  <sl-details open class="live-output-panel" @sl-after-show=${Ut}>
649
649
  <div slot="summary" class="live-output-header">
650
- <span class="live-output-icon">${k(R(mi,16))}</span>
650
+ <span class="live-output-icon">${T(R(mi,16))}</span>
651
651
  <span class="live-output-title">Live Output</span>
652
652
  ${e?u`<sl-badge variant="warning" pill>${s}</sl-badge>`:C}
653
653
  </div>
654
654
  <div class="live-output-controls">
655
- <button class="terminal-copy-btn" @click=${i=>pn(Qe,i.currentTarget)}>
656
- ${k(R(ze,14))}
655
+ <button class="terminal-copy-btn" @click=${i=>dn(Qe,i.currentTarget)}>
656
+ ${T(R(ze,14))}
657
657
  Copy
658
658
  </button>
659
659
  </div>
@@ -662,11 +662,11 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
662
662
  </div>
663
663
  </sl-details>
664
664
  </div>
665
- `}var Xp=["\x1B[36m","\x1B[33m","\x1B[35m","\x1B[32m","\x1B[34m","\x1B[91m","\x1B[96m","\x1B[93m"],Jp="\x1B[0m",nw="\x1B[2m",ea=new Map,zc=0;function aw(e){return e?new Date(e).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function lw(e){return ea.has(e)||(ea.set(e,Xp[zc%Xp.length]),zc++),ea.get(e)}var gt=null,Js=null,ar=null,Nc=null,Zs=null,Ei=null;async function cw(e){if(gt&&e.querySelector(".xterm")){Js.fit();return}if(Ei){await Ei;return}Ei=(async()=>{let[{Terminal:t},{FitAddon:s},{SearchAddon:i}]=await Promise.all([Promise.resolve().then(()=>(mc(),fc)),Promise.resolve().then(()=>(_c(),gc)),Promise.resolve().then(()=>(Yp(),Gp))]);gt=new t({theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#60a5fa",selectionBackground:"rgba(96, 165, 250, 0.3)"},fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:13,lineHeight:1.4,scrollback:5e4,convertEol:!0,cursorBlink:!1,disableStdin:!0}),Js=new s,ar=new i,gt.loadAddon(Js),gt.loadAddon(ar),gt.open(e),Js.fit(),Zs=new ResizeObserver(()=>{Js&&Js.fit()}),Zs.observe(e)})(),await Ei,Ei=null}function Zp(e){if(!gt)return;let t=e.timestamp?`${nw}${aw(e.timestamp)}${Jp} `:"",s=e.stage?`${lw(e.stage)}[${e.stage.toUpperCase()}]${Jp} `:"",i=e.line||e;gt.writeln(`${t}${s}${i}`)}function lr(){Zs&&Zs.disconnect(),gt&&gt.dispose(),gt=null,Js=null,ar=null,Zs=null,Ei=null,ea.clear(),zc=0}function Qp(){Zs&&Zs.disconnect(),gt&&gt.dispose(),gt=null,Js=null,ar=null,Zs=null,Ei=null,Nc=null}function ef(e){ar&&e&&ar.findNext(e,{incremental:!0})}async function tf(e){let t=document.getElementById("log-terminal");t&&(e!==Nc&&(lr(),Nc=e),await cw(t))}function sf(e,{onStageFilter:t,onIterationFilter:s,onSearch:i,onToggleAutoScroll:r,autoScroll:o,stageIterations:n,runStages:a}){let c=S=>{let $=S.filter(x=>x!=="orchestrator");return["orchestrator",...od($)]},l=a?c(Object.keys(a)):null,h=c([...new Set(e.logLines.map(S=>S.stage).filter(Boolean))]),d=l||h,m=e.currentLogStage,p=n?.[m]||0,f=m&&m!=="*"&&p>0,_=m&&m!=="*";return u`
665
+ `}var Xp=["\x1B[36m","\x1B[33m","\x1B[35m","\x1B[32m","\x1B[34m","\x1B[91m","\x1B[96m","\x1B[93m"],Jp="\x1B[0m",nw="\x1B[2m",Zn=new Map,Ic=0;function aw(e){return e?new Date(e).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function lw(e){return Zn.has(e)||(Zn.set(e,Xp[Ic%Xp.length]),Ic++),Zn.get(e)}var gt=null,Js=null,ar=null,zc=null,Zs=null,Ei=null;async function cw(e){if(gt&&e.querySelector(".xterm")){Js.fit();return}if(Ei){await Ei;return}Ei=(async()=>{let[{Terminal:t},{FitAddon:s},{SearchAddon:i}]=await Promise.all([Promise.resolve().then(()=>(fc(),pc)),Promise.resolve().then(()=>(gc(),mc)),Promise.resolve().then(()=>(Yp(),Gp))]);gt=new t({theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#60a5fa",selectionBackground:"rgba(96, 165, 250, 0.3)"},fontFamily:"'JetBrains Mono', 'SF Mono', 'Fira Code', monospace",fontSize:13,lineHeight:1.4,scrollback:5e4,convertEol:!0,cursorBlink:!1,disableStdin:!0}),Js=new s,ar=new i,gt.loadAddon(Js),gt.loadAddon(ar),gt.open(e),Js.fit(),Zs=new ResizeObserver(()=>{Js&&Js.fit()}),Zs.observe(e)})(),await Ei,Ei=null}function Zp(e){if(!gt)return;let t=e.timestamp?`${nw}${aw(e.timestamp)}${Jp} `:"",s=e.stage?`${lw(e.stage)}[${e.stage.toUpperCase()}]${Jp} `:"",i=e.line||e;gt.writeln(`${t}${s}${i}`)}function lr(){Zs&&Zs.disconnect(),gt&&gt.dispose(),gt=null,Js=null,ar=null,Zs=null,Ei=null,Zn.clear(),Ic=0}function Qp(){Zs&&Zs.disconnect(),gt&&gt.dispose(),gt=null,Js=null,ar=null,Zs=null,Ei=null,zc=null}function ef(e){ar&&e&&ar.findNext(e,{incremental:!0})}async function tf(e){let t=document.getElementById("log-terminal");t&&(e!==zc&&(lr(),zc=e),await cw(t))}function sf(e,{onStageFilter:t,onIterationFilter:s,onSearch:i,onToggleAutoScroll:r,autoScroll:o,stageIterations:n,runStages:a}){let c=S=>{let k=S.filter(x=>x!=="orchestrator");return["orchestrator",...od(k)]},l=a?c(Object.keys(a)):null,h=c([...new Set(e.logLines.map(S=>S.stage).filter(Boolean))]),d=l||h,m=e.currentLogStage,p=n?.[m]||0,f=m&&m!=="*"&&p>0,_=m&&m!=="*";return u`
666
666
  <div class="log-history-container">
667
667
  <sl-details class="log-history-panel" @sl-after-show=${Ut}>
668
668
  <div slot="summary" class="log-history-header">
669
- <span class="log-history-icon">${k(R(Wt,16))}</span>
669
+ <span class="log-history-icon">${T(R(Wt,16))}</span>
670
670
  <span class="log-history-title">Log History</span>
671
671
  </div>
672
672
  <div class="log-history-body">
@@ -678,7 +678,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
678
678
  clearable
679
679
  @sl-change=${S=>t(S.target.value||"*")}
680
680
  >
681
- ${d.map(S=>u`<sl-option value="${S}">${S==="orchestrator"?u`<span style="display:inline-flex;align-items:center;gap:4px">${k(R(el,12))} ORCHESTRATOR</span>`:S.toUpperCase()}</sl-option>`)}
681
+ ${d.map(S=>u`<sl-option value="${S}">${S==="orchestrator"?u`<span style="display:inline-flex;align-items:center;gap:4px">${T(R(Ja,12))} ORCHESTRATOR</span>`:S.toUpperCase()}</sl-option>`)}
682
682
  </sl-select>
683
683
  ${f?u`
684
684
  <sl-select
@@ -686,7 +686,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
686
686
  size="small"
687
687
  @sl-change=${S=>s(S.target.value?parseInt(S.target.value,10):null)}
688
688
  >
689
- ${Array.from({length:p},(S,$)=>u`<sl-option value="${$+1}">Iteration ${$+1}</sl-option>`)}
689
+ ${Array.from({length:p},(S,k)=>u`<sl-option value="${k+1}">Iteration ${k+1}</sl-option>`)}
690
690
  </sl-select>
691
691
  `:C}
692
692
  <sl-input
@@ -697,19 +697,19 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
697
697
  clearable
698
698
  @sl-input=${S=>i(S.target.value)}
699
699
  >
700
- <span slot="prefix">${k(R(Fs,14))}</span>
700
+ <span slot="prefix">${T(R(Fs,14))}</span>
701
701
  </sl-input>
702
702
  <sl-button
703
703
  size="small"
704
704
  variant="${o?"primary":"default"}"
705
705
  @click=${r}
706
706
  >
707
- ${k(R(o?ja:rt,14))}
707
+ ${T(R(o?Fa:rt,14))}
708
708
  ${o?"Auto":"Paused"}
709
709
  </sl-button>
710
710
  ${_?u`
711
- <button class="terminal-copy-btn" @click=${S=>pn(gt,S.currentTarget)}>
712
- ${k(R(ze,14))}
711
+ <button class="terminal-copy-btn" @click=${S=>dn(gt,S.currentTarget)}>
712
+ ${T(R(ze,14))}
713
713
  Copy
714
714
  </button>
715
715
  `:C}
@@ -720,7 +720,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
720
720
  </div>
721
721
  `:u`
722
722
  <div class="log-history-empty">
723
- <span class="log-history-empty-icon">${k(R(Wt,32))}</span>
723
+ <span class="log-history-empty-icon">${T(R(Wt,32))}</span>
724
724
  <p>Select a stage from the dropdown to review past output.</p>
725
725
  </div>
726
726
  `}
@@ -732,7 +732,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
732
732
  class="stage-dot ${i<t?"completed":i===t?"active":""}"
733
733
  title=${s}
734
734
  ></span>
735
- `)}function dw(e){if(!e)return"";let t=Date.now()-new Date(e).getTime();if(t<0)return"";let s=Math.floor(t/1e3);if(s<60)return`${s}s`;let i=Math.floor(s/60);return i<60?`${i}m ${s%60}s`:`${Math.floor(i/60)}h ${i%60}m`}function uw(e){switch(e){case"running":return"pipeline-running";case"succeeded":return"pipeline-succeeded";case"failed":return"pipeline-failed";case"paused":return"pipeline-paused";default:return"pipeline-unknown"}}function Fc(e,{onPause:t,onStop:s,onResume:i,onClick:r}={}){let o=e.status;return u`
735
+ `)}function dw(e){if(!e)return"";let t=Date.now()-new Date(e).getTime();if(t<0)return"";let s=Math.floor(t/1e3);if(s<60)return`${s}s`;let i=Math.floor(s/60);return i<60?`${i}m ${s%60}s`:`${Math.floor(i/60)}h ${i%60}m`}function uw(e){switch(e){case"running":return"pipeline-running";case"succeeded":return"pipeline-succeeded";case"failed":return"pipeline-failed";case"paused":return"pipeline-paused";default:return"pipeline-unknown"}}function Nc(e,{onPause:t,onStop:s,onResume:i,onClick:r}={}){let o=e.status;return u`
736
736
  <div
737
737
  class="pipeline-card ${uw(o)}"
738
738
  @click=${()=>r?.(e.run_id)}
@@ -751,7 +751,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
751
751
  </div>
752
752
  <div class="pipeline-card-footer">
753
753
  <span class="pipeline-elapsed">
754
- ${k(R(Wt,12))} ${dw(e.started_at)}
754
+ ${T(R(Wt,12))} ${dw(e.started_at)}
755
755
  </span>
756
756
  <span class="pipeline-run-id">${e.run_id||""}</span>
757
757
  ${o==="running"?u`
@@ -764,14 +764,14 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
764
764
  title="Pause"
765
765
  @click=${()=>t?.(e.run_id)}
766
766
  >
767
- ${k(R(rt,14))}
767
+ ${T(R(rt,14))}
768
768
  </button>
769
769
  <button
770
770
  class="pipeline-action-btn"
771
771
  title="Stop"
772
772
  @click=${()=>s?.(e.run_id)}
773
773
  >
774
- ${k(R(Hs,14))}
774
+ ${T(R(Hs,14))}
775
775
  </button>
776
776
  </span>
777
777
  `:o==="paused"?u`
@@ -784,7 +784,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
784
784
  title="Resume"
785
785
  @click=${()=>i?.(e.run_id)}
786
786
  >
787
- ${k(R(bs,14))}
787
+ ${T(R(bs,14))}
788
788
  </button>
789
789
  </span>
790
790
  `:C}
@@ -795,25 +795,24 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
795
795
  <h3 class="dashboard-section-title">Parallel Pipelines</h3>
796
796
  ${n.length>0||a.length>0?u`
797
797
  <div class="pipeline-grid">
798
- ${n.map(h=>Fc(h,l))}
799
- ${a.map(h=>Fc(h,l))}
798
+ ${n.map(h=>Nc(h,l))}
799
+ ${a.map(h=>Nc(h,l))}
800
800
  </div>
801
801
  `:C}
802
802
  ${c.length>0?u`
803
803
  <sl-details summary="Completed (${c.length})">
804
804
  <div class="pipeline-grid">
805
- ${c.map(h=>Fc(h,l))}
805
+ ${c.map(h=>Nc(h,l))}
806
806
  </div>
807
807
  </sl-details>
808
808
  `:C}
809
809
  </div>
810
- `}var pw={plan:"planner",plan_review:"plan_reviewer",coordinate:"coordinator",implement:"implementer",test:"tester",review:"guardian",pr:"guardian",learn:"learner"},ia=wt.filter(e=>e!=="preflight"),yo=["planner","plan_reviewer","coordinator","implementer","tester","guardian","learner"],fw=["opus","sonnet","haiku"],bo={plan:{agent:"planner",enabled:!0},plan_review:{agent:"plan_reviewer",enabled:!1},coordinate:{agent:"coordinator",enabled:!0},implement:{agent:"implementer",enabled:!0},test:{agent:"tester",enabled:!0},review:{agent:"guardian",enabled:!0},pr:{agent:"guardian",enabled:!0},learn:{agent:"learner",enabled:!1}},Hc=["opus","sonnet","haiku"],ra=[{key:"input_per_mtok",label:"Input/MTok ($)"},{key:"output_per_mtok",label:"Output/MTok ($)"},{key:"cache_write_per_mtok",label:"Cache Write 5m/MTok ($)"},{key:"cache_write_1h_per_mtok",label:"Cache Write 1h/MTok ($)"},{key:"cache_read_per_mtok",label:"Cache Read/MTok ($)"}],lf=Object.fromEntries(ra.map(e=>[e.key,0])),cf=[{key:"block_rm_rf",label:"Block rm -rf",description:"Prevent recursive force-delete commands"},{key:"block_env_write",label:"Block .env writes",description:"Prevent writing to .env files"},{key:"block_force_push",label:"Block force push",description:"Prevent git push --force"},{key:"restrict_git_commit",label:"Restrict git commit",description:"Only guardian agent may commit"}],Ti={guards:{block_rm_rf:!0,block_env_write:!0,block_force_push:!0,restrict_git_commit:!0},test_gate_strikes:2,dispatch:{planner:[],coordinator:["implementer"],implementer:[],tester:[],guardian:[]}},X=null,et=null,Kt="",dr=null;function Wc(e,t=""){return e?`/api/projects/${e}/settings${t}`:`/api/settings${t}`}async function ti(e){dr=e||null;try{let t=await fetch(Wc(e));if(!t.ok)throw new Error(`HTTP ${t.status}`);if(X=await t.json(),X.worca||(X.worca={}),!X.worca.stages)X.worca.stages={...bo};else for(let s of ia)X.worca.stages[s]||(X.worca.stages[s]={...bo[s]});if(!X.worca.stages.preflight)X.worca.stages.preflight={enabled:!0,script:".claude/worca/scripts/preflight_checks.py",require:[]};else{let s=X.worca.stages.preflight;s.enabled===void 0&&(s.enabled=!0),s.script||(s.script=".claude/worca/scripts/preflight_checks.py"),s.require||(s.require=[])}X.worca.plan_path_template||(X.worca.plan_path_template="docs/plans/{timestamp}-{title_slug}.md"),X.worca.defaults||(X.worca.defaults={msize:1,mloops:1}),X.worca.pricing||(X.worca.pricing={models:{},server_tools:{},currency:"USD"}),X.worca.pricing.models||(X.worca.pricing.models={});for(let s of Hc)X.worca.pricing.models[s]={...lf,...X.worca.pricing.models[s]||{}};X.worca.pricing.server_tools||(X.worca.pricing.server_tools={}),X.worca.governance?X.worca.governance={...Ti,...X.worca.governance,guards:{...Ti.guards,...X.worca.governance.guards||{}},dispatch:{...Ti.dispatch,...X.worca.governance.dispatch||{}}}:X.worca.governance={...Ti},X.worca.events||(X.worca.events={enabled:!0,agent_telemetry:!1,hook_events:!0,rate_limit_ms:1e3}),X.worca.budget||(X.worca.budget={}),X.worca.webhooks||(X.worca.webhooks=[])}catch(t){X=null,et="error",Kt=`Failed to load settings: ${t.message}`}}async function wo(e,t,s){et="saving",Kt="",t();try{let i=await fetch(Wc(s||dr),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok)throw new Error(`HTTP ${i.status}`);let r=await i.json();X={worca:r.worca,permissions:r.permissions},et="success",Kt="Settings saved successfully"}catch(i){et="error",Kt=`Failed to save: ${i.message}`}t(),et==="success"&&setTimeout(()=>{et==="success"&&(et=null,Kt="",t())},3e3)}async function mw(e,t,s){et="saving",Kt="",t();try{let i=await fetch(Wc(s||dr,`/${e}`),{method:"DELETE"});if(!i.ok)throw new Error(`HTTP ${i.status}`);let r=await i.json();X={worca:r.worca,permissions:r.permissions},await ti(s||dr),et="success",Kt=`${e.charAt(0).toUpperCase()+e.slice(1)} reset to defaults`}catch(i){et="error",Kt=`Failed to reset: ${i.message}`}t(),et==="success"&&setTimeout(()=>{et==="success"&&(et=null,Kt="",t())},3e3)}function So(e,t){let s=e.charAt(0).toUpperCase()+e.slice(1);At({label:`Reset ${s}`,message:u`Are you sure you want to reset <strong>${s}</strong> settings to their defaults?`,confirmLabel:"Reset",confirmVariant:"danger",onConfirm:()=>mw(e,t)},t)}function gw(){let e={};for(let t of yo){let s=document.getElementById(`agent-${t}-model`),i=document.getElementById(`agent-${t}-turns`);e[t]={model:s?.value||"sonnet",max_turns:parseInt(i?.value,10)||30}}return e}function _w(){let e={};for(let n of["implement_test","pr_changes","restart_planning"]){let a=document.getElementById(`loop-${n}`);e[n]=parseInt(a?.value,10)||0}let s=document.getElementById("plan-path-template")?.value?.trim()||"",i=document.getElementById("defaults-msize"),r=document.getElementById("defaults-mloops"),o={msize:parseInt(i?.value,10)||1,mloops:parseInt(r?.value,10)||1};return{loops:e,plan_path_template:s,defaults:o}}function vw(){let e={};for(let t of ia){let s=document.getElementById(`stage-${t}-enabled`),i=document.getElementById(`stage-${t}-agent`);e[t]={agent:i?.value||bo[t].agent,enabled:s?.checked??!0}}return e}function bw(){let e=document.getElementById("preflight-enabled"),t=document.getElementById("preflight-script"),i=(document.getElementById("preflight-require")?.value||"").trim();return{enabled:e?.checked??!0,script:t?.value?.trim()||".claude/worca/scripts/preflight_checks.py",require:i?i.split(",").map(r=>r.trim()).filter(Boolean):[]}}function yw(){let e={};for(let r of cf){let o=document.getElementById(`guard-${r.key}`);e[r.key]=o?.checked??!0}let t=document.getElementById("test-gate-strikes"),s=parseInt(t?.value,10)||2,i={};for(let r of yo){let n=(document.getElementById(`dispatch-${r}`)?.value||"").trim();i[r]=n?n.split(",").map(a=>a.trim()).filter(Boolean):[]}return{guards:e,test_gate_strikes:s,dispatch:i}}function ww(){let e=document.querySelectorAll(".perm-input");return Array.from(e).map(t=>t.value.trim()).filter(t=>t.length>0)}function Sw(){let e={};for(let i of Hc){e[i]={};for(let r of ra){let o=document.getElementById(`pricing-${i}-${r.key}`);e[i][r.key]=parseFloat(o?.value)||0}}let t=document.getElementById("pricing-server_tools-web_search_per_request"),s=document.getElementById("pricing-server_tools-web_fetch_per_request");return{models:e,server_tools:{web_search_per_request:parseFloat(t?.value)||0,web_fetch_per_request:parseFloat(s?.value)||0},currency:X?.worca?.pricing?.currency||"USD",last_updated:new Date().toISOString().slice(0,10)}}function jc(){return X?.worca?.defaults||{msize:1,mloops:1}}function Cw(e,t){let s=e.agents||{};return u`
810
+ `}var pw={plan:"planner",plan_review:"plan_reviewer",coordinate:"coordinator",implement:"implementer",test:"tester",review:"reviewer",pr:"guardian",learn:"learner"},Fc=wt.filter(e=>e!=="preflight"),bo=["planner","plan_reviewer","coordinator","implementer","tester","reviewer","guardian","learner"],fw=["opus","sonnet","haiku"],vo={plan:{agent:"planner",enabled:!0},plan_review:{agent:"plan_reviewer",enabled:!1},coordinate:{agent:"coordinator",enabled:!0},implement:{agent:"implementer",enabled:!0},test:{agent:"tester",enabled:!0},review:{agent:"reviewer",enabled:!0},pr:{agent:"guardian",enabled:!0},learn:{agent:"learner",enabled:!1}},Hc=["opus","sonnet","haiku"],ta=[{key:"input_per_mtok",label:"Input/MTok ($)"},{key:"output_per_mtok",label:"Output/MTok ($)"},{key:"cache_write_per_mtok",label:"Cache Write 5m/MTok ($)"},{key:"cache_write_1h_per_mtok",label:"Cache Write 1h/MTok ($)"},{key:"cache_read_per_mtok",label:"Cache Read/MTok ($)"}],lf=Object.fromEntries(ta.map(e=>[e.key,0])),cf=[{key:"block_rm_rf",label:"Block rm -rf",description:"Prevent recursive force-delete commands"},{key:"block_env_write",label:"Block .env writes",description:"Prevent writing to .env files"},{key:"block_force_push",label:"Block force push",description:"Prevent git push --force"},{key:"restrict_git_commit",label:"Restrict git commit",description:"Only guardian agent may commit"}],Ti={guards:{block_rm_rf:!0,block_env_write:!0,block_force_push:!0,restrict_git_commit:!0},test_gate_strikes:2,dispatch:{planner:[],coordinator:["implementer"],implementer:[],tester:[],guardian:[]}},X=null,et=null,Kt="",dr=null;function Wc(e,t=""){return e?`/api/projects/${e}/settings${t}`:`/api/settings${t}`}async function ti(e){dr=e||null;try{let t=await fetch(Wc(e));if(!t.ok)throw new Error(`HTTP ${t.status}`);if(X=await t.json(),X.worca||(X.worca={}),!X.worca.stages)X.worca.stages={...vo};else for(let s of Fc)X.worca.stages[s]||(X.worca.stages[s]={...vo[s]});if(!X.worca.stages.preflight)X.worca.stages.preflight={enabled:!0,script:".claude/worca/scripts/preflight_checks.py",require:[]};else{let s=X.worca.stages.preflight;s.enabled===void 0&&(s.enabled=!0),s.script||(s.script=".claude/worca/scripts/preflight_checks.py"),s.require||(s.require=[])}X.worca.plan_path_template||(X.worca.plan_path_template="docs/plans/{timestamp}-{title_slug}.md"),X.worca.defaults||(X.worca.defaults={msize:1,mloops:1}),X.worca.pricing||(X.worca.pricing={models:{},server_tools:{},currency:"USD"}),X.worca.pricing.models||(X.worca.pricing.models={});for(let s of Hc)X.worca.pricing.models[s]={...lf,...X.worca.pricing.models[s]||{}};X.worca.pricing.server_tools||(X.worca.pricing.server_tools={}),X.worca.governance?X.worca.governance={...Ti,...X.worca.governance,guards:{...Ti.guards,...X.worca.governance.guards||{}},dispatch:{...Ti.dispatch,...X.worca.governance.dispatch||{}}}:X.worca.governance={...Ti},X.worca.events||(X.worca.events={enabled:!0,agent_telemetry:!1,hook_events:!0,rate_limit_ms:1e3}),X.worca.budget||(X.worca.budget={}),X.worca.webhooks||(X.worca.webhooks=[])}catch(t){X=null,et="error",Kt=`Failed to load settings: ${t.message}`}}async function yo(e,t,s){et="saving",Kt="",t();try{let i=await fetch(Wc(s||dr),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!i.ok)throw new Error(`HTTP ${i.status}`);let r=await i.json();X={worca:r.worca,permissions:r.permissions},et="success",Kt="Settings saved successfully"}catch(i){et="error",Kt=`Failed to save: ${i.message}`}t(),et==="success"&&setTimeout(()=>{et==="success"&&(et=null,Kt="",t())},3e3)}async function mw(e,t,s){et="saving",Kt="",t();try{let i=await fetch(Wc(s||dr,`/${e}`),{method:"DELETE"});if(!i.ok)throw new Error(`HTTP ${i.status}`);let r=await i.json();X={worca:r.worca,permissions:r.permissions},await ti(s||dr),et="success",Kt=`${e.charAt(0).toUpperCase()+e.slice(1)} reset to defaults`}catch(i){et="error",Kt=`Failed to reset: ${i.message}`}t(),et==="success"&&setTimeout(()=>{et==="success"&&(et=null,Kt="",t())},3e3)}function wo(e,t){let s=e.charAt(0).toUpperCase()+e.slice(1);At({label:`Reset ${s}`,message:u`Are you sure you want to reset <strong>${s}</strong> settings to their defaults?`,confirmLabel:"Reset",confirmVariant:"danger",onConfirm:()=>mw(e,t)},t)}function gw(){let e={};for(let t of bo){let s=document.getElementById(`agent-${t}-model`),i=document.getElementById(`agent-${t}-turns`);e[t]={model:s?.value||"sonnet",max_turns:parseInt(i?.value,10)||30}}return e}function _w(){let e={};for(let n of["implement_test","pr_changes","restart_planning"]){let a=document.getElementById(`loop-${n}`);e[n]=parseInt(a?.value,10)||0}let s=document.getElementById("plan-path-template")?.value?.trim()||"",i=document.getElementById("defaults-msize"),r=document.getElementById("defaults-mloops"),o={msize:parseInt(i?.value,10)||1,mloops:parseInt(r?.value,10)||1};return{loops:e,plan_path_template:s,defaults:o}}function vw(){let e={};for(let t of Fc){let s=document.getElementById(`stage-${t}-enabled`),i=document.getElementById(`stage-${t}-agent`);e[t]={agent:i?.value||vo[t].agent,enabled:s?.checked??!0}}return e}function bw(){let e=document.getElementById("preflight-enabled"),t=document.getElementById("preflight-script"),i=(document.getElementById("preflight-require")?.value||"").trim();return{enabled:e?.checked??!0,script:t?.value?.trim()||".claude/worca/scripts/preflight_checks.py",require:i?i.split(",").map(r=>r.trim()).filter(Boolean):[]}}function yw(){let e={};for(let r of cf){let o=document.getElementById(`guard-${r.key}`);e[r.key]=o?.checked??!0}let t=document.getElementById("test-gate-strikes"),s=parseInt(t?.value,10)||2,i={};for(let r of bo){let n=(document.getElementById(`dispatch-${r}`)?.value||"").trim();i[r]=n?n.split(",").map(a=>a.trim()).filter(Boolean):[]}return{guards:e,test_gate_strikes:s,dispatch:i}}function ww(){let e=document.querySelectorAll(".perm-input");return Array.from(e).map(t=>t.value.trim()).filter(t=>t.length>0)}function Sw(){let e={};for(let i of Hc){e[i]={};for(let r of ta){let o=document.getElementById(`pricing-${i}-${r.key}`);e[i][r.key]=parseFloat(o?.value)||0}}let t=document.getElementById("pricing-server_tools-web_search_per_request"),s=document.getElementById("pricing-server_tools-web_fetch_per_request");return{models:e,server_tools:{web_search_per_request:parseFloat(t?.value)||0,web_fetch_per_request:parseFloat(s?.value)||0},currency:X?.worca?.pricing?.currency||"USD",last_updated:new Date().toISOString().slice(0,10)}}function jc(){return X?.worca?.defaults||{msize:1,mloops:1}}function Cw(e,t){let s=e.agents||{};return u`
811
811
  <div class="settings-tab-content">
812
812
  <div class="settings-cards">
813
- ${yo.map(i=>{let r=s[i]||{};return u`
813
+ ${bo.map(i=>{let r=s[i]||{};return u`
814
814
  <div class="settings-card">
815
815
  <div class="settings-card-header">
816
- <span class="settings-card-icon">${k(R(an,18))}</span>
817
816
  <span class="settings-card-title">${i}</span>
818
817
  </div>
819
818
  <div class="settings-card-body">
@@ -832,17 +831,17 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
832
831
  `})}
833
832
  </div>
834
833
  <div class="settings-tab-actions">
835
- <sl-button variant="primary" size="small" @click=${()=>{let i=gw();wo({worca:{agents:i}},t)}}>
836
- ${k(R(ys,14))}
834
+ <sl-button variant="primary" size="small" @click=${()=>{let i=gw();yo({worca:{agents:i}},t)}}>
835
+ ${T(R(ys,14))}
837
836
  Save
838
837
  </sl-button>
839
- <sl-button variant="default" size="small" outline @click=${()=>So("agents",t)}>
840
- ${k(R(Pe,14))}
838
+ <sl-button variant="default" size="small" outline @click=${()=>wo("agents",t)}>
839
+ ${T(R(Pe,14))}
841
840
  Reset
842
841
  </sl-button>
843
842
  </div>
844
843
  </div>
845
- `}function xw(e,t){let s=e.loops||{},i=e.stages||bo,r=i.preflight||{enabled:!0,script:".claude/worca/scripts/preflight_checks.py",require:[]};return u`
844
+ `}function xw(e,t){let s=e.loops||{},i=e.stages||vo,r=i.preflight||{enabled:!0,script:".claude/worca/scripts/preflight_checks.py",require:[]};return u`
846
845
  <div class="settings-tab-content">
847
846
  <h3 class="settings-section-title">Preflight</h3>
848
847
  <div class="settings-grid">
@@ -864,24 +863,23 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
864
863
  </div>
865
864
 
866
865
  <h3 class="settings-section-title">Stage Configuration</h3>
867
- <div class="pipeline-flow">
868
- ${ia.map((o,n)=>{let a=i[o]||bo[o],c=a.enabled!==!1;return u`
869
- <div class="pipeline-stage-node ${c?"pipeline-stage-node--enabled":"pipeline-stage-node--disabled"}">
870
- <div class="pipeline-stage-header">
871
- <span class="pipeline-stage-name ${c?"":"pipeline-stage-name--disabled"}">${o}</span>
872
- <sl-switch id="stage-${o}-enabled" ?checked=${c} size="small"
873
- @sl-change=${l=>{let h=l.target.closest(".pipeline-stage-node");l.target.checked?(h.classList.remove("pipeline-stage-node--disabled"),h.classList.add("pipeline-stage-node--enabled"),h.querySelector(".pipeline-stage-name").classList.remove("pipeline-stage-name--disabled")):(h.classList.remove("pipeline-stage-node--enabled"),h.classList.add("pipeline-stage-node--disabled"),h.querySelector(".pipeline-stage-name").classList.add("pipeline-stage-name--disabled"))}}></sl-switch>
866
+ <div class="settings-cards">
867
+ ${Fc.map(o=>{let n=i[o]||vo[o],a=n.enabled!==!1;return u`
868
+ <div class="settings-card pipeline-stage-node ${a?"pipeline-stage-node--enabled":"pipeline-stage-node--disabled"}">
869
+ <div class="settings-card-header">
870
+ <span class="settings-card-title ${a?"":"pipeline-stage-name--disabled"}">${o}</span>
871
+ <sl-switch id="stage-${o}-enabled" ?checked=${a} size="small"
872
+ @sl-change=${c=>{let l=c.target.closest(".pipeline-stage-node");c.target.checked?(l.classList.remove("pipeline-stage-node--disabled"),l.classList.add("pipeline-stage-node--enabled"),l.querySelector(".settings-card-title").classList.remove("pipeline-stage-name--disabled")):(l.classList.remove("pipeline-stage-node--enabled"),l.classList.add("pipeline-stage-node--disabled"),l.querySelector(".settings-card-title").classList.add("pipeline-stage-name--disabled"))}}></sl-switch>
874
873
  </div>
875
- <div class="settings-field pipeline-stage-field">
876
- <label class="settings-label">Agent</label>
877
- <sl-select id="stage-${o}-agent" .value="${a.agent||pw[o]}" size="small">
878
- ${yo.map(l=>u`<sl-option value="${l}">${l}</sl-option>`)}
879
- </sl-select>
874
+ <div class="settings-card-body">
875
+ <div class="settings-field">
876
+ <label class="settings-label">Agent</label>
877
+ <sl-select id="stage-${o}-agent" .value="${n.agent||pw[o]}" size="small" hoist>
878
+ ${bo.map(c=>u`<sl-option value="${c}">${c}</sl-option>`)}
879
+ </sl-select>
880
+ </div>
880
881
  </div>
881
882
  </div>
882
- ${n<ia.length-1?u`
883
- <span class="pipeline-arrow">${k(R(qa,16))}</span>
884
- `:C}
885
883
  `})}
886
884
  </div>
887
885
 
@@ -919,12 +917,12 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
919
917
  </div>
920
918
 
921
919
  <div class="settings-tab-actions">
922
- <sl-button variant="primary" size="small" @click=${()=>{let{loops:o,plan_path_template:n,defaults:a}=_w(),c=vw();c.preflight=bw(),wo({worca:{loops:o,stages:c,plan_path_template:n,defaults:a}},t)}}>
923
- ${k(R(ys,14))}
920
+ <sl-button variant="primary" size="small" @click=${()=>{let{loops:o,plan_path_template:n,defaults:a}=_w(),c=vw();c.preflight=bw(),yo({worca:{loops:o,stages:c,plan_path_template:n,defaults:a}},t)}}>
921
+ ${T(R(ys,14))}
924
922
  Save
925
923
  </sl-button>
926
- <sl-button variant="default" size="small" outline @click=${()=>So("pipeline",t)}>
927
- ${k(R(Pe,14))}
924
+ <sl-button variant="default" size="small" outline @click=${()=>wo("pipeline",t)}>
925
+ ${T(R(Pe,14))}
928
926
  Reset
929
927
  </sl-button>
930
928
  </div>
@@ -954,7 +952,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
954
952
 
955
953
  <h3 class="settings-section-title">Dispatch Rules</h3>
956
954
  <div class="settings-dispatch-table">
957
- ${yo.map(a=>u`
955
+ ${bo.map(a=>u`
958
956
  <div class="settings-dispatch-row">
959
957
  <span class="settings-dispatch-agent">${a}</span>
960
958
  <sl-input id="dispatch-${a}" value="${(o[a]||[]).join(", ")}" size="small" placeholder="none"></sl-input>
@@ -967,39 +965,39 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
967
965
  ${n.map((a,c)=>u`
968
966
  <div class="settings-perm-item settings-perm-item--editable">
969
967
  <sl-input class="perm-input" value="${a}" size="small" placeholder="e.g. Bash(pytest *)"></sl-input>
970
- <sl-icon-button name="x" label="Remove" class="perm-remove-btn" @click=${()=>{n.splice(c,1),s()}}>${k(R(Yi,14))}</sl-icon-button>
968
+ <sl-icon-button name="x" label="Remove" class="perm-remove-btn" @click=${()=>{n.splice(c,1),s()}}>${T(R(Yi,14))}</sl-icon-button>
971
969
  </div>
972
970
  `)}
973
971
  ${n.length===0?u`<span class="settings-muted">No permissions configured</span>`:C}
974
972
  </div>
975
973
  <sl-button size="small" variant="text" @click=${()=>{n.push(""),s()}}>
976
- ${k(R(Zt,14))}
974
+ ${T(R(Zt,14))}
977
975
  Add Permission
978
976
  </sl-button>
979
977
 
980
978
  <div class="settings-tab-actions">
981
- <sl-button variant="primary" size="small" @click=${()=>{let a=yw(),c=ww();wo({worca:{governance:a},permissions:{allow:c}},s)}}>
982
- ${k(R(ys,14))}
979
+ <sl-button variant="primary" size="small" @click=${()=>{let a=yw(),c=ww();yo({worca:{governance:a},permissions:{allow:c}},s)}}>
980
+ ${T(R(ys,14))}
983
981
  Save
984
982
  </sl-button>
985
- <sl-button variant="default" size="small" outline @click=${()=>So("governance",s)}>
986
- ${k(R(Pe,14))}
983
+ <sl-button variant="default" size="small" outline @click=${()=>wo("governance",s)}>
984
+ ${T(R(Pe,14))}
987
985
  Reset
988
986
  </sl-button>
989
987
  </div>
990
988
  </div>
991
- `}var ei=null,cr=!1,hr=null;async function sa(e,t=!1){cr=!0,hr=null,e();try{let i=await fetch(t?"/api/versions?force=1":"/api/versions");if(!i.ok)throw new Error(`HTTP ${i.status}`);ei=await i.json()}catch(s){hr=s.message}finally{cr=!1,e()}}function $w(e){if(!e)return"";let t=Date.now()-new Date(e).getTime(),s=Math.floor(t/1e3);if(s<60)return"just now";let i=Math.floor(s/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}function Ew(e,t){navigator.clipboard.writeText(e).then(()=>{let s=t.querySelector(".version-copy-icon");s&&(s.textContent="\u2713",setTimeout(()=>{s.textContent=""},1500))})}function Qs(e,t,s){return t===void 0?C:u`
989
+ `}var ei=null,cr=!1,hr=null;async function ea(e,t=!1){cr=!0,hr=null,e();try{let i=await fetch(t?"/api/versions?force=1":"/api/versions");if(!i.ok)throw new Error(`HTTP ${i.status}`);ei=await i.json()}catch(s){hr=s.message}finally{cr=!1,e()}}function $w(e){if(!e)return"";let t=Date.now()-new Date(e).getTime(),s=Math.floor(t/1e3);if(s<60)return"just now";let i=Math.floor(s/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}function Ew(e,t){navigator.clipboard.writeText(e).then(()=>{let s=t.querySelector(".version-copy-icon");s&&(s.textContent="\u2713",setTimeout(()=>{s.textContent=""},1500))})}function Qs(e,t,s,i){if(t===void 0)return C;let r=u`${t||"\u2014"}`;return u`
992
990
  <div class="version-row">
993
991
  <span class="version-row-label">${e}</span>
994
992
  <span class="version-row-value">${t&&s?u`
995
993
  <sl-tooltip content="Copy: ${s}">
996
- <button class="version-copy-btn" @click=${i=>Ew(s,i.currentTarget)}>
997
- <span class="version-copy-icon">${k(R(ze,12))}</span>
994
+ <button class="version-copy-btn" @click=${o=>Ew(s,o.currentTarget)}>
995
+ <span class="version-copy-icon">${T(R(ze,12))}</span>
998
996
  </button>
999
997
  </sl-tooltip>
1000
- `:C}${t||"\u2014"}</span>
998
+ `:C}${i?u`<sl-tooltip content="${i}">${r}</sl-tooltip>`:r}</span>
1001
999
  </div>
1002
- `}function Tw(e){if(!ei&&!cr&&!hr&&sa(e),cr&&!ei)return u`
1000
+ `}function Tw(e){if(!ei&&!cr&&!hr&&ea(e),cr&&!ei)return u`
1003
1001
  <h3 class="settings-section-title">Worca Versions</h3>
1004
1002
  <div class="settings-card">
1005
1003
  <div class="settings-muted">Loading version info…</div>
@@ -1009,13 +1007,13 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1009
1007
  <div class="settings-card">
1010
1008
  <div class="settings-muted">Failed to load versions: ${hr}</div>
1011
1009
  <div class="version-refresh">
1012
- <sl-button size="small" @click=${()=>sa(e,!0)}>
1013
- ${k(R(Pe,14))}
1010
+ <sl-button size="small" @click=${()=>ea(e,!0)}>
1011
+ ${T(R(Pe,14))}
1014
1012
  Retry
1015
1013
  </sl-button>
1016
1014
  </div>
1017
1015
  </div>
1018
- `;if(!ei)return C;let{worcaCc:t,worcaUi:s,devPath:i,cachedAt:r}=ei;return u`
1016
+ `;if(!ei)return C;let{worcaCc:t,worcaUi:s,devPath:i,installDir:r,cachedAt:o}=ei;function n(c,l){if(!c)return null;if(!l||l.ahead===0&&!l.dirty)return c;let h=[c];return l.ahead>0&&h.push(`+ ${l.ahead}`),l.dirty&&h.push("(dirty)"),h.join(" ")}function a(c){if(!c||c.ahead===0&&!c.dirty)return null;let l=[];return c.ahead>0&&l.push(`${c.ahead} commit${c.ahead===1?"":"s"} ahead of the last version tag`),c.dirty&&l.push("Working tree has uncommitted changes"),l.join(". ")}return u`
1019
1017
  <h3 class="settings-section-title">Worca Versions</h3>
1020
1018
  <div class="settings-grid">
1021
1019
  <div class="settings-card">
@@ -1027,7 +1025,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1027
1025
  ${Qs("Installed",t?.installed)}
1028
1026
  ${Qs("Latest",t?.latest,t?.latest?`pip install --upgrade worca-cc==${t.latest}`:null)}
1029
1027
  ${Qs("Latest RC",t?.latestRc,t?.latestRc?`pip install --upgrade worca-cc==${t.latestRc}`:null)}
1030
- ${Qs("Local repo",i?.worcaCc||null)}
1028
+ ${Qs("Local repo",n(i?.worcaCc,i?.worcaCcDev),null,a(i?.worcaCcDev))}
1031
1029
  </div>
1032
1030
  </div>
1033
1031
  <div class="settings-card">
@@ -1039,16 +1037,22 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1039
1037
  ${Qs("Installed",s?.installed)}
1040
1038
  ${Qs("Latest",s?.latest,s?.latest?`npm install -g @worca/ui@${s.latest}`:null)}
1041
1039
  ${Qs("Latest RC",s?.latestRc,s?.latestRc?`npm install -g @worca/ui@${s.latestRc}`:null)}
1042
- ${Qs("Local repo",i?.worcaUi||null)}
1040
+ ${Qs("Local repo",n(i?.worcaUi,i?.worcaUiDev),null,a(i?.worcaUiDev))}
1043
1041
  </div>
1044
1042
  </div>
1045
1043
  </div>
1044
+ ${r?u`
1045
+ <div class="install-path-row">
1046
+ <span class="install-path-label">Current worca-ui instance</span>
1047
+ <code class="install-path-value">${r}</code>
1048
+ </div>
1049
+ `:C}
1046
1050
  <div class="version-refresh">
1047
- <sl-button size="small" @click=${()=>sa(e,!0)} ?loading=${cr}>
1048
- ${k(R(Pe,14))}
1051
+ <sl-button size="small" @click=${()=>ea(e,!0)} ?loading=${cr}>
1052
+ ${T(R(Pe,14))}
1049
1053
  Refresh
1050
1054
  </sl-button>
1051
- <span class="version-refresh-hint">Updated ${$w(r)}</span>
1055
+ <span class="version-refresh-hint">Updated ${$w(o)}</span>
1052
1056
  </div>
1053
1057
  `}function Aw(e,{onThemeToggle:t,onSaveSourceRepo:s,rerender:i}){let r=e?.theme||"light",o=e?.source_repo||"";return u`
1054
1058
  <div class="settings-tab-content">
@@ -1070,7 +1074,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1070
1074
  </div>
1071
1075
  <div class="settings-tab-actions">
1072
1076
  <sl-button variant="primary" size="small" @click=${()=>{let a=document.getElementById("pref-source-repo")?.value?.trim()||"";s(a)}}>
1073
- ${k(R(ys,14))}
1077
+ ${T(R(ys,14))}
1074
1078
  Save
1075
1079
  </sl-button>
1076
1080
  </div>
@@ -1085,14 +1089,14 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1085
1089
  <thead>
1086
1090
  <tr>
1087
1091
  <th>Model</th>
1088
- ${ra.map(o=>u`<th>${o.label}</th>`)}
1092
+ ${ta.map(o=>u`<th>${o.label}</th>`)}
1089
1093
  </tr>
1090
1094
  </thead>
1091
1095
  <tbody>
1092
1096
  ${Hc.map(o=>{let n=i[o]||lf;return u`
1093
1097
  <tr>
1094
1098
  <td class="pricing-model-name">${o}</td>
1095
- ${ra.map(a=>u`
1099
+ ${ta.map(a=>u`
1096
1100
  <td>
1097
1101
  <sl-input
1098
1102
  class="pricing-input"
@@ -1158,12 +1162,12 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1158
1162
  </div>
1159
1163
 
1160
1164
  <div class="settings-tab-actions">
1161
- <sl-button variant="primary" size="small" @click=${()=>{let o=Sw();wo({worca:{pricing:o}},t)}}>
1162
- ${k(R(ys,14))}
1165
+ <sl-button variant="primary" size="small" @click=${()=>{let o=Sw();yo({worca:{pricing:o}},t)}}>
1166
+ ${T(R(ys,14))}
1163
1167
  Save
1164
1168
  </sl-button>
1165
- <sl-button variant="default" size="small" outline @click=${()=>So("pricing",t)}>
1166
- ${k(R(Pe,14))}
1169
+ <sl-button variant="default" size="small" outline @click=${()=>wo("pricing",t)}>
1170
+ ${T(R(Pe,14))}
1167
1171
  Reset
1168
1172
  </sl-button>
1169
1173
  </div>
@@ -1208,16 +1212,16 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1208
1212
 
1209
1213
  <div class="settings-tab-actions">
1210
1214
  <sl-button variant="primary" size="small" ?disabled=${h} @click=${()=>{let d=document.getElementById("notif-enabled")?.checked??!0,m=document.getElementById("notif-sound")?.checked??!1,p={};for(let f of Object.keys(nf))p[f]=document.getElementById(`notif-evt-${f}`)?.checked??!0;s({enabled:d,sound:m,events:p})}}>
1211
- ${k(R(ys,14))}
1215
+ ${T(R(ys,14))}
1212
1216
  Save
1213
1217
  </sl-button>
1214
1218
  </div>
1215
1219
  </div>
1216
- `}var ta={};function Dw(){return{enabled:document.getElementById("events-enabled")?.checked??!0,agent_telemetry:document.getElementById("events-agent-telemetry")?.checked??!1,hook_events:document.getElementById("events-hook-events")?.checked??!0,rate_limit_ms:parseInt(document.getElementById("events-rate-limit-ms")?.value,10)||1e3}}function Pw(){let e={},t=parseFloat(document.getElementById("budget-max-cost")?.value);!Number.isNaN(t)&&t>0&&(e.max_cost_usd=t);let s=parseInt(document.getElementById("budget-warning-pct")?.value,10);return Number.isNaN(s)||(e.warning_pct=s),e}function Mw(){return(X?.worca?.webhooks||[]).map((t,s)=>{let i=(document.getElementById(`webhook-${s}-events`)?.value||"").trim();return{url:document.getElementById(`webhook-${s}-url`)?.value?.trim()||"",secret:document.getElementById(`webhook-${s}-secret`)?.value||"",events:i?i.split(",").map(r=>r.trim()).filter(Boolean):[],timeout_ms:parseInt(document.getElementById(`webhook-${s}-timeout-ms`)?.value,10)||1e4,max_retries:parseInt(document.getElementById(`webhook-${s}-retries`)?.value,10)||3,rate_limit_ms:parseInt(document.getElementById(`webhook-${s}-rate-limit-ms`)?.value,10)||1e3,control:document.getElementById(`webhook-${s}-control`)?.checked??!1}})}function Bw(e,t,s){let i=ta[t];return u`
1220
+ `}var Qn={};function Dw(){return{enabled:document.getElementById("events-enabled")?.checked??!0,agent_telemetry:document.getElementById("events-agent-telemetry")?.checked??!1,hook_events:document.getElementById("events-hook-events")?.checked??!0,rate_limit_ms:parseInt(document.getElementById("events-rate-limit-ms")?.value,10)||1e3}}function Pw(){let e={},t=parseFloat(document.getElementById("budget-max-cost")?.value);!Number.isNaN(t)&&t>0&&(e.max_cost_usd=t);let s=parseInt(document.getElementById("budget-warning-pct")?.value,10);return Number.isNaN(s)||(e.warning_pct=s),e}function Mw(){return(X?.worca?.webhooks||[]).map((t,s)=>{let i=(document.getElementById(`webhook-${s}-events`)?.value||"").trim();return{url:document.getElementById(`webhook-${s}-url`)?.value?.trim()||"",secret:document.getElementById(`webhook-${s}-secret`)?.value||"",events:i?i.split(",").map(r=>r.trim()).filter(Boolean):[],timeout_ms:parseInt(document.getElementById(`webhook-${s}-timeout-ms`)?.value,10)||1e4,max_retries:parseInt(document.getElementById(`webhook-${s}-retries`)?.value,10)||3,rate_limit_ms:parseInt(document.getElementById(`webhook-${s}-rate-limit-ms`)?.value,10)||1e3,control:document.getElementById(`webhook-${s}-control`)?.checked??!1}})}function Bw(e,t,s){let i=Qn[t];return u`
1217
1221
  <div class="settings-card webhook-card">
1218
1222
  <div class="settings-card-header">
1219
1223
  <span class="settings-card-title">Webhook ${t+1}</span>
1220
- <sl-icon-button label="Remove webhook" @click=${()=>{X.worca.webhooks.splice(t,1),delete ta[t],s()}}>${k(R(Yi,14))}</sl-icon-button>
1224
+ <sl-icon-button label="Remove webhook" @click=${()=>{X.worca.webhooks.splice(t,1),delete Qn[t],s()}}>${T(R(Yi,14))}</sl-icon-button>
1221
1225
  </div>
1222
1226
  <div class="settings-card-body">
1223
1227
  <div class="settings-field">
@@ -1252,7 +1256,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1252
1256
  <span class="settings-switch-desc">Allow this webhook to control the pipeline (requires non-empty secret)</span>
1253
1257
  </div>
1254
1258
  <div class="webhook-actions">
1255
- <sl-button size="small" @click=${async()=>{let r=document.getElementById(`webhook-${t}-url`)?.value?.trim()||"",o=document.getElementById(`webhook-${t}-secret`)?.value||"",n=parseInt(document.getElementById(`webhook-${t}-timeout-ms`)?.value,10)||1e4;try{let a=await fetch("/api/webhooks/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:r,secret:o,timeout_ms:n})});ta[t]=await a.json()}catch(a){ta[t]={ok:!1,error:a.message}}s()}}>Test</sl-button>
1259
+ <sl-button size="small" @click=${async()=>{let r=document.getElementById(`webhook-${t}-url`)?.value?.trim()||"",o=document.getElementById(`webhook-${t}-secret`)?.value||"",n=parseInt(document.getElementById(`webhook-${t}-timeout-ms`)?.value,10)||1e4;try{let a=await fetch("/api/webhooks/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:r,secret:o,timeout_ms:n})});Qn[t]=await a.json()}catch(a){Qn[t]={ok:!1,error:a.message}}s()}}>Test</sl-button>
1256
1260
  ${i?u`
1257
1261
  <span class="webhook-test-result ${i.ok?"webhook-test-result--ok":"webhook-test-result--err"}">
1258
1262
  ${i.ok?`${i.status_code} OK (${i.response_ms}ms)`:i.error||"failed"}
@@ -1306,17 +1310,17 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1306
1310
  ${r.map((o,n)=>Bw(o,n,t))}
1307
1311
  </div>
1308
1312
  <sl-button size="small" variant="text" @click=${()=>{X.worca.webhooks=[...X.worca.webhooks||[],{url:"",secret:"",events:[],timeout_ms:1e4,max_retries:3,rate_limit_ms:1e3,control:!1}],t()}}>
1309
- ${k(R(Zt,14))}
1313
+ ${T(R(Zt,14))}
1310
1314
  Add Webhook
1311
1315
  </sl-button>
1312
1316
 
1313
1317
  <div class="settings-tab-actions">
1314
- <sl-button variant="primary" size="small" @click=${()=>{let o=Dw(),n=Pw(),a=Mw();wo({worca:{events:o,budget:n,webhooks:a}},t)}}>
1315
- ${k(R(ys,14))}
1318
+ <sl-button variant="primary" size="small" @click=${()=>{let o=Dw(),n=Pw(),a=Mw();yo({worca:{events:o,budget:n,webhooks:a}},t)}}>
1319
+ ${T(R(ys,14))}
1316
1320
  Save
1317
1321
  </sl-button>
1318
- <sl-button variant="default" size="small" outline @click=${()=>So("webhooks",t)}>
1319
- ${k(R(Pe,14))}
1322
+ <sl-button variant="default" size="small" outline @click=${()=>wo("webhooks",t)}>
1323
+ ${T(R(Pe,14))}
1320
1324
  Reset
1321
1325
  </sl-button>
1322
1326
  </div>
@@ -1328,7 +1332,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1328
1332
  ${Kt}
1329
1333
  </sl-alert>
1330
1334
  </div>
1331
- `}function af(e){let t=e.match(/^(.+?)[-.]?rc\.?(\d+)$/),s=t?t[1]:e,i=t?parseInt(t[2],10):1/0;return{parts:s.split(".").map(o=>parseInt(o,10)||0),rc:i}}function Iw(e,t){if(!e||!t)return!1;let s=af(e),i=af(t),r=Math.max(s.parts.length,i.parts.length);for(let o=0;o<r;o++){let n=s.parts[o]||0,a=i.parts[o]||0;if(n<a)return!0;if(n>a)return!1}return s.rc<i.rc}function zw(e,{onProjectAdd:t,onProjectRemove:s,onProjectsRefresh:i,rerender:r}){let o=e||[];!ei&&!cr&&!hr&&sa(r);let n=ei?.activeWorcaCc||null;function a(h){At({label:"Remove Project",message:u`Are you sure you want to remove <strong>${h}</strong>? This only unregisters the project — no files are deleted.`,confirmLabel:"Remove",confirmVariant:"danger",onConfirm:()=>{fetch(`/api/projects/${h}`,{method:"DELETE"}).then(d=>d.json()).then(d=>{d.ok&&s?.(h)}).catch(()=>{})}},r)}function c(h){At({label:"Update Worca",message:u`Update worca pipeline files in <strong>${h}</strong>?`,confirmLabel:"Update",confirmVariant:"primary",onConfirm:()=>{fetch(`/api/projects/${h}/worca-setup`,{method:"POST"}).then(d=>d.json()).then(d=>{d.ok&&setTimeout(()=>i?.(),3e3)}).catch(()=>{})}},r)}function l(){t?.({openDialog:!0})}return u`
1335
+ `}function af(e){let t=e.match(/^(.+?)[-.]?rc\.?(\d+)$/),s=t?t[1]:e,i=t?parseInt(t[2],10):1/0;return{parts:s.split(".").map(o=>parseInt(o,10)||0),rc:i}}function Iw(e,t){if(!e||!t)return!1;let s=af(e),i=af(t),r=Math.max(s.parts.length,i.parts.length);for(let o=0;o<r;o++){let n=s.parts[o]||0,a=i.parts[o]||0;if(n<a)return!0;if(n>a)return!1}return s.rc<i.rc}function zw(e,{onProjectAdd:t,onProjectRemove:s,onProjectsRefresh:i,rerender:r}){let o=e||[];!ei&&!cr&&!hr&&ea(r);let n=ei?.activeWorcaCc||null;function a(h){At({label:"Remove Project",message:u`Are you sure you want to remove <strong>${h}</strong>? This only unregisters the project — no files are deleted.`,confirmLabel:"Remove",confirmVariant:"danger",onConfirm:()=>{fetch(`/api/projects/${h}`,{method:"DELETE"}).then(d=>d.json()).then(d=>{d.ok&&s?.(h)}).catch(()=>{})}},r)}function c(h){At({label:"Update Worca",message:u`Update worca pipeline files in <strong>${h}</strong>?`,confirmLabel:"Update",confirmVariant:"primary",onConfirm:()=>{fetch(`/api/projects/${h}/worca-setup`,{method:"POST"}).then(d=>d.json()).then(d=>{d.ok&&setTimeout(()=>i?.(),3e3)}).catch(()=>{})}},r)}function l(){t?.({openDialog:!0})}return u`
1332
1336
  <div class="settings-card">
1333
1337
  <h3>Projects</h3>
1334
1338
  <div class="projects-list">
@@ -1346,7 +1350,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1346
1350
  outline
1347
1351
  @click=${()=>c(h.name)}
1348
1352
  >
1349
- ${k(R(Pe,14))}
1353
+ ${T(R(Pe,14))}
1350
1354
  Update
1351
1355
  </sl-button>
1352
1356
  <sl-button
@@ -1355,7 +1359,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1355
1359
  outline
1356
1360
  @click=${()=>a(h.name)}
1357
1361
  >
1358
- ${k(R(gi,14))}
1362
+ ${T(R(gi,14))}
1359
1363
  Remove
1360
1364
  </sl-button>
1361
1365
  </div>
@@ -1365,7 +1369,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1365
1369
  </div>
1366
1370
  <div style="margin-top: 12px;">
1367
1371
  <sl-button size="small" @click=${l}>
1368
- ${k(R(Zt,14))}
1372
+ ${T(R(Zt,14))}
1369
1373
  Add Project
1370
1374
  </sl-button>
1371
1375
  </div>
@@ -1376,15 +1380,15 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1376
1380
  <div class="settings-page">
1377
1381
  <sl-tab-group>
1378
1382
  <sl-tab slot="nav" panel="projects">
1379
- ${k(R(Fr,14))}
1383
+ ${T(R(Fr,14))}
1380
1384
  Projects
1381
1385
  </sl-tab>
1382
1386
  <sl-tab slot="nav" panel="notifications">
1383
- ${k(R(Ua,14))}
1387
+ ${T(R(Wa,14))}
1384
1388
  Notifications
1385
1389
  </sl-tab>
1386
1390
  <sl-tab slot="nav" panel="preferences">
1387
- ${k(R(jr,14))}
1391
+ ${T(R(Wr,14))}
1388
1392
  Preferences
1389
1393
  </sl-tab>
1390
1394
 
@@ -1399,23 +1403,23 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1399
1403
  <div class="settings-page">
1400
1404
  <sl-tab-group>
1401
1405
  <sl-tab slot="nav" panel="agents">
1402
- ${k(R(an,14))}
1406
+ ${T(R(Za,14))}
1403
1407
  Agents
1404
1408
  </sl-tab>
1405
1409
  <sl-tab slot="nav" panel="pipeline">
1406
- ${k(R(Hr,14))}
1410
+ ${T(R(Qa,14))}
1407
1411
  Pipeline
1408
1412
  </sl-tab>
1409
1413
  <sl-tab slot="nav" panel="governance">
1410
- ${k(R(Za,14))}
1414
+ ${T(R(Ya,14))}
1411
1415
  Governance
1412
1416
  </sl-tab>
1413
1417
  <sl-tab slot="nav" panel="pricing">
1414
- ${k(R(Rt,14))}
1418
+ ${T(R(Rt,14))}
1415
1419
  Pricing
1416
1420
  </sl-tab>
1417
1421
  <sl-tab slot="nav" panel="webhooks">
1418
- ${k(R(pt,14))}
1422
+ ${T(R(pt,14))}
1419
1423
  Webhooks
1420
1424
  </sl-tab>
1421
1425
 
@@ -1426,7 +1430,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1426
1430
  <sl-tab-panel name="webhooks">${Ow(i,t)}</sl-tab-panel>
1427
1431
  </sl-tab-group>
1428
1432
  </div>
1429
- `}var as="none",As=null,ur="",Ri=null,pr="",Co=!1,fr="",Ai=null,oa="",Rs=null,mr="default";function pf(e){return e==="source"?"GitHub Issue URL":e==="spec"?"Spec File Path":""}var gr=null;function Nw(e){if(Ai!==null&&gr===e)return Promise.resolve(Ai);gr=e;let t=e?`/api/projects/${e}/branches`:"/api/branches";return fetch(t).then(s=>s.json()).then(s=>(Ai=s.ok&&s.branches||[],Ai)).catch(()=>(Ai=[],[]))}function Fw(e){if(Ri&&gr===e)return Promise.resolve(Ri);let t=e?`/api/projects/${e}/plan-files`:"/api/plan-files";return fetch(t).then(s=>s.json()).then(s=>(s.ok&&(Ri=s.files),Ri||[])).catch(()=>[])}function Hw(){if(!Ri)return[];if(!pr)return Ri;let e=pr.toLowerCase();return Ri.filter(t=>t.name.toLowerCase().includes(e)||t.path.toLowerCase().includes(e))}function Ww(e){let t={};for(let s of e)t[s.dir]||(t[s.dir]=[]),t[s.dir].push(s);return t}function jw(e){if(Rs!==null&&gr===e)return Promise.resolve(Rs);let t=e?`/api/projects/${e}/templates`:"/api/templates";return fetch(t).then(s=>s.json()).then(s=>(s.ok&&(Rs=s.templates),Rs||[])).catch(()=>(Rs=[],[]))}function Vw(){let e={worca:[],project:[],user:[]};for(let t of Rs||[]){let s=t.tier;e[s]&&e[s].push(t)}return e}function ff(){return{submitStatus:As,isSubmitting:As==="submitting"}}async function mf({rerender:e,onStarted:t,projectId:s}){let i=document.getElementById("new-run-source-value"),r=document.getElementById("new-run-prompt"),o=document.getElementById("new-run-msize"),n=document.getElementById("new-run-mloops"),a=i?.value?.trim()||"",c=r?.value?.trim()||"",l=as!=="none"&&a.length>0,h=!!fr,d=c.length>0;if(as!=="none"&&!a){As="error",ur=`Please enter a ${pf(as).toLowerCase()}.`,e();return}if(!l&&!h&&!d){As="error",ur="Please provide at least one of: a work source, a plan file, or a prompt.",e();return}let m=o&&parseInt(o.value,10)||1,p=n&&parseInt(n.value,10)||1;As="submitting",ur="",e();try{let f={sourceType:as,msize:Math.max(1,Math.min(10,m)),mloops:Math.max(1,Math.min(10,p))};l&&(f.sourceValue=a),d&&(f.prompt=c),h&&(f.planFile=fr),oa&&(f.branch=oa),mr&&mr!=="default"&&(f.template=mr);let _=s?`/api/projects/${s}/runs`:"/api/runs",$=await(await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})).json();$.ok?(As=null,t()):(As="error",ur=$.error||"Failed to start pipeline",e())}catch(f){As="error",ur=f.message||"Network error",e()}}function Uw(e){let t=e?.runs;return t?Object.values(t).some(s=>s.active===!0):!1}function gf(e,{rerender:t}){let s=e.currentProjectId||null,i=Uw(e);function r(x){as=x.target.value,t()}gr!==s&&(Rs=null),(Ai===null||gr!==s)&&Nw(s).then(()=>t()),Rs===null&&jw(s).then(()=>t());function o(x){mr=x.target.value,t()}function n(x){oa=x.target.value,t()}function a(){Fw(s).then(()=>{Co=!0,t()})}function c(x){pr=x.target.value,fr="",Co=!0,t()}function l(){setTimeout(()=>{Co=!1,t()},200)}function h(x){fr=x.path,pr=x.path,Co=!1,t()}function d(){fr="",pr="",t()}let m=Hw(),p=Ww(m),$=!(as!=="none")&&!!!fr?"Prompt (required)":"Additional Instructions (optional)";return u`
1433
+ `}var as="none",As=null,ur="",Ri=null,pr="",So=!1,fr="",Ai=null,sa="",Rs=null,mr="default";function pf(e){return e==="source"?"GitHub Issue URL":e==="spec"?"Spec File Path":""}var gr=null;function Nw(e){if(Ai!==null&&gr===e)return Promise.resolve(Ai);gr=e;let t=e?`/api/projects/${e}/branches`:"/api/branches";return fetch(t).then(s=>s.json()).then(s=>(Ai=s.ok&&s.branches||[],Ai)).catch(()=>(Ai=[],[]))}function Fw(e){if(Ri&&gr===e)return Promise.resolve(Ri);let t=e?`/api/projects/${e}/plan-files`:"/api/plan-files";return fetch(t).then(s=>s.json()).then(s=>(s.ok&&(Ri=s.files),Ri||[])).catch(()=>[])}function Hw(){if(!Ri)return[];if(!pr)return Ri;let e=pr.toLowerCase();return Ri.filter(t=>t.name.toLowerCase().includes(e)||t.path.toLowerCase().includes(e))}function Ww(e){let t={};for(let s of e)t[s.dir]||(t[s.dir]=[]),t[s.dir].push(s);return t}function jw(e){if(Rs!==null&&gr===e)return Promise.resolve(Rs);let t=e?`/api/projects/${e}/templates`:"/api/templates";return fetch(t).then(s=>s.json()).then(s=>(s.ok&&(Rs=s.templates),Rs||[])).catch(()=>(Rs=[],[]))}function Vw(){let e={worca:[],project:[],user:[]};for(let t of Rs||[]){let s=t.tier;e[s]&&e[s].push(t)}return e}function ff(){return{submitStatus:As,isSubmitting:As==="submitting"}}async function mf({rerender:e,onStarted:t,projectId:s}){let i=document.getElementById("new-run-source-value"),r=document.getElementById("new-run-prompt"),o=document.getElementById("new-run-msize"),n=document.getElementById("new-run-mloops"),a=i?.value?.trim()||"",c=r?.value?.trim()||"",l=as!=="none"&&a.length>0,h=!!fr,d=c.length>0;if(as!=="none"&&!a){As="error",ur=`Please enter a ${pf(as).toLowerCase()}.`,e();return}if(!l&&!h&&!d){As="error",ur="Please provide at least one of: a work source, a plan file, or a prompt.",e();return}let m=o&&parseInt(o.value,10)||1,p=n&&parseInt(n.value,10)||1;As="submitting",ur="",e();try{let f={sourceType:as,msize:Math.max(1,Math.min(10,m)),mloops:Math.max(1,Math.min(10,p))};l&&(f.sourceValue=a),d&&(f.prompt=c),h&&(f.planFile=fr),sa&&(f.branch=sa),mr&&mr!=="default"&&(f.template=mr);let _=s?`/api/projects/${s}/runs`:"/api/runs",k=await(await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)})).json();k.ok?(As=null,t()):(As="error",ur=k.error||"Failed to start pipeline",e())}catch(f){As="error",ur=f.message||"Network error",e()}}function Uw(e){let t=e?.runs;return t?Object.values(t).some(s=>s.active===!0):!1}function gf(e,{rerender:t}){let s=e.currentProjectId||null,i=Uw(e);function r(x){as=x.target.value,t()}gr!==s&&(Rs=null),(Ai===null||gr!==s)&&Nw(s).then(()=>t()),Rs===null&&jw(s).then(()=>t());function o(x){mr=x.target.value,t()}function n(x){sa=x.target.value,t()}function a(){Fw(s).then(()=>{So=!0,t()})}function c(x){pr=x.target.value,fr="",So=!0,t()}function l(){setTimeout(()=>{So=!1,t()},200)}function h(x){fr=x.path,pr=x.path,So=!1,t()}function d(){fr="",pr="",t()}let m=Hw(),p=Ww(m),k=!(as!=="none")&&!!!fr?"Prompt (required)":"Additional Instructions (optional)";return u`
1430
1434
  <div class="new-run-page">
1431
1435
  ${i?u`
1432
1436
  <div class="new-run-info">
@@ -1470,9 +1474,9 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1470
1474
  clearable
1471
1475
  @sl-clear=${d}
1472
1476
  >
1473
- <span slot="prefix">${k(R(Nr,14))}</span>
1477
+ <span slot="prefix">${T(R(Nr,14))}</span>
1474
1478
  </sl-input>
1475
- ${Co&&m.length>0?u`
1479
+ ${So&&m.length>0?u`
1476
1480
  <div class="plan-dropdown">
1477
1481
  ${Object.entries(p).map(([x,v])=>u`
1478
1482
  <div class="plan-group-header">${x}/</div>
@@ -1532,7 +1536,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1532
1536
  <div class="new-run-section">
1533
1537
  <h3 class="new-run-section-title">Prompt</h3>
1534
1538
  <div class="settings-field">
1535
- <label class="settings-label">${$}</label>
1539
+ <label class="settings-label">${k}</label>
1536
1540
  <sl-textarea id="new-run-prompt" rows="8" placeholder="Describe what the pipeline should do..."></sl-textarea>
1537
1541
  </div>
1538
1542
  </div>
@@ -1557,7 +1561,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1557
1561
 
1558
1562
  <div class="settings-field">
1559
1563
  <label class="settings-label">Branch</label>
1560
- <sl-select value=${oa} @sl-change=${n}>
1564
+ <sl-select value=${sa} @sl-change=${n}>
1561
1565
  <sl-option value="">&lt;New branch&gt;</sl-option>
1562
1566
  ${(Ai||[]).map(x=>u`
1563
1567
  <sl-option value=${x}>${x}</sl-option>
@@ -1569,18 +1573,18 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1569
1573
  </div>
1570
1574
  </div>
1571
1575
  </div>
1572
- `}function _f(e,t,s){return!s||s.length===0?null:e?.get(t)??s[s.length-1].number}function qw(e){return cn(Object.entries(e))}var Kw={pending:gs,running:De,in_progress:De,completed:vs,failed:_s,error:_s,paused:rt,interrupted:rt,resuming:Wr,skipped:zr};function Gw(e,t){return t?.[e]?.label?t[e].label:e.replace(/_/g," ").toUpperCase()}function vf(e,t={},s=!0){if(!e||typeof e!="object")return u``;let i=qw(e);return i.length===0?u`<div class="empty-state">No stages</div>`:u`
1576
+ `}function _f(e,t,s){return!s||s.length===0?null:e?.get(t)??s[s.length-1].number}function qw(e){return an(Object.entries(e))}var Kw={pending:gs,running:De,in_progress:De,completed:vs,failed:_s,error:_s,paused:rt,interrupted:rt,resuming:Hr,skipped:zr};function Gw(e,t){return t?.[e]?.label?t[e].label:e.replace(/_/g," ").toUpperCase()}function vf(e,t={},s=!0){if(!e||typeof e!="object")return u``;let i=qw(e);return i.length===0?u`<div class="empty-state">No stages</div>`:u`
1573
1577
  <div class="stage-timeline">
1574
1578
  ${i.map(([r,o],n)=>{let a=Xi(o.status||"pending",s),c=Kw[a]||gs,l=Gw(r,t),h=a==="in_progress"||a==="running"||a==="resuming",d=o.iteration,m=h?"icon-spin":"";return u`
1575
1579
  ${n>0?u`<div class="stage-connector ${i[n-1]?.[1]?.status==="completed"?"completed":""}"></div>`:""}
1576
1580
  <div class="stage-node ${Ji(a)} ${h?"pulse":""}">
1577
- <div class="stage-icon">${k(R(c,22,m))}</div>
1581
+ <div class="stage-icon">${T(R(c,22,m))}</div>
1578
1582
  <div class="stage-label">${l}</div>
1579
- ${d>1?u`<span class="loop-indicator">${k(R(Pe,10))}${d}</span>`:""}
1583
+ ${d>1?u`<span class="loop-indicator">${T(R(Pe,10))}${d}</span>`:""}
1580
1584
  </div>
1581
1585
  `})}
1582
1586
  </div>
1583
- `}function Yw(e){return cn(Object.entries(e))}function Xw(e){return e?e.startsWith("builtin:")?`worca:${e.slice(8)}`:e:null}function Jw(e,t){if(!t||t<=0)return C;let s=e.reduce((h,d)=>h+(d.duration_api_ms||0),0),i=e.reduce((h,d)=>d.duration_session_ms!=null?h+d.duration_session_ms:h+(d.duration_ms||0),0),r=Math.max(0,i-s),o=Math.max(0,t-i);if(s<=0&&r<=0)return C;let n=Math.round(s/t*100),a=Math.round(r/t*100),c=Math.max(0,100-n-a),l=[{key:"thinking",pct:n,ms:s,label:"Thinking (Agent)",desc:"Time spent on model inference (API round-trips)",cls:"timing-bar-thinking"},{key:"tools",pct:a,ms:r,label:"Tools (Agent)",desc:"Time spent executing tools (bash, file I/O, subprocesses)",cls:"timing-bar-tools"},{key:"rest",pct:c,ms:o,label:"Rest of Pipeline",desc:"Orchestration, status writes, stage transitions, retry delays",cls:"timing-bar-rest"}].filter(h=>h.pct>0);return u`
1587
+ `}function Yw(e){return an(Object.entries(e))}function Xw(e){return e?e.startsWith("builtin:")?`worca:${e.slice(8)}`:e:null}function Jw(e,t){if(!t||t<=0)return C;let s=e.reduce((h,d)=>h+(d.duration_api_ms||0),0),i=e.reduce((h,d)=>d.duration_session_ms!=null?h+d.duration_session_ms:h+(d.duration_ms||0),0),r=Math.max(0,i-s),o=Math.max(0,t-i);if(s<=0&&r<=0)return C;let n=Math.round(s/t*100),a=Math.round(r/t*100),c=Math.max(0,100-n-a),l=[{key:"thinking",pct:n,ms:s,label:"Thinking (Agent)",desc:"Time spent on model inference (API round-trips)",cls:"timing-bar-thinking"},{key:"tools",pct:a,ms:r,label:"Tools (Agent)",desc:"Time spent executing tools (bash, file I/O, subprocesses)",cls:"timing-bar-tools"},{key:"rest",pct:c,ms:o,label:"Rest of Pipeline",desc:"Orchestration, status writes, stage transitions, retry delays",cls:"timing-bar-rest"}].filter(h=>h.pct>0);return u`
1584
1588
  <div class="pipeline-timing-bar-container">
1585
1589
  <div class="pipeline-timing-bar">
1586
1590
  ${l.map(h=>u`
@@ -1606,7 +1610,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1606
1610
  `)}
1607
1611
  </div>
1608
1612
  </div>
1609
- `}function Zw(e){if(!e)return null;let t=null;for(let s of Object.values(e))s.completed_at&&(!t||s.completed_at>t)&&(t=s.completed_at);return t}function Qw(e){return e==="completed"?"success":e==="error"?"danger":e==="in_progress"||e==="interrupted"?"warning":"neutral"}function e1(e){let t=e.status||"pending";return t==="completed"&&e.outcome==="success"?u`<span class="iter-status-icon success">${k(jt("completed",12))}</span>`:t==="completed"?u`<span class="iter-status-icon">${k(jt("completed",12))}</span>`:t==="error"?u`<span class="iter-status-icon failure">${k(jt("error",12))}</span>`:t==="in_progress"?u`<span class="iter-status-icon in-progress">${k(jt("in_progress",12))}</span>`:C}function bf(e){return e?u`<span class="iteration-trigger">${{initial:"Initial run",test_failure:"Test failure",review_changes:"Review changes",restart_planning:"Restart planning"}[e]||e}</span>`:C}function yf(e){return e?u`<span class="iteration-outcome ${e==="success"?"success":"failure"}">${e.replace(/_/g," ")}</span>`:C}function t1(e){return e==="infra_transient"?"warning":e==="infra_permanent"||e==="logic_stuck"||e==="env_missing"?"danger":"neutral"}function wf(e){let t=e.classification;if(!t)return C;let s=t1(t.category);return u`
1613
+ `}function Zw(e){if(!e)return null;let t=null;for(let s of Object.values(e))s.completed_at&&(!t||s.completed_at>t)&&(t=s.completed_at);return t}function Qw(e){return e==="completed"?"success":e==="error"?"danger":e==="in_progress"||e==="interrupted"?"warning":"neutral"}function e1(e){let t=e.status||"pending";return t==="completed"&&e.outcome==="success"?u`<span class="iter-status-icon success">${T(jt("completed",12))}</span>`:t==="completed"?u`<span class="iter-status-icon">${T(jt("completed",12))}</span>`:t==="error"?u`<span class="iter-status-icon failure">${T(jt("error",12))}</span>`:t==="in_progress"?u`<span class="iter-status-icon in-progress">${T(jt("in_progress",12))}</span>`:C}function bf(e){return e?u`<span class="iteration-trigger">${{initial:"Initial run",test_failure:"Test failure",review_changes:"Review changes",restart_planning:"Restart planning"}[e]||e}</span>`:C}function yf(e){return e?u`<span class="iteration-outcome ${e==="success"?"success":"failure"}">${e.replace(/_/g," ")}</span>`:C}function t1(e){return e==="infra_transient"?"warning":e==="infra_permanent"||e==="logic_stuck"||e==="env_missing"?"danger":"neutral"}function wf(e){let t=e.classification;if(!t)return C;let s=t1(t.category);return u`
1610
1614
  <div class="classification-strip">
1611
1615
  <span class="classification-strip-item">
1612
1616
  <span class="classification-strip-label">Category:</span>
@@ -1670,7 +1674,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1670
1674
  <div class="iteration-detail">
1671
1675
  ${Vc(e.started_at,e.completed_at)}
1672
1676
  <div class="stage-info-strip">
1673
- ${r?u`<span class="stage-info-item"><span class="stage-meta-icon">${k(R(qi,12))}</span> ${r}${o?u` <span class="text-muted">(${o})</span>`:""}</span>`:C}
1677
+ ${r?u`<span class="stage-info-item"><span class="stage-meta-icon">${T(R(qi,12))}</span> ${r}${o?u` <span class="text-muted">(${o})</span>`:""}</span>`:C}
1674
1678
  ${e.turns?u`<span class="stage-info-item"><span class="meta-label">Turns:</span> <span class="meta-value">${e.turns}</span></span>`:C}
1675
1679
  ${e.duration_api_ms?u`<span class="stage-info-item"><span class="meta-label">API Duration:</span> <span class="meta-value">${ye(e.duration_api_ms)}${e.started_at&&e.completed_at?` (${Math.round(e.duration_api_ms/Je(e.started_at,e.completed_at)*100)}%)`:""}</span></span>`:C}
1676
1680
  ${e.cost_usd!=null?u`<span class="stage-info-item"><span class="meta-label">Iteration Cost:</span> <span class="meta-value">$${Number(e.cost_usd).toFixed(2)}</span></span>`:C}
@@ -1684,38 +1688,38 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1684
1688
  `}function Uc(e,t){navigator.clipboard.writeText(e).then(()=>{t.textContent="Copied!",setTimeout(()=>{t.textContent="Copy"},1500)})}function xf(e,t){if(!t)return C;let{agentInstructions:s,userPrompt:i}=t;return!s&&!i?C:u`
1685
1689
  <sl-details class="agent-prompt-section" @sl-after-show=${Ut}>
1686
1690
  <div slot="summary" class="agent-prompt-header">
1687
- <span class="stage-meta-icon">${k(R(Nr,12))}</span>
1691
+ <span class="stage-meta-icon">${T(R(Nr,12))}</span>
1688
1692
  Agent Instructions
1689
1693
  </div>
1690
- ${i?u`
1694
+ ${s?u`
1691
1695
  <div class="agent-prompt-block">
1692
1696
  <div class="agent-prompt-label-row">
1693
- <span class="agent-prompt-label">User Prompt (-p)</span>
1694
- <button class="copy-btn" @click=${r=>Uc(i,r.currentTarget)}>
1695
- ${k(R(ze,11))} Copy
1697
+ <span class="agent-prompt-label">Agent Prompt (resolved)</span>
1698
+ <button class="copy-btn" @click=${r=>Uc(s,r.currentTarget)}>
1699
+ ${T(R(ze,11))} Copy
1696
1700
  </button>
1697
1701
  </div>
1698
- <pre class="agent-prompt-content">${i}</pre>
1702
+ <pre class="agent-prompt-content">${s}</pre>
1699
1703
  </div>
1700
1704
  `:C}
1701
- ${s?u`
1705
+ ${i?u`
1702
1706
  <div class="agent-prompt-block">
1703
1707
  <div class="agent-prompt-label-row">
1704
- <span class="agent-prompt-label">System Prompt (agent .md)</span>
1705
- <button class="copy-btn" @click=${r=>Uc(s,r.currentTarget)}>
1706
- ${k(R(ze,11))} Copy
1708
+ <span class="agent-prompt-label">User Message (-p)</span>
1709
+ <button class="copy-btn" @click=${r=>Uc(i,r.currentTarget)}>
1710
+ ${T(R(ze,11))} Copy
1707
1711
  </button>
1708
1712
  </div>
1709
- <pre class="agent-prompt-content">${s}</pre>
1713
+ <pre class="agent-prompt-content">${i}</pre>
1710
1714
  </div>
1711
1715
  `:C}
1712
1716
  </sl-details>
1713
1717
  `}function a1(e){let{svg:t,nodes:s}=cd(e);return u`
1714
1718
  <div class="run-beads-graph">
1715
- ${k(t)}
1719
+ ${T(t)}
1716
1720
  ${s.map(({issue:i,x:r,y:o,w:n,h:a})=>u`
1717
1721
  <sl-tooltip class="bead-tooltip" hoist placement="bottom" distance="4">
1718
- <div slot="content">${dn(i)}</div>
1722
+ <div slot="content">${cn(i)}</div>
1719
1723
  <div class="graph-tooltip-trigger" style="left:${r}px;top:${o}px;width:${n}px;height:${a}px"></div>
1720
1724
  </sl-tooltip>
1721
1725
  `)}
@@ -1724,7 +1728,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1724
1728
  <div class="run-beads-section">
1725
1729
  <sl-details class="run-beads-panel" @sl-after-show=${Ut}>
1726
1730
  <div slot="summary" class="run-beads-header">
1727
- <span class="run-beads-icon">${k(R(Ki,16))}</span>
1731
+ <span class="run-beads-icon">${T(R(Ki,16))}</span>
1728
1732
  <span class="run-beads-title">Beads</span>
1729
1733
  </div>
1730
1734
  <div class="run-beads-empty">No linked Beads issues</div>
@@ -1734,18 +1738,18 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1734
1738
  <div class="run-beads-section">
1735
1739
  <sl-details class="run-beads-panel" @sl-after-show=${Ut}>
1736
1740
  <div slot="summary" class="run-beads-header">
1737
- <span class="run-beads-icon">${k(R(Ki,16))}</span>
1741
+ <span class="run-beads-icon">${T(R(Ki,16))}</span>
1738
1742
  <span class="run-beads-title">Beads</span>
1739
1743
  <span class="run-beads-count">${e.filter(t=>t.status==="closed").length}/${e.length}</span>
1740
1744
  </div>
1741
1745
  <div class="run-beads-list">
1742
1746
  ${e.map(t=>u`
1743
1747
  <sl-tooltip class="bead-tooltip" hoist placement="bottom" distance="4">
1744
- <div slot="content">${dn(t)}</div>
1748
+ <div slot="content">${cn(t)}</div>
1745
1749
  <div class="run-bead-row">
1746
- <sl-badge variant="${sl(t.status,t)}" pill>${t.status}</sl-badge>
1750
+ <sl-badge variant="${tl(t.status,t)}" pill>${t.status}</sl-badge>
1747
1751
  ${t.blocked_by?.length?u`<sl-badge variant="warning" pill>blocked</sl-badge>`:""}
1748
- <sl-badge variant="${hn(t.priority)}" pill>P${t.priority}</sl-badge>
1752
+ <sl-badge variant="${ln(t.priority)}" pill>P${t.priority}</sl-badge>
1749
1753
  <span class="run-bead-id">#${t.id}</span>
1750
1754
  <span class="run-bead-title">${t.title}</span>
1751
1755
  </div>
@@ -1777,7 +1781,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1777
1781
  </div>
1778
1782
  `:C}
1779
1783
  ${Vc(e.started_at,n)}
1780
- ${(()=>{let p=Object.values(c).flatMap($=>$.iterations||[]),f=p.reduce(($,x)=>$+(x.cost_usd||0),0),_=p.reduce(($,x)=>$+(x.turns||0),0),S=e.started_at?Je(e.started_at,n||null):0;return u`
1784
+ ${(()=>{let p=Object.values(c).flatMap(k=>k.iterations||[]),f=p.reduce((k,x)=>k+(x.cost_usd||0),0),_=p.reduce((k,x)=>k+(x.turns||0),0),S=e.started_at?Je(e.started_at,n||null):0;return u`
1781
1785
  ${f>0||_>0?u`
1782
1786
  <div class="pipeline-cost-strip">
1783
1787
  ${f>0?u`<span class="pipeline-cost-item"><span class="meta-label">Pipeline Cost:</span> <span class="meta-value">$${f.toFixed(2)}</span></span>`:C}
@@ -1790,40 +1794,40 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1790
1794
  </div>
1791
1795
  `,m=u`
1792
1796
  <div class="stage-panels">
1793
- ${Yw(c).map(([p,f])=>{let _=l[p]?.label||p.replace(/_/g," ").toUpperCase(),S=Xi(f.status||"pending",e.active),$=f.agent||h[p]?.agent||p,x=f.model||h[p]?.model||"",v=Cf(f),y=v>0?ye(v):"",A=f.iterations||[],M=A.length>1,H=Sf(A);return u`
1797
+ ${Yw(c).map(([p,f])=>{let _=l[p]?.label||p.replace(/_/g," ").toUpperCase(),S=Xi(f.status||"pending",e.active),k=f.agent||h[p]?.agent||p,x=f.model||h[p]?.model||"",v=Cf(f),y=v>0?ye(v):"",A=f.iterations||[],M=A.length>1,H=Sf(A);return u`
1794
1798
  <sl-details ?open=${S==="in_progress"} class="stage-panel"
1795
1799
  @sl-after-show=${q=>{if(Ut(q),!M)return;let ee=q.target.querySelector("sl-tab-group");if(!ee)return;let ce=_f(s.stageIterationTab,p,A),V=`iter-${p}-${ce}`;requestAnimationFrame(()=>ee.show(V))}}>
1796
1800
  <div slot="summary" class="stage-panel-header">
1797
- <span class="stage-panel-icon ${Ji(S)}">${k(jt(S))}</span>
1801
+ <span class="stage-panel-icon ${Ji(S)}">${T(jt(S))}</span>
1798
1802
  <span class="stage-panel-label">${_}</span>
1799
1803
  <span class="stage-panel-meta">
1800
1804
  ${M?u`
1801
1805
  <span class="stage-meta-item stage-meta-iteration">
1802
- <span class="stage-meta-icon">${k(R(Pe,11))}</span>
1806
+ <span class="stage-meta-icon">${T(R(Pe,11))}</span>
1803
1807
  <span class="meta-value">${A.length} iterations</span>
1804
1808
  </span>
1805
1809
  `:C}
1806
1810
  ${(()=>{let q=A.reduce((ee,ce)=>ee+(ce.turns||0),0);return q>0?u`
1807
1811
  <span class="stage-meta-item">
1808
- <span class="stage-meta-icon">${k(R(Pe,11))}</span>
1812
+ <span class="stage-meta-icon">${T(R(Pe,11))}</span>
1809
1813
  <span class="meta-value">${q} turns</span>
1810
1814
  </span>
1811
1815
  `:C})()}
1812
1816
  ${H>0?u`
1813
1817
  <span class="stage-meta-item">
1814
- <span class="stage-meta-icon">${k(R(Rt,11))}</span>
1818
+ <span class="stage-meta-icon">${T(R(Rt,11))}</span>
1815
1819
  <span class="meta-value">$${H.toFixed(2)}</span>
1816
1820
  </span>
1817
1821
  `:C}
1818
1822
  ${f.completed_at?u`
1819
1823
  <span class="stage-meta-item">
1820
- <span class="stage-meta-icon">${k(R(Wt,11))}</span>
1824
+ <span class="stage-meta-icon">${T(R(Wt,11))}</span>
1821
1825
  <span class="meta-value">${ft(f.completed_at)}</span>
1822
1826
  </span>
1823
1827
  `:C}
1824
1828
  ${y?u`
1825
1829
  <span class="stage-meta-item">
1826
- <span class="stage-meta-icon">${k(R(Vr,11))}</span>
1830
+ <span class="stage-meta-icon">${T(R(jr,11))}</span>
1827
1831
  <span class="meta-value">${y}</span>
1828
1832
  </span>
1829
1833
  `:C}
@@ -1833,20 +1837,20 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1833
1837
  </sl-badge>
1834
1838
  </div>
1835
1839
  ${(()=>{let q=S!=="pending"?s.promptCache?.[p]:null,ee=u`
1836
- <button class="stage-copy-btn" title="Copy stage data as JSON" @click=${ce=>{let V=o1(p,f,$,x,q);Uc(JSON.stringify(V,null,2),ce.currentTarget)}}>
1837
- ${k(R(ze,12))} Copy
1840
+ <button class="stage-copy-btn" title="Copy stage data as JSON" @click=${ce=>{let V=o1(p,f,k,x,q);Uc(JSON.stringify(V,null,2),ce.currentTarget)}}>
1841
+ ${T(R(ze,12))} Copy
1838
1842
  </button>
1839
1843
  `;if(M){let ce=v>0?ye(v):"";return u`
1840
1844
  <div class="stage-content-wrapper">
1841
1845
  ${ee}
1842
- ${(()=>{let V=A.reduce((w,L)=>w+(L.duration_api_ms||0),0),ve=A.reduce((w,L)=>w+(L.turns||0),0),E=v>0&&V>0?Math.round(V/v*100):0;return u`
1846
+ ${(()=>{let V=A.reduce((w,L)=>w+(L.duration_api_ms||0),0),ve=A.reduce((w,L)=>w+(L.turns||0),0),$=v>0&&V>0?Math.round(V/v*100):0;return u`
1843
1847
  <div class="stage-totals-strip">
1844
1848
  <span class="stage-totals-item"><span class="meta-label">Cost:</span> <span class="meta-value">$${H.toFixed(2)}</span></span>
1845
1849
  <span class="stage-totals-item"><span class="meta-label">Duration:</span> <span class="meta-value">${ce}</span></span>
1846
- ${V>0?u`<span class="stage-totals-item"><span class="meta-label">API Duration:</span> <span class="meta-value">${ye(V)}${E>0?` (${E}%)`:""}</span></span>`:C}
1850
+ ${V>0?u`<span class="stage-totals-item"><span class="meta-label">API Duration:</span> <span class="meta-value">${ye(V)}${$>0?` (${$}%)`:""}</span></span>`:C}
1847
1851
  ${ve>0?u`<span class="stage-totals-item"><span class="meta-label">Turns:</span> <span class="meta-value">${ve}</span></span>`:C}
1848
1852
  </div>`})()}
1849
- <sl-tab-group @sl-tab-show=${V=>{let ve=V.detail.name,E=parseInt(ve.split("-").pop(),10);Number.isNaN(E)||s.onStageTabChange?.(p,E)}}>
1853
+ <sl-tab-group @sl-tab-show=${V=>{let ve=V.detail.name,$=parseInt(ve.split("-").pop(),10);Number.isNaN($)||s.onStageTabChange?.(p,$)}}>
1850
1854
  ${A.map(V=>u`
1851
1855
  <sl-tab slot="nav" panel="iter-${p}-${V.number}">
1852
1856
  Iter ${V.number} ${e1(V)}
@@ -1854,7 +1858,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1854
1858
  `)}
1855
1859
  ${A.map(V=>u`
1856
1860
  <sl-tab-panel name="iter-${p}-${V.number}">
1857
- ${n1(V,p,$,q)}
1861
+ ${n1(V,p,k,q)}
1858
1862
  </sl-tab-panel>
1859
1863
  `)}
1860
1864
  </sl-tab-group>
@@ -1865,7 +1869,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1865
1869
  <div class="stage-detail">
1866
1870
  ${Vc(f.started_at,f.completed_at)}
1867
1871
  <div class="stage-info-strip">
1868
- ${$?u`<span class="stage-info-item"><span class="stage-meta-icon">${k(R(qi,12))}</span> ${$}${x?u` <span class="text-muted">(${x})</span>`:""}</span>`:C}
1872
+ ${k?u`<span class="stage-info-item"><span class="stage-meta-icon">${T(R(qi,12))}</span> ${k}${x?u` <span class="text-muted">(${x})</span>`:""}</span>`:C}
1869
1873
  ${A.length===1&&A[0].turns?u`<span class="stage-info-item"><span class="meta-label">Turns:</span> <span class="meta-value">${A[0].turns}</span></span>`:C}
1870
1874
  ${A.length===1&&A[0].duration_api_ms?u`<span class="stage-info-item"><span class="meta-label">API Duration:</span> <span class="meta-value">${ye(A[0].duration_api_ms)}${v>0?` (${Math.round(A[0].duration_api_ms/v*100)}%)`:""}</span></span>`:C}
1871
1875
  ${A.length===1&&A[0].cost_usd!=null?u`<span class="stage-info-item"><span class="meta-label">Cost:</span> <span class="meta-value">$${Number(A[0].cost_usd).toFixed(2)}</span></span>`:C}
@@ -1883,7 +1887,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1883
1887
  ${S==="error"&&!e.active&&s.onRestartStage?u`
1884
1888
  <div class="stage-restart-btn">
1885
1889
  <sl-button variant="warning" size="small" @click=${()=>s.onRestartStage(p)}>
1886
- ${k(R(Ja,14))}
1890
+ ${T(R(Ga,14))}
1887
1891
  Restart Stage
1888
1892
  </sl-button>
1889
1893
  </div>
@@ -1914,7 +1918,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1914
1918
  ${p.map(_=>Vt(_,{onClick:s,onPause:i,onResume:r,onArchive:f?void 0:o,onUnarchive:f?n:void 0}))}
1915
1919
  </div>
1916
1920
  `}
1917
- `}function c1(e,t,s){let i=Object.values(t),r=e?i.filter(c=>{let l=c.project||c._project;return l?l===e:!s||s===e}):i,o=!1,n=!1,a=!1;for(let c of r){let l=c.pipeline_status||(c.active?"running":"completed");l==="running"?o=!0:l==="failed"||l==="error"?n=!0:(l==="paused"||l==="approval_needed")&&(a=!0)}return o?"running":n?"error":a?"paused":"idle"}function h1(e){switch(e){case"running":return"project-status-running";case"error":return"project-status-error";case"paused":return"project-status-paused";default:return"project-status-idle"}}function Tf(e,t,s,{onNavigate:i,onProjectChange:r,onAddProject:o}){let{runs:n,preferences:a,projects:c,currentProjectId:l}=e,h=Object.values(n),d=l&&(c||[]).length>1?h.filter(x=>(x.project||x._project)===l):h,m=d.filter(x=>{let v=x.pipeline_status||(x.active?"running":"completed");return v==="running"||v==="resuming"}).length,p=d.length,_=(e.beads?.issues||[]).filter(x=>x.status==="ready"&&(x.blocked_by?.length??0)===0).length,S=s==="open"?"connected":s==="reconnecting"?"reconnecting":"disconnected",$=s==="open"?"Connected":s==="reconnecting"?"Reconnecting\u2026":"Disconnected";return u`
1921
+ `}function c1(e,t,s){let i=Object.values(t),r=e?i.filter(c=>{let l=c.project||c._project;return l?l===e:!s||s===e}):i,o=!1,n=!1,a=!1;for(let c of r){let l=c.pipeline_status||(c.active?"running":"completed");l==="running"?o=!0:l==="failed"||l==="error"?n=!0:(l==="paused"||l==="approval_needed")&&(a=!0)}return o?"running":n?"error":a?"paused":"idle"}function h1(e){switch(e){case"running":return"project-status-running";case"error":return"project-status-error";case"paused":return"project-status-paused";default:return"project-status-idle"}}function Tf(e,t,s,{onNavigate:i,onProjectChange:r,onAddProject:o}){let{runs:n,preferences:a,projects:c,currentProjectId:l}=e,h=Object.values(n),d=l&&(c||[]).length>1?h.filter(x=>(x.project||x._project)===l):h,m=d.filter(x=>{let v=x.pipeline_status||(x.active?"running":"completed");return v==="running"||v==="resuming"}).length,p=d.length,_=(e.beads?.issues||[]).filter(x=>x.status==="ready"&&(x.blocked_by?.length??0)===0).length,S=s==="open"?"connected":s==="reconnecting"?"reconnecting":"disconnected",k=s==="open"?"Connected":s==="reconnecting"?"Reconnecting\u2026":"Disconnected";return u`
1918
1922
  <aside class="sidebar ${a.sidebarCollapsed?"collapsed":""}">
1919
1923
  <div class="sidebar-logo" @click=${()=>i("dashboard")} style="cursor:pointer">
1920
1924
  <span class="logo-text">WORCA</span>
@@ -1943,7 +1947,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1943
1947
  </sl-select>
1944
1948
  </div>
1945
1949
  <button class="sidebar-add-project-btn" aria-label="Add project" @click=${()=>o?.()}>
1946
- ${k(R(Zt,16))}
1950
+ ${T(R(Zt,16))}
1947
1951
  </button>
1948
1952
  </div>
1949
1953
  </div>
@@ -1952,7 +1956,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1952
1956
  ${l||(c||[]).length<=1?u`
1953
1957
  <div class="sidebar-new-run">
1954
1958
  <button class="sidebar-new-run-btn" @click=${()=>i("new-run")}>
1955
- ${k(R(Zt,16))}
1959
+ ${T(R(Zt,16))}
1956
1960
  <span>New Pipeline</span>
1957
1961
  </button>
1958
1962
  </div>
@@ -1962,7 +1966,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1962
1966
  <div class="sidebar-item ${t.section==="active"?"active":""}"
1963
1967
  @click=${()=>i("active")}>
1964
1968
  <span class="sidebar-item-left">
1965
- ${k(R(mi,16))}
1969
+ ${T(R(mi,16))}
1966
1970
  <span>Running</span>
1967
1971
  </span>
1968
1972
  ${m>0?u`<sl-badge variant="primary" pill>${m}</sl-badge>`:""}
@@ -1970,7 +1974,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1970
1974
  <div class="sidebar-item ${t.section==="history"?"active":""}"
1971
1975
  @click=${()=>i("history")}>
1972
1976
  <span class="sidebar-item-left">
1973
- ${k(R(Wa,16))}
1977
+ ${T(R(Na,16))}
1974
1978
  <span>History</span>
1975
1979
  </span>
1976
1980
  ${p>0?u`<sl-badge variant="neutral" pill>${p}</sl-badge>`:""}
@@ -1982,7 +1986,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1982
1986
  <div class="sidebar-item ${t.section==="beads"?"active":""}"
1983
1987
  @click=${()=>i("beads")}>
1984
1988
  <span class="sidebar-item-left">
1985
- ${k(R(Ki,16))}
1989
+ ${T(R(Ki,16))}
1986
1990
  <span>Beads</span>
1987
1991
  </span>
1988
1992
  ${_>0?u`<sl-badge variant="success" pill>${_}</sl-badge>`:""}
@@ -1994,14 +1998,14 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
1994
1998
  <div class="sidebar-item ${t.section==="costs"?"active":""}"
1995
1999
  @click=${()=>i("costs")}>
1996
2000
  <span class="sidebar-item-left">
1997
- ${k(R(Rt,16))}
2001
+ ${T(R(Rt,16))}
1998
2002
  <span>Costs</span>
1999
2003
  </span>
2000
2004
  </div>
2001
2005
  <div class="sidebar-item ${t.section==="webhooks"?"active":""}"
2002
2006
  @click=${()=>i("webhooks")}>
2003
2007
  <span class="sidebar-item-left">
2004
- ${k(R(pt,16))}
2008
+ ${T(R(pt,16))}
2005
2009
  <span>Webhooks</span>
2006
2010
  </span>
2007
2011
  ${(e.webhookInbox?.events?.length||0)>0?u`<sl-badge variant="warning" pill>${e.webhookInbox.events.length}</sl-badge>`:""}
@@ -2013,7 +2017,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2013
2017
  <div class="sidebar-item ${t.section==="project-settings"?"active":""}"
2014
2018
  @click=${()=>i("project-settings")}>
2015
2019
  <span class="sidebar-item-left">
2016
- ${k(R(Qa,16))}
2020
+ ${T(R(Xa,16))}
2017
2021
  <span>Project Settings</span>
2018
2022
  </span>
2019
2023
  </div>
@@ -2023,13 +2027,13 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2023
2027
  <div class="sidebar-footer">
2024
2028
  <div class="connection-indicator ${S}">
2025
2029
  <span class="conn-dot"></span>
2026
- <span class="conn-label">${$}</span>
2030
+ <span class="conn-label">${k}</span>
2027
2031
  </div>
2028
2032
  <button
2029
2033
  class="theme-toggle-btn ${t.section==="settings"?"active":""}"
2030
2034
  aria-label="Settings"
2031
2035
  @click=${()=>i("settings")}
2032
- >${k(R(jr,18))}</button>
2036
+ >${T(R(Wr,18))}</button>
2033
2037
  </div>
2034
2038
  </aside>
2035
2039
  `}var Af=null,Rf=null,qc=null;function d1(e,t){return e===Af&&t===Rf||(Af=e,Rf=t,qc=[...Object.values(e),...Object.values(t||{})].filter(s=>s.stages&&Object.keys(s.stages).length>0).sort((s,i)=>(i.started_at||"").localeCompare(s.started_at||""))),qc}function u1(e){let t=0;for(let s of e)for(let i of Object.values(s.stages||{}))for(let r of i.iterations||[])t+=r.cost_usd||0;return t}function p1(e){let t=0,s=0,i=0,r=0,o=0;for(let n of Object.values(e))for(let a of Object.values(n))for(let c of a)t+=c.inputTokens||0,s+=c.outputTokens||0,i+=c.cacheReadInputTokens||0,r+=c.cacheCreationInputTokens||0,o+=c.webSearchRequests||0;return{input:t,output:s,cacheRead:i,cacheWrite:r,webSearches:o}}function f1(e){let t=0;for(let s of Object.values(e.stages||{}))for(let i of s.iterations||[])t+=i.cost_usd||0;return t}function m1(e){if(e.started_at){let t=e.completed_at||Kc(e.stages);if(t)return Je(e.started_at,t)}return 0}function Kc(e){if(!e)return null;let t=null;for(let s of Object.values(e))s.completed_at&&(!t||s.completed_at>t)&&(t=s.completed_at);return t}function _r(e){return e==null||e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Li(e){return e==null||e===0?"0":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function g1(e,t){let s=e?ye(Je(e,t||null)):"";return u`
@@ -2041,28 +2045,28 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2041
2045
  `}function Lf(e){let t=Object.keys(e||{});return wt.filter(s=>t.includes(s)).concat(t.filter(s=>!wt.includes(s)))}function _1(e,t){let s=u1(e),i=e.length>0?s/e.length:0,r=p1(t),o=r.input+r.output+r.cacheRead+r.cacheWrite;return u`
2042
2046
  <div class="costs-stats">
2043
2047
  <div class="stat-card stat-cost-total">
2044
- <div class="stat-icon-ring">${k(R(Rt,20))}</div>
2048
+ <div class="stat-icon-ring">${T(R(Rt,20))}</div>
2045
2049
  <div class="stat-body">
2046
2050
  <span class="stat-number">${_r(s)}</span>
2047
2051
  <span class="stat-label">Total Cost</span>
2048
2052
  </div>
2049
2053
  </div>
2050
2054
  <div class="stat-card stat-cost-avg">
2051
- <div class="stat-icon-ring">${k(R(pt,20))}</div>
2055
+ <div class="stat-icon-ring">${T(R(pt,20))}</div>
2052
2056
  <div class="stat-body">
2053
2057
  <span class="stat-number">${_r(i)}</span>
2054
2058
  <span class="stat-label">Avg / Run</span>
2055
2059
  </div>
2056
2060
  </div>
2057
2061
  <div class="stat-card stat-tokens">
2058
- <div class="stat-icon-ring">${k(R(qi,20))}</div>
2062
+ <div class="stat-icon-ring">${T(R(qi,20))}</div>
2059
2063
  <div class="stat-body">
2060
2064
  <span class="stat-number">${Li(o)}</span>
2061
2065
  <span class="stat-label">Total Tokens</span>
2062
2066
  </div>
2063
2067
  </div>
2064
2068
  <div class="stat-card stat-runs-count">
2065
- <div class="stat-icon-ring">${k(R(Wt,20))}</div>
2069
+ <div class="stat-icon-ring">${T(R(Wt,20))}</div>
2066
2070
  <div class="stat-body">
2067
2071
  <span class="stat-number">${e.length}</span>
2068
2072
  <span class="stat-label">Runs</span>
@@ -2070,7 +2074,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2070
2074
  </div>
2071
2075
  ${r.webSearches>0?u`
2072
2076
  <div class="stat-card stat-web-search">
2073
- <div class="stat-icon-ring">${k(R(Fs,20))}</div>
2077
+ <div class="stat-icon-ring">${T(R(Fs,20))}</div>
2074
2078
  <div class="stat-body">
2075
2079
  <span class="stat-number">${r.webSearches}</span>
2076
2080
  <span class="stat-label">Web Searches</span>
@@ -2092,10 +2096,10 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2092
2096
  <div class="cost-run-row ${h?"expanded":""}">
2093
2097
  <div class="cost-run-summary" @click=${()=>i(e.id)}>
2094
2098
  <span class="cost-run-title">${c}</span>
2095
- <span class="cost-run-date">${k(R(Wt,12))} ${l?ft(l):e.active?"running\u2026":"interrupted"}</span>
2096
- <span class="cost-run-cost">${k(R(Rt,12))} ${_r(r)}</span>
2099
+ <span class="cost-run-date">${T(R(Wt,12))} ${l?ft(l):e.active?"running\u2026":"interrupted"}</span>
2100
+ <span class="cost-run-cost">${T(R(Rt,12))} ${_r(r)}</span>
2097
2101
 
2098
- <span class="cost-run-duration">${k(R(Vr,12))} ${o>0?ye(o):"-"}</span>
2102
+ <span class="cost-run-duration">${T(R(jr,12))} ${o>0?ye(o):"-"}</span>
2099
2103
 
2100
2104
  <span class="cost-run-chevron">${h?"\u25BC":"\u25B6"}</span>
2101
2105
  </div>
@@ -2119,17 +2123,17 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2119
2123
  </tr>
2120
2124
  </thead>
2121
2125
  <tbody>
2122
- ${d.map(p=>{let _=e.stages[p]?.iterations||[],S=m[p]||[];return _.length===0?u`<tr class="cost-table-stage"><td>${p}</td><td colspan="9" class="cost-muted">-</td></tr>`:_.map(($,x)=>{let v=S[x]||{};return u`
2126
+ ${d.map(p=>{let _=e.stages[p]?.iterations||[],S=m[p]||[];return _.length===0?u`<tr class="cost-table-stage"><td>${p}</td><td colspan="9" class="cost-muted">-</td></tr>`:_.map((k,x)=>{let v=S[x]||{};return u`
2123
2127
  <tr class="${x===0?"cost-table-stage":"cost-table-iter"}">
2124
2128
  ${x===0?u`<td rowspan="${_.length}">${p}</td>`:C}
2125
- <td>#${$.number||x+1}</td>
2129
+ <td>#${k.number||x+1}</td>
2126
2130
  <td>
2127
- ${_r($.cost_usd)}
2128
- ${v.webSearchRequests?u`<span class="cost-badge" title="Includes ${v.webSearchRequests} web search(es)">${k(R(Fs,10))} ${v.webSearchRequests}</span>`:C}
2131
+ ${_r(k.cost_usd)}
2132
+ ${v.webSearchRequests?u`<span class="cost-badge" title="Includes ${v.webSearchRequests} web search(es)">${T(R(Fs,10))} ${v.webSearchRequests}</span>`:C}
2129
2133
  </td>
2130
- <td>${$.turns||"-"}</td>
2131
- <td>${$.duration_ms?ye($.duration_ms):"-"}</td>
2132
- <td>${$.duration_api_ms?ye($.duration_api_ms):"-"}</td>
2134
+ <td>${k.turns||"-"}</td>
2135
+ <td>${k.duration_ms?ye(k.duration_ms):"-"}</td>
2136
+ <td>${k.duration_api_ms?ye(k.duration_api_ms):"-"}</td>
2133
2137
  <td>${v.inputTokens?Li(v.inputTokens):"-"}</td>
2134
2138
  <td>${v.outputTokens?Li(v.outputTokens):"-"}</td>
2135
2139
  <td>${v.cacheReadInputTokens?Li(v.cacheReadInputTokens):"-"}</td>
@@ -2152,7 +2156,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2152
2156
  </div>
2153
2157
  `:u`<div class="empty-state">No runs with cost data</div>`}
2154
2158
  </div>
2155
- `}function na(e){if(!e)return"other";let s=e.replace(/^pipeline\./,"").split(".")[0];return["run","stage","agent","bead","git","test","review","circuit_breaker","cost","loop","hook","control"].includes(s)?s:"other"}function y1(e){return e?e.replace(/^pipeline\./,""):""}function Pf(e){return{run:"cat-run",stage:"cat-stage",agent:"cat-agent",cost:"cat-cost",circuit_breaker:"cat-danger",hook:"cat-danger",test:"cat-stage",review:"cat-stage",bead:"cat-run",git:"cat-run",loop:"cat-cost",control:"cat-danger"}[e]||"cat-neutral"}function w1(e){if(!e)return"";let t=na(e.event_type),s=e.payload||{};switch(t){case"run":return s.status||s.outcome||"";case"stage":return[s.stage,s.outcome,s.duration_s!=null?`${s.duration_s}s`:""].filter(Boolean).join(" \u2022 ");case"agent":return[s.tool_name,s.file||s.command].filter(Boolean).join(" \u2022 ").slice(0,80);case"bead":return[s.bead_id,s.title].filter(Boolean).join(" \u2022 ").slice(0,80);case"git":return[s.branch,s.sha?.slice(0,7),s.pr_url].filter(Boolean).join(" \u2022 ");case"test":return s.passed!=null||s.failed!=null?`pass:${s.passed??0} fail:${s.failed??0}`:s.outcome||"";case"review":return[s.verdict,s.issue_count!=null?`${s.issue_count} issues`:""].filter(Boolean).join(" \u2022 ");case"circuit_breaker":return[s.category,s.consecutive!=null?`${s.consecutive}x`:""].filter(Boolean).join(" \u2022 ");case"cost":return s.total_cost!=null?`$${Number(s.total_cost).toFixed(2)}`:s.budget_pct!=null?`${s.budget_pct}% of budget`:"";case"loop":return[s.loop_key,s.iteration!=null?`iter ${s.iteration}`:"",s.from&&s.to?`${s.from}\u2192${s.to}`:""].filter(Boolean).join(" \u2022 ");case"hook":return[s.tool_blocked,s.reason].filter(Boolean).join(": ").slice(0,80);case"control":return s.action||"";default:return""}}function S1(e){if(!e)return"";let t=new Date(e),s=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}${i}${r}`}function C1(e){if(!e)return"";let t=new Date(e),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),r=String(t.getSeconds()).padStart(2,"0");return`${s}:${i}:${r}`}var Mf=["all","run","stage","agent","bead","cost","test","review","hook","other"];function Of(e,{selectedId:t,categoryFilter:s,runFilter:i,searchTerm:r,onSelectEvent:o,onCategoryFilter:n,onRunFilter:a,onSearch:c,onSetControl:l,onClear:h,onCopyJson:d,onDismissDetail:m}){let{events:p,controlAction:f}=e.webhookInbox,_={};for(let v of Mf)_[v]=0;for(let v of p){let y=na(v.envelope?.event_type);_[y]=(_[y]||0)+1,_.all++}let S=[...new Set(p.map(v=>v.envelope?.run_id).filter(Boolean))],$=p;if(s&&s!=="all"&&($=$.filter(v=>na(v.envelope?.event_type)===s)),i&&($=$.filter(v=>v.envelope?.run_id===i)),r){let v=r.toLowerCase();$=$.filter(y=>(y.envelope?.event_type||"").toLowerCase().includes(v)||JSON.stringify(y.envelope?.payload||{}).toLowerCase().includes(v))}let x=t?p.find(v=>v.id===t):null;return p.length===0?u`
2159
+ `}function ia(e){if(!e)return"other";let s=e.replace(/^pipeline\./,"").split(".")[0];return["run","stage","agent","bead","git","test","review","circuit_breaker","cost","loop","hook","control"].includes(s)?s:"other"}function y1(e){return e?e.replace(/^pipeline\./,""):""}function Pf(e){return{run:"cat-run",stage:"cat-stage",agent:"cat-agent",cost:"cat-cost",circuit_breaker:"cat-danger",hook:"cat-danger",test:"cat-stage",review:"cat-stage",bead:"cat-run",git:"cat-run",loop:"cat-cost",control:"cat-danger"}[e]||"cat-neutral"}function w1(e){if(!e)return"";let t=ia(e.event_type),s=e.payload||{};switch(t){case"run":return s.status||s.outcome||"";case"stage":return[s.stage,s.outcome,s.duration_s!=null?`${s.duration_s}s`:""].filter(Boolean).join(" \u2022 ");case"agent":return[s.tool_name,s.file||s.command].filter(Boolean).join(" \u2022 ").slice(0,80);case"bead":return[s.bead_id,s.title].filter(Boolean).join(" \u2022 ").slice(0,80);case"git":return[s.branch,s.sha?.slice(0,7),s.pr_url].filter(Boolean).join(" \u2022 ");case"test":return s.passed!=null||s.failed!=null?`pass:${s.passed??0} fail:${s.failed??0}`:s.outcome||"";case"review":return[s.verdict,s.issue_count!=null?`${s.issue_count} issues`:""].filter(Boolean).join(" \u2022 ");case"circuit_breaker":return[s.category,s.consecutive!=null?`${s.consecutive}x`:""].filter(Boolean).join(" \u2022 ");case"cost":return s.total_cost!=null?`$${Number(s.total_cost).toFixed(2)}`:s.budget_pct!=null?`${s.budget_pct}% of budget`:"";case"loop":return[s.loop_key,s.iteration!=null?`iter ${s.iteration}`:"",s.from&&s.to?`${s.from}\u2192${s.to}`:""].filter(Boolean).join(" \u2022 ");case"hook":return[s.tool_blocked,s.reason].filter(Boolean).join(": ").slice(0,80);case"control":return s.action||"";default:return""}}function S1(e){if(!e)return"";let t=new Date(e),s=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}${i}${r}`}function C1(e){if(!e)return"";let t=new Date(e),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),r=String(t.getSeconds()).padStart(2,"0");return`${s}:${i}:${r}`}var Mf=["all","run","stage","agent","bead","cost","test","review","hook","other"];function Of(e,{selectedId:t,categoryFilter:s,runFilter:i,searchTerm:r,onSelectEvent:o,onCategoryFilter:n,onRunFilter:a,onSearch:c,onSetControl:l,onClear:h,onCopyJson:d,onDismissDetail:m}){let{events:p,controlAction:f}=e.webhookInbox,_={};for(let v of Mf)_[v]=0;for(let v of p){let y=ia(v.envelope?.event_type);_[y]=(_[y]||0)+1,_.all++}let S=[...new Set(p.map(v=>v.envelope?.run_id).filter(Boolean))],k=p;if(s&&s!=="all"&&(k=k.filter(v=>ia(v.envelope?.event_type)===s)),i&&(k=k.filter(v=>v.envelope?.run_id===i)),r){let v=r.toLowerCase();k=k.filter(y=>(y.envelope?.event_type||"").toLowerCase().includes(v)||JSON.stringify(y.envelope?.payload||{}).toLowerCase().includes(v))}let x=t?p.find(v=>v.id===t):null;return p.length===0?u`
2156
2160
  <div class="webhook-inbox">
2157
2161
  <div class="webhook-inbox-toolbar">
2158
2162
  <div class="webhook-inbox-control">
@@ -2160,7 +2164,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2160
2164
  </div>
2161
2165
  </div>
2162
2166
  <div class="webhook-inbox-empty">
2163
- ${k(R(pt,32))}
2167
+ ${T(R(pt,32))}
2164
2168
  <p><strong>No webhook events received yet.</strong></p>
2165
2169
  <p>To start receiving events, add this URL to your webhook configuration:</p>
2166
2170
  <code class="webhook-inbox-url">http://localhost:3400/api/webhooks/inbox</code>
@@ -2188,7 +2192,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2188
2192
  </select>
2189
2193
  `:""}
2190
2194
  <div class="webhook-inbox-search">
2191
- ${k(R(Fs,14))}
2195
+ ${T(R(Fs,14))}
2192
2196
  <input type="text" placeholder="Filter events\u2026"
2193
2197
  .value=${r||""}
2194
2198
  @input=${v=>c(v.target.value)} />
@@ -2197,7 +2201,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2197
2201
  ${Bf(f,l)}
2198
2202
  </div>
2199
2203
  <button class="webhook-inbox-clear-btn" @click=${h} title="Clear all events">
2200
- ${k(R(gi,14))}
2204
+ ${T(R(gi,14))}
2201
2205
  </button>
2202
2206
  </div>
2203
2207
  </div>
@@ -2213,7 +2217,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2213
2217
  <span class="wh-col-run">Run</span>
2214
2218
  </div>
2215
2219
  <div class="webhook-inbox-list-body">
2216
- ${[...$].reverse().map(v=>{let y=na(v.envelope?.event_type);return u`
2220
+ ${[...k].reverse().map(v=>{let y=ia(v.envelope?.event_type);return u`
2217
2221
  <div class="webhook-inbox-row ${t===v.id?"selected":""}"
2218
2222
  @click=${()=>o(v.id)}>
2219
2223
  <span class="wh-col-id">${v.id}</span>
@@ -2236,10 +2240,10 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2236
2240
  <span class="webhook-inbox-detail-title">Event #${x.id} \u2014 ${x.envelope?.event_type||"unknown"}</span>
2237
2241
  <div class="webhook-inbox-detail-actions">
2238
2242
  <button class="webhook-inbox-copy-btn" @click=${()=>d(x)} title="Copy JSON">
2239
- ${k(R(ze,14))}
2243
+ ${T(R(ze,14))}
2240
2244
  </button>
2241
2245
  <button class="webhook-inbox-dismiss-btn" @click=${m} title="Close">
2242
- ${k(R(Yi,14))}
2246
+ ${T(R(Yi,14))}
2243
2247
  </button>
2244
2248
  </div>
2245
2249
  </div>
@@ -2261,7 +2265,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2261
2265
  </button>
2262
2266
  `)}
2263
2267
  </div>
2264
- `}var If=["subscribe-run","unsubscribe-run","subscribe-log","unsubscribe-log","list-runs","get-agent-prompt","get-preferences","set-preferences","stop-run","resume-run","list-beads-issues","start-beads-issue","list-beads-by-run","list-beads-counts","list-beads-refs","list-beads-unlinked","get-webhook-inbox","set-webhook-control","clear-webhook-inbox","hello","hello-ack","list-pipelines","subscribe-pipeline","unsubscribe-pipeline","pipeline-status-changed","pipelines-list","run-snapshot","run-update","runs-list","log-line","log-bulk","preferences","run-started","run-stopped","stage-restarted","beads-update","webhook-inbox-event","webhook-control-changed","webhook-inbox-cleared"];function Gc(){let e=Date.now().toString(36),t=Math.random().toString(36).slice(2,8);return`${e}-${t}`}function zf(e,t,s=Gc()){return{id:s,type:e,payload:t}}function Nf(e={}){let t={initialMs:e.backoff?.initialMs??1e3,maxMs:e.backoff?.maxMs??3e4,factor:e.backoff?.factor??2,jitterRatio:e.backoff?.jitterRatio??.2},s=()=>e.url&&e.url.length>0?e.url:typeof location<"u"?(location.protocol==="https:"?"wss://":"ws://")+location.host+"/ws":"ws://localhost/ws",i=null,r="closed",o=0,n=null,a=!0,c=new Map,l=[],h=new Map,d=new Set;function m(v){for(let y of Array.from(d))try{y(v)}catch{}}function p(){if(!a||n)return;r="reconnecting",m(r);let v=Math.min(t.maxMs,t.initialMs*t.factor**o),y=t.jitterRatio*v,A=Math.max(0,Math.round(v+(Math.random()*2-1)*y));n=setTimeout(()=>{n=null,x()},A)}function f(v){try{i?.send(JSON.stringify(v))}catch{}}function _(){for(r="open",m(r),o=0;l.length;){let v=l.shift();v&&f(v)}}function S(v){let y;try{y=JSON.parse(String(v.data))}catch{return}if(!y||typeof y.id!="string"||typeof y.type!="string")return;if(c.has(y.id)){let M=c.get(y.id);c.delete(y.id),y.ok?M?.resolve(y.payload):M?.reject(y.error||new Error("ws error"));return}let A=h.get(y.type);if(A&&A.size>0)for(let M of Array.from(A))try{M(y.payload,y)}catch{}}function $(){r="closed",m(r);for(let[v,y]of c.entries())y.reject(new Error("ws disconnected")),c.delete(v);o+=1,p()}function x(){if(!a)return;let v=s();try{i=new WebSocket(v),r="connecting",m(r),i.addEventListener("open",_),i.addEventListener("message",S),i.addEventListener("error",()=>{}),i.addEventListener("close",$)}catch{p()}}return x(),{sendRaw(v){f(v)},send(v,y){if(!If.includes(v))return Promise.reject(new Error(`unknown message type: ${v}`));let A=Gc(),M=zf(v,y,A);return new Promise((H,q)=>{c.set(A,{resolve:H,reject:q,type:v}),i&&i.readyState===i.OPEN?f(M):l.push(M)})},on(v,y){h.has(v)||h.set(v,new Set);let A=h.get(v);return A?.add(y),()=>{A?.delete(y)}},onConnection(v){return d.add(v),()=>{d.delete(v)}},close(){a=!1,n&&(clearTimeout(n),n=null);try{i?.close()}catch{}},getState(){return r}}}var aa=globalThis,la=aa.ShadowRoot&&(aa.ShadyCSS===void 0||aa.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yc=Symbol(),Ff=new WeakMap,xo=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==Yc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o,s=this.t;if(la&&t===void 0){let i=s!==void 0&&s.length===1;i&&(t=Ff.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ff.set(s,t))}return t}toString(){return this.cssText}},Hf=e=>new xo(typeof e=="string"?e:e+"",void 0,Yc),G=(e,...t)=>{let s=e.length===1?e[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[o+1],e[0]);return new xo(s,e,Yc)},Wf=(e,t)=>{if(la)e.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of t){let i=document.createElement("style"),r=aa.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=s.cssText,e.appendChild(i)}},Xc=la?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(let i of t.cssRules)s+=i.cssText;return Hf(s)})(e):e;var{is:x1,defineProperty:k1,getOwnPropertyDescriptor:$1,getOwnPropertyNames:E1,getOwnPropertySymbols:T1,getPrototypeOf:A1}=Object,si=globalThis,jf=si.trustedTypes,R1=jf?jf.emptyScript:"",L1=si.reactiveElementPolyfillSupport,ko=(e,t)=>e,ii={toAttribute(e,t){switch(t){case Boolean:e=e?R1:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},ca=(e,t)=>!x1(e,t),Vf={attribute:!0,type:String,converter:ii,reflect:!1,useDefault:!1,hasChanged:ca};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),si.litPropertyMetadata??(si.litPropertyMetadata=new WeakMap);var Ls=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=Vf){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,s);r!==void 0&&k1(this.prototype,t,r)}}static getPropertyDescriptor(t,s,i){let{get:r,set:o}=$1(this.prototype,t)??{get(){return this[s]},set(n){this[s]=n}};return{get:r,set(n){let a=r?.call(this);o?.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Vf}static _$Ei(){if(this.hasOwnProperty(ko("elementProperties")))return;let t=A1(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ko("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ko("properties"))){let s=this.properties,i=[...E1(s),...T1(s)];for(let r of i)this.createProperty(r,s[r])}let t=this[Symbol.metadata];if(t!==null){let s=litPropertyMetadata.get(t);if(s!==void 0)for(let[i,r]of s)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[s,i]of this.elementProperties){let r=this._$Eu(s,i);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let s=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)s.unshift(Xc(r))}else t!==void 0&&s.push(Xc(t));return s}static _$Eu(t,s){let i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,s=this.constructor.elementProperties;for(let i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Wf(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:ii).toAttribute(s,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,s){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let o=i.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ii;this._$Em=r;let a=n.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,s,i,r=!1,o){if(t!==void 0){let n=this.constructor;if(r===!1&&(o=this[t]),i??(i=n.getPropertyOptions(t)),!((i.hasChanged??ca)(o,s)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:r,wrapped:o},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??s??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),r===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,o]of i){let{wrapped:n}=o,a=this[r];n!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let t=!1,s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(s=>this._$ET(s,this[s]))),this._$EM()}updated(t){}firstUpdated(t){}};Ls.elementStyles=[],Ls.shadowRootOptions={mode:"open"},Ls[ko("elementProperties")]=new Map,Ls[ko("finalized")]=new Map,L1?.({ReactiveElement:Ls}),(si.reactiveElementVersions??(si.reactiveElementVersions=[])).push("2.1.2");var $o=globalThis,ri=class extends Ls{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;let t=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=t.firstChild),t}update(t){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=sn(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};ri._$litElement$=!0,ri.finalized=!0,$o.litElementHydrateSupport?.({LitElement:ri});var D1=$o.litElementPolyfillSupport;D1?.({LitElement:ri});($o.litElementVersions??($o.litElementVersions=[])).push("4.2.2");var Uf=G`
2268
+ `}var If=["subscribe-run","unsubscribe-run","subscribe-log","unsubscribe-log","list-runs","get-agent-prompt","get-preferences","set-preferences","stop-run","resume-run","list-beads-issues","start-beads-issue","list-beads-by-run","list-beads-counts","list-beads-refs","list-beads-unlinked","get-webhook-inbox","set-webhook-control","clear-webhook-inbox","hello","hello-ack","list-pipelines","subscribe-pipeline","unsubscribe-pipeline","pipeline-status-changed","pipelines-list","run-snapshot","run-update","runs-list","log-line","log-bulk","preferences","run-started","run-stopped","stage-restarted","beads-update","webhook-inbox-event","webhook-control-changed","webhook-inbox-cleared"];function Gc(){let e=Date.now().toString(36),t=Math.random().toString(36).slice(2,8);return`${e}-${t}`}function zf(e,t,s=Gc()){return{id:s,type:e,payload:t}}function Nf(e={}){let t={initialMs:e.backoff?.initialMs??1e3,maxMs:e.backoff?.maxMs??3e4,factor:e.backoff?.factor??2,jitterRatio:e.backoff?.jitterRatio??.2},s=()=>e.url&&e.url.length>0?e.url:typeof location<"u"?(location.protocol==="https:"?"wss://":"ws://")+location.host+"/ws":"ws://localhost/ws",i=null,r="closed",o=0,n=null,a=!0,c=new Map,l=[],h=new Map,d=new Set;function m(v){for(let y of Array.from(d))try{y(v)}catch{}}function p(){if(!a||n)return;r="reconnecting",m(r);let v=Math.min(t.maxMs,t.initialMs*t.factor**o),y=t.jitterRatio*v,A=Math.max(0,Math.round(v+(Math.random()*2-1)*y));n=setTimeout(()=>{n=null,x()},A)}function f(v){try{i?.send(JSON.stringify(v))}catch{}}function _(){for(r="open",m(r),o=0;l.length;){let v=l.shift();v&&f(v)}}function S(v){let y;try{y=JSON.parse(String(v.data))}catch{return}if(!y||typeof y.id!="string"||typeof y.type!="string")return;if(c.has(y.id)){let M=c.get(y.id);c.delete(y.id),y.ok?M?.resolve(y.payload):M?.reject(y.error||new Error("ws error"));return}let A=h.get(y.type);if(A&&A.size>0)for(let M of Array.from(A))try{M(y.payload,y)}catch{}}function k(){r="closed",m(r);for(let[v,y]of c.entries())y.reject(new Error("ws disconnected")),c.delete(v);o+=1,p()}function x(){if(!a)return;let v=s();try{i=new WebSocket(v),r="connecting",m(r),i.addEventListener("open",_),i.addEventListener("message",S),i.addEventListener("error",()=>{}),i.addEventListener("close",k)}catch{p()}}return x(),{sendRaw(v){f(v)},send(v,y){if(!If.includes(v))return Promise.reject(new Error(`unknown message type: ${v}`));let A=Gc(),M=zf(v,y,A);return new Promise((H,q)=>{c.set(A,{resolve:H,reject:q,type:v}),i&&i.readyState===i.OPEN?f(M):l.push(M)})},on(v,y){h.has(v)||h.set(v,new Set);let A=h.get(v);return A?.add(y),()=>{A?.delete(y)}},onConnection(v){return d.add(v),()=>{d.delete(v)}},close(){a=!1,n&&(clearTimeout(n),n=null);try{i?.close()}catch{}},getState(){return r}}}var ra=globalThis,oa=ra.ShadowRoot&&(ra.ShadyCSS===void 0||ra.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Yc=Symbol(),Ff=new WeakMap,Co=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==Yc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o,s=this.t;if(oa&&t===void 0){let i=s!==void 0&&s.length===1;i&&(t=Ff.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ff.set(s,t))}return t}toString(){return this.cssText}},Hf=e=>new Co(typeof e=="string"?e:e+"",void 0,Yc),G=(e,...t)=>{let s=e.length===1?e[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[o+1],e[0]);return new Co(s,e,Yc)},Wf=(e,t)=>{if(oa)e.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of t){let i=document.createElement("style"),r=ra.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=s.cssText,e.appendChild(i)}},Xc=oa?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(let i of t.cssRules)s+=i.cssText;return Hf(s)})(e):e;var{is:x1,defineProperty:k1,getOwnPropertyDescriptor:$1,getOwnPropertyNames:E1,getOwnPropertySymbols:T1,getPrototypeOf:A1}=Object,si=globalThis,jf=si.trustedTypes,R1=jf?jf.emptyScript:"",L1=si.reactiveElementPolyfillSupport,xo=(e,t)=>e,ii={toAttribute(e,t){switch(t){case Boolean:e=e?R1:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},na=(e,t)=>!x1(e,t),Vf={attribute:!0,type:String,converter:ii,reflect:!1,useDefault:!1,hasChanged:na};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),si.litPropertyMetadata??(si.litPropertyMetadata=new WeakMap);var Ls=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=Vf){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,s);r!==void 0&&k1(this.prototype,t,r)}}static getPropertyDescriptor(t,s,i){let{get:r,set:o}=$1(this.prototype,t)??{get(){return this[s]},set(n){this[s]=n}};return{get:r,set(n){let a=r?.call(this);o?.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Vf}static _$Ei(){if(this.hasOwnProperty(xo("elementProperties")))return;let t=A1(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(xo("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xo("properties"))){let s=this.properties,i=[...E1(s),...T1(s)];for(let r of i)this.createProperty(r,s[r])}let t=this[Symbol.metadata];if(t!==null){let s=litPropertyMetadata.get(t);if(s!==void 0)for(let[i,r]of s)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[s,i]of this.elementProperties){let r=this._$Eu(s,i);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let s=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)s.unshift(Xc(r))}else t!==void 0&&s.push(Xc(t));return s}static _$Eu(t,s){let i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,s=this.constructor.elementProperties;for(let i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Wf(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:ii).toAttribute(s,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,s){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let o=i.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ii;this._$Em=r;let a=n.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,s,i,r=!1,o){if(t!==void 0){let n=this.constructor;if(r===!1&&(o=this[t]),i??(i=n.getPropertyOptions(t)),!((i.hasChanged??na)(o,s)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:r,wrapped:o},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??s??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),r===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,o]of i){let{wrapped:n}=o,a=this[r];n!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let t=!1,s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(s=>this._$ET(s,this[s]))),this._$EM()}updated(t){}firstUpdated(t){}};Ls.elementStyles=[],Ls.shadowRootOptions={mode:"open"},Ls[xo("elementProperties")]=new Map,Ls[xo("finalized")]=new Map,L1?.({ReactiveElement:Ls}),(si.reactiveElementVersions??(si.reactiveElementVersions=[])).push("2.1.2");var ko=globalThis,ri=class extends Ls{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;let t=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=t.firstChild),t}update(t){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=tn(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};ri._$litElement$=!0,ri.finalized=!0,ko.litElementHydrateSupport?.({LitElement:ri});var D1=ko.litElementPolyfillSupport;D1?.({LitElement:ri});(ko.litElementVersions??(ko.litElementVersions=[])).push("4.2.2");var Uf=G`
2265
2269
  :host {
2266
2270
  display: block;
2267
2271
  }
@@ -2343,7 +2347,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2343
2347
  display: block;
2344
2348
  padding: var(--sl-spacing-medium);
2345
2349
  }
2346
- `;var Gf=Object.defineProperty,P1=Object.defineProperties,M1=Object.getOwnPropertyDescriptor,B1=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,O1=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable,Jc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Zc=e=>{throw TypeError(e)},Kf=(e,t,s)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,nt=(e,t)=>{for(var s in t||(t={}))O1.call(t,s)&&Kf(e,s,t[s]);if(qf)for(var s of qf(t))I1.call(t,s)&&Kf(e,s,t[s]);return e},Ds=(e,t)=>P1(e,B1(t)),g=(e,t,s,i)=>{for(var r=i>1?void 0:i?M1(t,s):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(i?n(t,s,r):n(r))||r);return i&&r&&Gf(t,s,r),r},Yf=(e,t,s)=>t.has(e)||Zc("Cannot "+s),Xf=(e,t,s)=>(Yf(e,t,"read from private field"),s?s.call(e):t.get(e)),Jf=(e,t,s)=>t.has(e)?Zc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Zf=(e,t,s,i)=>(Yf(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),z1=function(e,t){this[0]=e,this[1]=t},Qf=e=>{var t=e[Jc("asyncIterator")],s=!1,i,r={};return t==null?(t=e[Jc("iterator")](),i=o=>r[o]=n=>t[o](n)):(t=t.call(e),i=o=>r[o]=n=>{if(s){if(s=!1,o==="throw")throw n;return n}return s=!0,{done:!1,value:new z1(new Promise(a=>{var c=t[o](n);c instanceof Object||Zc("Object expected"),a(c)}),1)}}),r[Jc("iterator")]=()=>r,i("next"),"throw"in t?i("throw"):r.throw=o=>{throw o},"return"in t&&i("return"),r};var tm=new Map,N1=new WeakMap;function F1(e){return e??{keyframes:[],options:{duration:0}}}function em(e,t){return t.toLowerCase()==="rtl"?{keyframes:e.rtlKeyframes||e.keyframes,options:e.options}:e}function Ve(e,t){tm.set(e,F1(t))}function Ue(e,t,s){let i=N1.get(e);if(i?.[t])return em(i[t],s.dir);let r=tm.get(t);return r?em(r,s.dir):{keyframes:[],options:{duration:0}}}function ht(e,t){return new Promise(s=>{function i(r){r.target===e&&(e.removeEventListener(t,i),s())}e.addEventListener(t,i)})}function qe(e,t,s){return new Promise(i=>{if(s?.duration===1/0)throw new Error("Promise-based animations must be finite.");let r=e.animate(t,Ds(nt({},s),{duration:H1()?0:s.duration}));r.addEventListener("cancel",i,{once:!0}),r.addEventListener("finish",i,{once:!0})})}function Qc(e){return e=e.toString().toLowerCase(),e.indexOf("ms")>-1?parseFloat(e):e.indexOf("s")>-1?parseFloat(e)*1e3:parseFloat(e)}function H1(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tt(e){return Promise.all(e.getAnimations().map(t=>new Promise(s=>{t.cancel(),requestAnimationFrame(s)})))}function eh(e,t){return e.map(s=>Ds(nt({},s),{height:s.height==="auto"?`${t}px`:s.height}))}var th=new Set,vr=new Map,Di,sh="ltr",ih="en",sm=typeof MutationObserver<"u"&&typeof document<"u"&&typeof document.documentElement<"u";if(sm){let e=new MutationObserver(im);sh=document.documentElement.dir||"ltr",ih=document.documentElement.lang||navigator.language,e.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function Eo(...e){e.map(t=>{let s=t.$code.toLowerCase();vr.has(s)?vr.set(s,Object.assign(Object.assign({},vr.get(s)),t)):vr.set(s,t),Di||(Di=t)}),im()}function im(){sm&&(sh=document.documentElement.dir||"ltr",ih=document.documentElement.lang||navigator.language),[...th.keys()].map(e=>{typeof e.requestUpdate=="function"&&e.requestUpdate()})}var ha=class{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){th.add(this.host)}hostDisconnected(){th.delete(this.host)}dir(){return`${this.host.dir||sh}`.toLowerCase()}lang(){return`${this.host.lang||ih}`.toLowerCase()}getTranslationData(t){var s,i;let r=new Intl.Locale(t.replace(/_/g,"-")),o=r?.language.toLowerCase(),n=(i=(s=r?.region)===null||s===void 0?void 0:s.toLowerCase())!==null&&i!==void 0?i:"",a=vr.get(`${o}-${n}`),c=vr.get(o);return{locale:r,language:o,region:n,primary:a,secondary:c}}exists(t,s){var i;let{primary:r,secondary:o}=this.getTranslationData((i=s.lang)!==null&&i!==void 0?i:this.lang());return s=Object.assign({includeFallback:!1},s),!!(r&&r[t]||o&&o[t]||s.includeFallback&&Di&&Di[t])}term(t,...s){let{primary:i,secondary:r}=this.getTranslationData(this.lang()),o;if(i&&i[t])o=i[t];else if(r&&r[t])o=r[t];else if(Di&&Di[t])o=Di[t];else return console.error(`No translation found for: ${String(t)}`),String(t);return typeof o=="function"?o(...s):o}date(t,s){return t=new Date(t),new Intl.DateTimeFormat(this.lang(),s).format(t)}number(t,s){return t=Number(t),isNaN(t)?"":new Intl.NumberFormat(this.lang(),s).format(t)}relativeTime(t,s,i){return new Intl.RelativeTimeFormat(this.lang(),i).format(t,s)}};var rm={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(e,t)=>`Go to slide ${e} of ${t}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:e=>e===0?"No options selected":e===1?"1 option selected":`${e} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:e=>`Slide ${e}`,toggleColorFormat:"Toggle color format"};Eo(rm);var om=rm;var me=class extends ha{};Eo(om);var rh="";function nm(e){rh=e}function am(e=""){if(!rh){let t=[...document.getElementsByTagName("script")],s=t.find(i=>i.hasAttribute("data-shoelace"));if(s)nm(s.getAttribute("data-shoelace"));else{let i=t.find(o=>/shoelace(\.min)?\.js($|\?)/.test(o.src)||/shoelace-autoloader(\.min)?\.js($|\?)/.test(o.src)),r="";i&&(r=i.getAttribute("src")),nm(r.split("/").slice(0,-1).join("/"))}}return rh.replace(/\/$/,"")+(e?`/${e.replace(/^\//,"")}`:"")}var W1={name:"default",resolver:e=>am(`assets/icons/${e}.svg`)},lm=W1;var cm={caret:`
2350
+ `;var Gf=Object.defineProperty,P1=Object.defineProperties,M1=Object.getOwnPropertyDescriptor,B1=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,O1=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable,Jc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Zc=e=>{throw TypeError(e)},Kf=(e,t,s)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,nt=(e,t)=>{for(var s in t||(t={}))O1.call(t,s)&&Kf(e,s,t[s]);if(qf)for(var s of qf(t))I1.call(t,s)&&Kf(e,s,t[s]);return e},Ds=(e,t)=>P1(e,B1(t)),g=(e,t,s,i)=>{for(var r=i>1?void 0:i?M1(t,s):t,o=e.length-1,n;o>=0;o--)(n=e[o])&&(r=(i?n(t,s,r):n(r))||r);return i&&r&&Gf(t,s,r),r},Yf=(e,t,s)=>t.has(e)||Zc("Cannot "+s),Xf=(e,t,s)=>(Yf(e,t,"read from private field"),s?s.call(e):t.get(e)),Jf=(e,t,s)=>t.has(e)?Zc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),Zf=(e,t,s,i)=>(Yf(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),z1=function(e,t){this[0]=e,this[1]=t},Qf=e=>{var t=e[Jc("asyncIterator")],s=!1,i,r={};return t==null?(t=e[Jc("iterator")](),i=o=>r[o]=n=>t[o](n)):(t=t.call(e),i=o=>r[o]=n=>{if(s){if(s=!1,o==="throw")throw n;return n}return s=!0,{done:!1,value:new z1(new Promise(a=>{var c=t[o](n);c instanceof Object||Zc("Object expected"),a(c)}),1)}}),r[Jc("iterator")]=()=>r,i("next"),"throw"in t?i("throw"):r.throw=o=>{throw o},"return"in t&&i("return"),r};var tm=new Map,N1=new WeakMap;function F1(e){return e??{keyframes:[],options:{duration:0}}}function em(e,t){return t.toLowerCase()==="rtl"?{keyframes:e.rtlKeyframes||e.keyframes,options:e.options}:e}function Ve(e,t){tm.set(e,F1(t))}function Ue(e,t,s){let i=N1.get(e);if(i?.[t])return em(i[t],s.dir);let r=tm.get(t);return r?em(r,s.dir):{keyframes:[],options:{duration:0}}}function ht(e,t){return new Promise(s=>{function i(r){r.target===e&&(e.removeEventListener(t,i),s())}e.addEventListener(t,i)})}function qe(e,t,s){return new Promise(i=>{if(s?.duration===1/0)throw new Error("Promise-based animations must be finite.");let r=e.animate(t,Ds(nt({},s),{duration:H1()?0:s.duration}));r.addEventListener("cancel",i,{once:!0}),r.addEventListener("finish",i,{once:!0})})}function Qc(e){return e=e.toString().toLowerCase(),e.indexOf("ms")>-1?parseFloat(e):e.indexOf("s")>-1?parseFloat(e)*1e3:parseFloat(e)}function H1(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function tt(e){return Promise.all(e.getAnimations().map(t=>new Promise(s=>{t.cancel(),requestAnimationFrame(s)})))}function eh(e,t){return e.map(s=>Ds(nt({},s),{height:s.height==="auto"?`${t}px`:s.height}))}var th=new Set,vr=new Map,Di,sh="ltr",ih="en",sm=typeof MutationObserver<"u"&&typeof document<"u"&&typeof document.documentElement<"u";if(sm){let e=new MutationObserver(im);sh=document.documentElement.dir||"ltr",ih=document.documentElement.lang||navigator.language,e.observe(document.documentElement,{attributes:!0,attributeFilter:["dir","lang"]})}function $o(...e){e.map(t=>{let s=t.$code.toLowerCase();vr.has(s)?vr.set(s,Object.assign(Object.assign({},vr.get(s)),t)):vr.set(s,t),Di||(Di=t)}),im()}function im(){sm&&(sh=document.documentElement.dir||"ltr",ih=document.documentElement.lang||navigator.language),[...th.keys()].map(e=>{typeof e.requestUpdate=="function"&&e.requestUpdate()})}var aa=class{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){th.add(this.host)}hostDisconnected(){th.delete(this.host)}dir(){return`${this.host.dir||sh}`.toLowerCase()}lang(){return`${this.host.lang||ih}`.toLowerCase()}getTranslationData(t){var s,i;let r=new Intl.Locale(t.replace(/_/g,"-")),o=r?.language.toLowerCase(),n=(i=(s=r?.region)===null||s===void 0?void 0:s.toLowerCase())!==null&&i!==void 0?i:"",a=vr.get(`${o}-${n}`),c=vr.get(o);return{locale:r,language:o,region:n,primary:a,secondary:c}}exists(t,s){var i;let{primary:r,secondary:o}=this.getTranslationData((i=s.lang)!==null&&i!==void 0?i:this.lang());return s=Object.assign({includeFallback:!1},s),!!(r&&r[t]||o&&o[t]||s.includeFallback&&Di&&Di[t])}term(t,...s){let{primary:i,secondary:r}=this.getTranslationData(this.lang()),o;if(i&&i[t])o=i[t];else if(r&&r[t])o=r[t];else if(Di&&Di[t])o=Di[t];else return console.error(`No translation found for: ${String(t)}`),String(t);return typeof o=="function"?o(...s):o}date(t,s){return t=new Date(t),new Intl.DateTimeFormat(this.lang(),s).format(t)}number(t,s){return t=Number(t),isNaN(t)?"":new Intl.NumberFormat(this.lang(),s).format(t)}relativeTime(t,s,i){return new Intl.RelativeTimeFormat(this.lang(),i).format(t,s)}};var rm={$code:"en",$name:"English",$dir:"ltr",carousel:"Carousel",clearEntry:"Clear entry",close:"Close",copied:"Copied",copy:"Copy",currentValue:"Current value",error:"Error",goToSlide:(e,t)=>`Go to slide ${e} of ${t}`,hidePassword:"Hide password",loading:"Loading",nextSlide:"Next slide",numOptionsSelected:e=>e===0?"No options selected":e===1?"1 option selected":`${e} options selected`,previousSlide:"Previous slide",progress:"Progress",remove:"Remove",resize:"Resize",scrollToEnd:"Scroll to end",scrollToStart:"Scroll to start",selectAColorFromTheScreen:"Select a color from the screen",showPassword:"Show password",slideNum:e=>`Slide ${e}`,toggleColorFormat:"Toggle color format"};$o(rm);var om=rm;var me=class extends aa{};$o(om);var rh="";function nm(e){rh=e}function am(e=""){if(!rh){let t=[...document.getElementsByTagName("script")],s=t.find(i=>i.hasAttribute("data-shoelace"));if(s)nm(s.getAttribute("data-shoelace"));else{let i=t.find(o=>/shoelace(\.min)?\.js($|\?)/.test(o.src)||/shoelace-autoloader(\.min)?\.js($|\?)/.test(o.src)),r="";i&&(r=i.getAttribute("src")),nm(r.split("/").slice(0,-1).join("/"))}}return rh.replace(/\/$/,"")+(e?`/${e.replace(/^\//,"")}`:"")}var W1={name:"default",resolver:e=>am(`assets/icons/${e}.svg`)},lm=W1;var cm={caret:`
2347
2351
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2348
2352
  <polyline points="6 9 12 15 18 9"></polyline>
2349
2353
  </svg>
@@ -2462,9 +2466,9 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
2462
2466
  [hidden] {
2463
2467
  display: none !important;
2464
2468
  }
2465
- `;var U1={attribute:!0,type:String,converter:ii,reflect:!1,hasChanged:ca},q1=(e=U1,t,s)=>{let{kind:i,metadata:r}=s,o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(s.name,e),i==="accessor"){let{name:n}=s;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,e,!0,a)},init(a){return a!==void 0&&this.C(n,void 0,e,a),a}}}if(i==="setter"){let{name:n}=s;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function b(e){return(t,s)=>typeof s=="object"?q1(e,t,s):((i,r,o)=>{let n=r.hasOwnProperty(o);return r.constructor.createProperty(o,i),n?Object.getOwnPropertyDescriptor(r,o):void 0})(e,t,s)}function he(e){return b({...e,state:!0,attribute:!1})}function fm(e){return(t,s)=>{let i=typeof t=="function"?t:t[s];Object.assign(i,e)}}var Pi=(e,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,s),s);function Q(e,t){return(s,i,r)=>{let o=n=>n.renderRoot?.querySelector(e)??null;if(t){let{get:n,set:a}=typeof i=="object"?s:r??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return Pi(s,i,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return Pi(s,i,{get(){return o(this)}})}}var da,J=class extends ri{constructor(){super(),Jf(this,da,!1),this.initialReflectedProperties=new Map,Object.entries(this.constructor.dependencies).forEach(([e,t])=>{this.constructor.define(e,t)})}emit(e,t){let s=new CustomEvent(e,nt({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}static define(e,t=this,s={}){let i=customElements.get(e);if(!i){try{customElements.define(e,t,s)}catch{customElements.define(e,class extends t{},s)}return}let r=" (unknown version)",o=r;"version"in t&&t.version&&(r=" v"+t.version),"version"in i&&i.version&&(o=" v"+i.version),!(r&&o&&r===o)&&console.warn(`Attempted to register <${e}>${r}, but <${e}>${o} has already been registered.`)}attributeChangedCallback(e,t,s){Xf(this,da)||(this.constructor.elementProperties.forEach((i,r)=>{i.reflect&&this[r]!=null&&this.initialReflectedProperties.set(r,this[r])}),Zf(this,da,!0)),super.attributeChangedCallback(e,t,s)}willUpdate(e){super.willUpdate(e),this.initialReflectedProperties.forEach((t,s)=>{e.has(s)&&this[s]==null&&(this[s]=t)})}};da=new WeakMap;J.version="2.20.1";J.dependencies={};g([b()],J.prototype,"dir",2);g([b()],J.prototype,"lang",2);var{I:TR}=Zh;var mm=(e,t)=>t===void 0?e?._$litType$!==void 0:e?._$litType$===t;var gm=e=>e.strings===void 0;var K1={},_m=(e,t=K1)=>e._$AH=t;var To=Symbol(),ua=Symbol(),ah,lh=new Map,Re=class extends J{constructor(){super(...arguments),this.initialRender=!1,this.svg=null,this.label="",this.library="default"}async resolveIcon(e,t){var s;let i;if(t?.spriteSheet)return this.svg=u`<svg part="svg">
2469
+ `;var U1={attribute:!0,type:String,converter:ii,reflect:!1,hasChanged:na},q1=(e=U1,t,s)=>{let{kind:i,metadata:r}=s,o=globalThis.litPropertyMetadata.get(r);if(o===void 0&&globalThis.litPropertyMetadata.set(r,o=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),o.set(s.name,e),i==="accessor"){let{name:n}=s;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,e,!0,a)},init(a){return a!==void 0&&this.C(n,void 0,e,a),a}}}if(i==="setter"){let{name:n}=s;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function b(e){return(t,s)=>typeof s=="object"?q1(e,t,s):((i,r,o)=>{let n=r.hasOwnProperty(o);return r.constructor.createProperty(o,i),n?Object.getOwnPropertyDescriptor(r,o):void 0})(e,t,s)}function he(e){return b({...e,state:!0,attribute:!1})}function fm(e){return(t,s)=>{let i=typeof t=="function"?t:t[s];Object.assign(i,e)}}var Pi=(e,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,s),s);function Q(e,t){return(s,i,r)=>{let o=n=>n.renderRoot?.querySelector(e)??null;if(t){let{get:n,set:a}=typeof i=="object"?s:r??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return Pi(s,i,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return Pi(s,i,{get(){return o(this)}})}}var la,J=class extends ri{constructor(){super(),Jf(this,la,!1),this.initialReflectedProperties=new Map,Object.entries(this.constructor.dependencies).forEach(([e,t])=>{this.constructor.define(e,t)})}emit(e,t){let s=new CustomEvent(e,nt({bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(s),s}static define(e,t=this,s={}){let i=customElements.get(e);if(!i){try{customElements.define(e,t,s)}catch{customElements.define(e,class extends t{},s)}return}let r=" (unknown version)",o=r;"version"in t&&t.version&&(r=" v"+t.version),"version"in i&&i.version&&(o=" v"+i.version),!(r&&o&&r===o)&&console.warn(`Attempted to register <${e}>${r}, but <${e}>${o} has already been registered.`)}attributeChangedCallback(e,t,s){Xf(this,la)||(this.constructor.elementProperties.forEach((i,r)=>{i.reflect&&this[r]!=null&&this.initialReflectedProperties.set(r,this[r])}),Zf(this,la,!0)),super.attributeChangedCallback(e,t,s)}willUpdate(e){super.willUpdate(e),this.initialReflectedProperties.forEach((t,s)=>{e.has(s)&&this[s]==null&&(this[s]=t)})}};la=new WeakMap;J.version="2.20.1";J.dependencies={};g([b()],J.prototype,"dir",2);g([b()],J.prototype,"lang",2);var{I:TR}=Zh;var mm=(e,t)=>t===void 0?e?._$litType$!==void 0:e?._$litType$===t;var gm=e=>e.strings===void 0;var K1={},_m=(e,t=K1)=>e._$AH=t;var Eo=Symbol(),ca=Symbol(),ah,lh=new Map,Re=class extends J{constructor(){super(...arguments),this.initialRender=!1,this.svg=null,this.label="",this.library="default"}async resolveIcon(e,t){var s;let i;if(t?.spriteSheet)return this.svg=u`<svg part="svg">
2466
2470
  <use part="use" href="${e}"></use>
2467
- </svg>`,this.svg;try{if(i=await fetch(e,{mode:"cors"}),!i.ok)return i.status===410?To:ua}catch{return ua}try{let r=document.createElement("div");r.innerHTML=await i.text();let o=r.firstElementChild;if(((s=o?.tagName)==null?void 0:s.toLowerCase())!=="svg")return To;ah||(ah=new DOMParser);let a=ah.parseFromString(o.outerHTML,"text/html").body.querySelector("svg");return a?(a.part.add("svg"),document.adoptNode(a)):To}catch{return To}}connectedCallback(){super.connectedCallback(),dm(this)}firstUpdated(){this.initialRender=!0,this.setIcon()}disconnectedCallback(){super.disconnectedCallback(),um(this)}getIconSource(){let e=nh(this.library);return this.name&&e?{url:e.resolver(this.name),fromLibrary:!0}:{url:this.src,fromLibrary:!1}}handleLabelChange(){typeof this.label=="string"&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){var e;let{url:t,fromLibrary:s}=this.getIconSource(),i=s?nh(this.library):void 0;if(!t){this.svg=null;return}let r=lh.get(t);if(r||(r=this.resolveIcon(t,i),lh.set(t,r)),!this.initialRender)return;let o=await r;if(o===ua&&lh.delete(t),t===this.getIconSource().url){if(mm(o)){if(this.svg=o,i){await this.updateComplete;let n=this.shadowRoot.querySelector("[part='svg']");typeof i.mutator=="function"&&n&&i.mutator(n)}return}switch(o){case ua:case To:this.svg=null,this.emit("sl-error");break;default:this.svg=o.cloneNode(!0),(e=i?.mutator)==null||e.call(i,this.svg),this.emit("sl-load")}}}render(){return this.svg}};Re.styles=[te,pm];g([he()],Re.prototype,"svg",2);g([b({reflect:!0})],Re.prototype,"name",2);g([b()],Re.prototype,"src",2);g([b()],Re.prototype,"label",2);g([b({reflect:!0})],Re.prototype,"library",2);g([Y("label")],Re.prototype,"handleLabelChange",1);g([Y(["name","src","library"])],Re.prototype,"setIcon",1);var se=Vi(class extends Ns{constructor(e){if(super(e),e.type!==Ht.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let s=e.element.classList;for(let i of this.st)i in t||(s.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(s.add(i),this.st.add(i)):(s.remove(i),this.st.delete(i)))}return it}});var Ot=class extends J{constructor(){super(...arguments),this.localize=new me(this),this.open=!1,this.disabled=!1}firstUpdated(){this.body.style.height=this.open?"auto":"0",this.open&&(this.details.open=!0),this.detailsObserver=new MutationObserver(e=>{for(let t of e)t.type==="attributes"&&t.attributeName==="open"&&(this.details.open?this.show():this.hide())}),this.detailsObserver.observe(this.details,{attributes:!0})}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.detailsObserver)==null||e.disconnect()}handleSummaryClick(e){e.preventDefault(),this.disabled||(this.open?this.hide():this.show(),this.header.focus())}handleSummaryKeyDown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.open?this.hide():this.show()),(e.key==="ArrowUp"||e.key==="ArrowLeft")&&(e.preventDefault(),this.hide()),(e.key==="ArrowDown"||e.key==="ArrowRight")&&(e.preventDefault(),this.show())}async handleOpenChange(){if(this.open){if(this.details.open=!0,this.emit("sl-show",{cancelable:!0}).defaultPrevented){this.open=!1,this.details.open=!1;return}await tt(this.body);let{keyframes:t,options:s}=Ue(this,"details.show",{dir:this.localize.dir()});await qe(this.body,eh(t,this.body.scrollHeight),s),this.body.style.height="auto",this.emit("sl-after-show")}else{if(this.emit("sl-hide",{cancelable:!0}).defaultPrevented){this.details.open=!0,this.open=!0;return}await tt(this.body);let{keyframes:t,options:s}=Ue(this,"details.hide",{dir:this.localize.dir()});await qe(this.body,eh(t,this.body.scrollHeight),s),this.body.style.height="auto",this.details.open=!1,this.emit("sl-after-hide")}}async show(){if(!(this.open||this.disabled))return this.open=!0,ht(this,"sl-after-show")}async hide(){if(!(!this.open||this.disabled))return this.open=!1,ht(this,"sl-after-hide")}render(){let e=this.localize.dir()==="rtl";return u`
2471
+ </svg>`,this.svg;try{if(i=await fetch(e,{mode:"cors"}),!i.ok)return i.status===410?Eo:ca}catch{return ca}try{let r=document.createElement("div");r.innerHTML=await i.text();let o=r.firstElementChild;if(((s=o?.tagName)==null?void 0:s.toLowerCase())!=="svg")return Eo;ah||(ah=new DOMParser);let a=ah.parseFromString(o.outerHTML,"text/html").body.querySelector("svg");return a?(a.part.add("svg"),document.adoptNode(a)):Eo}catch{return Eo}}connectedCallback(){super.connectedCallback(),dm(this)}firstUpdated(){this.initialRender=!0,this.setIcon()}disconnectedCallback(){super.disconnectedCallback(),um(this)}getIconSource(){let e=nh(this.library);return this.name&&e?{url:e.resolver(this.name),fromLibrary:!0}:{url:this.src,fromLibrary:!1}}handleLabelChange(){typeof this.label=="string"&&this.label.length>0?(this.setAttribute("role","img"),this.setAttribute("aria-label",this.label),this.removeAttribute("aria-hidden")):(this.removeAttribute("role"),this.removeAttribute("aria-label"),this.setAttribute("aria-hidden","true"))}async setIcon(){var e;let{url:t,fromLibrary:s}=this.getIconSource(),i=s?nh(this.library):void 0;if(!t){this.svg=null;return}let r=lh.get(t);if(r||(r=this.resolveIcon(t,i),lh.set(t,r)),!this.initialRender)return;let o=await r;if(o===ca&&lh.delete(t),t===this.getIconSource().url){if(mm(o)){if(this.svg=o,i){await this.updateComplete;let n=this.shadowRoot.querySelector("[part='svg']");typeof i.mutator=="function"&&n&&i.mutator(n)}return}switch(o){case ca:case Eo:this.svg=null,this.emit("sl-error");break;default:this.svg=o.cloneNode(!0),(e=i?.mutator)==null||e.call(i,this.svg),this.emit("sl-load")}}}render(){return this.svg}};Re.styles=[te,pm];g([he()],Re.prototype,"svg",2);g([b({reflect:!0})],Re.prototype,"name",2);g([b()],Re.prototype,"src",2);g([b()],Re.prototype,"label",2);g([b({reflect:!0})],Re.prototype,"library",2);g([Y("label")],Re.prototype,"handleLabelChange",1);g([Y(["name","src","library"])],Re.prototype,"setIcon",1);var se=Vi(class extends Ns{constructor(e){if(super(e),e.type!==Ht.ATTRIBUTE||e.name!=="class"||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let s=e.element.classList;for(let i of this.st)i in t||(s.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(s.add(i),this.st.add(i)):(s.remove(i),this.st.delete(i)))}return it}});var Ot=class extends J{constructor(){super(...arguments),this.localize=new me(this),this.open=!1,this.disabled=!1}firstUpdated(){this.body.style.height=this.open?"auto":"0",this.open&&(this.details.open=!0),this.detailsObserver=new MutationObserver(e=>{for(let t of e)t.type==="attributes"&&t.attributeName==="open"&&(this.details.open?this.show():this.hide())}),this.detailsObserver.observe(this.details,{attributes:!0})}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.detailsObserver)==null||e.disconnect()}handleSummaryClick(e){e.preventDefault(),this.disabled||(this.open?this.hide():this.show(),this.header.focus())}handleSummaryKeyDown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.open?this.hide():this.show()),(e.key==="ArrowUp"||e.key==="ArrowLeft")&&(e.preventDefault(),this.hide()),(e.key==="ArrowDown"||e.key==="ArrowRight")&&(e.preventDefault(),this.show())}async handleOpenChange(){if(this.open){if(this.details.open=!0,this.emit("sl-show",{cancelable:!0}).defaultPrevented){this.open=!1,this.details.open=!1;return}await tt(this.body);let{keyframes:t,options:s}=Ue(this,"details.show",{dir:this.localize.dir()});await qe(this.body,eh(t,this.body.scrollHeight),s),this.body.style.height="auto",this.emit("sl-after-show")}else{if(this.emit("sl-hide",{cancelable:!0}).defaultPrevented){this.details.open=!0,this.open=!0;return}await tt(this.body);let{keyframes:t,options:s}=Ue(this,"details.hide",{dir:this.localize.dir()});await qe(this.body,eh(t,this.body.scrollHeight),s),this.body.style.height="auto",this.details.open=!1,this.emit("sl-after-hide")}}async show(){if(!(this.open||this.disabled))return this.open=!0,ht(this,"sl-after-show")}async hide(){if(!(!this.open||this.disabled))return this.open=!1,ht(this,"sl-after-hide")}render(){let e=this.localize.dir()==="rtl";return u`
2468
2472
  <details
2469
2473
  part="base"
2470
2474
  class=${se({details:!0,"details--open":this.open,"details--disabled":this.disabled,"details--rtl":e})}
@@ -3046,7 +3050,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
3046
3050
  padding-block: var(--sl-spacing-2x-small);
3047
3051
  padding-inline: var(--sl-spacing-x-large);
3048
3052
  }
3049
- `;function Y1(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}var hh=new Set;function X1(){let e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}function J1(){let e=Number(getComputedStyle(document.body).paddingRight.replace(/px/,""));return isNaN(e)||!e?0:e}function dh(e){if(hh.add(e),!document.documentElement.classList.contains("sl-scroll-lock")){let t=X1()+J1(),s=getComputedStyle(document.documentElement).scrollbarGutter;(!s||s==="auto")&&(s="stable"),t<2&&(s=""),document.documentElement.style.setProperty("--sl-scroll-lock-gutter",s),document.documentElement.classList.add("sl-scroll-lock"),document.documentElement.style.setProperty("--sl-scroll-lock-size",`${t}px`)}}function uh(e){hh.delete(e),hh.size===0&&(document.documentElement.classList.remove("sl-scroll-lock"),document.documentElement.style.removeProperty("--sl-scroll-lock-size"))}function Ao(e,t,s="vertical",i="smooth"){let r=Y1(e,t),o=r.top+t.scrollTop,n=r.left+t.scrollLeft,a=t.scrollLeft,c=t.scrollLeft+t.offsetWidth,l=t.scrollTop,h=t.scrollTop+t.offsetHeight;(s==="horizontal"||s==="both")&&(n<a?t.scrollTo({left:n,behavior:i}):n+e.clientWidth>c&&t.scrollTo({left:n-t.offsetWidth+e.clientWidth,behavior:i})),(s==="vertical"||s==="both")&&(o<l?t.scrollTo({top:o,behavior:i}):o+e.clientHeight>h&&t.scrollTo({top:o-t.offsetHeight+e.clientHeight,behavior:i}))}var ni=G`
3053
+ `;function Y1(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}var hh=new Set;function X1(){let e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}function J1(){let e=Number(getComputedStyle(document.body).paddingRight.replace(/px/,""));return isNaN(e)||!e?0:e}function dh(e){if(hh.add(e),!document.documentElement.classList.contains("sl-scroll-lock")){let t=X1()+J1(),s=getComputedStyle(document.documentElement).scrollbarGutter;(!s||s==="auto")&&(s="stable"),t<2&&(s=""),document.documentElement.style.setProperty("--sl-scroll-lock-gutter",s),document.documentElement.classList.add("sl-scroll-lock"),document.documentElement.style.setProperty("--sl-scroll-lock-size",`${t}px`)}}function uh(e){hh.delete(e),hh.size===0&&(document.documentElement.classList.remove("sl-scroll-lock"),document.documentElement.style.removeProperty("--sl-scroll-lock-size"))}function To(e,t,s="vertical",i="smooth"){let r=Y1(e,t),o=r.top+t.scrollTop,n=r.left+t.scrollLeft,a=t.scrollLeft,c=t.scrollLeft+t.offsetWidth,l=t.scrollTop,h=t.scrollTop+t.offsetHeight;(s==="horizontal"||s==="both")&&(n<a?t.scrollTo({left:n,behavior:i}):n+e.clientWidth>c&&t.scrollTo({left:n-t.offsetWidth+e.clientWidth,behavior:i})),(s==="vertical"||s==="both")&&(o<l?t.scrollTo({top:o,behavior:i}):o+e.clientHeight>h&&t.scrollTo({top:o-t.offsetHeight+e.clientHeight,behavior:i}))}var ni=G`
3050
3054
  .form-control .form-control__label {
3051
3055
  display: none;
3052
3056
  }
@@ -3160,7 +3164,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
3160
3164
  var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
3161
3165
  );
3162
3166
  }
3163
- `;var ls=Math.min,dt=Math.max,Lo=Math.round,Do=Math.floor,Gt=e=>({x:e,y:e}),Z1={left:"right",right:"left",bottom:"top",top:"bottom"};function fa(e,t,s){return dt(e,ls(t,s))}function Mi(e,t){return typeof e=="function"?e(t):e}function Ps(e){return e.split("-")[0]}function Bi(e){return e.split("-")[1]}function ph(e){return e==="x"?"y":"x"}function ma(e){return e==="y"?"height":"width"}function cs(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function ga(e){return ph(cs(e))}function $m(e,t,s){s===void 0&&(s=!1);let i=Bi(e),r=ga(e),o=ma(r),n=r==="x"?i===(s?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(n=Ro(n)),[n,Ro(n)]}function Em(e){let t=Ro(e);return[pa(e),t,pa(t)]}function pa(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var xm=["left","right"],km=["right","left"],Q1=["top","bottom"],eS=["bottom","top"];function tS(e,t,s){switch(e){case"top":case"bottom":return s?t?km:xm:t?xm:km;case"left":case"right":return t?Q1:eS;default:return[]}}function Tm(e,t,s,i){let r=Bi(e),o=tS(Ps(e),s==="start",i);return r&&(o=o.map(n=>n+"-"+r),t&&(o=o.concat(o.map(pa)))),o}function Ro(e){let t=Ps(e);return Z1[t]+e.slice(t.length)}function sS(e){return{top:0,right:0,bottom:0,left:0,...e}}function fh(e){return typeof e!="number"?sS(e):{top:e,right:e,bottom:e,left:e}}function Oi(e){let{x:t,y:s,width:i,height:r}=e;return{width:i,height:r,top:s,left:t,right:t+i,bottom:s+r,x:t,y:s}}function Am(e,t,s){let{reference:i,floating:r}=e,o=cs(t),n=ga(t),a=ma(n),c=Ps(t),l=o==="y",h=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,m=i[a]/2-r[a]/2,p;switch(c){case"top":p={x:h,y:i.y-r.height};break;case"bottom":p={x:h,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:d};break;case"left":p={x:i.x-r.width,y:d};break;default:p={x:i.x,y:i.y}}switch(Bi(t)){case"start":p[n]-=m*(s&&l?-1:1);break;case"end":p[n]+=m*(s&&l?-1:1);break}return p}async function Rm(e,t){var s;t===void 0&&(t={});let{x:i,y:r,platform:o,rects:n,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:m=!1,padding:p=0}=Mi(t,e),f=fh(p),S=a[m?d==="floating"?"reference":"floating":d],$=Oi(await o.getClippingRect({element:(s=await(o.isElement==null?void 0:o.isElement(S)))==null||s?S:S.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:h,strategy:c})),x=d==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},A=Oi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:c}):x);return{top:($.top-A.top+f.top)/y.y,bottom:(A.bottom-$.bottom+f.bottom)/y.y,left:($.left-A.left+f.left)/y.x,right:(A.right-$.right+f.right)/y.x}}var iS=50,Lm=async(e,t,s)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=s,a=n.detectOverflow?n:{...n,detectOverflow:Rm},c=await(n.isRTL==null?void 0:n.isRTL(t)),l=await n.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:d}=Am(l,i,c),m=i,p=0,f={};for(let _=0;_<o.length;_++){let S=o[_];if(!S)continue;let{name:$,fn:x}=S,{x:v,y,data:A,reset:M}=await x({x:h,y:d,initialPlacement:i,placement:m,strategy:r,middlewareData:f,rects:l,platform:a,elements:{reference:e,floating:t}});h=v??h,d=y??d,f[$]={...f[$],...A},M&&p<iS&&(p++,typeof M=="object"&&(M.placement&&(m=M.placement),M.rects&&(l=M.rects===!0?await n.getElementRects({reference:e,floating:t,strategy:r}):M.rects),{x:h,y:d}=Am(l,m,c)),_=-1)}return{x:h,y:d,placement:m,strategy:r,middlewareData:f}},Dm=e=>({name:"arrow",options:e,async fn(t){let{x:s,y:i,placement:r,rects:o,platform:n,elements:a,middlewareData:c}=t,{element:l,padding:h=0}=Mi(e,t)||{};if(l==null)return{};let d=fh(h),m={x:s,y:i},p=ga(r),f=ma(p),_=await n.getDimensions(l),S=p==="y",$=S?"top":"left",x=S?"bottom":"right",v=S?"clientHeight":"clientWidth",y=o.reference[f]+o.reference[p]-m[p]-o.floating[f],A=m[p]-o.reference[p],M=await(n.getOffsetParent==null?void 0:n.getOffsetParent(l)),H=M?M[v]:0;(!H||!await(n.isElement==null?void 0:n.isElement(M)))&&(H=a.floating[v]||o.floating[f]);let q=y/2-A/2,ee=H/2-_[f]/2-1,ce=ls(d[$],ee),V=ls(d[x],ee),ve=ce,E=H-_[f]-V,w=H/2-_[f]/2+q,L=fa(ve,w,E),T=!c.arrow&&Bi(r)!=null&&w!==L&&o.reference[f]/2-(w<ve?ce:V)-_[f]/2<0,P=T?w<ve?w-ve:w-E:0;return{[p]:m[p]+P,data:{[p]:L,centerOffset:w-L-P,...T&&{alignmentOffset:P}},reset:T}}});var Pm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,i;let{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:_=!0,...S}=Mi(e,t);if((s=o.arrow)!=null&&s.alignmentOffset)return{};let $=Ps(r),x=cs(a),v=Ps(a)===a,y=await(c.isRTL==null?void 0:c.isRTL(l.floating)),A=m||(v||!_?[Ro(a)]:Em(a)),M=f!=="none";!m&&M&&A.push(...Tm(a,_,f,y));let H=[a,...A],q=await c.detectOverflow(t,S),ee=[],ce=((i=o.flip)==null?void 0:i.overflows)||[];if(h&&ee.push(q[$]),d){let w=$m(r,n,y);ee.push(q[w[0]],q[w[1]])}if(ce=[...ce,{placement:r,overflows:ee}],!ee.every(w=>w<=0)){var V,ve;let w=(((V=o.flip)==null?void 0:V.index)||0)+1,L=H[w];if(L&&(!(d==="alignment"?x!==cs(L):!1)||ce.every(D=>cs(D.placement)===x?D.overflows[0]>0:!0)))return{data:{index:w,overflows:ce},reset:{placement:L}};let T=(ve=ce.filter(P=>P.overflows[0]<=0).sort((P,D)=>P.overflows[1]-D.overflows[1])[0])==null?void 0:ve.placement;if(!T)switch(p){case"bestFit":{var E;let P=(E=ce.filter(D=>{if(M){let N=cs(D.placement);return N===x||N==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(N=>N>0).reduce((N,Z)=>N+Z,0)]).sort((D,N)=>D[1]-N[1])[0])==null?void 0:E[0];P&&(T=P);break}case"initialPlacement":T=a;break}if(r!==T)return{reset:{placement:T}}}return{}}}};var rS=new Set(["left","top"]);async function oS(e,t){let{placement:s,platform:i,elements:r}=e,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=Ps(s),a=Bi(s),c=cs(s)==="y",l=rS.has(n)?-1:1,h=o&&c?-1:1,d=Mi(t,e),{mainAxis:m,crossAxis:p,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof f=="number"&&(p=a==="end"?f*-1:f),c?{x:p*h,y:m*l}:{x:m*l,y:p*h}}var Mm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,i;let{x:r,y:o,placement:n,middlewareData:a}=t,c=await oS(t,e);return n===((s=a.offset)==null?void 0:s.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:o+c.y,data:{...c,placement:n}}}}},Bm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:s,y:i,placement:r,platform:o}=t,{mainAxis:n=!0,crossAxis:a=!1,limiter:c={fn:$=>{let{x,y:v}=$;return{x,y:v}}},...l}=Mi(e,t),h={x:s,y:i},d=await o.detectOverflow(t,l),m=cs(Ps(r)),p=ph(m),f=h[p],_=h[m];if(n){let $=p==="y"?"top":"left",x=p==="y"?"bottom":"right",v=f+d[$],y=f-d[x];f=fa(v,f,y)}if(a){let $=m==="y"?"top":"left",x=m==="y"?"bottom":"right",v=_+d[$],y=_-d[x];_=fa(v,_,y)}let S=c.fn({...t,[p]:f,[m]:_});return{...S,data:{x:S.x-s,y:S.y-i,enabled:{[p]:n,[m]:a}}}}}};var Om=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,i;let{placement:r,rects:o,platform:n,elements:a}=t,{apply:c=()=>{},...l}=Mi(e,t),h=await n.detectOverflow(t,l),d=Ps(r),m=Bi(r),p=cs(r)==="y",{width:f,height:_}=o.floating,S,$;d==="top"||d==="bottom"?(S=d,$=m===(await(n.isRTL==null?void 0:n.isRTL(a.floating))?"start":"end")?"left":"right"):($=d,S=m==="end"?"top":"bottom");let x=_-h.top-h.bottom,v=f-h.left-h.right,y=ls(_-h[S],x),A=ls(f-h[$],v),M=!t.middlewareData.shift,H=y,q=A;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(q=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(H=x),M&&!m){let ce=dt(h.left,0),V=dt(h.right,0),ve=dt(h.top,0),E=dt(h.bottom,0);p?q=f-2*(ce!==0||V!==0?ce+V:dt(h.left,h.right)):H=_-2*(ve!==0||E!==0?ve+E:dt(h.top,h.bottom))}await c({...t,availableWidth:q,availableHeight:H});let ee=await n.getDimensions(a.floating);return f!==ee.width||_!==ee.height?{reset:{rects:!0}}:{}}}};function _a(){return typeof window<"u"}function zi(e){return zm(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yt(e){var t;return(t=(zm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zm(e){return _a()?e instanceof Node||e instanceof _t(e).Node:!1}function It(e){return _a()?e instanceof Element||e instanceof _t(e).Element:!1}function hs(e){return _a()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Im(e){return!_a()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function Sr(e){let{overflow:t,overflowX:s,overflowY:i,display:r}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+s)&&r!=="inline"&&r!=="contents"}function Nm(e){return/^(table|td|th)$/.test(zi(e))}function Po(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var nS=/transform|translate|scale|rotate|perspective|filter/,aS=/paint|layout|strict|content/,Ii=e=>!!e&&e!=="none",mh;function Cr(e){let t=It(e)?zt(e):e;return Ii(t.transform)||Ii(t.translate)||Ii(t.scale)||Ii(t.rotate)||Ii(t.perspective)||!va()&&(Ii(t.backdropFilter)||Ii(t.filter))||nS.test(t.willChange||"")||aS.test(t.contain||"")}function Fm(e){let t=Ms(e);for(;hs(t)&&!Ni(t);){if(Cr(t))return t;if(Po(t))return null;t=Ms(t)}return null}function va(){return mh==null&&(mh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mh}function Ni(e){return/^(html|body|#document)$/.test(zi(e))}function zt(e){return _t(e).getComputedStyle(e)}function Mo(e){return It(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ms(e){if(zi(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Im(e)&&e.host||Yt(e);return Im(t)?t.host:t}function Hm(e){let t=Ms(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:hs(t)&&Sr(t)?t:Hm(t)}function wr(e,t,s){var i;t===void 0&&(t=[]),s===void 0&&(s=!0);let r=Hm(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),n=_t(r);if(o){let a=ba(n);return t.concat(n,n.visualViewport||[],Sr(r)?r:[],a&&s?wr(a):[])}else return t.concat(r,wr(r,[],s))}function ba(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Um(e){let t=zt(e),s=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=hs(e),o=r?e.offsetWidth:s,n=r?e.offsetHeight:i,a=Lo(s)!==o||Lo(i)!==n;return a&&(s=o,i=n),{width:s,height:i,$:a}}function _h(e){return It(e)?e:e.contextElement}function xr(e){let t=_h(e);if(!hs(t))return Gt(1);let s=t.getBoundingClientRect(),{width:i,height:r,$:o}=Um(t),n=(o?Lo(s.width):s.width)/i,a=(o?Lo(s.height):s.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}var lS=Gt(0);function qm(e){let t=_t(e);return!va()||!t.visualViewport?lS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cS(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==_t(e)?!1:t}function Fi(e,t,s,i){t===void 0&&(t=!1),s===void 0&&(s=!1);let r=e.getBoundingClientRect(),o=_h(e),n=Gt(1);t&&(i?It(i)&&(n=xr(i)):n=xr(e));let a=cS(o,s,i)?qm(o):Gt(0),c=(r.left+a.x)/n.x,l=(r.top+a.y)/n.y,h=r.width/n.x,d=r.height/n.y;if(o){let m=_t(o),p=i&&It(i)?_t(i):i,f=m,_=ba(f);for(;_&&i&&p!==f;){let S=xr(_),$=_.getBoundingClientRect(),x=zt(_),v=$.left+(_.clientLeft+parseFloat(x.paddingLeft))*S.x,y=$.top+(_.clientTop+parseFloat(x.paddingTop))*S.y;c*=S.x,l*=S.y,h*=S.x,d*=S.y,c+=v,l+=y,f=_t(_),_=ba(f)}}return Oi({width:h,height:d,x:c,y:l})}function ya(e,t){let s=Mo(e).scrollLeft;return t?t.left+s:Fi(Yt(e)).left+s}function Km(e,t){let s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-ya(e,s),r=s.top+t.scrollTop;return{x:i,y:r}}function hS(e){let{elements:t,rect:s,offsetParent:i,strategy:r}=e,o=r==="fixed",n=Yt(i),a=t?Po(t.floating):!1;if(i===n||a&&o)return s;let c={scrollLeft:0,scrollTop:0},l=Gt(1),h=Gt(0),d=hs(i);if((d||!d&&!o)&&((zi(i)!=="body"||Sr(n))&&(c=Mo(i)),d)){let p=Fi(i);l=xr(i),h.x=p.x+i.clientLeft,h.y=p.y+i.clientTop}let m=n&&!d&&!o?Km(n,c):Gt(0);return{width:s.width*l.x,height:s.height*l.y,x:s.x*l.x-c.scrollLeft*l.x+h.x+m.x,y:s.y*l.y-c.scrollTop*l.y+h.y+m.y}}function dS(e){return Array.from(e.getClientRects())}function uS(e){let t=Yt(e),s=Mo(e),i=e.ownerDocument.body,r=dt(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=dt(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),n=-s.scrollLeft+ya(e),a=-s.scrollTop;return zt(i).direction==="rtl"&&(n+=dt(t.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}var Wm=25;function pS(e,t){let s=_t(e),i=Yt(e),r=s.visualViewport,o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(r){o=r.width,n=r.height;let h=va();(!h||h&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}let l=ya(i);if(l<=0){let h=i.ownerDocument,d=h.body,m=getComputedStyle(d),p=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,f=Math.abs(i.clientWidth-d.clientWidth-p);f<=Wm&&(o-=f)}else l<=Wm&&(o+=l);return{width:o,height:n,x:a,y:c}}function fS(e,t){let s=Fi(e,!0,t==="fixed"),i=s.top+e.clientTop,r=s.left+e.clientLeft,o=hs(e)?xr(e):Gt(1),n=e.clientWidth*o.x,a=e.clientHeight*o.y,c=r*o.x,l=i*o.y;return{width:n,height:a,x:c,y:l}}function jm(e,t,s){let i;if(t==="viewport")i=pS(e,s);else if(t==="document")i=uS(Yt(e));else if(It(t))i=fS(t,s);else{let r=qm(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Oi(i)}function Gm(e,t){let s=Ms(e);return s===t||!It(s)||Ni(s)?!1:zt(s).position==="fixed"||Gm(s,t)}function mS(e,t){let s=t.get(e);if(s)return s;let i=wr(e,[],!1).filter(a=>It(a)&&zi(a)!=="body"),r=null,o=zt(e).position==="fixed",n=o?Ms(e):e;for(;It(n)&&!Ni(n);){let a=zt(n),c=Cr(n);!c&&a.position==="fixed"&&(r=null),(o?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Sr(n)&&!c&&Gm(e,n))?i=i.filter(h=>h!==n):r=a,n=Ms(n)}return t.set(e,i),i}function gS(e){let{element:t,boundary:s,rootBoundary:i,strategy:r}=e,n=[...s==="clippingAncestors"?Po(t)?[]:mS(t,this._c):[].concat(s),i],a=jm(t,n[0],r),c=a.top,l=a.right,h=a.bottom,d=a.left;for(let m=1;m<n.length;m++){let p=jm(t,n[m],r);c=dt(p.top,c),l=ls(p.right,l),h=ls(p.bottom,h),d=dt(p.left,d)}return{width:l-d,height:h-c,x:d,y:c}}function _S(e){let{width:t,height:s}=Um(e);return{width:t,height:s}}function vS(e,t,s){let i=hs(t),r=Yt(t),o=s==="fixed",n=Fi(e,!0,o,t),a={scrollLeft:0,scrollTop:0},c=Gt(0);function l(){c.x=ya(r)}if(i||!i&&!o)if((zi(t)!=="body"||Sr(r))&&(a=Mo(t)),i){let p=Fi(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else r&&l();o&&!i&&r&&l();let h=r&&!i&&!o?Km(r,a):Gt(0),d=n.left+a.scrollLeft-c.x-h.x,m=n.top+a.scrollTop-c.y-h.y;return{x:d,y:m,width:n.width,height:n.height}}function gh(e){return zt(e).position==="static"}function Vm(e,t){if(!hs(e)||zt(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return Yt(e)===s&&(s=s.ownerDocument.body),s}function Ym(e,t){let s=_t(e);if(Po(e))return s;if(!hs(e)){let r=Ms(e);for(;r&&!Ni(r);){if(It(r)&&!gh(r))return r;r=Ms(r)}return s}let i=Vm(e,t);for(;i&&Nm(i)&&gh(i);)i=Vm(i,t);return i&&Ni(i)&&gh(i)&&!Cr(i)?s:i||Fm(e)||s}var bS=async function(e){let t=this.getOffsetParent||Ym,s=this.getDimensions,i=await s(e.floating);return{reference:vS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function yS(e){return zt(e).direction==="rtl"}var Bo={convertOffsetParentRelativeRectToViewportRelativeRect:hS,getDocumentElement:Yt,getClippingRect:gS,getOffsetParent:Ym,getElementRects:bS,getClientRects:dS,getDimensions:_S,getScale:xr,isElement:It,isRTL:yS};function Xm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wS(e,t){let s=null,i,r=Yt(e);function o(){var a;clearTimeout(i),(a=s)==null||a.disconnect(),s=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:h,top:d,width:m,height:p}=l;if(a||t(),!m||!p)return;let f=Do(d),_=Do(r.clientWidth-(h+m)),S=Do(r.clientHeight-(d+p)),$=Do(h),v={rootMargin:-f+"px "+-_+"px "+-S+"px "+-$+"px",threshold:dt(0,ls(1,c))||1},y=!0;function A(M){let H=M[0].intersectionRatio;if(H!==c){if(!y)return n();H?n(!1,H):i=setTimeout(()=>{n(!1,1e-7)},1e3)}H===1&&!Xm(l,e.getBoundingClientRect())&&n(),y=!1}try{s=new IntersectionObserver(A,{...v,root:r.ownerDocument})}catch{s=new IntersectionObserver(A,v)}s.observe(e)}return n(!0),o}function Jm(e,t,s,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=_h(e),h=r||o?[...l?wr(l):[],...t?wr(t):[]]:[];h.forEach($=>{r&&$.addEventListener("scroll",s,{passive:!0}),o&&$.addEventListener("resize",s)});let d=l&&a?wS(l,s):null,m=-1,p=null;n&&(p=new ResizeObserver($=>{let[x]=$;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=p)==null||v.observe(t)})),s()}),l&&!c&&p.observe(l),t&&p.observe(t));let f,_=c?Fi(e):null;c&&S();function S(){let $=Fi(e);_&&!Xm(_,$)&&s(),_=$,f=requestAnimationFrame(S)}return s(),()=>{var $;h.forEach(x=>{r&&x.removeEventListener("scroll",s),o&&x.removeEventListener("resize",s)}),d?.(),($=p)==null||$.disconnect(),p=null,c&&cancelAnimationFrame(f)}}var Zm=Mm;var Qm=Bm,eg=Pm,vh=Om;var tg=Dm;var sg=(e,t,s)=>{let i=new Map,r={platform:Bo,...s},o={...r.platform,_c:i};return Lm(e,t,{...r,platform:o})};function ig(e){return SS(e)}function bh(e){return e.assignedSlot?e.assignedSlot:e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}function SS(e){for(let t=e;t;t=bh(t))if(t instanceof Element&&getComputedStyle(t).display==="none")return null;for(let t=bh(e);t;t=bh(t)){if(!(t instanceof Element))continue;let s=getComputedStyle(t);if(s.display!=="contents"&&(s.position!=="static"||Cr(s)||t.tagName==="BODY"))return t}return null}function CS(e){return e!==null&&typeof e=="object"&&"getBoundingClientRect"in e&&("contextElement"in e?e.contextElement instanceof Element:!0)}var pe=class extends J{constructor(){super(...arguments),this.localize=new me(this),this.active=!1,this.placement="top",this.strategy="absolute",this.distance=0,this.skidding=0,this.arrow=!1,this.arrowPlacement="anchor",this.arrowPadding=10,this.flip=!1,this.flipFallbackPlacements="",this.flipFallbackStrategy="best-fit",this.flipPadding=0,this.shift=!1,this.shiftPadding=0,this.autoSizePadding=0,this.hoverBridge=!1,this.updateHoverBridge=()=>{if(this.hoverBridge&&this.anchorEl){let e=this.anchorEl.getBoundingClientRect(),t=this.popup.getBoundingClientRect(),s=this.placement.includes("top")||this.placement.includes("bottom"),i=0,r=0,o=0,n=0,a=0,c=0,l=0,h=0;s?e.top<t.top?(i=e.left,r=e.bottom,o=e.right,n=e.bottom,a=t.left,c=t.top,l=t.right,h=t.top):(i=t.left,r=t.bottom,o=t.right,n=t.bottom,a=e.left,c=e.top,l=e.right,h=e.top):e.left<t.left?(i=e.right,r=e.top,o=t.left,n=t.top,a=e.right,c=e.bottom,l=t.left,h=t.bottom):(i=t.right,r=t.top,o=e.left,n=e.top,a=t.right,c=t.bottom,l=e.left,h=e.bottom),this.style.setProperty("--hover-bridge-top-left-x",`${i}px`),this.style.setProperty("--hover-bridge-top-left-y",`${r}px`),this.style.setProperty("--hover-bridge-top-right-x",`${o}px`),this.style.setProperty("--hover-bridge-top-right-y",`${n}px`),this.style.setProperty("--hover-bridge-bottom-left-x",`${a}px`),this.style.setProperty("--hover-bridge-bottom-left-y",`${c}px`),this.style.setProperty("--hover-bridge-bottom-right-x",`${l}px`),this.style.setProperty("--hover-bridge-bottom-right-y",`${h}px`)}}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start()}disconnectedCallback(){super.disconnectedCallback(),this.stop()}async updated(e){super.updated(e),e.has("active")&&(this.active?this.start():this.stop()),e.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}async handleAnchorChange(){if(await this.stop(),this.anchor&&typeof this.anchor=="string"){let e=this.getRootNode();this.anchorEl=e.getElementById(this.anchor)}else this.anchor instanceof Element||CS(this.anchor)?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),this.anchorEl&&this.active&&this.start()}start(){!this.anchorEl||!this.active||(this.cleanup=Jm(this.anchorEl,this.popup,()=>{this.reposition()}))}async stop(){return new Promise(e=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame(()=>e())):e()})}reposition(){if(!this.active||!this.anchorEl)return;let e=[Zm({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?e.push(vh({apply:({rects:s})=>{let i=this.sync==="width"||this.sync==="both",r=this.sync==="height"||this.sync==="both";this.popup.style.width=i?`${s.reference.width}px`:"",this.popup.style.height=r?`${s.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&e.push(eg({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:this.flipFallbackStrategy==="best-fit"?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&e.push(Qm({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?e.push(vh({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:s,availableHeight:i})=>{this.autoSize==="vertical"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-height",`${i}px`):this.style.removeProperty("--auto-size-available-height"),this.autoSize==="horizontal"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-width",`${s}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&e.push(tg({element:this.arrowEl,padding:this.arrowPadding}));let t=this.strategy==="absolute"?s=>Bo.getOffsetParent(s,ig):Bo.getOffsetParent;sg(this.anchorEl,this.popup,{placement:this.placement,middleware:e,strategy:this.strategy,platform:Ds(nt({},Bo),{getOffsetParent:t})}).then(({x:s,y:i,middlewareData:r,placement:o})=>{let n=this.localize.dir()==="rtl",a={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]];if(this.setAttribute("data-current-placement",o),Object.assign(this.popup.style,{left:`${s}px`,top:`${i}px`}),this.arrow){let c=r.arrow.x,l=r.arrow.y,h="",d="",m="",p="";if(this.arrowPlacement==="start"){let f=typeof c=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";h=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",d=n?f:"",p=n?"":f}else if(this.arrowPlacement==="end"){let f=typeof c=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";d=n?"":f,p=n?f:"",m=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else this.arrowPlacement==="center"?(p=typeof c=="number"?"calc(50% - var(--arrow-size-diagonal))":"",h=typeof l=="number"?"calc(50% - var(--arrow-size-diagonal))":""):(p=typeof c=="number"?`${c}px`:"",h=typeof l=="number"?`${l}px`:"");Object.assign(this.arrowEl.style,{top:h,right:d,bottom:m,left:p,[a]:"calc(var(--arrow-size-diagonal) * -1)"})}}),requestAnimationFrame(()=>this.updateHoverBridge()),this.emit("sl-reposition")}render(){return u`
3167
+ `;var ls=Math.min,dt=Math.max,Ro=Math.round,Lo=Math.floor,Gt=e=>({x:e,y:e}),Z1={left:"right",right:"left",bottom:"top",top:"bottom"};function da(e,t,s){return dt(e,ls(t,s))}function Mi(e,t){return typeof e=="function"?e(t):e}function Ps(e){return e.split("-")[0]}function Bi(e){return e.split("-")[1]}function ph(e){return e==="x"?"y":"x"}function ua(e){return e==="y"?"height":"width"}function cs(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function pa(e){return ph(cs(e))}function $m(e,t,s){s===void 0&&(s=!1);let i=Bi(e),r=pa(e),o=ua(r),n=r==="x"?i===(s?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(n=Ao(n)),[n,Ao(n)]}function Em(e){let t=Ao(e);return[ha(e),t,ha(t)]}function ha(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var xm=["left","right"],km=["right","left"],Q1=["top","bottom"],eS=["bottom","top"];function tS(e,t,s){switch(e){case"top":case"bottom":return s?t?km:xm:t?xm:km;case"left":case"right":return t?Q1:eS;default:return[]}}function Tm(e,t,s,i){let r=Bi(e),o=tS(Ps(e),s==="start",i);return r&&(o=o.map(n=>n+"-"+r),t&&(o=o.concat(o.map(ha)))),o}function Ao(e){let t=Ps(e);return Z1[t]+e.slice(t.length)}function sS(e){return{top:0,right:0,bottom:0,left:0,...e}}function fh(e){return typeof e!="number"?sS(e):{top:e,right:e,bottom:e,left:e}}function Oi(e){let{x:t,y:s,width:i,height:r}=e;return{width:i,height:r,top:s,left:t,right:t+i,bottom:s+r,x:t,y:s}}function Am(e,t,s){let{reference:i,floating:r}=e,o=cs(t),n=pa(t),a=ua(n),c=Ps(t),l=o==="y",h=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,m=i[a]/2-r[a]/2,p;switch(c){case"top":p={x:h,y:i.y-r.height};break;case"bottom":p={x:h,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:d};break;case"left":p={x:i.x-r.width,y:d};break;default:p={x:i.x,y:i.y}}switch(Bi(t)){case"start":p[n]-=m*(s&&l?-1:1);break;case"end":p[n]+=m*(s&&l?-1:1);break}return p}async function Rm(e,t){var s;t===void 0&&(t={});let{x:i,y:r,platform:o,rects:n,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:m=!1,padding:p=0}=Mi(t,e),f=fh(p),S=a[m?d==="floating"?"reference":"floating":d],k=Oi(await o.getClippingRect({element:(s=await(o.isElement==null?void 0:o.isElement(S)))==null||s?S:S.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:h,strategy:c})),x=d==="floating"?{x:i,y:r,width:n.floating.width,height:n.floating.height}:n.reference,v=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(v))?await(o.getScale==null?void 0:o.getScale(v))||{x:1,y:1}:{x:1,y:1},A=Oi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:v,strategy:c}):x);return{top:(k.top-A.top+f.top)/y.y,bottom:(A.bottom-k.bottom+f.bottom)/y.y,left:(k.left-A.left+f.left)/y.x,right:(A.right-k.right+f.right)/y.x}}var iS=50,Lm=async(e,t,s)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:n}=s,a=n.detectOverflow?n:{...n,detectOverflow:Rm},c=await(n.isRTL==null?void 0:n.isRTL(t)),l=await n.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:d}=Am(l,i,c),m=i,p=0,f={};for(let _=0;_<o.length;_++){let S=o[_];if(!S)continue;let{name:k,fn:x}=S,{x:v,y,data:A,reset:M}=await x({x:h,y:d,initialPlacement:i,placement:m,strategy:r,middlewareData:f,rects:l,platform:a,elements:{reference:e,floating:t}});h=v??h,d=y??d,f[k]={...f[k],...A},M&&p<iS&&(p++,typeof M=="object"&&(M.placement&&(m=M.placement),M.rects&&(l=M.rects===!0?await n.getElementRects({reference:e,floating:t,strategy:r}):M.rects),{x:h,y:d}=Am(l,m,c)),_=-1)}return{x:h,y:d,placement:m,strategy:r,middlewareData:f}},Dm=e=>({name:"arrow",options:e,async fn(t){let{x:s,y:i,placement:r,rects:o,platform:n,elements:a,middlewareData:c}=t,{element:l,padding:h=0}=Mi(e,t)||{};if(l==null)return{};let d=fh(h),m={x:s,y:i},p=pa(r),f=ua(p),_=await n.getDimensions(l),S=p==="y",k=S?"top":"left",x=S?"bottom":"right",v=S?"clientHeight":"clientWidth",y=o.reference[f]+o.reference[p]-m[p]-o.floating[f],A=m[p]-o.reference[p],M=await(n.getOffsetParent==null?void 0:n.getOffsetParent(l)),H=M?M[v]:0;(!H||!await(n.isElement==null?void 0:n.isElement(M)))&&(H=a.floating[v]||o.floating[f]);let q=y/2-A/2,ee=H/2-_[f]/2-1,ce=ls(d[k],ee),V=ls(d[x],ee),ve=ce,$=H-_[f]-V,w=H/2-_[f]/2+q,L=da(ve,w,$),E=!c.arrow&&Bi(r)!=null&&w!==L&&o.reference[f]/2-(w<ve?ce:V)-_[f]/2<0,P=E?w<ve?w-ve:w-$:0;return{[p]:m[p]+P,data:{[p]:L,centerOffset:w-L-P,...E&&{alignmentOffset:P}},reset:E}}});var Pm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,i;let{placement:r,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:_=!0,...S}=Mi(e,t);if((s=o.arrow)!=null&&s.alignmentOffset)return{};let k=Ps(r),x=cs(a),v=Ps(a)===a,y=await(c.isRTL==null?void 0:c.isRTL(l.floating)),A=m||(v||!_?[Ao(a)]:Em(a)),M=f!=="none";!m&&M&&A.push(...Tm(a,_,f,y));let H=[a,...A],q=await c.detectOverflow(t,S),ee=[],ce=((i=o.flip)==null?void 0:i.overflows)||[];if(h&&ee.push(q[k]),d){let w=$m(r,n,y);ee.push(q[w[0]],q[w[1]])}if(ce=[...ce,{placement:r,overflows:ee}],!ee.every(w=>w<=0)){var V,ve;let w=(((V=o.flip)==null?void 0:V.index)||0)+1,L=H[w];if(L&&(!(d==="alignment"?x!==cs(L):!1)||ce.every(D=>cs(D.placement)===x?D.overflows[0]>0:!0)))return{data:{index:w,overflows:ce},reset:{placement:L}};let E=(ve=ce.filter(P=>P.overflows[0]<=0).sort((P,D)=>P.overflows[1]-D.overflows[1])[0])==null?void 0:ve.placement;if(!E)switch(p){case"bestFit":{var $;let P=($=ce.filter(D=>{if(M){let N=cs(D.placement);return N===x||N==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(N=>N>0).reduce((N,Z)=>N+Z,0)]).sort((D,N)=>D[1]-N[1])[0])==null?void 0:$[0];P&&(E=P);break}case"initialPlacement":E=a;break}if(r!==E)return{reset:{placement:E}}}return{}}}};var rS=new Set(["left","top"]);async function oS(e,t){let{placement:s,platform:i,elements:r}=e,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),n=Ps(s),a=Bi(s),c=cs(s)==="y",l=rS.has(n)?-1:1,h=o&&c?-1:1,d=Mi(t,e),{mainAxis:m,crossAxis:p,alignmentAxis:f}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof f=="number"&&(p=a==="end"?f*-1:f),c?{x:p*h,y:m*l}:{x:m*l,y:p*h}}var Mm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,i;let{x:r,y:o,placement:n,middlewareData:a}=t,c=await oS(t,e);return n===((s=a.offset)==null?void 0:s.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:o+c.y,data:{...c,placement:n}}}}},Bm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:s,y:i,placement:r,platform:o}=t,{mainAxis:n=!0,crossAxis:a=!1,limiter:c={fn:k=>{let{x,y:v}=k;return{x,y:v}}},...l}=Mi(e,t),h={x:s,y:i},d=await o.detectOverflow(t,l),m=cs(Ps(r)),p=ph(m),f=h[p],_=h[m];if(n){let k=p==="y"?"top":"left",x=p==="y"?"bottom":"right",v=f+d[k],y=f-d[x];f=da(v,f,y)}if(a){let k=m==="y"?"top":"left",x=m==="y"?"bottom":"right",v=_+d[k],y=_-d[x];_=da(v,_,y)}let S=c.fn({...t,[p]:f,[m]:_});return{...S,data:{x:S.x-s,y:S.y-i,enabled:{[p]:n,[m]:a}}}}}};var Om=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,i;let{placement:r,rects:o,platform:n,elements:a}=t,{apply:c=()=>{},...l}=Mi(e,t),h=await n.detectOverflow(t,l),d=Ps(r),m=Bi(r),p=cs(r)==="y",{width:f,height:_}=o.floating,S,k;d==="top"||d==="bottom"?(S=d,k=m===(await(n.isRTL==null?void 0:n.isRTL(a.floating))?"start":"end")?"left":"right"):(k=d,S=m==="end"?"top":"bottom");let x=_-h.top-h.bottom,v=f-h.left-h.right,y=ls(_-h[S],x),A=ls(f-h[k],v),M=!t.middlewareData.shift,H=y,q=A;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(q=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(H=x),M&&!m){let ce=dt(h.left,0),V=dt(h.right,0),ve=dt(h.top,0),$=dt(h.bottom,0);p?q=f-2*(ce!==0||V!==0?ce+V:dt(h.left,h.right)):H=_-2*(ve!==0||$!==0?ve+$:dt(h.top,h.bottom))}await c({...t,availableWidth:q,availableHeight:H});let ee=await n.getDimensions(a.floating);return f!==ee.width||_!==ee.height?{reset:{rects:!0}}:{}}}};function fa(){return typeof window<"u"}function zi(e){return zm(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yt(e){var t;return(t=(zm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zm(e){return fa()?e instanceof Node||e instanceof _t(e).Node:!1}function It(e){return fa()?e instanceof Element||e instanceof _t(e).Element:!1}function hs(e){return fa()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Im(e){return!fa()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function Sr(e){let{overflow:t,overflowX:s,overflowY:i,display:r}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+s)&&r!=="inline"&&r!=="contents"}function Nm(e){return/^(table|td|th)$/.test(zi(e))}function Do(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var nS=/transform|translate|scale|rotate|perspective|filter/,aS=/paint|layout|strict|content/,Ii=e=>!!e&&e!=="none",mh;function Cr(e){let t=It(e)?zt(e):e;return Ii(t.transform)||Ii(t.translate)||Ii(t.scale)||Ii(t.rotate)||Ii(t.perspective)||!ma()&&(Ii(t.backdropFilter)||Ii(t.filter))||nS.test(t.willChange||"")||aS.test(t.contain||"")}function Fm(e){let t=Ms(e);for(;hs(t)&&!Ni(t);){if(Cr(t))return t;if(Do(t))return null;t=Ms(t)}return null}function ma(){return mh==null&&(mh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),mh}function Ni(e){return/^(html|body|#document)$/.test(zi(e))}function zt(e){return _t(e).getComputedStyle(e)}function Po(e){return It(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ms(e){if(zi(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Im(e)&&e.host||Yt(e);return Im(t)?t.host:t}function Hm(e){let t=Ms(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:hs(t)&&Sr(t)?t:Hm(t)}function wr(e,t,s){var i;t===void 0&&(t=[]),s===void 0&&(s=!0);let r=Hm(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),n=_t(r);if(o){let a=ga(n);return t.concat(n,n.visualViewport||[],Sr(r)?r:[],a&&s?wr(a):[])}else return t.concat(r,wr(r,[],s))}function ga(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Um(e){let t=zt(e),s=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=hs(e),o=r?e.offsetWidth:s,n=r?e.offsetHeight:i,a=Ro(s)!==o||Ro(i)!==n;return a&&(s=o,i=n),{width:s,height:i,$:a}}function _h(e){return It(e)?e:e.contextElement}function xr(e){let t=_h(e);if(!hs(t))return Gt(1);let s=t.getBoundingClientRect(),{width:i,height:r,$:o}=Um(t),n=(o?Ro(s.width):s.width)/i,a=(o?Ro(s.height):s.height)/r;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}var lS=Gt(0);function qm(e){let t=_t(e);return!ma()||!t.visualViewport?lS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cS(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==_t(e)?!1:t}function Fi(e,t,s,i){t===void 0&&(t=!1),s===void 0&&(s=!1);let r=e.getBoundingClientRect(),o=_h(e),n=Gt(1);t&&(i?It(i)&&(n=xr(i)):n=xr(e));let a=cS(o,s,i)?qm(o):Gt(0),c=(r.left+a.x)/n.x,l=(r.top+a.y)/n.y,h=r.width/n.x,d=r.height/n.y;if(o){let m=_t(o),p=i&&It(i)?_t(i):i,f=m,_=ga(f);for(;_&&i&&p!==f;){let S=xr(_),k=_.getBoundingClientRect(),x=zt(_),v=k.left+(_.clientLeft+parseFloat(x.paddingLeft))*S.x,y=k.top+(_.clientTop+parseFloat(x.paddingTop))*S.y;c*=S.x,l*=S.y,h*=S.x,d*=S.y,c+=v,l+=y,f=_t(_),_=ga(f)}}return Oi({width:h,height:d,x:c,y:l})}function _a(e,t){let s=Po(e).scrollLeft;return t?t.left+s:Fi(Yt(e)).left+s}function Km(e,t){let s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-_a(e,s),r=s.top+t.scrollTop;return{x:i,y:r}}function hS(e){let{elements:t,rect:s,offsetParent:i,strategy:r}=e,o=r==="fixed",n=Yt(i),a=t?Do(t.floating):!1;if(i===n||a&&o)return s;let c={scrollLeft:0,scrollTop:0},l=Gt(1),h=Gt(0),d=hs(i);if((d||!d&&!o)&&((zi(i)!=="body"||Sr(n))&&(c=Po(i)),d)){let p=Fi(i);l=xr(i),h.x=p.x+i.clientLeft,h.y=p.y+i.clientTop}let m=n&&!d&&!o?Km(n,c):Gt(0);return{width:s.width*l.x,height:s.height*l.y,x:s.x*l.x-c.scrollLeft*l.x+h.x+m.x,y:s.y*l.y-c.scrollTop*l.y+h.y+m.y}}function dS(e){return Array.from(e.getClientRects())}function uS(e){let t=Yt(e),s=Po(e),i=e.ownerDocument.body,r=dt(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),o=dt(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),n=-s.scrollLeft+_a(e),a=-s.scrollTop;return zt(i).direction==="rtl"&&(n+=dt(t.clientWidth,i.clientWidth)-r),{width:r,height:o,x:n,y:a}}var Wm=25;function pS(e,t){let s=_t(e),i=Yt(e),r=s.visualViewport,o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(r){o=r.width,n=r.height;let h=ma();(!h||h&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}let l=_a(i);if(l<=0){let h=i.ownerDocument,d=h.body,m=getComputedStyle(d),p=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,f=Math.abs(i.clientWidth-d.clientWidth-p);f<=Wm&&(o-=f)}else l<=Wm&&(o+=l);return{width:o,height:n,x:a,y:c}}function fS(e,t){let s=Fi(e,!0,t==="fixed"),i=s.top+e.clientTop,r=s.left+e.clientLeft,o=hs(e)?xr(e):Gt(1),n=e.clientWidth*o.x,a=e.clientHeight*o.y,c=r*o.x,l=i*o.y;return{width:n,height:a,x:c,y:l}}function jm(e,t,s){let i;if(t==="viewport")i=pS(e,s);else if(t==="document")i=uS(Yt(e));else if(It(t))i=fS(t,s);else{let r=qm(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Oi(i)}function Gm(e,t){let s=Ms(e);return s===t||!It(s)||Ni(s)?!1:zt(s).position==="fixed"||Gm(s,t)}function mS(e,t){let s=t.get(e);if(s)return s;let i=wr(e,[],!1).filter(a=>It(a)&&zi(a)!=="body"),r=null,o=zt(e).position==="fixed",n=o?Ms(e):e;for(;It(n)&&!Ni(n);){let a=zt(n),c=Cr(n);!c&&a.position==="fixed"&&(r=null),(o?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Sr(n)&&!c&&Gm(e,n))?i=i.filter(h=>h!==n):r=a,n=Ms(n)}return t.set(e,i),i}function gS(e){let{element:t,boundary:s,rootBoundary:i,strategy:r}=e,n=[...s==="clippingAncestors"?Do(t)?[]:mS(t,this._c):[].concat(s),i],a=jm(t,n[0],r),c=a.top,l=a.right,h=a.bottom,d=a.left;for(let m=1;m<n.length;m++){let p=jm(t,n[m],r);c=dt(p.top,c),l=ls(p.right,l),h=ls(p.bottom,h),d=dt(p.left,d)}return{width:l-d,height:h-c,x:d,y:c}}function _S(e){let{width:t,height:s}=Um(e);return{width:t,height:s}}function vS(e,t,s){let i=hs(t),r=Yt(t),o=s==="fixed",n=Fi(e,!0,o,t),a={scrollLeft:0,scrollTop:0},c=Gt(0);function l(){c.x=_a(r)}if(i||!i&&!o)if((zi(t)!=="body"||Sr(r))&&(a=Po(t)),i){let p=Fi(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else r&&l();o&&!i&&r&&l();let h=r&&!i&&!o?Km(r,a):Gt(0),d=n.left+a.scrollLeft-c.x-h.x,m=n.top+a.scrollTop-c.y-h.y;return{x:d,y:m,width:n.width,height:n.height}}function gh(e){return zt(e).position==="static"}function Vm(e,t){if(!hs(e)||zt(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return Yt(e)===s&&(s=s.ownerDocument.body),s}function Ym(e,t){let s=_t(e);if(Do(e))return s;if(!hs(e)){let r=Ms(e);for(;r&&!Ni(r);){if(It(r)&&!gh(r))return r;r=Ms(r)}return s}let i=Vm(e,t);for(;i&&Nm(i)&&gh(i);)i=Vm(i,t);return i&&Ni(i)&&gh(i)&&!Cr(i)?s:i||Fm(e)||s}var bS=async function(e){let t=this.getOffsetParent||Ym,s=this.getDimensions,i=await s(e.floating);return{reference:vS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function yS(e){return zt(e).direction==="rtl"}var Mo={convertOffsetParentRelativeRectToViewportRelativeRect:hS,getDocumentElement:Yt,getClippingRect:gS,getOffsetParent:Ym,getElementRects:bS,getClientRects:dS,getDimensions:_S,getScale:xr,isElement:It,isRTL:yS};function Xm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wS(e,t){let s=null,i,r=Yt(e);function o(){var a;clearTimeout(i),(a=s)==null||a.disconnect(),s=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:h,top:d,width:m,height:p}=l;if(a||t(),!m||!p)return;let f=Lo(d),_=Lo(r.clientWidth-(h+m)),S=Lo(r.clientHeight-(d+p)),k=Lo(h),v={rootMargin:-f+"px "+-_+"px "+-S+"px "+-k+"px",threshold:dt(0,ls(1,c))||1},y=!0;function A(M){let H=M[0].intersectionRatio;if(H!==c){if(!y)return n();H?n(!1,H):i=setTimeout(()=>{n(!1,1e-7)},1e3)}H===1&&!Xm(l,e.getBoundingClientRect())&&n(),y=!1}try{s=new IntersectionObserver(A,{...v,root:r.ownerDocument})}catch{s=new IntersectionObserver(A,v)}s.observe(e)}return n(!0),o}function Jm(e,t,s,i){i===void 0&&(i={});let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=_h(e),h=r||o?[...l?wr(l):[],...t?wr(t):[]]:[];h.forEach(k=>{r&&k.addEventListener("scroll",s,{passive:!0}),o&&k.addEventListener("resize",s)});let d=l&&a?wS(l,s):null,m=-1,p=null;n&&(p=new ResizeObserver(k=>{let[x]=k;x&&x.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=p)==null||v.observe(t)})),s()}),l&&!c&&p.observe(l),t&&p.observe(t));let f,_=c?Fi(e):null;c&&S();function S(){let k=Fi(e);_&&!Xm(_,k)&&s(),_=k,f=requestAnimationFrame(S)}return s(),()=>{var k;h.forEach(x=>{r&&x.removeEventListener("scroll",s),o&&x.removeEventListener("resize",s)}),d?.(),(k=p)==null||k.disconnect(),p=null,c&&cancelAnimationFrame(f)}}var Zm=Mm;var Qm=Bm,eg=Pm,vh=Om;var tg=Dm;var sg=(e,t,s)=>{let i=new Map,r={platform:Mo,...s},o={...r.platform,_c:i};return Lm(e,t,{...r,platform:o})};function ig(e){return SS(e)}function bh(e){return e.assignedSlot?e.assignedSlot:e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}function SS(e){for(let t=e;t;t=bh(t))if(t instanceof Element&&getComputedStyle(t).display==="none")return null;for(let t=bh(e);t;t=bh(t)){if(!(t instanceof Element))continue;let s=getComputedStyle(t);if(s.display!=="contents"&&(s.position!=="static"||Cr(s)||t.tagName==="BODY"))return t}return null}function CS(e){return e!==null&&typeof e=="object"&&"getBoundingClientRect"in e&&("contextElement"in e?e.contextElement instanceof Element:!0)}var pe=class extends J{constructor(){super(...arguments),this.localize=new me(this),this.active=!1,this.placement="top",this.strategy="absolute",this.distance=0,this.skidding=0,this.arrow=!1,this.arrowPlacement="anchor",this.arrowPadding=10,this.flip=!1,this.flipFallbackPlacements="",this.flipFallbackStrategy="best-fit",this.flipPadding=0,this.shift=!1,this.shiftPadding=0,this.autoSizePadding=0,this.hoverBridge=!1,this.updateHoverBridge=()=>{if(this.hoverBridge&&this.anchorEl){let e=this.anchorEl.getBoundingClientRect(),t=this.popup.getBoundingClientRect(),s=this.placement.includes("top")||this.placement.includes("bottom"),i=0,r=0,o=0,n=0,a=0,c=0,l=0,h=0;s?e.top<t.top?(i=e.left,r=e.bottom,o=e.right,n=e.bottom,a=t.left,c=t.top,l=t.right,h=t.top):(i=t.left,r=t.bottom,o=t.right,n=t.bottom,a=e.left,c=e.top,l=e.right,h=e.top):e.left<t.left?(i=e.right,r=e.top,o=t.left,n=t.top,a=e.right,c=e.bottom,l=t.left,h=t.bottom):(i=t.right,r=t.top,o=e.left,n=e.top,a=t.right,c=t.bottom,l=e.left,h=e.bottom),this.style.setProperty("--hover-bridge-top-left-x",`${i}px`),this.style.setProperty("--hover-bridge-top-left-y",`${r}px`),this.style.setProperty("--hover-bridge-top-right-x",`${o}px`),this.style.setProperty("--hover-bridge-top-right-y",`${n}px`),this.style.setProperty("--hover-bridge-bottom-left-x",`${a}px`),this.style.setProperty("--hover-bridge-bottom-left-y",`${c}px`),this.style.setProperty("--hover-bridge-bottom-right-x",`${l}px`),this.style.setProperty("--hover-bridge-bottom-right-y",`${h}px`)}}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.start()}disconnectedCallback(){super.disconnectedCallback(),this.stop()}async updated(e){super.updated(e),e.has("active")&&(this.active?this.start():this.stop()),e.has("anchor")&&this.handleAnchorChange(),this.active&&(await this.updateComplete,this.reposition())}async handleAnchorChange(){if(await this.stop(),this.anchor&&typeof this.anchor=="string"){let e=this.getRootNode();this.anchorEl=e.getElementById(this.anchor)}else this.anchor instanceof Element||CS(this.anchor)?this.anchorEl=this.anchor:this.anchorEl=this.querySelector('[slot="anchor"]');this.anchorEl instanceof HTMLSlotElement&&(this.anchorEl=this.anchorEl.assignedElements({flatten:!0})[0]),this.anchorEl&&this.active&&this.start()}start(){!this.anchorEl||!this.active||(this.cleanup=Jm(this.anchorEl,this.popup,()=>{this.reposition()}))}async stop(){return new Promise(e=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.removeAttribute("data-current-placement"),this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame(()=>e())):e()})}reposition(){if(!this.active||!this.anchorEl)return;let e=[Zm({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?e.push(vh({apply:({rects:s})=>{let i=this.sync==="width"||this.sync==="both",r=this.sync==="height"||this.sync==="both";this.popup.style.width=i?`${s.reference.width}px`:"",this.popup.style.height=r?`${s.reference.height}px`:""}})):(this.popup.style.width="",this.popup.style.height=""),this.flip&&e.push(eg({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:this.flipFallbackStrategy==="best-fit"?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&e.push(Qm({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?e.push(vh({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:s,availableHeight:i})=>{this.autoSize==="vertical"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-height",`${i}px`):this.style.removeProperty("--auto-size-available-height"),this.autoSize==="horizontal"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-width",`${s}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&e.push(tg({element:this.arrowEl,padding:this.arrowPadding}));let t=this.strategy==="absolute"?s=>Mo.getOffsetParent(s,ig):Mo.getOffsetParent;sg(this.anchorEl,this.popup,{placement:this.placement,middleware:e,strategy:this.strategy,platform:Ds(nt({},Mo),{getOffsetParent:t})}).then(({x:s,y:i,middlewareData:r,placement:o})=>{let n=this.localize.dir()==="rtl",a={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]];if(this.setAttribute("data-current-placement",o),Object.assign(this.popup.style,{left:`${s}px`,top:`${i}px`}),this.arrow){let c=r.arrow.x,l=r.arrow.y,h="",d="",m="",p="";if(this.arrowPlacement==="start"){let f=typeof c=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";h=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",d=n?f:"",p=n?"":f}else if(this.arrowPlacement==="end"){let f=typeof c=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";d=n?"":f,p=n?f:"",m=typeof l=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else this.arrowPlacement==="center"?(p=typeof c=="number"?"calc(50% - var(--arrow-size-diagonal))":"",h=typeof l=="number"?"calc(50% - var(--arrow-size-diagonal))":""):(p=typeof c=="number"?`${c}px`:"",h=typeof l=="number"?`${l}px`:"");Object.assign(this.arrowEl.style,{top:h,right:d,bottom:m,left:p,[a]:"calc(var(--arrow-size-diagonal) * -1)"})}}),requestAnimationFrame(()=>this.updateHoverBridge()),this.emit("sl-reposition")}render(){return u`
3164
3168
  <slot name="anchor" @slotchange=${this.handleAnchorChange}></slot>
3165
3169
 
3166
3170
  <span
@@ -3175,7 +3179,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
3175
3179
  <slot></slot>
3176
3180
  ${this.arrow?u`<div part="arrow" class="popup__arrow" role="presentation"></div>`:""}
3177
3181
  </div>
3178
- `}};pe.styles=[te,Cm];g([Q(".popup")],pe.prototype,"popup",2);g([Q(".popup__arrow")],pe.prototype,"arrowEl",2);g([b()],pe.prototype,"anchor",2);g([b({type:Boolean,reflect:!0})],pe.prototype,"active",2);g([b({reflect:!0})],pe.prototype,"placement",2);g([b({reflect:!0})],pe.prototype,"strategy",2);g([b({type:Number})],pe.prototype,"distance",2);g([b({type:Number})],pe.prototype,"skidding",2);g([b({type:Boolean})],pe.prototype,"arrow",2);g([b({attribute:"arrow-placement"})],pe.prototype,"arrowPlacement",2);g([b({attribute:"arrow-padding",type:Number})],pe.prototype,"arrowPadding",2);g([b({type:Boolean})],pe.prototype,"flip",2);g([b({attribute:"flip-fallback-placements",converter:{fromAttribute:e=>e.split(" ").map(t=>t.trim()).filter(t=>t!==""),toAttribute:e=>e.join(" ")}})],pe.prototype,"flipFallbackPlacements",2);g([b({attribute:"flip-fallback-strategy"})],pe.prototype,"flipFallbackStrategy",2);g([b({type:Object})],pe.prototype,"flipBoundary",2);g([b({attribute:"flip-padding",type:Number})],pe.prototype,"flipPadding",2);g([b({type:Boolean})],pe.prototype,"shift",2);g([b({type:Object})],pe.prototype,"shiftBoundary",2);g([b({attribute:"shift-padding",type:Number})],pe.prototype,"shiftPadding",2);g([b({attribute:"auto-size"})],pe.prototype,"autoSize",2);g([b()],pe.prototype,"sync",2);g([b({type:Object})],pe.prototype,"autoSizeBoundary",2);g([b({attribute:"auto-size-padding",type:Number})],pe.prototype,"autoSizePadding",2);g([b({attribute:"hover-bridge",type:Boolean})],pe.prototype,"hoverBridge",2);var Oo=new WeakMap,Io=new WeakMap,zo=new WeakMap,yh=new WeakSet,wa=new WeakMap,ds=class{constructor(e,t){this.handleFormData=s=>{let i=this.options.disabled(this.host),r=this.options.name(this.host),o=this.options.value(this.host),n=this.host.tagName.toLowerCase()==="sl-button";this.host.isConnected&&!i&&!n&&typeof r=="string"&&r.length>0&&typeof o<"u"&&(Array.isArray(o)?o.forEach(a=>{s.formData.append(r,a.toString())}):s.formData.append(r,o.toString()))},this.handleFormSubmit=s=>{var i;let r=this.options.disabled(this.host),o=this.options.reportValidity;this.form&&!this.form.noValidate&&((i=Oo.get(this.form))==null||i.forEach(n=>{this.setUserInteracted(n,!0)})),this.form&&!this.form.noValidate&&!r&&!o(this.host)&&(s.preventDefault(),s.stopImmediatePropagation())},this.handleFormReset=()=>{this.options.setValue(this.host,this.options.defaultValue(this.host)),this.setUserInteracted(this.host,!1),wa.set(this.host,[])},this.handleInteraction=s=>{let i=wa.get(this.host);i.includes(s.type)||i.push(s.type),i.length===this.options.assumeInteractionOn.length&&this.setUserInteracted(this.host,!0)},this.checkFormValidity=()=>{if(this.form&&!this.form.noValidate){let s=this.form.querySelectorAll("*");for(let i of s)if(typeof i.checkValidity=="function"&&!i.checkValidity())return!1}return!0},this.reportFormValidity=()=>{if(this.form&&!this.form.noValidate){let s=this.form.querySelectorAll("*");for(let i of s)if(typeof i.reportValidity=="function"&&!i.reportValidity())return!1}return!0},(this.host=e).addController(this),this.options=nt({form:s=>{let i=s.form;if(i){let o=s.getRootNode().querySelector(`#${i}`);if(o)return o}return s.closest("form")},name:s=>s.name,value:s=>s.value,defaultValue:s=>s.defaultValue,disabled:s=>{var i;return(i=s.disabled)!=null?i:!1},reportValidity:s=>typeof s.reportValidity=="function"?s.reportValidity():!0,checkValidity:s=>typeof s.checkValidity=="function"?s.checkValidity():!0,setValue:(s,i)=>s.value=i,assumeInteractionOn:["sl-input"]},t)}hostConnected(){let e=this.options.form(this.host);e&&this.attachForm(e),wa.set(this.host,[]),this.options.assumeInteractionOn.forEach(t=>{this.host.addEventListener(t,this.handleInteraction)})}hostDisconnected(){this.detachForm(),wa.delete(this.host),this.options.assumeInteractionOn.forEach(e=>{this.host.removeEventListener(e,this.handleInteraction)})}hostUpdated(){let e=this.options.form(this.host);e||this.detachForm(),e&&this.form!==e&&(this.detachForm(),this.attachForm(e)),this.host.hasUpdated&&this.setValidity(this.host.validity.valid)}attachForm(e){e?(this.form=e,Oo.has(this.form)?Oo.get(this.form).add(this.host):Oo.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.handleFormData),this.form.addEventListener("submit",this.handleFormSubmit),this.form.addEventListener("reset",this.handleFormReset),Io.has(this.form)||(Io.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity()),zo.has(this.form)||(zo.set(this.form,this.form.checkValidity),this.form.checkValidity=()=>this.checkFormValidity())):this.form=void 0}detachForm(){if(!this.form)return;let e=Oo.get(this.form);e&&(e.delete(this.host),e.size<=0&&(this.form.removeEventListener("formdata",this.handleFormData),this.form.removeEventListener("submit",this.handleFormSubmit),this.form.removeEventListener("reset",this.handleFormReset),Io.has(this.form)&&(this.form.reportValidity=Io.get(this.form),Io.delete(this.form)),zo.has(this.form)&&(this.form.checkValidity=zo.get(this.form),zo.delete(this.form)),this.form=void 0))}setUserInteracted(e,t){t?yh.add(e):yh.delete(e),e.requestUpdate()}doAction(e,t){if(this.form){let s=document.createElement("button");s.type=e,s.style.position="absolute",s.style.width="0",s.style.height="0",s.style.clipPath="inset(50%)",s.style.overflow="hidden",s.style.whiteSpace="nowrap",t&&(s.name=t.name,s.value=t.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach(i=>{t.hasAttribute(i)&&s.setAttribute(i,t.getAttribute(i))})),this.form.append(s),s.click(),s.remove()}}getForm(){var e;return(e=this.form)!=null?e:null}reset(e){this.doAction("reset",e)}submit(e){this.doAction("submit",e)}setValidity(e){let t=this.host,s=!!yh.has(t),i=!!t.required;t.toggleAttribute("data-required",i),t.toggleAttribute("data-optional",!i),t.toggleAttribute("data-invalid",!e),t.toggleAttribute("data-valid",e),t.toggleAttribute("data-user-invalid",!e&&s),t.toggleAttribute("data-user-valid",e&&s)}updateValidity(){let e=this.host;this.setValidity(e.validity.valid)}emitInvalidEvent(e){let t=new CustomEvent("sl-invalid",{bubbles:!1,composed:!1,cancelable:!0,detail:{}});e||t.preventDefault(),this.host.dispatchEvent(t)||e?.preventDefault()}},Sa=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1}),JD=Object.freeze(Ds(nt({},Sa),{valid:!1,valueMissing:!0})),ZD=Object.freeze(Ds(nt({},Sa),{valid:!1,customError:!0}));var vt=class{constructor(e,...t){this.slotNames=[],this.handleSlotChange=s=>{let i=s.target;(this.slotNames.includes("[default]")&&!i.name||i.name&&this.slotNames.includes(i.name))&&this.host.requestUpdate()},(this.host=e).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent.trim()!=="")return!0;if(e.nodeType===e.ELEMENT_NODE){let t=e;if(t.tagName.toLowerCase()==="sl-visually-hidden")return!1;if(!t.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(e){return this.host.querySelector(`:scope > [slot="${e}"]`)!==null}test(e){return e==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(e)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}};var ne=class extends J{constructor(){super(...arguments),this.formControlController=new ds(this,{assumeInteractionOn:["sl-blur","sl-input"]}),this.hasSlotController=new vt(this,"help-text","label"),this.localize=new me(this),this.typeToSelectString="",this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.valueHasChanged=!1,this.name="",this._value="",this.defaultValue="",this.size="medium",this.placeholder="",this.multiple=!1,this.maxOptionsVisible=3,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.helpText="",this.form="",this.required=!1,this.getTag=e=>u`
3182
+ `}};pe.styles=[te,Cm];g([Q(".popup")],pe.prototype,"popup",2);g([Q(".popup__arrow")],pe.prototype,"arrowEl",2);g([b()],pe.prototype,"anchor",2);g([b({type:Boolean,reflect:!0})],pe.prototype,"active",2);g([b({reflect:!0})],pe.prototype,"placement",2);g([b({reflect:!0})],pe.prototype,"strategy",2);g([b({type:Number})],pe.prototype,"distance",2);g([b({type:Number})],pe.prototype,"skidding",2);g([b({type:Boolean})],pe.prototype,"arrow",2);g([b({attribute:"arrow-placement"})],pe.prototype,"arrowPlacement",2);g([b({attribute:"arrow-padding",type:Number})],pe.prototype,"arrowPadding",2);g([b({type:Boolean})],pe.prototype,"flip",2);g([b({attribute:"flip-fallback-placements",converter:{fromAttribute:e=>e.split(" ").map(t=>t.trim()).filter(t=>t!==""),toAttribute:e=>e.join(" ")}})],pe.prototype,"flipFallbackPlacements",2);g([b({attribute:"flip-fallback-strategy"})],pe.prototype,"flipFallbackStrategy",2);g([b({type:Object})],pe.prototype,"flipBoundary",2);g([b({attribute:"flip-padding",type:Number})],pe.prototype,"flipPadding",2);g([b({type:Boolean})],pe.prototype,"shift",2);g([b({type:Object})],pe.prototype,"shiftBoundary",2);g([b({attribute:"shift-padding",type:Number})],pe.prototype,"shiftPadding",2);g([b({attribute:"auto-size"})],pe.prototype,"autoSize",2);g([b()],pe.prototype,"sync",2);g([b({type:Object})],pe.prototype,"autoSizeBoundary",2);g([b({attribute:"auto-size-padding",type:Number})],pe.prototype,"autoSizePadding",2);g([b({attribute:"hover-bridge",type:Boolean})],pe.prototype,"hoverBridge",2);var Bo=new WeakMap,Oo=new WeakMap,Io=new WeakMap,yh=new WeakSet,va=new WeakMap,ds=class{constructor(e,t){this.handleFormData=s=>{let i=this.options.disabled(this.host),r=this.options.name(this.host),o=this.options.value(this.host),n=this.host.tagName.toLowerCase()==="sl-button";this.host.isConnected&&!i&&!n&&typeof r=="string"&&r.length>0&&typeof o<"u"&&(Array.isArray(o)?o.forEach(a=>{s.formData.append(r,a.toString())}):s.formData.append(r,o.toString()))},this.handleFormSubmit=s=>{var i;let r=this.options.disabled(this.host),o=this.options.reportValidity;this.form&&!this.form.noValidate&&((i=Bo.get(this.form))==null||i.forEach(n=>{this.setUserInteracted(n,!0)})),this.form&&!this.form.noValidate&&!r&&!o(this.host)&&(s.preventDefault(),s.stopImmediatePropagation())},this.handleFormReset=()=>{this.options.setValue(this.host,this.options.defaultValue(this.host)),this.setUserInteracted(this.host,!1),va.set(this.host,[])},this.handleInteraction=s=>{let i=va.get(this.host);i.includes(s.type)||i.push(s.type),i.length===this.options.assumeInteractionOn.length&&this.setUserInteracted(this.host,!0)},this.checkFormValidity=()=>{if(this.form&&!this.form.noValidate){let s=this.form.querySelectorAll("*");for(let i of s)if(typeof i.checkValidity=="function"&&!i.checkValidity())return!1}return!0},this.reportFormValidity=()=>{if(this.form&&!this.form.noValidate){let s=this.form.querySelectorAll("*");for(let i of s)if(typeof i.reportValidity=="function"&&!i.reportValidity())return!1}return!0},(this.host=e).addController(this),this.options=nt({form:s=>{let i=s.form;if(i){let o=s.getRootNode().querySelector(`#${i}`);if(o)return o}return s.closest("form")},name:s=>s.name,value:s=>s.value,defaultValue:s=>s.defaultValue,disabled:s=>{var i;return(i=s.disabled)!=null?i:!1},reportValidity:s=>typeof s.reportValidity=="function"?s.reportValidity():!0,checkValidity:s=>typeof s.checkValidity=="function"?s.checkValidity():!0,setValue:(s,i)=>s.value=i,assumeInteractionOn:["sl-input"]},t)}hostConnected(){let e=this.options.form(this.host);e&&this.attachForm(e),va.set(this.host,[]),this.options.assumeInteractionOn.forEach(t=>{this.host.addEventListener(t,this.handleInteraction)})}hostDisconnected(){this.detachForm(),va.delete(this.host),this.options.assumeInteractionOn.forEach(e=>{this.host.removeEventListener(e,this.handleInteraction)})}hostUpdated(){let e=this.options.form(this.host);e||this.detachForm(),e&&this.form!==e&&(this.detachForm(),this.attachForm(e)),this.host.hasUpdated&&this.setValidity(this.host.validity.valid)}attachForm(e){e?(this.form=e,Bo.has(this.form)?Bo.get(this.form).add(this.host):Bo.set(this.form,new Set([this.host])),this.form.addEventListener("formdata",this.handleFormData),this.form.addEventListener("submit",this.handleFormSubmit),this.form.addEventListener("reset",this.handleFormReset),Oo.has(this.form)||(Oo.set(this.form,this.form.reportValidity),this.form.reportValidity=()=>this.reportFormValidity()),Io.has(this.form)||(Io.set(this.form,this.form.checkValidity),this.form.checkValidity=()=>this.checkFormValidity())):this.form=void 0}detachForm(){if(!this.form)return;let e=Bo.get(this.form);e&&(e.delete(this.host),e.size<=0&&(this.form.removeEventListener("formdata",this.handleFormData),this.form.removeEventListener("submit",this.handleFormSubmit),this.form.removeEventListener("reset",this.handleFormReset),Oo.has(this.form)&&(this.form.reportValidity=Oo.get(this.form),Oo.delete(this.form)),Io.has(this.form)&&(this.form.checkValidity=Io.get(this.form),Io.delete(this.form)),this.form=void 0))}setUserInteracted(e,t){t?yh.add(e):yh.delete(e),e.requestUpdate()}doAction(e,t){if(this.form){let s=document.createElement("button");s.type=e,s.style.position="absolute",s.style.width="0",s.style.height="0",s.style.clipPath="inset(50%)",s.style.overflow="hidden",s.style.whiteSpace="nowrap",t&&(s.name=t.name,s.value=t.value,["formaction","formenctype","formmethod","formnovalidate","formtarget"].forEach(i=>{t.hasAttribute(i)&&s.setAttribute(i,t.getAttribute(i))})),this.form.append(s),s.click(),s.remove()}}getForm(){var e;return(e=this.form)!=null?e:null}reset(e){this.doAction("reset",e)}submit(e){this.doAction("submit",e)}setValidity(e){let t=this.host,s=!!yh.has(t),i=!!t.required;t.toggleAttribute("data-required",i),t.toggleAttribute("data-optional",!i),t.toggleAttribute("data-invalid",!e),t.toggleAttribute("data-valid",e),t.toggleAttribute("data-user-invalid",!e&&s),t.toggleAttribute("data-user-valid",e&&s)}updateValidity(){let e=this.host;this.setValidity(e.validity.valid)}emitInvalidEvent(e){let t=new CustomEvent("sl-invalid",{bubbles:!1,composed:!1,cancelable:!0,detail:{}});e||t.preventDefault(),this.host.dispatchEvent(t)||e?.preventDefault()}},ba=Object.freeze({badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1}),JD=Object.freeze(Ds(nt({},ba),{valid:!1,valueMissing:!0})),ZD=Object.freeze(Ds(nt({},ba),{valid:!1,customError:!0}));var vt=class{constructor(e,...t){this.slotNames=[],this.handleSlotChange=s=>{let i=s.target;(this.slotNames.includes("[default]")&&!i.name||i.name&&this.slotNames.includes(i.name))&&this.host.requestUpdate()},(this.host=e).addController(this),this.slotNames=t}hasDefaultSlot(){return[...this.host.childNodes].some(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent.trim()!=="")return!0;if(e.nodeType===e.ELEMENT_NODE){let t=e;if(t.tagName.toLowerCase()==="sl-visually-hidden")return!1;if(!t.hasAttribute("slot"))return!0}return!1})}hasNamedSlot(e){return this.host.querySelector(`:scope > [slot="${e}"]`)!==null}test(e){return e==="[default]"?this.hasDefaultSlot():this.hasNamedSlot(e)}hostConnected(){this.host.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}};var ne=class extends J{constructor(){super(...arguments),this.formControlController=new ds(this,{assumeInteractionOn:["sl-blur","sl-input"]}),this.hasSlotController=new vt(this,"help-text","label"),this.localize=new me(this),this.typeToSelectString="",this.hasFocus=!1,this.displayLabel="",this.selectedOptions=[],this.valueHasChanged=!1,this.name="",this._value="",this.defaultValue="",this.size="medium",this.placeholder="",this.multiple=!1,this.maxOptionsVisible=3,this.disabled=!1,this.clearable=!1,this.open=!1,this.hoist=!1,this.filled=!1,this.pill=!1,this.label="",this.placement="bottom",this.helpText="",this.form="",this.required=!1,this.getTag=e=>u`
3179
3183
  <sl-tag
3180
3184
  part="tag"
3181
3185
  exportparts="
@@ -3192,8 +3196,8 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
3192
3196
  ${e.getTextLabel()}
3193
3197
  </sl-tag>
3194
3198
  `,this.handleDocumentFocusIn=e=>{let t=e.composedPath();this&&!t.includes(this)&&this.hide()},this.handleDocumentKeyDown=e=>{let t=e.target,s=t.closest(".select__clear")!==null,i=t.closest("sl-icon-button")!==null;if(!(s||i)){if(e.key==="Escape"&&this.open&&!this.closeWatcher&&(e.preventDefault(),e.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0})),e.key==="Enter"||e.key===" "&&this.typeToSelectString===""){if(e.preventDefault(),e.stopImmediatePropagation(),!this.open){this.show();return}this.currentOption&&!this.currentOption.disabled&&(this.valueHasChanged=!0,this.multiple?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then(()=>{this.emit("sl-input"),this.emit("sl-change")}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})));return}if(["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let r=this.getAllOptions(),o=r.indexOf(this.currentOption),n=Math.max(0,o);if(e.preventDefault(),!this.open&&(this.show(),this.currentOption))return;e.key==="ArrowDown"?(n=o+1,n>r.length-1&&(n=0)):e.key==="ArrowUp"?(n=o-1,n<0&&(n=r.length-1)):e.key==="Home"?n=0:e.key==="End"&&(n=r.length-1),this.setCurrentOption(r[n])}if(e.key&&e.key.length===1||e.key==="Backspace"){let r=this.getAllOptions();if(e.metaKey||e.ctrlKey||e.altKey)return;if(!this.open){if(e.key==="Backspace")return;this.show()}e.stopPropagation(),e.preventDefault(),clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=window.setTimeout(()=>this.typeToSelectString="",1e3),e.key==="Backspace"?this.typeToSelectString=this.typeToSelectString.slice(0,-1):this.typeToSelectString+=e.key.toLowerCase();for(let o of r)if(o.getTextLabel().toLowerCase().startsWith(this.typeToSelectString)){this.setCurrentOption(o);break}}}},this.handleDocumentMouseDown=e=>{let t=e.composedPath();this&&!t.includes(this)&&this.hide()}}get value(){return this._value}set value(e){this.multiple?e=Array.isArray(e)?e:e.split(" "):e=Array.isArray(e)?e.join(" "):e,this._value!==e&&(this.valueHasChanged=!0,this._value=e)}get validity(){return this.valueInput.validity}get validationMessage(){return this.valueInput.validationMessage}connectedCallback(){super.connectedCallback(),setTimeout(()=>{this.handleDefaultSlotChange()}),this.open=!1}addOpenListeners(){var e;document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().addEventListener("focusin",this.handleDocumentFocusIn),"CloseWatcher"in window&&((e=this.closeWatcher)==null||e.destroy(),this.closeWatcher=new CloseWatcher,this.closeWatcher.onclose=()=>{this.open&&(this.hide(),this.displayInput.focus({preventScroll:!0}))})}removeOpenListeners(){var e;document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.getRootNode()!==document&&this.getRootNode().removeEventListener("focusin",this.handleDocumentFocusIn),(e=this.closeWatcher)==null||e.destroy()}handleFocus(){this.hasFocus=!0,this.displayInput.setSelectionRange(0,0),this.emit("sl-focus")}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleLabelClick(){this.displayInput.focus()}handleComboboxMouseDown(e){let s=e.composedPath().some(i=>i instanceof Element&&i.tagName.toLowerCase()==="sl-icon-button");this.disabled||s||(e.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open)}handleComboboxKeyDown(e){e.key!=="Tab"&&(e.stopPropagation(),this.handleDocumentKeyDown(e))}handleClearClick(e){e.stopPropagation(),this.valueHasChanged=!0,this.value!==""&&(this.setSelectedOptions([]),this.displayInput.focus({preventScroll:!0}),this.updateComplete.then(()=>{this.emit("sl-clear"),this.emit("sl-input"),this.emit("sl-change")}))}handleClearMouseDown(e){e.stopPropagation(),e.preventDefault()}handleOptionClick(e){let s=e.target.closest("sl-option"),i=this.value;s&&!s.disabled&&(this.valueHasChanged=!0,this.multiple?this.toggleOptionSelection(s):this.setSelectedOptions(s),this.updateComplete.then(()=>this.displayInput.focus({preventScroll:!0})),this.value!==i&&this.updateComplete.then(()=>{this.emit("sl-input"),this.emit("sl-change")}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})))}handleDefaultSlotChange(){customElements.get("sl-option")||customElements.whenDefined("sl-option").then(()=>this.handleDefaultSlotChange());let e=this.getAllOptions(),t=this.valueHasChanged?this.value:this.defaultValue,s=Array.isArray(t)?t:[t],i=[];e.forEach(r=>i.push(r.value)),this.setSelectedOptions(e.filter(r=>s.includes(r.value)))}handleTagRemove(e,t){e.stopPropagation(),this.valueHasChanged=!0,this.disabled||(this.toggleOptionSelection(t,!1),this.updateComplete.then(()=>{this.emit("sl-input"),this.emit("sl-change")}))}getAllOptions(){return[...this.querySelectorAll("sl-option")]}getFirstOption(){return this.querySelector("sl-option")}setCurrentOption(e){this.getAllOptions().forEach(s=>{s.current=!1,s.tabIndex=-1}),e&&(this.currentOption=e,e.current=!0,e.tabIndex=0,e.focus())}setSelectedOptions(e){let t=this.getAllOptions(),s=Array.isArray(e)?e:[e];t.forEach(i=>i.selected=!1),s.length&&s.forEach(i=>i.selected=!0),this.selectionChanged()}toggleOptionSelection(e,t){t===!0||t===!1?e.selected=t:e.selected=!e.selected,this.selectionChanged()}selectionChanged(){var e,t,s;let i=this.getAllOptions();this.selectedOptions=i.filter(o=>o.selected);let r=this.valueHasChanged;if(this.multiple)this.value=this.selectedOptions.map(o=>o.value),this.placeholder&&this.value.length===0?this.displayLabel="":this.displayLabel=this.localize.term("numOptionsSelected",this.selectedOptions.length);else{let o=this.selectedOptions[0];this.value=(e=o?.value)!=null?e:"",this.displayLabel=(s=(t=o?.getTextLabel)==null?void 0:t.call(o))!=null?s:""}this.valueHasChanged=r,this.updateComplete.then(()=>{this.formControlController.updateValidity()})}get tags(){return this.selectedOptions.map((e,t)=>{if(t<this.maxOptionsVisible||this.maxOptionsVisible<=0){let s=this.getTag(e,t);return u`<div @sl-remove=${i=>this.handleTagRemove(i,e)}>
3195
- ${typeof s=="string"?k(s):s}
3196
- </div>`}else if(t===this.maxOptionsVisible)return u`<sl-tag size=${this.size}>+${this.selectedOptions.length-t}</sl-tag>`;return u``})}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e==="value"){let i=this.valueHasChanged;this.value=this.defaultValue,this.valueHasChanged=i}}handleValueChange(){if(!this.valueHasChanged){let s=this.valueHasChanged;this.value=this.defaultValue,this.valueHasChanged=s}let e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(e.filter(s=>t.includes(s.value)))}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("sl-show"),this.addOpenListeners(),await tt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame(()=>{this.setCurrentOption(this.currentOption)});let{keyframes:e,options:t}=Ue(this,"select.show",{dir:this.localize.dir()});await qe(this.popup.popup,e,t),this.currentOption&&Ao(this.currentOption,this.listbox,"vertical","auto"),this.emit("sl-after-show")}else{this.emit("sl-hide"),this.removeOpenListeners(),await tt(this);let{keyframes:e,options:t}=Ue(this,"select.hide",{dir:this.localize.dir()});await qe(this.popup.popup,e,t),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sl-after-hide")}}async show(){if(this.open||this.disabled){this.open=!1;return}return this.open=!0,ht(this,"sl-after-show")}async hide(){if(!this.open||this.disabled){this.open=!1;return}return this.open=!1,ht(this,"sl-after-hide")}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}render(){let e=this.hasSlotController.test("label"),t=this.hasSlotController.test("help-text"),s=this.label?!0:!!e,i=this.helpText?!0:!!t,r=this.clearable&&!this.disabled&&this.value.length>0,o=this.placeholder&&this.value&&this.value.length<=0;return u`
3199
+ ${typeof s=="string"?T(s):s}
3200
+ </div>`}else if(t===this.maxOptionsVisible)return u`<sl-tag size=${this.size}>+${this.selectedOptions.length-t}</sl-tag>`;return u``})}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange())}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e==="value"){let i=this.valueHasChanged;this.value=this.defaultValue,this.valueHasChanged=i}}handleValueChange(){if(!this.valueHasChanged){let s=this.valueHasChanged;this.value=this.defaultValue,this.valueHasChanged=s}let e=this.getAllOptions(),t=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(e.filter(s=>t.includes(s.value)))}async handleOpenChange(){if(this.open&&!this.disabled){this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption()),this.emit("sl-show"),this.addOpenListeners(),await tt(this),this.listbox.hidden=!1,this.popup.active=!0,requestAnimationFrame(()=>{this.setCurrentOption(this.currentOption)});let{keyframes:e,options:t}=Ue(this,"select.show",{dir:this.localize.dir()});await qe(this.popup.popup,e,t),this.currentOption&&To(this.currentOption,this.listbox,"vertical","auto"),this.emit("sl-after-show")}else{this.emit("sl-hide"),this.removeOpenListeners(),await tt(this);let{keyframes:e,options:t}=Ue(this,"select.hide",{dir:this.localize.dir()});await qe(this.popup.popup,e,t),this.listbox.hidden=!0,this.popup.active=!1,this.emit("sl-after-hide")}}async show(){if(this.open||this.disabled){this.open=!1;return}return this.open=!0,ht(this,"sl-after-show")}async hide(){if(!this.open||this.disabled){this.open=!1;return}return this.open=!1,ht(this,"sl-after-hide")}checkValidity(){return this.valueInput.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return this.valueInput.reportValidity()}setCustomValidity(e){this.valueInput.setCustomValidity(e),this.formControlController.updateValidity()}focus(e){this.displayInput.focus(e)}blur(){this.displayInput.blur()}render(){let e=this.hasSlotController.test("label"),t=this.hasSlotController.test("help-text"),s=this.label?!0:!!e,i=this.helpText?!0:!!t,r=this.clearable&&!this.disabled&&this.value.length>0,o=this.placeholder&&this.value&&this.value.length<=0;return u`
3197
3201
  <div
3198
3202
  part="form-control"
3199
3203
  class=${se({"form-control":!0,"form-control--small":this.size==="small","form-control--medium":this.size==="medium","form-control--large":this.size==="large","form-control--has-label":s,"form-control--has-help-text":i})}
@@ -4458,7 +4462,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
4458
4462
  :host([data-sl-button-group__button][checked]) {
4459
4463
  z-index: 2;
4460
4464
  }
4461
- `;var de=class extends J{constructor(){super(...arguments),this.formControlController=new ds(this,{assumeInteractionOn:["click"]}),this.hasSlotController=new vt(this,"[default]","prefix","suffix"),this.localize=new me(this),this.hasFocus=!1,this.invalid=!1,this.title="",this.variant="default",this.size="medium",this.caret=!1,this.disabled=!1,this.loading=!1,this.outline=!1,this.pill=!1,this.circle=!1,this.type="button",this.name="",this.value="",this.href="",this.rel="noreferrer noopener"}get validity(){return this.isButton()?this.button.validity:Sa}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleClick(){this.type==="submit"&&this.formControlController.submit(this),this.type==="reset"&&this.formControlController.reset(this)}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}checkValidity(){return this.isButton()?this.button.checkValidity():!0}getForm(){return this.formControlController.getForm()}reportValidity(){return this.isButton()?this.button.reportValidity():!0}setCustomValidity(e){this.isButton()&&(this.button.setCustomValidity(e),this.formControlController.updateValidity())}render(){let e=this.isLink(),t=e?br`a`:br`button`;return yr`
4465
+ `;var de=class extends J{constructor(){super(...arguments),this.formControlController=new ds(this,{assumeInteractionOn:["click"]}),this.hasSlotController=new vt(this,"[default]","prefix","suffix"),this.localize=new me(this),this.hasFocus=!1,this.invalid=!1,this.title="",this.variant="default",this.size="medium",this.caret=!1,this.disabled=!1,this.loading=!1,this.outline=!1,this.pill=!1,this.circle=!1,this.type="button",this.name="",this.value="",this.href="",this.rel="noreferrer noopener"}get validity(){return this.isButton()?this.button.validity:ba}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.hasFocus=!1,this.emit("sl-blur")}handleFocus(){this.hasFocus=!0,this.emit("sl-focus")}handleClick(){this.type==="submit"&&this.formControlController.submit(this),this.type==="reset"&&this.formControlController.reset(this)}handleInvalid(e){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(e)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(e){this.button.focus(e)}blur(){this.button.blur()}checkValidity(){return this.isButton()?this.button.checkValidity():!0}getForm(){return this.formControlController.getForm()}reportValidity(){return this.isButton()?this.button.reportValidity():!0}setCustomValidity(e){this.isButton()&&(this.button.setCustomValidity(e),this.formControlController.updateValidity())}render(){let e=this.isLink(),t=e?br`a`:br`button`;return yr`
4462
4466
  <${t}
4463
4467
  part="base"
4464
4468
  class=${se({button:!0,"button--default":this.variant==="default","button--primary":this.variant==="primary","button--success":this.variant==="success","button--neutral":this.variant==="neutral","button--warning":this.variant==="warning","button--danger":this.variant==="danger","button--text":this.variant==="text","button--small":this.size==="small","button--medium":this.size==="medium","button--large":this.size==="large","button--caret":this.caret,"button--circle":this.circle,"button--disabled":this.disabled,"button--focused":this.hasFocus,"button--loading":this.loading,"button--standard":!this.outline,"button--outline":this.outline,"button--pill":this.pill,"button--rtl":this.localize.dir()==="rtl","button--has-label":this.hasSlotController.test("[default]"),"button--has-prefix":this.hasSlotController.test("prefix"),"button--has-suffix":this.hasSlotController.test("suffix")})}
@@ -4601,7 +4605,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
4601
4605
  border-left: solid var(--width) var(--color);
4602
4606
  margin: 0 var(--spacing);
4603
4607
  }
4604
- `;var No=class extends J{constructor(){super(...arguments),this.vertical=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","separator")}handleVerticalChange(){this.setAttribute("aria-orientation",this.vertical?"vertical":"horizontal")}};No.styles=[te,cg];g([b({type:Boolean,reflect:!0})],No.prototype,"vertical",2);g([Y("vertical")],No.prototype,"handleVerticalChange",1);No.define("sl-divider");var hg=G`
4608
+ `;var zo=class extends J{constructor(){super(...arguments),this.vertical=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","separator")}handleVerticalChange(){this.setAttribute("aria-orientation",this.vertical?"vertical":"horizontal")}};zo.styles=[te,cg];g([b({type:Boolean,reflect:!0})],zo.prototype,"vertical",2);g([Y("vertical")],zo.prototype,"handleVerticalChange",1);zo.define("sl-divider");var hg=G`
4605
4609
  :host {
4606
4610
  --max-width: 20rem;
4607
4611
  --hide-delay: 0ms;
@@ -4678,7 +4682,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
4678
4682
  <slot name="content">${this.content}</slot>
4679
4683
  </div>
4680
4684
  </sl-popup>
4681
- `}};Ke.styles=[te,hg];Ke.dependencies={"sl-popup":pe};g([Q("slot:not([name])")],Ke.prototype,"defaultSlot",2);g([Q(".tooltip__body")],Ke.prototype,"body",2);g([Q("sl-popup")],Ke.prototype,"popup",2);g([b()],Ke.prototype,"content",2);g([b()],Ke.prototype,"placement",2);g([b({type:Boolean,reflect:!0})],Ke.prototype,"disabled",2);g([b({type:Number})],Ke.prototype,"distance",2);g([b({type:Boolean,reflect:!0})],Ke.prototype,"open",2);g([b({type:Number})],Ke.prototype,"skidding",2);g([b()],Ke.prototype,"trigger",2);g([b({type:Boolean})],Ke.prototype,"hoist",2);g([Y("open",{waitUntilFirstUpdate:!0})],Ke.prototype,"handleOpenChange",1);g([Y(["content","distance","hoist","placement","skidding"])],Ke.prototype,"handleOptionsChange",1);g([Y("disabled")],Ke.prototype,"handleDisabledChange",1);Ve("tooltip.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:150,easing:"ease"}});Ve("tooltip.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:150,easing:"ease"}});Ke.define("sl-tooltip");function*Ca(e=document.activeElement){e!=null&&(yield e,"shadowRoot"in e&&e.shadowRoot&&e.shadowRoot.mode!=="closed"&&(yield*Qf(Ca(e.shadowRoot.activeElement))))}function ug(){return[...Ca()].pop()}var dg=new WeakMap;function pg(e){let t=dg.get(e);return t||(t=window.getComputedStyle(e,null),dg.set(e,t)),t}function xS(e){if(typeof e.checkVisibility=="function")return e.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0});let t=pg(e);return t.visibility!=="hidden"&&t.display!=="none"}function kS(e){let t=pg(e),{overflowY:s,overflowX:i}=t;return s==="scroll"||i==="scroll"?!0:s!=="auto"||i!=="auto"?!1:e.scrollHeight>e.clientHeight&&s==="auto"||e.scrollWidth>e.clientWidth&&i==="auto"}function $S(e){let t=e.tagName.toLowerCase(),s=Number(e.getAttribute("tabindex"));if(e.hasAttribute("tabindex")&&(isNaN(s)||s<=-1)||e.hasAttribute("disabled")||e.closest("[inert]"))return!1;if(t==="input"&&e.getAttribute("type")==="radio"){let o=e.getRootNode(),n=`input[type='radio'][name="${e.getAttribute("name")}"]`,a=o.querySelector(`${n}:checked`);return a?a===e:o.querySelector(n)===e}return xS(e)?(t==="audio"||t==="video")&&e.hasAttribute("controls")||e.hasAttribute("tabindex")||e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"||["button","input","select","textarea","a","audio","video","summary","iframe"].includes(t)?!0:kS(e):!1}function ES(e,t){var s;return((s=e.getRootNode({composed:!0}))==null?void 0:s.host)!==t}function Sh(e){let t=new WeakMap,s=[];function i(r){if(r instanceof Element){if(r.hasAttribute("inert")||r.closest("[inert]")||t.has(r))return;t.set(r,!0),!s.includes(r)&&$S(r)&&s.push(r),r instanceof HTMLSlotElement&&ES(r,e)&&r.assignedElements({flatten:!0}).forEach(o=>{i(o)}),r.shadowRoot!==null&&r.shadowRoot.mode==="open"&&i(r.shadowRoot)}for(let o of r.children)i(o)}return i(e),s.sort((r,o)=>{let n=Number(r.getAttribute("tabindex"))||0;return(Number(o.getAttribute("tabindex"))||0)-n})}var Fo=[],fg=class{constructor(e){this.tabDirection="forward",this.handleFocusIn=()=>{this.isActive()&&this.checkFocus()},this.handleKeyDown=t=>{var s;if(t.key!=="Tab"||this.isExternalActivated||!this.isActive())return;let i=ug();if(this.previousFocus=i,this.previousFocus&&this.possiblyHasTabbableChildren(this.previousFocus))return;t.shiftKey?this.tabDirection="backward":this.tabDirection="forward";let r=Sh(this.element),o=r.findIndex(a=>a===i);this.previousFocus=this.currentFocus;let n=this.tabDirection==="forward"?1:-1;for(;;){o+n>=r.length?o=0:o+n<0?o=r.length-1:o+=n,this.previousFocus=this.currentFocus;let a=r[o];if(this.tabDirection==="backward"&&this.previousFocus&&this.possiblyHasTabbableChildren(this.previousFocus)||a&&this.possiblyHasTabbableChildren(a))return;t.preventDefault(),this.currentFocus=a,(s=this.currentFocus)==null||s.focus({preventScroll:!1});let c=[...Ca()];if(c.includes(this.currentFocus)||!c.includes(this.previousFocus))break}setTimeout(()=>this.checkFocus())},this.handleKeyUp=()=>{this.tabDirection="forward"},this.element=e,this.elementsWithTabbableControls=["iframe"]}activate(){Fo.push(this.element),document.addEventListener("focusin",this.handleFocusIn),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}deactivate(){Fo=Fo.filter(e=>e!==this.element),this.currentFocus=null,document.removeEventListener("focusin",this.handleFocusIn),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)}isActive(){return Fo[Fo.length-1]===this.element}activateExternal(){this.isExternalActivated=!0}deactivateExternal(){this.isExternalActivated=!1}checkFocus(){if(this.isActive()&&!this.isExternalActivated){let e=Sh(this.element);if(!this.element.matches(":focus-within")){let t=e[0],s=e[e.length-1],i=this.tabDirection==="forward"?t:s;typeof i?.focus=="function"&&(this.currentFocus=i,i.focus({preventScroll:!1}))}}}possiblyHasTabbableChildren(e){return this.elementsWithTabbableControls.includes(e.tagName.toLowerCase())||e.hasAttribute("controls")}};var mg=G`
4685
+ `}};Ke.styles=[te,hg];Ke.dependencies={"sl-popup":pe};g([Q("slot:not([name])")],Ke.prototype,"defaultSlot",2);g([Q(".tooltip__body")],Ke.prototype,"body",2);g([Q("sl-popup")],Ke.prototype,"popup",2);g([b()],Ke.prototype,"content",2);g([b()],Ke.prototype,"placement",2);g([b({type:Boolean,reflect:!0})],Ke.prototype,"disabled",2);g([b({type:Number})],Ke.prototype,"distance",2);g([b({type:Boolean,reflect:!0})],Ke.prototype,"open",2);g([b({type:Number})],Ke.prototype,"skidding",2);g([b()],Ke.prototype,"trigger",2);g([b({type:Boolean})],Ke.prototype,"hoist",2);g([Y("open",{waitUntilFirstUpdate:!0})],Ke.prototype,"handleOpenChange",1);g([Y(["content","distance","hoist","placement","skidding"])],Ke.prototype,"handleOptionsChange",1);g([Y("disabled")],Ke.prototype,"handleDisabledChange",1);Ve("tooltip.show",{keyframes:[{opacity:0,scale:.8},{opacity:1,scale:1}],options:{duration:150,easing:"ease"}});Ve("tooltip.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.8}],options:{duration:150,easing:"ease"}});Ke.define("sl-tooltip");function*ya(e=document.activeElement){e!=null&&(yield e,"shadowRoot"in e&&e.shadowRoot&&e.shadowRoot.mode!=="closed"&&(yield*Qf(ya(e.shadowRoot.activeElement))))}function ug(){return[...ya()].pop()}var dg=new WeakMap;function pg(e){let t=dg.get(e);return t||(t=window.getComputedStyle(e,null),dg.set(e,t)),t}function xS(e){if(typeof e.checkVisibility=="function")return e.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0});let t=pg(e);return t.visibility!=="hidden"&&t.display!=="none"}function kS(e){let t=pg(e),{overflowY:s,overflowX:i}=t;return s==="scroll"||i==="scroll"?!0:s!=="auto"||i!=="auto"?!1:e.scrollHeight>e.clientHeight&&s==="auto"||e.scrollWidth>e.clientWidth&&i==="auto"}function $S(e){let t=e.tagName.toLowerCase(),s=Number(e.getAttribute("tabindex"));if(e.hasAttribute("tabindex")&&(isNaN(s)||s<=-1)||e.hasAttribute("disabled")||e.closest("[inert]"))return!1;if(t==="input"&&e.getAttribute("type")==="radio"){let o=e.getRootNode(),n=`input[type='radio'][name="${e.getAttribute("name")}"]`,a=o.querySelector(`${n}:checked`);return a?a===e:o.querySelector(n)===e}return xS(e)?(t==="audio"||t==="video")&&e.hasAttribute("controls")||e.hasAttribute("tabindex")||e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"||["button","input","select","textarea","a","audio","video","summary","iframe"].includes(t)?!0:kS(e):!1}function ES(e,t){var s;return((s=e.getRootNode({composed:!0}))==null?void 0:s.host)!==t}function Sh(e){let t=new WeakMap,s=[];function i(r){if(r instanceof Element){if(r.hasAttribute("inert")||r.closest("[inert]")||t.has(r))return;t.set(r,!0),!s.includes(r)&&$S(r)&&s.push(r),r instanceof HTMLSlotElement&&ES(r,e)&&r.assignedElements({flatten:!0}).forEach(o=>{i(o)}),r.shadowRoot!==null&&r.shadowRoot.mode==="open"&&i(r.shadowRoot)}for(let o of r.children)i(o)}return i(e),s.sort((r,o)=>{let n=Number(r.getAttribute("tabindex"))||0;return(Number(o.getAttribute("tabindex"))||0)-n})}var No=[],fg=class{constructor(e){this.tabDirection="forward",this.handleFocusIn=()=>{this.isActive()&&this.checkFocus()},this.handleKeyDown=t=>{var s;if(t.key!=="Tab"||this.isExternalActivated||!this.isActive())return;let i=ug();if(this.previousFocus=i,this.previousFocus&&this.possiblyHasTabbableChildren(this.previousFocus))return;t.shiftKey?this.tabDirection="backward":this.tabDirection="forward";let r=Sh(this.element),o=r.findIndex(a=>a===i);this.previousFocus=this.currentFocus;let n=this.tabDirection==="forward"?1:-1;for(;;){o+n>=r.length?o=0:o+n<0?o=r.length-1:o+=n,this.previousFocus=this.currentFocus;let a=r[o];if(this.tabDirection==="backward"&&this.previousFocus&&this.possiblyHasTabbableChildren(this.previousFocus)||a&&this.possiblyHasTabbableChildren(a))return;t.preventDefault(),this.currentFocus=a,(s=this.currentFocus)==null||s.focus({preventScroll:!1});let c=[...ya()];if(c.includes(this.currentFocus)||!c.includes(this.previousFocus))break}setTimeout(()=>this.checkFocus())},this.handleKeyUp=()=>{this.tabDirection="forward"},this.element=e,this.elementsWithTabbableControls=["iframe"]}activate(){No.push(this.element),document.addEventListener("focusin",this.handleFocusIn),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}deactivate(){No=No.filter(e=>e!==this.element),this.currentFocus=null,document.removeEventListener("focusin",this.handleFocusIn),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)}isActive(){return No[No.length-1]===this.element}activateExternal(){this.isExternalActivated=!0}deactivateExternal(){this.isExternalActivated=!1}checkFocus(){if(this.isActive()&&!this.isExternalActivated){let e=Sh(this.element);if(!this.element.matches(":focus-within")){let t=e[0],s=e[e.length-1],i=this.tabDirection==="forward"?t:s;typeof i?.focus=="function"&&(this.currentFocus=i,i.focus({preventScroll:!1}))}}}possiblyHasTabbableChildren(e){return this.elementsWithTabbableControls.includes(e.tagName.toLowerCase())||e.hasAttribute("controls")}};var mg=G`
4682
4686
  :host {
4683
4687
  --width: 31rem;
4684
4688
  --header-spacing: var(--sl-spacing-large);
@@ -4795,7 +4799,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
4795
4799
  border: solid 1px var(--sl-color-neutral-0);
4796
4800
  }
4797
4801
  }
4798
- `;var xa=e=>{var t;let{activeElement:s}=document;s&&e.contains(s)&&((t=document.activeElement)==null||t.blur())};var Xt=class extends J{constructor(){super(...arguments),this.hasSlotController=new vt(this,"footer"),this.localize=new me(this),this.modal=new fg(this),this.open=!1,this.label="",this.noHeader=!1,this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.modal.isActive()&&this.open&&(e.stopPropagation(),this.requestClose("keyboard"))}}firstUpdated(){this.dialog.hidden=!this.open,this.open&&(this.addOpenListeners(),this.modal.activate(),dh(this))}disconnectedCallback(){super.disconnectedCallback(),this.modal.deactivate(),uh(this),this.removeOpenListeners()}requestClose(e){if(this.emit("sl-request-close",{cancelable:!0,detail:{source:e}}).defaultPrevented){let s=Ue(this,"dialog.denyClose",{dir:this.localize.dir()});qe(this.panel,s.keyframes,s.options);return}this.hide()}addOpenListeners(){var e;"CloseWatcher"in window?((e=this.closeWatcher)==null||e.destroy(),this.closeWatcher=new CloseWatcher,this.closeWatcher.onclose=()=>this.requestClose("keyboard")):document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){var e;(e=this.closeWatcher)==null||e.destroy(),document.removeEventListener("keydown",this.handleDocumentKeyDown)}async handleOpenChange(){if(this.open){this.emit("sl-show"),this.addOpenListeners(),this.originalTrigger=document.activeElement,this.modal.activate(),dh(this);let e=this.querySelector("[autofocus]");e&&e.removeAttribute("autofocus"),await Promise.all([tt(this.dialog),tt(this.overlay)]),this.dialog.hidden=!1,requestAnimationFrame(()=>{this.emit("sl-initial-focus",{cancelable:!0}).defaultPrevented||(e?e.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),e&&e.setAttribute("autofocus","")});let t=Ue(this,"dialog.show",{dir:this.localize.dir()}),s=Ue(this,"dialog.overlay.show",{dir:this.localize.dir()});await Promise.all([qe(this.panel,t.keyframes,t.options),qe(this.overlay,s.keyframes,s.options)]),this.emit("sl-after-show")}else{xa(this),this.emit("sl-hide"),this.removeOpenListeners(),this.modal.deactivate(),await Promise.all([tt(this.dialog),tt(this.overlay)]);let e=Ue(this,"dialog.hide",{dir:this.localize.dir()}),t=Ue(this,"dialog.overlay.hide",{dir:this.localize.dir()});await Promise.all([qe(this.overlay,t.keyframes,t.options).then(()=>{this.overlay.hidden=!0}),qe(this.panel,e.keyframes,e.options).then(()=>{this.panel.hidden=!0})]),this.dialog.hidden=!0,this.overlay.hidden=!1,this.panel.hidden=!1,uh(this);let s=this.originalTrigger;typeof s?.focus=="function"&&setTimeout(()=>s.focus()),this.emit("sl-after-hide")}}async show(){if(!this.open)return this.open=!0,ht(this,"sl-after-show")}async hide(){if(this.open)return this.open=!1,ht(this,"sl-after-hide")}render(){return u`
4802
+ `;var wa=e=>{var t;let{activeElement:s}=document;s&&e.contains(s)&&((t=document.activeElement)==null||t.blur())};var Xt=class extends J{constructor(){super(...arguments),this.hasSlotController=new vt(this,"footer"),this.localize=new me(this),this.modal=new fg(this),this.open=!1,this.label="",this.noHeader=!1,this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.modal.isActive()&&this.open&&(e.stopPropagation(),this.requestClose("keyboard"))}}firstUpdated(){this.dialog.hidden=!this.open,this.open&&(this.addOpenListeners(),this.modal.activate(),dh(this))}disconnectedCallback(){super.disconnectedCallback(),this.modal.deactivate(),uh(this),this.removeOpenListeners()}requestClose(e){if(this.emit("sl-request-close",{cancelable:!0,detail:{source:e}}).defaultPrevented){let s=Ue(this,"dialog.denyClose",{dir:this.localize.dir()});qe(this.panel,s.keyframes,s.options);return}this.hide()}addOpenListeners(){var e;"CloseWatcher"in window?((e=this.closeWatcher)==null||e.destroy(),this.closeWatcher=new CloseWatcher,this.closeWatcher.onclose=()=>this.requestClose("keyboard")):document.addEventListener("keydown",this.handleDocumentKeyDown)}removeOpenListeners(){var e;(e=this.closeWatcher)==null||e.destroy(),document.removeEventListener("keydown",this.handleDocumentKeyDown)}async handleOpenChange(){if(this.open){this.emit("sl-show"),this.addOpenListeners(),this.originalTrigger=document.activeElement,this.modal.activate(),dh(this);let e=this.querySelector("[autofocus]");e&&e.removeAttribute("autofocus"),await Promise.all([tt(this.dialog),tt(this.overlay)]),this.dialog.hidden=!1,requestAnimationFrame(()=>{this.emit("sl-initial-focus",{cancelable:!0}).defaultPrevented||(e?e.focus({preventScroll:!0}):this.panel.focus({preventScroll:!0})),e&&e.setAttribute("autofocus","")});let t=Ue(this,"dialog.show",{dir:this.localize.dir()}),s=Ue(this,"dialog.overlay.show",{dir:this.localize.dir()});await Promise.all([qe(this.panel,t.keyframes,t.options),qe(this.overlay,s.keyframes,s.options)]),this.emit("sl-after-show")}else{wa(this),this.emit("sl-hide"),this.removeOpenListeners(),this.modal.deactivate(),await Promise.all([tt(this.dialog),tt(this.overlay)]);let e=Ue(this,"dialog.hide",{dir:this.localize.dir()}),t=Ue(this,"dialog.overlay.hide",{dir:this.localize.dir()});await Promise.all([qe(this.overlay,t.keyframes,t.options).then(()=>{this.overlay.hidden=!0}),qe(this.panel,e.keyframes,e.options).then(()=>{this.panel.hidden=!0})]),this.dialog.hidden=!0,this.overlay.hidden=!1,this.panel.hidden=!1,uh(this);let s=this.originalTrigger;typeof s?.focus=="function"&&setTimeout(()=>s.focus()),this.emit("sl-after-hide")}}async show(){if(!this.open)return this.open=!0,ht(this,"sl-after-show")}async hide(){if(this.open)return this.open=!1,ht(this,"sl-after-hide")}render(){return u`
4799
4803
  <div
4800
4804
  part="base"
4801
4805
  class=${se({dialog:!0,"dialog--open":this.open,"dialog--has-footer":this.hasSlotController.test("footer")})}
@@ -5077,7 +5081,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5077
5081
  :host {
5078
5082
  display: contents;
5079
5083
  }
5080
- `;var Ho=class extends J{constructor(){super(...arguments),this.observedElements=[],this.disabled=!1}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(e=>{this.emit("sl-resize",{detail:{entries:e}})}),this.disabled||this.startObserver()}disconnectedCallback(){super.disconnectedCallback(),this.stopObserver()}handleSlotChange(){this.disabled||this.startObserver()}startObserver(){let e=this.shadowRoot.querySelector("slot");if(e!==null){let t=e.assignedElements({flatten:!0});this.observedElements.forEach(s=>this.resizeObserver.unobserve(s)),this.observedElements=[],t.forEach(s=>{this.resizeObserver.observe(s),this.observedElements.push(s)})}}stopObserver(){this.resizeObserver.disconnect()}handleDisabledChange(){this.disabled?this.stopObserver():this.startObserver()}render(){return u` <slot @slotchange=${this.handleSlotChange}></slot> `}};Ho.styles=[te,_g];g([b({type:Boolean,reflect:!0})],Ho.prototype,"disabled",2);g([Y("disabled",{waitUntilFirstUpdate:!0})],Ho.prototype,"handleDisabledChange",1);var Ge=class extends J{constructor(){super(...arguments),this.tabs=[],this.focusableTabs=[],this.panels=[],this.localize=new me(this),this.hasScrollControls=!1,this.shouldHideScrollStartButton=!1,this.shouldHideScrollEndButton=!1,this.placement="top",this.activation="auto",this.noScrollControls=!1,this.fixedScrollControls=!1,this.scrollOffset=1}connectedCallback(){let e=Promise.all([customElements.whenDefined("sl-tab"),customElements.whenDefined("sl-tab-panel")]);super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>{this.repositionIndicator(),this.updateScrollControls()}),this.mutationObserver=new MutationObserver(t=>{let s=t.filter(({target:i})=>{if(i===this)return!0;if(i.closest("sl-tab-group")!==this)return!1;let r=i.tagName.toLowerCase();return r==="sl-tab"||r==="sl-tab-panel"});if(s.length!==0){if(s.some(i=>!["aria-labelledby","aria-controls"].includes(i.attributeName))&&setTimeout(()=>this.setAriaLabels()),s.some(i=>i.attributeName==="disabled"))this.syncTabsAndPanels();else if(s.some(i=>i.attributeName==="active")){let r=s.filter(o=>o.attributeName==="active"&&o.target.tagName.toLowerCase()==="sl-tab").map(o=>o.target).find(o=>o.active);r&&this.setActiveTab(r)}}}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,attributeFilter:["active","disabled","name","panel"],childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav),e.then(()=>{new IntersectionObserver((s,i)=>{var r;s[0].intersectionRatio>0&&(this.setAriaLabels(),this.setActiveTab((r=this.getActiveTab())!=null?r:this.tabs[0],{emitEvents:!1}),i.unobserve(s[0].target))}).observe(this.tabGroup)})})}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=this.mutationObserver)==null||e.disconnect(),this.nav&&((t=this.resizeObserver)==null||t.unobserve(this.nav))}getAllTabs(){return this.shadowRoot.querySelector('slot[name="nav"]').assignedElements()}getAllPanels(){return[...this.body.assignedElements()].filter(e=>e.tagName.toLowerCase()==="sl-tab-panel")}getActiveTab(){return this.tabs.find(e=>e.active)}handleClick(e){let s=e.target.closest("sl-tab");s?.closest("sl-tab-group")===this&&s!==null&&this.setActiveTab(s,{scrollBehavior:"smooth"})}handleKeyDown(e){let s=e.target.closest("sl-tab");if(s?.closest("sl-tab-group")===this&&(["Enter"," "].includes(e.key)&&s!==null&&(this.setActiveTab(s,{scrollBehavior:"smooth"}),e.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))){let r=this.tabs.find(a=>a.matches(":focus")),o=this.localize.dir()==="rtl",n=null;if(r?.tagName.toLowerCase()==="sl-tab"){if(e.key==="Home")n=this.focusableTabs[0];else if(e.key==="End")n=this.focusableTabs[this.focusableTabs.length-1];else if(["top","bottom"].includes(this.placement)&&e.key===(o?"ArrowRight":"ArrowLeft")||["start","end"].includes(this.placement)&&e.key==="ArrowUp"){let a=this.tabs.findIndex(c=>c===r);n=this.findNextFocusableTab(a,"backward")}else if(["top","bottom"].includes(this.placement)&&e.key===(o?"ArrowLeft":"ArrowRight")||["start","end"].includes(this.placement)&&e.key==="ArrowDown"){let a=this.tabs.findIndex(c=>c===r);n=this.findNextFocusableTab(a,"forward")}if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0}),this.activation==="auto"?this.setActiveTab(n,{scrollBehavior:"smooth"}):this.tabs.forEach(a=>{a.tabIndex=a===n?0:-1}),["top","bottom"].includes(this.placement)&&Ao(n,this.nav,"horizontal"),e.preventDefault()}}}handleScrollToStart(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(e,t){if(t=nt({emitEvents:!0,scrollBehavior:"auto"},t),e!==this.activeTab&&!e.disabled){let s=this.activeTab;this.activeTab=e,this.tabs.forEach(i=>{i.active=i===this.activeTab,i.tabIndex=i===this.activeTab?0:-1}),this.panels.forEach(i=>{var r;return i.active=i.name===((r=this.activeTab)==null?void 0:r.panel)}),this.syncIndicator(),["top","bottom"].includes(this.placement)&&Ao(this.activeTab,this.nav,"horizontal",t.scrollBehavior),t.emitEvents&&(s&&this.emit("sl-tab-hide",{detail:{name:s.panel}}),this.emit("sl-tab-show",{detail:{name:this.activeTab.panel}}))}}setAriaLabels(){this.tabs.forEach(e=>{let t=this.panels.find(s=>s.name===e.panel);t&&(e.setAttribute("aria-controls",t.getAttribute("id")),t.setAttribute("aria-labelledby",e.getAttribute("id")))})}repositionIndicator(){let e=this.getActiveTab();if(!e)return;let t=e.clientWidth,s=e.clientHeight,i=this.localize.dir()==="rtl",r=this.getAllTabs(),n=r.slice(0,r.indexOf(e)).reduce((a,c)=>({left:a.left+c.clientWidth,top:a.top+c.clientHeight}),{left:0,top:0});switch(this.placement){case"top":case"bottom":this.indicator.style.width=`${t}px`,this.indicator.style.height="auto",this.indicator.style.translate=i?`${-1*n.left}px`:`${n.left}px`;break;case"start":case"end":this.indicator.style.width="auto",this.indicator.style.height=`${s}px`,this.indicator.style.translate=`0 ${n.top}px`;break}}syncTabsAndPanels(){this.tabs=this.getAllTabs(),this.focusableTabs=this.tabs.filter(e=>!e.disabled),this.panels=this.getAllPanels(),this.syncIndicator(),this.updateComplete.then(()=>this.updateScrollControls())}findNextFocusableTab(e,t){let s=null,i=t==="forward"?1:-1,r=e+i;for(;e<this.tabs.length;){if(s=this.tabs[r]||null,s===null){t==="forward"?s=this.focusableTabs[0]:s=this.focusableTabs[this.focusableTabs.length-1];break}if(!s.disabled)break;r+=i}return s}updateScrollButtons(){this.hasScrollControls&&!this.fixedScrollControls&&(this.shouldHideScrollStartButton=this.scrollFromStart()<=this.scrollOffset,this.shouldHideScrollEndButton=this.isScrolledToEnd())}isScrolledToEnd(){return this.scrollFromStart()+this.nav.clientWidth>=this.nav.scrollWidth-this.scrollOffset}scrollFromStart(){return this.localize.dir()==="rtl"?-this.nav.scrollLeft:this.nav.scrollLeft}updateScrollControls(){this.noScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth+1,this.updateScrollButtons()}syncIndicator(){this.getActiveTab()?(this.indicator.style.display="block",this.repositionIndicator()):this.indicator.style.display="none"}show(e){let t=this.tabs.find(s=>s.panel===e);t&&this.setActiveTab(t,{scrollBehavior:"smooth"})}render(){let e=this.localize.dir()==="rtl";return u`
5084
+ `;var Fo=class extends J{constructor(){super(...arguments),this.observedElements=[],this.disabled=!1}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(e=>{this.emit("sl-resize",{detail:{entries:e}})}),this.disabled||this.startObserver()}disconnectedCallback(){super.disconnectedCallback(),this.stopObserver()}handleSlotChange(){this.disabled||this.startObserver()}startObserver(){let e=this.shadowRoot.querySelector("slot");if(e!==null){let t=e.assignedElements({flatten:!0});this.observedElements.forEach(s=>this.resizeObserver.unobserve(s)),this.observedElements=[],t.forEach(s=>{this.resizeObserver.observe(s),this.observedElements.push(s)})}}stopObserver(){this.resizeObserver.disconnect()}handleDisabledChange(){this.disabled?this.stopObserver():this.startObserver()}render(){return u` <slot @slotchange=${this.handleSlotChange}></slot> `}};Fo.styles=[te,_g];g([b({type:Boolean,reflect:!0})],Fo.prototype,"disabled",2);g([Y("disabled",{waitUntilFirstUpdate:!0})],Fo.prototype,"handleDisabledChange",1);var Ge=class extends J{constructor(){super(...arguments),this.tabs=[],this.focusableTabs=[],this.panels=[],this.localize=new me(this),this.hasScrollControls=!1,this.shouldHideScrollStartButton=!1,this.shouldHideScrollEndButton=!1,this.placement="top",this.activation="auto",this.noScrollControls=!1,this.fixedScrollControls=!1,this.scrollOffset=1}connectedCallback(){let e=Promise.all([customElements.whenDefined("sl-tab"),customElements.whenDefined("sl-tab-panel")]);super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>{this.repositionIndicator(),this.updateScrollControls()}),this.mutationObserver=new MutationObserver(t=>{let s=t.filter(({target:i})=>{if(i===this)return!0;if(i.closest("sl-tab-group")!==this)return!1;let r=i.tagName.toLowerCase();return r==="sl-tab"||r==="sl-tab-panel"});if(s.length!==0){if(s.some(i=>!["aria-labelledby","aria-controls"].includes(i.attributeName))&&setTimeout(()=>this.setAriaLabels()),s.some(i=>i.attributeName==="disabled"))this.syncTabsAndPanels();else if(s.some(i=>i.attributeName==="active")){let r=s.filter(o=>o.attributeName==="active"&&o.target.tagName.toLowerCase()==="sl-tab").map(o=>o.target).find(o=>o.active);r&&this.setActiveTab(r)}}}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,attributeFilter:["active","disabled","name","panel"],childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav),e.then(()=>{new IntersectionObserver((s,i)=>{var r;s[0].intersectionRatio>0&&(this.setAriaLabels(),this.setActiveTab((r=this.getActiveTab())!=null?r:this.tabs[0],{emitEvents:!1}),i.unobserve(s[0].target))}).observe(this.tabGroup)})})}disconnectedCallback(){var e,t;super.disconnectedCallback(),(e=this.mutationObserver)==null||e.disconnect(),this.nav&&((t=this.resizeObserver)==null||t.unobserve(this.nav))}getAllTabs(){return this.shadowRoot.querySelector('slot[name="nav"]').assignedElements()}getAllPanels(){return[...this.body.assignedElements()].filter(e=>e.tagName.toLowerCase()==="sl-tab-panel")}getActiveTab(){return this.tabs.find(e=>e.active)}handleClick(e){let s=e.target.closest("sl-tab");s?.closest("sl-tab-group")===this&&s!==null&&this.setActiveTab(s,{scrollBehavior:"smooth"})}handleKeyDown(e){let s=e.target.closest("sl-tab");if(s?.closest("sl-tab-group")===this&&(["Enter"," "].includes(e.key)&&s!==null&&(this.setActiveTab(s,{scrollBehavior:"smooth"}),e.preventDefault()),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))){let r=this.tabs.find(a=>a.matches(":focus")),o=this.localize.dir()==="rtl",n=null;if(r?.tagName.toLowerCase()==="sl-tab"){if(e.key==="Home")n=this.focusableTabs[0];else if(e.key==="End")n=this.focusableTabs[this.focusableTabs.length-1];else if(["top","bottom"].includes(this.placement)&&e.key===(o?"ArrowRight":"ArrowLeft")||["start","end"].includes(this.placement)&&e.key==="ArrowUp"){let a=this.tabs.findIndex(c=>c===r);n=this.findNextFocusableTab(a,"backward")}else if(["top","bottom"].includes(this.placement)&&e.key===(o?"ArrowLeft":"ArrowRight")||["start","end"].includes(this.placement)&&e.key==="ArrowDown"){let a=this.tabs.findIndex(c=>c===r);n=this.findNextFocusableTab(a,"forward")}if(!n)return;n.tabIndex=0,n.focus({preventScroll:!0}),this.activation==="auto"?this.setActiveTab(n,{scrollBehavior:"smooth"}):this.tabs.forEach(a=>{a.tabIndex=a===n?0:-1}),["top","bottom"].includes(this.placement)&&To(n,this.nav,"horizontal"),e.preventDefault()}}}handleScrollToStart(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.localize.dir()==="rtl"?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(e,t){if(t=nt({emitEvents:!0,scrollBehavior:"auto"},t),e!==this.activeTab&&!e.disabled){let s=this.activeTab;this.activeTab=e,this.tabs.forEach(i=>{i.active=i===this.activeTab,i.tabIndex=i===this.activeTab?0:-1}),this.panels.forEach(i=>{var r;return i.active=i.name===((r=this.activeTab)==null?void 0:r.panel)}),this.syncIndicator(),["top","bottom"].includes(this.placement)&&To(this.activeTab,this.nav,"horizontal",t.scrollBehavior),t.emitEvents&&(s&&this.emit("sl-tab-hide",{detail:{name:s.panel}}),this.emit("sl-tab-show",{detail:{name:this.activeTab.panel}}))}}setAriaLabels(){this.tabs.forEach(e=>{let t=this.panels.find(s=>s.name===e.panel);t&&(e.setAttribute("aria-controls",t.getAttribute("id")),t.setAttribute("aria-labelledby",e.getAttribute("id")))})}repositionIndicator(){let e=this.getActiveTab();if(!e)return;let t=e.clientWidth,s=e.clientHeight,i=this.localize.dir()==="rtl",r=this.getAllTabs(),n=r.slice(0,r.indexOf(e)).reduce((a,c)=>({left:a.left+c.clientWidth,top:a.top+c.clientHeight}),{left:0,top:0});switch(this.placement){case"top":case"bottom":this.indicator.style.width=`${t}px`,this.indicator.style.height="auto",this.indicator.style.translate=i?`${-1*n.left}px`:`${n.left}px`;break;case"start":case"end":this.indicator.style.width="auto",this.indicator.style.height=`${s}px`,this.indicator.style.translate=`0 ${n.top}px`;break}}syncTabsAndPanels(){this.tabs=this.getAllTabs(),this.focusableTabs=this.tabs.filter(e=>!e.disabled),this.panels=this.getAllPanels(),this.syncIndicator(),this.updateComplete.then(()=>this.updateScrollControls())}findNextFocusableTab(e,t){let s=null,i=t==="forward"?1:-1,r=e+i;for(;e<this.tabs.length;){if(s=this.tabs[r]||null,s===null){t==="forward"?s=this.focusableTabs[0]:s=this.focusableTabs[this.focusableTabs.length-1];break}if(!s.disabled)break;r+=i}return s}updateScrollButtons(){this.hasScrollControls&&!this.fixedScrollControls&&(this.shouldHideScrollStartButton=this.scrollFromStart()<=this.scrollOffset,this.shouldHideScrollEndButton=this.isScrolledToEnd())}isScrolledToEnd(){return this.scrollFromStart()+this.nav.clientWidth>=this.nav.scrollWidth-this.scrollOffset}scrollFromStart(){return this.localize.dir()==="rtl"?-this.nav.scrollLeft:this.nav.scrollLeft}updateScrollControls(){this.noScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth+1,this.updateScrollButtons()}syncIndicator(){this.getActiveTab()?(this.indicator.style.display="block",this.repositionIndicator()):this.indicator.style.display="none"}show(e){let t=this.tabs.find(s=>s.panel===e);t&&this.setActiveTab(t,{scrollBehavior:"smooth"})}render(){let e=this.localize.dir()==="rtl";return u`
5081
5085
  <div
5082
5086
  part="base"
5083
5087
  class=${se({"tab-group":!0,"tab-group--top":this.placement==="top","tab-group--bottom":this.placement==="bottom","tab-group--start":this.placement==="start","tab-group--end":this.placement==="end","tab-group--rtl":this.localize.dir()==="rtl","tab-group--has-scroll-controls":this.hasScrollControls})}
@@ -5125,7 +5129,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5125
5129
 
5126
5130
  <slot part="body" class="tab-group__body" @slotchange=${this.syncTabsAndPanels}></slot>
5127
5131
  </div>
5128
- `}};Ge.styles=[te,gg];Ge.dependencies={"sl-icon-button":ke,"sl-resize-observer":Ho};g([Q(".tab-group")],Ge.prototype,"tabGroup",2);g([Q(".tab-group__body")],Ge.prototype,"body",2);g([Q(".tab-group__nav")],Ge.prototype,"nav",2);g([Q(".tab-group__indicator")],Ge.prototype,"indicator",2);g([he()],Ge.prototype,"hasScrollControls",2);g([he()],Ge.prototype,"shouldHideScrollStartButton",2);g([he()],Ge.prototype,"shouldHideScrollEndButton",2);g([b()],Ge.prototype,"placement",2);g([b()],Ge.prototype,"activation",2);g([b({attribute:"no-scroll-controls",type:Boolean})],Ge.prototype,"noScrollControls",2);g([b({attribute:"fixed-scroll-controls",type:Boolean})],Ge.prototype,"fixedScrollControls",2);g([fm({passive:!0})],Ge.prototype,"updateScrollButtons",1);g([Y("noScrollControls",{waitUntilFirstUpdate:!0})],Ge.prototype,"updateScrollControls",1);g([Y("placement",{waitUntilFirstUpdate:!0})],Ge.prototype,"syncIndicator",1);Ge.define("sl-tab-group");var TS=(e,t)=>{let s=0;return function(...i){window.clearTimeout(s),s=window.setTimeout(()=>{e.call(this,...i)},t)}},vg=(e,t,s)=>{let i=e[t];e[t]=function(...r){i.call(this,...r),s.call(this,i,...r)}};(()=>{if(typeof window>"u")return;if(!("onscrollend"in window)){let t=new Set,s=new WeakMap,i=o=>{for(let n of o.changedTouches)t.add(n.identifier)},r=o=>{for(let n of o.changedTouches)t.delete(n.identifier)};document.addEventListener("touchstart",i,!0),document.addEventListener("touchend",r,!0),document.addEventListener("touchcancel",r,!0),vg(EventTarget.prototype,"addEventListener",function(o,n){if(n!=="scrollend")return;let a=TS(()=>{t.size?a():this.dispatchEvent(new Event("scrollend"))},100);o.call(this,"scroll",a,{passive:!0}),s.set(this,a)}),vg(EventTarget.prototype,"removeEventListener",function(o,n){if(n!=="scrollend")return;let a=s.get(this);a&&o.call(this,"scroll",a,{passive:!0})})}})();var bg=G`
5132
+ `}};Ge.styles=[te,gg];Ge.dependencies={"sl-icon-button":ke,"sl-resize-observer":Fo};g([Q(".tab-group")],Ge.prototype,"tabGroup",2);g([Q(".tab-group__body")],Ge.prototype,"body",2);g([Q(".tab-group__nav")],Ge.prototype,"nav",2);g([Q(".tab-group__indicator")],Ge.prototype,"indicator",2);g([he()],Ge.prototype,"hasScrollControls",2);g([he()],Ge.prototype,"shouldHideScrollStartButton",2);g([he()],Ge.prototype,"shouldHideScrollEndButton",2);g([b()],Ge.prototype,"placement",2);g([b()],Ge.prototype,"activation",2);g([b({attribute:"no-scroll-controls",type:Boolean})],Ge.prototype,"noScrollControls",2);g([b({attribute:"fixed-scroll-controls",type:Boolean})],Ge.prototype,"fixedScrollControls",2);g([fm({passive:!0})],Ge.prototype,"updateScrollButtons",1);g([Y("noScrollControls",{waitUntilFirstUpdate:!0})],Ge.prototype,"updateScrollControls",1);g([Y("placement",{waitUntilFirstUpdate:!0})],Ge.prototype,"syncIndicator",1);Ge.define("sl-tab-group");var TS=(e,t)=>{let s=0;return function(...i){window.clearTimeout(s),s=window.setTimeout(()=>{e.call(this,...i)},t)}},vg=(e,t,s)=>{let i=e[t];e[t]=function(...r){i.call(this,...r),s.call(this,i,...r)}};(()=>{if(typeof window>"u")return;if(!("onscrollend"in window)){let t=new Set,s=new WeakMap,i=o=>{for(let n of o.changedTouches)t.add(n.identifier)},r=o=>{for(let n of o.changedTouches)t.delete(n.identifier)};document.addEventListener("touchstart",i,!0),document.addEventListener("touchend",r,!0),document.addEventListener("touchcancel",r,!0),vg(EventTarget.prototype,"addEventListener",function(o,n){if(n!=="scrollend")return;let a=TS(()=>{t.size?a():this.dispatchEvent(new Event("scrollend"))},100);o.call(this,"scroll",a,{passive:!0}),s.set(this,a)}),vg(EventTarget.prototype,"removeEventListener",function(o,n){if(n!=="scrollend")return;let a=s.get(this);a&&o.call(this,"scroll",a,{passive:!0})})}})();var bg=G`
5129
5133
  :host {
5130
5134
  display: inline-block;
5131
5135
  }
@@ -5580,7 +5584,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5580
5584
  .alert__timer {
5581
5585
  display: none;
5582
5586
  }
5583
- `;var Tt=class Hi extends J{constructor(){super(...arguments),this.hasSlotController=new vt(this,"icon","suffix"),this.localize=new me(this),this.open=!1,this.closable=!1,this.variant="primary",this.duration=1/0,this.remainingTime=this.duration}static get toastStack(){return this.currentToastStack||(this.currentToastStack=Object.assign(document.createElement("div"),{className:"sl-toast-stack"})),this.currentToastStack}firstUpdated(){this.base.hidden=!this.open}restartAutoHide(){this.handleCountdownChange(),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval),this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout(()=>this.hide(),this.duration),this.remainingTime=this.duration,this.remainingTimeInterval=window.setInterval(()=>{this.remainingTime-=100},100))}pauseAutoHide(){var t;(t=this.countdownAnimation)==null||t.pause(),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval)}resumeAutoHide(){var t;this.duration<1/0&&(this.autoHideTimeout=window.setTimeout(()=>this.hide(),this.remainingTime),this.remainingTimeInterval=window.setInterval(()=>{this.remainingTime-=100},100),(t=this.countdownAnimation)==null||t.play())}handleCountdownChange(){if(this.open&&this.duration<1/0&&this.countdown){let{countdownElement:t}=this,s="100%",i="0";this.countdownAnimation=t.animate([{width:s},{width:i}],{duration:this.duration,easing:"linear"})}}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sl-show"),this.duration<1/0&&this.restartAutoHide(),await tt(this.base),this.base.hidden=!1;let{keyframes:t,options:s}=Ue(this,"alert.show",{dir:this.localize.dir()});await qe(this.base,t,s),this.emit("sl-after-show")}else{xa(this),this.emit("sl-hide"),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval),await tt(this.base);let{keyframes:t,options:s}=Ue(this,"alert.hide",{dir:this.localize.dir()});await qe(this.base,t,s),this.base.hidden=!0,this.emit("sl-after-hide")}}handleDurationChange(){this.restartAutoHide()}async show(){if(!this.open)return this.open=!0,ht(this,"sl-after-show")}async hide(){if(this.open)return this.open=!1,ht(this,"sl-after-hide")}async toast(){return new Promise(t=>{this.handleCountdownChange(),Hi.toastStack.parentElement===null&&document.body.append(Hi.toastStack),Hi.toastStack.appendChild(this),requestAnimationFrame(()=>{this.clientWidth,this.show()}),this.addEventListener("sl-after-hide",()=>{Hi.toastStack.removeChild(this),t(),Hi.toastStack.querySelector("sl-alert")===null&&Hi.toastStack.remove()},{once:!0})})}render(){return u`
5587
+ `;var Tt=class Hi extends J{constructor(){super(...arguments),this.hasSlotController=new vt(this,"icon","suffix"),this.localize=new me(this),this.open=!1,this.closable=!1,this.variant="primary",this.duration=1/0,this.remainingTime=this.duration}static get toastStack(){return this.currentToastStack||(this.currentToastStack=Object.assign(document.createElement("div"),{className:"sl-toast-stack"})),this.currentToastStack}firstUpdated(){this.base.hidden=!this.open}restartAutoHide(){this.handleCountdownChange(),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval),this.open&&this.duration<1/0&&(this.autoHideTimeout=window.setTimeout(()=>this.hide(),this.duration),this.remainingTime=this.duration,this.remainingTimeInterval=window.setInterval(()=>{this.remainingTime-=100},100))}pauseAutoHide(){var t;(t=this.countdownAnimation)==null||t.pause(),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval)}resumeAutoHide(){var t;this.duration<1/0&&(this.autoHideTimeout=window.setTimeout(()=>this.hide(),this.remainingTime),this.remainingTimeInterval=window.setInterval(()=>{this.remainingTime-=100},100),(t=this.countdownAnimation)==null||t.play())}handleCountdownChange(){if(this.open&&this.duration<1/0&&this.countdown){let{countdownElement:t}=this,s="100%",i="0";this.countdownAnimation=t.animate([{width:s},{width:i}],{duration:this.duration,easing:"linear"})}}handleCloseClick(){this.hide()}async handleOpenChange(){if(this.open){this.emit("sl-show"),this.duration<1/0&&this.restartAutoHide(),await tt(this.base),this.base.hidden=!1;let{keyframes:t,options:s}=Ue(this,"alert.show",{dir:this.localize.dir()});await qe(this.base,t,s),this.emit("sl-after-show")}else{wa(this),this.emit("sl-hide"),clearTimeout(this.autoHideTimeout),clearInterval(this.remainingTimeInterval),await tt(this.base);let{keyframes:t,options:s}=Ue(this,"alert.hide",{dir:this.localize.dir()});await qe(this.base,t,s),this.base.hidden=!0,this.emit("sl-after-hide")}}handleDurationChange(){this.restartAutoHide()}async show(){if(!this.open)return this.open=!0,ht(this,"sl-after-show")}async hide(){if(this.open)return this.open=!1,ht(this,"sl-after-hide")}async toast(){return new Promise(t=>{this.handleCountdownChange(),Hi.toastStack.parentElement===null&&document.body.append(Hi.toastStack),Hi.toastStack.appendChild(this),requestAnimationFrame(()=>{this.clientWidth,this.show()}),this.addEventListener("sl-after-hide",()=>{Hi.toastStack.removeChild(this),t(),Hi.toastStack.querySelector("sl-alert")===null&&Hi.toastStack.remove()},{once:!0})})}render(){return u`
5584
5588
  <div
5585
5589
  part="base"
5586
5590
  class=${se({alert:!0,"alert--open":this.open,"alert--closable":this.closable,"alert--has-countdown":!!this.countdown,"alert--has-icon":this.hasSlotController.test("icon"),"alert--primary":this.variant==="primary","alert--success":this.variant==="success","alert--neutral":this.variant==="neutral","alert--warning":this.variant==="warning","alert--danger":this.variant==="danger"})}
@@ -5854,94 +5858,94 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5854
5858
  <slot name="help-text">${this.helpText}</slot>
5855
5859
  </div>
5856
5860
  </div>
5857
- `}};ae.styles=[te,ni,xg];g([Q(".textarea__control")],ae.prototype,"input",2);g([Q(".textarea__size-adjuster")],ae.prototype,"sizeAdjuster",2);g([he()],ae.prototype,"hasFocus",2);g([b()],ae.prototype,"title",2);g([b()],ae.prototype,"name",2);g([b()],ae.prototype,"value",2);g([b({reflect:!0})],ae.prototype,"size",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"filled",2);g([b()],ae.prototype,"label",2);g([b({attribute:"help-text"})],ae.prototype,"helpText",2);g([b()],ae.prototype,"placeholder",2);g([b({type:Number})],ae.prototype,"rows",2);g([b()],ae.prototype,"resize",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"disabled",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"readonly",2);g([b({reflect:!0})],ae.prototype,"form",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"required",2);g([b({type:Number})],ae.prototype,"minlength",2);g([b({type:Number})],ae.prototype,"maxlength",2);g([b()],ae.prototype,"autocapitalize",2);g([b()],ae.prototype,"autocorrect",2);g([b()],ae.prototype,"autocomplete",2);g([b({type:Boolean})],ae.prototype,"autofocus",2);g([b()],ae.prototype,"enterkeyhint",2);g([b({type:Boolean,converter:{fromAttribute:e=>!(!e||e==="false"),toAttribute:e=>e?"true":"false"}})],ae.prototype,"spellcheck",2);g([b()],ae.prototype,"inputmode",2);g([kr()],ae.prototype,"defaultValue",2);g([Y("disabled",{waitUntilFirstUpdate:!0})],ae.prototype,"handleDisabledChange",1);g([Y("rows",{waitUntilFirstUpdate:!0})],ae.prototype,"handleRowsChange",1);g([Y("value",{waitUntilFirstUpdate:!0})],ae.prototype,"handleValueChange",1);ae.define("sl-textarea");var I=td();function us(e){let t=I.getState().currentProjectId;return t?`/api/projects/${t}${e}`:`/api${e}`}var W=Nf(),Go=ed({store:I,ws:W,getSettings:()=>Jt}),O=Fa(location.hash),Dg=W.getState(),xh=!0,Jt={},Ye=null,Os=null,li=null,qo=null,bt="*",Ea="",ai=null,Bs={},Wo=new Set,$h="all",Eh="all",jo=null,Ko=null,Th=new Map,Ah={},Rh=[],Vo=!1,Ra=new Map,Lh={},Ta=null,La=!1,Wi=null,Dh="all",Ph=null,Mh="",ka="all";function LS(){Jt={},Ye=null,Os=null,li=null,qo=null,bt="*",Ea="",ai=null;for(let e of Object.keys(Bs))delete Bs[e];Wo.clear(),$h="all",Eh="all",jo=null,Ko=null,Th.clear(),Ah={},Rh=[],Vo=!1,Ra.clear(),Lh={},Ta=null,La=!1,Wi=null,Dh="all",Ph=null,Mh="",ka="all"}function DS(e,t){Ra.set(e,t)}function Bh(e){e&&W.send("list-beads-by-run",{runId:e}).then(t=>{Th.set(e,t.issues||[]),j()}).catch(()=>{})}function PS(e,t){if(!(!e||!t)){Bs[e]||(Bs[e]={});for(let[s,i]of Object.entries(t)){if(i.status==="pending")continue;let r=`${e}:${s}`;Bs[e][s]||Wo.has(r)||(Wo.add(r),W.send("get-agent-prompt",{runId:e,stage:s}).then(o=>{Bs[e][s]=o,Wo.delete(r),j()}).catch(()=>{Wo.delete(r)}))}}}function kg(e){if(!e||!e.stages)return null;for(let[t,s]of Object.entries(e.stages))if(s.status==="in_progress")return t;return null}function Pg(e,t){let s=kg(e),i=kg(t);i&&s!==i&&(bt="*",ai=null,lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:null,runId:t.id}).catch(()=>{}))}W.on("runs-list",(e,t)=>{if((I.getState().projects||[]).length>1){let i={...I.getState().runs},r=new Set((e.runs||[]).map(c=>c.id)),o=t?.project||null;if(o)for(let[c,l]of Object.entries(i))l._project===o&&!r.has(c)&&delete i[c];let n={...I.getState().archivedRuns};if(o)for(let[c,l]of Object.entries(n))l._project===o&&!r.has(c)&&delete n[c];let a=Date.now();for(let c of e.runs||[])if(o&&(c._project=o),c.archived){if(on(c,a))continue;n[c.id]=c,delete i[c.id]}else i[c.id]=c,delete n[c.id];e.settings&&(Jt=e.settings),I.setState({runs:i,archivedRuns:n});return}e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])});W.on("run-snapshot",e=>{if(e?.id){let t=I.getRunById(e.id)??null;if(e.archived===!0||I.getState().archivedRuns[e.id]||Go.handleRunUpdate(e.id,e,t),t&&Bs[e.id])for(let[i,r]of Object.entries(e.stages||{})){let o=t.stages?.[i]?.iterations?.length||0;(r.iterations?.length||0)>o&&delete Bs[e.id][i]}I.setRun(e.id,e),O.runId===e.id&&(Pg(t,e),Un(e)),Ye&&(Ye=null,j())}});W.on("run-update",e=>{if(e?.id){let t=I.getRunById(e.id)??null;e.archived===!0||I.getState().archivedRuns[e.id]||Go.handleRunUpdate(e.id,e,t),I.setRun(e.id,e),O.runId===e.id&&(Pg(t,e),Un(e)),Ye&&(Ye=null,j())}});W.on("log-line",e=>{e&&(I.appendLog(e),e.iteration&&e.iteration>1&&e._iterStart&&yp(e.iteration),wc(e))});W.on("log-bulk",e=>{if(e&&Array.isArray(e.lines))for(let t of e.lines){let s={stage:e.stage,iteration:e.iteration,line:t,timestamp:new Date().toISOString()};I.appendLog(s),bt!=="*"&&Zp(s),wc(s)}});W.on("preferences",e=>{e&&(I.setState({preferences:e}),Ur(e.theme||"light"))});W.on("beads-update",(e,t)=>{let s=I.getState().currentProjectId;t?.project&&s&&t.project!==s||e&&(I.setState({beads:{issues:e.issues||[],dbExists:e.dbExists??!1,dbPath:e.dbPath||null,loading:!1}}),O.runId&&O.section!=="beads"&&Bh(O.runId),Oh(),O.section==="beads"&&O.runId&&Ih(O.runId))});function Aa(){return W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])})}W.on("run-started",()=>{Aa().catch(()=>{}),setTimeout(()=>Aa().catch(()=>{}),2e3)});W.on("run-archived",e=>{if(e?.runId){let t=I.getState().runs[e.runId]??I.getState().archivedRuns[e.runId];t?I.setRun(e.runId,{...t,archived:!0,archived_at:e.archived_at||new Date().toISOString()}):Aa().catch(()=>{})}});W.on("run-unarchived",e=>{if(e?.runId){let t=I.getState().runs[e.runId]??I.getState().archivedRuns[e.runId];if(t){let{archived:s,archived_at:i,...r}=t;I.setRun(e.runId,r)}else Aa().catch(()=>{})}});W.on("run-stopped",()=>{Ye=null,W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{})});W.on("stage-restarted",()=>{W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{})});W.on("learn-started",e=>{e?.runId&&e.runId===O.runId&&W.send("subscribe-run",{runId:e.runId}).catch(()=>{})});W.on("webhook-inbox-event",e=>{if(e){let t=I.getState().currentProjectId;if(!e.projectId||!t||e.projectId===t){let s=I.getState().webhookInbox;I.setState({webhookInbox:{...s,events:[...s.events,e]}})}}});W.on("webhook-control-changed",e=>{if(e){let t=I.getState().webhookInbox;I.setState({webhookInbox:{...t,controlAction:e.action}})}});W.on("webhook-inbox-cleared",()=>{let e=I.getState().webhookInbox;I.setState({webhookInbox:{...e,events:[]}}),Wi=null});W.on("pipeline-status-changed",e=>{let t=I.getState().currentProjectId;if(e.project&&t&&e.project!==t)return;let s={...I.getState().pipelines};e.status==="removed"?delete s[e.runId]:s[e.runId]={run_id:e.runId,status:e.status,stage:e.stage,title:e.title,worktree_path:e.worktree_path,started_at:e.started_at,pid:e.pid},I.setState({pipelines:s})});function MS(e){if(!(e?.capabilities||[]).includes("multi-project")){W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:null}}),$g();return}fetch("/api/projects").then(i=>i.json()).then(i=>{let r=i.projects||[];I.setState({projects:r});let o=O.projectId||(r.length===1?r[0].name:null);I.setState({currentProjectId:o}),W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:o}}),$g()}).catch(()=>{})}function Mg(){let e=I.getState().projects||[];Promise.all(e.map(t=>fetch(`/api/projects/${t.name}/runs`).then(s=>s.json()).then(s=>({runs:(s.runs||[]).map(i=>({...i,project:i.project||t.name})),settings:s.settings||null,projectName:t.name})).catch(()=>({runs:[],settings:null,projectName:t.name})))).then(t=>{let s={},i={},r=Date.now();for(let{runs:o,settings:n}of t){n&&(Jt=n);for(let a of o)if(a.archived){if(on(a,r))continue;i[a.id]=a}else s[a.id]=a}I.setState({runs:s,archivedRuns:i,runsLoaded:!0}),j()})}function $g(){(I.getState().projects||[]).length>1?Mg():W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{}),W.send("list-beads-issues").then(e=>{I.setState({beads:{issues:e.issues||[],dbExists:e.dbExists??!1,dbPath:e.dbPath||null,loading:!1}})}).catch(()=>{}),W.send("get-webhook-inbox").then(e=>{I.setState({webhookInbox:{events:e.events||[],controlAction:e.controlAction||"continue"}})}).catch(()=>{}),W.send("list-pipelines").then(e=>{let t={};for(let s of e.pipelines||[])t[s.run_id]=s;I.setState({pipelines:t})}).catch(()=>{}),Oh(),zh(),O.runId&&(O.section!=="beads"&&(W.send("subscribe-run",{runId:O.runId}).catch(()=>{}),W.send("subscribe-log",{stage:bt==="*"?null:bt,runId:O.runId}).catch(()=>{})),Bh(O.runId),O.section==="beads"&&Ih(O.runId))}W.on("hello",MS);W.on("projects-updated",e=>{e?.projects&&I.setState({projects:e.projects})});function BS(e){W.send("unsubscribe-run").catch(()=>{}),W.send("unsubscribe-log").catch(()=>{}),W.send("unsubscribe-events").catch(()=>{}),W.send("unsubscribe-pipeline").catch(()=>{}),I.clearLog(),I.setState({currentProjectId:e,runs:{},archivedRuns:{},logLines:[],activeRunId:null,pipelines:{}}),LS(),W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:e}}),(I.getState().projects||[]).length>1?Mg():W.send("list-runs").then(t=>{t.settings&&(Jt=t.settings),I.setRunsBulk(t.runs||[])}).catch(()=>{}),W.send("list-beads-issues").then(t=>{I.setState({beads:{issues:t.issues||[],dbExists:t.dbExists??!1,dbPath:t.dbPath||null,loading:!1}})}).catch(()=>{}),I.setState({webhookInbox:{events:[],controlAction:I.getState().webhookInbox?.controlAction||"continue"}}),W.send("get-webhook-inbox").then(t=>{I.setState({webhookInbox:{events:t.events||[],controlAction:t.controlAction||"continue"}})}).catch(()=>{}),Oh(),zh()}W.onConnection(e=>{Dg=e,e==="open"&&W.send("get-preferences").then(t=>{I.setState({preferences:t}),Ur(t.theme||"light")}).catch(()=>{}),j()});Qh(e=>{let t=O.runId,s=O.projectId;O=e,e.projectId!==s&&BS(e.projectId),t&&t!==O.runId&&(Ra.clear(),W.send("unsubscribe-run").catch(()=>{}),W.send("unsubscribe-log").catch(()=>{}),I.clearLog(),lr(),Sc()),O.runId&&O.runId!==t&&(O.section==="beads"?Ih(O.runId):(bt="*",ai=null,W.send("subscribe-run",{runId:O.runId}).catch(()=>{}),W.send("subscribe-log",{stage:null,runId:O.runId}).catch(()=>{}),Bh(O.runId))),O.section==="settings"&&ti(null).then(()=>j()),O.section==="project-settings"&&ti(I.getState().currentProjectId||null).then(()=>j()),O.section==="costs"&&(La=!1,Bg()),!O.runId&&t&&(Qp(),wp()),j()});function OS(e){Ie(e,null,O.projectId)}function $a(e){Ie(O.section,e,O.projectId)}function IS(e){e?Ie(O.section,null,e):Ie("dashboard",null,null)}function zS(){let t=I.getState().preferences.theme==="dark"?"light":"dark";W.send("set-preferences",{theme:t}).catch(()=>{}),I.setState({preferences:{theme:t}}),Ur(t)}function NS(e){W.send("set-preferences",{notifications:e}).catch(()=>{}),I.setState({preferences:{notifications:e}})}function FS(e){W.send("set-preferences",{source_repo:e}).catch(()=>{}),I.setState({preferences:{source_repo:e}})}function HS(e){if(bt=e,e!=="*"){let i=I.getRunById(O.runId)?.stages?.[e]?.iterations?.length||0;ai=i>0?i:null}else ai=null;lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:e==="*"?null:e,runId:O.runId,iteration:ai}).catch(()=>{}),j()}function WS(e){ai=e,lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:bt==="*"?null:bt,runId:O.runId,iteration:e}).catch(()=>{}),j()}function jS(e){Ea=e,ef(e)}function VS(){xh=!xh,j()}function Le(e){li=e,j(),requestAnimationFrame(()=>{let t=document.getElementById("action-error-dialog");t&&t.show()})}function US(){li=null,j()}function Eg(){At({label:"Stop Pipeline?",message:"Are you sure? The current stage will be interrupted and marked as error.",confirmLabel:"Stop",confirmVariant:"danger",onConfirm:qS},j)}async function qS(){Ye="stopping",li=null,j();try{let t=Object.values(I.getState().runs).find(r=>r.active)?.id||"current",i=await(await fetch(us(`/runs/${t}/stop`),{method:"POST"})).json();i.ok||(Ye=null,Le(i.error||"Failed to stop pipeline"))}catch(e){Ye=null,Le(e?.message||"Failed to stop pipeline")}}function Tg(){Ye="resuming",li=null,j(),W.send("resume-run",{runId:O.runId}).then(()=>{Ye=null,j()}).catch(e=>{Ye=null,Le(e?.message||"Failed to resume pipeline")})}async function KS(){let t=Object.values(I.getState().runs).find(s=>s.active)?.id||"current";Ye="pausing",li=null,j();try{let i=await(await fetch(us(`/runs/${t}/pause`),{method:"POST"})).json();i.ok||(Ye=null,Le(i.error||"Failed to pause pipeline"))}catch(s){Ye=null,Le(s?.message||"Failed to pause pipeline")}}async function kh(e){Os={action:"pause",runId:e},j();try{let s=await(await fetch(us(`/runs/${e}/pause`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to pause run")}catch(t){Le(t?.message||"Failed to pause run")}finally{Os=null,j()}}async function Uo(e){Os={action:"resume",runId:e},j();try{await W.send("resume-run",{runId:e})}catch(t){Le(t?.message||"Failed to resume run")}finally{Os=null,j()}}function Ag(e){At({label:"Stop Pipeline?",message:"Are you sure? The current stage will be interrupted and marked as error.",confirmLabel:"Stop",confirmVariant:"danger",onConfirm:async()=>{Os={action:"stop",runId:e},j();try{let s=await(await fetch(us(`/runs/${e}/stop`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to stop run")}catch(t){Le(t?.message||"Failed to stop run")}finally{Os=null,j()}}},j)}var{archiveRun:Ch,unarchiveRun:GS}=sd({showConfirm:At,showActionError:Le,projectUrl:us,store:I,rerender:j});async function YS(e){try{let s=await(await fetch(us(`/pipelines/${e}/pause`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to pause pipeline")}catch(t){Le(t?.message||"Failed to pause pipeline")}}async function XS(e){try{let s=await(await fetch(us(`/pipelines/${e}/stop`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to stop pipeline")}catch(t){Le(t?.message||"Failed to stop pipeline")}}async function JS(e){try{await W.send("resume-run",{runId:e})}catch(t){Le(t?.message||"Failed to resume pipeline")}}function ZS(e){qo=e,At({label:"Restart Stage?",message:`Restart the "${e}" stage? The pipeline will resume from this point.`,confirmLabel:"Restart",confirmVariant:"warning",onConfirm:QS,onCancel:()=>{qo=null}},j)}async function QS(){let e=qo;qo=null,j();try{let s=Object.values(I.getState().runs).find(o=>!o.active)?.id||"current",r=await(await fetch(us(`/runs/${s}/stages/${e}/restart`),{method:"POST"})).json();r.ok?Ie("active",null,O.projectId):Le(r.error||"Failed to restart stage")}catch(t){Le(t?.message||"Failed to restart stage")}}function eC(){O.runId?Ie(O.section,null,O.projectId):O.section&&O.section!=="dashboard"&&Ie("dashboard",null,O.projectId)}function tC(e){$h=e,j()}function sC(e){Eh=e,j()}async function iC(e){jo=e,Ko=null,j();try{await W.send("start-beads-issue",{issueId:e}),jo=null,Ie("active",null,O.projectId)}catch(t){jo=null,Ko=t?.message||"Failed to start pipeline",j()}}function rC(){Ko=null,j()}function Oh(){W.send("list-beads-counts").then(e=>{Ah=e.counts||{},j()}).catch(()=>{})}function Ih(e){Vo=!0,j(),W.send("list-beads-by-run",{runId:e}).then(t=>{Rh=t.issues||[],Vo=!1,j()}).catch(()=>{Vo=!1,j()})}function Bg(){fetch(us("/costs")).then(e=>e.json()).then(e=>{e.ok&&(Lh=e.tokenData||{},La=!0,j())}).catch(()=>{})}function zh(){let e=I.getState().currentProjectId,t=e?`/api/projects/${e}/info`:"/api/project-info";fetch(t).then(s=>s.json()).then(s=>{let i=s.project?.name??s.name;i!==void 0&&(I.setState({projectName:i}),document.title=id(i))}).catch(()=>{})}function oC(e){Ta=Ta===e?null:e,j()}function nC(e){Wi=Wi===e?null:e,j()}function aC(e){Dh=e,j()}function lC(e){Ph=e,j()}function cC(e){Mh=e,j()}function hC(e){W.send("set-webhook-control",{action:e}).catch(()=>{})}function Og(){W.send("clear-webhook-inbox").catch(()=>{}),Wi=null}function dC(e){try{navigator.clipboard.writeText(JSON.stringify(e.envelope,null,2))}catch{}}function uC(){Wi=null,j()}function pC(){let t=I.getRunById(O.runId)?.stages?.learn?.status;if(t==="completed"||t==="error"){At({label:"Re-run Learning Analysis?",message:"This will replace existing learnings. Continue?",confirmLabel:"Re-run",confirmVariant:"warning",onConfirm:Rg},j);return}Rg()}async function Rg(){j();try{let e=O.runId,s=await(await fetch(us(`/runs/${e}/learn`),{method:"POST"})).json();if(!s.ok)Le(s.error||"Failed to run learning analysis");else{let i=I.getRunById(e);if(i){let r=new Date().toISOString();I.setRun(e,{...i,stages:{...i.stages||{},learn:{status:"in_progress",pid:s.pid,started_at:r,iterations:[{number:1,status:"in_progress",started_at:r,trigger:"manual"}]}}})}}}catch(e){Le(e?.message||"Failed to run learning analysis")}}function fC(){let e=I.getState(),t="Dashboard",s=!1,i=null,r=null;if(O.section==="beads"&&O.runId){let a=(I.getRunById(O.runId)?.work_request?.title||O.runId).split(`
5858
- `)[0];t=a.length>80?`${a.slice(0,80)}\u2026`:a,s=!0}else if(O.section==="beads"&&!O.runId){t="Beads Issues",s=!0;let o=e.beads?.dbPath;o&&(r=u`<span class="beads-db-path">${k(R(Ka,12))} Beads DB<br><code>${o}</code></span>`)}else if(O.runId){let o=I.getRunById(O.runId),a=(o?.work_request?.title||"Pipeline Details").split(`
5861
+ `}};ae.styles=[te,ni,xg];g([Q(".textarea__control")],ae.prototype,"input",2);g([Q(".textarea__size-adjuster")],ae.prototype,"sizeAdjuster",2);g([he()],ae.prototype,"hasFocus",2);g([b()],ae.prototype,"title",2);g([b()],ae.prototype,"name",2);g([b()],ae.prototype,"value",2);g([b({reflect:!0})],ae.prototype,"size",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"filled",2);g([b()],ae.prototype,"label",2);g([b({attribute:"help-text"})],ae.prototype,"helpText",2);g([b()],ae.prototype,"placeholder",2);g([b({type:Number})],ae.prototype,"rows",2);g([b()],ae.prototype,"resize",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"disabled",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"readonly",2);g([b({reflect:!0})],ae.prototype,"form",2);g([b({type:Boolean,reflect:!0})],ae.prototype,"required",2);g([b({type:Number})],ae.prototype,"minlength",2);g([b({type:Number})],ae.prototype,"maxlength",2);g([b()],ae.prototype,"autocapitalize",2);g([b()],ae.prototype,"autocorrect",2);g([b()],ae.prototype,"autocomplete",2);g([b({type:Boolean})],ae.prototype,"autofocus",2);g([b()],ae.prototype,"enterkeyhint",2);g([b({type:Boolean,converter:{fromAttribute:e=>!(!e||e==="false"),toAttribute:e=>e?"true":"false"}})],ae.prototype,"spellcheck",2);g([b()],ae.prototype,"inputmode",2);g([kr()],ae.prototype,"defaultValue",2);g([Y("disabled",{waitUntilFirstUpdate:!0})],ae.prototype,"handleDisabledChange",1);g([Y("rows",{waitUntilFirstUpdate:!0})],ae.prototype,"handleRowsChange",1);g([Y("value",{waitUntilFirstUpdate:!0})],ae.prototype,"handleValueChange",1);ae.define("sl-textarea");var I=td();function us(e){let t=I.getState().currentProjectId;return t?`/api/projects/${t}${e}`:`/api${e}`}var W=Nf(),Ko=ed({store:I,ws:W,getSettings:()=>Jt}),O=Ia(location.hash),Dg=W.getState(),xh=!0,Jt={},Ye=null,Os=null,li=null,Uo=null,bt="*",xa="",ai=null,Bs={},Ho=new Set,$h="all",Eh="all",Wo=null,qo=null,Th=new Map,Ah={},Rh=[],jo=!1,Ea=new Map,Lh={},ka=null,Ta=!1,Wi=null,Dh="all",Ph=null,Mh="",Sa="all";function LS(){Jt={},Ye=null,Os=null,li=null,Uo=null,bt="*",xa="",ai=null;for(let e of Object.keys(Bs))delete Bs[e];Ho.clear(),$h="all",Eh="all",Wo=null,qo=null,Th.clear(),Ah={},Rh=[],jo=!1,Ea.clear(),Lh={},ka=null,Ta=!1,Wi=null,Dh="all",Ph=null,Mh="",Sa="all"}function DS(e,t){Ea.set(e,t)}function Bh(e){e&&W.send("list-beads-by-run",{runId:e}).then(t=>{Th.set(e,t.issues||[]),j()}).catch(()=>{})}function PS(e,t){if(!(!e||!t)){Bs[e]||(Bs[e]={});for(let[s,i]of Object.entries(t)){if(i.status==="pending")continue;let r=`${e}:${s}`;Bs[e][s]||Ho.has(r)||(Ho.add(r),W.send("get-agent-prompt",{runId:e,stage:s}).then(o=>{Bs[e][s]=o,Ho.delete(r),j()}).catch(()=>{Ho.delete(r)}))}}}function kg(e){if(!e||!e.stages)return null;for(let[t,s]of Object.entries(e.stages))if(s.status==="in_progress")return t;return null}function Pg(e,t){let s=kg(e),i=kg(t);i&&s!==i&&(bt="*",ai=null,lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:null,runId:t.id}).catch(()=>{}))}W.on("runs-list",(e,t)=>{if((I.getState().projects||[]).length>1){let i={...I.getState().runs},r=new Set((e.runs||[]).map(c=>c.id)),o=t?.project||null;if(o)for(let[c,l]of Object.entries(i))l._project===o&&!r.has(c)&&delete i[c];let n={...I.getState().archivedRuns};if(o)for(let[c,l]of Object.entries(n))l._project===o&&!r.has(c)&&delete n[c];let a=Date.now();for(let c of e.runs||[])if(o&&(c._project=o),c.archived){if(rn(c,a))continue;n[c.id]=c,delete i[c.id]}else i[c.id]=c,delete n[c.id];e.settings&&(Jt=e.settings),I.setState({runs:i,archivedRuns:n});return}e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])});W.on("run-snapshot",e=>{if(e?.id){let t=I.getRunById(e.id)??null;if(e.archived===!0||I.getState().archivedRuns[e.id]||Ko.handleRunUpdate(e.id,e,t),t&&Bs[e.id])for(let[i,r]of Object.entries(e.stages||{})){let o=t.stages?.[i]?.iterations?.length||0;(r.iterations?.length||0)>o&&delete Bs[e.id][i]}I.setRun(e.id,e),O.runId===e.id&&(Pg(t,e),jn(e)),Ye&&(Ye=null,j())}});W.on("run-update",e=>{if(e?.id){let t=I.getRunById(e.id)??null;e.archived===!0||I.getState().archivedRuns[e.id]||Ko.handleRunUpdate(e.id,e,t),I.setRun(e.id,e),O.runId===e.id&&(Pg(t,e),jn(e)),Ye&&(Ye=null,j())}});W.on("log-line",e=>{e&&(I.appendLog(e),e.iteration&&e.iteration>1&&e._iterStart&&yp(e.iteration),yc(e))});W.on("log-bulk",e=>{if(e&&Array.isArray(e.lines))for(let t of e.lines){let s={stage:e.stage,iteration:e.iteration,line:t,timestamp:new Date().toISOString()};I.appendLog(s),bt!=="*"&&Zp(s),yc(s)}});W.on("preferences",e=>{e&&(I.setState({preferences:e}),Vr(e.theme||"light"))});W.on("beads-update",(e,t)=>{let s=I.getState().currentProjectId;t?.project&&s&&t.project!==s||e&&(I.setState({beads:{issues:e.issues||[],dbExists:e.dbExists??!1,dbPath:e.dbPath||null,loading:!1}}),O.runId&&O.section!=="beads"&&Bh(O.runId),Oh(),O.section==="beads"&&O.runId&&Ih(O.runId))});function $a(){return W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])})}W.on("run-started",()=>{$a().catch(()=>{}),setTimeout(()=>$a().catch(()=>{}),2e3)});W.on("run-archived",e=>{if(e?.runId){let t=I.getState().runs[e.runId]??I.getState().archivedRuns[e.runId];t?I.setRun(e.runId,{...t,archived:!0,archived_at:e.archived_at||new Date().toISOString()}):$a().catch(()=>{})}});W.on("run-unarchived",e=>{if(e?.runId){let t=I.getState().runs[e.runId]??I.getState().archivedRuns[e.runId];if(t){let{archived:s,archived_at:i,...r}=t;I.setRun(e.runId,r)}else $a().catch(()=>{})}});W.on("run-stopped",()=>{Ye=null,W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{})});W.on("stage-restarted",()=>{W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{})});W.on("learn-started",e=>{e?.runId&&e.runId===O.runId&&W.send("subscribe-run",{runId:e.runId}).catch(()=>{})});W.on("webhook-inbox-event",e=>{if(e){let t=I.getState().currentProjectId;if(!e.projectId||!t||e.projectId===t){let s=I.getState().webhookInbox;I.setState({webhookInbox:{...s,events:[...s.events,e]}})}}});W.on("webhook-control-changed",e=>{if(e){let t=I.getState().webhookInbox;I.setState({webhookInbox:{...t,controlAction:e.action}})}});W.on("webhook-inbox-cleared",()=>{let e=I.getState().webhookInbox;I.setState({webhookInbox:{...e,events:[]}}),Wi=null});W.on("pipeline-status-changed",e=>{let t=I.getState().currentProjectId;if(e.project&&t&&e.project!==t)return;let s={...I.getState().pipelines};e.status==="removed"?delete s[e.runId]:s[e.runId]={run_id:e.runId,status:e.status,stage:e.stage,title:e.title,worktree_path:e.worktree_path,started_at:e.started_at,pid:e.pid},I.setState({pipelines:s})});function MS(e){if(!(e?.capabilities||[]).includes("multi-project")){W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:null}}),$g();return}fetch("/api/projects").then(i=>i.json()).then(i=>{let r=i.projects||[];I.setState({projects:r});let o=O.projectId||(r.length===1?r[0].name:null);I.setState({currentProjectId:o}),W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:o}}),$g()}).catch(()=>{})}function Mg(){let e=I.getState().projects||[];Promise.all(e.map(t=>fetch(`/api/projects/${t.name}/runs`).then(s=>s.json()).then(s=>({runs:(s.runs||[]).map(i=>({...i,project:i.project||t.name})),settings:s.settings||null,projectName:t.name})).catch(()=>({runs:[],settings:null,projectName:t.name})))).then(t=>{let s={},i={},r=Date.now();for(let{runs:o,settings:n}of t){n&&(Jt=n);for(let a of o)if(a.archived){if(rn(a,r))continue;i[a.id]=a}else s[a.id]=a}I.setState({runs:s,archivedRuns:i,runsLoaded:!0}),j()})}function $g(){(I.getState().projects||[]).length>1?Mg():W.send("list-runs").then(e=>{e.settings&&(Jt=e.settings),I.setRunsBulk(e.runs||[])}).catch(()=>{}),W.send("list-beads-issues").then(e=>{I.setState({beads:{issues:e.issues||[],dbExists:e.dbExists??!1,dbPath:e.dbPath||null,loading:!1}})}).catch(()=>{}),W.send("get-webhook-inbox").then(e=>{I.setState({webhookInbox:{events:e.events||[],controlAction:e.controlAction||"continue"}})}).catch(()=>{}),W.send("list-pipelines").then(e=>{let t={};for(let s of e.pipelines||[])t[s.run_id]=s;I.setState({pipelines:t})}).catch(()=>{}),Oh(),zh(),O.runId&&(O.section!=="beads"&&(W.send("subscribe-run",{runId:O.runId}).catch(()=>{}),W.send("subscribe-log",{stage:bt==="*"?null:bt,runId:O.runId}).catch(()=>{})),Bh(O.runId),O.section==="beads"&&Ih(O.runId))}W.on("hello",MS);W.on("projects-updated",e=>{e?.projects&&I.setState({projects:e.projects})});function BS(e){W.send("unsubscribe-run").catch(()=>{}),W.send("unsubscribe-log").catch(()=>{}),W.send("unsubscribe-events").catch(()=>{}),W.send("unsubscribe-pipeline").catch(()=>{}),I.clearLog(),I.setState({currentProjectId:e,runs:{},archivedRuns:{},logLines:[],activeRunId:null,pipelines:{}}),LS(),W.sendRaw({type:"hello-ack",payload:{protocol:2,projectId:e}}),(I.getState().projects||[]).length>1?Mg():W.send("list-runs").then(t=>{t.settings&&(Jt=t.settings),I.setRunsBulk(t.runs||[])}).catch(()=>{}),W.send("list-beads-issues").then(t=>{I.setState({beads:{issues:t.issues||[],dbExists:t.dbExists??!1,dbPath:t.dbPath||null,loading:!1}})}).catch(()=>{}),I.setState({webhookInbox:{events:[],controlAction:I.getState().webhookInbox?.controlAction||"continue"}}),W.send("get-webhook-inbox").then(t=>{I.setState({webhookInbox:{events:t.events||[],controlAction:t.controlAction||"continue"}})}).catch(()=>{}),Oh(),zh()}W.onConnection(e=>{Dg=e,e==="open"&&W.send("get-preferences").then(t=>{I.setState({preferences:t}),Vr(t.theme||"light")}).catch(()=>{}),j()});Qh(e=>{let t=O.runId,s=O.projectId;O=e,e.projectId!==s&&BS(e.projectId),t&&t!==O.runId&&(Ea.clear(),W.send("unsubscribe-run").catch(()=>{}),W.send("unsubscribe-log").catch(()=>{}),I.clearLog(),lr(),wc()),O.runId&&O.runId!==t&&(O.section==="beads"?Ih(O.runId):(bt="*",ai=null,W.send("subscribe-run",{runId:O.runId}).catch(()=>{}),W.send("subscribe-log",{stage:null,runId:O.runId}).catch(()=>{}),Bh(O.runId))),O.section==="settings"&&ti(null).then(()=>j()),O.section==="project-settings"&&ti(I.getState().currentProjectId||null).then(()=>j()),O.section==="costs"&&(Ta=!1,Bg()),!O.runId&&t&&(Qp(),wp()),j()});function OS(e){Ie(e,null,O.projectId)}function Ca(e){Ie(O.section,e,O.projectId)}function IS(e){e?Ie(O.section,null,e):Ie("dashboard",null,null)}function zS(){let t=I.getState().preferences.theme==="dark"?"light":"dark";W.send("set-preferences",{theme:t}).catch(()=>{}),I.setState({preferences:{theme:t}}),Vr(t)}function NS(e){W.send("set-preferences",{notifications:e}).catch(()=>{}),I.setState({preferences:{notifications:e}})}function FS(e){W.send("set-preferences",{source_repo:e}).catch(()=>{}),I.setState({preferences:{source_repo:e}})}function HS(e){if(bt=e,e!=="*"){let i=I.getRunById(O.runId)?.stages?.[e]?.iterations?.length||0;ai=i>0?i:null}else ai=null;lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:e==="*"?null:e,runId:O.runId,iteration:ai}).catch(()=>{}),j()}function WS(e){ai=e,lr(),I.clearLog(),W.send("unsubscribe-log").catch(()=>{}),W.send("subscribe-log",{stage:bt==="*"?null:bt,runId:O.runId,iteration:e}).catch(()=>{}),j()}function jS(e){xa=e,ef(e)}function VS(){xh=!xh,j()}function Le(e){li=e,j(),requestAnimationFrame(()=>{let t=document.getElementById("action-error-dialog");t&&t.show()})}function US(){li=null,j()}function Eg(){At({label:"Stop Pipeline?",message:"Are you sure? The current stage will be interrupted and marked as error.",confirmLabel:"Stop",confirmVariant:"danger",onConfirm:qS},j)}async function qS(){Ye="stopping",li=null,j();try{let t=Object.values(I.getState().runs).find(r=>r.active)?.id||"current",i=await(await fetch(us(`/runs/${t}/stop`),{method:"POST"})).json();i.ok||(Ye=null,Le(i.error||"Failed to stop pipeline"))}catch(e){Ye=null,Le(e?.message||"Failed to stop pipeline")}}function Tg(){Ye="resuming",li=null,j(),W.send("resume-run",{runId:O.runId}).then(()=>{Ye=null,j()}).catch(e=>{Ye=null,Le(e?.message||"Failed to resume pipeline")})}async function KS(){let t=Object.values(I.getState().runs).find(s=>s.active)?.id||"current";Ye="pausing",li=null,j();try{let i=await(await fetch(us(`/runs/${t}/pause`),{method:"POST"})).json();i.ok||(Ye=null,Le(i.error||"Failed to pause pipeline"))}catch(s){Ye=null,Le(s?.message||"Failed to pause pipeline")}}async function kh(e){Os={action:"pause",runId:e},j();try{let s=await(await fetch(us(`/runs/${e}/pause`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to pause run")}catch(t){Le(t?.message||"Failed to pause run")}finally{Os=null,j()}}async function Vo(e){Os={action:"resume",runId:e},j();try{await W.send("resume-run",{runId:e})}catch(t){Le(t?.message||"Failed to resume run")}finally{Os=null,j()}}function Ag(e){At({label:"Stop Pipeline?",message:"Are you sure? The current stage will be interrupted and marked as error.",confirmLabel:"Stop",confirmVariant:"danger",onConfirm:async()=>{Os={action:"stop",runId:e},j();try{let s=await(await fetch(us(`/runs/${e}/stop`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to stop run")}catch(t){Le(t?.message||"Failed to stop run")}finally{Os=null,j()}}},j)}var{archiveRun:Ch,unarchiveRun:GS}=sd({showConfirm:At,showActionError:Le,projectUrl:us,store:I,rerender:j});async function YS(e){try{let s=await(await fetch(us(`/pipelines/${e}/pause`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to pause pipeline")}catch(t){Le(t?.message||"Failed to pause pipeline")}}async function XS(e){try{let s=await(await fetch(us(`/pipelines/${e}/stop`),{method:"POST"})).json();s.ok||Le(s.error||"Failed to stop pipeline")}catch(t){Le(t?.message||"Failed to stop pipeline")}}async function JS(e){try{await W.send("resume-run",{runId:e})}catch(t){Le(t?.message||"Failed to resume pipeline")}}function ZS(e){Uo=e,At({label:"Restart Stage?",message:`Restart the "${e}" stage? The pipeline will resume from this point.`,confirmLabel:"Restart",confirmVariant:"warning",onConfirm:QS,onCancel:()=>{Uo=null}},j)}async function QS(){let e=Uo;Uo=null,j();try{let s=Object.values(I.getState().runs).find(o=>!o.active)?.id||"current",r=await(await fetch(us(`/runs/${s}/stages/${e}/restart`),{method:"POST"})).json();r.ok?Ie("active",null,O.projectId):Le(r.error||"Failed to restart stage")}catch(t){Le(t?.message||"Failed to restart stage")}}function eC(){O.runId?Ie(O.section,null,O.projectId):O.section&&O.section!=="dashboard"&&Ie("dashboard",null,O.projectId)}function tC(e){$h=e,j()}function sC(e){Eh=e,j()}async function iC(e){Wo=e,qo=null,j();try{await W.send("start-beads-issue",{issueId:e}),Wo=null,Ie("active",null,O.projectId)}catch(t){Wo=null,qo=t?.message||"Failed to start pipeline",j()}}function rC(){qo=null,j()}function Oh(){W.send("list-beads-counts").then(e=>{Ah=e.counts||{},j()}).catch(()=>{})}function Ih(e){jo=!0,j(),W.send("list-beads-by-run",{runId:e}).then(t=>{Rh=t.issues||[],jo=!1,j()}).catch(()=>{jo=!1,j()})}function Bg(){fetch(us("/costs")).then(e=>e.json()).then(e=>{e.ok&&(Lh=e.tokenData||{},Ta=!0,j())}).catch(()=>{})}function zh(){let e=I.getState().currentProjectId,t=e?`/api/projects/${e}/info`:"/api/project-info";fetch(t).then(s=>s.json()).then(s=>{let i=s.project?.name??s.name;i!==void 0&&(I.setState({projectName:i}),document.title=id(i))}).catch(()=>{})}function oC(e){ka=ka===e?null:e,j()}function nC(e){Wi=Wi===e?null:e,j()}function aC(e){Dh=e,j()}function lC(e){Ph=e,j()}function cC(e){Mh=e,j()}function hC(e){W.send("set-webhook-control",{action:e}).catch(()=>{})}function Og(){W.send("clear-webhook-inbox").catch(()=>{}),Wi=null}function dC(e){try{navigator.clipboard.writeText(JSON.stringify(e.envelope,null,2))}catch{}}function uC(){Wi=null,j()}function pC(){let t=I.getRunById(O.runId)?.stages?.learn?.status;if(t==="completed"||t==="error"){At({label:"Re-run Learning Analysis?",message:"This will replace existing learnings. Continue?",confirmLabel:"Re-run",confirmVariant:"warning",onConfirm:Rg},j);return}Rg()}async function Rg(){j();try{let e=O.runId,s=await(await fetch(us(`/runs/${e}/learn`),{method:"POST"})).json();if(!s.ok)Le(s.error||"Failed to run learning analysis");else{let i=I.getRunById(e);if(i){let r=new Date().toISOString();I.setRun(e,{...i,stages:{...i.stages||{},learn:{status:"in_progress",pid:s.pid,started_at:r,iterations:[{number:1,status:"in_progress",started_at:r,trigger:"manual"}]}}})}}}catch(e){Le(e?.message||"Failed to run learning analysis")}}function fC(){let e=I.getState(),t="Dashboard",s=!1,i=null,r=null;if(O.section==="beads"&&O.runId){let a=(I.getRunById(O.runId)?.work_request?.title||O.runId).split(`
5862
+ `)[0];t=a.length>80?`${a.slice(0,80)}\u2026`:a,s=!0}else if(O.section==="beads"&&!O.runId){t="Beads Issues",s=!0;let o=e.beads?.dbPath;o&&(r=u`<span class="beads-db-path">${T(R(ja,12))} Beads DB<br><code>${o}</code></span>`)}else if(O.runId){let o=I.getRunById(O.runId),a=(o?.work_request?.title||"Pipeline Details").split(`
5859
5863
  `)[0];if(t=a.length>80?`${a.slice(0,80)}\u2026`:a,s=!0,o){let c=o.pipeline_status||(o.active?"running":"completed"),h={running:"warning",resuming:"warning",paused:"warning",completed:"success",failed:"danger"}[c]||"neutral",d=c.charAt(0).toUpperCase()+c.slice(1);i=u`<sl-badge variant="${h}" pill>
5860
- ${k(jt(c,12))}
5864
+ ${T(jt(c,12))}
5861
5865
  ${d}
5862
5866
  </sl-badge>`,Ye==="stopping"?r=u`
5863
5867
  <button class="action-btn action-btn--danger" disabled>
5864
- ${k(R(De,14,"icon-spin"))}
5868
+ ${T(R(De,14,"icon-spin"))}
5865
5869
  Stopping\u2026
5866
5870
  </button>`:Ye==="pausing"?r=u`
5867
5871
  <button class="action-btn action-btn--amber" disabled>
5868
- ${k(R(De,14,"icon-spin"))}
5872
+ ${T(R(De,14,"icon-spin"))}
5869
5873
  Pausing\u2026
5870
5874
  </button>`:Ye==="resuming"?r=u`
5871
5875
  <button class="action-btn action-btn--primary" disabled>
5872
- ${k(R(De,14,"icon-spin"))}
5876
+ ${T(R(De,14,"icon-spin"))}
5873
5877
  Resuming\u2026
5874
5878
  </button>`:c==="running"?r=u`
5875
5879
  <button class="action-btn action-btn--amber" @click=${KS}>
5876
- ${k(R(rt,14))}
5880
+ ${T(R(rt,14))}
5877
5881
  Pause
5878
5882
  </button>
5879
5883
  <button class="action-btn action-btn--danger" @click=${Eg}>
5880
- ${k(R(Hs,14))}
5884
+ ${T(R(Hs,14))}
5881
5885
  Stop
5882
5886
  </button>`:c==="paused"?r=u`
5883
5887
  <button class="action-btn action-btn--primary" @click=${Tg}>
5884
- ${k(R(bs,14))}
5888
+ ${T(R(bs,14))}
5885
5889
  Resume
5886
5890
  </button>
5887
5891
  <button class="action-btn action-btn--danger" @click=${Eg}>
5888
- ${k(R(Hs,14))}
5892
+ ${T(R(Hs,14))}
5889
5893
  Stop
5890
5894
  </button>`:c==="failed"&&(r=u`
5891
5895
  <button class="action-btn action-btn--primary" @click=${Tg}>
5892
- ${k(R(bs,14))}
5896
+ ${T(R(bs,14))}
5893
5897
  Resume
5894
5898
  </button>`)}}else if(O.section==="active")t="Running Pipelines",s=!0;else if(O.section==="history"){if(t="History",s=!0,O.runId){let n=Object.values(e.runs).find(c=>c.id===O.runId)?.pipeline_status,a=Os?.runId===O.runId?Os.action:null;a==="stop"?r=u`
5895
5899
  <button class="action-btn action-btn--danger" disabled>
5896
- ${k(R(De,14,"icon-spin"))}
5900
+ ${T(R(De,14,"icon-spin"))}
5897
5901
  Stopping\u2026
5898
5902
  </button>`:a==="pause"?r=u`
5899
5903
  <button class="action-btn action-btn--amber" disabled>
5900
- ${k(R(De,14,"icon-spin"))}
5904
+ ${T(R(De,14,"icon-spin"))}
5901
5905
  Pausing\u2026
5902
5906
  </button>`:a==="resume"?r=u`
5903
5907
  <button class="action-btn action-btn--primary" disabled>
5904
- ${k(R(De,14,"icon-spin"))}
5908
+ ${T(R(De,14,"icon-spin"))}
5905
5909
  Resuming\u2026
5906
5910
  </button>`:n==="running"?r=u`
5907
5911
  <button class="action-btn action-btn--amber" @click=${()=>kh(O.runId)}>
5908
- ${k(R(rt,14))}
5912
+ ${T(R(rt,14))}
5909
5913
  Pause
5910
5914
  </button>
5911
5915
  <button class="action-btn action-btn--danger" @click=${()=>Ag(O.runId)}>
5912
- ${k(R(Hs,14))}
5916
+ ${T(R(Hs,14))}
5913
5917
  Stop
5914
5918
  </button>`:n==="paused"?r=u`
5915
- <button class="action-btn action-btn--primary" @click=${()=>Uo(O.runId)}>
5916
- ${k(R(bs,14))}
5919
+ <button class="action-btn action-btn--primary" @click=${()=>Vo(O.runId)}>
5920
+ ${T(R(bs,14))}
5917
5921
  Resume
5918
5922
  </button>
5919
5923
  <button class="action-btn action-btn--danger" @click=${()=>Ag(O.runId)}>
5920
- ${k(R(Hs,14))}
5924
+ ${T(R(Hs,14))}
5921
5925
  Stop
5922
5926
  </button>`:n==="failed"&&(r=u`
5923
- <button class="action-btn action-btn--primary" @click=${()=>Uo(O.runId)}>
5924
- ${k(R(bs,14))}
5927
+ <button class="action-btn action-btn--primary" @click=${()=>Vo(O.runId)}>
5928
+ ${T(R(bs,14))}
5925
5929
  Resume
5926
5930
  </button>`)}}else if(O.section==="new-run"){t="New Pipeline",s=!0;let o=ff();r=u`
5927
5931
  <button class="action-btn action-btn--primary" ?disabled=${o.isSubmitting}
5928
5932
  @click=${()=>mf({rerender:j,onStarted:()=>Ie("active",null,O.projectId),projectId:I.getState().currentProjectId})}>
5929
5933
 
5930
- ${k(R(bs,14))}
5934
+ ${T(R(bs,14))}
5931
5935
  ${o.isSubmitting?"Starting\u2026":"Start"}
5932
5936
  </button>`}else O.section==="webhooks"?(t="Webhook Inbox",s=!0,(e.webhookInbox?.events||[]).length>0&&(r=u`
5933
5937
  <button class="action-btn action-btn--danger" @click=${Og}>
5934
- ${k(R(gi,14))}
5938
+ ${T(R(gi,14))}
5935
5939
  Clear
5936
5940
  </button>`)):O.section==="costs"?(t="Token & Cost Dashboard",s=!0):O.section==="settings"?(t="Settings",s=!0):O.section==="project-settings"&&(t="Project Settings",s=!0);return!O.section&&!O.runId&&(r=u`
5937
5941
  <button class="action-btn action-btn--primary" @click=${()=>Ie("new-run",null,O.projectId)}>
5938
- ${k(R(Zt,14))}
5942
+ ${T(R(Zt,14))}
5939
5943
  New Pipeline
5940
5944
  </button>`),u`
5941
5945
  <div class="content-header">
5942
5946
  ${s?u`
5943
5947
  <button class="content-header-back" @click=${eC}>
5944
- ${k(R(Va,18))}
5948
+ ${T(R(Ha,18))}
5945
5949
  </button>
5946
5950
  `:""}
5947
5951
  ${i||""}
@@ -5950,7 +5954,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5950
5954
  ${r}
5951
5955
  </div>`:""}
5952
5956
  </div>
5953
- `}function mC(){let e=I.getState(),t=Object.values(e.runs),s=e.currentProjectId,i=s&&(e.projects||[]).length>1?t.filter(l=>(l.project||l._project)===s):t,r={};for(let l of i)r[l.id]=l;let o=Object.values(e.archivedRuns),n=s&&(e.projects||[]).length>1?o.filter(l=>(l.project||l._project)===s):o,a={};for(let l of n)a[l.id]=l;let c={...e,runs:r,archivedRuns:a};if(O.section==="beads")return O.runId?dd(Rh,{statusFilter:$h,priorityFilter:Eh,starting:jo,startError:Ko,onStatusFilter:tC,onPriorityFilter:sC,onStartIssue:iC,onDismissError:rC,loading:Vo,run:I.getRunById(O.runId),runId:O.runId}):hd(i,{onSelectRun:$a,beadsCounts:Ah});if(O.runId){let l=I.getRunById(O.runId);if(!l&&e.runsLoaded&&s&&(e.projects||[]).length>1)return Ie(O.section,null,O.projectId),u``;let h={};if(l?.stages){for(let[S,$]of Object.entries(l.stages)){let x=$.iterations||[];x.length>0&&(h[S]=x.length)}PS(O.runId,l.stages)}let d=gC(e);d.currentLogStage=bt==="*"?null:bt,d.currentLogIteration=ai;let m=!!l?.active,p=Cc();l&&!p&&Un(l);let{overview:f,stages:_}=$f(l,Jt,{promptCache:Bs[O.runId]||{},onRestartStage:ZS,stageIterationTab:Ra,onStageTabChange:DS});return u`
5957
+ `}function mC(){let e=I.getState(),t=Object.values(e.runs),s=e.currentProjectId,i=s&&(e.projects||[]).length>1?t.filter(l=>(l.project||l._project)===s):t,r={};for(let l of i)r[l.id]=l;let o=Object.values(e.archivedRuns),n=s&&(e.projects||[]).length>1?o.filter(l=>(l.project||l._project)===s):o,a={};for(let l of n)a[l.id]=l;let c={...e,runs:r,archivedRuns:a};if(O.section==="beads")return O.runId?dd(Rh,{statusFilter:$h,priorityFilter:Eh,starting:Wo,startError:qo,onStatusFilter:tC,onPriorityFilter:sC,onStartIssue:iC,onDismissError:rC,loading:jo,run:I.getRunById(O.runId),runId:O.runId}):hd(i,{onSelectRun:Ca,beadsCounts:Ah});if(O.runId){let l=I.getRunById(O.runId);if(!l&&e.runsLoaded&&s&&(e.projects||[]).length>1)return Ie(O.section,null,O.projectId),u``;let h={};if(l?.stages){for(let[S,k]of Object.entries(l.stages)){let x=k.iterations||[];x.length>0&&(h[S]=x.length)}PS(O.runId,l.stages)}let d=gC(e);d.currentLogStage=bt==="*"?null:bt,d.currentLogIteration=ai;let m=!!l?.active,p=Sc();l&&!p&&jn(l);let{overview:f,stages:_}=$f(l,Jt,{promptCache:Bs[O.runId]||{},onRestartStage:ZS,stageIterationTab:Ea,onStageTabChange:DS});return u`
5954
5958
  <div class="run-detail run-detail-layout">
5955
5959
  <div class="run-detail-layout__overview">
5956
5960
  ${f}
@@ -5961,29 +5965,29 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5961
5965
  </div>
5962
5966
  <div class="run-detail-layout__logs">
5963
5967
  <div class="run-detail-column-header">Artifacts</div>
5964
- ${Cp(Cc(),m)}
5968
+ ${Cp(Sc(),m)}
5965
5969
  ${sf(d,{onStageFilter:HS,onIterationFilter:WS,onSearch:jS,onToggleAutoScroll:VS,autoScroll:xh,stageIterations:h,runStages:l?.stages})}
5966
5970
  ${kf(Th.get(O.runId))}
5967
5971
  ${md(l?.stages?.learn,{onRunLearn:pC})}
5968
5972
  </div>
5969
5973
  </div>
5970
- `}if(O.section==="webhooks")return Of(e,{selectedId:Wi,categoryFilter:Dh,runFilter:Ph,searchTerm:Mh,onSelectEvent:nC,onCategoryFilter:aC,onRunFilter:lC,onSearch:cC,onSetControl:hC,onClear:Og,onCopyJson:dC,onDismissDetail:uC});if(O.section==="costs")return La||Bg(),Df(c,{expandedRun:Ta,tokenData:Lh,onToggleRun:oC});if(O.section==="new-run")return gf(c,{rerender:j});if(O.section==="project-settings")return uf(e.preferences,{rerender:j,currentProjectId:e.currentProjectId||null});if(O.section==="settings")return df(e.preferences,{rerender:j,onThemeToggle:zS,onSaveSourceRepo:FS,onSaveNotifications:NS,onRequestPermission:()=>Go.requestPermission(),projects:e.projects||[],onProjectAdd:l=>{l?.openDialog?(I.setState({addProjectDialogOpen:!0}),j()):l?.name&&fetch("/api/projects").then(h=>h.json()).then(h=>{I.setState({projects:h.projects||[]}),j()}).catch(()=>{})},onProjectRemove:()=>{fetch("/api/projects").then(l=>l.json()).then(l=>{I.setState({projects:l.projects||[]}),j()}).catch(()=>{})},onProjectsRefresh:()=>{fetch("/api/projects").then(l=>l.json()).then(l=>{I.setState({projects:l.projects||[]}),j()}).catch(()=>{})}});if(O.section==="history")return Ef(i,"history",{onSelectRun:$a,onResume:Uo,onArchive:Ch,onUnarchive:GS,archivedRuns:n,statusFilter:ka,onStatusFilter:l=>{ka=l,j()}});if(O.section==="active"){let l=yt(i.filter(h=>h.active));return u`
5974
+ `}if(O.section==="webhooks")return Of(e,{selectedId:Wi,categoryFilter:Dh,runFilter:Ph,searchTerm:Mh,onSelectEvent:nC,onCategoryFilter:aC,onRunFilter:lC,onSearch:cC,onSetControl:hC,onClear:Og,onCopyJson:dC,onDismissDetail:uC});if(O.section==="costs")return Ta||Bg(),Df(c,{expandedRun:ka,tokenData:Lh,onToggleRun:oC});if(O.section==="new-run")return gf(c,{rerender:j});if(O.section==="project-settings")return uf(e.preferences,{rerender:j,currentProjectId:e.currentProjectId||null});if(O.section==="settings")return df(e.preferences,{rerender:j,onThemeToggle:zS,onSaveSourceRepo:FS,onSaveNotifications:NS,onRequestPermission:()=>Ko.requestPermission(),projects:e.projects||[],onProjectAdd:l=>{l?.openDialog?(I.setState({addProjectDialogOpen:!0}),j()):l?.name&&fetch("/api/projects").then(h=>h.json()).then(h=>{I.setState({projects:h.projects||[]}),j()}).catch(()=>{})},onProjectRemove:()=>{fetch("/api/projects").then(l=>l.json()).then(l=>{I.setState({projects:l.projects||[]}),j()}).catch(()=>{})},onProjectsRefresh:()=>{fetch("/api/projects").then(l=>l.json()).then(l=>{I.setState({projects:l.projects||[]}),j()}).catch(()=>{})}});if(O.section==="history")return Ef(i,"history",{onSelectRun:Ca,onResume:Vo,onArchive:Ch,onUnarchive:GS,archivedRuns:n,statusFilter:Sa,onStatusFilter:l=>{Sa=l,j()}});if(O.section==="active"){let l=yt(i.filter(h=>h.active));return u`
5971
5975
  <h3 class="dashboard-section-title">Active Runs</h3>
5972
5976
  ${l.length>0?u`
5973
5977
  <div class="active-group">
5974
5978
  <div class="run-list">
5975
- ${l.map(h=>Vt(h,{onClick:$a,onPause:kh,onResume:Uo,onArchive:Ch}))}
5979
+ ${l.map(h=>Vt(h,{onClick:Ca,onPause:kh,onResume:Vo,onArchive:Ch}))}
5976
5980
  </div>
5977
5981
  </div>
5978
5982
  `:u`<div class="empty-state">No running pipelines</div>`}
5979
5983
  `}return u`
5980
- ${ud(c,{onSelectRun:l=>Ie("active",l,O.projectId),onArchive:Ch,onNavigate:(l,h,d)=>{h&&typeof h=="object"&&h.statusFilter?(ka=h.statusFilter,Ie(l,null,O.projectId)):Ie(l,h||null,d||O.projectId)},onPause:kh,onResume:Uo})}
5984
+ ${ud(c,{onSelectRun:l=>Ie("active",l,O.projectId),onArchive:Ch,onNavigate:(l,h,d)=>{h&&typeof h=="object"&&h.statusFilter?(Sa=h.statusFilter,Ie(l,null,O.projectId)):Ie(l,h||null,d||O.projectId)},onPause:kh,onResume:Vo})}
5981
5985
  ${of(e.pipelines,{onPause:YS,onStop:XS,onResume:JS,onClick:l=>Ie("active",l,O.projectId)})}
5982
- `}function gC(e){let t=e.logLines;if(bt!=="*"&&(t=t.filter(s=>s.stage===bt)),Ea){let s=Ea.toLowerCase();t=t.filter(i=>(i.line||"").toLowerCase().includes(s))}return{...e,logLines:t}}function j(){let e=I.getState(),t=document.getElementById("app");t&&(sn(u`
5986
+ `}function gC(e){let t=e.logLines;if(bt!=="*"&&(t=t.filter(s=>s.stage===bt)),xa){let s=xa.toLowerCase();t=t.filter(i=>(i.line||"").toLowerCase().includes(s))}return{...e,logLines:t}}function j(){let e=I.getState(),t=document.getElementById("app");t&&(tn(u`
5983
5987
  <div class="app-shell">
5984
- ${Tf(e,O,Dg,{onNavigate:OS,onSelectRun:$a,onProjectChange:IS,onAddProject:()=>{I.setState({addProjectDialogOpen:!0}),j()}})}
5988
+ ${Tf(e,O,Dg,{onNavigate:OS,onSelectRun:Ca,onProjectChange:IS,onAddProject:()=>{I.setState({addProjectDialogOpen:!0}),j()}})}
5985
5989
  <main class="main-content">
5986
- ${Go.renderBanner()}
5990
+ ${Ko.renderBanner()}
5987
5991
  ${fC()}
5988
5992
  ${mC()}
5989
5993
  </main>
@@ -5991,7 +5995,7 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5991
5995
  ${li?u`
5992
5996
  <sl-dialog id="action-error-dialog" label="Pipeline Error" @sl-after-hide=${US}>
5993
5997
  <div class="error-dialog-body">
5994
- ${k(R(Gi,32,"error-dialog-icon"))}
5998
+ ${T(R(Gi,32,"error-dialog-icon"))}
5995
5999
  <p>${li}</p>
5996
6000
  </div>
5997
6001
  <sl-button slot="footer" variant="primary" @click=${()=>{document.getElementById("action-error-dialog")?.hide()}}>OK</sl-button>
@@ -5999,5 +6003,5 @@ ${yc}${"\u2500".repeat(40)} Iteration ${e} ${"\u2500".repeat(40)}${Vn}
5999
6003
  `:""}
6000
6004
  ${Ir()}
6001
6005
  ${rd(e,{onProjectAdd:s=>{I.setState({addProjectDialogOpen:!1}),fetch("/api/projects").then(i=>i.json()).then(i=>{I.setState({projects:i.projects||[]}),j()}).catch(()=>{})},onClose:()=>{I.setState({addProjectDialogOpen:!1}),j()},rerender:j})}
6002
- `,t),O.runId&&(bt!=="*"&&tf(O.runId),Sp(O.runId)))}var Lg=!1;function _C(){if(Lg)return;let e=document.querySelector(".main-content");e&&(e.addEventListener("scroll",()=>{let t=e.querySelector(".content-header");t&&t.classList.toggle("content-header--scrolled",e.scrollTop>10)},{passive:!0}),Lg=!0)}Go.setRerender(j);I.subscribe(()=>j());Ur(I.getState().preferences.theme);O.projectId&&I.setState({currentProjectId:O.projectId});zh();O.section==="settings"&&ti(null).then(()=>j());O.section==="project-settings"&&ti(I.getState().currentProjectId||null).then(()=>j());j();_C();
6006
+ `,t),O.runId&&(bt!=="*"&&tf(O.runId),Sp(O.runId)))}var Lg=!1;function _C(){if(Lg)return;let e=document.querySelector(".main-content");e&&(e.addEventListener("scroll",()=>{let t=e.querySelector(".content-header");t&&t.classList.toggle("content-header--scrolled",e.scrollTop>10)},{passive:!0}),Lg=!0)}Ko.setRerender(j);I.subscribe(()=>j());Vr(I.getState().preferences.theme);O.projectId&&I.setState({currentProjectId:O.projectId});zh();O.section==="settings"&&ti(null).then(()=>j());O.section==="project-settings"&&ti(I.getState().currentProjectId||null).then(()=>j());j();_C();
6003
6007
  //# sourceMappingURL=main.bundle.js.map