ccdeck 3.82.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSING.md +42 -4
- package/README.md +183 -72
- package/THIRD_PARTY_NOTICES.md +243 -17
- package/bin/cli/tui.js +58 -4
- package/bin/deck.js +27 -1
- package/dist/web/assets/AccountBridge-OQHT5qmS.js +1 -0
- package/dist/web/assets/AccountSection-BpIHPhF3.js +1 -0
- package/dist/web/assets/BrowserWatchModal-DBdt52v7.js +1 -0
- package/dist/web/assets/FeedbackConversations-BJjgXI0-.js +1 -0
- package/dist/web/assets/IntegrationModal-DQ0vEz4X.js +7 -0
- package/dist/web/assets/IntegrationSkeleton-JCPbqp96.js +1 -0
- package/dist/web/assets/RadioPanel-Be6AkrKl.js +1 -0
- package/dist/web/assets/StageShell-Dq0JOQhd.js +4 -0
- package/dist/web/assets/TrafficRadar-7jqJbhaK.js +8 -0
- package/dist/web/assets/UsageHistoryModal-ckawZGoe.js +1 -0
- package/dist/web/assets/addon-unicode-graphemes-DW3WJwyh.js +18 -0
- package/dist/web/assets/addon-web-links-BWjmmSgS.js +12 -0
- package/dist/web/assets/addon-webgl-CLK4R-_u.js +75 -0
- package/dist/web/assets/app-40gNTTfq.js +361 -0
- package/dist/web/assets/app-BRjYF6oD.css +1 -0
- package/dist/web/assets/{index-B-l-VxLm.js → index-XIY3yFiN.js} +1 -1
- package/dist/web/assets/inspector-status-pane-BV_m7eBv.js +1 -0
- package/dist/web/assets/screens-9_ivqfcF.js +12 -0
- package/dist/web/assets/screens-DUniTTbC.css +1 -0
- package/dist/web/assets/stage-board-NF_wgGRA.js +2 -0
- package/dist/web/assets/use-account-BUmI-A8e.js +1 -0
- package/dist/web/assets/xterm-4jYizCpg.js +27 -0
- package/dist/web/assets/xterm-sheet-6GBZ9nXN.css +32 -0
- package/dist/web/index.html +16 -6
- package/package.json +13 -1
- package/release-notes.json +67 -0
- package/src/server/account-client.mjs +196 -0
- package/src/server/account-connect.mjs +238 -0
- package/src/server/account-flag.mjs +106 -0
- package/src/server/account-projects.mjs +1 -1
- package/src/server/account-service.mjs +532 -0
- package/src/server/account-status.mjs +293 -0
- package/src/server/account-store.mjs +137 -0
- package/src/server/account-sync.mjs +473 -0
- package/src/server/account-token-store.mjs +216 -0
- package/src/server/account-ui-fields.mjs +126 -0
- package/src/server/account-watch.mjs +1 -1
- package/src/server/browser-watch-log.mjs +1 -1
- package/src/server/browser-watch-store.mjs +1 -1
- package/src/server/ccdeck-account-routes.mjs +252 -0
- package/src/server/ccusage-install.mjs +2 -2
- package/src/server/ccusage-registry.mjs +4 -4
- package/src/server/ccusage-session.mjs +11 -0
- package/src/server/claude-accounts.mjs +1 -1
- package/src/server/claude-recovery.mjs +9 -4
- package/src/server/claude-settings-catalog.mjs +6 -6
- package/src/server/claude-settings.mjs +1 -1
- package/src/server/codex-auto.mjs +1 -1
- package/src/server/codex-cost-usage.mjs +7 -2
- package/src/server/codex-live-checkpoint.mjs +24 -9
- package/src/server/codex-live-engine.mjs +14 -4
- package/src/server/codex-live-handoff.mjs +53 -9
- package/src/server/codex-names.mjs +49 -0
- package/src/server/codex-translate.mjs +1 -1
- package/src/server/codex-ultrafast.d.mts +3 -0
- package/src/server/codex-ultrafast.mjs +5 -0
- package/src/server/codex-watch.mjs +25 -0
- package/src/server/command-panel-engine.mjs +300 -0
- package/src/server/command-panel-platform.mjs +99 -0
- package/src/server/cswap-auto-choice.mjs +1 -1
- package/src/server/cswap-auto-loop.mjs +1 -1
- package/src/server/cswap-install.mjs +21 -40
- package/src/server/deck-home.mjs +6 -0
- package/src/server/deck-prefs.mjs +53 -1
- package/src/server/detach.mjs +1 -1
- package/src/server/engine-download.mjs +277 -0
- package/src/server/engine-install.mjs +378 -0
- package/src/server/engine-package.mjs +267 -0
- package/src/server/event-log.mjs +7 -1
- package/src/server/event-pipeline.mjs +29 -1
- package/src/server/ghostty-handoff.mjs +81 -0
- package/src/server/index.mjs +143 -5
- package/src/server/installer.mjs +4 -1
- package/src/server/integrations/jira-write-guard.mjs +14 -208
- package/src/server/integrations/store.mjs +37 -19
- package/src/server/integrations/write-guard.mjs +223 -0
- package/src/server/intel-cpu-temperature.mjs +26 -0
- package/src/server/lifecycle.mjs +69 -6
- package/src/server/log-replay.mjs +4 -0
- package/src/server/login-service.mjs +7 -1
- package/src/server/macmon.mjs +1 -1
- package/src/server/npm-latest.mjs +1 -1
- package/src/server/org-telemetry.mjs +1 -1
- package/src/server/output-watch.mjs +4 -1
- package/src/server/panel-provenance.mjs +390 -0
- package/src/server/pinned-build.mjs +14 -0
- package/src/server/prefs-refusal.mjs +8 -1
- package/src/server/prefs-routes.mjs +60 -11
- package/src/server/pro-engine-client.mjs +339 -0
- package/src/server/pro-engine-install.mjs +294 -0
- package/src/server/pro-engine-terminal.mjs +308 -0
- package/src/server/project-discovery.mjs +139 -0
- package/src/server/provider-session-name.mjs +58 -0
- package/src/server/quota-closes.mjs +1 -1
- package/src/server/quota-history.mjs +1 -1
- package/src/server/reports.mjs +86 -21
- package/src/server/request-gates.mjs +34 -5
- package/src/server/restart-note.mjs +1 -1
- package/src/server/seed-boundary.mjs +489 -0
- package/src/server/session-counts.mjs +244 -0
- package/src/server/session-deck-names.mjs +143 -0
- package/src/server/session-enrichment.mjs +43 -6
- package/src/server/session-name-route.mjs +73 -0
- package/src/server/session-summary.mjs +12 -1
- package/src/server/session-transcript-routes.mjs +167 -0
- package/src/server/swap-log.mjs +1 -1
- package/src/server/system-metrics.mjs +57 -0
- package/src/server/terminal-bridge.mjs +485 -0
- package/src/server/terminal-folder.mjs +61 -0
- package/src/server/terminal-js-routes.mjs +752 -0
- package/src/server/terminal-routes.mjs +553 -0
- package/src/server/terminal-sessions.mjs +759 -0
- package/src/server/terminal-socket.mjs +403 -0
- package/src/server/terminal-target.mjs +928 -0
- package/src/server/thermal-metrics.mjs +13 -9
- package/src/server/tmux-control.mjs +1319 -0
- package/src/server/tmux-download.mjs +220 -0
- package/src/server/tmux.mjs +542 -0
- package/src/server/token-redact.mjs +42 -3
- package/src/server/tool-audit-report.mjs +44 -6
- package/src/server/tool-audit-routes.mjs +12 -1
- package/src/server/tool-audit.mjs +42 -8
- package/src/server/traffic-radar-monitor.mjs +1 -1
- package/src/server/traffic-radar-permission.mjs +1 -1
- package/src/server/transcript-gate.mjs +1 -1
- package/src/server/transcript-scan.mjs +15 -7
- package/src/server/transcript-turns.mjs +154 -0
- package/src/server/tui-network.mjs +1 -0
- package/src/server/tui-view.mjs +28 -0
- package/src/server/utf8-carry.mjs +159 -0
- package/src/server/uv-bootstrap.mjs +2 -2
- package/src/server/windows-acl.mjs +158 -0
- package/src/server/ws-frames.mjs +690 -0
- package/dist/web/assets/BrowserWatchModal-CWVooKxD.js +0 -1
- package/dist/web/assets/IntegrationModal-DLX43RIK.js +0 -7
- package/dist/web/assets/RadioPanel-Cj6PjrvQ.js +0 -1
- package/dist/web/assets/TrafficRadar-Bq1YcuHB.js +0 -8
- package/dist/web/assets/UsageHistoryModal-CMSCca5_.js +0 -1
- package/dist/web/assets/app-BHxsMz3-.js +0 -358
- package/dist/web/assets/app-CbXmr9rC.css +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
6
|
+
* @license MIT
|
|
7
|
+
*
|
|
8
|
+
* Originally forked from (with the author's permission):
|
|
9
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
10
|
+
* http://bellard.org/jslinux/
|
|
11
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
12
|
+
*/var Ti=(e,t,i,r)=>{for(var s=t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(s=n(s)||s);return s},Bi=(e,t)=>(i,r)=>t(i,r,e),Ei=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?yt.isErrorNoTelemetry(e)?new yt(e.message+`
|
|
13
|
+
|
|
14
|
+
`+e.stack):new Error(e.message+`
|
|
15
|
+
|
|
16
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},ki=new Ei;function et(e){Fi(e)||ki.onUnexpectedError(e)}var ut="Canceled";function Fi(e){return e instanceof Pi?!0:e instanceof Error&&e.name===ut&&e.message===ut}var Pi=class extends Error{constructor(){super(ut),this.name=this.message}},yt=class _t extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof _t)return t;let i=new _t;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},$i;(e=>{function t(a){return a<0}e.isLessThan=t;function i(a){return a<=0}e.isLessThanOrEqual=i;function r(a){return a>0}e.isGreaterThan=r;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})($i||={});function Di(e,t){let i=this,r=!1,s;return function(){return r||(r=!0,t||(s=e.apply(i,arguments))),s}}var ei;(e=>{function t(x){return x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*s(x){yield x}e.single=s;function a(x){return t(x)?x:s(x)}e.wrap=a;function n(x){return x||i}e.from=n;function*o(x){for(let M=x.length-1;M>=0;M--)yield x[M]}e.reverse=o;function l(x){return!x||x[Symbol.iterator]().next().done===!0}e.isEmpty=l;function h(x){return x[Symbol.iterator]().next().value}e.first=h;function c(x,M){let A=0;for(let U of x)if(M(U,A++))return!0;return!1}e.some=c;function d(x,M){for(let A of x)if(M(A))return A}e.find=d;function*u(x,M){for(let A of x)M(A)&&(yield A)}e.filter=u;function*g(x,M){let A=0;for(let U of x)yield M(U,A++)}e.map=g;function*y(x,M){let A=0;for(let U of x)yield*M(U,A++)}e.flatMap=y;function*T(...x){for(let M of x)yield*M}e.concat=T;function $(x,M,A){let U=A;for(let Z of x)U=M(U,Z);return U}e.reduce=$;function*O(x,M,A=x.length){for(M<0&&(M+=x.length),A<0?A+=x.length:A>x.length&&(A=x.length);M<A;M++)yield x[M]}e.slice=O;function R(x,M=Number.POSITIVE_INFINITY){let A=[];if(M===0)return[A,x];let U=x[Symbol.iterator]();for(let Z=0;Z<M;Z++){let ae=U.next();if(ae.done)return[A,e.empty()];A.push(ae.value)}return[A,{[Symbol.iterator](){return U}}]}e.consume=R;async function S(x){let M=[];for await(let A of x)M.push(A);return Promise.resolve(M)}e.asyncToArray=S})(ei||={});function ti(e){if(ei.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ii(...e){return X(()=>ti(e))}function X(e){return{dispose:Di(()=>{e()})}}var si=class ri{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ti(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ri.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};si.DISABLE_DISPOSED_WARNING=!1;var ke=si,oe=class{constructor(){this._store=new ke,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};oe.None=Object.freeze({dispose(){}});var Pe=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},mt=typeof process<"u"&&"title"in process,Qe=mt?"node":navigator.userAgent,Ii=mt?"node":navigator.platform,zi=Qe.includes("Firefox"),Wi=Qe.includes("Edge"),ni=/^((?!chrome|android).)*safari/i.test(Qe);function Oi(){if(!ni)return 0;let e=Qe.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}Ii.indexOf("Linux")>=0;var Ui="",q=0,G=0,H=0,I=0,ie={css:"#00000000",rgba:0},K;(e=>{function t(s,a,n,o){return o!==void 0?`#${be(s)}${be(a)}${be(n)}${be(o)}`:`#${be(s)}${be(a)}${be(n)}`}e.toCss=t;function i(s,a,n,o=255){return(s<<24|a<<16|n<<8|o)>>>0}e.toRgba=i;function r(s,a,n,o){return{css:e.toCss(s,a,n,o),rgba:e.toRgba(s,a,n,o)}}e.toColor=r})(K||={});var ze;(e=>{function t(l,h){if(I=(h.rgba&255)/255,I===1)return{css:h.css,rgba:h.rgba};let c=h.rgba>>24&255,d=h.rgba>>16&255,u=h.rgba>>8&255,g=l.rgba>>24&255,y=l.rgba>>16&255,T=l.rgba>>8&255;q=g+Math.round((c-g)*I),G=y+Math.round((d-y)*I),H=T+Math.round((u-T)*I);let $=K.toCss(q,G,H),O=K.toRgba(q,G,H);return{css:$,rgba:O}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function r(l,h,c){let d=Me.ensureContrastRatio(l.rgba,h.rgba,c);if(d)return K.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function s(l){let h=(l.rgba|255)>>>0;return[q,G,H]=Me.toChannels(h),{css:K.toCss(q,G,H),rgba:h}}e.opaque=s;function a(l,h){return I=Math.round(h*255),[q,G,H]=Me.toChannels(l.rgba),{css:K.toCss(q,G,H,I),rgba:K.toRgba(q,G,H,I)}}e.opacity=a;function n(l,h){return I=l.rgba&255,a(l,I*h/255)}e.multiplyOpacity=n;function o(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=o})(ze||={});var Ni;(e=>{let t,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return q=parseInt(s.slice(1,2).repeat(2),16),G=parseInt(s.slice(2,3).repeat(2),16),H=parseInt(s.slice(3,4).repeat(2),16),K.toColor(q,G,H);case 5:return q=parseInt(s.slice(1,2).repeat(2),16),G=parseInt(s.slice(2,3).repeat(2),16),H=parseInt(s.slice(3,4).repeat(2),16),I=parseInt(s.slice(4,5).repeat(2),16),K.toColor(q,G,H,I);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return q=parseInt(a[1]),G=parseInt(a[2]),H=parseInt(a[3]),I=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),K.toColor(q,G,H,I);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[q,G,H,I]=t.getImageData(0,0,1,1).data,I!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:K.toRgba(q,G,H,I),css:s}}e.toColor=r})(Ni||={});var Q;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,s,a){let n=r/255,o=s/255,l=a/255,h=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return h*.2126+c*.7152+d*.0722}e.relativeLuminance2=i})(Q||={});var Me;(e=>{function t(n,o){if(I=(o&255)/255,I===1)return o;let l=o>>24&255,h=o>>16&255,c=o>>8&255,d=n>>24&255,u=n>>16&255,g=n>>8&255;return q=d+Math.round((l-d)*I),G=u+Math.round((h-u)*I),H=g+Math.round((c-g)*I),K.toRgba(q,G,H)}e.blend=t;function i(n,o,l){let h=Q.relativeLuminance(n>>8),c=Q.relativeLuminance(o>>8);if(_e(h,c)<l){if(c<h){let g=r(n,o,l),y=_e(h,Q.relativeLuminance(g>>8));if(y<l){let T=s(n,o,l),$=_e(h,Q.relativeLuminance(T>>8));return y>$?g:T}return g}let d=s(n,o,l),u=_e(h,Q.relativeLuminance(d>>8));if(u<l){let g=r(n,o,l),y=_e(h,Q.relativeLuminance(g>>8));return u>y?d:g}return d}}e.ensureContrastRatio=i;function r(n,o,l){let h=n>>24&255,c=n>>16&255,d=n>>8&255,u=o>>24&255,g=o>>16&255,y=o>>8&255,T=_e(Q.relativeLuminance2(u,g,y),Q.relativeLuminance2(h,c,d));for(;T<l&&(u>0||g>0||y>0);)u-=Math.max(0,Math.ceil(u*.1)),g-=Math.max(0,Math.ceil(g*.1)),y-=Math.max(0,Math.ceil(y*.1)),T=_e(Q.relativeLuminance2(u,g,y),Q.relativeLuminance2(h,c,d));return(u<<24|g<<16|y<<8|255)>>>0}e.reduceLuminance=r;function s(n,o,l){let h=n>>24&255,c=n>>16&255,d=n>>8&255,u=o>>24&255,g=o>>16&255,y=o>>8&255,T=_e(Q.relativeLuminance2(u,g,y),Q.relativeLuminance2(h,c,d));for(;T<l&&(u<255||g<255||y<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),T=_e(Q.relativeLuminance2(u,g,y),Q.relativeLuminance2(h,c,d));return(u<<24|g<<16|y<<8|255)>>>0}e.increaseLuminance=s;function a(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}e.toChannels=a})(Me||={});function be(e){let t=e.toString(16);return t.length<2?"0"+t:t}function _e(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function W(e){if(!e)throw new Error("value must not be falsy");return e}function wt(e){return 57508<=e&&e<=57558}function qi(e){return 57520<=e&&e<=57527}function Gi(e){return 57344<=e&&e<=63743}function Hi(e){return 9472<=e&&e<=9631}function Vi(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function ji(e,t,i,r){return t===1&&i>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Vi(e)&&!wt(e)&&!Gi(e)}function oi(e){return wt(e)||Hi(e)}function Yi(){return{css:{canvas:qe(),cell:qe()},device:{canvas:qe(),cell:qe(),char:{width:0,height:0,left:0,top:0}}}}function qe(){return{width:0,height:0}}function Xi(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var V=0,N=0,le=!1,ge=!1,Ge=!1,J,tt=0,Zi=class{constructor(e,t,i,r,s,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,N=0,V=0,ge=!1,le=!1,Ge=!1,J=this._themeService.colors,tt=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));tt=t*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",s=>{s.backgroundColorRGB&&(N=s.backgroundColorRGB.rgba>>8&16777215,ge=!0),s.foregroundColorRGB&&(V=s.foregroundColorRGB.rgba>>8&16777215,le=!0)}),Ge=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Ge){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:N=(this.result.fg&16777215)<<8|255;break;case 0:default:N=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:N=(this.result.bg&16777215)<<8|255;break}N=Me.blend(N,(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else N=(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ge=!0,J.selectionForeground&&(V=J.selectionForeground.rgba>>8&16777215,le=!0),oi(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)V=(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:V=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:V=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:V=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:V=(this.result.fg&16777215)<<8|255;break;case 0:default:V=this._themeService.colors.foreground.rgba}V=Me.blend(V,(this._coreBrowserService.isFocused?J.selectionBackgroundOpaque:J.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}le=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",s=>{s.backgroundColorRGB&&(N=s.backgroundColorRGB.rgba>>8&16777215,ge=!0),s.foregroundColorRGB&&(V=s.foregroundColorRGB.rgba>>8&16777215,le=!0)}),ge&&(Ge?N=e.bg&-16777216&-134217729|N|50331648:N=e.bg&-16777216|N|50331648),le&&(V=e.fg&-16777216&-67108865|V|50331648),this.result.fg&67108864&&(ge&&!le&&((this.result.bg&50331648)===0?V=this.result.fg&-134217728|J.background.rgba>>8&16777215&16777215|50331648:V=this.result.fg&-134217728|this.result.bg&67108863,le=!0),!ge&&le&&((this.result.fg&50331648)===0?N=this.result.bg&-67108864|J.foreground.rgba>>8&16777215&16777215|50331648:N=this.result.bg&-67108864|this.result.fg&67108863,ge=!0)),J=void 0,this.result.bg=ge?N:this.result.bg,this.result.fg=le?V:this.result.fg,this.result.ext&=536870911,this.result.ext|=tt<<29&3758096384}},Qi=.5,ai=zi||Wi?"bottom":"ideographic",Ki={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Ji={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},es={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},We={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};We[""]=We[""];We[""]=We[""];function ts(e,t,i,r,s,a,n,o){let l=Ki[t];if(l)return is(e,l,i,r,s,a),!0;let h=Ji[t];if(h)return ss(e,h,i,r,s,a),!0;let c=es[t];if(c)return rs(e,c,i,r,s,a,o),!0;let d=We[t];return d?(ns(e,d,i,r,s,a,n,o),!0):!1}function is(e,t,i,r,s,a){for(let n=0;n<t.length;n++){let o=t[n],l=s/8,h=a/8;e.fillRect(i+o.x*l,r+o.y*h,o.w*l,o.h*h)}}var Mt=new Map;function ss(e,t,i,r,s,a){let n=Mt.get(t);n||(n=new Map,Mt.set(t,n));let o=e.fillStyle;if(typeof o!="string")throw new Error(`Unexpected fillStyle type "${o}"`);let l=n.get(o);if(!l){let h=t[0].length,c=t.length,d=e.canvas.ownerDocument.createElement("canvas");d.width=h,d.height=c;let u=W(d.getContext("2d")),g=new ImageData(h,c),y,T,$,O;if(o.startsWith("#"))y=parseInt(o.slice(1,3),16),T=parseInt(o.slice(3,5),16),$=parseInt(o.slice(5,7),16),O=o.length>7&&parseInt(o.slice(7,9),16)||1;else if(o.startsWith("rgba"))[y,T,$,O]=o.substring(5,o.length-1).split(",").map(R=>parseFloat(R));else throw new Error(`Unexpected fillStyle color format "${o}" when drawing pattern glyph`);for(let R=0;R<c;R++)for(let S=0;S<h;S++)g.data[(R*h+S)*4]=y,g.data[(R*h+S)*4+1]=T,g.data[(R*h+S)*4+2]=$,g.data[(R*h+S)*4+3]=t[R][S]*(O*255);u.putImageData(g,0,0),l=W(e.createPattern(d,null)),n.set(o,l)}e.fillStyle=l,e.fillRect(i,r,s,a)}function rs(e,t,i,r,s,a,n){e.strokeStyle=e.fillStyle;for(let[o,l]of Object.entries(t)){e.beginPath(),e.lineWidth=n*Number.parseInt(o);let h;if(typeof l=="function"){let c=.15/a*s;h=l(.15,c)}else h=l;for(let c of h.split(" ")){let d=c[0],u=hi[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let g=c.substring(1).split(",");!g[0]||!g[1]||u(e,li(g,s,a,i,r,!0,n))}e.stroke(),e.closePath()}}function ns(e,t,i,r,s,a,n,o){let l=new Path2D;l.rect(i,r,s,a),e.clip(l),e.beginPath();let h=n/12;e.lineWidth=o*h;for(let c of t.d.split(" ")){let d=c[0],u=hi[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let g=c.substring(1).split(",");!g[0]||!g[1]||u(e,li(g,s,a,i,r,!1,o,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function St(e,t,i=0){return Math.max(Math.min(e,t),i)}var hi={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function li(e,t,i,r,s,a,n,o=0,l=0){let h=e.map(c=>parseFloat(c)||parseInt(c));if(h.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<h.length;c+=2)h[c]*=t-o*n-l*n,a&&h[c]!==0&&(h[c]=St(Math.round(h[c]+.5)-.5,t,0)),h[c]+=r+o*n;for(let c=1;c<h.length;c+=2)h[c]*=i,a&&h[c]!==0&&(h[c]=St(Math.round(h[c]+.5)-.5,i,0)),h[c]+=s;return h}var At=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Rt=class{constructor(){this._data=new At}set(e,t,i,r,s){this._data.get(e,t)||this._data.set(e,t,new At),this._data.get(e,t).set(i,r,s)}get(e,t,i,r){var s;return(s=this._data.get(e,t))==null?void 0:s.get(i,r)}clear(){this._data.clear()}},ci=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=s}this.clear()}},os=class extends ci{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},as=class extends ci{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},hs=!mt&&"requestIdleCallback"in window?as:os,Be=class di{constructor(){this.fg=0,this.bg=0,this.extended=new ui}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new di;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ui=class _i{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new _i(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ls=globalThis.performance&&typeof globalThis.performance.now=="function",cs=class gi{static create(t){return new gi(t)}constructor(t){this._now=ls&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},pe;(e=>{e.None=()=>oe.None;function t(w,_){return d(w,()=>{},0,void 0,!0,void 0,_)}e.defer=t;function i(w){return(_,p=null,v)=>{let L=!1,f;return f=w(m=>{if(!L)return f?f.dispose():L=!0,_.call(p,m)},null,v),L&&f.dispose(),f}}e.once=i;function r(w,_,p){return h((v,L=null,f)=>w(m=>v.call(L,_(m)),null,f),p)}e.map=r;function s(w,_,p){return h((v,L=null,f)=>w(m=>{_(m),v.call(L,m)},null,f),p)}e.forEach=s;function a(w,_,p){return h((v,L=null,f)=>w(m=>_(m)&&v.call(L,m),null,f),p)}e.filter=a;function n(w){return w}e.signal=n;function o(...w){return(_,p=null,v)=>{let L=ii(...w.map(f=>f(m=>_.call(p,m))));return c(L,v)}}e.any=o;function l(w,_,p,v){let L=p;return r(w,f=>(L=_(L,f),L),v)}e.reduce=l;function h(w,_){let p,v={onWillAddFirstListener(){p=w(L.fire,L)},onDidRemoveLastListener(){p==null||p.dispose()}},L=new P(v);return _==null||_.add(L),L.event}function c(w,_){return _ instanceof Array?_.push(w):_&&_.add(w),w}function d(w,_,p=100,v=!1,L=!1,f,m){let b,C,E,Y=0,k,Le={leakWarningThreshold:f,onWillAddFirstListener(){b=w(ue=>{Y++,C=_(C,ue),v&&!E&&(he.fire(C),C=void 0),k=()=>{let ee=C;C=void 0,E=void 0,(!v||Y>1)&&he.fire(ee),Y=0},typeof p=="number"?(clearTimeout(E),E=setTimeout(k,p)):E===void 0&&(E=0,queueMicrotask(k))})},onWillRemoveListener(){L&&Y>0&&(k==null||k())},onDidRemoveLastListener(){k=void 0,b.dispose()}},he=new P(Le);return m==null||m.add(he),he.event}e.debounce=d;function u(w,_=0,p){return e.debounce(w,(v,L)=>v?(v.push(L),v):[L],_,void 0,!0,void 0,p)}e.accumulate=u;function g(w,_=(v,L)=>v===L,p){let v=!0,L;return a(w,f=>{let m=v||!_(f,L);return v=!1,L=f,m},p)}e.latch=g;function y(w,_,p){return[e.filter(w,_,p),e.filter(w,v=>!_(v),p)]}e.split=y;function T(w,_=!1,p=[],v){let L=p.slice(),f=w(C=>{L?L.push(C):b.fire(C)});v&&v.add(f);let m=()=>{L==null||L.forEach(C=>b.fire(C)),L=null},b=new P({onWillAddFirstListener(){f||(f=w(C=>b.fire(C)),v&&v.add(f))},onDidAddFirstListener(){L&&(_?setTimeout(m):m())},onDidRemoveLastListener(){f&&f.dispose(),f=null}});return v&&v.add(b),b.event}e.buffer=T;function $(w,_){return(p,v,L)=>{let f=_(new R);return w(function(m){let b=f.evaluate(m);b!==O&&p.call(v,b)},void 0,L)}}e.chain=$;let O=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(_){return this.steps.push(_),this}forEach(_){return this.steps.push(p=>(_(p),p)),this}filter(_){return this.steps.push(p=>_(p)?p:O),this}reduce(_,p){let v=p;return this.steps.push(L=>(v=_(v,L),v)),this}latch(_=(p,v)=>p===v){let p=!0,v;return this.steps.push(L=>{let f=p||!_(L,v);return p=!1,v=L,f?L:O}),this}evaluate(_){for(let p of this.steps)if(_=p(_),_===O)break;return _}}function S(w,_,p=v=>v){let v=(...b)=>m.fire(p(...b)),L=()=>w.on(_,v),f=()=>w.removeListener(_,v),m=new P({onWillAddFirstListener:L,onDidRemoveLastListener:f});return m.event}e.fromNodeEventEmitter=S;function x(w,_,p=v=>v){let v=(...b)=>m.fire(p(...b)),L=()=>w.addEventListener(_,v),f=()=>w.removeEventListener(_,v),m=new P({onWillAddFirstListener:L,onDidRemoveLastListener:f});return m.event}e.fromDOMEventEmitter=x;function M(w){return new Promise(_=>i(w)(_))}e.toPromise=M;function A(w){let _=new P;return w.then(p=>{_.fire(p)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=A;function U(w,_){return w(p=>_.fire(p))}e.forward=U;function Z(w,_,p){return _(p),w(v=>_(v))}e.runAndSubscribe=Z;class ae{constructor(_,p){this._observable=_,this._counter=0,this._hasChanged=!1;let v={onWillAddFirstListener:()=>{_.addObserver(this)},onDidRemoveLastListener:()=>{_.removeObserver(this)}};this.emitter=new P(v),p&&p.add(this.emitter)}beginUpdate(_){this._counter++}handlePossibleChange(_){}handleChange(_,p){this._hasChanged=!0}endUpdate(_){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function me(w,_){return new ae(w,_).emitter.event}e.fromObservable=me;function B(w){return(_,p,v)=>{let L=0,f=!1,m={beginUpdate(){L++},endUpdate(){L--,L===0&&(w.reportChanges(),f&&(f=!1,_.call(p)))},handlePossibleChange(){},handleChange(){f=!0}};w.addObserver(m),w.reportChanges();let b={dispose(){w.removeObserver(m)}};return v instanceof ke?v.add(b):Array.isArray(v)&&v.push(b),b}}e.fromObservableLight=B})(pe||={});var gt=class ft{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ft._idPool++}`,ft.all.add(this)}start(t){this._stopWatch=new cs,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};gt.all=new Set,gt._idPool=0;var ds=gt,us=-1,fi=class vi{constructor(t,i,r=(vi._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,n]=this.getMostFrequentStack(),o=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${n}):`;console.warn(o),console.warn(a);let l=new fs(o,a);this._errorHandler(l)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,s]of this._stacks)(!t||i<s)&&(t=[r,s],i=s);return t}};fi._idPool=1;var _s=fi,gs=class pi{constructor(t){this.value=t}static create(){let t=new Error;return new pi(t.stack??"")}print(){console.warn(this.value.split(`
|
|
17
|
+
`).slice(2).join(`
|
|
18
|
+
`))}},fs=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},vs=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},ps=0,it=class{constructor(e){this.value=e,this.id=ps++}},ms=2,ws,P=class{constructor(e){var t,i,r,s;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new _s((e==null?void 0:e.onListenerError)??et,((i=this._options)==null?void 0:i.leakWarningThreshold)??us):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new ds(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var e,t,i,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??=(e,t,i)=>{var n,o,l,h,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new vs(`${d}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(((n=this._options)==null?void 0:n.onListenerError)||et)(g),oe.None}if(this._disposed)return oe.None;t&&(e=e.bind(t));let r=new it(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gs.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof it?(this._deliveryQueue??=new Cs,this._listeners=[this._listeners,r]):this._listeners.push(r):((l=(o=this._options)==null?void 0:o.onWillAddFirstListener)==null||l.call(o,this),this._listeners=r,(c=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||c.call(h,this)),this._size++;let a=X(()=>{s==null||s(),this._removeListener(r)});return i instanceof ke?i.add(a):Array.isArray(i)&&i.push(a),a},this._event}_removeListener(e){var s,a,n,o;if((a=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||a.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(o=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||o.call(n,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ms<=t.length){let l=0;for(let h=0;h<t.length;h++)t[h]?t[l++]=t[h]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){var r;if(!e)return;let i=((r=this._options)==null?void 0:r.onListenerError)||et;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,r,s;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof it)this._deliver(this._listeners,e);else{let a=this._deliveryQueue;a.enqueue(this,e,this._listeners.length),this._deliverQueue(a)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},Cs=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Tt={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},$e=2,De,Ce=class Te{constructor(t,i,r){this._document=t,this._config=i,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new Rt,this._cacheMapCombined=new Rt,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Be,this._textureSize=512,this._onAddTextureAtlasCanvas=new P,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new P,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=mi(t,this._config.deviceCellWidth*4+$e*2,this._config.deviceCellHeight+$e*2),this._tmpCtx=W(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new hs;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let r=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Te.maxAtlasPages&&this._pages.length>=Math.max(4,Te.maxAtlasPages)){let i=this._pages.filter(h=>h.canvas.width*2<=(Te.maxTextureSize||4096)).sort((h,c)=>c.canvas.width!==h.canvas.width?c.canvas.width-h.canvas.width:c.percentageUsed-h.percentageUsed),r=-1,s=0;for(let h=0;h<i.length;h++)if(i[h].canvas.width!==s)r=h,s=i[h].canvas.width;else if(h-r===3)break;let a=i.slice(r,r+4),n=a.map(h=>h.glyphs[0].texturePage).sort((h,c)=>h>c?1:-1),o=this.pages.length-a.length,l=this._mergePages(a,o);l.version++;for(let h=n.length-1;h>=0;h--)this._deletePage(n[h]);this.pages.push(l),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(l.canvas)}let t=new st(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let r=t[0].canvas.width*2,s=new st(this._document,r,t);for(let[a,n]of t.entries()){let o=a*n.canvas.width%r,l=Math.floor(a/2)*n.canvas.height;s.ctx.drawImage(n.canvas,o,l);for(let c of n.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/r,c.sizeClipSpace.y=c.size.y/r,c.texturePosition.x+=o,c.texturePosition.y+=l,c.texturePositionClipSpace.x=c.texturePosition.x/r,c.texturePositionClipSpace.y=c.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let h=this._activePages.indexOf(n);h!==-1&&this._activePages.splice(h,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let r=this._pages[i];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(t,i,r,s,a,n){return this._getFromCacheMap(this._cacheMapCombined,t,i,r,s,a,n)}getRasterizedGlyph(t,i,r,s,a,n){return this._getFromCacheMap(this._cacheMap,t,i,r,s,a,n)}_getFromCacheMap(t,i,r,s,a,n,o){return De=t.get(i,r,s,a),De||(De=this._drawToCache(i,r,s,a,n,o),t.set(i,r,s,a,De)),De}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,r,s){if(this._config.allowTransparency)return ie;let a;switch(t){case 16777216:case 33554432:a=this._getColorFromAnsiIndex(i);break;case 50331648:let n=Be.toColorRGB(i);a=K.toColor(n[0],n[1],n[2]);break;case 0:default:r?a=ze.opaque(this._config.colors.foreground):a=this._config.colors.background;break}return this._config.allowTransparency||(a=ze.opaque(a)),a}_getForegroundColor(t,i,r,s,a,n,o,l,h,c){let d=this._getMinimumContrastColor(t,i,r,s,a,n,o,h,l,c);if(d)return d;let u;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&n<8&&(n+=8),u=this._getColorFromAnsiIndex(n);break;case 50331648:let g=Be.toColorRGB(n);u=K.toColor(g[0],g[1],g[2]);break;case 0:default:o?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=ze.opaque(u)),l&&(u=ze.multiplyOpacity(u,Qi)),u}_resolveBackgroundRgba(t,i,r){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,r,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,r,s,a,n,o,l,h,c){if(this._config.minimumContrastRatio===1||c)return;let d=this._getContrastCache(h),u=d.getColor(t,s);if(u!==void 0)return u||void 0;let g=this._resolveBackgroundRgba(i,r,o),y=this._resolveForegroundRgba(a,n,o,l),T=Me.ensureContrastRatio(g,y,this._config.minimumContrastRatio/(h?2:1));if(!T){d.setColor(t,s,null);return}let $=K.toColor(T>>24&255,T>>16&255,T>>8&255);return d.setColor(t,s,$),$}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,r,s,a,n){let o=typeof t=="number"?String.fromCharCode(t):t;n&&this._tmpCanvas.parentElement!==n&&(this._tmpCanvas.style.display="none",n.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(o.length,2)+$e*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let h=Math.min(this._config.deviceCellHeight+$e*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return Tt;let c=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),g=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),T=!!this._workAttributeData.isStrikethrough(),$=!!this._workAttributeData.isOverline(),O=this._workAttributeData.getFgColor(),R=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),x=this._workAttributeData.getBgColorMode();if(d){let C=O;O=S,S=C;let E=R;R=x,x=E}let M=this._getBackgroundColor(x,S,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let A=c?this._config.fontWeightBold:this._config.fontWeight,U=g?"italic":"";this._tmpCtx.font=`${U} ${A} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ai;let Z=o.length===1&&wt(o.charCodeAt(0)),ae=o.length===1&&qi(o.charCodeAt(0)),me=this._getForegroundColor(i,x,S,r,R,O,d,u,c,oi(o.charCodeAt(0)));this._tmpCtx.fillStyle=me.css;let B=ae?0:$e*2,w=!1;this._config.customGlyphs!==!1&&(w=ts(this._tmpCtx,o,B,B,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let _=!Z,p;if(typeof t=="number"?p=this._unicodeService.wcwidth(t):p=this._unicodeService.getStringCellWidth(t),y){this._tmpCtx.save();let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=C%2===1?.5:0;if(this._tmpCtx.lineWidth=C,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())_=!1,this._tmpCtx.strokeStyle=`rgb(${Be.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{_=!1;let ee=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ee<8&&(ee+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ee).css}this._tmpCtx.beginPath();let Y=B,k=Math.ceil(B+this._config.deviceCharHeight)-E-(a?C*2:0),Le=k+C,he=k+C*2,ue=this._workAttributeData.getUnderlineVariantOffset();for(let ee=0;ee<p;ee++){this._tmpCtx.save();let z=Y+ee*this._config.deviceCellWidth,te=Y+(ee+1)*this._config.deviceCellWidth,Ke=z+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(te,k),this._tmpCtx.moveTo(z,he),this._tmpCtx.lineTo(te,he);break;case 3:let Oe=C<=1?he:Math.ceil(B+this._config.deviceCharHeight-C/2)-E,Ue=C<=1?k:Math.ceil(B+this._config.deviceCharHeight+C/2)-E,xt=new Path2D;xt.rect(z,k,this._config.deviceCellWidth,he-k),this._tmpCtx.clip(xt),this._tmpCtx.moveTo(z-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(z-this._config.deviceCellWidth/2,Ue,z,Ue,z,Le),this._tmpCtx.bezierCurveTo(z,Oe,Ke,Oe,Ke,Le),this._tmpCtx.bezierCurveTo(Ke,Ue,te,Ue,te,Le),this._tmpCtx.bezierCurveTo(te,Oe,te+this._config.deviceCellWidth/2,Oe,te+this._config.deviceCellWidth/2,Le);break;case 4:let Ne=ue===0?0:ue>=C?C*2-ue:C-ue;ue>=C||Ne===0?(this._tmpCtx.setLineDash([Math.round(C),Math.round(C)]),this._tmpCtx.moveTo(z+Ne,k),this._tmpCtx.lineTo(te,k)):(this._tmpCtx.setLineDash([Math.round(C),Math.round(C)]),this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(z+Ne,k),this._tmpCtx.moveTo(z+Ne+C,k),this._tmpCtx.lineTo(te,k)),ue=Xi(te-z,C,ue);break;case 5:let Si=.6,Ai=.3,Je=te-z,Lt=Math.floor(Si*Je),bt=Math.floor(Ai*Je),Ri=Je-Lt-bt;this._tmpCtx.setLineDash([Lt,bt,Ri]),this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(te,k);break;case 1:default:this._tmpCtx.moveTo(z,k),this._tmpCtx.lineTo(te,k);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!w&&this._config.fontSize>=12&&!this._config.allowTransparency&&o!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ee=this._tmpCtx.measureText(o);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ee&&ee.actualBoundingBoxDescent>0){this._tmpCtx.save();let z=new Path2D;z.rect(Y,k-Math.ceil(C/2),this._config.deviceCellWidth*p,he-k+Math.ceil(C/2)),this._tmpCtx.clip(z),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(o,B,B+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if($){let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=C%2===1?.5:0;this._tmpCtx.lineWidth=C,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(B,B+E),this._tmpCtx.lineTo(B+this._config.deviceCharWidth*p,B+E),this._tmpCtx.stroke()}if(w||this._tmpCtx.fillText(o,B,B+this._config.deviceCharHeight),o==="_"&&!this._config.allowTransparency){let C=rt(this._tmpCtx.getImageData(B,B,this._config.deviceCellWidth,this._config.deviceCellHeight),M,me,_);if(C)for(let E=1;E<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(o,B,B+this._config.deviceCharHeight-E),C=rt(this._tmpCtx.getImageData(B,B,this._config.deviceCellWidth,this._config.deviceCellHeight),M,me,_),!!C);E++);}if(T){let C=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),E=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=C,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(B,B+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.lineTo(B+this._config.deviceCharWidth*p,B+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.stroke()}this._tmpCtx.restore();let v=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),L;if(this._config.allowTransparency?L=xs(v):L=rt(v,M,me,_),L)return Tt;let f=this._findGlyphBoundingBox(v,this._workBoundingBox,l,ae,w,B),m,b;for(;;){if(this._activePages.length===0){let C=this._createNewPage();m=C,b=C.currentRow,b.height=f.size.y;break}m=this._activePages[this._activePages.length-1],b=m.currentRow;for(let C of this._activePages)f.size.y<=C.currentRow.height&&(m=C,b=C.currentRow);for(let C=this._activePages.length-1;C>=0;C--)for(let E of this._activePages[C].fixedRows)E.height<=b.height&&f.size.y<=E.height&&(m=this._activePages[C],b=E);if(f.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new st(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),m=this._overflowSizePage,b=this._overflowSizePage.currentRow,b.x+f.size.x>=m.canvas.width&&(b.x=0,b.y+=b.height,b.height=0);break}if(b.y+f.size.y>=m.canvas.height||b.height>f.size.y+2){let C=!1;if(m.currentRow.y+m.currentRow.height+f.size.y>=m.canvas.height){let E;for(let Y of this._activePages)if(Y.currentRow.y+Y.currentRow.height+f.size.y<Y.canvas.height){E=Y;break}if(E)m=E;else if(Te.maxAtlasPages&&this._pages.length>=Te.maxAtlasPages&&b.y+f.size.y<=m.canvas.height&&b.height>=f.size.y&&b.x+f.size.x<=m.canvas.width)C=!0;else{let Y=this._createNewPage();m=Y,b=Y.currentRow,b.height=f.size.y,C=!0}}C||(m.currentRow.height>0&&m.fixedRows.push(m.currentRow),b={x:0,y:m.currentRow.y+m.currentRow.height,height:f.size.y},m.fixedRows.push(b),m.currentRow={x:0,y:b.y+b.height,height:0})}if(b.x+f.size.x<=m.canvas.width)break;b===m.currentRow?(b.x=0,b.y+=b.height,b.height=0):m.fixedRows.splice(m.fixedRows.indexOf(b),1)}return f.texturePage=this._pages.indexOf(m),f.texturePosition.x=b.x,f.texturePosition.y=b.y,f.texturePositionClipSpace.x=b.x/m.canvas.width,f.texturePositionClipSpace.y=b.y/m.canvas.height,f.sizeClipSpace.x/=m.canvas.width,f.sizeClipSpace.y/=m.canvas.height,b.height=Math.max(b.height,f.size.y),b.x+=f.size.x,m.ctx.putImageData(v,f.texturePosition.x-this._workBoundingBox.left,f.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,f.size.x,f.size.y),m.addGlyph(f),m.version++,f}_findGlyphBoundingBox(t,i,r,s,a,n){i.top=0;let o=s?this._config.deviceCellHeight:this._tmpCanvas.height,l=s?this._config.deviceCellWidth:r,h=!1;for(let c=0;c<o;c++){for(let d=0;d<l;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(t.data[u]!==0){i.top=c,h=!0;break}}if(h)break}i.left=0,h=!1;for(let c=0;c<n+l;c++){for(let d=0;d<o;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(t.data[u]!==0){i.left=c,h=!0;break}}if(h)break}i.right=l,h=!1;for(let c=n+l-1;c>=n;c--){for(let d=0;d<o;d++){let u=d*this._tmpCanvas.width*4+c*4+3;if(t.data[u]!==0){i.right=c,h=!0;break}}if(h)break}i.bottom=o,h=!1;for(let c=o-1;c>=0;c--){for(let d=0;d<l;d++){let u=c*this._tmpCanvas.width*4+d*4+3;if(t.data[u]!==0){i.bottom=c,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+n+(s||a?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+n+(s||a?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},st=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=mi(e,t,t),this.ctx=W(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function rt(e,t,i,r){let s=t.rgba>>>24,a=t.rgba>>>16&255,n=t.rgba>>>8&255,o=i.rgba>>>24,l=i.rgba>>>16&255,h=i.rgba>>>8&255,c=Math.floor((Math.abs(s-o)+Math.abs(a-l)+Math.abs(n-h))/12),d=!0;for(let u=0;u<e.data.length;u+=4)e.data[u]===s&&e.data[u+1]===a&&e.data[u+2]===n||r&&Math.abs(e.data[u]-s)+Math.abs(e.data[u+1]-a)+Math.abs(e.data[u+2]-n)<c?e.data[u+3]=0:d=!1;return d}function xs(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function mi(e,t,i){let r=e.createElement("canvas");return r.width=t,r.height=i,r}function Ls(e,t,i,r,s,a,n,o){let l={foreground:a.foreground,background:a.background,cursor:ie,cursorAccent:ie,selectionForeground:ie,selectionBackgroundTransparent:ie,selectionBackgroundOpaque:ie,selectionInactiveBackgroundTransparent:ie,selectionInactiveBackgroundOpaque:ie,overviewRulerBorder:ie,scrollbarSliderBackground:ie,scrollbarSliderHoverBackground:ie,scrollbarSliderActiveBackground:ie,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:n,deviceMaxTextureSize:o,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}function Bt(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function bs(e){return(e&50331648)===16777216||(e&50331648)===33554432}var re=[];function wi(e,t,i,r,s,a,n,o,l){let h=Ls(r,s,a,n,t,i,o,l);for(let u=0;u<re.length;u++){let g=re[u],y=g.ownedBy.indexOf(e);if(y>=0){if(Bt(g.config,h))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),re.splice(u,1)):g.ownedBy.splice(y,1);break}}for(let u=0;u<re.length;u++){let g=re[u];if(Bt(g.config,h))return g.ownedBy.push(e),g.atlas}let c=e._core,d={atlas:new Ce(document,h,c.unicodeService),config:h,ownedBy:[e]};return re.push(d),d.atlas}function Et(e){for(let t=0;t<re.length;t++){let i=re[t].ownedBy.indexOf(e);if(i!==-1){re[t].ownedBy.length===1?(re[t].atlas.dispose(),re.splice(t,1)):re[t].ownedBy.splice(i,1);break}}}var He=600,ys=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=He){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=He-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=He-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},He)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function kt(e,t,i){let r=new t.ResizeObserver(s=>{let a=s.find(l=>l.target===e);if(!a)return;if(!("devicePixelContentBoxSize"in a)){r==null||r.disconnect(),r=void 0;return}let n=a.devicePixelContentBoxSize[0].inlineSize,o=a.devicePixelContentBoxSize[0].blockSize;n>0&&o>0&&i(n,o)});try{r.observe(e,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return X(()=>r==null?void 0:r.disconnect())}function Ms(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Ft=class Ci extends Be{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ui,this.combinedData=""}static fromCharData(t){let i=new Ci;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ms(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},xi=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Li(e,t,i){let r=W(e.createProgram());if(e.attachShader(r,W(Pt(e,e.VERTEX_SHADER,t))),e.attachShader(r,W(Pt(e,e.FRAGMENT_SHADER,i))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function Pt(e,t,i){let r=W(e.createShader(t));if(e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function Ss(e,t){let i=Math.min(e.length*2,t),r=new Float32Array(i);for(let s=0;s<e.length;s++)r[s]=e[s];return r}var As=class{constructor(e){this.texture=e,this.version=-1}},Rs=`#version 300 es
|
|
19
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
20
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
21
|
+
layout (location = 2) in vec2 a_offset;
|
|
22
|
+
layout (location = 3) in vec2 a_size;
|
|
23
|
+
layout (location = 4) in float a_texpage;
|
|
24
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
25
|
+
layout (location = 6) in vec2 a_texsize;
|
|
26
|
+
|
|
27
|
+
uniform mat4 u_projection;
|
|
28
|
+
uniform vec2 u_resolution;
|
|
29
|
+
|
|
30
|
+
out vec2 v_texcoord;
|
|
31
|
+
flat out int v_texpage;
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
35
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
36
|
+
v_texpage = int(a_texpage);
|
|
37
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
38
|
+
}`;function Ts(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
39
|
+
precision lowp float;
|
|
40
|
+
|
|
41
|
+
in vec2 v_texcoord;
|
|
42
|
+
flat in int v_texpage;
|
|
43
|
+
|
|
44
|
+
uniform sampler2D u_texture[${e}];
|
|
45
|
+
|
|
46
|
+
out vec4 outColor;
|
|
47
|
+
|
|
48
|
+
void main() {
|
|
49
|
+
if (v_texpage == 0) {
|
|
50
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
51
|
+
} ${t}
|
|
52
|
+
}`}var xe=11,Ae=xe*Float32Array.BYTES_PER_ELEMENT,Bs=2,D=0,F,nt=0,Ie=0,Es=class extends oe{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;Ce.maxAtlasPages===void 0&&(Ce.maxAtlasPages=Math.min(32,W(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),Ce.maxTextureSize=W(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=W(Li(s,Rs,Ts(Ce.maxAtlasPages))),this._register(X(()=>s.deleteProgram(this._program))),this._projectionLocation=W(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=W(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=W(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),n=s.createBuffer();this._register(X(()=>s.deleteBuffer(n))),s.bindBuffer(s.ARRAY_BUFFER,n),s.bufferData(s.ARRAY_BUFFER,a,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(X(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,o,s.STATIC_DRAW),this._attributesBuffer=W(s.createBuffer()),this._register(X(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,Ae,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,Ae,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,Ae,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,Ae,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,Ae,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,Ae,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let h=new Int32Array(Ce.maxAtlasPages);for(let c=0;c<Ce.maxAtlasPages;c++)h[c]=c;s.uniform1iv(this._textureLocation,h),s.uniformMatrix4fv(this._projectionLocation,!1,xi),this._atlasTextures=[];for(let c=0;c<Ce.maxAtlasPages;c++){let d=new As(W(s.createTexture()));this._register(X(()=>s.deleteTexture(d.texture))),s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,d.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=d}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,r,s,a,n,o,l){this._updateCell(this._vertices.attributes,e,t,i,r,s,a,n,o,l)}_updateCell(e,t,i,r,s,a,n,o,l,h){if(D=(i*this._terminal.cols+t)*xe,r===0||r===void 0){e.fill(0,D,D+xe-1-Bs);return}this._atlas&&(o&&o.length>1?F=this._atlas.getRasterizedGlyphCombinedChar(o,s,a,n,!1,this._terminal.element):F=this._atlas.getRasterizedGlyph(r,s,a,n,!1,this._terminal.element),nt=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==h&&F.offset.x>nt?(Ie=F.offset.x-nt,e[D]=-(F.offset.x-Ie)+this._dimensions.device.char.left,e[D+1]=-F.offset.y+this._dimensions.device.char.top,e[D+2]=(F.size.x-Ie)/this._dimensions.device.canvas.width,e[D+3]=F.size.y/this._dimensions.device.canvas.height,e[D+4]=F.texturePage,e[D+5]=F.texturePositionClipSpace.x+Ie/this._atlas.pages[F.texturePage].canvas.width,e[D+6]=F.texturePositionClipSpace.y,e[D+7]=F.sizeClipSpace.x-Ie/this._atlas.pages[F.texturePage].canvas.width,e[D+8]=F.sizeClipSpace.y):(e[D]=-F.offset.x+this._dimensions.device.char.left,e[D+1]=-F.offset.y+this._dimensions.device.char.top,e[D+2]=F.size.x/this._dimensions.device.canvas.width,e[D+3]=F.size.y/this._dimensions.device.canvas.height,e[D+4]=F.texturePage,e[D+5]=F.texturePositionClipSpace.x,e[D+6]=F.texturePositionClipSpace.y,e[D+7]=F.sizeClipSpace.x,e[D+8]=F.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&ji(r,l,F.size.x,this._dimensions.device.cell.width)&&(e[D+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*xe;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let r=0;r<e.rows;r++)for(let s=0;s<e.cols;s++)this._vertices.attributes[i+9]=s/e.cols,this._vertices.attributes[i+10]=r/e.rows,i+=xe}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<e.lineLengths.length;s++){let a=s*this._terminal.cols*xe,n=this._vertices.attributes.subarray(a,a+e.lineLengths[s]*xe);i.set(n,r),r+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,r),t.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(t,this._atlas,s);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/xe)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},ks=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let s=e.buffers.active.ydisp,a=t[1]-s,n=i[1]-s,o=Math.max(a,0),l=Math.min(n,e.rows-1);if(o>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=n,this.viewportCappedStartRow=o,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Fs(){return new ks}var Ze=4,je=1,Ye=2,ot=3,Ps=2147483648,$s=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Fs()}resize(e,t){let i=e*t*Ze;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Ds=`#version 300 es
|
|
53
|
+
layout (location = 0) in vec2 a_position;
|
|
54
|
+
layout (location = 1) in vec2 a_size;
|
|
55
|
+
layout (location = 2) in vec4 a_color;
|
|
56
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
57
|
+
|
|
58
|
+
uniform mat4 u_projection;
|
|
59
|
+
|
|
60
|
+
out vec4 v_color;
|
|
61
|
+
|
|
62
|
+
void main() {
|
|
63
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
64
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
65
|
+
v_color = a_color;
|
|
66
|
+
}`,Is=`#version 300 es
|
|
67
|
+
precision lowp float;
|
|
68
|
+
|
|
69
|
+
in vec4 v_color;
|
|
70
|
+
|
|
71
|
+
out vec4 outColor;
|
|
72
|
+
|
|
73
|
+
void main() {
|
|
74
|
+
outColor = v_color;
|
|
75
|
+
}`,ve=8,at=ve*Float32Array.BYTES_PER_ELEMENT,zs=20*ve,$t=class{constructor(){this.attributes=new Float32Array(zs),this.count=0}},fe=0,Dt=0,It=0,zt=0,Wt=0,Ot=0,Ut=0,Ws=class extends oe{constructor(e,t,i,r){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=r,this._vertices=new $t,this._verticesCursor=new $t;let s=this._gl;this._program=W(Li(s,Ds,Is)),this._register(X(()=>s.deleteProgram(this._program))),this._projectionLocation=W(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),n=s.createBuffer();this._register(X(()=>s.deleteBuffer(n))),s.bindBuffer(s.ARRAY_BUFFER,n),s.bufferData(s.ARRAY_BUFFER,a,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let o=new Uint8Array([0,1,2,3]),l=s.createBuffer();this._register(X(()=>s.deleteBuffer(l))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,l),s.bufferData(s.ELEMENT_ARRAY_BUFFER,o,s.STATIC_DRAW),this._attributesBuffer=W(s.createBuffer()),this._register(X(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,at,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,at,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,at,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),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,xi),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,i=this._vertices,r=1,s,a,n,o,l,h,c,d,u,g,y;for(s=0;s<t.rows;s++){for(n=-1,o=0,l=0,h=!1,a=0;a<t.cols;a++)c=(s*t.cols+a)*Ze,d=e.cells[c+je],u=e.cells[c+Ye],g=!!(u&67108864),(d!==o||u!==l&&(h||g))&&((o!==0||h&&l!==0)&&(y=r++*ve,this._updateRectangle(i,y,l,o,n,a,s)),n=a,o=d,l=u,h=g);(o!==0||h&&l!==0)&&(y=r++*ve,this._updateRectangle(i,y,l,o,n,t.cols,s))}i.count=r}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let r,s=0;(i.style==="bar"||i.style==="outline")&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(r=s++*ve,this._addRectangleFloat(t.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=s++*ve,this._addRectangleFloat(t.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=s}_updateRectangle(e,t,i,r,s,a,n){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:fe=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:fe=(i&16777215)<<8;break;case 0:default:fe=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:fe=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:fe=(r&16777215)<<8;break;case 0:default:fe=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=Ss(e.attributes,this._terminal.rows*this._terminal.cols*ve)),Dt=s*this._dimensions.device.cell.width,It=n*this._dimensions.device.cell.height,zt=(fe>>24&255)/255,Wt=(fe>>16&255)/255,Ot=(fe>>8&255)/255,Ut=1,this._addRectangle(e.attributes,t,Dt,It,(a-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,zt,Wt,Ot,Ut)}_addRectangle(e,t,i,r,s,a,n,o,l,h){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=n,e[t+5]=o,e[t+6]=l,e[t+7]=h}_addRectangleFloat(e,t,i,r,s,a,n){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=n[0],e[t+5]=n[1],e[t+6]=n[2],e[t+7]=n[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])}},Os=class extends oe{constructor(e,t,i,r,s,a,n,o){super(),this._container=t,this._alpha=s,this._coreBrowserService=a,this._optionsService=n,this._themeService=o,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-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(l=>{this._refreshCharAtlas(e,l),this.reset(e)})),this._register(X(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=W(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=wi(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,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*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,i,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ai,this._clipCell(i,r,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Us=class extends Os{constructor(e,t,i,r,s,a,n){super(i,e,"link",t,!0,s,a,n),this._register(r.onShowLinkUnderline(o=>this._handleShowLinkUnderline(o))),this._register(r.onHideLinkUnderline(o=>this._handleHideLinkUnderline(o)))}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&&bs(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()}},ye=typeof window=="object"?window:globalThis,vt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new P,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};vt.INSTANCE=new vt;var bi=vt;function Ns(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}bi.INSTANCE.onDidChangeZoomLevel;bi.INSTANCE.onDidChangeFullscreen;var Fe=typeof navigator=="object"?navigator.userAgent:"";Fe.indexOf("Firefox")>=0;Fe.indexOf("AppleWebKit")>=0;var qs=Fe.indexOf("Chrome")>=0;!qs&&Fe.indexOf("Safari")>=0;Fe.indexOf("Electron/")>=0;Fe.indexOf("Android")>=0;var ht=!1;if(typeof ye.matchMedia=="function"){let e=ye.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ye.matchMedia("(display-mode: fullscreen)");ht=e.matches,Ns(ye,e,({matches:i})=>{ht&&t.matches||(ht=i)})}var Ee="en",lt=!1,yi=!1,Ve,Xe=Ee,Nt=Ee,Gs,ne,Se=globalThis,j,Qt;typeof Se.vscode<"u"&&typeof Se.vscode.process<"u"?j=Se.vscode.process:typeof process<"u"&&typeof((Qt=process==null?void 0:process.versions)==null?void 0:Qt.node)=="string"&&(j=process);var Kt,Hs=typeof((Kt=j==null?void 0:j.versions)==null?void 0:Kt.electron)=="string",Vs=Hs&&(j==null?void 0:j.type)==="renderer",Jt;if(typeof j=="object"){j.platform,j.platform,lt=j.platform==="linux",lt&&j.env.SNAP&&j.env.SNAP_REVISION,j.env.CI||j.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ve=Ee,Xe=Ee;let e=j.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ve=t.userLocale,Nt=t.osLocale,Xe=t.resolvedLanguage||Ee,Gs=(Jt=t.languagePack)==null?void 0:Jt.translationsConfigFile}catch{}yi=!0}else typeof navigator=="object"&&!Vs?(ne=navigator.userAgent,ne.indexOf("Windows")>=0,ne.indexOf("Macintosh")>=0,(ne.indexOf("Macintosh")>=0||ne.indexOf("iPad")>=0||ne.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,lt=ne.indexOf("Linux")>=0,(ne==null?void 0:ne.indexOf("Mobi"))>=0,Xe=globalThis._VSCODE_NLS_LANGUAGE||Ee,Ve=navigator.language.toLowerCase(),Nt=Ve):console.error("Unable to resolve platform.");var qt=yi,ce=ne,we=Xe,js;(e=>{function t(){return we}e.value=t;function i(){return we.length===2?we==="en":we.length>=3?we[0]==="e"&&we[1]==="n"&&we[2]==="-":!1}e.isDefaultVariant=i;function r(){return we==="en"}e.isDefault=r})(js||={});var Ys=typeof Se.postMessage=="function"&&!Se.importScripts;(()=>{if(Ys){let e=[];Se.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=e.length;r<s;r++){let a=e[r];if(a.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Se.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var Xs=!!(ce&&ce.indexOf("Chrome")>=0);ce&&ce.indexOf("Firefox")>=0;!Xs&&ce&&ce.indexOf("Safari")>=0;ce&&ce.indexOf("Edg/")>=0;ce&&ce.indexOf("Android")>=0;var Re=typeof navigator=="object"?navigator:{};qt||document.queryCommandSupported&&document.queryCommandSupported("copy")||Re&&Re.clipboard&&Re.clipboard.writeText,qt||Re&&Re.clipboard&&Re.clipboard.readText;var Ct=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}},ct=new Ct,Gt=new Ct,Ht=new Ct;new Array(230);var Zs;(e=>{function t(o){return ct.keyCodeToStr(o)}e.toString=t;function i(o){return ct.strToKeyCode(o)}e.fromString=i;function r(o){return Gt.keyCodeToStr(o)}e.toUserSettingsUS=r;function s(o){return Ht.keyCodeToStr(o)}e.toUserSettingsGeneral=s;function a(o){return Gt.strToKeyCode(o)||Ht.strToKeyCode(o)}e.fromUserSettings=a;function n(o){if(o>=98&&o<=113)return null;switch(o){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ct.keyCodeToStr(o)}e.toElectronAccelerator=n})(Zs||={});var Mi=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Qs;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Ks?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:pe.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Mi})})(Qs||={});var Ks=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?Mi:(this._emitter||(this._emitter=new P),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Js;(e=>{async function t(r){let s,a=await Promise.all(r.map(n=>n.then(o=>o,o=>{s||(s=o)})));if(typeof s<"u")throw s;return a}e.settled=t;function i(r){return new Promise(async(s,a)=>{try{await r(s,a)}catch(n){a(n)}})}e.withAsyncBody=i})(Js||={});var Vt=class se{static fromArray(t){return new se(i=>{i.emitMany(t)})}static fromPromise(t){return new se(async i=>{i.emitMany(await t)})}static fromPromises(t){return new se(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new se(async i=>{await Promise.all(t.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new P,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await pe.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new se(async r=>{for await(let s of t)r.emitOne(i(s))})}map(t){return se.map(this,t)}static filter(t,i){return new se(async r=>{for await(let s of t)i(s)&&r.emitOne(s)})}filter(t){return se.filter(this,t)}static coalesce(t){return se.filter(t,i=>!!i)}coalesce(){return se.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return se.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Vt.EMPTY=Vt.fromArray([]);var{getWindow:er}=(function(){let e=new Map,t={window:ye,disposables:new ke};e.set(ye.vscodeWindowId,t);let i=new P,r=new P,s=new P;function a(n,o){return(typeof n=="number"?e.get(n):void 0)??(o?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(n){if(e.has(n.vscodeWindowId))return oe.None;let o=new ke,l={window:n,disposables:o.add(new ke)};return e.set(n.vscodeWindowId,l),o.add(X(()=>{e.delete(n.vscodeWindowId),r.fire(n)})),o.add(pt(n,ir.BEFORE_UNLOAD,()=>{s.fire(n)})),i.fire(l),o},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(n){return n.vscodeWindowId},hasWindow(n){return e.has(n)},getWindowById:a,getWindow(n){var h;let o=n;if((h=o==null?void 0:o.ownerDocument)!=null&&h.defaultView)return o.ownerDocument.defaultView.window;let l=n;return l!=null&&l.view?l.view.window:ye},getDocument(n){return er(n).document}}})(),tr=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,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,this._handler=null)}};function pt(e,t,i,r){return new tr(e,t,i,r)}var ir={BEFORE_UNLOAD:"beforeunload"},sr=class extends oe{constructor(e,t,i,r,s,a,n,o,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=a,this._optionsService=n,this._themeService=o,this._cursorBlinkStateManager=new Pe,this._charAtlasDisposable=this._register(new Pe),this._observerDisposable=this._register(new Pe),this._model=new $s,this._workCell=new Ft,this._workCell2=new Ft,this._rectangleRenderer=this._register(new Pe),this._glyphRenderer=this._register(new Pe),this._onChangeTextureAtlas=this._register(new P),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new P),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new P),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new P),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new P),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Zi(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Us(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,n,this._themeService)],this.dimensions=Yi(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(n.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(pt(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(pt(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Et(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=kt(this._canvas,this._coreBrowserService.window,(c,d)=>this._setCanvasDevicePixelDimensions(c,d)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=kt(this._canvas,c,(d,u)=>this._setCanvasDevicePixelDimensions(d,u))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(X(()=>{var c;for(let d of this._renderLayers)d.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),Et(this._terminal)}))}get textureAtlas(){var e;return(e=this._charAtlas)==null?void 0:e.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){var i,r,s,a;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let n of this._renderLayers)n.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`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(r=this._rectangleRenderer.value)==null||r.handleResize(),(s=this._glyphRenderer.value)==null||s.setDimensions(this.dimensions),(a=this._glyphRenderer.value)==null||a.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var e;for(let t of this._renderLayers)t.handleBlur(this._terminal);(e=this._cursorBlinkStateManager.value)==null||e.pause(),this._requestRedrawViewport()}handleFocus(){var e;for(let t of this._renderLayers)t.handleFocus(this._terminal);(e=this._cursorBlinkStateManager.value)==null||e.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){var e;for(let t of this._renderLayers)t.handleCursorMove(this._terminal);(e=this._cursorBlinkStateManager.value)==null||e.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Ws(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Es(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var t;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=wi(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=ii(pe.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),pe.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),(t=this._glyphRenderer.value)==null||t.setAtlas(this._charAtlas)}_clearModel(e){var t;this._model.clear(),e&&((t=this._glyphRenderer.value)==null||t.clear())}clearTextureAtlas(){var e;(e=this._charAtlas)==null||e.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var e;this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);(e=this._cursorBlinkStateManager.value)==null||e.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.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 ys(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,r=this._workCell,s,a,n,o,l,h,c=0,d=!0,u,g,y,T,$,O,R,S,x;e=jt(e,i.rows-1,0),t=jt(t,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,U=A-i.buffer.ydisp,Z=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),ae=-1,me=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(a=e;a<=t;a++)for(n=a+i.buffer.ydisp,o=i.buffer.lines.get(n),this._model.lineLengths[a]=0,y=A===n,c=0,l=this._characterJoinerService.getJoinedCharacters(n),S=0;S<i.cols;S++){if(s=this._cellColorResolver.result.bg,o.loadCell(S,r),S===0&&(s=this._cellColorResolver.result.bg),h=!1,d=S>=c,u=S,l.length>0&&S===l[0][0]&&d){g=l.shift();let w=this._model.selection.isCellSelected(this._terminal,g[0],n);for(R=g[0]+1;R<g[1];R++)d&&=w===this._model.selection.isCellSelected(this._terminal,R,n);d&&=!y||Z<g[0]||Z>=g[1],d?(h=!0,r=new rr(r,o.translateToString(!0,g[0],g[1]),g[1]-g[0]),u=g[1]-1):c=g[1]}if(T=r.getChars(),$=r.getCode(),R=(a*i.cols+S)*Ze,this._cellColorResolver.resolve(r,S,n,this.dimensions.device.cell.width),me&&n===A&&(S===Z&&(this._model.cursor={x:Z,y:U,width:r.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},ae=Z+r.getWidth()-1),S>=Z&&S<=ae&&(this._coreBrowserService.isFocused&&M==="block"||this._coreBrowserService.isFocused===!1&&i.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)),$!==0&&(this._model.lineLengths[a]=S+1),!(this._model.cells[R]===$&&this._model.cells[R+je]===this._cellColorResolver.result.bg&&this._model.cells[R+Ye]===this._cellColorResolver.result.fg&&this._model.cells[R+ot]===this._cellColorResolver.result.ext)&&(B=!0,T.length>1&&($|=Ps),this._model.cells[R]=$,this._model.cells[R+je]=this._cellColorResolver.result.bg,this._model.cells[R+Ye]=this._cellColorResolver.result.fg,this._model.cells[R+ot]=this._cellColorResolver.result.ext,O=r.getWidth(),this._glyphRenderer.value.updateCell(S,a,$,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,T,O,s),h)){for(r=this._workCell,S++;S<=u;S++)x=(a*i.cols+S)*Ze,this._glyphRenderer.value.updateCell(S,a,0,0,0,0,Ui,0,0),this._model.cells[x]=0,this._model.cells[x+je]=this._cellColorResolver.result.bg,this._model.cells[x+Ye]=this._cellColorResolver.result.fg,this._model.cells[x+ot]=this._cellColorResolver.result.ext;S--}}B&&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})}},rr=class extends Be{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function jt(e,t,i=0){return Math.max(Math.min(e,t),i)}var Yt="di$target",Xt="di$dependencies",dt=new Map;function de(e){if(dt.has(e))return dt.get(e);let t=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");nr(t,i,s)};return t._id=e,dt.set(e,t),t}function nr(e,t,i){t[Yt]===t?t[Xt].push({id:e,index:i}):(t[Xt]=[{id:e,index:i}],t[Yt]=t)}de("BufferService");de("CoreMouseService");de("CoreService");de("CharsetService");de("InstantiationService");de("LogService");var or=de("OptionsService");de("OscLinkService");de("UnicodeService");de("DecorationService");var ar={trace:0,debug:1,info:2,warn:3,error:4,off:5},hr="xterm.js: ",Zt=class extends oe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ar[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":hr)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Zt=Ti([Bi(0,or)],Zt);var cr=class extends oe{constructor(e){if(ni&&Oi()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new P),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new P),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new P),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new P),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 i=t.coreService,r=t.optionsService,s=t,a=s._renderService,n=s._characterJoinerService,o=s._charSizeService,l=s._coreBrowserService,h=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new sr(e,n,o,l,i,h,r,c,this._preserveDrawingBuffer)),this._register(pe.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(pe.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(pe.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(pe.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(X(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(e.cols,e.rows)}))}get textureAtlas(){var e;return(e=this._renderer)==null?void 0:e.textureAtlas}clearTextureAtlas(){var e;(e=this._renderer)==null||e.clearTextureAtlas()}};export{cr as WebglAddon};
|