maplestory-openapi 2.7.3 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,6 +4,2355 @@ import xml2js from 'xml2js';
4
4
 
5
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
6
 
7
+ var buffer = {};
8
+
9
+ var base64Js = {};
10
+
11
+ base64Js.byteLength = byteLength;
12
+ base64Js.toByteArray = toByteArray;
13
+ base64Js.fromByteArray = fromByteArray;
14
+
15
+ var lookup = [];
16
+ var revLookup = [];
17
+ var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
18
+
19
+ var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
20
+ for (var i = 0, len = code.length; i < len; ++i) {
21
+ lookup[i] = code[i];
22
+ revLookup[code.charCodeAt(i)] = i;
23
+ }
24
+
25
+ // Support decoding URL-safe base64 strings, as Node.js does.
26
+ // See: https://en.wikipedia.org/wiki/Base64#URL_applications
27
+ revLookup['-'.charCodeAt(0)] = 62;
28
+ revLookup['_'.charCodeAt(0)] = 63;
29
+
30
+ function getLens (b64) {
31
+ var len = b64.length;
32
+
33
+ if (len % 4 > 0) {
34
+ throw new Error('Invalid string. Length must be a multiple of 4')
35
+ }
36
+
37
+ // Trim off extra bytes after placeholder bytes are found
38
+ // See: https://github.com/beatgammit/base64-js/issues/42
39
+ var validLen = b64.indexOf('=');
40
+ if (validLen === -1) validLen = len;
41
+
42
+ var placeHoldersLen = validLen === len
43
+ ? 0
44
+ : 4 - (validLen % 4);
45
+
46
+ return [validLen, placeHoldersLen]
47
+ }
48
+
49
+ // base64 is 4/3 + up to two characters of the original data
50
+ function byteLength (b64) {
51
+ var lens = getLens(b64);
52
+ var validLen = lens[0];
53
+ var placeHoldersLen = lens[1];
54
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
55
+ }
56
+
57
+ function _byteLength (b64, validLen, placeHoldersLen) {
58
+ return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
59
+ }
60
+
61
+ function toByteArray (b64) {
62
+ var tmp;
63
+ var lens = getLens(b64);
64
+ var validLen = lens[0];
65
+ var placeHoldersLen = lens[1];
66
+
67
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
68
+
69
+ var curByte = 0;
70
+
71
+ // if there are placeholders, only get up to the last complete 4 chars
72
+ var len = placeHoldersLen > 0
73
+ ? validLen - 4
74
+ : validLen;
75
+
76
+ var i;
77
+ for (i = 0; i < len; i += 4) {
78
+ tmp =
79
+ (revLookup[b64.charCodeAt(i)] << 18) |
80
+ (revLookup[b64.charCodeAt(i + 1)] << 12) |
81
+ (revLookup[b64.charCodeAt(i + 2)] << 6) |
82
+ revLookup[b64.charCodeAt(i + 3)];
83
+ arr[curByte++] = (tmp >> 16) & 0xFF;
84
+ arr[curByte++] = (tmp >> 8) & 0xFF;
85
+ arr[curByte++] = tmp & 0xFF;
86
+ }
87
+
88
+ if (placeHoldersLen === 2) {
89
+ tmp =
90
+ (revLookup[b64.charCodeAt(i)] << 2) |
91
+ (revLookup[b64.charCodeAt(i + 1)] >> 4);
92
+ arr[curByte++] = tmp & 0xFF;
93
+ }
94
+
95
+ if (placeHoldersLen === 1) {
96
+ tmp =
97
+ (revLookup[b64.charCodeAt(i)] << 10) |
98
+ (revLookup[b64.charCodeAt(i + 1)] << 4) |
99
+ (revLookup[b64.charCodeAt(i + 2)] >> 2);
100
+ arr[curByte++] = (tmp >> 8) & 0xFF;
101
+ arr[curByte++] = tmp & 0xFF;
102
+ }
103
+
104
+ return arr
105
+ }
106
+
107
+ function tripletToBase64 (num) {
108
+ return lookup[num >> 18 & 0x3F] +
109
+ lookup[num >> 12 & 0x3F] +
110
+ lookup[num >> 6 & 0x3F] +
111
+ lookup[num & 0x3F]
112
+ }
113
+
114
+ function encodeChunk (uint8, start, end) {
115
+ var tmp;
116
+ var output = [];
117
+ for (var i = start; i < end; i += 3) {
118
+ tmp =
119
+ ((uint8[i] << 16) & 0xFF0000) +
120
+ ((uint8[i + 1] << 8) & 0xFF00) +
121
+ (uint8[i + 2] & 0xFF);
122
+ output.push(tripletToBase64(tmp));
123
+ }
124
+ return output.join('')
125
+ }
126
+
127
+ function fromByteArray (uint8) {
128
+ var tmp;
129
+ var len = uint8.length;
130
+ var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
131
+ var parts = [];
132
+ var maxChunkLength = 16383; // must be multiple of 3
133
+
134
+ // go through the array every three bytes, we'll deal with trailing stuff later
135
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
136
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
137
+ }
138
+
139
+ // pad the end with zeros, but make sure to not forget the extra bytes
140
+ if (extraBytes === 1) {
141
+ tmp = uint8[len - 1];
142
+ parts.push(
143
+ lookup[tmp >> 2] +
144
+ lookup[(tmp << 4) & 0x3F] +
145
+ '=='
146
+ );
147
+ } else if (extraBytes === 2) {
148
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
149
+ parts.push(
150
+ lookup[tmp >> 10] +
151
+ lookup[(tmp >> 4) & 0x3F] +
152
+ lookup[(tmp << 2) & 0x3F] +
153
+ '='
154
+ );
155
+ }
156
+
157
+ return parts.join('')
158
+ }
159
+
160
+ var ieee754 = {};
161
+
162
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
163
+
164
+ ieee754.read = function (buffer, offset, isLE, mLen, nBytes) {
165
+ var e, m;
166
+ var eLen = (nBytes * 8) - mLen - 1;
167
+ var eMax = (1 << eLen) - 1;
168
+ var eBias = eMax >> 1;
169
+ var nBits = -7;
170
+ var i = isLE ? (nBytes - 1) : 0;
171
+ var d = isLE ? -1 : 1;
172
+ var s = buffer[offset + i];
173
+
174
+ i += d;
175
+
176
+ e = s & ((1 << (-nBits)) - 1);
177
+ s >>= (-nBits);
178
+ nBits += eLen;
179
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
180
+
181
+ m = e & ((1 << (-nBits)) - 1);
182
+ e >>= (-nBits);
183
+ nBits += mLen;
184
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
185
+
186
+ if (e === 0) {
187
+ e = 1 - eBias;
188
+ } else if (e === eMax) {
189
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
190
+ } else {
191
+ m = m + Math.pow(2, mLen);
192
+ e = e - eBias;
193
+ }
194
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
195
+ };
196
+
197
+ ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) {
198
+ var e, m, c;
199
+ var eLen = (nBytes * 8) - mLen - 1;
200
+ var eMax = (1 << eLen) - 1;
201
+ var eBias = eMax >> 1;
202
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
203
+ var i = isLE ? 0 : (nBytes - 1);
204
+ var d = isLE ? 1 : -1;
205
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
206
+
207
+ value = Math.abs(value);
208
+
209
+ if (isNaN(value) || value === Infinity) {
210
+ m = isNaN(value) ? 1 : 0;
211
+ e = eMax;
212
+ } else {
213
+ e = Math.floor(Math.log(value) / Math.LN2);
214
+ if (value * (c = Math.pow(2, -e)) < 1) {
215
+ e--;
216
+ c *= 2;
217
+ }
218
+ if (e + eBias >= 1) {
219
+ value += rt / c;
220
+ } else {
221
+ value += rt * Math.pow(2, 1 - eBias);
222
+ }
223
+ if (value * c >= 2) {
224
+ e++;
225
+ c /= 2;
226
+ }
227
+
228
+ if (e + eBias >= eMax) {
229
+ m = 0;
230
+ e = eMax;
231
+ } else if (e + eBias >= 1) {
232
+ m = ((value * c) - 1) * Math.pow(2, mLen);
233
+ e = e + eBias;
234
+ } else {
235
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
236
+ e = 0;
237
+ }
238
+ }
239
+
240
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
241
+
242
+ e = (e << mLen) | m;
243
+ eLen += mLen;
244
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
245
+
246
+ buffer[offset + i - d] |= s * 128;
247
+ };
248
+
249
+ /*!
250
+ * The buffer module from node.js, for the browser.
251
+ *
252
+ * @author Feross Aboukhadijeh <https://feross.org>
253
+ * @license MIT
254
+ */
255
+
256
+ (function (exports) {
257
+
258
+ const base64 = base64Js;
259
+ const ieee754$1 = ieee754;
260
+ const customInspectSymbol =
261
+ (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
262
+ ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
263
+ : null;
264
+
265
+ exports.Buffer = Buffer;
266
+ exports.SlowBuffer = SlowBuffer;
267
+ exports.INSPECT_MAX_BYTES = 50;
268
+
269
+ const K_MAX_LENGTH = 0x7fffffff;
270
+ exports.kMaxLength = K_MAX_LENGTH;
271
+
272
+ /**
273
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
274
+ * === true Use Uint8Array implementation (fastest)
275
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
276
+ * implementation (most compatible, even IE6)
277
+ *
278
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
279
+ * Opera 11.6+, iOS 4.2+.
280
+ *
281
+ * We report that the browser does not support typed arrays if the are not subclassable
282
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
283
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
284
+ * for __proto__ and has a buggy typed array implementation.
285
+ */
286
+ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
287
+
288
+ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
289
+ typeof console.error === 'function') {
290
+ console.error(
291
+ 'This browser lacks typed array (Uint8Array) support which is required by ' +
292
+ '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
293
+ );
294
+ }
295
+
296
+ function typedArraySupport () {
297
+ // Can typed array instances can be augmented?
298
+ try {
299
+ const arr = new Uint8Array(1);
300
+ const proto = { foo: function () { return 42 } };
301
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
302
+ Object.setPrototypeOf(arr, proto);
303
+ return arr.foo() === 42
304
+ } catch (e) {
305
+ return false
306
+ }
307
+ }
308
+
309
+ Object.defineProperty(Buffer.prototype, 'parent', {
310
+ enumerable: true,
311
+ get: function () {
312
+ if (!Buffer.isBuffer(this)) return undefined
313
+ return this.buffer
314
+ }
315
+ });
316
+
317
+ Object.defineProperty(Buffer.prototype, 'offset', {
318
+ enumerable: true,
319
+ get: function () {
320
+ if (!Buffer.isBuffer(this)) return undefined
321
+ return this.byteOffset
322
+ }
323
+ });
324
+
325
+ function createBuffer (length) {
326
+ if (length > K_MAX_LENGTH) {
327
+ throw new RangeError('The value "' + length + '" is invalid for option "size"')
328
+ }
329
+ // Return an augmented `Uint8Array` instance
330
+ const buf = new Uint8Array(length);
331
+ Object.setPrototypeOf(buf, Buffer.prototype);
332
+ return buf
333
+ }
334
+
335
+ /**
336
+ * The Buffer constructor returns instances of `Uint8Array` that have their
337
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
338
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
339
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
340
+ * returns a single octet.
341
+ *
342
+ * The `Uint8Array` prototype remains unmodified.
343
+ */
344
+
345
+ function Buffer (arg, encodingOrOffset, length) {
346
+ // Common case.
347
+ if (typeof arg === 'number') {
348
+ if (typeof encodingOrOffset === 'string') {
349
+ throw new TypeError(
350
+ 'The "string" argument must be of type string. Received type number'
351
+ )
352
+ }
353
+ return allocUnsafe(arg)
354
+ }
355
+ return from(arg, encodingOrOffset, length)
356
+ }
357
+
358
+ Buffer.poolSize = 8192; // not used by this implementation
359
+
360
+ function from (value, encodingOrOffset, length) {
361
+ if (typeof value === 'string') {
362
+ return fromString(value, encodingOrOffset)
363
+ }
364
+
365
+ if (ArrayBuffer.isView(value)) {
366
+ return fromArrayView(value)
367
+ }
368
+
369
+ if (value == null) {
370
+ throw new TypeError(
371
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
372
+ 'or Array-like Object. Received type ' + (typeof value)
373
+ )
374
+ }
375
+
376
+ if (isInstance(value, ArrayBuffer) ||
377
+ (value && isInstance(value.buffer, ArrayBuffer))) {
378
+ return fromArrayBuffer(value, encodingOrOffset, length)
379
+ }
380
+
381
+ if (typeof SharedArrayBuffer !== 'undefined' &&
382
+ (isInstance(value, SharedArrayBuffer) ||
383
+ (value && isInstance(value.buffer, SharedArrayBuffer)))) {
384
+ return fromArrayBuffer(value, encodingOrOffset, length)
385
+ }
386
+
387
+ if (typeof value === 'number') {
388
+ throw new TypeError(
389
+ 'The "value" argument must not be of type number. Received type number'
390
+ )
391
+ }
392
+
393
+ const valueOf = value.valueOf && value.valueOf();
394
+ if (valueOf != null && valueOf !== value) {
395
+ return Buffer.from(valueOf, encodingOrOffset, length)
396
+ }
397
+
398
+ const b = fromObject(value);
399
+ if (b) return b
400
+
401
+ if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
402
+ typeof value[Symbol.toPrimitive] === 'function') {
403
+ return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
404
+ }
405
+
406
+ throw new TypeError(
407
+ 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
408
+ 'or Array-like Object. Received type ' + (typeof value)
409
+ )
410
+ }
411
+
412
+ /**
413
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
414
+ * if value is a number.
415
+ * Buffer.from(str[, encoding])
416
+ * Buffer.from(array)
417
+ * Buffer.from(buffer)
418
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
419
+ **/
420
+ Buffer.from = function (value, encodingOrOffset, length) {
421
+ return from(value, encodingOrOffset, length)
422
+ };
423
+
424
+ // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
425
+ // https://github.com/feross/buffer/pull/148
426
+ Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
427
+ Object.setPrototypeOf(Buffer, Uint8Array);
428
+
429
+ function assertSize (size) {
430
+ if (typeof size !== 'number') {
431
+ throw new TypeError('"size" argument must be of type number')
432
+ } else if (size < 0) {
433
+ throw new RangeError('The value "' + size + '" is invalid for option "size"')
434
+ }
435
+ }
436
+
437
+ function alloc (size, fill, encoding) {
438
+ assertSize(size);
439
+ if (size <= 0) {
440
+ return createBuffer(size)
441
+ }
442
+ if (fill !== undefined) {
443
+ // Only pay attention to encoding if it's a string. This
444
+ // prevents accidentally sending in a number that would
445
+ // be interpreted as a start offset.
446
+ return typeof encoding === 'string'
447
+ ? createBuffer(size).fill(fill, encoding)
448
+ : createBuffer(size).fill(fill)
449
+ }
450
+ return createBuffer(size)
451
+ }
452
+
453
+ /**
454
+ * Creates a new filled Buffer instance.
455
+ * alloc(size[, fill[, encoding]])
456
+ **/
457
+ Buffer.alloc = function (size, fill, encoding) {
458
+ return alloc(size, fill, encoding)
459
+ };
460
+
461
+ function allocUnsafe (size) {
462
+ assertSize(size);
463
+ return createBuffer(size < 0 ? 0 : checked(size) | 0)
464
+ }
465
+
466
+ /**
467
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
468
+ * */
469
+ Buffer.allocUnsafe = function (size) {
470
+ return allocUnsafe(size)
471
+ };
472
+ /**
473
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
474
+ */
475
+ Buffer.allocUnsafeSlow = function (size) {
476
+ return allocUnsafe(size)
477
+ };
478
+
479
+ function fromString (string, encoding) {
480
+ if (typeof encoding !== 'string' || encoding === '') {
481
+ encoding = 'utf8';
482
+ }
483
+
484
+ if (!Buffer.isEncoding(encoding)) {
485
+ throw new TypeError('Unknown encoding: ' + encoding)
486
+ }
487
+
488
+ const length = byteLength(string, encoding) | 0;
489
+ let buf = createBuffer(length);
490
+
491
+ const actual = buf.write(string, encoding);
492
+
493
+ if (actual !== length) {
494
+ // Writing a hex string, for example, that contains invalid characters will
495
+ // cause everything after the first invalid character to be ignored. (e.g.
496
+ // 'abxxcd' will be treated as 'ab')
497
+ buf = buf.slice(0, actual);
498
+ }
499
+
500
+ return buf
501
+ }
502
+
503
+ function fromArrayLike (array) {
504
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
505
+ const buf = createBuffer(length);
506
+ for (let i = 0; i < length; i += 1) {
507
+ buf[i] = array[i] & 255;
508
+ }
509
+ return buf
510
+ }
511
+
512
+ function fromArrayView (arrayView) {
513
+ if (isInstance(arrayView, Uint8Array)) {
514
+ const copy = new Uint8Array(arrayView);
515
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
516
+ }
517
+ return fromArrayLike(arrayView)
518
+ }
519
+
520
+ function fromArrayBuffer (array, byteOffset, length) {
521
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
522
+ throw new RangeError('"offset" is outside of buffer bounds')
523
+ }
524
+
525
+ if (array.byteLength < byteOffset + (length || 0)) {
526
+ throw new RangeError('"length" is outside of buffer bounds')
527
+ }
528
+
529
+ let buf;
530
+ if (byteOffset === undefined && length === undefined) {
531
+ buf = new Uint8Array(array);
532
+ } else if (length === undefined) {
533
+ buf = new Uint8Array(array, byteOffset);
534
+ } else {
535
+ buf = new Uint8Array(array, byteOffset, length);
536
+ }
537
+
538
+ // Return an augmented `Uint8Array` instance
539
+ Object.setPrototypeOf(buf, Buffer.prototype);
540
+
541
+ return buf
542
+ }
543
+
544
+ function fromObject (obj) {
545
+ if (Buffer.isBuffer(obj)) {
546
+ const len = checked(obj.length) | 0;
547
+ const buf = createBuffer(len);
548
+
549
+ if (buf.length === 0) {
550
+ return buf
551
+ }
552
+
553
+ obj.copy(buf, 0, 0, len);
554
+ return buf
555
+ }
556
+
557
+ if (obj.length !== undefined) {
558
+ if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
559
+ return createBuffer(0)
560
+ }
561
+ return fromArrayLike(obj)
562
+ }
563
+
564
+ if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
565
+ return fromArrayLike(obj.data)
566
+ }
567
+ }
568
+
569
+ function checked (length) {
570
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
571
+ // length is NaN (which is otherwise coerced to zero.)
572
+ if (length >= K_MAX_LENGTH) {
573
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
574
+ 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
575
+ }
576
+ return length | 0
577
+ }
578
+
579
+ function SlowBuffer (length) {
580
+ if (+length != length) { // eslint-disable-line eqeqeq
581
+ length = 0;
582
+ }
583
+ return Buffer.alloc(+length)
584
+ }
585
+
586
+ Buffer.isBuffer = function isBuffer (b) {
587
+ return b != null && b._isBuffer === true &&
588
+ b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
589
+ };
590
+
591
+ Buffer.compare = function compare (a, b) {
592
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
593
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
594
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
595
+ throw new TypeError(
596
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
597
+ )
598
+ }
599
+
600
+ if (a === b) return 0
601
+
602
+ let x = a.length;
603
+ let y = b.length;
604
+
605
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
606
+ if (a[i] !== b[i]) {
607
+ x = a[i];
608
+ y = b[i];
609
+ break
610
+ }
611
+ }
612
+
613
+ if (x < y) return -1
614
+ if (y < x) return 1
615
+ return 0
616
+ };
617
+
618
+ Buffer.isEncoding = function isEncoding (encoding) {
619
+ switch (String(encoding).toLowerCase()) {
620
+ case 'hex':
621
+ case 'utf8':
622
+ case 'utf-8':
623
+ case 'ascii':
624
+ case 'latin1':
625
+ case 'binary':
626
+ case 'base64':
627
+ case 'ucs2':
628
+ case 'ucs-2':
629
+ case 'utf16le':
630
+ case 'utf-16le':
631
+ return true
632
+ default:
633
+ return false
634
+ }
635
+ };
636
+
637
+ Buffer.concat = function concat (list, length) {
638
+ if (!Array.isArray(list)) {
639
+ throw new TypeError('"list" argument must be an Array of Buffers')
640
+ }
641
+
642
+ if (list.length === 0) {
643
+ return Buffer.alloc(0)
644
+ }
645
+
646
+ let i;
647
+ if (length === undefined) {
648
+ length = 0;
649
+ for (i = 0; i < list.length; ++i) {
650
+ length += list[i].length;
651
+ }
652
+ }
653
+
654
+ const buffer = Buffer.allocUnsafe(length);
655
+ let pos = 0;
656
+ for (i = 0; i < list.length; ++i) {
657
+ let buf = list[i];
658
+ if (isInstance(buf, Uint8Array)) {
659
+ if (pos + buf.length > buffer.length) {
660
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
661
+ buf.copy(buffer, pos);
662
+ } else {
663
+ Uint8Array.prototype.set.call(
664
+ buffer,
665
+ buf,
666
+ pos
667
+ );
668
+ }
669
+ } else if (!Buffer.isBuffer(buf)) {
670
+ throw new TypeError('"list" argument must be an Array of Buffers')
671
+ } else {
672
+ buf.copy(buffer, pos);
673
+ }
674
+ pos += buf.length;
675
+ }
676
+ return buffer
677
+ };
678
+
679
+ function byteLength (string, encoding) {
680
+ if (Buffer.isBuffer(string)) {
681
+ return string.length
682
+ }
683
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
684
+ return string.byteLength
685
+ }
686
+ if (typeof string !== 'string') {
687
+ throw new TypeError(
688
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
689
+ 'Received type ' + typeof string
690
+ )
691
+ }
692
+
693
+ const len = string.length;
694
+ const mustMatch = (arguments.length > 2 && arguments[2] === true);
695
+ if (!mustMatch && len === 0) return 0
696
+
697
+ // Use a for loop to avoid recursion
698
+ let loweredCase = false;
699
+ for (;;) {
700
+ switch (encoding) {
701
+ case 'ascii':
702
+ case 'latin1':
703
+ case 'binary':
704
+ return len
705
+ case 'utf8':
706
+ case 'utf-8':
707
+ return utf8ToBytes(string).length
708
+ case 'ucs2':
709
+ case 'ucs-2':
710
+ case 'utf16le':
711
+ case 'utf-16le':
712
+ return len * 2
713
+ case 'hex':
714
+ return len >>> 1
715
+ case 'base64':
716
+ return base64ToBytes(string).length
717
+ default:
718
+ if (loweredCase) {
719
+ return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
720
+ }
721
+ encoding = ('' + encoding).toLowerCase();
722
+ loweredCase = true;
723
+ }
724
+ }
725
+ }
726
+ Buffer.byteLength = byteLength;
727
+
728
+ function slowToString (encoding, start, end) {
729
+ let loweredCase = false;
730
+
731
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
732
+ // property of a typed array.
733
+
734
+ // This behaves neither like String nor Uint8Array in that we set start/end
735
+ // to their upper/lower bounds if the value passed is out of range.
736
+ // undefined is handled specially as per ECMA-262 6th Edition,
737
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
738
+ if (start === undefined || start < 0) {
739
+ start = 0;
740
+ }
741
+ // Return early if start > this.length. Done here to prevent potential uint32
742
+ // coercion fail below.
743
+ if (start > this.length) {
744
+ return ''
745
+ }
746
+
747
+ if (end === undefined || end > this.length) {
748
+ end = this.length;
749
+ }
750
+
751
+ if (end <= 0) {
752
+ return ''
753
+ }
754
+
755
+ // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
756
+ end >>>= 0;
757
+ start >>>= 0;
758
+
759
+ if (end <= start) {
760
+ return ''
761
+ }
762
+
763
+ if (!encoding) encoding = 'utf8';
764
+
765
+ while (true) {
766
+ switch (encoding) {
767
+ case 'hex':
768
+ return hexSlice(this, start, end)
769
+
770
+ case 'utf8':
771
+ case 'utf-8':
772
+ return utf8Slice(this, start, end)
773
+
774
+ case 'ascii':
775
+ return asciiSlice(this, start, end)
776
+
777
+ case 'latin1':
778
+ case 'binary':
779
+ return latin1Slice(this, start, end)
780
+
781
+ case 'base64':
782
+ return base64Slice(this, start, end)
783
+
784
+ case 'ucs2':
785
+ case 'ucs-2':
786
+ case 'utf16le':
787
+ case 'utf-16le':
788
+ return utf16leSlice(this, start, end)
789
+
790
+ default:
791
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
792
+ encoding = (encoding + '').toLowerCase();
793
+ loweredCase = true;
794
+ }
795
+ }
796
+ }
797
+
798
+ // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
799
+ // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
800
+ // reliably in a browserify context because there could be multiple different
801
+ // copies of the 'buffer' package in use. This method works even for Buffer
802
+ // instances that were created from another copy of the `buffer` package.
803
+ // See: https://github.com/feross/buffer/issues/154
804
+ Buffer.prototype._isBuffer = true;
805
+
806
+ function swap (b, n, m) {
807
+ const i = b[n];
808
+ b[n] = b[m];
809
+ b[m] = i;
810
+ }
811
+
812
+ Buffer.prototype.swap16 = function swap16 () {
813
+ const len = this.length;
814
+ if (len % 2 !== 0) {
815
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
816
+ }
817
+ for (let i = 0; i < len; i += 2) {
818
+ swap(this, i, i + 1);
819
+ }
820
+ return this
821
+ };
822
+
823
+ Buffer.prototype.swap32 = function swap32 () {
824
+ const len = this.length;
825
+ if (len % 4 !== 0) {
826
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
827
+ }
828
+ for (let i = 0; i < len; i += 4) {
829
+ swap(this, i, i + 3);
830
+ swap(this, i + 1, i + 2);
831
+ }
832
+ return this
833
+ };
834
+
835
+ Buffer.prototype.swap64 = function swap64 () {
836
+ const len = this.length;
837
+ if (len % 8 !== 0) {
838
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
839
+ }
840
+ for (let i = 0; i < len; i += 8) {
841
+ swap(this, i, i + 7);
842
+ swap(this, i + 1, i + 6);
843
+ swap(this, i + 2, i + 5);
844
+ swap(this, i + 3, i + 4);
845
+ }
846
+ return this
847
+ };
848
+
849
+ Buffer.prototype.toString = function toString () {
850
+ const length = this.length;
851
+ if (length === 0) return ''
852
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
853
+ return slowToString.apply(this, arguments)
854
+ };
855
+
856
+ Buffer.prototype.toLocaleString = Buffer.prototype.toString;
857
+
858
+ Buffer.prototype.equals = function equals (b) {
859
+ if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
860
+ if (this === b) return true
861
+ return Buffer.compare(this, b) === 0
862
+ };
863
+
864
+ Buffer.prototype.inspect = function inspect () {
865
+ let str = '';
866
+ const max = exports.INSPECT_MAX_BYTES;
867
+ str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
868
+ if (this.length > max) str += ' ... ';
869
+ return '<Buffer ' + str + '>'
870
+ };
871
+ if (customInspectSymbol) {
872
+ Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
873
+ }
874
+
875
+ Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
876
+ if (isInstance(target, Uint8Array)) {
877
+ target = Buffer.from(target, target.offset, target.byteLength);
878
+ }
879
+ if (!Buffer.isBuffer(target)) {
880
+ throw new TypeError(
881
+ 'The "target" argument must be one of type Buffer or Uint8Array. ' +
882
+ 'Received type ' + (typeof target)
883
+ )
884
+ }
885
+
886
+ if (start === undefined) {
887
+ start = 0;
888
+ }
889
+ if (end === undefined) {
890
+ end = target ? target.length : 0;
891
+ }
892
+ if (thisStart === undefined) {
893
+ thisStart = 0;
894
+ }
895
+ if (thisEnd === undefined) {
896
+ thisEnd = this.length;
897
+ }
898
+
899
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
900
+ throw new RangeError('out of range index')
901
+ }
902
+
903
+ if (thisStart >= thisEnd && start >= end) {
904
+ return 0
905
+ }
906
+ if (thisStart >= thisEnd) {
907
+ return -1
908
+ }
909
+ if (start >= end) {
910
+ return 1
911
+ }
912
+
913
+ start >>>= 0;
914
+ end >>>= 0;
915
+ thisStart >>>= 0;
916
+ thisEnd >>>= 0;
917
+
918
+ if (this === target) return 0
919
+
920
+ let x = thisEnd - thisStart;
921
+ let y = end - start;
922
+ const len = Math.min(x, y);
923
+
924
+ const thisCopy = this.slice(thisStart, thisEnd);
925
+ const targetCopy = target.slice(start, end);
926
+
927
+ for (let i = 0; i < len; ++i) {
928
+ if (thisCopy[i] !== targetCopy[i]) {
929
+ x = thisCopy[i];
930
+ y = targetCopy[i];
931
+ break
932
+ }
933
+ }
934
+
935
+ if (x < y) return -1
936
+ if (y < x) return 1
937
+ return 0
938
+ };
939
+
940
+ // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
941
+ // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
942
+ //
943
+ // Arguments:
944
+ // - buffer - a Buffer to search
945
+ // - val - a string, Buffer, or number
946
+ // - byteOffset - an index into `buffer`; will be clamped to an int32
947
+ // - encoding - an optional encoding, relevant is val is a string
948
+ // - dir - true for indexOf, false for lastIndexOf
949
+ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
950
+ // Empty buffer means no match
951
+ if (buffer.length === 0) return -1
952
+
953
+ // Normalize byteOffset
954
+ if (typeof byteOffset === 'string') {
955
+ encoding = byteOffset;
956
+ byteOffset = 0;
957
+ } else if (byteOffset > 0x7fffffff) {
958
+ byteOffset = 0x7fffffff;
959
+ } else if (byteOffset < -0x80000000) {
960
+ byteOffset = -0x80000000;
961
+ }
962
+ byteOffset = +byteOffset; // Coerce to Number.
963
+ if (numberIsNaN(byteOffset)) {
964
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
965
+ byteOffset = dir ? 0 : (buffer.length - 1);
966
+ }
967
+
968
+ // Normalize byteOffset: negative offsets start from the end of the buffer
969
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
970
+ if (byteOffset >= buffer.length) {
971
+ if (dir) return -1
972
+ else byteOffset = buffer.length - 1;
973
+ } else if (byteOffset < 0) {
974
+ if (dir) byteOffset = 0;
975
+ else return -1
976
+ }
977
+
978
+ // Normalize val
979
+ if (typeof val === 'string') {
980
+ val = Buffer.from(val, encoding);
981
+ }
982
+
983
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
984
+ if (Buffer.isBuffer(val)) {
985
+ // Special case: looking for empty string/buffer always fails
986
+ if (val.length === 0) {
987
+ return -1
988
+ }
989
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
990
+ } else if (typeof val === 'number') {
991
+ val = val & 0xFF; // Search for a byte value [0-255]
992
+ if (typeof Uint8Array.prototype.indexOf === 'function') {
993
+ if (dir) {
994
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
995
+ } else {
996
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
997
+ }
998
+ }
999
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
1000
+ }
1001
+
1002
+ throw new TypeError('val must be string, number or Buffer')
1003
+ }
1004
+
1005
+ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
1006
+ let indexSize = 1;
1007
+ let arrLength = arr.length;
1008
+ let valLength = val.length;
1009
+
1010
+ if (encoding !== undefined) {
1011
+ encoding = String(encoding).toLowerCase();
1012
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
1013
+ encoding === 'utf16le' || encoding === 'utf-16le') {
1014
+ if (arr.length < 2 || val.length < 2) {
1015
+ return -1
1016
+ }
1017
+ indexSize = 2;
1018
+ arrLength /= 2;
1019
+ valLength /= 2;
1020
+ byteOffset /= 2;
1021
+ }
1022
+ }
1023
+
1024
+ function read (buf, i) {
1025
+ if (indexSize === 1) {
1026
+ return buf[i]
1027
+ } else {
1028
+ return buf.readUInt16BE(i * indexSize)
1029
+ }
1030
+ }
1031
+
1032
+ let i;
1033
+ if (dir) {
1034
+ let foundIndex = -1;
1035
+ for (i = byteOffset; i < arrLength; i++) {
1036
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1037
+ if (foundIndex === -1) foundIndex = i;
1038
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
1039
+ } else {
1040
+ if (foundIndex !== -1) i -= i - foundIndex;
1041
+ foundIndex = -1;
1042
+ }
1043
+ }
1044
+ } else {
1045
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
1046
+ for (i = byteOffset; i >= 0; i--) {
1047
+ let found = true;
1048
+ for (let j = 0; j < valLength; j++) {
1049
+ if (read(arr, i + j) !== read(val, j)) {
1050
+ found = false;
1051
+ break
1052
+ }
1053
+ }
1054
+ if (found) return i
1055
+ }
1056
+ }
1057
+
1058
+ return -1
1059
+ }
1060
+
1061
+ Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
1062
+ return this.indexOf(val, byteOffset, encoding) !== -1
1063
+ };
1064
+
1065
+ Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
1066
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
1067
+ };
1068
+
1069
+ Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
1070
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
1071
+ };
1072
+
1073
+ function hexWrite (buf, string, offset, length) {
1074
+ offset = Number(offset) || 0;
1075
+ const remaining = buf.length - offset;
1076
+ if (!length) {
1077
+ length = remaining;
1078
+ } else {
1079
+ length = Number(length);
1080
+ if (length > remaining) {
1081
+ length = remaining;
1082
+ }
1083
+ }
1084
+
1085
+ const strLen = string.length;
1086
+
1087
+ if (length > strLen / 2) {
1088
+ length = strLen / 2;
1089
+ }
1090
+ let i;
1091
+ for (i = 0; i < length; ++i) {
1092
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
1093
+ if (numberIsNaN(parsed)) return i
1094
+ buf[offset + i] = parsed;
1095
+ }
1096
+ return i
1097
+ }
1098
+
1099
+ function utf8Write (buf, string, offset, length) {
1100
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1101
+ }
1102
+
1103
+ function asciiWrite (buf, string, offset, length) {
1104
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
1105
+ }
1106
+
1107
+ function base64Write (buf, string, offset, length) {
1108
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
1109
+ }
1110
+
1111
+ function ucs2Write (buf, string, offset, length) {
1112
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1113
+ }
1114
+
1115
+ Buffer.prototype.write = function write (string, offset, length, encoding) {
1116
+ // Buffer#write(string)
1117
+ if (offset === undefined) {
1118
+ encoding = 'utf8';
1119
+ length = this.length;
1120
+ offset = 0;
1121
+ // Buffer#write(string, encoding)
1122
+ } else if (length === undefined && typeof offset === 'string') {
1123
+ encoding = offset;
1124
+ length = this.length;
1125
+ offset = 0;
1126
+ // Buffer#write(string, offset[, length][, encoding])
1127
+ } else if (isFinite(offset)) {
1128
+ offset = offset >>> 0;
1129
+ if (isFinite(length)) {
1130
+ length = length >>> 0;
1131
+ if (encoding === undefined) encoding = 'utf8';
1132
+ } else {
1133
+ encoding = length;
1134
+ length = undefined;
1135
+ }
1136
+ } else {
1137
+ throw new Error(
1138
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1139
+ )
1140
+ }
1141
+
1142
+ const remaining = this.length - offset;
1143
+ if (length === undefined || length > remaining) length = remaining;
1144
+
1145
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1146
+ throw new RangeError('Attempt to write outside buffer bounds')
1147
+ }
1148
+
1149
+ if (!encoding) encoding = 'utf8';
1150
+
1151
+ let loweredCase = false;
1152
+ for (;;) {
1153
+ switch (encoding) {
1154
+ case 'hex':
1155
+ return hexWrite(this, string, offset, length)
1156
+
1157
+ case 'utf8':
1158
+ case 'utf-8':
1159
+ return utf8Write(this, string, offset, length)
1160
+
1161
+ case 'ascii':
1162
+ case 'latin1':
1163
+ case 'binary':
1164
+ return asciiWrite(this, string, offset, length)
1165
+
1166
+ case 'base64':
1167
+ // Warning: maxLength not taken into account in base64Write
1168
+ return base64Write(this, string, offset, length)
1169
+
1170
+ case 'ucs2':
1171
+ case 'ucs-2':
1172
+ case 'utf16le':
1173
+ case 'utf-16le':
1174
+ return ucs2Write(this, string, offset, length)
1175
+
1176
+ default:
1177
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1178
+ encoding = ('' + encoding).toLowerCase();
1179
+ loweredCase = true;
1180
+ }
1181
+ }
1182
+ };
1183
+
1184
+ Buffer.prototype.toJSON = function toJSON () {
1185
+ return {
1186
+ type: 'Buffer',
1187
+ data: Array.prototype.slice.call(this._arr || this, 0)
1188
+ }
1189
+ };
1190
+
1191
+ function base64Slice (buf, start, end) {
1192
+ if (start === 0 && end === buf.length) {
1193
+ return base64.fromByteArray(buf)
1194
+ } else {
1195
+ return base64.fromByteArray(buf.slice(start, end))
1196
+ }
1197
+ }
1198
+
1199
+ function utf8Slice (buf, start, end) {
1200
+ end = Math.min(buf.length, end);
1201
+ const res = [];
1202
+
1203
+ let i = start;
1204
+ while (i < end) {
1205
+ const firstByte = buf[i];
1206
+ let codePoint = null;
1207
+ let bytesPerSequence = (firstByte > 0xEF)
1208
+ ? 4
1209
+ : (firstByte > 0xDF)
1210
+ ? 3
1211
+ : (firstByte > 0xBF)
1212
+ ? 2
1213
+ : 1;
1214
+
1215
+ if (i + bytesPerSequence <= end) {
1216
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1217
+
1218
+ switch (bytesPerSequence) {
1219
+ case 1:
1220
+ if (firstByte < 0x80) {
1221
+ codePoint = firstByte;
1222
+ }
1223
+ break
1224
+ case 2:
1225
+ secondByte = buf[i + 1];
1226
+ if ((secondByte & 0xC0) === 0x80) {
1227
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
1228
+ if (tempCodePoint > 0x7F) {
1229
+ codePoint = tempCodePoint;
1230
+ }
1231
+ }
1232
+ break
1233
+ case 3:
1234
+ secondByte = buf[i + 1];
1235
+ thirdByte = buf[i + 2];
1236
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1237
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
1238
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1239
+ codePoint = tempCodePoint;
1240
+ }
1241
+ }
1242
+ break
1243
+ case 4:
1244
+ secondByte = buf[i + 1];
1245
+ thirdByte = buf[i + 2];
1246
+ fourthByte = buf[i + 3];
1247
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1248
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1249
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1250
+ codePoint = tempCodePoint;
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+
1256
+ if (codePoint === null) {
1257
+ // we did not generate a valid codePoint so insert a
1258
+ // replacement char (U+FFFD) and advance only 1 byte
1259
+ codePoint = 0xFFFD;
1260
+ bytesPerSequence = 1;
1261
+ } else if (codePoint > 0xFFFF) {
1262
+ // encode to utf16 (surrogate pair dance)
1263
+ codePoint -= 0x10000;
1264
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1265
+ codePoint = 0xDC00 | codePoint & 0x3FF;
1266
+ }
1267
+
1268
+ res.push(codePoint);
1269
+ i += bytesPerSequence;
1270
+ }
1271
+
1272
+ return decodeCodePointsArray(res)
1273
+ }
1274
+
1275
+ // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1276
+ // the lowest limit is Chrome, with 0x10000 args.
1277
+ // We go 1 magnitude less, for safety
1278
+ const MAX_ARGUMENTS_LENGTH = 0x1000;
1279
+
1280
+ function decodeCodePointsArray (codePoints) {
1281
+ const len = codePoints.length;
1282
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1283
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1284
+ }
1285
+
1286
+ // Decode in chunks to avoid "call stack size exceeded".
1287
+ let res = '';
1288
+ let i = 0;
1289
+ while (i < len) {
1290
+ res += String.fromCharCode.apply(
1291
+ String,
1292
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1293
+ );
1294
+ }
1295
+ return res
1296
+ }
1297
+
1298
+ function asciiSlice (buf, start, end) {
1299
+ let ret = '';
1300
+ end = Math.min(buf.length, end);
1301
+
1302
+ for (let i = start; i < end; ++i) {
1303
+ ret += String.fromCharCode(buf[i] & 0x7F);
1304
+ }
1305
+ return ret
1306
+ }
1307
+
1308
+ function latin1Slice (buf, start, end) {
1309
+ let ret = '';
1310
+ end = Math.min(buf.length, end);
1311
+
1312
+ for (let i = start; i < end; ++i) {
1313
+ ret += String.fromCharCode(buf[i]);
1314
+ }
1315
+ return ret
1316
+ }
1317
+
1318
+ function hexSlice (buf, start, end) {
1319
+ const len = buf.length;
1320
+
1321
+ if (!start || start < 0) start = 0;
1322
+ if (!end || end < 0 || end > len) end = len;
1323
+
1324
+ let out = '';
1325
+ for (let i = start; i < end; ++i) {
1326
+ out += hexSliceLookupTable[buf[i]];
1327
+ }
1328
+ return out
1329
+ }
1330
+
1331
+ function utf16leSlice (buf, start, end) {
1332
+ const bytes = buf.slice(start, end);
1333
+ let res = '';
1334
+ // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1335
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1336
+ res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));
1337
+ }
1338
+ return res
1339
+ }
1340
+
1341
+ Buffer.prototype.slice = function slice (start, end) {
1342
+ const len = this.length;
1343
+ start = ~~start;
1344
+ end = end === undefined ? len : ~~end;
1345
+
1346
+ if (start < 0) {
1347
+ start += len;
1348
+ if (start < 0) start = 0;
1349
+ } else if (start > len) {
1350
+ start = len;
1351
+ }
1352
+
1353
+ if (end < 0) {
1354
+ end += len;
1355
+ if (end < 0) end = 0;
1356
+ } else if (end > len) {
1357
+ end = len;
1358
+ }
1359
+
1360
+ if (end < start) end = start;
1361
+
1362
+ const newBuf = this.subarray(start, end);
1363
+ // Return an augmented `Uint8Array` instance
1364
+ Object.setPrototypeOf(newBuf, Buffer.prototype);
1365
+
1366
+ return newBuf
1367
+ };
1368
+
1369
+ /*
1370
+ * Need to make sure that buffer isn't trying to write out of bounds.
1371
+ */
1372
+ function checkOffset (offset, ext, length) {
1373
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1374
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1375
+ }
1376
+
1377
+ Buffer.prototype.readUintLE =
1378
+ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1379
+ offset = offset >>> 0;
1380
+ byteLength = byteLength >>> 0;
1381
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1382
+
1383
+ let val = this[offset];
1384
+ let mul = 1;
1385
+ let i = 0;
1386
+ while (++i < byteLength && (mul *= 0x100)) {
1387
+ val += this[offset + i] * mul;
1388
+ }
1389
+
1390
+ return val
1391
+ };
1392
+
1393
+ Buffer.prototype.readUintBE =
1394
+ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1395
+ offset = offset >>> 0;
1396
+ byteLength = byteLength >>> 0;
1397
+ if (!noAssert) {
1398
+ checkOffset(offset, byteLength, this.length);
1399
+ }
1400
+
1401
+ let val = this[offset + --byteLength];
1402
+ let mul = 1;
1403
+ while (byteLength > 0 && (mul *= 0x100)) {
1404
+ val += this[offset + --byteLength] * mul;
1405
+ }
1406
+
1407
+ return val
1408
+ };
1409
+
1410
+ Buffer.prototype.readUint8 =
1411
+ Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1412
+ offset = offset >>> 0;
1413
+ if (!noAssert) checkOffset(offset, 1, this.length);
1414
+ return this[offset]
1415
+ };
1416
+
1417
+ Buffer.prototype.readUint16LE =
1418
+ Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1419
+ offset = offset >>> 0;
1420
+ if (!noAssert) checkOffset(offset, 2, this.length);
1421
+ return this[offset] | (this[offset + 1] << 8)
1422
+ };
1423
+
1424
+ Buffer.prototype.readUint16BE =
1425
+ Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1426
+ offset = offset >>> 0;
1427
+ if (!noAssert) checkOffset(offset, 2, this.length);
1428
+ return (this[offset] << 8) | this[offset + 1]
1429
+ };
1430
+
1431
+ Buffer.prototype.readUint32LE =
1432
+ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1433
+ offset = offset >>> 0;
1434
+ if (!noAssert) checkOffset(offset, 4, this.length);
1435
+
1436
+ return ((this[offset]) |
1437
+ (this[offset + 1] << 8) |
1438
+ (this[offset + 2] << 16)) +
1439
+ (this[offset + 3] * 0x1000000)
1440
+ };
1441
+
1442
+ Buffer.prototype.readUint32BE =
1443
+ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1444
+ offset = offset >>> 0;
1445
+ if (!noAssert) checkOffset(offset, 4, this.length);
1446
+
1447
+ return (this[offset] * 0x1000000) +
1448
+ ((this[offset + 1] << 16) |
1449
+ (this[offset + 2] << 8) |
1450
+ this[offset + 3])
1451
+ };
1452
+
1453
+ Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
1454
+ offset = offset >>> 0;
1455
+ validateNumber(offset, 'offset');
1456
+ const first = this[offset];
1457
+ const last = this[offset + 7];
1458
+ if (first === undefined || last === undefined) {
1459
+ boundsError(offset, this.length - 8);
1460
+ }
1461
+
1462
+ const lo = first +
1463
+ this[++offset] * 2 ** 8 +
1464
+ this[++offset] * 2 ** 16 +
1465
+ this[++offset] * 2 ** 24;
1466
+
1467
+ const hi = this[++offset] +
1468
+ this[++offset] * 2 ** 8 +
1469
+ this[++offset] * 2 ** 16 +
1470
+ last * 2 ** 24;
1471
+
1472
+ return BigInt(lo) + (BigInt(hi) << BigInt(32))
1473
+ });
1474
+
1475
+ Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
1476
+ offset = offset >>> 0;
1477
+ validateNumber(offset, 'offset');
1478
+ const first = this[offset];
1479
+ const last = this[offset + 7];
1480
+ if (first === undefined || last === undefined) {
1481
+ boundsError(offset, this.length - 8);
1482
+ }
1483
+
1484
+ const hi = first * 2 ** 24 +
1485
+ this[++offset] * 2 ** 16 +
1486
+ this[++offset] * 2 ** 8 +
1487
+ this[++offset];
1488
+
1489
+ const lo = this[++offset] * 2 ** 24 +
1490
+ this[++offset] * 2 ** 16 +
1491
+ this[++offset] * 2 ** 8 +
1492
+ last;
1493
+
1494
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo)
1495
+ });
1496
+
1497
+ Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1498
+ offset = offset >>> 0;
1499
+ byteLength = byteLength >>> 0;
1500
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1501
+
1502
+ let val = this[offset];
1503
+ let mul = 1;
1504
+ let i = 0;
1505
+ while (++i < byteLength && (mul *= 0x100)) {
1506
+ val += this[offset + i] * mul;
1507
+ }
1508
+ mul *= 0x80;
1509
+
1510
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1511
+
1512
+ return val
1513
+ };
1514
+
1515
+ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1516
+ offset = offset >>> 0;
1517
+ byteLength = byteLength >>> 0;
1518
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1519
+
1520
+ let i = byteLength;
1521
+ let mul = 1;
1522
+ let val = this[offset + --i];
1523
+ while (i > 0 && (mul *= 0x100)) {
1524
+ val += this[offset + --i] * mul;
1525
+ }
1526
+ mul *= 0x80;
1527
+
1528
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1529
+
1530
+ return val
1531
+ };
1532
+
1533
+ Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1534
+ offset = offset >>> 0;
1535
+ if (!noAssert) checkOffset(offset, 1, this.length);
1536
+ if (!(this[offset] & 0x80)) return (this[offset])
1537
+ return ((0xff - this[offset] + 1) * -1)
1538
+ };
1539
+
1540
+ Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1541
+ offset = offset >>> 0;
1542
+ if (!noAssert) checkOffset(offset, 2, this.length);
1543
+ const val = this[offset] | (this[offset + 1] << 8);
1544
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1545
+ };
1546
+
1547
+ Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1548
+ offset = offset >>> 0;
1549
+ if (!noAssert) checkOffset(offset, 2, this.length);
1550
+ const val = this[offset + 1] | (this[offset] << 8);
1551
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
1552
+ };
1553
+
1554
+ Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1555
+ offset = offset >>> 0;
1556
+ if (!noAssert) checkOffset(offset, 4, this.length);
1557
+
1558
+ return (this[offset]) |
1559
+ (this[offset + 1] << 8) |
1560
+ (this[offset + 2] << 16) |
1561
+ (this[offset + 3] << 24)
1562
+ };
1563
+
1564
+ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1565
+ offset = offset >>> 0;
1566
+ if (!noAssert) checkOffset(offset, 4, this.length);
1567
+
1568
+ return (this[offset] << 24) |
1569
+ (this[offset + 1] << 16) |
1570
+ (this[offset + 2] << 8) |
1571
+ (this[offset + 3])
1572
+ };
1573
+
1574
+ Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
1575
+ offset = offset >>> 0;
1576
+ validateNumber(offset, 'offset');
1577
+ const first = this[offset];
1578
+ const last = this[offset + 7];
1579
+ if (first === undefined || last === undefined) {
1580
+ boundsError(offset, this.length - 8);
1581
+ }
1582
+
1583
+ const val = this[offset + 4] +
1584
+ this[offset + 5] * 2 ** 8 +
1585
+ this[offset + 6] * 2 ** 16 +
1586
+ (last << 24); // Overflow
1587
+
1588
+ return (BigInt(val) << BigInt(32)) +
1589
+ BigInt(first +
1590
+ this[++offset] * 2 ** 8 +
1591
+ this[++offset] * 2 ** 16 +
1592
+ this[++offset] * 2 ** 24)
1593
+ });
1594
+
1595
+ Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
1596
+ offset = offset >>> 0;
1597
+ validateNumber(offset, 'offset');
1598
+ const first = this[offset];
1599
+ const last = this[offset + 7];
1600
+ if (first === undefined || last === undefined) {
1601
+ boundsError(offset, this.length - 8);
1602
+ }
1603
+
1604
+ const val = (first << 24) + // Overflow
1605
+ this[++offset] * 2 ** 16 +
1606
+ this[++offset] * 2 ** 8 +
1607
+ this[++offset];
1608
+
1609
+ return (BigInt(val) << BigInt(32)) +
1610
+ BigInt(this[++offset] * 2 ** 24 +
1611
+ this[++offset] * 2 ** 16 +
1612
+ this[++offset] * 2 ** 8 +
1613
+ last)
1614
+ });
1615
+
1616
+ Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1617
+ offset = offset >>> 0;
1618
+ if (!noAssert) checkOffset(offset, 4, this.length);
1619
+ return ieee754$1.read(this, offset, true, 23, 4)
1620
+ };
1621
+
1622
+ Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1623
+ offset = offset >>> 0;
1624
+ if (!noAssert) checkOffset(offset, 4, this.length);
1625
+ return ieee754$1.read(this, offset, false, 23, 4)
1626
+ };
1627
+
1628
+ Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1629
+ offset = offset >>> 0;
1630
+ if (!noAssert) checkOffset(offset, 8, this.length);
1631
+ return ieee754$1.read(this, offset, true, 52, 8)
1632
+ };
1633
+
1634
+ Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1635
+ offset = offset >>> 0;
1636
+ if (!noAssert) checkOffset(offset, 8, this.length);
1637
+ return ieee754$1.read(this, offset, false, 52, 8)
1638
+ };
1639
+
1640
+ function checkInt (buf, value, offset, ext, max, min) {
1641
+ if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1642
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1643
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
1644
+ }
1645
+
1646
+ Buffer.prototype.writeUintLE =
1647
+ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1648
+ value = +value;
1649
+ offset = offset >>> 0;
1650
+ byteLength = byteLength >>> 0;
1651
+ if (!noAssert) {
1652
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1653
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1654
+ }
1655
+
1656
+ let mul = 1;
1657
+ let i = 0;
1658
+ this[offset] = value & 0xFF;
1659
+ while (++i < byteLength && (mul *= 0x100)) {
1660
+ this[offset + i] = (value / mul) & 0xFF;
1661
+ }
1662
+
1663
+ return offset + byteLength
1664
+ };
1665
+
1666
+ Buffer.prototype.writeUintBE =
1667
+ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1668
+ value = +value;
1669
+ offset = offset >>> 0;
1670
+ byteLength = byteLength >>> 0;
1671
+ if (!noAssert) {
1672
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1673
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1674
+ }
1675
+
1676
+ let i = byteLength - 1;
1677
+ let mul = 1;
1678
+ this[offset + i] = value & 0xFF;
1679
+ while (--i >= 0 && (mul *= 0x100)) {
1680
+ this[offset + i] = (value / mul) & 0xFF;
1681
+ }
1682
+
1683
+ return offset + byteLength
1684
+ };
1685
+
1686
+ Buffer.prototype.writeUint8 =
1687
+ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1688
+ value = +value;
1689
+ offset = offset >>> 0;
1690
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1691
+ this[offset] = (value & 0xff);
1692
+ return offset + 1
1693
+ };
1694
+
1695
+ Buffer.prototype.writeUint16LE =
1696
+ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1697
+ value = +value;
1698
+ offset = offset >>> 0;
1699
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1700
+ this[offset] = (value & 0xff);
1701
+ this[offset + 1] = (value >>> 8);
1702
+ return offset + 2
1703
+ };
1704
+
1705
+ Buffer.prototype.writeUint16BE =
1706
+ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1707
+ value = +value;
1708
+ offset = offset >>> 0;
1709
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1710
+ this[offset] = (value >>> 8);
1711
+ this[offset + 1] = (value & 0xff);
1712
+ return offset + 2
1713
+ };
1714
+
1715
+ Buffer.prototype.writeUint32LE =
1716
+ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1717
+ value = +value;
1718
+ offset = offset >>> 0;
1719
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1720
+ this[offset + 3] = (value >>> 24);
1721
+ this[offset + 2] = (value >>> 16);
1722
+ this[offset + 1] = (value >>> 8);
1723
+ this[offset] = (value & 0xff);
1724
+ return offset + 4
1725
+ };
1726
+
1727
+ Buffer.prototype.writeUint32BE =
1728
+ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1729
+ value = +value;
1730
+ offset = offset >>> 0;
1731
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1732
+ this[offset] = (value >>> 24);
1733
+ this[offset + 1] = (value >>> 16);
1734
+ this[offset + 2] = (value >>> 8);
1735
+ this[offset + 3] = (value & 0xff);
1736
+ return offset + 4
1737
+ };
1738
+
1739
+ function wrtBigUInt64LE (buf, value, offset, min, max) {
1740
+ checkIntBI(value, min, max, buf, offset, 7);
1741
+
1742
+ let lo = Number(value & BigInt(0xffffffff));
1743
+ buf[offset++] = lo;
1744
+ lo = lo >> 8;
1745
+ buf[offset++] = lo;
1746
+ lo = lo >> 8;
1747
+ buf[offset++] = lo;
1748
+ lo = lo >> 8;
1749
+ buf[offset++] = lo;
1750
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1751
+ buf[offset++] = hi;
1752
+ hi = hi >> 8;
1753
+ buf[offset++] = hi;
1754
+ hi = hi >> 8;
1755
+ buf[offset++] = hi;
1756
+ hi = hi >> 8;
1757
+ buf[offset++] = hi;
1758
+ return offset
1759
+ }
1760
+
1761
+ function wrtBigUInt64BE (buf, value, offset, min, max) {
1762
+ checkIntBI(value, min, max, buf, offset, 7);
1763
+
1764
+ let lo = Number(value & BigInt(0xffffffff));
1765
+ buf[offset + 7] = lo;
1766
+ lo = lo >> 8;
1767
+ buf[offset + 6] = lo;
1768
+ lo = lo >> 8;
1769
+ buf[offset + 5] = lo;
1770
+ lo = lo >> 8;
1771
+ buf[offset + 4] = lo;
1772
+ let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1773
+ buf[offset + 3] = hi;
1774
+ hi = hi >> 8;
1775
+ buf[offset + 2] = hi;
1776
+ hi = hi >> 8;
1777
+ buf[offset + 1] = hi;
1778
+ hi = hi >> 8;
1779
+ buf[offset] = hi;
1780
+ return offset + 8
1781
+ }
1782
+
1783
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
1784
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1785
+ });
1786
+
1787
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
1788
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1789
+ });
1790
+
1791
+ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1792
+ value = +value;
1793
+ offset = offset >>> 0;
1794
+ if (!noAssert) {
1795
+ const limit = Math.pow(2, (8 * byteLength) - 1);
1796
+
1797
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1798
+ }
1799
+
1800
+ let i = 0;
1801
+ let mul = 1;
1802
+ let sub = 0;
1803
+ this[offset] = value & 0xFF;
1804
+ while (++i < byteLength && (mul *= 0x100)) {
1805
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1806
+ sub = 1;
1807
+ }
1808
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1809
+ }
1810
+
1811
+ return offset + byteLength
1812
+ };
1813
+
1814
+ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1815
+ value = +value;
1816
+ offset = offset >>> 0;
1817
+ if (!noAssert) {
1818
+ const limit = Math.pow(2, (8 * byteLength) - 1);
1819
+
1820
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1821
+ }
1822
+
1823
+ let i = byteLength - 1;
1824
+ let mul = 1;
1825
+ let sub = 0;
1826
+ this[offset + i] = value & 0xFF;
1827
+ while (--i >= 0 && (mul *= 0x100)) {
1828
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1829
+ sub = 1;
1830
+ }
1831
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1832
+ }
1833
+
1834
+ return offset + byteLength
1835
+ };
1836
+
1837
+ Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1838
+ value = +value;
1839
+ offset = offset >>> 0;
1840
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
1841
+ if (value < 0) value = 0xff + value + 1;
1842
+ this[offset] = (value & 0xff);
1843
+ return offset + 1
1844
+ };
1845
+
1846
+ Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1847
+ value = +value;
1848
+ offset = offset >>> 0;
1849
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1850
+ this[offset] = (value & 0xff);
1851
+ this[offset + 1] = (value >>> 8);
1852
+ return offset + 2
1853
+ };
1854
+
1855
+ Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1856
+ value = +value;
1857
+ offset = offset >>> 0;
1858
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1859
+ this[offset] = (value >>> 8);
1860
+ this[offset + 1] = (value & 0xff);
1861
+ return offset + 2
1862
+ };
1863
+
1864
+ Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1865
+ value = +value;
1866
+ offset = offset >>> 0;
1867
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1868
+ this[offset] = (value & 0xff);
1869
+ this[offset + 1] = (value >>> 8);
1870
+ this[offset + 2] = (value >>> 16);
1871
+ this[offset + 3] = (value >>> 24);
1872
+ return offset + 4
1873
+ };
1874
+
1875
+ Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1876
+ value = +value;
1877
+ offset = offset >>> 0;
1878
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1879
+ if (value < 0) value = 0xffffffff + value + 1;
1880
+ this[offset] = (value >>> 24);
1881
+ this[offset + 1] = (value >>> 16);
1882
+ this[offset + 2] = (value >>> 8);
1883
+ this[offset + 3] = (value & 0xff);
1884
+ return offset + 4
1885
+ };
1886
+
1887
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
1888
+ return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1889
+ });
1890
+
1891
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
1892
+ return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1893
+ });
1894
+
1895
+ function checkIEEE754 (buf, value, offset, ext, max, min) {
1896
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
1897
+ if (offset < 0) throw new RangeError('Index out of range')
1898
+ }
1899
+
1900
+ function writeFloat (buf, value, offset, littleEndian, noAssert) {
1901
+ value = +value;
1902
+ offset = offset >>> 0;
1903
+ if (!noAssert) {
1904
+ checkIEEE754(buf, value, offset, 4);
1905
+ }
1906
+ ieee754$1.write(buf, value, offset, littleEndian, 23, 4);
1907
+ return offset + 4
1908
+ }
1909
+
1910
+ Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1911
+ return writeFloat(this, value, offset, true, noAssert)
1912
+ };
1913
+
1914
+ Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1915
+ return writeFloat(this, value, offset, false, noAssert)
1916
+ };
1917
+
1918
+ function writeDouble (buf, value, offset, littleEndian, noAssert) {
1919
+ value = +value;
1920
+ offset = offset >>> 0;
1921
+ if (!noAssert) {
1922
+ checkIEEE754(buf, value, offset, 8);
1923
+ }
1924
+ ieee754$1.write(buf, value, offset, littleEndian, 52, 8);
1925
+ return offset + 8
1926
+ }
1927
+
1928
+ Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1929
+ return writeDouble(this, value, offset, true, noAssert)
1930
+ };
1931
+
1932
+ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1933
+ return writeDouble(this, value, offset, false, noAssert)
1934
+ };
1935
+
1936
+ // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1937
+ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1938
+ if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
1939
+ if (!start) start = 0;
1940
+ if (!end && end !== 0) end = this.length;
1941
+ if (targetStart >= target.length) targetStart = target.length;
1942
+ if (!targetStart) targetStart = 0;
1943
+ if (end > 0 && end < start) end = start;
1944
+
1945
+ // Copy 0 bytes; we're done
1946
+ if (end === start) return 0
1947
+ if (target.length === 0 || this.length === 0) return 0
1948
+
1949
+ // Fatal error conditions
1950
+ if (targetStart < 0) {
1951
+ throw new RangeError('targetStart out of bounds')
1952
+ }
1953
+ if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
1954
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
1955
+
1956
+ // Are we oob?
1957
+ if (end > this.length) end = this.length;
1958
+ if (target.length - targetStart < end - start) {
1959
+ end = target.length - targetStart + start;
1960
+ }
1961
+
1962
+ const len = end - start;
1963
+
1964
+ if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
1965
+ // Use built-in when available, missing from IE11
1966
+ this.copyWithin(targetStart, start, end);
1967
+ } else {
1968
+ Uint8Array.prototype.set.call(
1969
+ target,
1970
+ this.subarray(start, end),
1971
+ targetStart
1972
+ );
1973
+ }
1974
+
1975
+ return len
1976
+ };
1977
+
1978
+ // Usage:
1979
+ // buffer.fill(number[, offset[, end]])
1980
+ // buffer.fill(buffer[, offset[, end]])
1981
+ // buffer.fill(string[, offset[, end]][, encoding])
1982
+ Buffer.prototype.fill = function fill (val, start, end, encoding) {
1983
+ // Handle string cases:
1984
+ if (typeof val === 'string') {
1985
+ if (typeof start === 'string') {
1986
+ encoding = start;
1987
+ start = 0;
1988
+ end = this.length;
1989
+ } else if (typeof end === 'string') {
1990
+ encoding = end;
1991
+ end = this.length;
1992
+ }
1993
+ if (encoding !== undefined && typeof encoding !== 'string') {
1994
+ throw new TypeError('encoding must be a string')
1995
+ }
1996
+ if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1997
+ throw new TypeError('Unknown encoding: ' + encoding)
1998
+ }
1999
+ if (val.length === 1) {
2000
+ const code = val.charCodeAt(0);
2001
+ if ((encoding === 'utf8' && code < 128) ||
2002
+ encoding === 'latin1') {
2003
+ // Fast path: If `val` fits into a single byte, use that numeric value.
2004
+ val = code;
2005
+ }
2006
+ }
2007
+ } else if (typeof val === 'number') {
2008
+ val = val & 255;
2009
+ } else if (typeof val === 'boolean') {
2010
+ val = Number(val);
2011
+ }
2012
+
2013
+ // Invalid ranges are not set to a default, so can range check early.
2014
+ if (start < 0 || this.length < start || this.length < end) {
2015
+ throw new RangeError('Out of range index')
2016
+ }
2017
+
2018
+ if (end <= start) {
2019
+ return this
2020
+ }
2021
+
2022
+ start = start >>> 0;
2023
+ end = end === undefined ? this.length : end >>> 0;
2024
+
2025
+ if (!val) val = 0;
2026
+
2027
+ let i;
2028
+ if (typeof val === 'number') {
2029
+ for (i = start; i < end; ++i) {
2030
+ this[i] = val;
2031
+ }
2032
+ } else {
2033
+ const bytes = Buffer.isBuffer(val)
2034
+ ? val
2035
+ : Buffer.from(val, encoding);
2036
+ const len = bytes.length;
2037
+ if (len === 0) {
2038
+ throw new TypeError('The value "' + val +
2039
+ '" is invalid for argument "value"')
2040
+ }
2041
+ for (i = 0; i < end - start; ++i) {
2042
+ this[i + start] = bytes[i % len];
2043
+ }
2044
+ }
2045
+
2046
+ return this
2047
+ };
2048
+
2049
+ // CUSTOM ERRORS
2050
+ // =============
2051
+
2052
+ // Simplified versions from Node, changed for Buffer-only usage
2053
+ const errors = {};
2054
+ function E (sym, getMessage, Base) {
2055
+ errors[sym] = class NodeError extends Base {
2056
+ constructor () {
2057
+ super();
2058
+
2059
+ Object.defineProperty(this, 'message', {
2060
+ value: getMessage.apply(this, arguments),
2061
+ writable: true,
2062
+ configurable: true
2063
+ });
2064
+
2065
+ // Add the error code to the name to include it in the stack trace.
2066
+ this.name = `${this.name} [${sym}]`;
2067
+ // Access the stack to generate the error message including the error code
2068
+ // from the name.
2069
+ this.stack; // eslint-disable-line no-unused-expressions
2070
+ // Reset the name to the actual name.
2071
+ delete this.name;
2072
+ }
2073
+
2074
+ get code () {
2075
+ return sym
2076
+ }
2077
+
2078
+ set code (value) {
2079
+ Object.defineProperty(this, 'code', {
2080
+ configurable: true,
2081
+ enumerable: true,
2082
+ value,
2083
+ writable: true
2084
+ });
2085
+ }
2086
+
2087
+ toString () {
2088
+ return `${this.name} [${sym}]: ${this.message}`
2089
+ }
2090
+ };
2091
+ }
2092
+
2093
+ E('ERR_BUFFER_OUT_OF_BOUNDS',
2094
+ function (name) {
2095
+ if (name) {
2096
+ return `${name} is outside of buffer bounds`
2097
+ }
2098
+
2099
+ return 'Attempt to access memory outside buffer bounds'
2100
+ }, RangeError);
2101
+ E('ERR_INVALID_ARG_TYPE',
2102
+ function (name, actual) {
2103
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`
2104
+ }, TypeError);
2105
+ E('ERR_OUT_OF_RANGE',
2106
+ function (str, range, input) {
2107
+ let msg = `The value of "${str}" is out of range.`;
2108
+ let received = input;
2109
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
2110
+ received = addNumericalSeparator(String(input));
2111
+ } else if (typeof input === 'bigint') {
2112
+ received = String(input);
2113
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
2114
+ received = addNumericalSeparator(received);
2115
+ }
2116
+ received += 'n';
2117
+ }
2118
+ msg += ` It must be ${range}. Received ${received}`;
2119
+ return msg
2120
+ }, RangeError);
2121
+
2122
+ function addNumericalSeparator (val) {
2123
+ let res = '';
2124
+ let i = val.length;
2125
+ const start = val[0] === '-' ? 1 : 0;
2126
+ for (; i >= start + 4; i -= 3) {
2127
+ res = `_${val.slice(i - 3, i)}${res}`;
2128
+ }
2129
+ return `${val.slice(0, i)}${res}`
2130
+ }
2131
+
2132
+ // CHECK FUNCTIONS
2133
+ // ===============
2134
+
2135
+ function checkBounds (buf, offset, byteLength) {
2136
+ validateNumber(offset, 'offset');
2137
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
2138
+ boundsError(offset, buf.length - (byteLength + 1));
2139
+ }
2140
+ }
2141
+
2142
+ function checkIntBI (value, min, max, buf, offset, byteLength) {
2143
+ if (value > max || value < min) {
2144
+ const n = typeof min === 'bigint' ? 'n' : '';
2145
+ let range;
2146
+ if (byteLength > 3) {
2147
+ if (min === 0 || min === BigInt(0)) {
2148
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
2149
+ } else {
2150
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
2151
+ `${(byteLength + 1) * 8 - 1}${n}`;
2152
+ }
2153
+ } else {
2154
+ range = `>= ${min}${n} and <= ${max}${n}`;
2155
+ }
2156
+ throw new errors.ERR_OUT_OF_RANGE('value', range, value)
2157
+ }
2158
+ checkBounds(buf, offset, byteLength);
2159
+ }
2160
+
2161
+ function validateNumber (value, name) {
2162
+ if (typeof value !== 'number') {
2163
+ throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
2164
+ }
2165
+ }
2166
+
2167
+ function boundsError (value, length, type) {
2168
+ if (Math.floor(value) !== value) {
2169
+ validateNumber(value, type);
2170
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
2171
+ }
2172
+
2173
+ if (length < 0) {
2174
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
2175
+ }
2176
+
2177
+ throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
2178
+ `>= ${type ? 1 : 0} and <= ${length}`,
2179
+ value)
2180
+ }
2181
+
2182
+ // HELPER FUNCTIONS
2183
+ // ================
2184
+
2185
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
2186
+
2187
+ function base64clean (str) {
2188
+ // Node takes equal signs as end of the Base64 encoding
2189
+ str = str.split('=')[0];
2190
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
2191
+ str = str.trim().replace(INVALID_BASE64_RE, '');
2192
+ // Node converts strings with length < 2 to ''
2193
+ if (str.length < 2) return ''
2194
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
2195
+ while (str.length % 4 !== 0) {
2196
+ str = str + '=';
2197
+ }
2198
+ return str
2199
+ }
2200
+
2201
+ function utf8ToBytes (string, units) {
2202
+ units = units || Infinity;
2203
+ let codePoint;
2204
+ const length = string.length;
2205
+ let leadSurrogate = null;
2206
+ const bytes = [];
2207
+
2208
+ for (let i = 0; i < length; ++i) {
2209
+ codePoint = string.charCodeAt(i);
2210
+
2211
+ // is surrogate component
2212
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
2213
+ // last char was a lead
2214
+ if (!leadSurrogate) {
2215
+ // no lead yet
2216
+ if (codePoint > 0xDBFF) {
2217
+ // unexpected trail
2218
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2219
+ continue
2220
+ } else if (i + 1 === length) {
2221
+ // unpaired lead
2222
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2223
+ continue
2224
+ }
2225
+
2226
+ // valid lead
2227
+ leadSurrogate = codePoint;
2228
+
2229
+ continue
2230
+ }
2231
+
2232
+ // 2 leads in a row
2233
+ if (codePoint < 0xDC00) {
2234
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2235
+ leadSurrogate = codePoint;
2236
+ continue
2237
+ }
2238
+
2239
+ // valid surrogate pair
2240
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
2241
+ } else if (leadSurrogate) {
2242
+ // valid bmp char, but last char was a lead
2243
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2244
+ }
2245
+
2246
+ leadSurrogate = null;
2247
+
2248
+ // encode utf8
2249
+ if (codePoint < 0x80) {
2250
+ if ((units -= 1) < 0) break
2251
+ bytes.push(codePoint);
2252
+ } else if (codePoint < 0x800) {
2253
+ if ((units -= 2) < 0) break
2254
+ bytes.push(
2255
+ codePoint >> 0x6 | 0xC0,
2256
+ codePoint & 0x3F | 0x80
2257
+ );
2258
+ } else if (codePoint < 0x10000) {
2259
+ if ((units -= 3) < 0) break
2260
+ bytes.push(
2261
+ codePoint >> 0xC | 0xE0,
2262
+ codePoint >> 0x6 & 0x3F | 0x80,
2263
+ codePoint & 0x3F | 0x80
2264
+ );
2265
+ } else if (codePoint < 0x110000) {
2266
+ if ((units -= 4) < 0) break
2267
+ bytes.push(
2268
+ codePoint >> 0x12 | 0xF0,
2269
+ codePoint >> 0xC & 0x3F | 0x80,
2270
+ codePoint >> 0x6 & 0x3F | 0x80,
2271
+ codePoint & 0x3F | 0x80
2272
+ );
2273
+ } else {
2274
+ throw new Error('Invalid code point')
2275
+ }
2276
+ }
2277
+
2278
+ return bytes
2279
+ }
2280
+
2281
+ function asciiToBytes (str) {
2282
+ const byteArray = [];
2283
+ for (let i = 0; i < str.length; ++i) {
2284
+ // Node's code seems to be doing this and not & 0x7F..
2285
+ byteArray.push(str.charCodeAt(i) & 0xFF);
2286
+ }
2287
+ return byteArray
2288
+ }
2289
+
2290
+ function utf16leToBytes (str, units) {
2291
+ let c, hi, lo;
2292
+ const byteArray = [];
2293
+ for (let i = 0; i < str.length; ++i) {
2294
+ if ((units -= 2) < 0) break
2295
+
2296
+ c = str.charCodeAt(i);
2297
+ hi = c >> 8;
2298
+ lo = c % 256;
2299
+ byteArray.push(lo);
2300
+ byteArray.push(hi);
2301
+ }
2302
+
2303
+ return byteArray
2304
+ }
2305
+
2306
+ function base64ToBytes (str) {
2307
+ return base64.toByteArray(base64clean(str))
2308
+ }
2309
+
2310
+ function blitBuffer (src, dst, offset, length) {
2311
+ let i;
2312
+ for (i = 0; i < length; ++i) {
2313
+ if ((i + offset >= dst.length) || (i >= src.length)) break
2314
+ dst[i + offset] = src[i];
2315
+ }
2316
+ return i
2317
+ }
2318
+
2319
+ // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
2320
+ // the `instanceof` check but they should be treated as of that type.
2321
+ // See: https://github.com/feross/buffer/issues/166
2322
+ function isInstance (obj, type) {
2323
+ return obj instanceof type ||
2324
+ (obj != null && obj.constructor != null && obj.constructor.name != null &&
2325
+ obj.constructor.name === type.name)
2326
+ }
2327
+ function numberIsNaN (obj) {
2328
+ // For IE11 support
2329
+ return obj !== obj // eslint-disable-line no-self-compare
2330
+ }
2331
+
2332
+ // Create lookup table for `toString('hex')`
2333
+ // See: https://github.com/feross/buffer/issues/219
2334
+ const hexSliceLookupTable = (function () {
2335
+ const alphabet = '0123456789abcdef';
2336
+ const table = new Array(256);
2337
+ for (let i = 0; i < 16; ++i) {
2338
+ const i16 = i * 16;
2339
+ for (let j = 0; j < 16; ++j) {
2340
+ table[i16 + j] = alphabet[i] + alphabet[j];
2341
+ }
2342
+ }
2343
+ return table
2344
+ })();
2345
+
2346
+ // Return not function with Error if BigInt not supported
2347
+ function defineBigIntMethod (fn) {
2348
+ return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
2349
+ }
2350
+
2351
+ function BufferBigIntNotDefined () {
2352
+ throw new Error('BigInt not supported')
2353
+ }
2354
+ }(buffer));
2355
+
7
2356
  var timezone$1 = {exports: {}};
8
2357
 
9
2358
  (function (module, exports) {
@@ -1218,6 +3567,105 @@ class CharacterHyperStatDto {
1218
3567
  }
1219
3568
  }
1220
3569
 
3570
+ /**
3571
+ * 캐릭터 외형 이미지 정보
3572
+ */
3573
+ class CharacterImageDto {
3574
+ /**
3575
+ * 조회 기준일
3576
+ */
3577
+ date;
3578
+ /**
3579
+ * 캐릭터 외형 이미지 원본 (URL)
3580
+ */
3581
+ originUrl;
3582
+ /**
3583
+ * 캐릭터 외형 기본 이미지 (base64)
3584
+ */
3585
+ originImage;
3586
+ /**
3587
+ * 캐릭터 외형 이미지 (base64)
3588
+ */
3589
+ image;
3590
+ /**
3591
+ * 캐릭터 액션
3592
+ */
3593
+ action;
3594
+ /**
3595
+ * 캐릭터 감정표현
3596
+ */
3597
+ emotion;
3598
+ /**
3599
+ * 캐릭터 무기 모션
3600
+ */
3601
+ wmotion;
3602
+ /**
3603
+ * 가로 길이. 배경 크기에 해당함, 96 (default) ~ 1000
3604
+ */
3605
+ width;
3606
+ /**
3607
+ * 세로 길이. 배경 크기에 해당함, 96 (default) ~ 1000
3608
+ */
3609
+ height;
3610
+ /**
3611
+ * 캐릭터의 가로 좌표
3612
+ */
3613
+ x;
3614
+ /**
3615
+ * 캐릭터의 세로 좌표.
3616
+ */
3617
+ y;
3618
+ constructor(obj) {
3619
+ this.date = obj.date;
3620
+ this.originUrl = obj.originUrl;
3621
+ this.originImage = obj.originImage;
3622
+ this.image = obj.image;
3623
+ this.action = obj.action;
3624
+ this.emotion = obj.emotion;
3625
+ this.wmotion = obj.wmotion;
3626
+ this.width = obj.width;
3627
+ this.height = obj.height;
3628
+ this.x = obj.x;
3629
+ this.y = obj.y;
3630
+ }
3631
+ }
3632
+ /**
3633
+ * 캐릭터 액션
3634
+ */
3635
+ var CharacterImageAction;
3636
+ (function (CharacterImageAction) {
3637
+ CharacterImageAction["Stand1"] = "A00";
3638
+ CharacterImageAction["Stand2"] = "A01";
3639
+ CharacterImageAction["Walk1"] = "A02";
3640
+ CharacterImageAction["Walk2"] = "A03";
3641
+ CharacterImageAction["Prone"] = "A04";
3642
+ CharacterImageAction["Fly"] = "A05";
3643
+ CharacterImageAction["Jump"] = "A06";
3644
+ CharacterImageAction["Sit"] = "A07";
3645
+ })(CharacterImageAction || (CharacterImageAction = {}));
3646
+ /**
3647
+ * 캐릭터 감정표현
3648
+ */
3649
+ var CharacterImageEmotion;
3650
+ (function (CharacterImageEmotion) {
3651
+ CharacterImageEmotion["Default"] = "E00";
3652
+ CharacterImageEmotion["Wink"] = "E01";
3653
+ CharacterImageEmotion["Smile"] = "E02";
3654
+ CharacterImageEmotion["Cry"] = "E03";
3655
+ CharacterImageEmotion["Angry"] = "E04";
3656
+ CharacterImageEmotion["Bewildered"] = "E05";
3657
+ })(CharacterImageEmotion || (CharacterImageEmotion = {}));
3658
+ /**
3659
+ * 캐릭터 무기 모션
3660
+ */
3661
+ var CharacterImageWeaponMotion;
3662
+ (function (CharacterImageWeaponMotion) {
3663
+ CharacterImageWeaponMotion["Default"] = "W00";
3664
+ CharacterImageWeaponMotion["OneHand"] = "W01";
3665
+ CharacterImageWeaponMotion["TwoHands"] = "W02";
3666
+ CharacterImageWeaponMotion["Gun"] = "W03";
3667
+ })(CharacterImageWeaponMotion || (CharacterImageWeaponMotion = {}));
3668
+
1221
3669
  /**
1222
3670
  * 캐릭터 장비 추가 옵션 정보
1223
3671
  */
@@ -4986,6 +7434,50 @@ class MapleStoryApi {
4986
7434
  });
4987
7435
  return new CharacterBasicDto(data);
4988
7436
  }
7437
+ /**
7438
+ * 캐릭터 외형 이미지 정보를 조회합니다.
7439
+ * - 메이플스토리 게임 데이터는 평균 15분 후 확인 가능합니다.
7440
+ * - 2023년 12월 21일 데이터부터 조회할 수 있습니다.
7441
+ * - 과거 데이터는 원하는 일자를 입력해 조회할 수 있으며, 전일 데이터는 다음날 오전 2시부터 확인할 수 있습니다. (12월 22일 데이터 조회 시, 22일 00시부터 23일 00시 사이 데이터가 조회 됩니다.)
7442
+ * - 게임 콘텐츠 변경으로 ocid가 변경될 수 있습니다. ocid 기반 서비스 갱신 시 유의해 주시길 바랍니다.
7443
+ *
7444
+ * @param ocid 캐릭터 식별자
7445
+ * @param imageOptions 캐릭터 외형 파라미터
7446
+ * @param dateOptions 조회 기준일 (KST)
7447
+ */
7448
+ async getCharacterImage(ocid, imageOptions, dateOptions) {
7449
+ const { date, characterImage: path } = await this.getCharacterBasic(ocid, dateOptions);
7450
+ const query = {
7451
+ action: CharacterImageAction.Stand1,
7452
+ emotion: CharacterImageEmotion.Default,
7453
+ wmotion: CharacterImageWeaponMotion.Default,
7454
+ width: 96,
7455
+ height: 96,
7456
+ x: null,
7457
+ y: null,
7458
+ ...imageOptions,
7459
+ };
7460
+ const urlImageToBase64 = async (path, query) => {
7461
+ const { data, headers } = await axios.get(path, {
7462
+ params: query,
7463
+ responseType: 'arraybuffer',
7464
+ });
7465
+ const base64 = buffer.Buffer.from(data, 'binary').toString('base64');
7466
+ const mimeType = headers['content-type'];
7467
+ return `data:${mimeType};base64,${base64}`;
7468
+ };
7469
+ const [originImage, image] = await Promise.all([
7470
+ urlImageToBase64(path),
7471
+ urlImageToBase64(path, query),
7472
+ ]);
7473
+ return new CharacterImageDto({
7474
+ date,
7475
+ originUrl: path,
7476
+ originImage,
7477
+ image,
7478
+ ...query,
7479
+ });
7480
+ }
4989
7481
  /**
4990
7482
  * 인기도 정보를 조회합니다.
4991
7483
  * - 메이플스토리 게임 데이터는 평균 15분 후 확인 가능합니다.
@@ -6117,4 +8609,4 @@ class MapleStoryApi {
6117
8609
  }
6118
8610
  }
6119
8611
 
6120
- export { AchievementRankingDto, AchievementRankingResponseDto, CashshopNoticeDetailDto, CashshopNoticeListDto, CashshopNoticeListItemDto, CharacterAbilityDto, CharacterAbilityInfoDto, CharacterAbilityPresetDto, CharacterAndroidCashItemEquipmentColoringPrismDto, CharacterAndroidCashItemEquipmentDto, CharacterAndroidCashItemEquipmentOptionDto, CharacterAndroidEquipmentDto, CharacterAndroidEquipmentFaceDto, CharacterAndroidEquipmentHairDto, CharacterAndroidEquipmentPresetDto, CharacterBasicDto, CharacterBeautyEquipmentDto, CharacterBeautyEquipmentFaceDto, CharacterBeautyEquipmentHairDto, CharacterCashItemEquipmentColoringPrismDto, CharacterCashItemEquipmentDto, CharacterCashItemEquipmentOptionDto, CharacterCashItemEquipmentPresetDto, CharacterDojangDto, CharacterDto, CharacterHexaMatrixDto, CharacterHexaMatrixEquipmentDto, CharacterHexaMatrixEquipmentLinkedSkillDto, CharacterHexaMatrixStatCoreDto, CharacterHexaMatrixStatDto, CharacterHyperStatDto, CharacterHyperStatPresetDto, CharacterItemEquipmentAddOptionDto, CharacterItemEquipmentBaseOptionDto, CharacterItemEquipmentDragonInfoDto, CharacterItemEquipmentDto, CharacterItemEquipmentEtcOptionDto, CharacterItemEquipmentExceptionalOptionDto, CharacterItemEquipmentInfoDto, CharacterItemEquipmentMechanicInfoDto, CharacterItemEquipmentStarforceOptionDto, CharacterItemEquipmentTitleDto, CharacterItemEquipmentTotalOptionDto, CharacterLinkSkillDto, CharacterLinkSkillInfoDto, CharacterListAccountCharacterDto, CharacterListAccountDto, CharacterListDto, CharacterPetEquipmentAutoSkillDto, CharacterPetEquipmentDto, CharacterPetEquipmentItemDto, CharacterPetEquipmentItemOptionDto, CharacterPopularityDto, CharacterPropensityDto, CharacterSetEffectDto, CharacterSetEffectInfoDto, CharacterSetEffectOptionFullDto, CharacterSetEffectSetDto, CharacterSkillDto, CharacterSkillInfoDto, CharacterStatDto, CharacterSymbolEquipmentDto, CharacterSymbolEquipmentInfoDto, CharacterVMatrixCodeEquipmentDto, CharacterVMatrixDto, CubeHistoryDto, CubeHistoryResponseDto, CubeResultOptionDto, DojangRankingDto, DojangRankingResponseDto, EventNoticeDetailDto, EventNoticeListDto, EventNoticeListItemDto, GuildBasicDto, GuildDto, GuildRankingDto, GuildRankingResponseDto, GuildSkillDto, InspectionInfoDto, MapleStoryApi, MapleStoryApiError, MapleStoryApiErrorCode, NoticeDetailDto, NoticeListDto, NoticeListItemDto, OverallRankingDto, OverallRankingResponseDto, PotentialHistoryDto, PotentialHistoryResponseDto, PotentialOptionGrade, PotentialResultOptionDto, StarforceEventDto, StarforceHistoryDto, StarforceHistoryResponseDto, TheSeedRankingDto, TheSeedRankingResponseDto, UnionArtifactCrystalDto, UnionArtifactDto, UnionArtifactEffectDto, UnionDto, UnionRaiderBlockControlPointDto, UnionRaiderBlockDto, UnionRaiderBlockPositionDto, UnionRaiderDto, UnionRaiderInnerStatDto, UnionRaiderPresetDto, UnionRankingDto, UnionRankingResponseDto, UpdateNoticeDetailDto, UpdateNoticeListDto, UpdateNoticeListItemDto, potentialOptionGradeFromString };
8612
+ export { AchievementRankingDto, AchievementRankingResponseDto, CashshopNoticeDetailDto, CashshopNoticeListDto, CashshopNoticeListItemDto, CharacterAbilityDto, CharacterAbilityInfoDto, CharacterAbilityPresetDto, CharacterAndroidCashItemEquipmentColoringPrismDto, CharacterAndroidCashItemEquipmentDto, CharacterAndroidCashItemEquipmentOptionDto, CharacterAndroidEquipmentDto, CharacterAndroidEquipmentFaceDto, CharacterAndroidEquipmentHairDto, CharacterAndroidEquipmentPresetDto, CharacterBasicDto, CharacterBeautyEquipmentDto, CharacterBeautyEquipmentFaceDto, CharacterBeautyEquipmentHairDto, CharacterCashItemEquipmentColoringPrismDto, CharacterCashItemEquipmentDto, CharacterCashItemEquipmentOptionDto, CharacterCashItemEquipmentPresetDto, CharacterDojangDto, CharacterDto, CharacterHexaMatrixDto, CharacterHexaMatrixEquipmentDto, CharacterHexaMatrixEquipmentLinkedSkillDto, CharacterHexaMatrixStatCoreDto, CharacterHexaMatrixStatDto, CharacterHyperStatDto, CharacterHyperStatPresetDto, CharacterImageAction, CharacterImageDto, CharacterImageEmotion, CharacterImageWeaponMotion, CharacterItemEquipmentAddOptionDto, CharacterItemEquipmentBaseOptionDto, CharacterItemEquipmentDragonInfoDto, CharacterItemEquipmentDto, CharacterItemEquipmentEtcOptionDto, CharacterItemEquipmentExceptionalOptionDto, CharacterItemEquipmentInfoDto, CharacterItemEquipmentMechanicInfoDto, CharacterItemEquipmentStarforceOptionDto, CharacterItemEquipmentTitleDto, CharacterItemEquipmentTotalOptionDto, CharacterLinkSkillDto, CharacterLinkSkillInfoDto, CharacterListAccountCharacterDto, CharacterListAccountDto, CharacterListDto, CharacterPetEquipmentAutoSkillDto, CharacterPetEquipmentDto, CharacterPetEquipmentItemDto, CharacterPetEquipmentItemOptionDto, CharacterPopularityDto, CharacterPropensityDto, CharacterSetEffectDto, CharacterSetEffectInfoDto, CharacterSetEffectOptionFullDto, CharacterSetEffectSetDto, CharacterSkillDto, CharacterSkillInfoDto, CharacterStatDto, CharacterSymbolEquipmentDto, CharacterSymbolEquipmentInfoDto, CharacterVMatrixCodeEquipmentDto, CharacterVMatrixDto, CubeHistoryDto, CubeHistoryResponseDto, CubeResultOptionDto, DojangRankingDto, DojangRankingResponseDto, EventNoticeDetailDto, EventNoticeListDto, EventNoticeListItemDto, GuildBasicDto, GuildDto, GuildRankingDto, GuildRankingResponseDto, GuildSkillDto, InspectionInfoDto, MapleStoryApi, MapleStoryApiError, MapleStoryApiErrorCode, NoticeDetailDto, NoticeListDto, NoticeListItemDto, OverallRankingDto, OverallRankingResponseDto, PotentialHistoryDto, PotentialHistoryResponseDto, PotentialOptionGrade, PotentialResultOptionDto, StarforceEventDto, StarforceHistoryDto, StarforceHistoryResponseDto, TheSeedRankingDto, TheSeedRankingResponseDto, UnionArtifactCrystalDto, UnionArtifactDto, UnionArtifactEffectDto, UnionDto, UnionRaiderBlockControlPointDto, UnionRaiderBlockDto, UnionRaiderBlockPositionDto, UnionRaiderDto, UnionRaiderInnerStatDto, UnionRaiderPresetDto, UnionRankingDto, UnionRankingResponseDto, UpdateNoticeDetailDto, UpdateNoticeListDto, UpdateNoticeListItemDto, potentialOptionGradeFromString };