@pyscript/core 0.6.9 → 0.6.11
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/dist/codemirror-CAEZ6Sg7.js +2 -0
- package/dist/{codemirror-1dOfKU91.js.map → codemirror-CAEZ6Sg7.js.map} +1 -1
- package/dist/codemirror_commands-BPM8HxXO.js +2 -0
- package/dist/{codemirror_commands-CKMxnUcp.js.map → codemirror_commands-BPM8HxXO.js.map} +1 -1
- package/dist/codemirror_lang-python-DvjhpaK2.js +2 -0
- package/dist/{codemirror_lang-python-D9DYtDWr.js.map → codemirror_lang-python-DvjhpaK2.js.map} +1 -1
- package/dist/codemirror_language-4kk4Aqm3.js +2 -0
- package/dist/{codemirror_language-B5lTPv2c.js.map → codemirror_language-4kk4Aqm3.js.map} +1 -1
- package/dist/codemirror_state-1d1uncXx.js +2 -0
- package/dist/{codemirror_state-n1sFh2hh.js.map → codemirror_state-1d1uncXx.js.map} +1 -1
- package/dist/codemirror_view-aIuSN42d.js +2 -0
- package/dist/{codemirror_view-1a1gCrKZ.js.map → codemirror_view-aIuSN42d.js.map} +1 -1
- package/dist/core-hN7rJB9q.js +2 -0
- package/dist/core-hN7rJB9q.js.map +1 -0
- package/dist/core.css +1 -75
- package/dist/core.js +1 -1
- package/dist/deprecations-manager-DTY9DgQj.js +2 -0
- package/dist/deprecations-manager-DTY9DgQj.js.map +1 -0
- package/dist/donkey-DHUqA8KM.js +2 -0
- package/dist/{donkey-Cc8svH2Q.js.map → donkey-DHUqA8KM.js.map} +1 -1
- package/dist/error-CL2MCT5A.js +2 -0
- package/dist/error-CL2MCT5A.js.map +1 -0
- package/dist/index-DqgFLybq.js +2 -0
- package/dist/{index-BVFrv_QY.js.map → index-DqgFLybq.js.map} +1 -1
- package/dist/mpy-CMrxRmg5.js +2 -0
- package/dist/{mpy-CQiuZcjW.js.map → mpy-CMrxRmg5.js.map} +1 -1
- package/dist/py-BE0TtYqn.js +2 -0
- package/dist/{py-BgH4mprx.js.map → py-BE0TtYqn.js.map} +1 -1
- package/dist/py-editor-ChUKHNHb.js +2 -0
- package/dist/{py-editor-Dzsa3rsF.js.map → py-editor-ChUKHNHb.js.map} +1 -1
- package/dist/py-terminal-lpYLTFln.js +2 -0
- package/dist/{py-terminal-BX_wPoTi.js.map → py-terminal-lpYLTFln.js.map} +1 -1
- package/dist/storage.js +1 -421
- package/dist/storage.js.map +1 -1
- package/dist/toml-CvAfdf9_.js +3 -0
- package/dist/toml-CvAfdf9_.js.map +1 -0
- package/dist/toml-DiUM0_qs.js +3 -0
- package/dist/{toml-CkEFU7ly.js.map → toml-DiUM0_qs.js.map} +1 -1
- package/dist/xterm-BY7uk_OU.js +2 -0
- package/dist/xterm-BY7uk_OU.js.map +1 -0
- package/dist/xterm-readline-CZfBw7ic.js +2 -0
- package/dist/xterm-readline-CZfBw7ic.js.map +1 -0
- package/dist/xterm_addon-fit--gyF3PcZ.js +2 -0
- package/dist/xterm_addon-fit--gyF3PcZ.js.map +1 -0
- package/dist/xterm_addon-web-links-Cnej-nJ6.js +2 -0
- package/dist/xterm_addon-web-links-Cnej-nJ6.js.map +1 -0
- package/dist/zip-Bf48tRr5.js +2 -0
- package/dist/zip-Bf48tRr5.js.map +1 -0
- package/package.json +1 -1
- package/src/core.js +4 -2
- package/src/plugins/deprecations-manager.js +2 -1
- package/src/plugins/error.js +2 -0
- package/src/plugins/py-terminal/mpy.js +1 -1
- package/src/plugins/py-terminal/py.js +1 -1
- package/src/stdlib/pyscript.js +13 -13
- package/dist/codemirror-1dOfKU91.js +0 -1832
- package/dist/codemirror_commands-CKMxnUcp.js +0 -1714
- package/dist/codemirror_lang-python-D9DYtDWr.js +0 -2462
- package/dist/codemirror_language-B5lTPv2c.js +0 -5337
- package/dist/codemirror_state-n1sFh2hh.js +0 -3930
- package/dist/codemirror_view-1a1gCrKZ.js +0 -11428
- package/dist/core-D2ytnMSk.js +0 -4349
- package/dist/core-D2ytnMSk.js.map +0 -1
- package/dist/deprecations-manager-Cf_aFUPK.js +0 -29
- package/dist/deprecations-manager-Cf_aFUPK.js.map +0 -1
- package/dist/donkey-Cc8svH2Q.js +0 -170
- package/dist/error-DWoeKPDI.js +0 -59
- package/dist/error-DWoeKPDI.js.map +0 -1
- package/dist/index-BVFrv_QY.js +0 -1911
- package/dist/mpy-CQiuZcjW.js +0 -255
- package/dist/py-BgH4mprx.js +0 -182
- package/dist/py-editor-Dzsa3rsF.js +0 -433
- package/dist/py-terminal-BX_wPoTi.js +0 -61
- package/dist/toml-CkEFU7ly.js +0 -103
- package/dist/toml-DTuPg5as.js +0 -5
- package/dist/toml-DTuPg5as.js.map +0 -1
- package/dist/xterm-eU6F6YKE.js +0 -10
- package/dist/xterm-eU6F6YKE.js.map +0 -1
- package/dist/xterm-readline-C7HDczqS.js +0 -501
- package/dist/xterm-readline-C7HDczqS.js.map +0 -1
- package/dist/xterm_addon-fit-Cotzxdkz.js +0 -10
- package/dist/xterm_addon-fit-Cotzxdkz.js.map +0 -1
- package/dist/xterm_addon-web-links-DoNfCjeX.js +0 -10
- package/dist/xterm_addon-web-links-DoNfCjeX.js.map +0 -1
- package/dist/zip-Cj6c-tjp.js +0 -13
- package/dist/zip-Cj6c-tjp.js.map +0 -1
@@ -1,501 +0,0 @@
|
|
1
|
-
function ansiRegex({onlyFirst = false} = {}) {
|
2
|
-
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
3
|
-
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
4
|
-
const pattern = [
|
5
|
-
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
6
|
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
7
|
-
].join('|');
|
8
|
-
|
9
|
-
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
10
|
-
}
|
11
|
-
|
12
|
-
const regex = ansiRegex();
|
13
|
-
|
14
|
-
function stripAnsi(string) {
|
15
|
-
if (typeof string !== 'string') {
|
16
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
17
|
-
}
|
18
|
-
|
19
|
-
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
20
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
21
|
-
// and doing it manually has a performance penalty.
|
22
|
-
return string.replace(regex, '');
|
23
|
-
}
|
24
|
-
|
25
|
-
// Generated code.
|
26
|
-
|
27
|
-
function isAmbiguous(x) {
|
28
|
-
return x === 0xA1
|
29
|
-
|| x === 0xA4
|
30
|
-
|| x === 0xA7
|
31
|
-
|| x === 0xA8
|
32
|
-
|| x === 0xAA
|
33
|
-
|| x === 0xAD
|
34
|
-
|| x === 0xAE
|
35
|
-
|| x >= 0xB0 && x <= 0xB4
|
36
|
-
|| x >= 0xB6 && x <= 0xBA
|
37
|
-
|| x >= 0xBC && x <= 0xBF
|
38
|
-
|| x === 0xC6
|
39
|
-
|| x === 0xD0
|
40
|
-
|| x === 0xD7
|
41
|
-
|| x === 0xD8
|
42
|
-
|| x >= 0xDE && x <= 0xE1
|
43
|
-
|| x === 0xE6
|
44
|
-
|| x >= 0xE8 && x <= 0xEA
|
45
|
-
|| x === 0xEC
|
46
|
-
|| x === 0xED
|
47
|
-
|| x === 0xF0
|
48
|
-
|| x === 0xF2
|
49
|
-
|| x === 0xF3
|
50
|
-
|| x >= 0xF7 && x <= 0xFA
|
51
|
-
|| x === 0xFC
|
52
|
-
|| x === 0xFE
|
53
|
-
|| x === 0x101
|
54
|
-
|| x === 0x111
|
55
|
-
|| x === 0x113
|
56
|
-
|| x === 0x11B
|
57
|
-
|| x === 0x126
|
58
|
-
|| x === 0x127
|
59
|
-
|| x === 0x12B
|
60
|
-
|| x >= 0x131 && x <= 0x133
|
61
|
-
|| x === 0x138
|
62
|
-
|| x >= 0x13F && x <= 0x142
|
63
|
-
|| x === 0x144
|
64
|
-
|| x >= 0x148 && x <= 0x14B
|
65
|
-
|| x === 0x14D
|
66
|
-
|| x === 0x152
|
67
|
-
|| x === 0x153
|
68
|
-
|| x === 0x166
|
69
|
-
|| x === 0x167
|
70
|
-
|| x === 0x16B
|
71
|
-
|| x === 0x1CE
|
72
|
-
|| x === 0x1D0
|
73
|
-
|| x === 0x1D2
|
74
|
-
|| x === 0x1D4
|
75
|
-
|| x === 0x1D6
|
76
|
-
|| x === 0x1D8
|
77
|
-
|| x === 0x1DA
|
78
|
-
|| x === 0x1DC
|
79
|
-
|| x === 0x251
|
80
|
-
|| x === 0x261
|
81
|
-
|| x === 0x2C4
|
82
|
-
|| x === 0x2C7
|
83
|
-
|| x >= 0x2C9 && x <= 0x2CB
|
84
|
-
|| x === 0x2CD
|
85
|
-
|| x === 0x2D0
|
86
|
-
|| x >= 0x2D8 && x <= 0x2DB
|
87
|
-
|| x === 0x2DD
|
88
|
-
|| x === 0x2DF
|
89
|
-
|| x >= 0x300 && x <= 0x36F
|
90
|
-
|| x >= 0x391 && x <= 0x3A1
|
91
|
-
|| x >= 0x3A3 && x <= 0x3A9
|
92
|
-
|| x >= 0x3B1 && x <= 0x3C1
|
93
|
-
|| x >= 0x3C3 && x <= 0x3C9
|
94
|
-
|| x === 0x401
|
95
|
-
|| x >= 0x410 && x <= 0x44F
|
96
|
-
|| x === 0x451
|
97
|
-
|| x === 0x2010
|
98
|
-
|| x >= 0x2013 && x <= 0x2016
|
99
|
-
|| x === 0x2018
|
100
|
-
|| x === 0x2019
|
101
|
-
|| x === 0x201C
|
102
|
-
|| x === 0x201D
|
103
|
-
|| x >= 0x2020 && x <= 0x2022
|
104
|
-
|| x >= 0x2024 && x <= 0x2027
|
105
|
-
|| x === 0x2030
|
106
|
-
|| x === 0x2032
|
107
|
-
|| x === 0x2033
|
108
|
-
|| x === 0x2035
|
109
|
-
|| x === 0x203B
|
110
|
-
|| x === 0x203E
|
111
|
-
|| x === 0x2074
|
112
|
-
|| x === 0x207F
|
113
|
-
|| x >= 0x2081 && x <= 0x2084
|
114
|
-
|| x === 0x20AC
|
115
|
-
|| x === 0x2103
|
116
|
-
|| x === 0x2105
|
117
|
-
|| x === 0x2109
|
118
|
-
|| x === 0x2113
|
119
|
-
|| x === 0x2116
|
120
|
-
|| x === 0x2121
|
121
|
-
|| x === 0x2122
|
122
|
-
|| x === 0x2126
|
123
|
-
|| x === 0x212B
|
124
|
-
|| x === 0x2153
|
125
|
-
|| x === 0x2154
|
126
|
-
|| x >= 0x215B && x <= 0x215E
|
127
|
-
|| x >= 0x2160 && x <= 0x216B
|
128
|
-
|| x >= 0x2170 && x <= 0x2179
|
129
|
-
|| x === 0x2189
|
130
|
-
|| x >= 0x2190 && x <= 0x2199
|
131
|
-
|| x === 0x21B8
|
132
|
-
|| x === 0x21B9
|
133
|
-
|| x === 0x21D2
|
134
|
-
|| x === 0x21D4
|
135
|
-
|| x === 0x21E7
|
136
|
-
|| x === 0x2200
|
137
|
-
|| x === 0x2202
|
138
|
-
|| x === 0x2203
|
139
|
-
|| x === 0x2207
|
140
|
-
|| x === 0x2208
|
141
|
-
|| x === 0x220B
|
142
|
-
|| x === 0x220F
|
143
|
-
|| x === 0x2211
|
144
|
-
|| x === 0x2215
|
145
|
-
|| x === 0x221A
|
146
|
-
|| x >= 0x221D && x <= 0x2220
|
147
|
-
|| x === 0x2223
|
148
|
-
|| x === 0x2225
|
149
|
-
|| x >= 0x2227 && x <= 0x222C
|
150
|
-
|| x === 0x222E
|
151
|
-
|| x >= 0x2234 && x <= 0x2237
|
152
|
-
|| x === 0x223C
|
153
|
-
|| x === 0x223D
|
154
|
-
|| x === 0x2248
|
155
|
-
|| x === 0x224C
|
156
|
-
|| x === 0x2252
|
157
|
-
|| x === 0x2260
|
158
|
-
|| x === 0x2261
|
159
|
-
|| x >= 0x2264 && x <= 0x2267
|
160
|
-
|| x === 0x226A
|
161
|
-
|| x === 0x226B
|
162
|
-
|| x === 0x226E
|
163
|
-
|| x === 0x226F
|
164
|
-
|| x === 0x2282
|
165
|
-
|| x === 0x2283
|
166
|
-
|| x === 0x2286
|
167
|
-
|| x === 0x2287
|
168
|
-
|| x === 0x2295
|
169
|
-
|| x === 0x2299
|
170
|
-
|| x === 0x22A5
|
171
|
-
|| x === 0x22BF
|
172
|
-
|| x === 0x2312
|
173
|
-
|| x >= 0x2460 && x <= 0x24E9
|
174
|
-
|| x >= 0x24EB && x <= 0x254B
|
175
|
-
|| x >= 0x2550 && x <= 0x2573
|
176
|
-
|| x >= 0x2580 && x <= 0x258F
|
177
|
-
|| x >= 0x2592 && x <= 0x2595
|
178
|
-
|| x === 0x25A0
|
179
|
-
|| x === 0x25A1
|
180
|
-
|| x >= 0x25A3 && x <= 0x25A9
|
181
|
-
|| x === 0x25B2
|
182
|
-
|| x === 0x25B3
|
183
|
-
|| x === 0x25B6
|
184
|
-
|| x === 0x25B7
|
185
|
-
|| x === 0x25BC
|
186
|
-
|| x === 0x25BD
|
187
|
-
|| x === 0x25C0
|
188
|
-
|| x === 0x25C1
|
189
|
-
|| x >= 0x25C6 && x <= 0x25C8
|
190
|
-
|| x === 0x25CB
|
191
|
-
|| x >= 0x25CE && x <= 0x25D1
|
192
|
-
|| x >= 0x25E2 && x <= 0x25E5
|
193
|
-
|| x === 0x25EF
|
194
|
-
|| x === 0x2605
|
195
|
-
|| x === 0x2606
|
196
|
-
|| x === 0x2609
|
197
|
-
|| x === 0x260E
|
198
|
-
|| x === 0x260F
|
199
|
-
|| x === 0x261C
|
200
|
-
|| x === 0x261E
|
201
|
-
|| x === 0x2640
|
202
|
-
|| x === 0x2642
|
203
|
-
|| x === 0x2660
|
204
|
-
|| x === 0x2661
|
205
|
-
|| x >= 0x2663 && x <= 0x2665
|
206
|
-
|| x >= 0x2667 && x <= 0x266A
|
207
|
-
|| x === 0x266C
|
208
|
-
|| x === 0x266D
|
209
|
-
|| x === 0x266F
|
210
|
-
|| x === 0x269E
|
211
|
-
|| x === 0x269F
|
212
|
-
|| x === 0x26BF
|
213
|
-
|| x >= 0x26C6 && x <= 0x26CD
|
214
|
-
|| x >= 0x26CF && x <= 0x26D3
|
215
|
-
|| x >= 0x26D5 && x <= 0x26E1
|
216
|
-
|| x === 0x26E3
|
217
|
-
|| x === 0x26E8
|
218
|
-
|| x === 0x26E9
|
219
|
-
|| x >= 0x26EB && x <= 0x26F1
|
220
|
-
|| x === 0x26F4
|
221
|
-
|| x >= 0x26F6 && x <= 0x26F9
|
222
|
-
|| x === 0x26FB
|
223
|
-
|| x === 0x26FC
|
224
|
-
|| x === 0x26FE
|
225
|
-
|| x === 0x26FF
|
226
|
-
|| x === 0x273D
|
227
|
-
|| x >= 0x2776 && x <= 0x277F
|
228
|
-
|| x >= 0x2B56 && x <= 0x2B59
|
229
|
-
|| x >= 0x3248 && x <= 0x324F
|
230
|
-
|| x >= 0xE000 && x <= 0xF8FF
|
231
|
-
|| x >= 0xFE00 && x <= 0xFE0F
|
232
|
-
|| x === 0xFFFD
|
233
|
-
|| x >= 0x1F100 && x <= 0x1F10A
|
234
|
-
|| x >= 0x1F110 && x <= 0x1F12D
|
235
|
-
|| x >= 0x1F130 && x <= 0x1F169
|
236
|
-
|| x >= 0x1F170 && x <= 0x1F18D
|
237
|
-
|| x === 0x1F18F
|
238
|
-
|| x === 0x1F190
|
239
|
-
|| x >= 0x1F19B && x <= 0x1F1AC
|
240
|
-
|| x >= 0xE0100 && x <= 0xE01EF
|
241
|
-
|| x >= 0xF0000 && x <= 0xFFFFD
|
242
|
-
|| x >= 0x100000 && x <= 0x10FFFD;
|
243
|
-
}
|
244
|
-
|
245
|
-
function isFullWidth(x) {
|
246
|
-
return x === 0x3000
|
247
|
-
|| x >= 0xFF01 && x <= 0xFF60
|
248
|
-
|| x >= 0xFFE0 && x <= 0xFFE6;
|
249
|
-
}
|
250
|
-
|
251
|
-
function isWide(x) {
|
252
|
-
return x >= 0x1100 && x <= 0x115F
|
253
|
-
|| x === 0x231A
|
254
|
-
|| x === 0x231B
|
255
|
-
|| x === 0x2329
|
256
|
-
|| x === 0x232A
|
257
|
-
|| x >= 0x23E9 && x <= 0x23EC
|
258
|
-
|| x === 0x23F0
|
259
|
-
|| x === 0x23F3
|
260
|
-
|| x === 0x25FD
|
261
|
-
|| x === 0x25FE
|
262
|
-
|| x === 0x2614
|
263
|
-
|| x === 0x2615
|
264
|
-
|| x >= 0x2648 && x <= 0x2653
|
265
|
-
|| x === 0x267F
|
266
|
-
|| x === 0x2693
|
267
|
-
|| x === 0x26A1
|
268
|
-
|| x === 0x26AA
|
269
|
-
|| x === 0x26AB
|
270
|
-
|| x === 0x26BD
|
271
|
-
|| x === 0x26BE
|
272
|
-
|| x === 0x26C4
|
273
|
-
|| x === 0x26C5
|
274
|
-
|| x === 0x26CE
|
275
|
-
|| x === 0x26D4
|
276
|
-
|| x === 0x26EA
|
277
|
-
|| x === 0x26F2
|
278
|
-
|| x === 0x26F3
|
279
|
-
|| x === 0x26F5
|
280
|
-
|| x === 0x26FA
|
281
|
-
|| x === 0x26FD
|
282
|
-
|| x === 0x2705
|
283
|
-
|| x === 0x270A
|
284
|
-
|| x === 0x270B
|
285
|
-
|| x === 0x2728
|
286
|
-
|| x === 0x274C
|
287
|
-
|| x === 0x274E
|
288
|
-
|| x >= 0x2753 && x <= 0x2755
|
289
|
-
|| x === 0x2757
|
290
|
-
|| x >= 0x2795 && x <= 0x2797
|
291
|
-
|| x === 0x27B0
|
292
|
-
|| x === 0x27BF
|
293
|
-
|| x === 0x2B1B
|
294
|
-
|| x === 0x2B1C
|
295
|
-
|| x === 0x2B50
|
296
|
-
|| x === 0x2B55
|
297
|
-
|| x >= 0x2E80 && x <= 0x2E99
|
298
|
-
|| x >= 0x2E9B && x <= 0x2EF3
|
299
|
-
|| x >= 0x2F00 && x <= 0x2FD5
|
300
|
-
|| x >= 0x2FF0 && x <= 0x2FFF
|
301
|
-
|| x >= 0x3001 && x <= 0x303E
|
302
|
-
|| x >= 0x3041 && x <= 0x3096
|
303
|
-
|| x >= 0x3099 && x <= 0x30FF
|
304
|
-
|| x >= 0x3105 && x <= 0x312F
|
305
|
-
|| x >= 0x3131 && x <= 0x318E
|
306
|
-
|| x >= 0x3190 && x <= 0x31E3
|
307
|
-
|| x >= 0x31EF && x <= 0x321E
|
308
|
-
|| x >= 0x3220 && x <= 0x3247
|
309
|
-
|| x >= 0x3250 && x <= 0x4DBF
|
310
|
-
|| x >= 0x4E00 && x <= 0xA48C
|
311
|
-
|| x >= 0xA490 && x <= 0xA4C6
|
312
|
-
|| x >= 0xA960 && x <= 0xA97C
|
313
|
-
|| x >= 0xAC00 && x <= 0xD7A3
|
314
|
-
|| x >= 0xF900 && x <= 0xFAFF
|
315
|
-
|| x >= 0xFE10 && x <= 0xFE19
|
316
|
-
|| x >= 0xFE30 && x <= 0xFE52
|
317
|
-
|| x >= 0xFE54 && x <= 0xFE66
|
318
|
-
|| x >= 0xFE68 && x <= 0xFE6B
|
319
|
-
|| x >= 0x16FE0 && x <= 0x16FE4
|
320
|
-
|| x === 0x16FF0
|
321
|
-
|| x === 0x16FF1
|
322
|
-
|| x >= 0x17000 && x <= 0x187F7
|
323
|
-
|| x >= 0x18800 && x <= 0x18CD5
|
324
|
-
|| x >= 0x18D00 && x <= 0x18D08
|
325
|
-
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
326
|
-
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
327
|
-
|| x === 0x1AFFD
|
328
|
-
|| x === 0x1AFFE
|
329
|
-
|| x >= 0x1B000 && x <= 0x1B122
|
330
|
-
|| x === 0x1B132
|
331
|
-
|| x >= 0x1B150 && x <= 0x1B152
|
332
|
-
|| x === 0x1B155
|
333
|
-
|| x >= 0x1B164 && x <= 0x1B167
|
334
|
-
|| x >= 0x1B170 && x <= 0x1B2FB
|
335
|
-
|| x === 0x1F004
|
336
|
-
|| x === 0x1F0CF
|
337
|
-
|| x === 0x1F18E
|
338
|
-
|| x >= 0x1F191 && x <= 0x1F19A
|
339
|
-
|| x >= 0x1F200 && x <= 0x1F202
|
340
|
-
|| x >= 0x1F210 && x <= 0x1F23B
|
341
|
-
|| x >= 0x1F240 && x <= 0x1F248
|
342
|
-
|| x === 0x1F250
|
343
|
-
|| x === 0x1F251
|
344
|
-
|| x >= 0x1F260 && x <= 0x1F265
|
345
|
-
|| x >= 0x1F300 && x <= 0x1F320
|
346
|
-
|| x >= 0x1F32D && x <= 0x1F335
|
347
|
-
|| x >= 0x1F337 && x <= 0x1F37C
|
348
|
-
|| x >= 0x1F37E && x <= 0x1F393
|
349
|
-
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
350
|
-
|| x >= 0x1F3CF && x <= 0x1F3D3
|
351
|
-
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
352
|
-
|| x === 0x1F3F4
|
353
|
-
|| x >= 0x1F3F8 && x <= 0x1F43E
|
354
|
-
|| x === 0x1F440
|
355
|
-
|| x >= 0x1F442 && x <= 0x1F4FC
|
356
|
-
|| x >= 0x1F4FF && x <= 0x1F53D
|
357
|
-
|| x >= 0x1F54B && x <= 0x1F54E
|
358
|
-
|| x >= 0x1F550 && x <= 0x1F567
|
359
|
-
|| x === 0x1F57A
|
360
|
-
|| x === 0x1F595
|
361
|
-
|| x === 0x1F596
|
362
|
-
|| x === 0x1F5A4
|
363
|
-
|| x >= 0x1F5FB && x <= 0x1F64F
|
364
|
-
|| x >= 0x1F680 && x <= 0x1F6C5
|
365
|
-
|| x === 0x1F6CC
|
366
|
-
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
367
|
-
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
368
|
-
|| x >= 0x1F6DC && x <= 0x1F6DF
|
369
|
-
|| x === 0x1F6EB
|
370
|
-
|| x === 0x1F6EC
|
371
|
-
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
372
|
-
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
373
|
-
|| x === 0x1F7F0
|
374
|
-
|| x >= 0x1F90C && x <= 0x1F93A
|
375
|
-
|| x >= 0x1F93C && x <= 0x1F945
|
376
|
-
|| x >= 0x1F947 && x <= 0x1F9FF
|
377
|
-
|| x >= 0x1FA70 && x <= 0x1FA7C
|
378
|
-
|| x >= 0x1FA80 && x <= 0x1FA88
|
379
|
-
|| x >= 0x1FA90 && x <= 0x1FABD
|
380
|
-
|| x >= 0x1FABF && x <= 0x1FAC5
|
381
|
-
|| x >= 0x1FACE && x <= 0x1FADB
|
382
|
-
|| x >= 0x1FAE0 && x <= 0x1FAE8
|
383
|
-
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
384
|
-
|| x >= 0x20000 && x <= 0x2FFFD
|
385
|
-
|| x >= 0x30000 && x <= 0x3FFFD;
|
386
|
-
}
|
387
|
-
|
388
|
-
function validate(codePoint) {
|
389
|
-
if (!Number.isSafeInteger(codePoint)) {
|
390
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
391
|
-
}
|
392
|
-
}
|
393
|
-
|
394
|
-
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
395
|
-
validate(codePoint);
|
396
|
-
|
397
|
-
if (
|
398
|
-
isFullWidth(codePoint)
|
399
|
-
|| isWide(codePoint)
|
400
|
-
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
401
|
-
) {
|
402
|
-
return 2;
|
403
|
-
}
|
404
|
-
|
405
|
-
return 1;
|
406
|
-
}
|
407
|
-
|
408
|
-
var emojiRegex = () => {
|
409
|
-
// https://mths.be/emoji
|
410
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
411
|
-
};
|
412
|
-
|
413
|
-
const segmenter = new Intl.Segmenter();
|
414
|
-
|
415
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
416
|
-
|
417
|
-
function stringWidth(string, options = {}) {
|
418
|
-
if (typeof string !== 'string' || string.length === 0) {
|
419
|
-
return 0;
|
420
|
-
}
|
421
|
-
|
422
|
-
const {
|
423
|
-
ambiguousIsNarrow = true,
|
424
|
-
countAnsiEscapeCodes = false,
|
425
|
-
} = options;
|
426
|
-
|
427
|
-
if (!countAnsiEscapeCodes) {
|
428
|
-
string = stripAnsi(string);
|
429
|
-
}
|
430
|
-
|
431
|
-
if (string.length === 0) {
|
432
|
-
return 0;
|
433
|
-
}
|
434
|
-
|
435
|
-
let width = 0;
|
436
|
-
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
437
|
-
|
438
|
-
for (const {segment: character} of segmenter.segment(string)) {
|
439
|
-
const codePoint = character.codePointAt(0);
|
440
|
-
|
441
|
-
// Ignore control characters
|
442
|
-
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
443
|
-
continue;
|
444
|
-
}
|
445
|
-
|
446
|
-
// Ignore zero-width characters
|
447
|
-
if (
|
448
|
-
(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
449
|
-
|| codePoint === 0xFE_FF // Zero-width no-break space
|
450
|
-
) {
|
451
|
-
continue;
|
452
|
-
}
|
453
|
-
|
454
|
-
// Ignore combining characters
|
455
|
-
if (
|
456
|
-
(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks
|
457
|
-
|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended
|
458
|
-
|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement
|
459
|
-
|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols
|
460
|
-
|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks
|
461
|
-
) {
|
462
|
-
continue;
|
463
|
-
}
|
464
|
-
|
465
|
-
// Ignore surrogate pairs
|
466
|
-
if (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {
|
467
|
-
continue;
|
468
|
-
}
|
469
|
-
|
470
|
-
// Ignore variation selectors
|
471
|
-
if (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {
|
472
|
-
continue;
|
473
|
-
}
|
474
|
-
|
475
|
-
// This covers some of the above cases, but we still keep them for performance reasons.
|
476
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
477
|
-
continue;
|
478
|
-
}
|
479
|
-
|
480
|
-
// TODO: Use `/\p{RGI_Emoji}/v` when targeting Node.js 20.
|
481
|
-
if (emojiRegex().test(character)) {
|
482
|
-
width += 2;
|
483
|
-
continue;
|
484
|
-
}
|
485
|
-
|
486
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
487
|
-
}
|
488
|
-
|
489
|
-
return width;
|
490
|
-
}
|
491
|
-
|
492
|
-
/**
|
493
|
-
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
|
494
|
-
* Original file: /npm/xterm-readline@1.1.1/lib/readline.js
|
495
|
-
*
|
496
|
-
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
497
|
-
*/
|
498
|
-
var e,s,i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={},o={};e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.parseInput=e.InputType=void 0,function(t){t[t.Text=0]="Text",t[t.AltEnter=1]="AltEnter",t[t.ArrowUp=2]="ArrowUp",t[t.ArrowDown=3]="ArrowDown",t[t.ArrowLeft=4]="ArrowLeft",t[t.ArrowRight=5]="ArrowRight",t[t.Delete=6]="Delete",t[t.Backspace=7]="Backspace",t[t.CtrlA=8]="CtrlA",t[t.CtrlC=9]="CtrlC",t[t.CtrlD=10]="CtrlD",t[t.CtrlE=11]="CtrlE",t[t.CtrlK=12]="CtrlK",t[t.CtrlL=13]="CtrlL",t[t.CtrlQ=14]="CtrlQ",t[t.CtrlS=15]="CtrlS",t[t.CtrlU=16]="CtrlU",t[t.End=17]="End",t[t.Enter=18]="Enter",t[t.Home=19]="Home",t[t.ShiftEnter=20]="ShiftEnter",t[t.UnsupportedControlChar=21]="UnsupportedControlChar",t[t.UnsupportedEscape=22]="UnsupportedEscape";}(s=e.InputType||(e.InputType={})),e.parseInput=function(t){return Array.from(function*(t){let e=[];const i=t[Symbol.iterator]();for(let t=i.next();!t.done;t=i.next()){const r=t.value;if(r.length>1){e.push(r);continue}const o=r.charCodeAt(0);if(e.length>0&&(o<32||127===o)&&(yield {inputType:s.Text,data:e},e=[]),27!==o)if(o<32||127===o){let t=s.UnsupportedControlChar;switch(o){case 1:t=s.CtrlA;break;case 3:t=s.CtrlC;break;case 4:t=s.CtrlD;break;case 5:t=s.CtrlE;break;case 11:t=s.CtrlK;break;case 17:t=s.CtrlQ;break;case 19:t=s.CtrlS;break;case 21:t=s.CtrlU;break;case 13:t=s.Enter;break;case 127:t=s.Backspace;break;case 12:t=s.CtrlL;}yield {inputType:t,data:[r]};}else e.push(r);else {const t=i.next();if(t.done){e.push("");continue}let r=s.UnsupportedEscape;if("["!==t.value){"\r"===t.value&&(r=s.AltEnter),yield {inputType:r,data:["",t.value]};continue}const o=i.next();if(o.done)continue;if(o.value>="0"&&o.value<="9"){let t=o.value;const e=i.next();if(e.done)return;if(e.value>="0"&&e.value<="9")t+=e.value;else if("~"!==e.value)continue;"3"===t&&(r=s.Delete),yield {inputType:r,data:["","[",t,"~"]};continue}switch(o.value){case"A":r=s.ArrowUp;break;case"B":r=s.ArrowDown;break;case"C":r=s.ArrowRight;break;case"D":r=s.ArrowLeft;break;case"F":r=s.End;break;case"H":r=s.Home;break;case"\r":r=s.AltEnter;}yield {inputType:r,data:["","[",o.value]};}}e.length>0&&(yield {inputType:s.Text,data:e});}(t))};var h={},n={};Object.defineProperty(n,"__esModule",{value:!0}),n.LineBuffer=void 0;n.LineBuffer=class{constructor(){this.buf="",this.pos=0;}buffer(){return this.buf}pos_buffer(){return this.buf.slice(0,this.pos)}length(){return this.buf.length}char_length(){return [...this.buf].length}update(t,e){this.buf=t,this.pos=e;}insert(t){const e=t.length,s=this.pos===this.buf.length;return this.buf=s?this.buf+t:this.buf.slice(0,this.pos)+t+this.buf.slice(this.pos),this.pos+=e,s}moveBack(t){const e=this.prevPos(t);return void 0!==e&&(this.pos=e,!0)}moveForward(t){const e=this.nextPos(t);return void 0!==e&&(this.pos=e,!0)}moveHome(){const t=this.startOfLine();return this.pos>t&&(this.pos=t,!0)}moveEnd(){const t=this.endOfLine();return this.pos!==t&&(this.pos=t,!0)}startOfLine(){const t=this.buf.slice(0,this.pos).lastIndexOf("\n");return -1!==t?t+1:0}endOfLine(){const t=this.buf.slice(this.pos).indexOf("\n");return -1!==t?this.pos+t:this.buf.length}moveLineUp(t){const e=this.buf.slice(0,this.pos).lastIndexOf("\n");if(-1===e)return !1;const s=[...this.buf.slice(e+1,this.pos)].length;let i=this.buf.slice(0,e).lastIndexOf("\n");-1===i?i=0:i+=1;let r=e;for(let e=1;e<t&&0!==i;e++)r=i-1,i=this.buf.slice(0,r).lastIndexOf("\n"),-1===i?i=0:i+=1;const o=[...this.buf.slice(i,r)].slice(0,s);let h=e;return o.length>0&&(h=o.map((t=>t.length)).reduce(((t,e)=>t+e),0),h=i+h),this.pos=h,!0}moveLineDown(t){const e=this.buf.slice(this.pos).indexOf("\n");if(-1===e)return !1;let s=this.buf.slice(0,this.pos).lastIndexOf("\n");-1===s?s=0:s+=1;const i=[...this.buf.slice(s,this.pos)].length;let r=this.pos+e+1,o=this.buf.slice(r).indexOf("\n");o=-1===o?this.buf.length:r+o;for(let e=1;e<t&&o!==this.buf.length;e++)r=o+1,o=this.buf.slice(r).indexOf("\n"),o=-1===o?this.buf.length:r+o;const h=[...this.buf.slice(r,o)];return i<h.length?this.pos=h.slice(0,i).map((t=>t.length)).reduce(((t,e)=>t+e),0)+r:this.pos=o,!0}set_pos(t){this.pos=t;}prevPos(t){if(0===this.pos)return;const e=this.buf.slice(0,this.pos);return this.pos-[...e].slice(-t).map((t=>t.length)).reduce(((t,e)=>t+e),0)}nextPos(t){if(this.pos===this.buf.length)return;const e=this.buf.slice(this.pos);return this.pos+[...e].slice(0,t).map((t=>t.length)).reduce(((t,e)=>t+e),0)}backspace(t){const e=this.prevPos(t);return void 0!==e&&(this.buf=this.buf.slice(0,e)+this.buf.slice(this.pos),this.pos=e,!0)}delete(t){const e=this.nextPos(t);return void 0!==e&&(this.buf=this.buf.slice(0,this.pos)+this.buf.slice(e),!0)}deleteEndOfLine(){if(0==this.buf.length||this.pos==this.buf.length)return !1;const t=this.pos,e=this.endOfLine();return t==e?this.delete(1):this.buf=this.buf.slice(0,t)+this.buf.slice(e),!0}};var a=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(h,"__esModule",{value:!0}),h.State=h.Layout=h.Position=void 0;const l=n,u=a(stringWidth);class c{constructor(t,e){this.row=void 0!==t?t:0,this.col=void 0!==e?e:0;}}h.Position=c;class p{constructor(t){this.promptSize=t,this.cursor=new c,this.end=new c;}}h.Layout=p;h.State=class{constructor(t,e,s,i){this.line=new l.LineBuffer,this.highlighting=!1,this.prompt=t,this.tty=e,this.highlighter=s,this.history=i,this.promptSize=e.calculatePosition(t,new c),this.layout=new p(this.promptSize);}buffer(){return this.line.buffer()}shouldHighlight(){return this.highlighter.highlightChar(this.line.buf,this.line.pos)?(this.highlighting=!0,!0):!!this.highlighting&&(this.highlighting=!1,!0)}clearScreen(){this.tty.clearScreen(),this.layout.cursor=new c,this.layout.end=new c,this.refresh();}editInsert(t){const e=this.line.insert(t),s=t.includes("\n");if(e&&!s){const e=(0, u.default)(t);e>0&&this.layout.cursor.col+e<this.tty.col&&!this.shouldHighlight()?(this.layout.cursor.col+=e,this.layout.end.col+=e,this.tty.write(t)):this.refresh();}else this.refresh();}update(t){this.line.update(t,t.length),this.refresh();}editBackspace(t){this.line.backspace(t)&&this.refresh();}editDelete(t){this.line.delete(t)&&this.refresh();}editDeleteEndOfLine(){this.line.deleteEndOfLine()&&this.refresh();}refresh(){const t=this.tty.computeLayout(this.promptSize,this.line);this.tty.refreshLine(this.prompt,this.line,this.layout,t,this.highlighter),this.layout=t;}moveCursorBack(t){this.line.moveBack(t)&&this.moveCursor();}moveCursorForward(t){this.line.moveForward(t)&&this.moveCursor();}moveCursorUp(t){this.line.moveLineUp(t)?this.moveCursor():this.previousHistory();}moveCursorDown(t){this.line.moveLineDown(t)?this.moveCursor():this.nextHistory();}moveCursorHome(){this.line.moveHome()&&this.moveCursor();}moveCursorEnd(){this.line.moveEnd()&&this.moveCursor();}moveCursorToEnd(){this.layout.cursor!==this.layout.end&&(this.tty.moveCursor(this.layout.cursor,this.layout.end),this.layout.cursor=Object.assign({},this.layout.end));}previousHistory(){if(-1===this.history.cursor&&this.line.length()>0)return;const t=this.history.prev();void 0!==t&&this.update(t);}nextHistory(){if(-1===this.history.cursor)return;const t=this.history.next();void 0!==t?this.update(t):this.update("");}moveCursor(){const t=this.tty.calculatePosition(this.line.pos_buffer(),this.promptSize);t!==this.layout.cursor&&(this.shouldHighlight()?this.refresh():(this.tty.moveCursor(this.layout.cursor,t),this.layout.promptSize=Object.assign({},this.promptSize),this.layout.cursor=Object.assign({},t)));}};var d={};Object.defineProperty(d,"__esModule",{value:!0}),d.History=void 0;d.History=class{constructor(t){this.entries=[],this.cursor=-1,this.maxEntries=t;}saveToLocalStorage(){const t=null===window||void 0===window?void 0:window.localStorage;void 0!==t&&t.setItem("history",JSON.stringify(this.entries));}restoreFromLocalStorage(){const t=null===window||void 0===window?void 0:window.localStorage;if(void 0!==t){const e=t.getItem("history");if(null==e)return;try{const s=JSON.parse(e);Array.isArray(s)&&void 0===s.find((t=>"string"!=typeof t))?this.entries=s:(this.entries=[],t.setItem("history","[]"));}catch(e){this.entries=[],t.setItem("history","[]");}}}append(t){this.resetCursor(),this.entries.includes(t)?(this.entries.splice(this.entries.indexOf(t),1),this.entries.unshift(t)):this.entries.unshift(t),this.entries.length>this.maxEntries&&this.entries.pop(),this.saveToLocalStorage();}resetCursor(){this.cursor=-1;}next(){if(-1!==this.cursor)return this.cursor-=1,this.entries[this.cursor]}prev(){if(!(this.cursor+1>=this.entries.length))return this.cursor+=1,this.entries[this.cursor]}};var f={},y=i&&i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(f,"__esModule",{value:!0}),f.Tty=void 0;const w=y(stringWidth);f.Tty=class{constructor(t,e,s,i){this.tabWidth=s,this.col=t,this.row=e,this.out=i;}write(t){return this.out.write(t)}print(t){return this.out.print(t)}println(t){return this.out.println(t)}clearScreen(){this.out.write("[H[2J");}calculatePosition(t,e){const s=Object.assign({},e);let i=0;return [...t].forEach((t=>{if("\n"===t)return s.row+=1,void(s.col=0);let e=0;if("\t"===t)e=this.tabWidth-s.col%this.tabWidth;else {let s;[s,i]=function(t,e){return 1===e?"["===t?[0,2]:[0,0]:2===e?";"===t||t[0]>="0"&&t[0]<="9"?[0,e]:[0,0]:""===t?[0,1]:"\n"===t?[0,e]:[(0, w.default)(t),e]}(t,i),e=s;}s.col+=e,s.col>this.col&&(s.row+=1,s.col=e);})),s.col===this.col&&(s.col=0,s.row+=1),s}computeLayout(t,e){const s=Object.assign({},t),i=e.pos,r=this.calculatePosition(e.buf.slice(0,e.pos),t);return {promptSize:s,cursor:r,end:i===e.buf.length?Object.assign({},r):this.calculatePosition(e.buf.slice(i),r)}}refreshLine(t,e,s,i,r){const o=i.cursor,h=i.end;this.clearOldRows(s),this.write(r.highlightPrompt(t)),this.write(r.highlight(e.buf,e.pos)),0===h.col&&h.row>0&&"\n"!==e.buf[e.buf.length-1]&&this.write("\n");const n=h.row-o.row;n>0&&this.write(`[${n}A`),o.col>0?this.write(`\r[${o.col}C`):this.write("\r");}clearOldRows(t){const e=t.cursor.row,s=t.end.row,i=Math.max(s-e,0);i>0&&this.write(`[${i}B`);for(let t=0;t<s;t++)this.write("\r[0K[A");this.write("\r[0K");}moveCursor(t,e){if(e.row>t.row){const s=e.row-t.row;1===s?this.write("[B"):this.write(`[${s}B`);}else if(e.row<t.row){const s=t.row-e.row;1===s?this.write("[A"):this.write(`[${s}A`);}if(e.col>t.col){const s=e.col-t.col;1===s?this.write("[C"):this.write(`[${s}C`);}else if(e.col<t.col){const s=t.col-e.col;1===s?this.write("[D"):this.write(`[${s}D`);}}};var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.IdentityHighlighter=void 0;v.IdentityHighlighter=class{highlight(t,e){return t}highlightPrompt(t){return t}highlightChar(t,e){return !1}},Object.defineProperty(r,"__esModule",{value:!0});var b=r.Readline=void 0;const g=o,m=h,C=d,T=f,k=v;b=r.Readline=class{constructor(){this.highlighter=new k.IdentityHighlighter,this.history=new C.History(50),this.disposables=[],this.watermark=0,this.highWatermark=1e4,this.lowWatermark=1e3,this.highWater=!1,this.state=new m.State(">",this.tty(),this.highlighter,this.history),this.checkHandler=()=>!0,this.ctrlCHandler=()=>{},this.pauseHandler=t=>{},this.history.restoreFromLocalStorage();}activate(t){this.term=t,this.term.onData(this.readData.bind(this)),this.term.attachCustomKeyEventHandler(this.handleKeyEvent.bind(this));}dispose(){this.disposables.forEach((t=>t.dispose()));}appendHistory(t){this.history.append(t);}setHighlighter(t){this.highlighter=t;}setCheckHandler(t){this.checkHandler=t;}setCtrlCHandler(t){this.ctrlCHandler=t;}setPauseHandler(t){this.pauseHandler=t;}writeReady(){return !this.highWater}write(t){const e=(t="\n"===t?"\r\n":(t=t.replace(/^\n/,"\r\n")).replace(/([^\r])\n/g,"$1\r\n")).length;this.watermark+=e,this.watermark>this.highWatermark&&(this.highWater=!0),this.term&&this.term.write(t,(()=>{this.watermark=Math.max(this.watermark-e,0),this.highWater&&this.watermark<this.lowWatermark&&(this.highWater=!1);}));}print(t){return this.write(t)}println(t){return this.write(t+"\r\n")}output(){return this}tty(){var t,e;return void 0!==(null===(e=null===(t=this.term)||void 0===t?void 0:t.options)||void 0===e?void 0:e.tabStopWidth)?new T.Tty(this.term.cols,this.term.rows,this.term.options.tabStopWidth,this.output()):new T.Tty(0,0,8,this.output())}read(t){return new Promise(((e,s)=>{void 0!==this.term?(this.state=new m.State(t,this.tty(),this.highlighter,this.history),this.state.refresh(),this.activeRead={prompt:t,resolve:e,reject:s}):s("addon is not active");}))}handleKeyEvent(t){return "Enter"!==t.key||!t.shiftKey||("keydown"===t.type&&this.readKey({inputType:g.InputType.ShiftEnter,data:["\r"]}),!1)}readData(t){const e=(0, g.parseInput)(t);e.length>1||e[0].inputType===g.InputType.Text&&e[0].data.length>1?this.readPaste(e):this.readKey(e[0]);}readPaste(t){const e=t.map((t=>t.inputType===g.InputType.Enter?{inputType:g.InputType.Text,data:["\n"]}:t));for(const t of e)t.inputType===g.InputType.Text?this.state.editInsert(t.data.join("")):this.readKey(t);}readKey(t){var e,s,i;if(void 0!==this.activeRead)switch(t.inputType){case g.InputType.Text:this.state.editInsert(t.data.join(""));break;case g.InputType.AltEnter:case g.InputType.ShiftEnter:this.state.editInsert("\n");break;case g.InputType.Enter:this.checkHandler(this.state.buffer())?(this.state.moveCursorToEnd(),null===(e=this.term)||void 0===e||e.write("\r\n"),this.history.append(this.state.buffer()),null===(s=this.activeRead)||void 0===s||s.resolve(this.state.buffer()),this.activeRead=void 0):this.state.editInsert("\n");break;case g.InputType.CtrlC:this.state.moveCursorToEnd(),null===(i=this.term)||void 0===i||i.write("^C\r\n"),this.state=new m.State(this.activeRead.prompt,this.tty(),this.highlighter,this.history),this.state.refresh();break;case g.InputType.CtrlS:this.pauseHandler(!1);break;case g.InputType.CtrlU:this.state.update("");break;case g.InputType.CtrlK:this.state.editDeleteEndOfLine();break;case g.InputType.CtrlQ:this.pauseHandler(!0);break;case g.InputType.CtrlL:this.state.clearScreen();break;case g.InputType.Home:case g.InputType.CtrlA:this.state.moveCursorHome();break;case g.InputType.End:case g.InputType.CtrlE:this.state.moveCursorEnd();break;case g.InputType.Backspace:this.state.editBackspace(1);break;case g.InputType.Delete:case g.InputType.CtrlD:this.state.editDelete(1);break;case g.InputType.ArrowLeft:this.state.moveCursorBack(1);break;case g.InputType.ArrowRight:this.state.moveCursorForward(1);break;case g.InputType.ArrowUp:this.state.moveCursorUp(1);break;case g.InputType.ArrowDown:this.state.moveCursorDown(1);case g.InputType.UnsupportedControlChar:case g.InputType.UnsupportedEscape:}else switch(t.inputType){case g.InputType.CtrlC:this.ctrlCHandler();break;case g.InputType.CtrlL:this.write("[H[2J");}}};var I=r.__esModule;
|
499
|
-
|
500
|
-
export { b as Readline, I as __esModule, r as default };
|
501
|
-
//# sourceMappingURL=xterm-readline-C7HDczqS.js.map
|