@medplum/agent 4.3.11 → 4.3.12
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/cjs/index.cjs +471 -324
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -126,12 +126,14 @@ var require_bom_handling = __commonJS({
|
|
|
126
126
|
}
|
|
127
127
|
StripBOMWrapper.prototype.write = function(buf) {
|
|
128
128
|
var res = this.decoder.write(buf);
|
|
129
|
-
if (this.pass || !res)
|
|
129
|
+
if (this.pass || !res) {
|
|
130
130
|
return res;
|
|
131
|
+
}
|
|
131
132
|
if (res[0] === BOMChar) {
|
|
132
133
|
res = res.slice(1);
|
|
133
|
-
if (typeof this.options.stripBOM === "function")
|
|
134
|
+
if (typeof this.options.stripBOM === "function") {
|
|
134
135
|
this.options.stripBOM();
|
|
136
|
+
}
|
|
135
137
|
}
|
|
136
138
|
this.pass = true;
|
|
137
139
|
return res;
|
|
@@ -142,6 +144,22 @@ var require_bom_handling = __commonJS({
|
|
|
142
144
|
}
|
|
143
145
|
});
|
|
144
146
|
|
|
147
|
+
// ../../node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
148
|
+
var require_merge_exports = __commonJS({
|
|
149
|
+
"../../node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports2, module2) {
|
|
150
|
+
"use strict";
|
|
151
|
+
var hasOwn = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
152
|
+
function mergeModules(target, module3) {
|
|
153
|
+
for (var key in module3) {
|
|
154
|
+
if (hasOwn(module3, key)) {
|
|
155
|
+
target[key] = module3[key];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
module2.exports = mergeModules;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
145
163
|
// ../../node_modules/iconv-lite/encodings/internal.js
|
|
146
164
|
var require_internal = __commonJS({
|
|
147
165
|
"../../node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
|
|
@@ -163,9 +181,11 @@ var require_internal = __commonJS({
|
|
|
163
181
|
function InternalCodec(codecOptions, iconv) {
|
|
164
182
|
this.enc = codecOptions.encodingName;
|
|
165
183
|
this.bomAware = codecOptions.bomAware;
|
|
166
|
-
if (this.enc === "base64")
|
|
184
|
+
if (this.enc === "base64") {
|
|
167
185
|
this.encoder = InternalEncoderBase64;
|
|
168
|
-
else if (this.enc === "
|
|
186
|
+
} else if (this.enc === "utf8") {
|
|
187
|
+
this.encoder = InternalEncoderUtf8;
|
|
188
|
+
} else if (this.enc === "cesu8") {
|
|
169
189
|
this.enc = "utf8";
|
|
170
190
|
this.encoder = InternalEncoderCesu8;
|
|
171
191
|
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
|
|
@@ -177,9 +197,6 @@ var require_internal = __commonJS({
|
|
|
177
197
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
178
198
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
179
199
|
var StringDecoder = require("string_decoder").StringDecoder;
|
|
180
|
-
if (!StringDecoder.prototype.end)
|
|
181
|
-
StringDecoder.prototype.end = function() {
|
|
182
|
-
};
|
|
183
200
|
function InternalDecoder(options, codec) {
|
|
184
201
|
this.decoder = new StringDecoder(codec.enc);
|
|
185
202
|
}
|
|
@@ -216,12 +233,13 @@ var require_internal = __commonJS({
|
|
|
216
233
|
function InternalEncoderCesu8(options, codec) {
|
|
217
234
|
}
|
|
218
235
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
219
|
-
var buf = Buffer2.alloc(str.length * 3)
|
|
236
|
+
var buf = Buffer2.alloc(str.length * 3);
|
|
237
|
+
var bufIdx = 0;
|
|
220
238
|
for (var i = 0; i < str.length; i++) {
|
|
221
239
|
var charCode = str.charCodeAt(i);
|
|
222
|
-
if (charCode < 128)
|
|
240
|
+
if (charCode < 128) {
|
|
223
241
|
buf[bufIdx++] = charCode;
|
|
224
|
-
else if (charCode < 2048) {
|
|
242
|
+
} else if (charCode < 2048) {
|
|
225
243
|
buf[bufIdx++] = 192 + (charCode >>> 6);
|
|
226
244
|
buf[bufIdx++] = 128 + (charCode & 63);
|
|
227
245
|
} else {
|
|
@@ -241,7 +259,10 @@ var require_internal = __commonJS({
|
|
|
241
259
|
this.defaultCharUnicode = codec.defaultCharUnicode;
|
|
242
260
|
}
|
|
243
261
|
InternalDecoderCesu8.prototype.write = function(buf) {
|
|
244
|
-
var acc = this.acc
|
|
262
|
+
var acc = this.acc;
|
|
263
|
+
var contBytes = this.contBytes;
|
|
264
|
+
var accBytes = this.accBytes;
|
|
265
|
+
var res = "";
|
|
245
266
|
for (var i = 0; i < buf.length; i++) {
|
|
246
267
|
var curByte = buf[i];
|
|
247
268
|
if ((curByte & 192) !== 128) {
|
|
@@ -268,12 +289,13 @@ var require_internal = __commonJS({
|
|
|
268
289
|
contBytes--;
|
|
269
290
|
accBytes++;
|
|
270
291
|
if (contBytes === 0) {
|
|
271
|
-
if (accBytes === 2 && acc < 128 && acc > 0)
|
|
292
|
+
if (accBytes === 2 && acc < 128 && acc > 0) {
|
|
272
293
|
res += this.defaultCharUnicode;
|
|
273
|
-
else if (accBytes === 3 && acc < 2048)
|
|
294
|
+
} else if (accBytes === 3 && acc < 2048) {
|
|
274
295
|
res += this.defaultCharUnicode;
|
|
275
|
-
else
|
|
296
|
+
} else {
|
|
276
297
|
res += String.fromCharCode(acc);
|
|
298
|
+
}
|
|
277
299
|
}
|
|
278
300
|
} else {
|
|
279
301
|
res += this.defaultCharUnicode;
|
|
@@ -287,10 +309,35 @@ var require_internal = __commonJS({
|
|
|
287
309
|
};
|
|
288
310
|
InternalDecoderCesu8.prototype.end = function() {
|
|
289
311
|
var res = 0;
|
|
290
|
-
if (this.contBytes > 0)
|
|
312
|
+
if (this.contBytes > 0) {
|
|
291
313
|
res += this.defaultCharUnicode;
|
|
314
|
+
}
|
|
292
315
|
return res;
|
|
293
316
|
};
|
|
317
|
+
function InternalEncoderUtf8(options, codec) {
|
|
318
|
+
this.highSurrogate = "";
|
|
319
|
+
}
|
|
320
|
+
InternalEncoderUtf8.prototype.write = function(str) {
|
|
321
|
+
if (this.highSurrogate) {
|
|
322
|
+
str = this.highSurrogate + str;
|
|
323
|
+
this.highSurrogate = "";
|
|
324
|
+
}
|
|
325
|
+
if (str.length > 0) {
|
|
326
|
+
var charCode = str.charCodeAt(str.length - 1);
|
|
327
|
+
if (charCode >= 55296 && charCode < 56320) {
|
|
328
|
+
this.highSurrogate = str[str.length - 1];
|
|
329
|
+
str = str.slice(0, str.length - 1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return Buffer2.from(str, this.enc);
|
|
333
|
+
};
|
|
334
|
+
InternalEncoderUtf8.prototype.end = function() {
|
|
335
|
+
if (this.highSurrogate) {
|
|
336
|
+
var str = this.highSurrogate;
|
|
337
|
+
this.highSurrogate = "";
|
|
338
|
+
return Buffer2.from(str, this.enc);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
294
341
|
}
|
|
295
342
|
});
|
|
296
343
|
|
|
@@ -322,8 +369,8 @@ var require_utf32 = __commonJS({
|
|
|
322
369
|
var offset = 0;
|
|
323
370
|
for (var i = 0; i < src.length; i += 2) {
|
|
324
371
|
var code = src.readUInt16LE(i);
|
|
325
|
-
var isHighSurrogate =
|
|
326
|
-
var isLowSurrogate =
|
|
372
|
+
var isHighSurrogate = code >= 55296 && code < 56320;
|
|
373
|
+
var isLowSurrogate = code >= 56320 && code < 57344;
|
|
327
374
|
if (this.highSurrogate) {
|
|
328
375
|
if (isHighSurrogate || !isLowSurrogate) {
|
|
329
376
|
write32.call(dst, this.highSurrogate, offset);
|
|
@@ -336,26 +383,29 @@ var require_utf32 = __commonJS({
|
|
|
336
383
|
continue;
|
|
337
384
|
}
|
|
338
385
|
}
|
|
339
|
-
if (isHighSurrogate)
|
|
386
|
+
if (isHighSurrogate) {
|
|
340
387
|
this.highSurrogate = code;
|
|
341
|
-
else {
|
|
388
|
+
} else {
|
|
342
389
|
write32.call(dst, code, offset);
|
|
343
390
|
offset += 4;
|
|
344
391
|
this.highSurrogate = 0;
|
|
345
392
|
}
|
|
346
393
|
}
|
|
347
|
-
if (offset < dst.length)
|
|
394
|
+
if (offset < dst.length) {
|
|
348
395
|
dst = dst.slice(0, offset);
|
|
396
|
+
}
|
|
349
397
|
return dst;
|
|
350
398
|
};
|
|
351
399
|
Utf32Encoder.prototype.end = function() {
|
|
352
|
-
if (!this.highSurrogate)
|
|
400
|
+
if (!this.highSurrogate) {
|
|
353
401
|
return;
|
|
402
|
+
}
|
|
354
403
|
var buf = Buffer2.alloc(4);
|
|
355
|
-
if (this.isLE)
|
|
404
|
+
if (this.isLE) {
|
|
356
405
|
buf.writeUInt32LE(this.highSurrogate, 0);
|
|
357
|
-
else
|
|
406
|
+
} else {
|
|
358
407
|
buf.writeUInt32BE(this.highSurrogate, 0);
|
|
408
|
+
}
|
|
359
409
|
this.highSurrogate = 0;
|
|
360
410
|
return buf;
|
|
361
411
|
};
|
|
@@ -365,8 +415,9 @@ var require_utf32 = __commonJS({
|
|
|
365
415
|
this.overflow = [];
|
|
366
416
|
}
|
|
367
417
|
Utf32Decoder.prototype.write = function(src) {
|
|
368
|
-
if (src.length === 0)
|
|
418
|
+
if (src.length === 0) {
|
|
369
419
|
return "";
|
|
420
|
+
}
|
|
370
421
|
var i = 0;
|
|
371
422
|
var codepoint = 0;
|
|
372
423
|
var dst = Buffer2.alloc(src.length + 4);
|
|
@@ -375,8 +426,9 @@ var require_utf32 = __commonJS({
|
|
|
375
426
|
var overflow = this.overflow;
|
|
376
427
|
var badChar = this.badChar;
|
|
377
428
|
if (overflow.length > 0) {
|
|
378
|
-
for (; i < src.length && overflow.length < 4; i++)
|
|
429
|
+
for (; i < src.length && overflow.length < 4; i++) {
|
|
379
430
|
overflow.push(src[i]);
|
|
431
|
+
}
|
|
380
432
|
if (overflow.length === 4) {
|
|
381
433
|
if (isLE) {
|
|
382
434
|
codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
|
|
@@ -427,8 +479,9 @@ var require_utf32 = __commonJS({
|
|
|
427
479
|
Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
|
|
428
480
|
function Utf32AutoEncoder(options, codec) {
|
|
429
481
|
options = options || {};
|
|
430
|
-
if (options.addBOM === void 0)
|
|
482
|
+
if (options.addBOM === void 0) {
|
|
431
483
|
options.addBOM = true;
|
|
484
|
+
}
|
|
432
485
|
this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
|
|
433
486
|
}
|
|
434
487
|
Utf32AutoEncoder.prototype.write = function(str) {
|
|
@@ -448,13 +501,15 @@ var require_utf32 = __commonJS({
|
|
|
448
501
|
if (!this.decoder) {
|
|
449
502
|
this.initialBufs.push(buf);
|
|
450
503
|
this.initialBufsLen += buf.length;
|
|
451
|
-
if (this.initialBufsLen < 32)
|
|
504
|
+
if (this.initialBufsLen < 32) {
|
|
452
505
|
return "";
|
|
506
|
+
}
|
|
453
507
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
454
508
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
455
509
|
var resStr = "";
|
|
456
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
510
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
457
511
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
512
|
+
}
|
|
458
513
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
459
514
|
return resStr;
|
|
460
515
|
}
|
|
@@ -465,11 +520,13 @@ var require_utf32 = __commonJS({
|
|
|
465
520
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
466
521
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
467
522
|
var resStr = "";
|
|
468
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
523
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
469
524
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
525
|
+
}
|
|
470
526
|
var trail = this.decoder.end();
|
|
471
|
-
if (trail)
|
|
527
|
+
if (trail) {
|
|
472
528
|
resStr += trail;
|
|
529
|
+
}
|
|
473
530
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
474
531
|
return resStr;
|
|
475
532
|
}
|
|
@@ -478,9 +535,11 @@ var require_utf32 = __commonJS({
|
|
|
478
535
|
function detectEncoding(bufs, defaultEncoding) {
|
|
479
536
|
var b2 = [];
|
|
480
537
|
var charsProcessed = 0;
|
|
481
|
-
var invalidLE = 0
|
|
482
|
-
var
|
|
483
|
-
|
|
538
|
+
var invalidLE = 0;
|
|
539
|
+
var invalidBE = 0;
|
|
540
|
+
var bmpCharsLE = 0;
|
|
541
|
+
var bmpCharsBE = 0;
|
|
542
|
+
outerLoop:
|
|
484
543
|
for (var i = 0; i < bufs.length; i++) {
|
|
485
544
|
var buf = bufs[i];
|
|
486
545
|
for (var j2 = 0; j2 < buf.length; j2++) {
|
|
@@ -501,7 +560,7 @@ var require_utf32 = __commonJS({
|
|
|
501
560
|
b2.length = 0;
|
|
502
561
|
charsProcessed++;
|
|
503
562
|
if (charsProcessed >= 100) {
|
|
504
|
-
break
|
|
563
|
+
break outerLoop;
|
|
505
564
|
}
|
|
506
565
|
}
|
|
507
566
|
}
|
|
@@ -541,9 +600,12 @@ var require_utf16 = __commonJS({
|
|
|
541
600
|
this.overflowByte = -1;
|
|
542
601
|
}
|
|
543
602
|
Utf16BEDecoder.prototype.write = function(buf) {
|
|
544
|
-
if (buf.length == 0)
|
|
603
|
+
if (buf.length == 0) {
|
|
545
604
|
return "";
|
|
546
|
-
|
|
605
|
+
}
|
|
606
|
+
var buf2 = Buffer2.alloc(buf.length + 1);
|
|
607
|
+
var i = 0;
|
|
608
|
+
var j2 = 0;
|
|
547
609
|
if (this.overflowByte !== -1) {
|
|
548
610
|
buf2[0] = buf[0];
|
|
549
611
|
buf2[1] = this.overflowByte;
|
|
@@ -568,8 +630,9 @@ var require_utf16 = __commonJS({
|
|
|
568
630
|
Utf16Codec.prototype.decoder = Utf16Decoder;
|
|
569
631
|
function Utf16Encoder(options, codec) {
|
|
570
632
|
options = options || {};
|
|
571
|
-
if (options.addBOM === void 0)
|
|
633
|
+
if (options.addBOM === void 0) {
|
|
572
634
|
options.addBOM = true;
|
|
635
|
+
}
|
|
573
636
|
this.encoder = codec.iconv.getEncoder("utf-16le", options);
|
|
574
637
|
}
|
|
575
638
|
Utf16Encoder.prototype.write = function(str) {
|
|
@@ -589,13 +652,15 @@ var require_utf16 = __commonJS({
|
|
|
589
652
|
if (!this.decoder) {
|
|
590
653
|
this.initialBufs.push(buf);
|
|
591
654
|
this.initialBufsLen += buf.length;
|
|
592
|
-
if (this.initialBufsLen < 16)
|
|
655
|
+
if (this.initialBufsLen < 16) {
|
|
593
656
|
return "";
|
|
657
|
+
}
|
|
594
658
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
595
659
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
596
660
|
var resStr = "";
|
|
597
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
661
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
598
662
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
663
|
+
}
|
|
599
664
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
600
665
|
return resStr;
|
|
601
666
|
}
|
|
@@ -606,11 +671,13 @@ var require_utf16 = __commonJS({
|
|
|
606
671
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
607
672
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
608
673
|
var resStr = "";
|
|
609
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
674
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
610
675
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
676
|
+
}
|
|
611
677
|
var trail = this.decoder.end();
|
|
612
|
-
if (trail)
|
|
678
|
+
if (trail) {
|
|
613
679
|
resStr += trail;
|
|
680
|
+
}
|
|
614
681
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
615
682
|
return resStr;
|
|
616
683
|
}
|
|
@@ -619,8 +686,9 @@ var require_utf16 = __commonJS({
|
|
|
619
686
|
function detectEncoding(bufs, defaultEncoding) {
|
|
620
687
|
var b2 = [];
|
|
621
688
|
var charsProcessed = 0;
|
|
622
|
-
var asciiCharsLE = 0
|
|
623
|
-
|
|
689
|
+
var asciiCharsLE = 0;
|
|
690
|
+
var asciiCharsBE = 0;
|
|
691
|
+
outerLoop:
|
|
624
692
|
for (var i = 0; i < bufs.length; i++) {
|
|
625
693
|
var buf = bufs[i];
|
|
626
694
|
for (var j2 = 0; j2 < buf.length; j2++) {
|
|
@@ -635,7 +703,7 @@ var require_utf16 = __commonJS({
|
|
|
635
703
|
b2.length = 0;
|
|
636
704
|
charsProcessed++;
|
|
637
705
|
if (charsProcessed >= 100) {
|
|
638
|
-
break
|
|
706
|
+
break outerLoop;
|
|
639
707
|
}
|
|
640
708
|
}
|
|
641
709
|
}
|
|
@@ -678,14 +746,18 @@ var require_utf7 = __commonJS({
|
|
|
678
746
|
}
|
|
679
747
|
var base64Regex = /[A-Za-z0-9\/+]/;
|
|
680
748
|
var base64Chars = [];
|
|
681
|
-
for (i = 0; i < 256; i++)
|
|
749
|
+
for (i = 0; i < 256; i++) {
|
|
682
750
|
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
|
|
751
|
+
}
|
|
683
752
|
var i;
|
|
684
753
|
var plusChar = "+".charCodeAt(0);
|
|
685
754
|
var minusChar = "-".charCodeAt(0);
|
|
686
755
|
var andChar = "&".charCodeAt(0);
|
|
687
756
|
Utf7Decoder.prototype.write = function(buf) {
|
|
688
|
-
var res = ""
|
|
757
|
+
var res = "";
|
|
758
|
+
var lastI = 0;
|
|
759
|
+
var inBase64 = this.inBase64;
|
|
760
|
+
var base64Accum = this.base64Accum;
|
|
689
761
|
for (var i2 = 0; i2 < buf.length; i2++) {
|
|
690
762
|
if (!inBase64) {
|
|
691
763
|
if (buf[i2] == plusChar) {
|
|
@@ -701,8 +773,9 @@ var require_utf7 = __commonJS({
|
|
|
701
773
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
|
|
702
774
|
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
703
775
|
}
|
|
704
|
-
if (buf[i2] != minusChar)
|
|
776
|
+
if (buf[i2] != minusChar) {
|
|
705
777
|
i2--;
|
|
778
|
+
}
|
|
706
779
|
lastI = i2 + 1;
|
|
707
780
|
inBase64 = false;
|
|
708
781
|
base64Accum = "";
|
|
@@ -724,8 +797,9 @@ var require_utf7 = __commonJS({
|
|
|
724
797
|
};
|
|
725
798
|
Utf7Decoder.prototype.end = function() {
|
|
726
799
|
var res = "";
|
|
727
|
-
if (this.inBase64 && this.base64Accum.length > 0)
|
|
800
|
+
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
728
801
|
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
802
|
+
}
|
|
729
803
|
this.inBase64 = false;
|
|
730
804
|
this.base64Accum = "";
|
|
731
805
|
return res;
|
|
@@ -744,10 +818,14 @@ var require_utf7 = __commonJS({
|
|
|
744
818
|
this.base64AccumIdx = 0;
|
|
745
819
|
}
|
|
746
820
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
747
|
-
var inBase64 = this.inBase64
|
|
821
|
+
var inBase64 = this.inBase64;
|
|
822
|
+
var base64Accum = this.base64Accum;
|
|
823
|
+
var base64AccumIdx = this.base64AccumIdx;
|
|
824
|
+
var buf = Buffer2.alloc(str.length * 5 + 10);
|
|
825
|
+
var bufIdx = 0;
|
|
748
826
|
for (var i2 = 0; i2 < str.length; i2++) {
|
|
749
827
|
var uChar = str.charCodeAt(i2);
|
|
750
|
-
if (
|
|
828
|
+
if (uChar >= 32 && uChar <= 126) {
|
|
751
829
|
if (inBase64) {
|
|
752
830
|
if (base64AccumIdx > 0) {
|
|
753
831
|
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
|
|
@@ -758,8 +836,9 @@ var require_utf7 = __commonJS({
|
|
|
758
836
|
}
|
|
759
837
|
if (!inBase64) {
|
|
760
838
|
buf[bufIdx++] = uChar;
|
|
761
|
-
if (uChar === andChar)
|
|
839
|
+
if (uChar === andChar) {
|
|
762
840
|
buf[bufIdx++] = minusChar;
|
|
841
|
+
}
|
|
763
842
|
}
|
|
764
843
|
} else {
|
|
765
844
|
if (!inBase64) {
|
|
@@ -781,7 +860,8 @@ var require_utf7 = __commonJS({
|
|
|
781
860
|
return buf.slice(0, bufIdx);
|
|
782
861
|
};
|
|
783
862
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
784
|
-
var buf = Buffer2.alloc(10)
|
|
863
|
+
var buf = Buffer2.alloc(10);
|
|
864
|
+
var bufIdx = 0;
|
|
785
865
|
if (this.inBase64) {
|
|
786
866
|
if (this.base64AccumIdx > 0) {
|
|
787
867
|
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
|
|
@@ -800,7 +880,10 @@ var require_utf7 = __commonJS({
|
|
|
800
880
|
var base64IMAPChars = base64Chars.slice();
|
|
801
881
|
base64IMAPChars[",".charCodeAt(0)] = true;
|
|
802
882
|
Utf7IMAPDecoder.prototype.write = function(buf) {
|
|
803
|
-
var res = ""
|
|
883
|
+
var res = "";
|
|
884
|
+
var lastI = 0;
|
|
885
|
+
var inBase64 = this.inBase64;
|
|
886
|
+
var base64Accum = this.base64Accum;
|
|
804
887
|
for (var i2 = 0; i2 < buf.length; i2++) {
|
|
805
888
|
if (!inBase64) {
|
|
806
889
|
if (buf[i2] == andChar) {
|
|
@@ -816,8 +899,9 @@ var require_utf7 = __commonJS({
|
|
|
816
899
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
|
|
817
900
|
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
818
901
|
}
|
|
819
|
-
if (buf[i2] != minusChar)
|
|
902
|
+
if (buf[i2] != minusChar) {
|
|
820
903
|
i2--;
|
|
904
|
+
}
|
|
821
905
|
lastI = i2 + 1;
|
|
822
906
|
inBase64 = false;
|
|
823
907
|
base64Accum = "";
|
|
@@ -839,8 +923,9 @@ var require_utf7 = __commonJS({
|
|
|
839
923
|
};
|
|
840
924
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
841
925
|
var res = "";
|
|
842
|
-
if (this.inBase64 && this.base64Accum.length > 0)
|
|
926
|
+
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
843
927
|
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
928
|
+
}
|
|
844
929
|
this.inBase64 = false;
|
|
845
930
|
this.base64Accum = "";
|
|
846
931
|
return res;
|
|
@@ -855,20 +940,24 @@ var require_sbcs_codec = __commonJS({
|
|
|
855
940
|
var Buffer2 = require_safer().Buffer;
|
|
856
941
|
exports2._sbcs = SBCSCodec;
|
|
857
942
|
function SBCSCodec(codecOptions, iconv) {
|
|
858
|
-
if (!codecOptions)
|
|
943
|
+
if (!codecOptions) {
|
|
859
944
|
throw new Error("SBCS codec is called without the data.");
|
|
860
|
-
|
|
945
|
+
}
|
|
946
|
+
if (!codecOptions.chars || codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256) {
|
|
861
947
|
throw new Error("Encoding '" + codecOptions.type + "' has incorrect 'chars' (must be of len 128 or 256)");
|
|
948
|
+
}
|
|
862
949
|
if (codecOptions.chars.length === 128) {
|
|
863
950
|
var asciiString = "";
|
|
864
|
-
for (var i = 0; i < 128; i++)
|
|
951
|
+
for (var i = 0; i < 128; i++) {
|
|
865
952
|
asciiString += String.fromCharCode(i);
|
|
953
|
+
}
|
|
866
954
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
867
955
|
}
|
|
868
956
|
this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
|
|
869
957
|
var encodeBuf = Buffer2.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
|
|
870
|
-
for (var i = 0; i < codecOptions.chars.length; i++)
|
|
958
|
+
for (var i = 0; i < codecOptions.chars.length; i++) {
|
|
871
959
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
960
|
+
}
|
|
872
961
|
this.encodeBuf = encodeBuf;
|
|
873
962
|
}
|
|
874
963
|
SBCSCodec.prototype.encoder = SBCSEncoder;
|
|
@@ -878,8 +967,9 @@ var require_sbcs_codec = __commonJS({
|
|
|
878
967
|
}
|
|
879
968
|
SBCSEncoder.prototype.write = function(str) {
|
|
880
969
|
var buf = Buffer2.alloc(str.length);
|
|
881
|
-
for (var i = 0; i < str.length; i++)
|
|
970
|
+
for (var i = 0; i < str.length; i++) {
|
|
882
971
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
972
|
+
}
|
|
883
973
|
return buf;
|
|
884
974
|
};
|
|
885
975
|
SBCSEncoder.prototype.end = function() {
|
|
@@ -890,7 +980,8 @@ var require_sbcs_codec = __commonJS({
|
|
|
890
980
|
SBCSDecoder.prototype.write = function(buf) {
|
|
891
981
|
var decodeBuf = this.decodeBuf;
|
|
892
982
|
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
893
|
-
var idx1 = 0
|
|
983
|
+
var idx1 = 0;
|
|
984
|
+
var idx2 = 0;
|
|
894
985
|
for (var i = 0; i < buf.length; i++) {
|
|
895
986
|
idx1 = buf[i] * 2;
|
|
896
987
|
idx2 = i * 2;
|
|
@@ -910,149 +1001,149 @@ var require_sbcs_data = __commonJS({
|
|
|
910
1001
|
"use strict";
|
|
911
1002
|
module2.exports = {
|
|
912
1003
|
// Not supported by iconv, not sure why.
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1004
|
+
10029: "maccenteuro",
|
|
1005
|
+
maccenteuro: {
|
|
1006
|
+
type: "_sbcs",
|
|
1007
|
+
chars: "\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"
|
|
917
1008
|
},
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1009
|
+
808: "cp808",
|
|
1010
|
+
ibm808: "cp808",
|
|
1011
|
+
cp808: {
|
|
1012
|
+
type: "_sbcs",
|
|
1013
|
+
chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"
|
|
923
1014
|
},
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1015
|
+
mik: {
|
|
1016
|
+
type: "_sbcs",
|
|
1017
|
+
chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
|
|
927
1018
|
},
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1019
|
+
cp720: {
|
|
1020
|
+
type: "_sbcs",
|
|
1021
|
+
chars: "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
|
|
931
1022
|
},
|
|
932
1023
|
// Aliases of generated encodings.
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1024
|
+
ascii8bit: "ascii",
|
|
1025
|
+
usascii: "ascii",
|
|
1026
|
+
ansix34: "ascii",
|
|
1027
|
+
ansix341968: "ascii",
|
|
1028
|
+
ansix341986: "ascii",
|
|
1029
|
+
csascii: "ascii",
|
|
1030
|
+
cp367: "ascii",
|
|
1031
|
+
ibm367: "ascii",
|
|
1032
|
+
isoir6: "ascii",
|
|
1033
|
+
iso646us: "ascii",
|
|
1034
|
+
iso646irv: "ascii",
|
|
1035
|
+
us: "ascii",
|
|
1036
|
+
latin1: "iso88591",
|
|
1037
|
+
latin2: "iso88592",
|
|
1038
|
+
latin3: "iso88593",
|
|
1039
|
+
latin4: "iso88594",
|
|
1040
|
+
latin5: "iso88599",
|
|
1041
|
+
latin6: "iso885910",
|
|
1042
|
+
latin7: "iso885913",
|
|
1043
|
+
latin8: "iso885914",
|
|
1044
|
+
latin9: "iso885915",
|
|
1045
|
+
latin10: "iso885916",
|
|
1046
|
+
csisolatin1: "iso88591",
|
|
1047
|
+
csisolatin2: "iso88592",
|
|
1048
|
+
csisolatin3: "iso88593",
|
|
1049
|
+
csisolatin4: "iso88594",
|
|
1050
|
+
csisolatincyrillic: "iso88595",
|
|
1051
|
+
csisolatinarabic: "iso88596",
|
|
1052
|
+
csisolatingreek: "iso88597",
|
|
1053
|
+
csisolatinhebrew: "iso88598",
|
|
1054
|
+
csisolatin5: "iso88599",
|
|
1055
|
+
csisolatin6: "iso885910",
|
|
1056
|
+
l1: "iso88591",
|
|
1057
|
+
l2: "iso88592",
|
|
1058
|
+
l3: "iso88593",
|
|
1059
|
+
l4: "iso88594",
|
|
1060
|
+
l5: "iso88599",
|
|
1061
|
+
l6: "iso885910",
|
|
1062
|
+
l7: "iso885913",
|
|
1063
|
+
l8: "iso885914",
|
|
1064
|
+
l9: "iso885915",
|
|
1065
|
+
l10: "iso885916",
|
|
1066
|
+
isoir14: "iso646jp",
|
|
1067
|
+
isoir57: "iso646cn",
|
|
1068
|
+
isoir100: "iso88591",
|
|
1069
|
+
isoir101: "iso88592",
|
|
1070
|
+
isoir109: "iso88593",
|
|
1071
|
+
isoir110: "iso88594",
|
|
1072
|
+
isoir144: "iso88595",
|
|
1073
|
+
isoir127: "iso88596",
|
|
1074
|
+
isoir126: "iso88597",
|
|
1075
|
+
isoir138: "iso88598",
|
|
1076
|
+
isoir148: "iso88599",
|
|
1077
|
+
isoir157: "iso885910",
|
|
1078
|
+
isoir166: "tis620",
|
|
1079
|
+
isoir179: "iso885913",
|
|
1080
|
+
isoir199: "iso885914",
|
|
1081
|
+
isoir203: "iso885915",
|
|
1082
|
+
isoir226: "iso885916",
|
|
1083
|
+
cp819: "iso88591",
|
|
1084
|
+
ibm819: "iso88591",
|
|
1085
|
+
cyrillic: "iso88595",
|
|
1086
|
+
arabic: "iso88596",
|
|
1087
|
+
arabic8: "iso88596",
|
|
1088
|
+
ecma114: "iso88596",
|
|
1089
|
+
asmo708: "iso88596",
|
|
1090
|
+
greek: "iso88597",
|
|
1091
|
+
greek8: "iso88597",
|
|
1092
|
+
ecma118: "iso88597",
|
|
1093
|
+
elot928: "iso88597",
|
|
1094
|
+
hebrew: "iso88598",
|
|
1095
|
+
hebrew8: "iso88598",
|
|
1096
|
+
turkish: "iso88599",
|
|
1097
|
+
turkish8: "iso88599",
|
|
1098
|
+
thai: "iso885911",
|
|
1099
|
+
thai8: "iso885911",
|
|
1100
|
+
celtic: "iso885914",
|
|
1101
|
+
celtic8: "iso885914",
|
|
1102
|
+
isoceltic: "iso885914",
|
|
1103
|
+
tis6200: "tis620",
|
|
1104
|
+
tis62025291: "tis620",
|
|
1105
|
+
tis62025330: "tis620",
|
|
1106
|
+
1e4: "macroman",
|
|
1107
|
+
10006: "macgreek",
|
|
1108
|
+
10007: "maccyrillic",
|
|
1109
|
+
10079: "maciceland",
|
|
1110
|
+
10081: "macturkish",
|
|
1111
|
+
cspc8codepage437: "cp437",
|
|
1112
|
+
cspc775baltic: "cp775",
|
|
1113
|
+
cspc850multilingual: "cp850",
|
|
1114
|
+
cspcp852: "cp852",
|
|
1115
|
+
cspc862latinhebrew: "cp862",
|
|
1116
|
+
cpgr: "cp869",
|
|
1117
|
+
msee: "cp1250",
|
|
1118
|
+
mscyrl: "cp1251",
|
|
1119
|
+
msansi: "cp1252",
|
|
1120
|
+
msgreek: "cp1253",
|
|
1121
|
+
msturk: "cp1254",
|
|
1122
|
+
mshebr: "cp1255",
|
|
1123
|
+
msarab: "cp1256",
|
|
1124
|
+
winbaltrim: "cp1257",
|
|
1125
|
+
cp20866: "koi8r",
|
|
1126
|
+
20866: "koi8r",
|
|
1127
|
+
ibm878: "koi8r",
|
|
1128
|
+
cskoi8r: "koi8r",
|
|
1129
|
+
cp21866: "koi8u",
|
|
1130
|
+
21866: "koi8u",
|
|
1131
|
+
ibm1168: "koi8u",
|
|
1132
|
+
strk10482002: "rk1048",
|
|
1133
|
+
tcvn5712: "tcvn",
|
|
1134
|
+
tcvn57121: "tcvn",
|
|
1135
|
+
gb198880: "iso646cn",
|
|
1136
|
+
cn: "iso646cn",
|
|
1137
|
+
csiso14jisc6220ro: "iso646jp",
|
|
1138
|
+
jisc62201969ro: "iso646jp",
|
|
1139
|
+
jp: "iso646jp",
|
|
1140
|
+
cshproman8: "hproman8",
|
|
1141
|
+
r8: "hproman8",
|
|
1142
|
+
roman8: "hproman8",
|
|
1143
|
+
xroman8: "hproman8",
|
|
1144
|
+
ibm1051: "hproman8",
|
|
1145
|
+
mac: "macintosh",
|
|
1146
|
+
csmacintosh: "macintosh"
|
|
1056
1147
|
};
|
|
1057
1148
|
}
|
|
1058
1149
|
});
|
|
@@ -1524,21 +1615,25 @@ var require_dbcs_codec = __commonJS({
|
|
|
1524
1615
|
var NODE_START = -1e3;
|
|
1525
1616
|
var UNASSIGNED_NODE = new Array(256);
|
|
1526
1617
|
var DEF_CHAR = -1;
|
|
1527
|
-
for (i = 0; i < 256; i++)
|
|
1618
|
+
for (i = 0; i < 256; i++) {
|
|
1528
1619
|
UNASSIGNED_NODE[i] = UNASSIGNED;
|
|
1620
|
+
}
|
|
1529
1621
|
var i;
|
|
1530
1622
|
function DBCSCodec(codecOptions, iconv) {
|
|
1531
1623
|
this.encodingName = codecOptions.encodingName;
|
|
1532
|
-
if (!codecOptions)
|
|
1624
|
+
if (!codecOptions) {
|
|
1533
1625
|
throw new Error("DBCS codec is called without the data.");
|
|
1534
|
-
|
|
1626
|
+
}
|
|
1627
|
+
if (!codecOptions.table) {
|
|
1535
1628
|
throw new Error("Encoding '" + this.encodingName + "' has no data.");
|
|
1629
|
+
}
|
|
1536
1630
|
var mappingTable = codecOptions.table();
|
|
1537
1631
|
this.decodeTables = [];
|
|
1538
1632
|
this.decodeTables[0] = UNASSIGNED_NODE.slice(0);
|
|
1539
1633
|
this.decodeTableSeq = [];
|
|
1540
|
-
for (var i2 = 0; i2 < mappingTable.length; i2++)
|
|
1634
|
+
for (var i2 = 0; i2 < mappingTable.length; i2++) {
|
|
1541
1635
|
this._addDecodeChunk(mappingTable[i2]);
|
|
1636
|
+
}
|
|
1542
1637
|
if (typeof codecOptions.gb18030 === "function") {
|
|
1543
1638
|
this.gb18030 = codecOptions.gb18030();
|
|
1544
1639
|
var commonThirdByteNodeIdx = this.decodeTables.length;
|
|
@@ -1565,8 +1660,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1565
1660
|
}
|
|
1566
1661
|
var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k3]];
|
|
1567
1662
|
for (var l3 = 48; l3 <= 57; l3++) {
|
|
1568
|
-
if (fourthByteNode[l3] === UNASSIGNED)
|
|
1663
|
+
if (fourthByteNode[l3] === UNASSIGNED) {
|
|
1569
1664
|
fourthByteNode[l3] = GB18030_CODE;
|
|
1665
|
+
}
|
|
1570
1666
|
}
|
|
1571
1667
|
}
|
|
1572
1668
|
}
|
|
@@ -1576,20 +1672,25 @@ var require_dbcs_codec = __commonJS({
|
|
|
1576
1672
|
this.encodeTable = [];
|
|
1577
1673
|
this.encodeTableSeq = [];
|
|
1578
1674
|
var skipEncodeChars = {};
|
|
1579
|
-
if (codecOptions.encodeSkipVals)
|
|
1675
|
+
if (codecOptions.encodeSkipVals) {
|
|
1580
1676
|
for (var i2 = 0; i2 < codecOptions.encodeSkipVals.length; i2++) {
|
|
1581
1677
|
var val = codecOptions.encodeSkipVals[i2];
|
|
1582
|
-
if (typeof val === "number")
|
|
1678
|
+
if (typeof val === "number") {
|
|
1583
1679
|
skipEncodeChars[val] = true;
|
|
1584
|
-
else
|
|
1585
|
-
for (var j2 = val.from; j2 <= val.to; j2++)
|
|
1680
|
+
} else {
|
|
1681
|
+
for (var j2 = val.from; j2 <= val.to; j2++) {
|
|
1586
1682
|
skipEncodeChars[j2] = true;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1587
1685
|
}
|
|
1686
|
+
}
|
|
1588
1687
|
this._fillEncodeTable(0, 0, skipEncodeChars);
|
|
1589
1688
|
if (codecOptions.encodeAdd) {
|
|
1590
|
-
for (var uChar in codecOptions.encodeAdd)
|
|
1591
|
-
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
|
|
1689
|
+
for (var uChar in codecOptions.encodeAdd) {
|
|
1690
|
+
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) {
|
|
1592
1691
|
this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1593
1694
|
}
|
|
1594
1695
|
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
|
|
1595
1696
|
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]["?"];
|
|
@@ -1599,10 +1700,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1599
1700
|
DBCSCodec.prototype.decoder = DBCSDecoder;
|
|
1600
1701
|
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
|
|
1601
1702
|
var bytes = [];
|
|
1602
|
-
for (; addr > 0; addr >>>= 8)
|
|
1703
|
+
for (; addr > 0; addr >>>= 8) {
|
|
1603
1704
|
bytes.push(addr & 255);
|
|
1604
|
-
|
|
1705
|
+
}
|
|
1706
|
+
if (bytes.length == 0) {
|
|
1605
1707
|
bytes.push(0);
|
|
1708
|
+
}
|
|
1606
1709
|
var node = this.decodeTables[0];
|
|
1607
1710
|
for (var i2 = bytes.length - 1; i2 > 0; i2--) {
|
|
1608
1711
|
var val = node[bytes[i2]];
|
|
@@ -1611,8 +1714,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1611
1714
|
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
|
|
1612
1715
|
} else if (val <= NODE_START) {
|
|
1613
1716
|
node = this.decodeTables[NODE_START - val];
|
|
1614
|
-
} else
|
|
1717
|
+
} else {
|
|
1615
1718
|
throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
|
|
1719
|
+
}
|
|
1616
1720
|
}
|
|
1617
1721
|
return node;
|
|
1618
1722
|
};
|
|
@@ -1625,45 +1729,53 @@ var require_dbcs_codec = __commonJS({
|
|
|
1625
1729
|
if (typeof part === "string") {
|
|
1626
1730
|
for (var l3 = 0; l3 < part.length; ) {
|
|
1627
1731
|
var code = part.charCodeAt(l3++);
|
|
1628
|
-
if (
|
|
1732
|
+
if (code >= 55296 && code < 56320) {
|
|
1629
1733
|
var codeTrail = part.charCodeAt(l3++);
|
|
1630
|
-
if (
|
|
1734
|
+
if (codeTrail >= 56320 && codeTrail < 57344) {
|
|
1631
1735
|
writeTable[curAddr++] = 65536 + (code - 55296) * 1024 + (codeTrail - 56320);
|
|
1632
|
-
else
|
|
1736
|
+
} else {
|
|
1633
1737
|
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
|
|
1634
|
-
|
|
1738
|
+
}
|
|
1739
|
+
} else if (code > 4080 && code <= 4095) {
|
|
1635
1740
|
var len = 4095 - code + 2;
|
|
1636
1741
|
var seq = [];
|
|
1637
|
-
for (var m2 = 0; m2 < len; m2++)
|
|
1742
|
+
for (var m2 = 0; m2 < len; m2++) {
|
|
1638
1743
|
seq.push(part.charCodeAt(l3++));
|
|
1744
|
+
}
|
|
1639
1745
|
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
|
|
1640
1746
|
this.decodeTableSeq.push(seq);
|
|
1641
|
-
} else
|
|
1747
|
+
} else {
|
|
1642
1748
|
writeTable[curAddr++] = code;
|
|
1749
|
+
}
|
|
1643
1750
|
}
|
|
1644
1751
|
} else if (typeof part === "number") {
|
|
1645
1752
|
var charCode = writeTable[curAddr - 1] + 1;
|
|
1646
|
-
for (var l3 = 0; l3 < part; l3++)
|
|
1753
|
+
for (var l3 = 0; l3 < part; l3++) {
|
|
1647
1754
|
writeTable[curAddr++] = charCode++;
|
|
1648
|
-
|
|
1755
|
+
}
|
|
1756
|
+
} else {
|
|
1649
1757
|
throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
|
|
1758
|
+
}
|
|
1650
1759
|
}
|
|
1651
|
-
if (curAddr > 255)
|
|
1760
|
+
if (curAddr > 255) {
|
|
1652
1761
|
throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
|
|
1762
|
+
}
|
|
1653
1763
|
};
|
|
1654
1764
|
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
|
|
1655
1765
|
var high = uCode >> 8;
|
|
1656
|
-
if (this.encodeTable[high] === void 0)
|
|
1766
|
+
if (this.encodeTable[high] === void 0) {
|
|
1657
1767
|
this.encodeTable[high] = UNASSIGNED_NODE.slice(0);
|
|
1768
|
+
}
|
|
1658
1769
|
return this.encodeTable[high];
|
|
1659
1770
|
};
|
|
1660
1771
|
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
|
|
1661
1772
|
var bucket = this._getEncodeBucket(uCode);
|
|
1662
1773
|
var low = uCode & 255;
|
|
1663
|
-
if (bucket[low] <= SEQ_START)
|
|
1774
|
+
if (bucket[low] <= SEQ_START) {
|
|
1664
1775
|
this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = dbcsCode;
|
|
1665
|
-
else if (bucket[low] == UNASSIGNED)
|
|
1776
|
+
} else if (bucket[low] == UNASSIGNED) {
|
|
1666
1777
|
bucket[low] = dbcsCode;
|
|
1778
|
+
}
|
|
1667
1779
|
};
|
|
1668
1780
|
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
|
|
1669
1781
|
var uCode = seq[0];
|
|
@@ -1680,12 +1792,13 @@ var require_dbcs_codec = __commonJS({
|
|
|
1680
1792
|
}
|
|
1681
1793
|
for (var j2 = 1; j2 < seq.length - 1; j2++) {
|
|
1682
1794
|
var oldVal = node[uCode];
|
|
1683
|
-
if (typeof oldVal === "object")
|
|
1795
|
+
if (typeof oldVal === "object") {
|
|
1684
1796
|
node = oldVal;
|
|
1685
|
-
else {
|
|
1797
|
+
} else {
|
|
1686
1798
|
node = node[uCode] = {};
|
|
1687
|
-
if (oldVal !== void 0)
|
|
1799
|
+
if (oldVal !== void 0) {
|
|
1688
1800
|
node[DEF_CHAR] = oldVal;
|
|
1801
|
+
}
|
|
1689
1802
|
}
|
|
1690
1803
|
}
|
|
1691
1804
|
uCode = seq[seq.length - 1];
|
|
@@ -1698,8 +1811,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1698
1811
|
for (var i2 = 0; i2 < 256; i2++) {
|
|
1699
1812
|
var uCode = node[i2];
|
|
1700
1813
|
var mbCode = prefix + i2;
|
|
1701
|
-
if (skipEncodeChars[mbCode])
|
|
1814
|
+
if (skipEncodeChars[mbCode]) {
|
|
1702
1815
|
continue;
|
|
1816
|
+
}
|
|
1703
1817
|
if (uCode >= 0) {
|
|
1704
1818
|
this._setEncodeChar(uCode, mbCode);
|
|
1705
1819
|
hasValues = true;
|
|
@@ -1707,10 +1821,11 @@ var require_dbcs_codec = __commonJS({
|
|
|
1707
1821
|
var subNodeIdx = NODE_START - uCode;
|
|
1708
1822
|
if (!subNodeEmpty[subNodeIdx]) {
|
|
1709
1823
|
var newPrefix = mbCode << 8 >>> 0;
|
|
1710
|
-
if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars))
|
|
1824
|
+
if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars)) {
|
|
1711
1825
|
hasValues = true;
|
|
1712
|
-
else
|
|
1826
|
+
} else {
|
|
1713
1827
|
subNodeEmpty[subNodeIdx] = true;
|
|
1828
|
+
}
|
|
1714
1829
|
}
|
|
1715
1830
|
} else if (uCode <= SEQ_START) {
|
|
1716
1831
|
this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
|
|
@@ -1728,7 +1843,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1728
1843
|
this.gb18030 = codec.gb18030;
|
|
1729
1844
|
}
|
|
1730
1845
|
DBCSEncoder.prototype.write = function(str) {
|
|
1731
|
-
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3))
|
|
1846
|
+
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
|
|
1847
|
+
var leadSurrogate = this.leadSurrogate;
|
|
1848
|
+
var seqObj = this.seqObj;
|
|
1849
|
+
var nextChar = -1;
|
|
1850
|
+
var i2 = 0;
|
|
1851
|
+
var j2 = 0;
|
|
1732
1852
|
while (true) {
|
|
1733
1853
|
if (nextChar === -1) {
|
|
1734
1854
|
if (i2 == str.length) break;
|
|
@@ -1737,7 +1857,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
1737
1857
|
var uCode = nextChar;
|
|
1738
1858
|
nextChar = -1;
|
|
1739
1859
|
}
|
|
1740
|
-
if (
|
|
1860
|
+
if (uCode >= 55296 && uCode < 57344) {
|
|
1741
1861
|
if (uCode < 56320) {
|
|
1742
1862
|
if (leadSurrogate === -1) {
|
|
1743
1863
|
leadSurrogate = uCode;
|
|
@@ -1765,7 +1885,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
1765
1885
|
if (typeof resCode === "object") {
|
|
1766
1886
|
seqObj = resCode;
|
|
1767
1887
|
continue;
|
|
1768
|
-
} else if (typeof resCode
|
|
1888
|
+
} else if (typeof resCode === "number") {
|
|
1769
1889
|
dbcsCode = resCode;
|
|
1770
1890
|
} else if (resCode == void 0) {
|
|
1771
1891
|
resCode = seqObj[DEF_CHAR];
|
|
@@ -1778,8 +1898,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1778
1898
|
seqObj = void 0;
|
|
1779
1899
|
} else if (uCode >= 0) {
|
|
1780
1900
|
var subtable = this.encodeTable[uCode >> 8];
|
|
1781
|
-
if (subtable !== void 0)
|
|
1901
|
+
if (subtable !== void 0) {
|
|
1782
1902
|
dbcsCode = subtable[uCode & 255];
|
|
1903
|
+
}
|
|
1783
1904
|
if (dbcsCode <= SEQ_START) {
|
|
1784
1905
|
seqObj = this.encodeTableSeq[SEQ_START - dbcsCode];
|
|
1785
1906
|
continue;
|
|
@@ -1799,8 +1920,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1799
1920
|
}
|
|
1800
1921
|
}
|
|
1801
1922
|
}
|
|
1802
|
-
if (dbcsCode === UNASSIGNED)
|
|
1923
|
+
if (dbcsCode === UNASSIGNED) {
|
|
1803
1924
|
dbcsCode = this.defaultCharSingleByte;
|
|
1925
|
+
}
|
|
1804
1926
|
if (dbcsCode < 256) {
|
|
1805
1927
|
newBuf[j2++] = dbcsCode;
|
|
1806
1928
|
} else if (dbcsCode < 65536) {
|
|
@@ -1822,9 +1944,11 @@ var require_dbcs_codec = __commonJS({
|
|
|
1822
1944
|
return newBuf.slice(0, j2);
|
|
1823
1945
|
};
|
|
1824
1946
|
DBCSEncoder.prototype.end = function() {
|
|
1825
|
-
if (this.leadSurrogate === -1 && this.seqObj === void 0)
|
|
1947
|
+
if (this.leadSurrogate === -1 && this.seqObj === void 0) {
|
|
1826
1948
|
return;
|
|
1827
|
-
|
|
1949
|
+
}
|
|
1950
|
+
var newBuf = Buffer2.alloc(10);
|
|
1951
|
+
var j2 = 0;
|
|
1828
1952
|
if (this.seqObj) {
|
|
1829
1953
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
1830
1954
|
if (dbcsCode !== void 0) {
|
|
@@ -1854,7 +1978,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1854
1978
|
this.gb18030 = codec.gb18030;
|
|
1855
1979
|
}
|
|
1856
1980
|
DBCSDecoder.prototype.write = function(buf) {
|
|
1857
|
-
var newBuf = Buffer2.alloc(buf.length * 2)
|
|
1981
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
1982
|
+
var nodeIdx = this.nodeIdx;
|
|
1983
|
+
var prevBytes = this.prevBytes;
|
|
1984
|
+
var prevOffset = this.prevBytes.length;
|
|
1985
|
+
var seqStart = -this.prevBytes.length;
|
|
1986
|
+
var uCode;
|
|
1858
1987
|
for (var i2 = 0, j2 = 0; i2 < buf.length; i2++) {
|
|
1859
1988
|
var curByte = i2 >= 0 ? buf[i2] : prevBytes[i2 + prevOffset];
|
|
1860
1989
|
var uCode = this.decodeTables[nodeIdx][curByte];
|
|
@@ -1881,8 +2010,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1881
2010
|
newBuf[j2++] = uCode >> 8;
|
|
1882
2011
|
}
|
|
1883
2012
|
uCode = seq[seq.length - 1];
|
|
1884
|
-
} else
|
|
2013
|
+
} else {
|
|
1885
2014
|
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
|
2015
|
+
}
|
|
1886
2016
|
if (uCode >= 65536) {
|
|
1887
2017
|
uCode -= 65536;
|
|
1888
2018
|
var uCodeLead = 55296 | uCode >> 10;
|
|
@@ -1906,23 +2036,27 @@ var require_dbcs_codec = __commonJS({
|
|
|
1906
2036
|
var bytesArr = this.prevBytes.slice(1);
|
|
1907
2037
|
this.prevBytes = [];
|
|
1908
2038
|
this.nodeIdx = 0;
|
|
1909
|
-
if (bytesArr.length > 0)
|
|
2039
|
+
if (bytesArr.length > 0) {
|
|
1910
2040
|
ret += this.write(bytesArr);
|
|
2041
|
+
}
|
|
1911
2042
|
}
|
|
1912
2043
|
this.prevBytes = [];
|
|
1913
2044
|
this.nodeIdx = 0;
|
|
1914
2045
|
return ret;
|
|
1915
2046
|
};
|
|
1916
2047
|
function findIdx(table, val) {
|
|
1917
|
-
if (table[0] > val)
|
|
2048
|
+
if (table[0] > val) {
|
|
1918
2049
|
return -1;
|
|
1919
|
-
|
|
2050
|
+
}
|
|
2051
|
+
var l3 = 0;
|
|
2052
|
+
var r6 = table.length;
|
|
1920
2053
|
while (l3 < r6 - 1) {
|
|
1921
2054
|
var mid = l3 + (r6 - l3 + 1 >> 1);
|
|
1922
|
-
if (table[mid] <= val)
|
|
2055
|
+
if (table[mid] <= val) {
|
|
1923
2056
|
l3 = mid;
|
|
1924
|
-
else
|
|
2057
|
+
} else {
|
|
1925
2058
|
r6 = mid;
|
|
2059
|
+
}
|
|
1926
2060
|
}
|
|
1927
2061
|
return l3;
|
|
1928
2062
|
}
|
|
@@ -3185,7 +3319,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3185
3319
|
// == Japanese/ShiftJIS ====================================================
|
|
3186
3320
|
// All japanese encodings are based on JIS X set of standards:
|
|
3187
3321
|
// JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
|
|
3188
|
-
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
|
|
3322
|
+
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
|
|
3189
3323
|
// Has several variations in 1978, 1983, 1990 and 1997.
|
|
3190
3324
|
// JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
|
|
3191
3325
|
// JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
|
|
@@ -3202,7 +3336,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3202
3336
|
// 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
|
|
3203
3337
|
// * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
|
|
3204
3338
|
// Used as-is in ISO2022 family.
|
|
3205
|
-
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
|
|
3339
|
+
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
|
|
3206
3340
|
// 0201-1976 Roman, 0208-1978, 0208-1983.
|
|
3207
3341
|
// * ISO2022-JP-1: Adds esc seq for 0212-1990.
|
|
3208
3342
|
// * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
|
|
@@ -3212,7 +3346,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3212
3346
|
// After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
|
|
3213
3347
|
//
|
|
3214
3348
|
// Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
|
|
3215
|
-
|
|
3349
|
+
shiftjis: {
|
|
3216
3350
|
type: "_dbcs",
|
|
3217
3351
|
table: function() {
|
|
3218
3352
|
return require_shiftjis();
|
|
@@ -3220,17 +3354,17 @@ var require_dbcs_data = __commonJS({
|
|
|
3220
3354
|
encodeAdd: { "\xA5": 92, "\u203E": 126 },
|
|
3221
3355
|
encodeSkipVals: [{ from: 60736, to: 63808 }]
|
|
3222
3356
|
},
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3357
|
+
csshiftjis: "shiftjis",
|
|
3358
|
+
mskanji: "shiftjis",
|
|
3359
|
+
sjis: "shiftjis",
|
|
3360
|
+
windows31j: "shiftjis",
|
|
3361
|
+
ms31j: "shiftjis",
|
|
3362
|
+
xsjis: "shiftjis",
|
|
3363
|
+
windows932: "shiftjis",
|
|
3364
|
+
ms932: "shiftjis",
|
|
3365
|
+
932: "shiftjis",
|
|
3366
|
+
cp932: "shiftjis",
|
|
3367
|
+
eucjp: {
|
|
3234
3368
|
type: "_dbcs",
|
|
3235
3369
|
table: function() {
|
|
3236
3370
|
return require_eucjp();
|
|
@@ -3244,37 +3378,37 @@ var require_dbcs_data = __commonJS({
|
|
|
3244
3378
|
// http://en.wikipedia.org/wiki/GBK
|
|
3245
3379
|
// We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
3246
3380
|
// Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3381
|
+
gb2312: "cp936",
|
|
3382
|
+
gb231280: "cp936",
|
|
3383
|
+
gb23121980: "cp936",
|
|
3384
|
+
csgb2312: "cp936",
|
|
3385
|
+
csiso58gb231280: "cp936",
|
|
3386
|
+
euccn: "cp936",
|
|
3253
3387
|
// Microsoft's CP936 is a subset and approximation of GBK.
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3388
|
+
windows936: "cp936",
|
|
3389
|
+
ms936: "cp936",
|
|
3390
|
+
936: "cp936",
|
|
3391
|
+
cp936: {
|
|
3258
3392
|
type: "_dbcs",
|
|
3259
3393
|
table: function() {
|
|
3260
3394
|
return require_cp936();
|
|
3261
3395
|
}
|
|
3262
3396
|
},
|
|
3263
3397
|
// GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
|
|
3264
|
-
|
|
3398
|
+
gbk: {
|
|
3265
3399
|
type: "_dbcs",
|
|
3266
3400
|
table: function() {
|
|
3267
3401
|
return require_cp936().concat(require_gbk_added());
|
|
3268
3402
|
}
|
|
3269
3403
|
},
|
|
3270
|
-
|
|
3271
|
-
|
|
3404
|
+
xgbk: "gbk",
|
|
3405
|
+
isoir58: "gbk",
|
|
3272
3406
|
// GB18030 is an algorithmic extension of GBK.
|
|
3273
3407
|
// Main source: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
3274
3408
|
// http://icu-project.org/docs/papers/gb18030.html
|
|
3275
3409
|
// http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
|
|
3276
3410
|
// http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
|
|
3277
|
-
|
|
3411
|
+
gb18030: {
|
|
3278
3412
|
type: "_dbcs",
|
|
3279
3413
|
table: function() {
|
|
3280
3414
|
return require_cp936().concat(require_gbk_added());
|
|
@@ -3285,26 +3419,26 @@ var require_dbcs_data = __commonJS({
|
|
|
3285
3419
|
encodeSkipVals: [128],
|
|
3286
3420
|
encodeAdd: { "\u20AC": 41699 }
|
|
3287
3421
|
},
|
|
3288
|
-
|
|
3422
|
+
chinese: "gb18030",
|
|
3289
3423
|
// == Korean ===============================================================
|
|
3290
3424
|
// EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3425
|
+
windows949: "cp949",
|
|
3426
|
+
ms949: "cp949",
|
|
3427
|
+
949: "cp949",
|
|
3428
|
+
cp949: {
|
|
3295
3429
|
type: "_dbcs",
|
|
3296
3430
|
table: function() {
|
|
3297
3431
|
return require_cp949();
|
|
3298
3432
|
}
|
|
3299
3433
|
},
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3434
|
+
cseuckr: "cp949",
|
|
3435
|
+
csksc56011987: "cp949",
|
|
3436
|
+
euckr: "cp949",
|
|
3437
|
+
isoir149: "cp949",
|
|
3438
|
+
korean: "cp949",
|
|
3439
|
+
ksc56011987: "cp949",
|
|
3440
|
+
ksc56011989: "cp949",
|
|
3441
|
+
ksc5601: "cp949",
|
|
3308
3442
|
// == Big5/Taiwan/Hong Kong ================================================
|
|
3309
3443
|
// There are lots of tables for Big5 and cp950. Please see the following links for history:
|
|
3310
3444
|
// http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
|
|
@@ -3313,7 +3447,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3313
3447
|
// * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
|
|
3314
3448
|
// * Big5-2003 (Taiwan standard) almost superset of cp950.
|
|
3315
3449
|
// * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
|
|
3316
|
-
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
|
|
3450
|
+
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
|
|
3317
3451
|
// many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
|
|
3318
3452
|
// Plus, it has 4 combining sequences.
|
|
3319
3453
|
// Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
|
|
@@ -3324,21 +3458,21 @@ var require_dbcs_data = __commonJS({
|
|
|
3324
3458
|
// In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
|
|
3325
3459
|
// Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
|
|
3326
3460
|
// http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
|
|
3327
|
-
//
|
|
3461
|
+
//
|
|
3328
3462
|
// Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
|
|
3329
3463
|
// Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3464
|
+
windows950: "cp950",
|
|
3465
|
+
ms950: "cp950",
|
|
3466
|
+
950: "cp950",
|
|
3467
|
+
cp950: {
|
|
3334
3468
|
type: "_dbcs",
|
|
3335
3469
|
table: function() {
|
|
3336
3470
|
return require_cp950();
|
|
3337
3471
|
}
|
|
3338
3472
|
},
|
|
3339
3473
|
// Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
|
|
3340
|
-
|
|
3341
|
-
|
|
3474
|
+
big5: "big5hkscs",
|
|
3475
|
+
big5hkscs: {
|
|
3342
3476
|
type: "_dbcs",
|
|
3343
3477
|
table: function() {
|
|
3344
3478
|
return require_cp950().concat(require_big5_added());
|
|
@@ -3417,9 +3551,9 @@ var require_dbcs_data = __commonJS({
|
|
|
3417
3551
|
41678
|
|
3418
3552
|
]
|
|
3419
3553
|
},
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3554
|
+
cnbig5: "big5hkscs",
|
|
3555
|
+
csbig5: "big5hkscs",
|
|
3556
|
+
xxbig5: "big5hkscs"
|
|
3423
3557
|
};
|
|
3424
3558
|
}
|
|
3425
3559
|
});
|
|
@@ -3428,6 +3562,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3428
3562
|
var require_encodings = __commonJS({
|
|
3429
3563
|
"../../node_modules/iconv-lite/encodings/index.js"(exports2, module2) {
|
|
3430
3564
|
"use strict";
|
|
3565
|
+
var mergeModules = require_merge_exports();
|
|
3431
3566
|
var modules = [
|
|
3432
3567
|
require_internal(),
|
|
3433
3568
|
require_utf32(),
|
|
@@ -3441,12 +3576,9 @@ var require_encodings = __commonJS({
|
|
|
3441
3576
|
];
|
|
3442
3577
|
for (i = 0; i < modules.length; i++) {
|
|
3443
3578
|
module2 = modules[i];
|
|
3444
|
-
|
|
3445
|
-
if (Object.prototype.hasOwnProperty.call(module2, enc))
|
|
3446
|
-
exports2[enc] = module2[enc];
|
|
3579
|
+
mergeModules(exports2, module2);
|
|
3447
3580
|
}
|
|
3448
3581
|
var module2;
|
|
3449
|
-
var enc;
|
|
3450
3582
|
var i;
|
|
3451
3583
|
}
|
|
3452
3584
|
});
|
|
@@ -3456,8 +3588,8 @@ var require_streams = __commonJS({
|
|
|
3456
3588
|
"../../node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
|
|
3457
3589
|
"use strict";
|
|
3458
3590
|
var Buffer2 = require_safer().Buffer;
|
|
3459
|
-
module2.exports = function(
|
|
3460
|
-
var Transform =
|
|
3591
|
+
module2.exports = function(streamModule) {
|
|
3592
|
+
var Transform = streamModule.Transform;
|
|
3461
3593
|
function IconvLiteEncoderStream(conv, options) {
|
|
3462
3594
|
this.conv = conv;
|
|
3463
3595
|
options = options || {};
|
|
@@ -3468,8 +3600,9 @@ var require_streams = __commonJS({
|
|
|
3468
3600
|
constructor: { value: IconvLiteEncoderStream }
|
|
3469
3601
|
});
|
|
3470
3602
|
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
3471
|
-
if (typeof chunk
|
|
3603
|
+
if (typeof chunk !== "string") {
|
|
3472
3604
|
return done(new Error("Iconv encoding stream needs strings as its input."));
|
|
3605
|
+
}
|
|
3473
3606
|
try {
|
|
3474
3607
|
var res = this.conv.write(chunk);
|
|
3475
3608
|
if (res && res.length) this.push(res);
|
|
@@ -3508,8 +3641,9 @@ var require_streams = __commonJS({
|
|
|
3508
3641
|
constructor: { value: IconvLiteDecoderStream }
|
|
3509
3642
|
});
|
|
3510
3643
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
3511
|
-
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array))
|
|
3644
|
+
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
|
|
3512
3645
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
3646
|
+
}
|
|
3513
3647
|
try {
|
|
3514
3648
|
var res = this.conv.write(chunk);
|
|
3515
3649
|
if (res && res.length) this.push(res, this.encoding);
|
|
@@ -3552,6 +3686,7 @@ var require_lib = __commonJS({
|
|
|
3552
3686
|
"use strict";
|
|
3553
3687
|
var Buffer2 = require_safer().Buffer;
|
|
3554
3688
|
var bomHandling = require_bom_handling();
|
|
3689
|
+
var mergeModules = require_merge_exports();
|
|
3555
3690
|
var iconv = module2.exports;
|
|
3556
3691
|
iconv.encodings = null;
|
|
3557
3692
|
iconv.defaultCharUnicode = "\uFFFD";
|
|
@@ -3586,31 +3721,38 @@ var require_lib = __commonJS({
|
|
|
3586
3721
|
};
|
|
3587
3722
|
iconv.toEncoding = iconv.encode;
|
|
3588
3723
|
iconv.fromEncoding = iconv.decode;
|
|
3589
|
-
iconv._codecDataCache = {};
|
|
3724
|
+
iconv._codecDataCache = { __proto__: null };
|
|
3590
3725
|
iconv.getCodec = function getCodec(encoding) {
|
|
3591
|
-
if (!iconv.encodings)
|
|
3592
|
-
|
|
3726
|
+
if (!iconv.encodings) {
|
|
3727
|
+
var raw = require_encodings();
|
|
3728
|
+
iconv.encodings = { __proto__: null };
|
|
3729
|
+
mergeModules(iconv.encodings, raw);
|
|
3730
|
+
}
|
|
3593
3731
|
var enc = iconv._canonicalizeEncoding(encoding);
|
|
3594
3732
|
var codecOptions = {};
|
|
3595
3733
|
while (true) {
|
|
3596
3734
|
var codec = iconv._codecDataCache[enc];
|
|
3597
|
-
if (codec)
|
|
3735
|
+
if (codec) {
|
|
3598
3736
|
return codec;
|
|
3737
|
+
}
|
|
3599
3738
|
var codecDef = iconv.encodings[enc];
|
|
3600
3739
|
switch (typeof codecDef) {
|
|
3601
3740
|
case "string":
|
|
3602
3741
|
enc = codecDef;
|
|
3603
3742
|
break;
|
|
3604
3743
|
case "object":
|
|
3605
|
-
for (var key in codecDef)
|
|
3744
|
+
for (var key in codecDef) {
|
|
3606
3745
|
codecOptions[key] = codecDef[key];
|
|
3607
|
-
|
|
3746
|
+
}
|
|
3747
|
+
if (!codecOptions.encodingName) {
|
|
3608
3748
|
codecOptions.encodingName = enc;
|
|
3749
|
+
}
|
|
3609
3750
|
enc = codecDef.type;
|
|
3610
3751
|
break;
|
|
3611
3752
|
case "function":
|
|
3612
|
-
if (!codecOptions.encodingName)
|
|
3753
|
+
if (!codecOptions.encodingName) {
|
|
3613
3754
|
codecOptions.encodingName = enc;
|
|
3755
|
+
}
|
|
3614
3756
|
codec = new codecDef(codecOptions, iconv);
|
|
3615
3757
|
iconv._codecDataCache[codecOptions.encodingName] = codec;
|
|
3616
3758
|
return codec;
|
|
@@ -3623,21 +3765,26 @@ var require_lib = __commonJS({
|
|
|
3623
3765
|
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
|
3624
3766
|
};
|
|
3625
3767
|
iconv.getEncoder = function getEncoder(encoding, options) {
|
|
3626
|
-
var codec = iconv.getCodec(encoding)
|
|
3627
|
-
|
|
3768
|
+
var codec = iconv.getCodec(encoding);
|
|
3769
|
+
var encoder = new codec.encoder(options, codec);
|
|
3770
|
+
if (codec.bomAware && options && options.addBOM) {
|
|
3628
3771
|
encoder = new bomHandling.PrependBOM(encoder, options);
|
|
3772
|
+
}
|
|
3629
3773
|
return encoder;
|
|
3630
3774
|
};
|
|
3631
3775
|
iconv.getDecoder = function getDecoder(encoding, options) {
|
|
3632
|
-
var codec = iconv.getCodec(encoding)
|
|
3633
|
-
|
|
3776
|
+
var codec = iconv.getCodec(encoding);
|
|
3777
|
+
var decoder = new codec.decoder(options, codec);
|
|
3778
|
+
if (codec.bomAware && !(options && options.stripBOM === false)) {
|
|
3634
3779
|
decoder = new bomHandling.StripBOM(decoder, options);
|
|
3780
|
+
}
|
|
3635
3781
|
return decoder;
|
|
3636
3782
|
};
|
|
3637
|
-
iconv.enableStreamingAPI = function enableStreamingAPI(
|
|
3638
|
-
if (iconv.supportsStreams)
|
|
3783
|
+
iconv.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
|
|
3784
|
+
if (iconv.supportsStreams) {
|
|
3639
3785
|
return;
|
|
3640
|
-
|
|
3786
|
+
}
|
|
3787
|
+
var streams = require_streams()(streamModule2);
|
|
3641
3788
|
iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
|
|
3642
3789
|
iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
|
|
3643
3790
|
iconv.encodeStream = function encodeStream(encoding, options) {
|
|
@@ -3648,13 +3795,13 @@ var require_lib = __commonJS({
|
|
|
3648
3795
|
};
|
|
3649
3796
|
iconv.supportsStreams = true;
|
|
3650
3797
|
};
|
|
3651
|
-
var
|
|
3798
|
+
var streamModule;
|
|
3652
3799
|
try {
|
|
3653
|
-
|
|
3800
|
+
streamModule = require("stream");
|
|
3654
3801
|
} catch (e) {
|
|
3655
3802
|
}
|
|
3656
|
-
if (
|
|
3657
|
-
iconv.enableStreamingAPI(
|
|
3803
|
+
if (streamModule && streamModule.Transform) {
|
|
3804
|
+
iconv.enableStreamingAPI(streamModule);
|
|
3658
3805
|
} else {
|
|
3659
3806
|
iconv.encodeStream = iconv.decodeStream = function() {
|
|
3660
3807
|
throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
|
|
@@ -52788,7 +52935,7 @@ var $t = class {
|
|
|
52788
52935
|
return this.masterSubEmitter || (this.masterSubEmitter = new et(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
|
|
52789
52936
|
}
|
|
52790
52937
|
};
|
|
52791
|
-
var Kr = "4.3.
|
|
52938
|
+
var Kr = "4.3.12-5e839d331";
|
|
52792
52939
|
var ga = A.FHIR_JSON + ", */*; q=0.1";
|
|
52793
52940
|
var xa = "https://api.medplum.com/";
|
|
52794
52941
|
var va = 1e3;
|