@xterm/addon-image 0.7.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2019, 2020, 2021, 2022, 2023 The xterm.js authors (https://github.com/xtermjs/xterm.js)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ ## @xterm/addon-image
2
+
3
+ Inline image output in xterm.js. Supports SIXEL and iTerm's inline image protocol (IIP).
4
+
5
+
6
+ ![](fixture/example.png)
7
+
8
+
9
+ ### Install from npm
10
+
11
+ ```bash
12
+ npm install --save @xterm/addon-image
13
+ ```
14
+
15
+
16
+ ### Usage
17
+
18
+ ```ts
19
+ import { Terminal } from '@xterm/xterm';
20
+ import { ImageAddon, IImageAddonOptions } from '@xterm/addon-image';
21
+
22
+ // customize as needed (showing addon defaults)
23
+ const customSettings: IImageAddonOptions = {
24
+ enableSizeReports: true, // whether to enable CSI t reports (see below)
25
+ pixelLimit: 16777216, // max. pixel size of a single image
26
+ sixelSupport: true, // enable sixel support
27
+ sixelScrolling: true, // whether to scroll on image output
28
+ sixelPaletteLimit: 256, // initial sixel palette size
29
+ sixelSizeLimit: 25000000, // size limit of a single sixel sequence
30
+ storageLimit: 128, // FIFO storage limit in MB
31
+ showPlaceholder: true, // whether to show a placeholder for evicted images
32
+ iipSupport: true, // enable iTerm IIP support
33
+ iipSizeLimit: 20000000 // size limit of a single IIP sequence
34
+ }
35
+
36
+ // initialization
37
+ const terminal = new Terminal();
38
+ const imageAddon = new ImageAddon(customSettings);
39
+ terminal.loadAddon(imageAddon);
40
+ ```
41
+
42
+ ### General Notes
43
+
44
+ - *IMPORTANT:* The worker approach as done in previous releases got removed.
45
+ The addon contructor no longer expects a worker path as first argument.
46
+
47
+ - By default the addon will activate these `windowOptions` reports on the terminal:
48
+ - getWinSizePixels (CSI 14 t)
49
+ - getCellSizePixels (CSI 16 t)
50
+ - getWinSizeChars (CSI 18 t)
51
+
52
+ to help applications getting useful terminal metrics for their image preparations. Set `enableSizeReports` in the constructor options to `false`, if you dont want the addon to alter these terminal settings. This is especially useful, if you have very strict security needs not allowing any terminal reports, or deal with `windowOptions` by other means.
53
+
54
+
55
+ ### Operation Modes
56
+
57
+ - **SIXEL Support**
58
+ Set by default, change it with `{sixelSupport: true}`.
59
+
60
+ - **Scrolling On | Off**
61
+ By default scrolling is on, thus an image will advance the cursor at the bottom if needed.
62
+ (see cursor positioning).
63
+
64
+ If scrolling is off, the image gets painted from the top left of the current viewport
65
+ and might be truncated if the image exceeds the viewport size.
66
+ The cursor position does not change.
67
+
68
+ You can customize this behavior with the constructor option `{sixelScrolling: false}`
69
+ or with `DECSET 80` (off, binary: `\x1b [ ? 80 h`) and
70
+ `DECRST 80` (on, binary: `\x1b [ ? 80 l`) during runtime.
71
+
72
+ - **Cursor Positioning**
73
+ If scrolling is set, the cursor will be placed at the first image column of the last image row (VT340 mode).
74
+ Other cursor positioning modes as used by xterm or mintty are not supported.
75
+
76
+ - **SIXEL Palette Handling**
77
+ By default the addon limits the palette size to 256 registers (as demanded by the DEC specification).
78
+ The limit can be increased to a maximum of 4096 registers (via `sixelPaletteLimit`).
79
+
80
+ The default palette is a mixture of VT340 colors (lower 16 registers), xterm colors (up to 256) and zeros (up to 4096).
81
+ There is no private/shared palette distinction, palette colors are always carried over from a previous sixel image.
82
+ Restoring the default palette size and colors is possible with `XTSMGRAPHICS 1 ; 2` (binary: `\x1b[?1;2S`).
83
+ It gets also restored automatically on RIS and DECSTR.
84
+
85
+ Other than on older terminals, the underlying SIXEL library applies colors immediately to individual pixels
86
+ (*printer mode*), thus it is technically possible to use more colors in one image than the palette has color slots.
87
+ This feature is called *high-color* in libsixel.
88
+
89
+ A terminal wide shared palette mode with late indexed coloring of the output is not supported,
90
+ therefore palette animations cannot be used.
91
+
92
+ - **SIXEL Raster Attributes Handling**
93
+ If raster attributes were found in the SIXEL data (level 2), the image will always be truncated to the given height/width extend. We deviate here from the specification on purpose, as it allows several processing optimizations. For level 1 SIXEL data without any raster attributes the image can freely grow in width and height up to the last data byte, which has a much higher processing penalty. In general encoding libraries should not create level 1 data anymore and should not produce pixel information beyond the announced height/width extend. Both is discouraged by the >30 years old specification.
94
+
95
+ Currently the SIXEL implementation of the addon does not take custom pixel sizes into account, a SIXEL pixel will map 1:1 to a screen pixel.
96
+
97
+ - **IIP Support (iTerm's Inline Image Protocol)**
98
+ Set by default, change it with `{iipSupport: true}`.
99
+
100
+ The IIP implementation has the following features / restrictions (sequence will silently fail for unmet conditions):
101
+ - Supported formats: PNG, JPEG and GIF
102
+ - No animation support.
103
+ - Image type hinting is not supported (always deducted from data header).
104
+ - File download is not supported.
105
+ - Filename gets parsed but not used.
106
+ - Strict base64 handling as of RFC4648 §4 (standard alphabet, optional padding, no separator bytes allowed).
107
+ - Payload size may not exceed CEIL(sizeParameter * 4 / 3).
108
+ - Image scaling beyond terminal viewport size is allowed (e.g. `width=200%`).
109
+ - Image pixel size is restricted by `pixelLimit` (pre- and post resizing).
110
+ - Size parameter is restricted by `iipSizeLimit`.
111
+ - Cursor positioning behaves the same as for sixel (see above).
112
+
113
+
114
+ ### Storage and Drawing Settings
115
+
116
+ The internal storage holds images up to `storageLimit` (in MB, calculated as 4-channel RBGA unpacked, default 100 MB). Once hit images get evicted by FIFO rules. Furthermore images on the alternate buffer will always be erased on buffer changes.
117
+
118
+ The addon exposes two properties to interact with the storage limits at runtime:
119
+ - `storageLimit`
120
+ Change the value to your needs at runtime. This is especially useful, if you have multiple terminal
121
+ instances running, that all add to one upper memory limit.
122
+ - `storageUsage`
123
+ Inspect the current memory usage of the image storage.
124
+
125
+ By default the addon will show a placeholder pattern for evicted images that are still part
126
+ of the terminal (e.g. in the scrollback). The pattern can be deactivated by toggling `showPlaceholder`.
127
+
128
+ ### Image Data Retrieval
129
+
130
+ The addon provides the following API endpoints to retrieve raw image data as canvas:
131
+
132
+ - `getImageAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined`
133
+ Returns the canvas containing the original image data (not resized) at the given buffer position.
134
+ The buffer position is the 0-based absolute index (including scrollback at top).
135
+
136
+ - `extractTileAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined`
137
+ Returns a canvas containing the actual single tile image data (maybe resized) at the given buffer position.
138
+ The buffer position is the 0-based absolute index (including scrollback at top).
139
+ Note that the canvas gets created and data copied over for every call, thus it is not suitable for performance critical actions.
140
+
141
+ ### Memory Usage
142
+
143
+ The addon does most image processing in Javascript and therefore can occupy a rather big amount of memory. To get an idea where the memory gets eaten, lets look at the data flow and processing steps:
144
+ - Incomming image data chunk at `term.write` (terminal)
145
+ `term.write` might stock up incoming chunks. To circumvent this, you will need proper flow control (see xterm.js docs). Note that with image output it is more likely to run into this issue, as it can create lots of MBs in very short time.
146
+ - Sequence Parser (terminal)
147
+ The parser operates on a buffer containing up to 2^17 codepoints (~0.5 MB).
148
+ - Sequence Handler - Chunk Decoding (addon)
149
+ Image data chunks are processed immediately by the SIXEL decoder (streamlined). The decoder allocates memory for image
150
+ pixels as needed. The allowed image size is restricted by `pixelLimit` (default 16M pixels), the decoder holds 2 pixel buffers at maximum during decoding (RGBA, ~128 MB for 16M pixels).
151
+ - Sequence Handler - Image Finalization (addon)
152
+ After decoding the final pixel buffer is grabbed by the sequence handler and written to a canvas of the same size (~64 MB for 16M pixels) and added to the storage.
153
+ - Image Storage (addon)
154
+ The image storage implements a FIFO cache, that will remove old images, if a new one arrives and `storageLimit` is hit (default 128 MB). The storage holds a canvas with the original image, and may additionally hold resized versions of images after a font rescaling. Both are accounted in `storageUsage` as a rough estimation of _pixels x 4 channels_.
155
+
156
+ Following the steps above, a rough estimation of maximum memory usage by the addon can be calculated with these formulas (in bytes):
157
+ ```typescript
158
+ // storage alone
159
+ const storageBytes = storageUsage * storageLimit * 1024 * 1024;
160
+ // decoding alone
161
+ const decodingBytes = sixelSizeLimit + 2 * (pixelLimit * 4);
162
+
163
+ // totals
164
+ // inactive decoding
165
+ const totalInactive = storageBytes;
166
+ // active decoding
167
+ const totalActive = storageBytes + decodingBytes;
168
+ ```
169
+
170
+ Note that browsers have offloading tricks for rarely touched memory segments, esp. `storageBytes` might not directly translate into real memory usage. Usage peaks will happen during active decoding of multiple big images due to the need of 2 full pixel buffers at the same time, which cannot be offloaded. Thus you may want to keep an eye on `pixelLimit` under limited memory conditions.
171
+ Further note that the formulas above do not respect the Javascript object's overhead. Compared to the raw buffer needs the book keeping by these objects is rather small (<<5%).
172
+
173
+ _Why should I care about memory usage at all?_
174
+ Well you don't have to, and it probably will just work fine with the addon defaults. But for bigger integrations, where much more data is held in the Javascript context (like multiple terminals on one page), it is likely to hit the engine's memory limit sooner or later under decoding and/or storage pressure.
175
+
176
+ _How can I adjust the memory usage?_
177
+ - `pixelLimit`
178
+ A constructor setting, thus you would have to anticipate, whether (multiple) terminals in your page gonna do lots of concurrent decoding. Since this is normally not the case and the memory usage is only temporarily peaking, a rather high value should work even with multiple terminals in one page.
179
+ - `storageLimit`
180
+ A constructor and a runtime setting. In conjunction with `storageUsage` you can do runtime checks and adjust the limit to your needs. If you have to lower the limit below the current usage, images will be removed in FIFO order and may turn into a placeholder in the terminal's scrollback (if `showPlaceholder` is set). When adjusting keep in mind to leave enough room for memory peaking for decoding.
181
+ - `sixelSizeLimit`
182
+ A constructor setting. This has only a small impact on peaking memory during decoding. It is meant to avoid processing of overly big or broken SIXEL sequences at an earlier phase, thus may stop the decoder from entering its memory intensive task for potentially invalid data.
183
+
184
+
185
+ ### Terminal Interaction
186
+
187
+ - Images already on the terminal screen will reshape on font-rescaling to keep the terminal cell coverage intact.
188
+ This behavior might diverge from other terminals, but is in general the more desired one.
189
+ - On terminal resize images may expand to the right automatically, if they were right-truncated before.
190
+ They never expand to the bottom, if they were bottom-truncated before (e.g. from scrolling-off).
191
+ - Text autowrapping from terminal resize may break and wrap images into multiple parts. This is unfortunate,
192
+ but cannot be avoided, while sticking to the stronger terminal text-grid mechanics.
193
+ (Yes images are a second class citizen on a mainly text-driven interface.)
194
+ - Characters written over an image will erase the image information for affected cells.
195
+ - Images are painted above BG/FG data not erasing it. More advanced "composition tricks" like painting images
196
+ below FG/BG data are not possible. (We currently dont hook into BG/FG rendering itself.)
197
+ - Previous image data at a cell will be erased on new image data. (We currently have no transparency composition.)
198
+
199
+
200
+ ### Performance & Latency
201
+
202
+ - Performance should be good enough for occasional SIXEL output from REPLs, up to downscaled movies
203
+ from `mpv` with its SIXEL renderer (tested in the demo). For 3rd party xterm.js integrations this
204
+ furthermore depends highly on the overall incoming data throughput.
205
+ - Image processing has a high latency. Most of the latency though is inherited from xterm.js' incoming data route
206
+ (PTY -> server process -> websocket -> xterm.js async parsing), where every step creates more waiting time.
207
+ Since we cannot do much about that "long line", keep that in mind when you try to run more demanding applications with realtime drawing and interactive response needs.
208
+
209
+
210
+ ### Status
211
+
212
+ - Sixel support and image handling in xterm.js is considered beta quality.
213
+ - IIP support is in alpha stage. Please file a bug for any awkwardities.
214
+
215
+
216
+ ### Changelog
217
+
218
+ - 0.5.0 integrate with xtermjs base repo (at v0.4.3)
219
+ - 0.4.3 defer canvas creation
220
+ - 0.4.2 fix image canvas resize
221
+ - 0.4.1 compat release for xterm.js 5.2.0
222
+ - 0.4.0 IIP support
223
+ - 0.3.1 compat release for xterm.js 5.1.0
224
+ - 0.3.0 important change: worker removed from addon
225
+ - 0.2.0 compat release for xterm.js 5.0.0
226
+ - 0.1.3 bugfix: avoid striping
227
+ - 0.1.2 bugfix: reset clear flag
228
+ - 0.1.1 bugfixes:
229
+ - clear sticky image tiles on render
230
+ - create folder from bootstrap.sh
231
+ - fix peer dependency in package.json
@@ -0,0 +1,3 @@
1
+ /*! For license information please see addon-image.js.LICENSE.txt */
2
+ !function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ImageAddon=e():A.ImageAddon=e()}(self,(()=>(()=>{"use strict";var A={615:(A,e)=>{function t(A){if("undefined"!=typeof Buffer)return Buffer.from(A,"base64");const e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<t.length;++A)t[A]=e.charCodeAt(A);return t}Object.defineProperty(e,"__esModule",{value:!0}),e.InWasm=void 0,e.InWasm=function(A){if(A.d){const{t:e,s:i,d:s}=A;let r,g;const a=WebAssembly;return 2===e?i?()=>r||(r=t(s)):()=>Promise.resolve(r||(r=t(s))):1===e?i?()=>g||(g=new a.Module(r||(r=t(s)))):()=>g?Promise.resolve(g):a.compile(r||(r=t(s))).then((A=>g=A)):i?A=>new a.Instance(g||(g=new a.Module(r||(r=t(s)))),A):A=>g?a.instantiate(g,A):a.instantiate(r||(r=t(s)),A).then((A=>(g=A.module)&&A.instance))}if("undefined"==typeof _wasmCtx)throw new Error('must run "inwasm"');_wasmCtx.add(A)}},477:(A,e)=>{function t(A){return 255&A}function i(A){return A>>>8&255}function s(A){return A>>>16&255}function r(A,e,t,i=255){return((255&i)<<24|(255&t)<<16|(255&e)<<8|255&A)>>>0}function g(A,e,t){return Math.max(A,Math.min(t,e))}function a(A,e,t){return t<0&&(t+=1),t>1&&(t-=1),6*t<1?e+6*(A-e)*t:2*t<1?A:3*t<2?e+(A-e)*(4-6*t):e}function o(A,e,t){return(4278190080|Math.round(t/100*255)<<16|Math.round(e/100*255)<<8|Math.round(A/100*255))>>>0}Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FOREGROUND=e.DEFAULT_BACKGROUND=e.PALETTE_ANSI_256=e.PALETTE_VT340_GREY=e.PALETTE_VT340_COLOR=e.normalizeHLS=e.normalizeRGB=e.nearestColorIndex=e.fromRGBA8888=e.toRGBA8888=e.alpha=e.blue=e.green=e.red=e.BIG_ENDIAN=void 0,e.BIG_ENDIAN=255===new Uint8Array(new Uint32Array([4278190080]).buffer)[0],e.BIG_ENDIAN&&console.warn("BE platform detected. This version of node-sixel works only on LE properly."),e.red=t,e.green=i,e.blue=s,e.alpha=function(A){return A>>>24&255},e.toRGBA8888=r,e.fromRGBA8888=function(A){return[255&A,A>>8&255,A>>16&255,A>>>24]},e.nearestColorIndex=function(A,e){const r=t(A),g=i(A),a=s(A);let o=Number.MAX_SAFE_INTEGER,h=-1;for(let A=0;A<e.length;++A){const t=r-e[A][0],i=g-e[A][1],s=a-e[A][2],n=t*t+i*i+s*s;if(!n)return A;n<o&&(o=n,h=A)}return h},e.normalizeRGB=o,e.normalizeHLS=function(A,e,t){return function(A,e,t){if(!t){const A=Math.round(255*e);return r(A,A,A)}const i=e<.5?e*(1+t):e+t-e*t,s=2*e-i;return r(g(0,255,Math.round(255*a(i,s,A+1/3))),g(0,255,Math.round(255*a(i,s,A))),g(0,255,Math.round(255*a(i,s,A-1/3))))}((A+240)/360,e/100,t/100)},e.PALETTE_VT340_COLOR=new Uint32Array([o(0,0,0),o(20,20,80),o(80,13,13),o(20,80,20),o(80,20,80),o(20,80,80),o(80,80,20),o(53,53,53),o(26,26,26),o(33,33,60),o(60,26,26),o(33,60,33),o(60,33,60),o(33,60,60),o(60,60,33),o(80,80,80)]),e.PALETTE_VT340_GREY=new Uint32Array([o(0,0,0),o(13,13,13),o(26,26,26),o(40,40,40),o(6,6,6),o(20,20,20),o(33,33,33),o(46,46,46),o(0,0,0),o(13,13,13),o(26,26,26),o(40,40,40),o(6,6,6),o(20,20,20),o(33,33,33),o(46,46,46)]),e.PALETTE_ANSI_256=(()=>{const A=[r(0,0,0),r(205,0,0),r(0,205,0),r(205,205,0),r(0,0,238),r(205,0,205),r(0,250,205),r(229,229,229),r(127,127,127),r(255,0,0),r(0,255,0),r(255,255,0),r(92,92,255),r(255,0,255),r(0,255,255),r(255,255,255)],e=[0,95,135,175,215,255];for(let t=0;t<6;++t)for(let i=0;i<6;++i)for(let s=0;s<6;++s)A.push(r(e[t],e[i],e[s]));for(let e=8;e<=238;e+=10)A.push(r(e,e,e));return new Uint32Array(A)})(),e.DEFAULT_BACKGROUND=r(0,0,0,255),e.DEFAULT_FOREGROUND=r(255,255,255,255)},710:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeAsync=e.decode=e.Decoder=e.DecoderAsync=void 0;const i=t(477),s=t(343),r=function(A){if("undefined"!=typeof Buffer)return Buffer.from(A,"base64");const e=atob(A),t=new Uint8Array(e.length);for(let A=0;A<t.length;++A)t[A]=e.charCodeAt(A);return t}(s.LIMITS.BYTES);let g;const a=new Uint32Array;class o{constructor(){this.bandHandler=A=>1,this.modeHandler=A=>1}handle_band(A){return this.bandHandler(A)}mode_parsed(A){return this.modeHandler(A)}}const h={memoryLimit:134217728,sixelColor:i.DEFAULT_FOREGROUND,fillColor:i.DEFAULT_BACKGROUND,palette:i.PALETTE_VT340_COLOR,paletteLimit:s.LIMITS.PALETTE_SIZE,truncate:!0};function n(A){const e=new o,t={env:{handle_band:e.handle_band.bind(e),mode_parsed:e.mode_parsed.bind(e)}};return WebAssembly.instantiate(g||r,t).then((t=>(g=g||t.module,new I(A,t.instance||t,e))))}e.DecoderAsync=n;class I{constructor(A,e,t){if(this._PIXEL_OFFSET=s.LIMITS.MAX_WIDTH+4,this._canvas=a,this._bandWidths=[],this._maxWidth=0,this._minWidth=s.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0,this._opts=Object.assign({},h,A),this._opts.paletteLimit>s.LIMITS.PALETTE_SIZE)throw new Error(`DecoderOptions.paletteLimit must not exceed ${s.LIMITS.PALETTE_SIZE}`);if(e)t.bandHandler=this._handle_band.bind(this),t.modeHandler=this._initCanvas.bind(this);else{const A=g||(g=new WebAssembly.Module(r));e=new WebAssembly.Instance(A,{env:{handle_band:this._handle_band.bind(this),mode_parsed:this._initCanvas.bind(this)}})}this._instance=e,this._wasm=this._instance.exports,this._chunk=new Uint8Array(this._wasm.memory.buffer,this._wasm.get_chunk_address(),s.LIMITS.CHUNK_SIZE),this._states=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_state_address(),12),this._palette=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_palette_address(),s.LIMITS.PALETTE_SIZE),this._palette.set(this._opts.palette),this._pSrc=new Uint32Array(this._wasm.memory.buffer,this._wasm.get_p0_address()),this._wasm.init(i.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}get _fillColor(){return this._states[0]}get _truncate(){return this._states[8]}get _rasterWidth(){return this._states[6]}get _rasterHeight(){return this._states[7]}get _width(){return this._states[2]?this._states[2]-4:0}get _height(){return this._states[3]}get _level(){return this._states[9]}get _mode(){return this._states[10]}get _paletteLimit(){return this._states[11]}_initCanvas(A){if(2===A){const A=this.width*this.height;if(A>this._canvas.length){if(this._opts.memoryLimit&&4*A>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(A)}this._maxWidth=this._width}else if(1===A)if(2===this._level){const A=Math.min(this._rasterWidth,s.LIMITS.MAX_WIDTH)*this._rasterHeight;if(A>this._canvas.length){if(this._opts.memoryLimit&&4*A>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");this._canvas=new Uint32Array(A)}}else this._canvas.length<65536&&(this._canvas=new Uint32Array(65536));return 0}_realloc(A,e){const t=A+e;if(t>this._canvas.length){if(this._opts.memoryLimit&&4*t>this._opts.memoryLimit)throw this.release(),new Error("image exceeds memory limit");const A=new Uint32Array(65536*Math.ceil(t/65536));A.set(this._canvas),this._canvas=A}}_handle_band(A){const e=this._PIXEL_OFFSET;let t=this._lastOffset;if(2===this._mode){let i=this.height-this._currentHeight,s=0;for(;s<6&&i>0;)this._canvas.set(this._pSrc.subarray(e*s,e*s+A),t+A*s),s++,i--;this._lastOffset+=A*s,this._currentHeight+=s}else if(1===this._mode){this._realloc(t,6*A),this._maxWidth=Math.max(this._maxWidth,A),this._minWidth=Math.min(this._minWidth,A);for(let i=0;i<6;++i)this._canvas.set(this._pSrc.subarray(e*i,e*i+A),t+A*i);this._bandWidths.push(A),this._lastOffset+=6*A,this._currentHeight+=6}return 0}get width(){return 1!==this._mode?this._width:Math.max(this._maxWidth,this._wasm.current_width())}get height(){return 1!==this._mode?this._height:this._wasm.current_width()?6*this._bandWidths.length+this._wasm.current_height():6*this._bandWidths.length}get palette(){return this._palette.subarray(0,this._paletteLimit)}get memoryUsage(){return this._canvas.byteLength+this._wasm.memory.buffer.byteLength+8*this._bandWidths.length}get properties(){return{width:this.width,height:this.height,mode:this._mode,level:this._level,truncate:!!this._truncate,paletteLimit:this._paletteLimit,fillColor:this._fillColor,memUsage:this.memoryUsage,rasterAttributes:{numerator:this._states[4],denominator:this._states[5],width:this._rasterWidth,height:this._rasterHeight}}}init(A=this._opts.fillColor,e=this._opts.palette,t=this._opts.paletteLimit,i=this._opts.truncate){this._wasm.init(this._opts.sixelColor,A,t,i?1:0),e&&this._palette.set(e.subarray(0,s.LIMITS.PALETTE_SIZE)),this._bandWidths.length=0,this._maxWidth=0,this._minWidth=s.LIMITS.MAX_WIDTH,this._lastOffset=0,this._currentHeight=0}decode(A,e=0,t=A.length){let i=e;for(;i<t;){const e=Math.min(t-i,s.LIMITS.CHUNK_SIZE);this._chunk.set(A.subarray(i,i+=e)),this._wasm.decode(0,e)}}decodeString(A,e=0,t=A.length){let i=e;for(;i<t;){const e=Math.min(t-i,s.LIMITS.CHUNK_SIZE);for(let t=0,s=i;t<e;++t,++s)this._chunk[t]=A.charCodeAt(s);i+=e,this._wasm.decode(0,e)}}get data32(){if(0===this._mode||!this.width||!this.height)return a;const A=this._wasm.current_width();if(2===this._mode){let e=this.height-this._currentHeight;if(e>0){const t=this._PIXEL_OFFSET;let i=this._lastOffset,s=0;for(;s<6&&e>0;)this._canvas.set(this._pSrc.subarray(t*s,t*s+A),i+A*s),s++,e--;e&&this._canvas.fill(this._fillColor,i+A*s)}return this._canvas.subarray(0,this.width*this.height)}if(1===this._mode){if(this._minWidth===this._maxWidth){let e=!1;if(A)if(A!==this._minWidth)e=!0;else{const e=this._PIXEL_OFFSET;let t=this._lastOffset;this._realloc(t,6*A);for(let i=0;i<6;++i)this._canvas.set(this._pSrc.subarray(e*i,e*i+A),t+A*i)}if(!e)return this._canvas.subarray(0,this.width*this.height)}const e=new Uint32Array(this.width*this.height);e.fill(this._fillColor);let t=0,i=0;for(let A=0;A<this._bandWidths.length;++A){const s=this._bandWidths[A];for(let A=0;A<6;++A)e.set(this._canvas.subarray(i,i+=s),t),t+=this.width}if(A){const i=this._PIXEL_OFFSET,s=this._wasm.current_height();for(let r=0;r<s;++r)e.set(this._pSrc.subarray(i*r,i*r+A),t+this.width*r)}return e}return a}get data8(){return new Uint8ClampedArray(this.data32.buffer,0,this.width*this.height*4)}release(){this._canvas=a,this._bandWidths.length=0,this._maxWidth=0,this._minWidth=s.LIMITS.MAX_WIDTH,this._wasm.init(i.DEFAULT_FOREGROUND,0,this._opts.paletteLimit,0)}}e.Decoder=I,e.decode=function(A,e){const t=new I(e);return t.init(),"string"==typeof A?t.decodeString(A):t.decode(A),{width:t.width,height:t.height,data32:t.data32,data8:t.data8}},e.decodeAsync=async function(A,e){const t=await n(e);return t.init(),"string"==typeof A?t.decodeString(A):t.decode(A),{width:t.width,height:t.height,data32:t.data32,data8:t.data8}}},343:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LIMITS=void 0,e.LIMITS={CHUNK_SIZE:16384,PALETTE_SIZE:4096,MAX_WIDTH:16384,BYTES:"AGFzbQEAAAABJAdgAAF/YAJ/fwBgA39/fwF/YAF/AX9gAABgBH9/f38AYAF/AAIlAgNlbnYLaGFuZGxlX2JhbmQAAwNlbnYLbW9kZV9wYXJzZWQAAwMTEgQAAAAAAQQBAQUBAAACAgAGAwQFAXABBwcFBAEBBwcGCAF/AUGAihoLB9wBDgZtZW1vcnkCABFnZXRfc3RhdGVfYWRkcmVzcwADEWdldF9jaHVua19hZGRyZXNzAAQOZ2V0X3AwX2FkZHJlc3MABRNnZXRfcGFsZXR0ZV9hZGRyZXNzAAYEaW5pdAALBmRlY29kZQAMDWN1cnJlbnRfd2lkdGgADQ5jdXJyZW50X2hlaWdodAAOGV9faW5kaXJlY3RfZnVuY3Rpb25fdGFibGUBAAtfaW5pdGlhbGl6ZQACCXN0YWNrU2F2ZQARDHN0YWNrUmVzdG9yZQASCnN0YWNrQWxsb2MAEwkMAQBBAQsGCgcJDxACDAEBCq5UEgMAAQsFAEGgCAsGAEGQiQELBgBBsIkCCwUAQZAJC+okAQh/QeQIKAIAIQVB4AgoAgAhA0HoCCgCACEIIAFBkIkBaiIJQf8BOgAAIAAgAUgEQCAAQZCJAWohBgNAIAMhBCAGQQFqIQECQCAGLQAAQf8AcSIDQTBrQQlLBEAgASEGDAELQewIKAIAQQJ0QewIaiICKAIAIQADQCACIAMgAEEKbGpBMGsiADYCACABLQAAIQMgAUEBaiIGIQEgA0H/AHEiA0Ewa0EKSQ0ACwsCQAJAAkACQAJAAkACQAJ/AkACQCADQT9rIgBBP00EQCAERQ0BIARBIUYEQAJAQfAIKAIAIgFBASABGyIHIAhqIgFB1AgoAgAiA0gNACADQf//AEoNAANAIANBAnQiAkGgiQJqIgRB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HEiA0E/ayIAQcAASQ0ACyAECyECQQAhBCACIQYgASEIIANB/QBxQSFGDQELIANBJGsOCgEDAwMDAwMDAwIDC0HsCEIBNwIADAQLQdgIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbNgIADAILQegIIAFB2AgoAgAiACAAIAFIGyIAQYCAASAAQYCAAUgbIgA2AgBB2AggADYCACAAQQRrEAAEQEHoCEEENgIAQdgIQQQ2AgBB0AhBATYCAA8LEAgMAQsCQCADQTtHDQBB7AgoAgAiAEEHSg0AQewIIABBAWo2AgAgAEECdEHwCGpBADYCAAsgAiEGIAQhAyABIQgMAQtBBCEIIAIhBiAEIQMLIAYgCUkNAAsLQeQIIAU2AgBB4AggAzYCAEHoCCAINgIAC9ELAgF+CH9B2AhCBDcDAEGojQJBoAgpAwAiADcDAEGgjQIgADcDAEGYjQIgADcDAEGQjQIgADcDAEGIjQIgADcDAEGAjQIgADcDAEH4jAIgADcDAEHwjAIgADcDAEHojAIgADcDAEHgjAIgADcDAEHYjAIgADcDAEHQjAIgADcDAEHIjAIgADcDAEHAjAIgADcDAEG4jAIgADcDAEGwjAIgADcDAEGojAIgADcDAEGgjAIgADcDAEGYjAIgADcDAEGQjAIgADcDAEGIjAIgADcDAEGAjAIgADcDAEH4iwIgADcDAEHwiwIgADcDAEHoiwIgADcDAEHgiwIgADcDAEHYiwIgADcDAEHQiwIgADcDAEHIiwIgADcDAEHAiwIgADcDAEG4iwIgADcDAEGwiwIgADcDAEGoiwIgADcDAEGgiwIgADcDAEGYiwIgADcDAEGQiwIgADcDAEGIiwIgADcDAEGAiwIgADcDAEH4igIgADcDAEHwigIgADcDAEHoigIgADcDAEHgigIgADcDAEHYigIgADcDAEHQigIgADcDAEHIigIgADcDAEHAigIgADcDAEG4igIgADcDAEGwigIgADcDAEGoigIgADcDAEGgigIgADcDAEGYigIgADcDAEGQigIgADcDAEGIigIgADcDAEGAigIgADcDAEH4iQIgADcDAEHwiQIgADcDAEHoiQIgADcDAEHg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Dq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQECQCAABEAgBUMAAIA/kiEEDAELIAUiBEMAAIA/XkUNACAFQwAAgL+SIQQLIAVDq6qqvpIiBUMAAAAAXSECAn8CfSADIAcgA5NDAADAQJQgBJSSIARDq6oqPl0NABogByAEQwAAAD9dDQAaIAMgBEOrqio/XUUNABogAyAHIAOTIARDAADAwJRDAACAQJKUkgtDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALIQACQCACBEAgBUMAAIA/kiEFDAELIAVDAACAP15FDQAgBUMAAIC/kiEFCwJAIAVDq6oqPl0EQCADIAcgA5NDAADAQJQgBZSSIQcMAQsgBUMAAAA/XQ0AIAVDq6oqP11FBEAgAyEHDAELIAMgByADkyAFQwAAwMCUQwAAgECSlJIhBwsgAEEIdAJ/IAdDAAB/Q5RDAAAAP5IiBkMAAIBPXSAGQwAAAABgcQRAIAapDAELQQALQRB0ciABcgtBgICAeHILNwAgAEH/AWxBMmpB5ABtIAFB/wFsQTJqQeQAbUEIdHIgAkH/AWxBMmpB5ABtQRB0ckGAgIB4cgsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwsYAQBBgAgLEQEAAAACAAAAAwAAAAQAAAAF"}},280:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=(0,t(615).InWasm)({s:1,t:0,d:"AGFzbQEAAAABBQFgAAF/Ag8BA2VudgZtZW1vcnkCAAEDAwIAAAcNAgNkZWMAAANlbmQAAQqxAwKuAQEFf0GIKCgCAEGgKGohAUGEKCgCACIAQYAoKAIAQQFrQXxxIgJIBEAgAkGgKGohAyAAQaAoaiEAA0AgAC0AA0ECdCgCgCAgAC0AAkECdCgCgBggAC0AAUECdCgCgBAgAC0AAEECdCgCgAhycnIiBEH///8HSwRAQQEPCyABIAQ2AgAgAUEDaiEBIABBBGoiACADSQ0ACwtBhCggAjYCAEGIKCABQaAoazYCAEEAC/4BAQZ/AkBBgCgoAgAiAUGEKCgCACIAa0EFTgRAQQEhAxAADQFBgCgoAgAhAUGEKCgCACEAC0EBIQMgASAAayIEQQJIDQAgAEGhKGotAABBAnQoAoAQIABBoChqLQAAQQJ0KAKACHIhAQJAIARBAkYEQEEBIQIMAQtBASECIAAtAKIoIgVBPUcEQEECIQIgBUECdCgCgBggAXIhAQsgBEEERw0AIAAtAKMoIgBBPUYNACACQQFqIQIgAEECdCgCgCAgAXIhAQsgAUH///8HSw0AQYgoKAIAQaAoaiABNgIAQYgoQYgoKAIAIAJqIgA2AgAgAEGQKCgCAEchAwsgAwsAdglwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQEFY2xhbmdWMTguMC4wIChodHRwczovL2dpdGh1Yi5jb20vbGx2bS9sbHZtLXByb2plY3QgZDFlNjg1ZGY0NWRjNTk0NGI0M2QyNTQ3ZDAxMzhjZDRhM2VlNGVmZSkALA90YXJnZXRfZmVhdHVyZXMCKw9tdXRhYmxlLWdsb2JhbHMrCHNpZ24tZXh0"}),s=new Uint8Array("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").map((A=>A.charCodeAt(0)))),r=new Uint32Array(1024);r.fill(4278190080);for(let A=0;A<s.length;++A)r[s[A]]=A<<2;for(let A=0;A<s.length;++A)r[256+s[A]]=A>>4|(A<<4&255)<<8;for(let A=0;A<s.length;++A)r[512+s[A]]=A>>2<<8|(A<<6&255)<<16;for(let A=0;A<s.length;++A)r[768+s[A]]=A<<16;const g=new Uint8Array(0);e.default=class{constructor(A){this.keepSize=A}get data8(){return this._inst?this._d.subarray(0,this._m32[1282]):g}release(){this._inst&&(this._mem.buffer.byteLength>this.keepSize?this._inst=this._m32=this._d=this._mem=null:(this._m32[1280]=0,this._m32[1281]=0,this._m32[1282]=0))}init(A){let e=this._m32;const t=4*(Math.ceil(A/3)+1288);this._inst?this._mem.buffer.byteLength<t&&(this._mem.grow(Math.ceil((t-this._mem.buffer.byteLength)/65536)),e=new Uint32Array(this._mem.buffer,0),this._d=new Uint8Array(this._mem.buffer,5152)):(this._mem=new WebAssembly.Memory({initial:Math.ceil(t/65536)}),this._inst=i({env:{memory:this._mem}}),e=new Uint32Array(this._mem.buffer,0),e.set(r,256),this._d=new Uint8Array(this._mem.buffer,5152)),e[1284]=A,e[1283]=4*Math.ceil(A/3),e[1280]=0,e[1281]=0,e[1282]=0,this._m32=e}put(A,e,t){if(!this._inst)return 1;const i=this._m32;return t-e+i[1280]>i[1283]?1:(this._d.set(A.subarray(e,t),i[1280]),i[1280]+=t-e,i[1280]-i[1281]>=131072?this._inst.exports.dec():0)}end(){return this._inst?this._inst.exports.end():1}}},125:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IIPHandler=void 0;const i=t(782),s=t(216),r=t(280),g=t(769),a=t(326),o={name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0};e.IIPHandler=class{constructor(A,e,t,i){this._opts=A,this._renderer=e,this._storage=t,this._coreTerminal=i,this._aborted=!1,this._hp=new g.HeaderParser,this._header=o,this._dec=new r.default(4194304),this._metrics=a.UNSUPPORTED_TYPE}reset(){}start(){this._aborted=!1,this._header=o,this._metrics=a.UNSUPPORTED_TYPE,this._hp.reset()}put(A,e,t){if(!this._aborted)if(4===this._hp.state)this._dec.put(A,e,t)&&(this._dec.release(),this._aborted=!0);else{const i=this._hp.parse(A,e,t);if(-1===i)return void(this._aborted=!0);if(i>0){if(this._header=Object.assign({},o,this._hp.fields),!this._header.inline||!this._header.size||this._header.size>this._opts.iipSizeLimit)return void(this._aborted=!0);this._dec.init(this._header.size),this._dec.put(A,i,t)&&(this._dec.release(),this._aborted=!0)}}}end(A){if(this._aborted)return!0;let e=0,t=0,s=!0;if((s=A)&&(s=!this._dec.end())&&(this._metrics=(0,a.imageType)(this._dec.data8),(s="unsupported"!==this._metrics.mime)&&(e=this._metrics.width,t=this._metrics.height,(s=e&&t&&e*t<this._opts.pixelLimit)&&([e,t]=this._resize(e,t).map(Math.floor),s=e&&t&&e*t<this._opts.pixelLimit))),!s)return this._dec.release(),!0;const r=new Blob([this._dec.data8],{type:this._metrics.mime});if(this._dec.release(),!window.createImageBitmap){const A=URL.createObjectURL(r),s=new Image;return new Promise((r=>{s.addEventListener("load",(()=>{var g;URL.revokeObjectURL(A);const a=i.ImageRenderer.createCanvas(window.document,e,t);null===(g=a.getContext("2d"))||void 0===g||g.drawImage(s,0,0,e,t),this._storage.addImage(a),r(!0)})),s.src=A,setTimeout((()=>r(!0)),1e3)}))}return createImageBitmap(r,{resizeWidth:e,resizeHeight:t}).then((A=>(this._storage.addImage(A),!0)))}_resize(A,e){var t,i,r,g;const a=(null===(t=this._renderer.dimensions)||void 0===t?void 0:t.css.cell.width)||s.CELL_SIZE_DEFAULT.width,o=(null===(i=this._renderer.dimensions)||void 0===i?void 0:i.css.cell.height)||s.CELL_SIZE_DEFAULT.height,h=(null===(r=this._renderer.dimensions)||void 0===r?void 0:r.css.canvas.width)||a*this._coreTerminal.cols,n=(null===(g=this._renderer.dimensions)||void 0===g?void 0:g.css.canvas.height)||o*this._coreTerminal.rows,I=this._dim(this._header.width,h,a),C=this._dim(this._header.height,n,o);if(!I&&!C){const t=h/A,i=(n-o)/e,s=Math.min(t,i);return s<1?[A*s,e*s]:[A,e]}return I?!this._header.preserveAspectRatio&&I&&C?[I,C]:[I,e*I/A]:[A*C/e,C]}_dim(A,e,t){return"auto"===A?0:A.endsWith("%")?parseInt(A.slice(0,-1))*e/100:A.endsWith("px")?parseInt(A.slice(0,-2)):parseInt(A)*t}}},769:(A,e)=>{function t(A){let e="";for(let t=0;t<A.length;++t)e+=String.fromCharCode(A[t]);return e}function i(A){let e=0;for(let t=0;t<A.length;++t){if(A[t]<48||A[t]>57)throw new Error("illegal char");e=10*e+A[t]-48}return e}function s(A){const e=t(A);if(!e.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.HeaderParser=void 0;const r={inline:i,size:i,name:function(A){if("undefined"!=typeof Buffer)return Buffer.from(t(A),"base64").toString();const e=atob(t(A)),i=new Uint8Array(e.length);for(let A=0;A<i.length;++A)i[A]=e.charCodeAt(A);return(new TextDecoder).decode(i)},width:s,height:s,preserveAspectRatio:i},g=[70,105,108,101],a=1024;e.HeaderParser=class{constructor(){this.state=0,this._buffer=new Uint32Array(a),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}parse(A,e,t){let i=this.state,s=this._position;const r=this._buffer;if(1===i||4===i)return-1;if(0===i&&s>6)return-1;for(let o=e;o<t;++o){const e=A[o];switch(e){case 59:if(!this._storeValue(s))return this._a();i=2,s=0;break;case 61:if(0===i){for(let A=0;A<g.length;++A)if(r[A]!==g[A])return this._a();i=2,s=0}else if(2===i){if(!this._storeKey(s))return this._a();i=3,s=0}else if(3===i){if(s>=a)return this._a();r[s++]=e}break;case 58:return 3!==i||this._storeValue(s)?(this.state=4,o+1):this._a();default:if(s>=a)return this._a();r[s++]=e}}return this.state=i,this._position=s,-2}_a(){return this.state=1,-1}_storeKey(A){const e=t(this._buffer.subarray(0,A));return!!e&&(this._key=e,this.fields[e]=null,!0)}_storeValue(A){if(this._key){try{const e=this._buffer.slice(0,A);this.fields[this._key]=r[this._key]?r[this._key](e):e}catch(A){return!1}return!0}return!1}}},326:(A,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.imageType=e.UNSUPPORTED_TYPE=void 0,e.UNSUPPORTED_TYPE={mime:"unsupported",width:0,height:0},e.imageType=function(A){if(A.length<24)return e.UNSUPPORTED_TYPE;const t=new Uint32Array(A.buffer,A.byteOffset,6);if(1196314761===t[0]&&169478669===t[1]&&1380206665===t[3])return{mime:"image/png",width:A[16]<<24|A[17]<<16|A[18]<<8|A[19],height:A[20]<<24|A[21]<<16|A[22]<<8|A[23]};if((3774863615===t[0]||3791640831===t[0])&&(74===A[6]&&70===A[7]&&73===A[8]&&70===A[9]||69===A[6]&&120===A[7]&&105===A[8]&&102===A[9])){const[e,t]=function(A){const e=A.length;let t=4,i=A[t]<<8|A[t+1];for(;;){if(t+=i,t>=e)return[0,0];if(255!==A[t])return[0,0];if(192===A[t+1]||194===A[t+1])return t+8<e?[A[t+7]<<8|A[t+8],A[t+5]<<8|A[t+6]]:[0,0];t+=2,i=A[t]<<8|A[t+1]}}(A);return{mime:"image/jpeg",width:e,height:t}}return 944130375!==t[0]||55!==A[4]&&57!==A[4]||97!==A[5]?e.UNSUPPORTED_TYPE:{mime:"image/gif",width:A[7]<<8|A[6],height:A[9]<<8|A[8]}}},782:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ImageRenderer=void 0;const i=t(477),s=t(859);class r extends s.Disposable{static createCanvas(A,e,t){const i=(A||document).createElement("canvas");return i.width=0|e,i.height=0|t,i}static createImageData(A,e,t,i){if("function"!=typeof ImageData){const s=A.createImageData(e,t);return i&&s.data.set(new Uint8ClampedArray(i,0,e*t*4)),s}return i?new ImageData(new Uint8ClampedArray(i,0,e*t*4),e,t):new ImageData(e,t)}static createImageBitmap(A){return"function"!=typeof createImageBitmap?Promise.resolve(void 0):createImageBitmap(A)}constructor(A){super(),this._terminal=A,this._optionsRefresh=this.register(new s.MutableDisposable),this._oldOpen=this._terminal._core.open,this._terminal._core.open=A=>{var e;null===(e=this._oldOpen)||void 0===e||e.call(this._terminal._core,A),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange((A=>{var e;"fontSize"===A&&(this.rescaleCanvas(),null===(e=this._renderService)||void 0===e||e.refreshRows(0,this._terminal.rows))})),this.register((0,s.toDisposable)((()=>{var A;this.removeLayerFromDom(),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this.canvas=void 0,this._ctx=void 0,null===(A=this._placeholderBitmap)||void 0===A||A.close(),this._placeholderBitmap=void 0,this._placeholder=void 0})))}showPlaceholder(A){var e,t;A?this._placeholder||-1===this.cellSize.height||this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(null===(e=this._placeholderBitmap)||void 0===e||e.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),null===(t=this._renderService)||void 0===t||t.refreshRows(0,this._terminal.rows)}get dimensions(){var A;return null===(A=this._renderService)||void 0===A?void 0:A.dimensions}get cellSize(){var A,e;return{width:(null===(A=this.dimensions)||void 0===A?void 0:A.css.cell.width)||-1,height:(null===(e=this.dimensions)||void 0===e?void 0:e.css.cell.height)||-1}}clearLines(A,e){var t,i,s,r;null===(t=this._ctx)||void 0===t||t.clearRect(0,A*((null===(i=this.dimensions)||void 0===i?void 0:i.css.cell.height)||0),(null===(s=this.dimensions)||void 0===s?void 0:s.css.canvas.width)||0,(++e-A)*((null===(r=this.dimensions)||void 0===r?void 0:r.css.cell.height)||0))}clearAll(){var A,e,t;null===(A=this._ctx)||void 0===A||A.clearRect(0,0,(null===(e=this.canvas)||void 0===e?void 0:e.width)||0,(null===(t=this.canvas)||void 0===t?void 0:t.height)||0)}draw(A,e,t,i,s=1){if(!this._ctx)return;const{width:r,height:g}=this.cellSize;if(-1===r||-1===g)return;this._rescaleImage(A,r,g);const a=A.actual,o=Math.ceil(a.width/r),h=e%o*r,n=Math.floor(e/o)*g,I=t*r,C=i*g,l=s*r+h>a.width?a.width-h:s*r,B=n+g>a.height?a.height-n:g;this._ctx.drawImage(a,Math.floor(h),Math.floor(n),Math.ceil(l),Math.ceil(B),Math.floor(I),Math.floor(C),Math.ceil(l),Math.ceil(B))}extractTile(A,e){const{width:t,height:i}=this.cellSize;if(-1===t||-1===i)return;this._rescaleImage(A,t,i);const s=A.actual,g=Math.ceil(s.width/t),a=e%g*t,o=Math.floor(e/g)*i,h=t+a>s.width?s.width-a:t,n=o+i>s.height?s.height-o:i,I=r.createCanvas(this.document,h,n),C=I.getContext("2d");return C?(C.drawImage(s,Math.floor(a),Math.floor(o),Math.floor(h),Math.floor(n),0,0,Math.floor(h),Math.floor(n)),I):void 0}drawPlaceholder(A,e,t=1){if(this._ctx){const{width:i,height:s}=this.cellSize;if(-1===i||-1===s)return;if(this._placeholder?s>=this._placeholder.height&&this._createPlaceHolder(s+1):this._createPlaceHolder(Math.max(s+1,24)),!this._placeholder)return;this._ctx.drawImage(this._placeholderBitmap||this._placeholder,A*i,e*s%2?0:1,i*t,s,A*i,e*s,i*t,s)}}rescaleCanvas(){this.canvas&&(this.canvas.width===this.dimensions.css.canvas.width&&this.canvas.height===this.dimensions.css.canvas.height||(this.canvas.width=this.dimensions.css.canvas.width||0,this.canvas.height=this.dimensions.css.canvas.height||0))}_rescaleImage(A,e,t){if(e===A.actualCellSize.width&&t===A.actualCellSize.height)return;const{width:i,height:s}=A.origCellSize;if(e===i&&t===s)return A.actual=A.orig,A.actualCellSize.width=i,void(A.actualCellSize.height=s);const g=r.createCanvas(this.document,Math.ceil(A.orig.width*e/i),Math.ceil(A.orig.height*t/s)),a=g.getContext("2d");a&&(a.drawImage(A.orig,0,0,g.width,g.height),A.actual=g,A.actualCellSize.width=e,A.actualCellSize.height=t)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=A=>{var e;this.removeLayerFromDom(),null===(e=this._oldSetRenderer)||void 0===e||e.call(this._renderService,A)}}insertLayerToDom(){var A,e;this.document&&this._terminal._core.screenElement?this.canvas||(this.canvas=r.createCanvas(this.document,(null===(A=this.dimensions)||void 0===A?void 0:A.css.canvas.width)||0,(null===(e=this.dimensions)||void 0===e?void 0:e.css.canvas.height)||0),this.canvas.classList.add("xterm-image-layer"),this._terminal._core.screenElement.appendChild(this.canvas),this._ctx=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0}),this.clearAll()):console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement")}removeLayerFromDom(){this.canvas&&(this._ctx=void 0,this.canvas.remove(),this.canvas=void 0)}_createPlaceHolder(A=24){var e;null===(e=this._placeholderBitmap)||void 0===e||e.close(),this._placeholderBitmap=void 0;const t=32,s=r.createCanvas(this.document,t,A),g=s.getContext("2d",{alpha:!1});if(!g)return;const a=r.createImageData(g,t,A),o=new Uint32Array(a.data.buffer),h=(0,i.toRGBA8888)(0,0,0),n=(0,i.toRGBA8888)(255,255,255);o.fill(h);for(let e=0;e<A;++e){const A=e%2,i=e*t;for(let e=0;e<t;e+=2)o[i+e+A]=n}g.putImageData(a,0,0);const I=screen.width+t-1&-32||4096;this._placeholder=r.createCanvas(this.document,I,A);const C=this._placeholder.getContext("2d",{alpha:!1});if(C){for(let A=0;A<I;A+=t)C.drawImage(s,A,0);r.createImageBitmap(this._placeholder).then((A=>this._placeholderBitmap=A))}else this._placeholder=void 0}get document(){var A;return null===(A=this._terminal._core._coreBrowserService)||void 0===A?void 0:A.window.document}}e.ImageRenderer=r},216:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ImageStorage=e.CELL_SIZE_DEFAULT=void 0;const i=t(782);e.CELL_SIZE_DEFAULT={width:7,height:14};class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(A){this._ext=A}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(A){this._ext&=-469762049,this._ext|=A<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(A){this._ext&=-67108864,this._ext|=67108863&A}get urlId(){return this._urlId}set urlId(A){this._urlId=A}constructor(A=0,e=0,t=-1,i=-1){this.imageId=t,this.tileId=i,this._ext=0,this._urlId=0,this._ext=A,this._urlId=e}clone(){return new s(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId&&-1===this.imageId}}const r=new s;e.ImageStorage=class{constructor(A,e,t){this._terminal=A,this._renderer=e,this._opts=t,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(A){console.error(A.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){var A;for(const e of this._images.values())null===(A=e.marker)||void 0===A||A.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return 4*this._pixelLimit/1e6}setLimit(A){if(A<.5||A>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=A/4*1e6>>>0,this._evictOldest(0)}getUsage(){return 4*this._getStoredPixels()/1e6}_getStoredPixels(){let A=0;for(const e of this._images.values())e.orig&&(A+=e.orig.width*e.orig.height,e.actual&&e.actual!==e.orig&&(A+=e.actual.width*e.actual.height));return A}_delImg(A){const e=this._images.get(A);this._images.delete(A),e&&window.ImageBitmap&&e.orig instanceof ImageBitmap&&e.orig.close()}wipeAlternate(){var A;const e=[];for(const[t,i]of this._images.entries())"alternate"===i.bufferType&&(null===(A=i.marker)||void 0===A||A.dispose(),e.push(t));for(const A of e)this._delImg(A);this._needsFullClear=!0,this._fullyCleared=!1}advanceCursor(A){if(this._opts.sixelScrolling){let t=this._renderer.cellSize;-1!==t.width&&-1!==t.height||(t=e.CELL_SIZE_DEFAULT);const i=Math.ceil(A/t.height);for(let A=1;A<i;++A)this._terminal._core._inputHandler.lineFeed()}}addImage(A){var t;this._evictOldest(A.width*A.height);let i=this._renderer.cellSize;-1!==i.width&&-1!==i.height||(i=e.CELL_SIZE_DEFAULT);const s=Math.ceil(A.width/i.width),r=Math.ceil(A.height/i.height),g=++this._lastId,a=this._terminal._core.buffer,o=this._terminal.cols,h=this._terminal.rows,n=a.x,I=a.y;let C=n,l=0;this._opts.sixelScrolling||(a.x=0,a.y=0,C=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(a.y);for(let A=0;A<r;++A){const e=a.lines.get(a.y+a.ybase);for(let t=0;t<s&&!(C+t>=o);++t)this._writeToCell(e,C+t,g,A*s+t),l++;if(this._opts.sixelScrolling)A<r-1&&this._terminal._core._inputHandler.lineFeed();else if(++a.y>=h)break;a.x=C}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(a.y),this._opts.sixelScrolling?a.x=C:(a.x=n,a.y=I);const B=[];for(const[A,e]of this._images.entries())e.tileCount<1&&(null===(t=e.marker)||void 0===t||t.dispose(),B.push(A));for(const A of B)this._delImg(A);const Q=this._terminal.registerMarker(0);null==Q||Q.onDispose((()=>{this._images.get(g)&&this._delImg(g)})),"alternate"===this._terminal.buffer.active.type&&this._evictOnAlternate();const d={orig:A,origCellSize:i,actual:A,actualCellSize:Object.assign({},i),marker:Q||void 0,tileCount:l,bufferType:this._terminal.buffer.active.type};this._images.set(g,d)}render(A){if(!this._renderer.canvas&&this._images.size&&(this._renderer.insertLayerToDom(),!this._renderer.canvas))return;if(this._renderer.rescaleCanvas(),!this._images.size)return this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),void(this._renderer.canvas&&this._renderer.removeLayerFromDom());this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);const{start:e,end:t}=A,i=this._terminal._core.buffer,s=this._terminal._core.cols;this._renderer.clearLines(e,t);for(let A=e;A<=t;++A){const e=i.lines.get(A+i.ydisp);if(!e)return;for(let t=0;t<s;++t)if(268435456&e.getBg(t)){let i=e._extendedAttrs[t]||r;const g=i.imageId;if(void 0===g||-1===g)continue;const a=this._images.get(g);if(-1!==i.tileId){const o=i.tileId,h=t;let n=1;for(;++t<s&&268435456&e.getBg(t)&&(i=e._extendedAttrs[t]||r)&&i.imageId===g&&i.tileId===o+n;)n++;t--,a?a.actual&&this._renderer.draw(a,o,h,A,n):this._opts.showPlaceholder&&this._renderer.drawPlaceholder(h,A,n),this._fullyCleared=!1}}}}viewportResize(A){var e;if(!this._images.size)return void(this._viewportMetrics=A);if(this._viewportMetrics.cols>=A.cols)return void(this._viewportMetrics=A);const t=this._terminal._core.buffer,i=t.lines.length,s=this._viewportMetrics.cols-1;for(let g=0;g<i;++g){const i=t.lines.get(g);if(268435456&i.getBg(s)){const t=i._extendedAttrs[s]||r,g=t.imageId;if(void 0===g||-1===g)continue;const a=this._images.get(g);if(!a)continue;const o=Math.ceil(((null===(e=a.actual)||void 0===e?void 0:e.width)||0)/a.actualCellSize.width);if(t.tileId%o+1>=o)continue;let h=!1;for(let e=s+1;e>A.cols;++e)if(4194303&i._data[3*e+0]){h=!0;break}if(h)continue;const n=Math.min(A.cols,o-t.tileId%o+s);let I=t.tileId;for(let A=s+1;A<n;++A)this._writeToCell(i,A,g,++I),a.tileCount++}}this._viewportMetrics=A}getImageAtBufferCell(A,e){var t,s;const g=this._terminal._core.buffer.lines.get(e);if(g&&268435456&g.getBg(A)){const e=g._extendedAttrs[A]||r;if(e.imageId&&-1!==e.imageId){const A=null===(t=this._images.get(e.imageId))||void 0===t?void 0:t.orig;if(window.ImageBitmap&&A instanceof ImageBitmap){const e=i.ImageRenderer.createCanvas(window.document,A.width,A.height);return null===(s=e.getContext("2d"))||void 0===s||s.drawImage(A,0,0,A.width,A.height),e}return A}}}extractTileAtBufferCell(A,e){const t=this._terminal._core.buffer.lines.get(e);if(t&&268435456&t.getBg(A)){const e=t._extendedAttrs[A]||r;if(e.imageId&&-1!==e.imageId&&-1!==e.tileId){const A=this._images.get(e.imageId);if(A)return this._renderer.extractTile(A,e.tileId)}}}_evictOldest(A){var e;const t=this._getStoredPixels();let i=t;for(;this._pixelLimit<i+A&&this._images.size;){const A=this._images.get(++this._lowestId);A&&A.orig&&(i-=A.orig.width*A.orig.height,A.actual&&A.orig!==A.actual&&(i-=A.actual.width*A.actual.height),null===(e=A.marker)||void 0===e||e.dispose(),this._delImg(this._lowestId))}return t-i}_writeToCell(A,e,t,i){if(268435456&A._data[3*e+2]){const r=A._extendedAttrs[e];if(r){if(void 0!==r.imageId){const A=this._images.get(r.imageId);return A&&A.tileCount--,r.imageId=t,void(r.tileId=i)}return void(A._extendedAttrs[e]=new s(r.ext,r.urlId,t,i))}}A._data[3*e+2]|=268435456,A._extendedAttrs[e]=new s(0,0,t,i)}_evictOnAlternate(){var A,e;for(const A of this._images.values())"alternate"===A.bufferType&&(A.tileCount=0);const t=this._terminal._core.buffer;for(let e=0;e<this._terminal.rows;++e){const i=t.lines.get(e);if(i)for(let e=0;e<this._terminal.cols;++e)if(268435456&i._data[3*e+2]){const t=null===(A=i._extendedAttrs[e])||void 0===A?void 0:A.imageId;if(t){const A=this._images.get(t);A&&A.tileCount++}}}const i=[];for(const[A,t]of this._images.entries())"alternate"!==t.bufferType||t.tileCount||(null===(e=t.marker)||void 0===e||e.dispose(),i.push(A));for(const A of i)this._delImg(A)}}},973:(A,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SixelHandler=void 0;const i=t(477),s=t(782),r=t(710),g=i.PALETTE_ANSI_256;function a(A){return i.BIG_ENDIAN?A:(255&A)<<24|(A>>>8&255)<<16|(A>>>16&255)<<8|A>>>24&255}g.set(i.PALETTE_VT340_COLOR),e.SixelHandler=class{constructor(A,e,t){this._opts=A,this._storage=e,this._coreTerminal=t,this._size=0,this._aborted=!1,(0,r.DecoderAsync)({memoryLimit:4*this._opts.pixelLimit,palette:g,paletteLimit:this._opts.sixelPaletteLimit}).then((A=>this._dec=A))}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,g,this._opts.sixelPaletteLimit))}hook(A){var e;if(this._size=0,this._aborted=!1,this._dec){const t=1===A.params[1]?0:function(A,e){let t=0;if(!e)return t;if(A.isInverse())if(A.isFgDefault())t=a(e.foreground.rgba);else if(A.isFgRGB()){const e=A.constructor.toColorRGB(A.getFgColor());t=(0,i.toRGBA8888)(...e)}else t=a(e.ansi[A.getFgColor()].rgba);else if(A.isBgDefault())t=a(e.background.rgba);else if(A.isBgRGB()){const e=A.constructor.toColorRGB(A.getBgColor());t=(0,i.toRGBA8888)(...e)}else t=a(e.ansi[A.getBgColor()].rgba);return t}(this._coreTerminal._core._inputHandler._curAttrData,null===(e=this._coreTerminal._core._themeService)||void 0===e?void 0:e.colors);this._dec.init(t,null,this._opts.sixelPaletteLimit)}}put(A,e,t){if(!this._aborted&&this._dec){if(this._size+=t-e,this._size>this._opts.sixelSizeLimit)return console.warn("SIXEL: too much data, aborting"),this._aborted=!0,void this._dec.release();try{this._dec.decode(A,e,t)}catch(A){console.warn(`SIXEL: error while decoding image - ${A}`),this._aborted=!0,this._dec.release()}}}unhook(A){var e;if(this._aborted||!A||!this._dec)return!0;const t=this._dec.width,i=this._dec.height;if(!t||!i)return i&&this._storage.advanceCursor(i),!0;const r=s.ImageRenderer.createCanvas(void 0,t,i);return null===(e=r.getContext("2d"))||void 0===e||e.putImageData(new ImageData(this._dec.data8,t,i),0,0),this._dec.memoryUsage>4194304&&this._dec.release(),this._storage.addImage(r),!0}}},859:(A,e)=>{function t(A){for(const e of A)e.dispose();A.length=0}Object.defineProperty(e,"__esModule",{value:!0}),e.getDisposeArrayDisposable=e.disposeArray=e.toDisposable=e.MutableDisposable=e.Disposable=void 0,e.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const A of this._disposables)A.dispose();this._disposables.length=0}register(A){return this._disposables.push(A),A}unregister(A){const e=this._disposables.indexOf(A);-1!==e&&this._disposables.splice(e,1)}},e.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(A){this._isDisposed||A===this._value||(this._value?.dispose(),this._value=A)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},e.toDisposable=function(A){return{dispose:A}},e.disposeArray=t,e.getDisposeArrayDisposable=function(A){return{dispose:()=>t(A)}}}},e={};function t(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={exports:{}};return A[i](r,r.exports,t),r.exports}var i={};return(()=>{var A=i;Object.defineProperty(A,"__esModule",{value:!0}),A.ImageAddon=void 0;const e=t(125),s=t(782),r=t(216),g=t(973),a={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};A.ImageAddon=class{constructor(A){this._disposables=[],this._handlers=new Map,this._opts=Object.assign({},a,A),this._defaultOpts=Object.assign({},a,A)}dispose(){for(const A of this._disposables)A.dispose();this._disposables.length=0,this._handlers.clear()}_disposeLater(...A){for(const e of A)this._disposables.push(e)}activate(A){if(this._terminal=A,this._renderer=new s.ImageRenderer(A),this._storage=new r.ImageStorage(A,this._renderer,this._opts),this._opts.enableSizeReports){const e=A.options.windowOptions||{};e.getWinSizePixels=!0,e.getCellSizePixels=!0,e.getWinSizeChars=!0,A.options.windowOptions=e}if(this._disposeLater(this._renderer,this._storage,A.parser.registerCsiHandler({prefix:"?",final:"h"},(A=>this._decset(A))),A.parser.registerCsiHandler({prefix:"?",final:"l"},(A=>this._decrst(A))),A.parser.registerCsiHandler({final:"c"},(A=>this._da1(A))),A.parser.registerCsiHandler({prefix:"?",final:"S"},(A=>this._xtermGraphicsAttributes(A))),A.onRender((A=>{var e;return null===(e=this._storage)||void 0===e?void 0:e.render(A)})),A.parser.registerCsiHandler({intermediates:"!",final:"p"},(()=>this.reset())),A.parser.registerEscHandler({final:"c"},(()=>this.reset())),A._core._inputHandler.onRequestReset((()=>this.reset())),A.buffer.onBufferChange((()=>{var A;return null===(A=this._storage)||void 0===A?void 0:A.wipeAlternate()})),A.onResize((A=>{var e;return null===(e=this._storage)||void 0===e?void 0:e.viewportResize(A)}))),this._opts.sixelSupport){const e=new g.SixelHandler(this._opts,this._storage,A);this._handlers.set("sixel",e),this._disposeLater(A._core._inputHandler._parser.registerDcsHandler({final:"q"},e))}if(this._opts.iipSupport){const t=new e.IIPHandler(this._opts,this._renderer,this._storage,A);this._handlers.set("iip",t),this._disposeLater(A._core._inputHandler._parser.registerOscHandler(1337,t))}}reset(){var A;this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,null===(A=this._storage)||void 0===A||A.reset();for(const A of this._handlers.values())A.reset();return!1}get storageLimit(){var A;return(null===(A=this._storage)||void 0===A?void 0:A.getLimit())||-1}set storageLimit(A){var e;null===(e=this._storage)||void 0===e||e.setLimit(A),this._opts.storageLimit=A}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(A){var e;this._opts.showPlaceholder=A,null===(e=this._renderer)||void 0===e||e.showPlaceholder(A)}getImageAtBufferCell(A,e){var t;return null===(t=this._storage)||void 0===t?void 0:t.getImageAtBufferCell(A,e)}extractTileAtBufferCell(A,e){var t;return null===(t=this._storage)||void 0===t?void 0:t.extractTileAtBufferCell(A,e)}_report(A){var e;null===(e=this._terminal)||void 0===e||e._core.coreService.triggerDataEvent(A)}_decset(A){for(let e=0;e<A.length;++e)80===A[e]&&(this._opts.sixelScrolling=!1);return!1}_decrst(A){for(let e=0;e<A.length;++e)80===A[e]&&(this._opts.sixelScrolling=!0);return!1}_da1(A){return!!A[0]||!!this._opts.sixelSupport&&(this._report("[?62;4;9;22c"),!0)}_xtermGraphicsAttributes(A){var e,t,i,s,g,a;if(A.length<2)return!0;if(1===A[0])switch(A[1]){case 1:return this._report(`[?${A[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`[?${A[0]};0;${this._opts.sixelPaletteLimit}S`);for(const A of this._handlers.values())A.reset();return!0;case 3:return A.length>2&&!(A[2]instanceof Array)&&A[2]<=4096?(this._opts.sixelPaletteLimit=A[2],this._report(`[?${A[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`[?${A[0]};2S`),!0;case 4:return this._report(`[?${A[0]};0;4096S`),!0;default:return this._report(`[?${A[0]};2S`),!0}if(2===A[0])switch(A[1]){case 1:let o=null===(t=null===(e=this._renderer)||void 0===e?void 0:e.dimensions)||void 0===t?void 0:t.css.canvas.width,h=null===(s=null===(i=this._renderer)||void 0===i?void 0:i.dimensions)||void 0===s?void 0:s.css.canvas.height;if(!o||!h){const A=r.CELL_SIZE_DEFAULT;o=((null===(g=this._terminal)||void 0===g?void 0:g.cols)||80)*A.width,h=((null===(a=this._terminal)||void 0===a?void 0:a.rows)||24)*A.height}if(o*h<this._opts.pixelLimit)this._report(`[?${A[0]};0;${o.toFixed(0)};${h.toFixed(0)}S`);else{const e=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`[?${A[0]};0;${e};${e}S`)}return!0;case 4:const n=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`[?${A[0]};0;${n};${n}S`),!0;default:return this._report(`[?${A[0]};2S`),!0}return this._report(`[?${A[0]};1S`),!0}}})(),i})()));
3
+ //# sourceMappingURL=addon-image.js.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2019 Joerg Breitbart.
3
+ * @license MIT
4
+ */
5
+
6
+ /**
7
+ * Copyright (c) 2020 The xterm.js authors. All rights reserved.
8
+ * @license MIT
9
+ */
10
+
11
+ /**
12
+ * Copyright (c) 2020, 2023 The xterm.js authors. All rights reserved.
13
+ * @license MIT
14
+ */
15
+
16
+ /**
17
+ * Copyright (c) 2021 Joerg Breitbart.
18
+ * @license MIT
19
+ */
20
+
21
+ /**
22
+ * Copyright (c) 2023 The xterm.js authors. All rights reserved.
23
+ * @license MIT
24
+ */