maplestory-openapi 2.7.3 → 2.8.0

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