@sma1lboy/rove 0.9.294 → 0.9.295-next.319

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.
Files changed (59) hide show
  1. package/dist/cli/chunk-01xa5ys8.js +3 -0
  2. package/dist/cli/{chunk-434886z8.js → chunk-0ya37mzg.js} +1 -1
  3. package/dist/cli/{chunk-k0tx8ybc.js → chunk-13typ0jk.js} +1 -1
  4. package/dist/cli/{chunk-k0tqjnbb.js → chunk-208gaccf.js} +1 -1
  5. package/dist/cli/{chunk-khcgbts9.js → chunk-2aks2qc2.js} +1 -1
  6. package/dist/cli/{chunk-m7yw9d7k.js → chunk-31zy7k62.js} +1 -1
  7. package/dist/cli/{chunk-j96df7ae.js → chunk-362e5h9b.js} +1 -1
  8. package/dist/cli/{chunk-zs428z6r.js → chunk-3phydb23.js} +1 -1
  9. package/dist/cli/{chunk-c5aw9yrt.js → chunk-41tf7b21.js} +1 -1
  10. package/dist/cli/{chunk-02fh3406.js → chunk-539a4gmw.js} +1 -1
  11. package/dist/cli/{chunk-e62qpmrh.js → chunk-54fxckr1.js} +1 -1
  12. package/dist/cli/{chunk-z74pj630.js → chunk-5n94gkv7.js} +1 -1
  13. package/dist/cli/{chunk-am82s655.js → chunk-6d5sjgd8.js} +1 -1
  14. package/dist/cli/{chunk-c9jdz10a.js → chunk-7yhd1fxc.js} +1 -1
  15. package/dist/cli/{chunk-90v6rdc7.js → chunk-80bzwf6j.js} +1 -1
  16. package/dist/cli/{chunk-f7kaxhs0.js → chunk-88h7naaq.js} +1 -1
  17. package/dist/cli/{chunk-xchzbpyz.js → chunk-8wttdgtk.js} +1 -1
  18. package/dist/cli/{chunk-mezj6vmr.js → chunk-948dfvxe.js} +1 -1
  19. package/dist/cli/{chunk-m2n78yy0.js → chunk-99e4cwpe.js} +1 -1
  20. package/dist/cli/{chunk-t10f6ybb.js → chunk-a10me8cf.js} +1 -1
  21. package/dist/cli/{chunk-wxx1art9.js → chunk-ap685n80.js} +1 -1
  22. package/dist/cli/{chunk-79rmjvqm.js → chunk-aqba3ms1.js} +4 -4
  23. package/dist/cli/{chunk-03t4t0sn.js → chunk-atsscywc.js} +2 -2
  24. package/dist/cli/{chunk-f28gnjvp.js → chunk-bs1e4382.js} +1 -1
  25. package/dist/cli/{chunk-j92hev7v.js → chunk-bs6d1pkg.js} +1 -1
  26. package/dist/cli/{chunk-c3jd6f68.js → chunk-cvhf14sm.js} +1 -1
  27. package/dist/cli/{chunk-agacwtcz.js → chunk-d450cm7e.js} +1 -1
  28. package/dist/cli/{chunk-9zm62ndy.js → chunk-dg018cf7.js} +1 -1
  29. package/dist/cli/{chunk-98d0rpdv.js → chunk-dg9c0bfh.js} +1 -1
  30. package/dist/cli/{chunk-7zkc31ax.js → chunk-dttgc44k.js} +1 -1
  31. package/dist/cli/{chunk-8r8ba78e.js → chunk-e9d3tm89.js} +1 -1
  32. package/dist/cli/{chunk-b5epzfht.js → chunk-exyeqndp.js} +1 -1
  33. package/dist/cli/{chunk-6be8b4v2.js → chunk-hdxna9t9.js} +1 -1
  34. package/dist/cli/{chunk-25hw5fb2.js → chunk-hexx6ryy.js} +2 -2
  35. package/dist/cli/{chunk-mcb74w0j.js → chunk-k0f912qf.js} +1 -1
  36. package/dist/cli/{chunk-592mrege.js → chunk-krx6k0nc.js} +2 -2
  37. package/dist/cli/{chunk-ea4zm7g0.js → chunk-m29s2m81.js} +1 -1
  38. package/dist/cli/{chunk-d5fdbrd9.js → chunk-m7q4m1fq.js} +1 -1
  39. package/dist/cli/{chunk-j34tg4mx.js → chunk-q0ahw1x4.js} +1 -1
  40. package/dist/cli/{chunk-7h7dfp3b.js → chunk-qvzfhncv.js} +1 -1
  41. package/dist/cli/{chunk-j93b42yv.js → chunk-rgx715cp.js} +1 -1
  42. package/dist/cli/{chunk-61pxwadx.js → chunk-s6e1npcn.js} +1 -1
  43. package/dist/cli/{chunk-a0p8t1p5.js → chunk-t4w9pjzb.js} +2 -2
  44. package/dist/cli/{chunk-qys9g9sb.js → chunk-vg68mg6p.js} +1 -1
  45. package/dist/cli/{chunk-z4017ss3.js → chunk-wz1c0xqw.js} +1 -1
  46. package/dist/cli/{chunk-d9jf96nf.js → chunk-xrq0tfy9.js} +1 -1
  47. package/dist/cli/{chunk-skv8cv3z.js → chunk-ykmmhcs6.js} +1 -1
  48. package/dist/cli/{chunk-8y160wdx.js → chunk-ys942a6z.js} +2 -2
  49. package/dist/cli/{chunk-0tqfnw3h.js → chunk-yt6xnvd1.js} +1 -1
  50. package/dist/cli/{chunk-9x404t1p.js → chunk-z127y2a3.js} +1 -1
  51. package/dist/cli/{chunk-jat715c6.js → chunk-zgckm896.js} +1 -1
  52. package/dist/cli/index.js +2 -2
  53. package/dist/cli/rove.js +3 -3
  54. package/dist/skills/rove/SKILL.md +2 -2
  55. package/dist/web/assets/{index-BXCepdnn.js → index-DDALm7-O.js} +2 -2
  56. package/dist/web/assets/{term-mount-C5HqiLAQ.js → term-mount-B1mCULdd.js} +2 -2
  57. package/dist/web/index.html +1 -1
  58. package/package.json +1 -1
  59. package/dist/cli/chunk-m9b8afhp.js +0 -3
@@ -1,4 +1,4 @@
1
- import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./index-BXCepdnn.js";var h=0,g=0,_=0,v=0,y;(e=>{function t(e,t,n,r){return r===void 0?`#${C(e)}${C(t)}${C(n)}`:`#${C(e)}${C(t)}${C(n)}${C(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(y||={});var ee;(e=>{function t(e,t){if(v=(t.rgba&255)/255,v===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return h=a+Math.round((n-a)*v),g=o+Math.round((r-o)*v),_=s+Math.round((i-s)*v),{css:y.toCss(h,g,_),rgba:y.toRgba(h,g,_)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=S.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return y.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[h,g,_]=S.toChannels(t),{css:y.toCss(h,g,_),rgba:t}}e.opaque=i;function a(e,t){return v=Math.round(t*255),[h,g,_]=S.toChannels(e.rgba),{css:y.toCss(h,g,_,v),rgba:y.toRgba(h,g,_,v)}}e.opacity=a;function o(e,t){return v=e.rgba&255,a(e,v*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(ee||={});var b;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return h=parseInt(e.slice(1,2).repeat(2),16),g=parseInt(e.slice(2,3).repeat(2),16),_=parseInt(e.slice(3,4).repeat(2),16),y.toColor(h,g,_);case 5:return h=parseInt(e.slice(1,2).repeat(2),16),g=parseInt(e.slice(2,3).repeat(2),16),_=parseInt(e.slice(3,4).repeat(2),16),v=parseInt(e.slice(4,5).repeat(2),16),y.toColor(h,g,_,v);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return h=parseInt(r[1]),g=parseInt(r[2]),_=parseInt(r[3]),v=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),y.toColor(h,g,_,v);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[h,g,_,v]=t.getImageData(0,0,1,1).data,v!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:y.toRgba(h,g,_,v),css:e}}e.toColor=r})(b||={});var x;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(x||={});var S;(e=>{function t(e,t){if(v=(t&255)/255,v===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return h=a+Math.round((n-a)*v),g=o+Math.round((r-o)*v),_=s+Math.round((i-s)*v),y.toRgba(h,g,_)}e.blend=t;function n(e,t,n){let a=x.relativeLuminance(e>>8),o=x.relativeLuminance(t>>8);if(w(a,o)<n){if(o<a){let o=r(e,t,n),s=w(a,x.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>w(a,x.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=w(a,x.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>w(a,x.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(S||={});function C(e){let t=e.toString(16);return t.length<2?`0`+t:t}function w(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var te=Object.freeze((()=>{let e=[b.toColor(`#2e3436`),b.toColor(`#cc0000`),b.toColor(`#4e9a06`),b.toColor(`#c4a000`),b.toColor(`#3465a4`),b.toColor(`#75507b`),b.toColor(`#06989a`),b.toColor(`#d3d7cf`),b.toColor(`#555753`),b.toColor(`#ef2929`),b.toColor(`#8ae234`),b.toColor(`#fce94f`),b.toColor(`#729fcf`),b.toColor(`#ad7fa8`),b.toColor(`#34e2e2`),b.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:y.toCss(r,i,a),rgba:y.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:y.toCss(n,n,n),rgba:y.toRgba(n,n,n)})}return e})());function T(e,t,n){return Math.max(t,Math.min(e,n))}function ne(e){switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`}return e}var E=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function re(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function D(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function ie(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var O=class extends E{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!D(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
1
+ import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./index-DDALm7-O.js";var h=0,g=0,_=0,v=0,y;(e=>{function t(e,t,n,r){return r===void 0?`#${C(e)}${C(t)}${C(n)}`:`#${C(e)}${C(t)}${C(n)}${C(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(y||={});var ee;(e=>{function t(e,t){if(v=(t.rgba&255)/255,v===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return h=a+Math.round((n-a)*v),g=o+Math.round((r-o)*v),_=s+Math.round((i-s)*v),{css:y.toCss(h,g,_),rgba:y.toRgba(h,g,_)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=S.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return y.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[h,g,_]=S.toChannels(t),{css:y.toCss(h,g,_),rgba:t}}e.opaque=i;function a(e,t){return v=Math.round(t*255),[h,g,_]=S.toChannels(e.rgba),{css:y.toCss(h,g,_,v),rgba:y.toRgba(h,g,_,v)}}e.opacity=a;function o(e,t){return v=e.rgba&255,a(e,v*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(ee||={});var b;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return h=parseInt(e.slice(1,2).repeat(2),16),g=parseInt(e.slice(2,3).repeat(2),16),_=parseInt(e.slice(3,4).repeat(2),16),y.toColor(h,g,_);case 5:return h=parseInt(e.slice(1,2).repeat(2),16),g=parseInt(e.slice(2,3).repeat(2),16),_=parseInt(e.slice(3,4).repeat(2),16),v=parseInt(e.slice(4,5).repeat(2),16),y.toColor(h,g,_,v);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return h=parseInt(r[1]),g=parseInt(r[2]),_=parseInt(r[3]),v=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),y.toColor(h,g,_,v);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[h,g,_,v]=t.getImageData(0,0,1,1).data,v!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:y.toRgba(h,g,_,v),css:e}}e.toColor=r})(b||={});var x;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(x||={});var S;(e=>{function t(e,t){if(v=(t&255)/255,v===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return h=a+Math.round((n-a)*v),g=o+Math.round((r-o)*v),_=s+Math.round((i-s)*v),y.toRgba(h,g,_)}e.blend=t;function n(e,t,n){let a=x.relativeLuminance(e>>8),o=x.relativeLuminance(t>>8);if(w(a,o)<n){if(o<a){let o=r(e,t,n),s=w(a,x.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>w(a,x.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=w(a,x.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>w(a,x.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=w(x.relativeLuminance2(o,s,c),x.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(S||={});function C(e){let t=e.toString(16);return t.length<2?`0`+t:t}function w(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var te=Object.freeze((()=>{let e=[b.toColor(`#2e3436`),b.toColor(`#cc0000`),b.toColor(`#4e9a06`),b.toColor(`#c4a000`),b.toColor(`#3465a4`),b.toColor(`#75507b`),b.toColor(`#06989a`),b.toColor(`#d3d7cf`),b.toColor(`#555753`),b.toColor(`#ef2929`),b.toColor(`#8ae234`),b.toColor(`#fce94f`),b.toColor(`#729fcf`),b.toColor(`#ad7fa8`),b.toColor(`#34e2e2`),b.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:y.toCss(r,i,a),rgba:y.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:y.toCss(n,n,n),rgba:y.toRgba(n,n,n)})}return e})());function T(e,t,n){return Math.max(t,Math.min(e,n))}function ne(e){switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`}return e}var E=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function re(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function D(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function ie(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var O=class extends E{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!D(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
2
2
  `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&D(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&D(i,o)&&D(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!re(e,t),i=!D(e,t),a=!ie(e,t);if(r||i||a){if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!D(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(D(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(D(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},k=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:T(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new O(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new A(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:T(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},A=class extends E{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,this._ansiColors=t._core._themeService?t._core._themeService.colors.ansi:te}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!re(e,t),i=!D(e,t),a=!ie(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=ne(e.getChars())}_serializeString(){return this._htmlContent}},ae=[[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]],oe=[[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]],j;function se(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var ce=class{constructor(){if(this.version=`6`,!j){j=new Uint8Array(65536),j.fill(1),j[0]=0,j.fill(0,1,32),j.fill(0,127,160),j.fill(2,4352,4448),j[9001]=2,j[9002]=2,j.fill(2,11904,42192),j[12351]=1,j.fill(2,44032,55204),j.fill(2,63744,64256),j.fill(2,65040,65050),j.fill(2,65072,65136),j.fill(2,65280,65377),j.fill(2,65504,65511);for(let e=0;e<ae.length;++e)j.fill(0,ae[e][0],ae[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?j[e]:se(e,oe)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Ke.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Ke.createPropertyValue(0,n,r)}},le=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?me.isErrorNoTelemetry(e)?new me(e.message+`
3
3
 
4
4
  `+e.stack):Error(e.message+`
@@ -90,4 +90,4 @@ out vec4 outColor;
90
90
 
91
91
  void main() {
92
92
  outColor = v_color;
93
- }`,zf=8,Bf=zf*Float32Array.BYTES_PER_ELEMENT,Vf=20*zf,Hf=class{constructor(){this.attributes=new Float32Array(Vf),this.count=0}},Uf=0,Wf=0,Gf=0,Kf=0,qf=0,Jf=0,Yf=0,Xf=class extends Eu{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Hf,this._verticesCursor=new Hf;let i=this._gl;this._program=X(_f(i,Lf,Rf)),this._register(Cu(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Cu(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Cu(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Cu(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Bf,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Bf,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Bf,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,gf),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*jf,d=e.cells[u+Mf],f=e.cells[u+Nf],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*zf,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*zf,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*zf,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Uf=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Uf=(n&16777215)<<8;break;default:Uf=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Uf=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Uf=(r&16777215)<<8;break;default:Uf=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=yf(e.attributes,this._terminal.rows*this._terminal.cols*zf)),Wf=i*this._dimensions.device.cell.width,Gf=o*this._dimensions.device.cell.height,Kf=(Uf>>24&255)/255,qf=(Uf>>16&255)/255,Jf=(Uf>>8&255)/255,Yf=1,this._addRectangle(e.attributes,t,Wf,Gf,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Kf,qf,Jf,Yf)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Zf=class extends Eu{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(Cu(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lf(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=fd,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Qf=class extends Zf{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&sf(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},$f=typeof window==`object`?window:globalThis,ep=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(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ep.INSTANCE=new ep;var tp=ep;function np(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}tp.INSTANCE.onDidChangeZoomLevel,tp.INSTANCE.onDidChangeFullscreen;var rp=typeof navigator==`object`?navigator.userAgent:``;rp.indexOf(`Firefox`);var ip=rp.indexOf(`AppleWebKit`)>=0;!(rp.indexOf(`Chrome`)>=0)&&rp.indexOf(`Safari`),rp.indexOf(`Electron/`),rp.indexOf(`Android`);var ap=!1;if(typeof $f.matchMedia==`function`){let e=$f.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$f.matchMedia(`(display-mode: fullscreen)`);ap=e.matches,np($f,e,({matches:e})=>{ap&&t.matches||(ap=e)})}function op(){return ap}var sp=`en`,cp=!1,lp=!1,up=!1,dp=sp,fp,pp=globalThis,mp;typeof pp.vscode<`u`&&typeof pp.vscode.process<`u`?mp=pp.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(mp=process);var hp=typeof mp?.versions?.electron==`string`&&mp?.type===`renderer`;if(typeof mp==`object`){mp.platform,mp.platform,cp=mp.platform===`linux`,cp&&mp.env.SNAP&&mp.env.SNAP_REVISION,mp.env.CI||mp.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dp=sp;let e=mp.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dp=t.resolvedLanguage||sp,t.languagePack?.translationsConfigFile}catch{}lp=!0}else typeof navigator==`object`&&!hp?(fp=navigator.userAgent,fp.indexOf(`Windows`),fp.indexOf(`Macintosh`),(fp.indexOf(`Macintosh`)>=0||fp.indexOf(`iPad`)>=0||fp.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,cp=fp.indexOf(`Linux`)>=0,fp?.indexOf(`Mobi`),up=!0,dp=globalThis._VSCODE_NLS_LANGUAGE||sp,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var gp=lp;up&&typeof pp.importScripts==`function`&&pp.origin;var _p=fp,vp=dp,yp;(e=>{function t(){return vp}e.value=t;function n(){return vp.length===2?vp===`en`:vp.length>=3&&vp[0]===`e`&&vp[1]===`n`&&vp[2]===`-`}e.isDefaultVariant=n;function r(){return vp===`en`}e.isDefault=r})(yp||={});var bp=typeof pp.postMessage==`function`&&!pp.importScripts;(()=>{if(bp){let e=[];pp.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),pp.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xp=!!(_p&&_p.indexOf(`Chrome`)>=0);_p&&_p.indexOf(`Firefox`),!xp&&_p&&_p.indexOf(`Safari`),_p&&_p.indexOf(`Edg/`),_p&&_p.indexOf(`Android`);var Sp=typeof navigator==`object`?navigator:{};gp||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Sp&&Sp.clipboard&&Sp.clipboard.writeText,gp||Sp&&Sp.clipboard&&Sp.clipboard.readText,gp||op()||Sp.keyboard,`ontouchstart`in $f||Sp.maxTouchPoints,$f.PointerEvent&&(`ontouchstart`in $f||navigator.maxTouchPoints);var Cp=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}},wp=new Cp,Tp=new Cp,Ep=new Cp;Array(230);var Dp;(e=>{function t(e){return wp.keyCodeToStr(e)}e.toString=t;function n(e){return wp.strToKeyCode(e)}e.fromString=n;function r(e){return Tp.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ep.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Tp.strToKeyCode(e)||Ep.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return wp.keyCodeToStr(e)}e.toElectronAccelerator=o})(Dp||={});var Op=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kp;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Ap?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ld.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Op})})(kp||={});var Ap=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?Op:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var jp;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(jp||={});var Mp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ld.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Mp.EMPTY=Mp.fromArray([]);function Np(e){return Pp(e,0)}function Pp(e,t){switch(typeof e){case`object`:return e===null?Fp(349,t):Array.isArray(e)?Rp(e,t):zp(e,t);case`string`:return Lp(e,t);case`boolean`:return Ip(e,t);case`number`:return Fp(e,t);case`undefined`:return Fp(937,t);default:return Fp(617,t)}}function Fp(e,t){return(t<<5)-t+e|0}function Ip(e,t){return Fp(e?433:863,t)}function Lp(e,t){t=Fp(149417,t);for(let n=0,r=e.length;n<r;n++)t=Fp(e.charCodeAt(n),t);return t}function Rp(e,t){return t=Fp(104579,t),e.reduce((e,t)=>Pp(t,e),t)}function zp(e,t){return t=Fp(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Lp(n,t),Pp(e[n],t)),t)}var{registerWindow:Bp,getWindow:Vp,getDocument:Hp,getWindows:Up,getWindowsCount:Wp,getWindowId:Gp,getWindowById:Kp,hasWindow:qp,onDidRegisterWindow:Jp,onWillUnregisterWindow:Yp,onDidUnregisterWindow:Xp}=function(){let e=new Map,t={window:$f,disposables:new Tu};e.set($f.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Eu.None;let a=new Tu,o={window:t,disposables:a.add(new Tu)};return e.set(t.vscodeWindowId,o),a.add(Cu(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Qp(t,em.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:$f},getDocument(e){return Vp(e).document}}}(),Zp=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function Qp(e,t,n,r){return new Zp(e,t,n,r)}var $p=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};$p.None=new $p(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Np(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Cu(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var em={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:ip?`webkitAnimationStart`:`animationstart`,ANIMATION_END:ip?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:ip?`webkitAnimationIteration`:`animationiteration`},tm=class extends Eu{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new Du,this._charAtlasDisposable=this._register(new Du),this._observerDisposable=this._register(new Du),this._model=new If,this._workCell=new hf,this._workCell2=new hf,this._rectangleRenderer=this._register(new Du),this._glyphRenderer=this._register(new Du),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ud(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qf(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=ed(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Qp(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Qp(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,uf(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pf(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=pf(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Cu(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),uf(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Xf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Of(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=lf(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Su(Ld.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ld.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ff(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,ee;e=rm(e,n.rows-1,0),t=rm(t,n.rows-1,0);let b=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,S=x-n.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),w=-1,te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=x===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||C<p[0]||C>=p[1],d?(l=!0,r=new nm(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*jf,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),te&&o===x&&(y===C&&(this._model.cursor={x:C,y:S,width:r.getWidth(),style:this._coreBrowserService.isFocused?b:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},w=C+r.getWidth()-1),y>=C&&y<=w&&(this._coreBrowserService.isFocused&&b===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+Mf]!==this._cellColorResolver.result.bg||this._model.cells[v+Nf]!==this._cellColorResolver.result.fg||this._model.cells[v+Pf]!==this._cellColorResolver.result.ext)&&(T=!0,h.length>1&&(g|=Ff),this._model.cells[v]=g,this._model.cells[v+Mf]=this._cellColorResolver.result.bg,this._model.cells[v+Nf]=this._cellColorResolver.result.fg,this._model.cells[v+Pf]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)ee=(a*n.cols+y)*jf,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Fu,0,0),this._model.cells[ee]=0,this._model.cells[ee+Mf]=this._cellColorResolver.result.bg,this._model.cells[ee+Nf]=this._cellColorResolver.result.fg,this._model.cells[ee+Pf]=this._cellColorResolver.result.ext;y--}}T&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},nm=class extends Md{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function rm(e,t,n=0){return Math.max(Math.min(e,t),n)}var im=`di$target`,am=`di$dependencies`,om=new Map;function sm(e){if(om.has(e))return om.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);cm(t,e,r)};return t._id=e,om.set(e,t),t}function cm(e,t,n){t[im]===t?t[am].push({id:e,index:n}):(t[am]=[{id:e,index:n}],t[im]=t)}sm(`BufferService`),sm(`CoreMouseService`),sm(`CoreService`),sm(`CharsetService`),sm(`InstantiationService`),sm(`LogService`);var lm=sm(`OptionsService`);sm(`OscLinkService`),sm(`UnicodeService`),sm(`DecorationService`);var um={trace:0,debug:1,info:2,warn:3,error:4,off:5},dm=`xterm.js: `,fm=class extends Eu{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),pm=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=um[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:dm)+t,...n)}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)}};fm=au([ou(0,lm)],fm);var pm,mm=class extends Eu{constructor(e){if(Nu&&Pu()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new tm(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Ld.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ld.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ld.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ld.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(Cu(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},hm=!1;function gm(){if(hm)return;hm=!0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e||(e.font=` 12px monospace`,e.font.startsWith(`12px`)))return;let t=Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,`font`),{get:n,set:r}=t??{};!t||!n||!r||Object.defineProperty(CanvasRenderingContext2D.prototype,"font",{...t,set(e){r.call(this,typeof e==`string`?e.trim():e)}})}var _m=`normal`,vm=0;function ym(){vm||=(_m=_m===`normal`?`400`:`normal`,requestAnimationFrame(()=>{vm=0}))}function bm(e){let t=null,n=null,r=0,i=()=>{ym(),!r&&(r=requestAnimationFrame(()=>{r=0,e.options.fontWeight=_m}))};try{gm(),e.options.fontWeight=_m;let r=new Set(e.element?.querySelectorAll(`canvas`)),a=new mm;a.onContextLoss(()=>{a.dispose(),t=null}),a.onRemoveTextureAtlasCanvas(i),e.loadAddon(a),t=a,n=[...e.element?.querySelectorAll(`canvas`)??[]].find(e=>!r.has(e)&&!e.classList.contains(`xterm-link-layer`))??null}catch{}let a=new ResizeObserver(()=>{let n=e._core?._renderService;t&&n&&!n._isPaused&&typeof n._renderRows==`function`&&n._renderRows(0,e.rows-1)});if(n)try{a.observe(n,{box:`device-pixel-content-box`})}catch{}let o=()=>{t&&(t.clearTextureAtlas(),e.refresh(0,e.rows-1))};return document.fonts.addEventListener(`loadingdone`,o),{dispose(){document.fonts.removeEventListener(`loadingdone`,o),r&&cancelAnimationFrame(r),a.disconnect(),n?.getContext(`webgl2`)?.getExtension(`WEBGL_lose_context`)?.loseContext()}}}function xm(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function Sm(e){return!e||typeof e!=`object`||!(`stream`in e)||typeof e.stream!=`string`?null:{stream:e.stream,...`data`in e&&typeof e.data==`string`?{data:e.data}:{},...`code`in e&&(typeof e.code==`number`||e.code===null)?{code:e.code}:{}}}var Cm=65536,wm=20;function Tm(e){let t=0,n=null,r=()=>{n!==null&&window.clearTimeout(n),n=null,t>0&&e(t),t=0};return{parsed(e){t+=e,t>=Cm?r():n??=window.setTimeout(r,wm)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function Em(e){return!e||typeof e!=`object`||!(`stream`in e)||!(`replay`in e)?null:typeof e.stream==`string`&&typeof e.replay==`string`?{stream:e.stream,replay:e.replay}:null}var Dm=8,Om=new WeakMap,km=new Uint8Array([27,99]);function Am(e){let t=new Uint8Array(km.length+e.length);return t.set(km),t.set(e,km.length),t}function jm(r){let{client:u,el:h,taskId:g,tabId:_}=r,v=new Gc({fontFamily:c,fontSize:13,lineHeight:1.15,theme:a.get()??d,cursorBlink:!0,scrollback:e.get().prefs.scrollbackRows,allowProposedApi:!0,overviewRuler:{width:Dm},scrollOnUserInput:!1}),y=new ol(v);v.loadAddon(y);let ee=new k;v.loadAddon(ee),v.loadAddon(new et),v.unicode.activeVersion=`11`,v.loadAddon(new ot),v.open(h);let b=bm(v),x=Cl(v);y.fit();let S=qc(v,h,ee),C=!1;r.snapshot&&S.raise(r.snapshot),r.focusOnMount&&v.focus();let w=m(g,_,r.leafId),te=Om.get(u);te||(te=new Map,Om.set(u,te));let T=te.get(w)??{owners:0,attached:!1};T.owners++,te.set(w,T);let ne=()=>void u.request(`term.detach`,{stream:w}).catch(()=>{}),E=null,re=!1,D=null,ie=!1,O=Dl(e=>{E&&re&&u.request(`term.input`,{stream:E,data:e}).catch(()=>{})}),A=Tm(e=>{E&&u.request(`term.ack`,{stream:E,chars:e}).catch(()=>{})}),ae=(e,t,n)=>{x.push(e),v.write(e,()=>{n?.(),A.parsed(t)})},oe=u.on(`term.data`,e=>{let t=Sm(e);if(!t?.data||t.stream!==w)return;let n=xm(t.data);D?D.push({bytes:n,chars:t.data.length}):E&&ae(n,t.data.length)}),j=e=>v.rows<=2?Promise.resolve():u.request(`term.resize`,{stream:e,cols:v.cols,rows:v.rows-1}).then(()=>new Promise(e=>window.setTimeout(e,60))).then(()=>E===e?u.request(`term.resize`,{stream:e,cols:v.cols,rows:v.rows}):void 0),se=u.on(`term.reset`,e=>{let t=Em(e);if(!t||t.stream!==w||!E||D)return;let n=E;O.replay(e=>ae(Am(xm(t.replay)),t.replay.length,e)),re&&j(n).catch(()=>{})}),ce=u.on(`term.exit`,e=>{let t=Sm(e);!t||t.stream!==w||(re=!1,r.setNotice({kind:`exited`,code:t.code??null}),r.onExit(t.code??null))}),le=!1,ue=null,de=()=>{let e=v.buffer.active;for(let t=0;t<v.rows;t++)if(e.getLine(e.viewportY+t)?.translateToString(!0).trim())return!0;return!1},fe=e=>{if(!le){if(e&&!de()){ue??=v.onWriteParsed(()=>fe(!0));return}le=!0,ue?.dispose(),e?requestAnimationFrame(()=>requestAnimationFrame(()=>r.onPainted?.())):r.onPainted?.()}},pe=async()=>{D=[],E=null;try{let e=await u.request(`term.attach`,{taskId:g,tabId:_,...r.leafId&&r.leafId!==`leaf-1`?{leafId:r.leafId}:{},cols:v.cols,rows:v.rows,acks:!0}),t=te.get(w);if(t?t.attached=!0:ne(),ie)return;Be.reset(),C&&!S.raised&&S.raise(S.snapshot()),C=!0,Le=null,Re=!0,O.replay(t=>{let n=xm(e.replay);x.push(n),v.write(Am(n),()=>{Re=!1,t(),fe(!0)})});for(let e of D)ae(e.bytes,e.chars);E=e.stream,re=e.alive,e.alive&&v.rows>2?j(e.stream).then(()=>window.setTimeout(S.lower,250)).catch(S.lower):S.lower(),e.alive&&document.activeElement===v.textarea&&s.set(e.stream),r.setNotice(e.alive?{kind:`none`}:e.restored?{kind:`restored`}:{kind:`exited`,code:null})}catch(e){if(ie)return;e instanceof n&&e.code===`TAB_NOT_LIVE`?r.setNotice({kind:`notLive`}):e instanceof n&&e.code===`NOT_CONNECTED`||r.setNotice({kind:`failed`,message:e instanceof Error?e.message:String(e)})}finally{D=null,E||(S.lower(),fe(!1))}},me=()=>h.clientWidth>0&&h.clientHeight>0,he=!1,ge=u.onOpen(()=>{he=!me(),he||pe()}),_e=null,ve=v.onData(e=>{if(_e&&e.length===1){let t=_e;_e=null,t(),O.forward(f(e))}else O.forward(e)}),ye=nu(v),be=nl(v,e=>O.forward(e),ye.onKey),xe=0,Se=()=>{!E||!re||(xe=Date.now(),u.request(`term.resize`,{stream:E,cols:v.cols,rows:v.rows}).catch(()=>{}))},Ce=ye.onKey(()=>{Date.now()-xe>1e3&&Se()}),we=null,Te=v.onResize(({cols:e,rows:t})=>{we!==null&&window.clearTimeout(we),we=window.setTimeout(()=>{E&&re&&u.request(`term.resize`,{stream:E,cols:e,rows:t}).catch(()=>{})},80)}),Ee=()=>{i.get()!==null||!me()||(y.fit(),he&&(he=!1,pe()))},De=new ResizeObserver(Ee);De.observe(h);let Oe=i.subscribe(Ee),ke=e.subscribe(()=>{v.options.scrollback=e.get().prefs.scrollbackRows}),Ae=()=>{h.style.backgroundColor=(a.get()??d).background??``};Ae();let je=a.subscribe(()=>{v.options.theme=a.get()??d,Ae()});v.attachCustomKeyEventHandler(e=>{if(o(e))return e.preventDefault(),e.type===`keydown`&&ye.input(l),!1;if(e.type===`keydown`&&e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`v`&&/Mac|iPhone|iPad/.test(navigator.platform))return r.pasteImage(),!1;let n=t(e);if(!n)return!0;n===`copy`&&e.ctrlKey&&e.preventDefault();let i=v.getSelection();return i.trim().length===0?n===`interrupt-or-copy`:(r.copyText(i),v.clearSelection(),!1)});let Me=!1,Ne=e=>{Me=e.button===0},Pe=()=>{if(!Me)return;Me=!1;let e=v.getSelection();e.trim().length>0&&r.copyText(e)};h.addEventListener(`mousedown`,Ne),document.addEventListener(`mouseup`,Pe);let Fe=v.parser.registerOscHandler(52,e=>{let t=wl(e);return t&&r.copyText(t),!0}),Ie=v.textarea,Le=null,Re=!1,ze=0,Be=Zl(v,()=>{Le=null}),Ve=$l(h,v,Be),He=tu(h,v,Be),Ue=e=>{e.target instanceof Element&&e.target.closest(`.scrollbar`)&&(Le=null,Be.reset())};h.addEventListener(`mousedown`,Ue,{capture:!0});let We=()=>p(h);h.addEventListener(`wheel`,We,{capture:!0,passive:!0}),h.addEventListener(`touchmove`,We,{capture:!0,passive:!0});let Ge=()=>{if(!Re&&v.buffer.active.type===`normal`){let e=Ul(v.buffer.active);Le===null&&e>0&&(Le=e),ze=performance.now()}return!1},Ke=v.parser.registerCsiHandler({final:`J`},e=>e[0]===3&&Ge()),qe=v.parser.registerEscHandler({final:`c`},Ge),Je=()=>{Le=null,Be.reset(),Ul(v.buffer.active)>0&&v.scrollToBottom()},Ye=ye.onKey(Je);Ie?.addEventListener(`paste`,Je),Ie?.addEventListener(`compositionend`,Je);let Xe=()=>r.onScrolled(Ul(v.buffer.active)),Ze=v.onScroll(Xe),Qe=v.onWriteParsed(()=>{Le!==null&&performance.now()-ze>1e3&&(Le=null);let e=Wl(Le,v.buffer.active);e!==null&&v.scrollToLine(e),Xe()}),$e=e=>{Le=null,Be.reset(),e()},tt=()=>{s.set(E),Se(),r.onFocusChange(!0)},nt=()=>r.onFocusChange(!1);return Ie?.addEventListener(`focus`,tt),Ie?.addEventListener(`blur`,nt),{term:v,stream:w,scrollLines:e=>$e(()=>v.scrollLines(e)),scrollToTop:()=>$e(()=>v.scrollToTop()),scrollToBottom:()=>$e(()=>v.scrollToBottom()),armCtrl:e=>{_e=e},reattach:pe,snapshot:S.snapshot,dispose(){ie=!0,S.lower(),De.disconnect(),Ve(),He(),Be.dispose(),h.removeEventListener(`mousedown`,Ue,{capture:!0}),h.removeEventListener(`wheel`,We,{capture:!0}),h.removeEventListener(`touchmove`,We,{capture:!0}),Ie?.removeEventListener(`paste`,Je),Ie?.removeEventListener(`compositionend`,Je),Ke.dispose(),qe.dispose(),Ye.dispose(),je(),ke(),Oe(),we!==null&&window.clearTimeout(we),h.removeEventListener(`mousedown`,Ne),document.removeEventListener(`mouseup`,Pe),Fe.dispose(),Ie?.removeEventListener(`focus`,tt),Ie?.removeEventListener(`blur`,nt),Ze.dispose(),Qe.dispose(),ve.dispose(),be(),Ce.dispose(),ye.dispose(),Te.dispose(),ge(),oe(),ce(),se(),A.dispose(),E&&s.get()===E&&s.set(null),T.owners--,T.owners===0&&(te.delete(w),T.attached&&ne()),x.dispose(),v.dispose(),b.dispose()}}}export{jm as mountTerminal};
93
+ }`,zf=8,Bf=zf*Float32Array.BYTES_PER_ELEMENT,Vf=20*zf,Hf=class{constructor(){this.attributes=new Float32Array(Vf),this.count=0}},Uf=0,Wf=0,Gf=0,Kf=0,qf=0,Jf=0,Yf=0,Xf=class extends Eu{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Hf,this._verticesCursor=new Hf;let i=this._gl;this._program=X(_f(i,Lf,Rf)),this._register(Cu(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Cu(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Cu(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Cu(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Bf,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Bf,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Bf,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,gf),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*jf,d=e.cells[u+Mf],f=e.cells[u+Nf],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*zf,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*zf,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*zf,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*zf,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Uf=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Uf=(n&16777215)<<8;break;default:Uf=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Uf=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Uf=(r&16777215)<<8;break;default:Uf=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=yf(e.attributes,this._terminal.rows*this._terminal.cols*zf)),Wf=i*this._dimensions.device.cell.width,Gf=o*this._dimensions.device.cell.height,Kf=(Uf>>24&255)/255,qf=(Uf>>16&255)/255,Jf=(Uf>>8&255)/255,Yf=1,this._addRectangle(e.attributes,t,Wf,Gf,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Kf,qf,Jf,Yf)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Zf=class extends Eu{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(Cu(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lf(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=fd,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Qf=class extends Zf{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&sf(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},$f=typeof window==`object`?window:globalThis,ep=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(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ep.INSTANCE=new ep;var tp=ep;function np(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}tp.INSTANCE.onDidChangeZoomLevel,tp.INSTANCE.onDidChangeFullscreen;var rp=typeof navigator==`object`?navigator.userAgent:``;rp.indexOf(`Firefox`);var ip=rp.indexOf(`AppleWebKit`)>=0;!(rp.indexOf(`Chrome`)>=0)&&rp.indexOf(`Safari`),rp.indexOf(`Electron/`),rp.indexOf(`Android`);var ap=!1;if(typeof $f.matchMedia==`function`){let e=$f.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$f.matchMedia(`(display-mode: fullscreen)`);ap=e.matches,np($f,e,({matches:e})=>{ap&&t.matches||(ap=e)})}function op(){return ap}var sp=`en`,cp=!1,lp=!1,up=!1,dp=sp,fp,pp=globalThis,mp;typeof pp.vscode<`u`&&typeof pp.vscode.process<`u`?mp=pp.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(mp=process);var hp=typeof mp?.versions?.electron==`string`&&mp?.type===`renderer`;if(typeof mp==`object`){mp.platform,mp.platform,cp=mp.platform===`linux`,cp&&mp.env.SNAP&&mp.env.SNAP_REVISION,mp.env.CI||mp.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dp=sp;let e=mp.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dp=t.resolvedLanguage||sp,t.languagePack?.translationsConfigFile}catch{}lp=!0}else typeof navigator==`object`&&!hp?(fp=navigator.userAgent,fp.indexOf(`Windows`),fp.indexOf(`Macintosh`),(fp.indexOf(`Macintosh`)>=0||fp.indexOf(`iPad`)>=0||fp.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,cp=fp.indexOf(`Linux`)>=0,fp?.indexOf(`Mobi`),up=!0,dp=globalThis._VSCODE_NLS_LANGUAGE||sp,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var gp=lp;up&&typeof pp.importScripts==`function`&&pp.origin;var _p=fp,vp=dp,yp;(e=>{function t(){return vp}e.value=t;function n(){return vp.length===2?vp===`en`:vp.length>=3&&vp[0]===`e`&&vp[1]===`n`&&vp[2]===`-`}e.isDefaultVariant=n;function r(){return vp===`en`}e.isDefault=r})(yp||={});var bp=typeof pp.postMessage==`function`&&!pp.importScripts;(()=>{if(bp){let e=[];pp.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),pp.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xp=!!(_p&&_p.indexOf(`Chrome`)>=0);_p&&_p.indexOf(`Firefox`),!xp&&_p&&_p.indexOf(`Safari`),_p&&_p.indexOf(`Edg/`),_p&&_p.indexOf(`Android`);var Sp=typeof navigator==`object`?navigator:{};gp||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Sp&&Sp.clipboard&&Sp.clipboard.writeText,gp||Sp&&Sp.clipboard&&Sp.clipboard.readText,gp||op()||Sp.keyboard,`ontouchstart`in $f||Sp.maxTouchPoints,$f.PointerEvent&&(`ontouchstart`in $f||navigator.maxTouchPoints);var Cp=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}},wp=new Cp,Tp=new Cp,Ep=new Cp;Array(230);var Dp;(e=>{function t(e){return wp.keyCodeToStr(e)}e.toString=t;function n(e){return wp.strToKeyCode(e)}e.fromString=n;function r(e){return Tp.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ep.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Tp.strToKeyCode(e)||Ep.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return wp.keyCodeToStr(e)}e.toElectronAccelerator=o})(Dp||={});var Op=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kp;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Ap?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ld.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Op})})(kp||={});var Ap=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?Op:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var jp;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(jp||={});var Mp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ld.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Mp.EMPTY=Mp.fromArray([]);function Np(e){return Pp(e,0)}function Pp(e,t){switch(typeof e){case`object`:return e===null?Fp(349,t):Array.isArray(e)?Rp(e,t):zp(e,t);case`string`:return Lp(e,t);case`boolean`:return Ip(e,t);case`number`:return Fp(e,t);case`undefined`:return Fp(937,t);default:return Fp(617,t)}}function Fp(e,t){return(t<<5)-t+e|0}function Ip(e,t){return Fp(e?433:863,t)}function Lp(e,t){t=Fp(149417,t);for(let n=0,r=e.length;n<r;n++)t=Fp(e.charCodeAt(n),t);return t}function Rp(e,t){return t=Fp(104579,t),e.reduce((e,t)=>Pp(t,e),t)}function zp(e,t){return t=Fp(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Lp(n,t),Pp(e[n],t)),t)}var{registerWindow:Bp,getWindow:Vp,getDocument:Hp,getWindows:Up,getWindowsCount:Wp,getWindowId:Gp,getWindowById:Kp,hasWindow:qp,onDidRegisterWindow:Jp,onWillUnregisterWindow:Yp,onDidUnregisterWindow:Xp}=function(){let e=new Map,t={window:$f,disposables:new Tu};e.set($f.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Eu.None;let a=new Tu,o={window:t,disposables:a.add(new Tu)};return e.set(t.vscodeWindowId,o),a.add(Cu(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Qp(t,em.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:$f},getDocument(e){return Vp(e).document}}}(),Zp=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function Qp(e,t,n,r){return new Zp(e,t,n,r)}var $p=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};$p.None=new $p(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Np(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Cu(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var em={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:ip?`webkitAnimationStart`:`animationstart`,ANIMATION_END:ip?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:ip?`webkitAnimationIteration`:`animationiteration`},tm=class extends Eu{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new Du,this._charAtlasDisposable=this._register(new Du),this._observerDisposable=this._register(new Du),this._model=new If,this._workCell=new hf,this._workCell2=new hf,this._rectangleRenderer=this._register(new Du),this._glyphRenderer=this._register(new Du),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ud(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qf(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=ed(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Qp(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Qp(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,uf(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pf(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=pf(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Cu(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),uf(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Xf(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Of(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=lf(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Su(Ld.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ld.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ff(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,ee;e=rm(e,n.rows-1,0),t=rm(t,n.rows-1,0);let b=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,x=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,S=x-n.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),w=-1,te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let T=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=x===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||C<p[0]||C>=p[1],d?(l=!0,r=new nm(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*jf,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),te&&o===x&&(y===C&&(this._model.cursor={x:C,y:S,width:r.getWidth(),style:this._coreBrowserService.isFocused?b:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},w=C+r.getWidth()-1),y>=C&&y<=w&&(this._coreBrowserService.isFocused&&b===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+Mf]!==this._cellColorResolver.result.bg||this._model.cells[v+Nf]!==this._cellColorResolver.result.fg||this._model.cells[v+Pf]!==this._cellColorResolver.result.ext)&&(T=!0,h.length>1&&(g|=Ff),this._model.cells[v]=g,this._model.cells[v+Mf]=this._cellColorResolver.result.bg,this._model.cells[v+Nf]=this._cellColorResolver.result.fg,this._model.cells[v+Pf]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)ee=(a*n.cols+y)*jf,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Fu,0,0),this._model.cells[ee]=0,this._model.cells[ee+Mf]=this._cellColorResolver.result.bg,this._model.cells[ee+Nf]=this._cellColorResolver.result.fg,this._model.cells[ee+Pf]=this._cellColorResolver.result.ext;y--}}T&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},nm=class extends Md{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function rm(e,t,n=0){return Math.max(Math.min(e,t),n)}var im=`di$target`,am=`di$dependencies`,om=new Map;function sm(e){if(om.has(e))return om.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);cm(t,e,r)};return t._id=e,om.set(e,t),t}function cm(e,t,n){t[im]===t?t[am].push({id:e,index:n}):(t[am]=[{id:e,index:n}],t[im]=t)}sm(`BufferService`),sm(`CoreMouseService`),sm(`CoreService`),sm(`CharsetService`),sm(`InstantiationService`),sm(`LogService`);var lm=sm(`OptionsService`);sm(`OscLinkService`),sm(`UnicodeService`),sm(`DecorationService`);var um={trace:0,debug:1,info:2,warn:3,error:4,off:5},dm=`xterm.js: `,fm=class extends Eu{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),pm=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=um[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:dm)+t,...n)}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)}};fm=au([ou(0,lm)],fm);var pm,mm=class extends Eu{constructor(e){if(Nu&&Pu()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new tm(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Ld.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ld.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ld.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ld.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(Cu(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},hm=!1;function gm(){if(hm)return;hm=!0;let e=document.createElement(`canvas`).getContext(`2d`);if(!e||(e.font=` 12px monospace`,e.font.startsWith(`12px`)))return;let t=Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,`font`),{get:n,set:r}=t??{};!t||!n||!r||Object.defineProperty(CanvasRenderingContext2D.prototype,"font",{...t,set(e){r.call(this,typeof e==`string`?e.trim():e)}})}var _m=`normal`,vm=0;function ym(){vm||=(_m=_m===`normal`?`400`:`normal`,requestAnimationFrame(()=>{vm=0}))}function bm(e){let t=null,n=null,r=0,i=()=>{ym(),!r&&(r=requestAnimationFrame(()=>{r=0,e.options.fontWeight=_m}))};try{gm(),e.options.fontWeight=_m;let r=new Set(e.element?.querySelectorAll(`canvas`)),a=new mm;a.onContextLoss(()=>{a.dispose(),t=null}),a.onRemoveTextureAtlasCanvas(i),e.loadAddon(a),t=a,n=[...e.element?.querySelectorAll(`canvas`)??[]].find(e=>!r.has(e)&&!e.classList.contains(`xterm-link-layer`))??null}catch{}let a=new ResizeObserver(()=>{let n=e._core?._renderService;t&&n&&!n._isPaused&&typeof n._renderRows==`function`&&n._renderRows(0,e.rows-1)});if(n)try{a.observe(n,{box:`device-pixel-content-box`})}catch{}let o=()=>{t&&(t.clearTextureAtlas(),e.refresh(0,e.rows-1))};document.fonts.addEventListener(`loadingdone`,o);let s=()=>{document.visibilityState===`visible`&&o()};return document.addEventListener(`visibilitychange`,s),{dispose(){document.fonts.removeEventListener(`loadingdone`,o),document.removeEventListener(`visibilitychange`,s),r&&cancelAnimationFrame(r),a.disconnect(),n?.getContext(`webgl2`)?.getExtension(`WEBGL_lose_context`)?.loseContext()}}}function xm(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function Sm(e){return!e||typeof e!=`object`||!(`stream`in e)||typeof e.stream!=`string`?null:{stream:e.stream,...`data`in e&&typeof e.data==`string`?{data:e.data}:{},...`code`in e&&(typeof e.code==`number`||e.code===null)?{code:e.code}:{}}}var Cm=65536,wm=20;function Tm(e){let t=0,n=null,r=()=>{n!==null&&window.clearTimeout(n),n=null,t>0&&e(t),t=0};return{parsed(e){t+=e,t>=Cm?r():n??=window.setTimeout(r,wm)},dispose(){n!==null&&window.clearTimeout(n),n=null,t=0}}}function Em(e){return!e||typeof e!=`object`||!(`stream`in e)||!(`replay`in e)?null:typeof e.stream==`string`&&typeof e.replay==`string`?{stream:e.stream,replay:e.replay}:null}var Dm=8,Om=new WeakMap,km=new Uint8Array([27,99]);function Am(e){let t=new Uint8Array(km.length+e.length);return t.set(km),t.set(e,km.length),t}function jm(r){let{client:u,el:h,taskId:g,tabId:_}=r,v=new Gc({fontFamily:c,fontSize:13,lineHeight:1.15,theme:a.get()??d,cursorBlink:!0,scrollback:e.get().prefs.scrollbackRows,allowProposedApi:!0,overviewRuler:{width:Dm},scrollOnUserInput:!1}),y=new ol(v);v.loadAddon(y);let ee=new k;v.loadAddon(ee),v.loadAddon(new et),v.unicode.activeVersion=`11`,v.loadAddon(new ot),v.open(h);let b=bm(v),x=Cl(v);y.fit();let S=qc(v,h,ee),C=!1;r.snapshot&&S.raise(r.snapshot),r.focusOnMount&&v.focus();let w=m(g,_,r.leafId),te=Om.get(u);te||(te=new Map,Om.set(u,te));let T=te.get(w)??{owners:0,attached:!1};T.owners++,te.set(w,T);let ne=()=>void u.request(`term.detach`,{stream:w}).catch(()=>{}),E=null,re=!1,D=null,ie=!1,O=Dl(e=>{E&&re&&u.request(`term.input`,{stream:E,data:e}).catch(()=>{})}),A=Tm(e=>{E&&u.request(`term.ack`,{stream:E,chars:e}).catch(()=>{})}),ae=(e,t,n)=>{x.push(e),v.write(e,()=>{n?.(),A.parsed(t)})},oe=u.on(`term.data`,e=>{let t=Sm(e);if(!t?.data||t.stream!==w)return;let n=xm(t.data);D?D.push({bytes:n,chars:t.data.length}):E&&ae(n,t.data.length)}),j=e=>v.rows<=2?Promise.resolve():u.request(`term.resize`,{stream:e,cols:v.cols,rows:v.rows-1}).then(()=>new Promise(e=>window.setTimeout(e,60))).then(()=>E===e?u.request(`term.resize`,{stream:e,cols:v.cols,rows:v.rows}):void 0),se=u.on(`term.reset`,e=>{let t=Em(e);if(!t||t.stream!==w||!E||D)return;let n=E;O.replay(e=>ae(Am(xm(t.replay)),t.replay.length,e)),re&&j(n).catch(()=>{})}),ce=u.on(`term.exit`,e=>{let t=Sm(e);!t||t.stream!==w||(re=!1,r.setNotice({kind:`exited`,code:t.code??null}),r.onExit(t.code??null))}),le=!1,ue=null,de=()=>{let e=v.buffer.active;for(let t=0;t<v.rows;t++)if(e.getLine(e.viewportY+t)?.translateToString(!0).trim())return!0;return!1},fe=e=>{if(!le){if(e&&!de()){ue??=v.onWriteParsed(()=>fe(!0));return}le=!0,ue?.dispose(),e?requestAnimationFrame(()=>requestAnimationFrame(()=>r.onPainted?.())):r.onPainted?.()}},pe=async()=>{D=[],E=null;try{let e=await u.request(`term.attach`,{taskId:g,tabId:_,...r.leafId&&r.leafId!==`leaf-1`?{leafId:r.leafId}:{},cols:v.cols,rows:v.rows,acks:!0}),t=te.get(w);if(t?t.attached=!0:ne(),ie)return;Be.reset(),C&&!S.raised&&S.raise(S.snapshot()),C=!0,Le=null,Re=!0,O.replay(t=>{let n=xm(e.replay);x.push(n),v.write(Am(n),()=>{Re=!1,t(),fe(!0)})});for(let e of D)ae(e.bytes,e.chars);E=e.stream,re=e.alive,e.alive&&v.rows>2?j(e.stream).then(()=>window.setTimeout(S.lower,250)).catch(S.lower):S.lower(),e.alive&&document.activeElement===v.textarea&&s.set(e.stream),r.setNotice(e.alive?{kind:`none`}:e.restored?{kind:`restored`}:{kind:`exited`,code:null})}catch(e){if(ie)return;e instanceof n&&e.code===`TAB_NOT_LIVE`?r.setNotice({kind:`notLive`}):e instanceof n&&e.code===`NOT_CONNECTED`||r.setNotice({kind:`failed`,message:e instanceof Error?e.message:String(e)})}finally{D=null,E||(S.lower(),fe(!1))}},me=()=>h.clientWidth>0&&h.clientHeight>0,he=!1,ge=u.onOpen(()=>{he=!me(),he||pe()}),_e=null,ve=v.onData(e=>{if(_e&&e.length===1){let t=_e;_e=null,t(),O.forward(f(e))}else O.forward(e)}),ye=nu(v),be=nl(v,e=>O.forward(e),ye.onKey),xe=0,Se=()=>{!E||!re||(xe=Date.now(),u.request(`term.resize`,{stream:E,cols:v.cols,rows:v.rows}).catch(()=>{}))},Ce=ye.onKey(()=>{Date.now()-xe>1e3&&Se()}),we=null,Te=v.onResize(({cols:e,rows:t})=>{we!==null&&window.clearTimeout(we),we=window.setTimeout(()=>{E&&re&&u.request(`term.resize`,{stream:E,cols:e,rows:t}).catch(()=>{})},80)}),Ee=()=>{i.get()!==null||!me()||(y.fit(),he&&(he=!1,pe()))},De=new ResizeObserver(Ee);De.observe(h);let Oe=i.subscribe(Ee),ke=e.subscribe(()=>{v.options.scrollback=e.get().prefs.scrollbackRows}),Ae=()=>{h.style.backgroundColor=(a.get()??d).background??``};Ae();let je=a.subscribe(()=>{v.options.theme=a.get()??d,Ae()});v.attachCustomKeyEventHandler(e=>{if(o(e))return e.preventDefault(),e.type===`keydown`&&ye.input(l),!1;if(e.type===`keydown`&&e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`v`&&/Mac|iPhone|iPad/.test(navigator.platform))return r.pasteImage(),!1;let n=t(e);if(!n)return!0;n===`copy`&&e.ctrlKey&&e.preventDefault();let i=v.getSelection();return i.trim().length===0?n===`interrupt-or-copy`:(r.copyText(i),v.clearSelection(),!1)});let Me=!1,Ne=e=>{Me=e.button===0},Pe=()=>{if(!Me)return;Me=!1;let e=v.getSelection();e.trim().length>0&&r.copyText(e)};h.addEventListener(`mousedown`,Ne),document.addEventListener(`mouseup`,Pe);let Fe=v.parser.registerOscHandler(52,e=>{let t=wl(e);return t&&r.copyText(t),!0}),Ie=v.textarea,Le=null,Re=!1,ze=0,Be=Zl(v,()=>{Le=null}),Ve=$l(h,v,Be),He=tu(h,v,Be),Ue=e=>{e.target instanceof Element&&e.target.closest(`.scrollbar`)&&(Le=null,Be.reset())};h.addEventListener(`mousedown`,Ue,{capture:!0});let We=()=>p(h);h.addEventListener(`wheel`,We,{capture:!0,passive:!0}),h.addEventListener(`touchmove`,We,{capture:!0,passive:!0});let Ge=()=>{if(!Re&&v.buffer.active.type===`normal`){let e=Ul(v.buffer.active);Le===null&&e>0&&(Le=e),ze=performance.now()}return!1},Ke=v.parser.registerCsiHandler({final:`J`},e=>e[0]===3&&Ge()),qe=v.parser.registerEscHandler({final:`c`},Ge),Je=()=>{Le=null,Be.reset(),Ul(v.buffer.active)>0&&v.scrollToBottom()},Ye=ye.onKey(Je);Ie?.addEventListener(`paste`,Je),Ie?.addEventListener(`compositionend`,Je);let Xe=()=>r.onScrolled(Ul(v.buffer.active)),Ze=v.onScroll(Xe),Qe=v.onWriteParsed(()=>{Le!==null&&performance.now()-ze>1e3&&(Le=null);let e=Wl(Le,v.buffer.active);e!==null&&v.scrollToLine(e),Xe()}),$e=e=>{Le=null,Be.reset(),e()},tt=()=>{s.set(E),Se(),r.onFocusChange(!0)},nt=()=>r.onFocusChange(!1);return Ie?.addEventListener(`focus`,tt),Ie?.addEventListener(`blur`,nt),{term:v,stream:w,scrollLines:e=>$e(()=>v.scrollLines(e)),scrollToTop:()=>$e(()=>v.scrollToTop()),scrollToBottom:()=>$e(()=>v.scrollToBottom()),armCtrl:e=>{_e=e},reattach:pe,snapshot:S.snapshot,dispose(){ie=!0,S.lower(),De.disconnect(),Ve(),He(),Be.dispose(),h.removeEventListener(`mousedown`,Ue,{capture:!0}),h.removeEventListener(`wheel`,We,{capture:!0}),h.removeEventListener(`touchmove`,We,{capture:!0}),Ie?.removeEventListener(`paste`,Je),Ie?.removeEventListener(`compositionend`,Je),Ke.dispose(),qe.dispose(),Ye.dispose(),je(),ke(),Oe(),we!==null&&window.clearTimeout(we),h.removeEventListener(`mousedown`,Ne),document.removeEventListener(`mouseup`,Pe),Fe.dispose(),Ie?.removeEventListener(`focus`,tt),Ie?.removeEventListener(`blur`,nt),Ze.dispose(),Qe.dispose(),ve.dispose(),be(),Ce.dispose(),ye.dispose(),Te.dispose(),ge(),oe(),ce(),se(),A.dispose(),E&&s.get()===E&&s.set(null),T.owners--,T.owners===0&&(te.delete(w),T.attached&&ne()),x.dispose(),v.dispose(),b.dispose()}}}export{jm as mountTerminal};
@@ -11,7 +11,7 @@
11
11
  <meta name="apple-mobile-web-app-capable" content="yes" />
12
12
  <meta name="apple-mobile-web-app-title" content="rove" />
13
13
  <title>rove</title>
14
- <script type="module" crossorigin src="/assets/index-BXCepdnn.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-DDALm7-O.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-DILEZb0x.css">
16
16
  </head>
17
17
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@sma1lboy/rove",
4
- "version": "0.9.294",
4
+ "version": "0.9.295-next.319",
5
5
  "description": "Rove: all your coding agents, in one place. An agentic development environment (ADE) for your terminal: Claude Code, Codex, Copilot and more, side by side in isolated worktrees, handing tasks to each other.",
6
6
  "keywords": [
7
7
  "terminal",
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{isDev}from"./chunk-8143k3t6.js";import{fileURLToPath}from"url";var package_default={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.9.294",description:"Rove: all your coding agents, in one place. An agentic development environment (ADE) for your terminal: Claude Code, Codex, Copilot and more, side by side in isolated worktrees, handing tasks to each other.",keywords:["terminal","tui","cli","ade","agentic-development-environment","multiplexer","ai-agents","coding-agent","ai-coding-assistant","agentic-ai","parallel-agents","git-worktree","claude-code","codex","llm","developer-tools"],type:"module",packageManager:"bun@1.3.13",bin:{rove:"dist/cli/rove.js"},files:["dist/cli","dist/completions","dist/web","dist/web-ui","dist/skills","dist/voice","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/rove.git"},homepage:"https://rove.run",bugs:{url:"https://github.com/Sma1lboy/rove/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"ROVE_DEV=1 bun --conditions=browser ./src/cli/rove.ts","dev:mock":"ROVE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts","build:rubric":"bun run scripts/build-tier-rubric.ts",compile:"bun run scripts/compile.ts",typecheck:"tsc --noEmit","check-i18n":"bun run scripts/check-i18n.ts",test:"bun run test:fast && bun run test:socket","perf:golden":"bun scripts/perf-golden.ts","rove-bench":"bun --conditions=browser scripts/rove-bench.ts","pty:soak":"bun scripts/pty-soak.ts","test:fast":"vitest run --passWithNoTests --minWorkers=1 --maxWorkers=8","test:socket":"ROVE_INCLUDE_SOCKET=1 vitest run test/daemon --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:socket:coverage":"ROVE_INCLUDE_SOCKET=1 ROVE_COVERAGE_DAEMON=1 vitest run test/daemon --coverage --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:behavior":"ROVE_INCLUDE_BEHAVIOR=1 vitest run test/behavior --pool forks --minWorkers=1 --maxWorkers=1 --retry=2 --passWithNoTests","test:render":"bun scripts/render-track.mjs",coverage:"vitest run --coverage --passWithNoTests",bench:"vitest bench --run",lint:"biome check .",knip:"knip-bun",postinstall:"bun run scripts/check-preview-deps.ts || true",prepublishOnly:"bun run typecheck && bun run build","plugin-sandbox":"bun run scripts/plugin-sandbox.ts"},"//":"biome.json + bunfig.toml live at the monorepo root since they apply repo-wide; bun.lock also lives at root (workspace-shared).",dependencies:{"@ansi-tools/parser":"^1.0.15","@opentui/core":"0.8.4","@opentui/react":"0.8.4","@xterm/addon-serialize":"^0.14.0","@xterm/addon-unicode11":"^0.9.0","@xterm/headless":"^6.0.0",react:"^19.2.8","smol-toml":"^1.7.1",ws:"^8.21.3",yaml:"^2.9.0"},optionalDependencies:{"@sma1lboy/opentui-rove-darwin-arm64":"0.8.4-rove.1","@sma1lboy/opentui-rove-linux-x64":"0.8.4-rove.1","node-pty":"^1.1.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/rove-daemon":"0.7.23","@tsconfig/bun":"1.0.11","@types/bun":"1.3.14","@types/node":"25.6.2","@types/react":"^19.2.0","@vitest/coverage-v8":"2.1.9",knip:"^6.14.2","react-devtools-core":"^7.0.1","rove-bridge":"0.0.55","rove-weixin":"0.0.55",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]};var RELEASE_CHANNELS=["latest","next","nightly"],DEFAULT_RELEASE_CHANNEL="latest";function channelFor(version){let dash=version.indexOf("-"),tag=dash===-1?void 0:version.slice(dash+1).split(".")[0];return tag==="nightly"||tag==="next"?tag:"latest"}var CURRENT_VERSION=package_default.version,PACKAGE_NAME=package_default.name;function repoSlug(){let url=package_default.repository?.url;if(!url)return null;let m=url.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!m||!m[1]||!m[2])return null;return`${m[1]}/${m[2]}`}var UPDATE_SCRIPT_URL="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",UPDATE_COMMAND=`curl -fsSL ${UPDATE_SCRIPT_URL} | sh`;function updateCommandFor(target){return target===void 0||target===DEFAULT_RELEASE_CHANNEL?UPDATE_COMMAND:`${UPDATE_COMMAND} -s -- ${target}`}function owningNpmPrefix(modulePath=fileURLToPath(import.meta.url)){let at=modulePath.indexOf("/lib/node_modules/");if(at<=0)return null;return modulePath.slice(0,at)}function recommendedGlobalInstallCommand(prefix=owningNpmPrefix()){let target=`${PACKAGE_NAME}@latest`;return prefix===null?`npm install -g ${target}`:`npm install -g --prefix ${prefix} ${target}`}var BREAKING_VERSIONS=[];function breakingVersionsCrossed(from,to,breaking=BREAKING_VERSIONS){let[lo,hi]=compareSemver(from,to)<=0?[from,to]:[to,from];return breaking.filter((b)=>compareSemver(b,lo)>0&&compareSemver(b,hi)<=0)}var FETCH_TIMEOUT_MS=3000,PACKUMENT_TIMEOUT_MS=15000;function channelOf(version=CURRENT_VERSION){return channelFor(version)}async function fetchLatestFromRegistry(packageName,channel){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}/${channel}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let body=await res.json();if(typeof body.version!=="string")return null;return body.version}catch{return null}finally{clearTimeout(timer)}}async function fetchPublishedAt(packageName,version){let ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),PACKUMENT_TIMEOUT_MS);try{let encoded=packageName.replace("/","%2F"),res=await fetch(`https://registry.npmjs.org/${encoded}`,{signal:ctrl.signal,headers:{accept:"application/json"}});if(!res.ok)return null;let stamp=(await res.json()).time?.[version],ms=typeof stamp==="string"?Date.parse(stamp):Number.NaN;return Number.isFinite(ms)?ms:null}catch{return null}finally{clearTimeout(timer)}}function isNewerSemver(latest,current){let core=compareSemver(latest,current);if(core!==0)return core>0;return comparePrerelease(prereleaseOf(latest),prereleaseOf(current))>0}function prereleaseOf(version){let dash=version.indexOf("-");return dash===-1?void 0:version.slice(dash+1)||void 0}function comparePrerelease(a,b){if(a===b)return 0;if(a===void 0)return 1;if(b===void 0)return-1;let aParts=a.split("."),bParts=b.split(".");for(let i=0;i<Math.max(aParts.length,bParts.length);i++){let av=aParts[i],bv=bParts[i];if(av===void 0)return-1;if(bv===void 0)return 1;if(av===bv)continue;let an=/^\d+$/.test(av)?Number.parseInt(av,10):null,bn=/^\d+$/.test(bv)?Number.parseInt(bv,10):null;if(an!==null&&bn!==null)return an>bn?1:-1;if(an!==null)return-1;if(bn!==null)return 1;return av>bv?1:-1}return 0}function compareSemver(aVersion,bVersion){let norm=(v)=>v.split("-")[0]??v,a=norm(aVersion).split(".").map((s)=>Number.parseInt(s,10)),b=norm(bVersion).split(".").map((s)=>Number.parseInt(s,10));for(let i=0;i<3;i++){let av=a[i]??0,bv=b[i]??0;if(Number.isNaN(av)||Number.isNaN(bv))return 0;if(av>bv)return 1;if(av<bv)return-1}return 0}async function checkLatestVersion(opts={}){let channel=opts.channel??channelOf(),fake=process.env.ROVE_FAKE_UPDATE;if(fake)return{current:CURRENT_VERSION,latest:fake,hasUpdate:isNewerSemver(fake,CURRENT_VERSION),channel};if(isDev()&&!opts.force)return null;let latest=await fetchLatestFromRegistry(PACKAGE_NAME,channel);if(!latest)return null;let hasUpdate=isNewerSemver(latest,CURRENT_VERSION),minAgeMs=(opts.minAgeHours??0)*3600000;if(hasUpdate&&minAgeMs>0){let publishedAt=await fetchPublishedAt(PACKAGE_NAME,latest),now=(opts.now??Date.now)();if(publishedAt!==null&&now-publishedAt<minAgeMs)hasUpdate=!1}return{current:CURRENT_VERSION,latest,hasUpdate,channel}}function versionFromTagName(tagName,channel){if(typeof tagName!=="string")return null;let match=tagName.match(/^v\d+\.\d+\.\d+(?:-([a-z]+)\.\d+)?$/);if(!match||match[1]&&match[1]!==channel)return null;return tagName.slice(1)}var ZH_NOTES_ASSET="release-notes.zh.md";async function notesBody(release,locale,signal){if(locale!=="zh"||!Array.isArray(release.assets))return release.body;let asset=release.assets.find((a)=>a.name===ZH_NOTES_ASSET);if(typeof asset?.browser_download_url!=="string")return release.body;try{let res=await fetch(asset.browser_download_url,{signal}),text=res.ok?await res.text():"";return text.trim()?text:release.body}catch{return release.body}}async function fetchReleaseNotes(version,locale="en"){let slug=repoSlug();if(!slug)return null;let tag=`v${version}`,ctrl=new AbortController,timer=setTimeout(()=>ctrl.abort(),FETCH_TIMEOUT_MS);try{let res=await fetch(`https://api.github.com/repos/${slug}/releases/tags/${tag}`,{signal:ctrl.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return null;let body=await res.json();if(typeof body.body!=="string"||typeof body.html_url!=="string")return null;return{body:await notesBody({...body,body:body.body},locale,ctrl.signal),url:body.html_url,version}}catch{return null}finally{clearTimeout(timer)}}var RELEASES_PER_PAGE=100,MAX_RELEASE_PAGES=10;async function walkReleases(visit){let slug=repoSlug();if(!slug)return;for(let page=1;page<=MAX_RELEASE_PAGES;page++){let body;try{let res=await fetch(`https://api.github.com/repos/${slug}/releases?per_page=${RELEASES_PER_PAGE}&page=${page}`,{signal:AbortSignal.timeout(FETCH_TIMEOUT_MS),headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!res.ok)return;body=await res.json()}catch{return}if(!Array.isArray(body))return;for(let release of body)if(!visit(release))return;if(body.length<RELEASES_PER_PAGE)return}}async function fetchReleaseNotesRange(args){let channel=channelFor(args.latest),inRange=[];await walkReleases((release)=>{let version=versionFromTagName(release.tag_name,channel);if(!version)return!0;if(!isNewerSemver(version,args.current))return!1;if(isNewerSemver(version,args.latest))return!0;if(typeof release.html_url==="string"&&typeof release.body==="string")inRange.push({version,url:release.html_url,release:{...release,body:release.body}});return!0});let signal=AbortSignal.timeout(FETCH_TIMEOUT_MS);return Promise.all(inRange.map(async({version,url,release})=>({version,url,body:await notesBody(release,args.locale??"en",signal)})))}async function fetchReleaseSummaries(limit=12){let summaries=[];return await walkReleases((release)=>{let version=versionFromTagName(release.tag_name);if(version&&typeof release.html_url==="string")summaries.push({version,url:release.html_url});return summaries.length<limit}),summaries}function releasePageUrl(version){let slug=repoSlug();if(!slug)return null;return`https://github.com/${slug}/releases/tag/v${version}`}
3
- export{package_default,RELEASE_CHANNELS,DEFAULT_RELEASE_CHANNEL,CURRENT_VERSION,PACKAGE_NAME,repoSlug,UPDATE_SCRIPT_URL,UPDATE_COMMAND,updateCommandFor,owningNpmPrefix,recommendedGlobalInstallCommand,BREAKING_VERSIONS,breakingVersionsCrossed,channelOf,isNewerSemver,compareSemver,checkLatestVersion,ZH_NOTES_ASSET,fetchReleaseNotes,fetchReleaseNotesRange,fetchReleaseSummaries,releasePageUrl};