@mcp-use/inspector 0.9.0-canary.2 → 0.9.0-canary.3

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.
@@ -1,4 +1,4 @@
1
- import { bh as getAugmentedNamespace, bi as getDefaultExportFromCjs } from "./index-BaR5HKmC.js";
1
+ import { bh as getAugmentedNamespace, bi as getDefaultExportFromCjs } from "./index-DlUHZ9Rv.js";
2
2
  import { u as util } from "./util-D59LNlyU.js";
3
3
  import { o as os } from "./__vite-browser-external-CHS79mP1.js";
4
4
  import { r as requireBase64Js } from "./index-DX0TIfSM.js";
@@ -3079,12 +3079,380 @@ function requireBrowser$1() {
3079
3079
  }
3080
3080
  return browser$1;
3081
3081
  }
3082
+ var events = { exports: {} };
3083
+ var hasRequiredEvents;
3084
+ function requireEvents() {
3085
+ if (hasRequiredEvents) return events.exports;
3086
+ hasRequiredEvents = 1;
3087
+ var R = typeof Reflect === "object" ? Reflect : null;
3088
+ var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
3089
+ return Function.prototype.apply.call(target, receiver, args);
3090
+ };
3091
+ var ReflectOwnKeys;
3092
+ if (R && typeof R.ownKeys === "function") {
3093
+ ReflectOwnKeys = R.ownKeys;
3094
+ } else if (Object.getOwnPropertySymbols) {
3095
+ ReflectOwnKeys = function ReflectOwnKeys2(target) {
3096
+ return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
3097
+ };
3098
+ } else {
3099
+ ReflectOwnKeys = function ReflectOwnKeys2(target) {
3100
+ return Object.getOwnPropertyNames(target);
3101
+ };
3102
+ }
3103
+ function ProcessEmitWarning(warning) {
3104
+ if (console && console.warn) console.warn(warning);
3105
+ }
3106
+ var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
3107
+ return value !== value;
3108
+ };
3109
+ function EventEmitter() {
3110
+ EventEmitter.init.call(this);
3111
+ }
3112
+ events.exports = EventEmitter;
3113
+ events.exports.once = once2;
3114
+ EventEmitter.EventEmitter = EventEmitter;
3115
+ EventEmitter.prototype._events = void 0;
3116
+ EventEmitter.prototype._eventsCount = 0;
3117
+ EventEmitter.prototype._maxListeners = void 0;
3118
+ var defaultMaxListeners = 10;
3119
+ function checkListener(listener) {
3120
+ if (typeof listener !== "function") {
3121
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
3122
+ }
3123
+ }
3124
+ Object.defineProperty(EventEmitter, "defaultMaxListeners", {
3125
+ enumerable: true,
3126
+ get: function() {
3127
+ return defaultMaxListeners;
3128
+ },
3129
+ set: function(arg) {
3130
+ if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
3131
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
3132
+ }
3133
+ defaultMaxListeners = arg;
3134
+ }
3135
+ });
3136
+ EventEmitter.init = function() {
3137
+ if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
3138
+ this._events = /* @__PURE__ */ Object.create(null);
3139
+ this._eventsCount = 0;
3140
+ }
3141
+ this._maxListeners = this._maxListeners || void 0;
3142
+ };
3143
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
3144
+ if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
3145
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
3146
+ }
3147
+ this._maxListeners = n;
3148
+ return this;
3149
+ };
3150
+ function _getMaxListeners(that) {
3151
+ if (that._maxListeners === void 0)
3152
+ return EventEmitter.defaultMaxListeners;
3153
+ return that._maxListeners;
3154
+ }
3155
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
3156
+ return _getMaxListeners(this);
3157
+ };
3158
+ EventEmitter.prototype.emit = function emit(type) {
3159
+ var args = [];
3160
+ for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
3161
+ var doError = type === "error";
3162
+ var events2 = this._events;
3163
+ if (events2 !== void 0)
3164
+ doError = doError && events2.error === void 0;
3165
+ else if (!doError)
3166
+ return false;
3167
+ if (doError) {
3168
+ var er;
3169
+ if (args.length > 0)
3170
+ er = args[0];
3171
+ if (er instanceof Error) {
3172
+ throw er;
3173
+ }
3174
+ var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
3175
+ err.context = er;
3176
+ throw err;
3177
+ }
3178
+ var handler = events2[type];
3179
+ if (handler === void 0)
3180
+ return false;
3181
+ if (typeof handler === "function") {
3182
+ ReflectApply(handler, this, args);
3183
+ } else {
3184
+ var len = handler.length;
3185
+ var listeners = arrayClone(handler, len);
3186
+ for (var i = 0; i < len; ++i)
3187
+ ReflectApply(listeners[i], this, args);
3188
+ }
3189
+ return true;
3190
+ };
3191
+ function _addListener(target, type, listener, prepend) {
3192
+ var m;
3193
+ var events2;
3194
+ var existing;
3195
+ checkListener(listener);
3196
+ events2 = target._events;
3197
+ if (events2 === void 0) {
3198
+ events2 = target._events = /* @__PURE__ */ Object.create(null);
3199
+ target._eventsCount = 0;
3200
+ } else {
3201
+ if (events2.newListener !== void 0) {
3202
+ target.emit(
3203
+ "newListener",
3204
+ type,
3205
+ listener.listener ? listener.listener : listener
3206
+ );
3207
+ events2 = target._events;
3208
+ }
3209
+ existing = events2[type];
3210
+ }
3211
+ if (existing === void 0) {
3212
+ existing = events2[type] = listener;
3213
+ ++target._eventsCount;
3214
+ } else {
3215
+ if (typeof existing === "function") {
3216
+ existing = events2[type] = prepend ? [listener, existing] : [existing, listener];
3217
+ } else if (prepend) {
3218
+ existing.unshift(listener);
3219
+ } else {
3220
+ existing.push(listener);
3221
+ }
3222
+ m = _getMaxListeners(target);
3223
+ if (m > 0 && existing.length > m && !existing.warned) {
3224
+ existing.warned = true;
3225
+ var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
3226
+ w.name = "MaxListenersExceededWarning";
3227
+ w.emitter = target;
3228
+ w.type = type;
3229
+ w.count = existing.length;
3230
+ ProcessEmitWarning(w);
3231
+ }
3232
+ }
3233
+ return target;
3234
+ }
3235
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
3236
+ return _addListener(this, type, listener, false);
3237
+ };
3238
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
3239
+ EventEmitter.prototype.prependListener = function prependListener(type, listener) {
3240
+ return _addListener(this, type, listener, true);
3241
+ };
3242
+ function onceWrapper() {
3243
+ if (!this.fired) {
3244
+ this.target.removeListener(this.type, this.wrapFn);
3245
+ this.fired = true;
3246
+ if (arguments.length === 0)
3247
+ return this.listener.call(this.target);
3248
+ return this.listener.apply(this.target, arguments);
3249
+ }
3250
+ }
3251
+ function _onceWrap(target, type, listener) {
3252
+ var state2 = { fired: false, wrapFn: void 0, target, type, listener };
3253
+ var wrapped = onceWrapper.bind(state2);
3254
+ wrapped.listener = listener;
3255
+ state2.wrapFn = wrapped;
3256
+ return wrapped;
3257
+ }
3258
+ EventEmitter.prototype.once = function once3(type, listener) {
3259
+ checkListener(listener);
3260
+ this.on(type, _onceWrap(this, type, listener));
3261
+ return this;
3262
+ };
3263
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
3264
+ checkListener(listener);
3265
+ this.prependListener(type, _onceWrap(this, type, listener));
3266
+ return this;
3267
+ };
3268
+ EventEmitter.prototype.removeListener = function removeListener(type, listener) {
3269
+ var list, events2, position, i, originalListener;
3270
+ checkListener(listener);
3271
+ events2 = this._events;
3272
+ if (events2 === void 0)
3273
+ return this;
3274
+ list = events2[type];
3275
+ if (list === void 0)
3276
+ return this;
3277
+ if (list === listener || list.listener === listener) {
3278
+ if (--this._eventsCount === 0)
3279
+ this._events = /* @__PURE__ */ Object.create(null);
3280
+ else {
3281
+ delete events2[type];
3282
+ if (events2.removeListener)
3283
+ this.emit("removeListener", type, list.listener || listener);
3284
+ }
3285
+ } else if (typeof list !== "function") {
3286
+ position = -1;
3287
+ for (i = list.length - 1; i >= 0; i--) {
3288
+ if (list[i] === listener || list[i].listener === listener) {
3289
+ originalListener = list[i].listener;
3290
+ position = i;
3291
+ break;
3292
+ }
3293
+ }
3294
+ if (position < 0)
3295
+ return this;
3296
+ if (position === 0)
3297
+ list.shift();
3298
+ else {
3299
+ spliceOne(list, position);
3300
+ }
3301
+ if (list.length === 1)
3302
+ events2[type] = list[0];
3303
+ if (events2.removeListener !== void 0)
3304
+ this.emit("removeListener", type, originalListener || listener);
3305
+ }
3306
+ return this;
3307
+ };
3308
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
3309
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
3310
+ var listeners, events2, i;
3311
+ events2 = this._events;
3312
+ if (events2 === void 0)
3313
+ return this;
3314
+ if (events2.removeListener === void 0) {
3315
+ if (arguments.length === 0) {
3316
+ this._events = /* @__PURE__ */ Object.create(null);
3317
+ this._eventsCount = 0;
3318
+ } else if (events2[type] !== void 0) {
3319
+ if (--this._eventsCount === 0)
3320
+ this._events = /* @__PURE__ */ Object.create(null);
3321
+ else
3322
+ delete events2[type];
3323
+ }
3324
+ return this;
3325
+ }
3326
+ if (arguments.length === 0) {
3327
+ var keys = Object.keys(events2);
3328
+ var key;
3329
+ for (i = 0; i < keys.length; ++i) {
3330
+ key = keys[i];
3331
+ if (key === "removeListener") continue;
3332
+ this.removeAllListeners(key);
3333
+ }
3334
+ this.removeAllListeners("removeListener");
3335
+ this._events = /* @__PURE__ */ Object.create(null);
3336
+ this._eventsCount = 0;
3337
+ return this;
3338
+ }
3339
+ listeners = events2[type];
3340
+ if (typeof listeners === "function") {
3341
+ this.removeListener(type, listeners);
3342
+ } else if (listeners !== void 0) {
3343
+ for (i = listeners.length - 1; i >= 0; i--) {
3344
+ this.removeListener(type, listeners[i]);
3345
+ }
3346
+ }
3347
+ return this;
3348
+ };
3349
+ function _listeners(target, type, unwrap) {
3350
+ var events2 = target._events;
3351
+ if (events2 === void 0)
3352
+ return [];
3353
+ var evlistener = events2[type];
3354
+ if (evlistener === void 0)
3355
+ return [];
3356
+ if (typeof evlistener === "function")
3357
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
3358
+ return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
3359
+ }
3360
+ EventEmitter.prototype.listeners = function listeners(type) {
3361
+ return _listeners(this, type, true);
3362
+ };
3363
+ EventEmitter.prototype.rawListeners = function rawListeners(type) {
3364
+ return _listeners(this, type, false);
3365
+ };
3366
+ EventEmitter.listenerCount = function(emitter, type) {
3367
+ if (typeof emitter.listenerCount === "function") {
3368
+ return emitter.listenerCount(type);
3369
+ } else {
3370
+ return listenerCount.call(emitter, type);
3371
+ }
3372
+ };
3373
+ EventEmitter.prototype.listenerCount = listenerCount;
3374
+ function listenerCount(type) {
3375
+ var events2 = this._events;
3376
+ if (events2 !== void 0) {
3377
+ var evlistener = events2[type];
3378
+ if (typeof evlistener === "function") {
3379
+ return 1;
3380
+ } else if (evlistener !== void 0) {
3381
+ return evlistener.length;
3382
+ }
3383
+ }
3384
+ return 0;
3385
+ }
3386
+ EventEmitter.prototype.eventNames = function eventNames() {
3387
+ return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
3388
+ };
3389
+ function arrayClone(arr, n) {
3390
+ var copy = new Array(n);
3391
+ for (var i = 0; i < n; ++i)
3392
+ copy[i] = arr[i];
3393
+ return copy;
3394
+ }
3395
+ function spliceOne(list, index) {
3396
+ for (; index + 1 < list.length; index++)
3397
+ list[index] = list[index + 1];
3398
+ list.pop();
3399
+ }
3400
+ function unwrapListeners(arr) {
3401
+ var ret = new Array(arr.length);
3402
+ for (var i = 0; i < ret.length; ++i) {
3403
+ ret[i] = arr[i].listener || arr[i];
3404
+ }
3405
+ return ret;
3406
+ }
3407
+ function once2(emitter, name) {
3408
+ return new Promise(function(resolve, reject) {
3409
+ function errorListener(err) {
3410
+ emitter.removeListener(name, resolver);
3411
+ reject(err);
3412
+ }
3413
+ function resolver() {
3414
+ if (typeof emitter.removeListener === "function") {
3415
+ emitter.removeListener("error", errorListener);
3416
+ }
3417
+ resolve([].slice.call(arguments));
3418
+ }
3419
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
3420
+ if (name !== "error") {
3421
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
3422
+ }
3423
+ });
3424
+ }
3425
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
3426
+ if (typeof emitter.on === "function") {
3427
+ eventTargetAgnosticAddListener(emitter, "error", handler, flags);
3428
+ }
3429
+ }
3430
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
3431
+ if (typeof emitter.on === "function") {
3432
+ if (flags.once) {
3433
+ emitter.once(name, listener);
3434
+ } else {
3435
+ emitter.on(name, listener);
3436
+ }
3437
+ } else if (typeof emitter.addEventListener === "function") {
3438
+ emitter.addEventListener(name, function wrapListener(arg) {
3439
+ if (flags.once) {
3440
+ emitter.removeEventListener(name, wrapListener);
3441
+ }
3442
+ listener(arg);
3443
+ });
3444
+ } else {
3445
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
3446
+ }
3447
+ }
3448
+ return events.exports;
3449
+ }
3082
3450
  var streamBrowser;
3083
3451
  var hasRequiredStreamBrowser;
3084
3452
  function requireStreamBrowser() {
3085
3453
  if (hasRequiredStreamBrowser) return streamBrowser;
3086
3454
  hasRequiredStreamBrowser = 1;
3087
- streamBrowser = require$$0$1.EventEmitter;
3455
+ streamBrowser = requireEvents().EventEmitter;
3088
3456
  return streamBrowser;
3089
3457
  }
3090
3458
  var buffer = {};
@@ -3177,13 +3545,13 @@ function requireBuffer() {
3177
3545
  if (hasRequiredBuffer) return buffer;
3178
3546
  hasRequiredBuffer = 1;
3179
3547
  (function(exports$1) {
3180
- var base64 = requireBase64Js();
3181
- var ieee7542 = requireIeee754();
3182
- var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
3548
+ const base64 = requireBase64Js();
3549
+ const ieee7542 = requireIeee754();
3550
+ const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
3183
3551
  exports$1.Buffer = Buffer2;
3184
3552
  exports$1.SlowBuffer = SlowBuffer;
3185
3553
  exports$1.INSPECT_MAX_BYTES = 50;
3186
- var K_MAX_LENGTH = 2147483647;
3554
+ const K_MAX_LENGTH = 2147483647;
3187
3555
  exports$1.kMaxLength = K_MAX_LENGTH;
3188
3556
  Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
3189
3557
  if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
@@ -3193,8 +3561,8 @@ function requireBuffer() {
3193
3561
  }
3194
3562
  function typedArraySupport() {
3195
3563
  try {
3196
- var arr = new Uint8Array(1);
3197
- var proto = { foo: function() {
3564
+ const arr = new Uint8Array(1);
3565
+ const proto = { foo: function() {
3198
3566
  return 42;
3199
3567
  } };
3200
3568
  Object.setPrototypeOf(proto, Uint8Array.prototype);
@@ -3222,7 +3590,7 @@ function requireBuffer() {
3222
3590
  if (length > K_MAX_LENGTH) {
3223
3591
  throw new RangeError('The value "' + length + '" is invalid for option "size"');
3224
3592
  }
3225
- var buf = new Uint8Array(length);
3593
+ const buf = new Uint8Array(length);
3226
3594
  Object.setPrototypeOf(buf, Buffer2.prototype);
3227
3595
  return buf;
3228
3596
  }
@@ -3261,18 +3629,14 @@ function requireBuffer() {
3261
3629
  'The "value" argument must not be of type number. Received type number'
3262
3630
  );
3263
3631
  }
3264
- var valueOf = value.valueOf && value.valueOf();
3632
+ const valueOf = value.valueOf && value.valueOf();
3265
3633
  if (valueOf != null && valueOf !== value) {
3266
3634
  return Buffer2.from(valueOf, encodingOrOffset, length);
3267
3635
  }
3268
- var b = fromObject(value);
3636
+ const b = fromObject(value);
3269
3637
  if (b) return b;
3270
3638
  if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
3271
- return Buffer2.from(
3272
- value[Symbol.toPrimitive]("string"),
3273
- encodingOrOffset,
3274
- length
3275
- );
3639
+ return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
3276
3640
  }
3277
3641
  throw new TypeError(
3278
3642
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
@@ -3320,25 +3684,25 @@ function requireBuffer() {
3320
3684
  if (!Buffer2.isEncoding(encoding)) {
3321
3685
  throw new TypeError("Unknown encoding: " + encoding);
3322
3686
  }
3323
- var length = byteLength(string, encoding) | 0;
3324
- var buf = createBuffer(length);
3325
- var actual = buf.write(string, encoding);
3687
+ const length = byteLength(string, encoding) | 0;
3688
+ let buf = createBuffer(length);
3689
+ const actual = buf.write(string, encoding);
3326
3690
  if (actual !== length) {
3327
3691
  buf = buf.slice(0, actual);
3328
3692
  }
3329
3693
  return buf;
3330
3694
  }
3331
3695
  function fromArrayLike(array) {
3332
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
3333
- var buf = createBuffer(length);
3334
- for (var i = 0; i < length; i += 1) {
3696
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
3697
+ const buf = createBuffer(length);
3698
+ for (let i = 0; i < length; i += 1) {
3335
3699
  buf[i] = array[i] & 255;
3336
3700
  }
3337
3701
  return buf;
3338
3702
  }
3339
3703
  function fromArrayView(arrayView) {
3340
3704
  if (isInstance(arrayView, Uint8Array)) {
3341
- var copy = new Uint8Array(arrayView);
3705
+ const copy = new Uint8Array(arrayView);
3342
3706
  return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
3343
3707
  }
3344
3708
  return fromArrayLike(arrayView);
@@ -3350,7 +3714,7 @@ function requireBuffer() {
3350
3714
  if (array.byteLength < byteOffset + (length || 0)) {
3351
3715
  throw new RangeError('"length" is outside of buffer bounds');
3352
3716
  }
3353
- var buf;
3717
+ let buf;
3354
3718
  if (byteOffset === void 0 && length === void 0) {
3355
3719
  buf = new Uint8Array(array);
3356
3720
  } else if (length === void 0) {
@@ -3363,8 +3727,8 @@ function requireBuffer() {
3363
3727
  }
3364
3728
  function fromObject(obj) {
3365
3729
  if (Buffer2.isBuffer(obj)) {
3366
- var len = checked(obj.length) | 0;
3367
- var buf = createBuffer(len);
3730
+ const len = checked(obj.length) | 0;
3731
+ const buf = createBuffer(len);
3368
3732
  if (buf.length === 0) {
3369
3733
  return buf;
3370
3734
  }
@@ -3405,9 +3769,9 @@ function requireBuffer() {
3405
3769
  );
3406
3770
  }
3407
3771
  if (a === b) return 0;
3408
- var x = a.length;
3409
- var y = b.length;
3410
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
3772
+ let x = a.length;
3773
+ let y = b.length;
3774
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
3411
3775
  if (a[i] !== b[i]) {
3412
3776
  x = a[i];
3413
3777
  y = b[i];
@@ -3443,20 +3807,21 @@ function requireBuffer() {
3443
3807
  if (list.length === 0) {
3444
3808
  return Buffer2.alloc(0);
3445
3809
  }
3446
- var i;
3810
+ let i;
3447
3811
  if (length === void 0) {
3448
3812
  length = 0;
3449
3813
  for (i = 0; i < list.length; ++i) {
3450
3814
  length += list[i].length;
3451
3815
  }
3452
3816
  }
3453
- var buffer2 = Buffer2.allocUnsafe(length);
3454
- var pos = 0;
3817
+ const buffer2 = Buffer2.allocUnsafe(length);
3818
+ let pos = 0;
3455
3819
  for (i = 0; i < list.length; ++i) {
3456
- var buf = list[i];
3820
+ let buf = list[i];
3457
3821
  if (isInstance(buf, Uint8Array)) {
3458
3822
  if (pos + buf.length > buffer2.length) {
3459
- Buffer2.from(buf).copy(buffer2, pos);
3823
+ if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf);
3824
+ buf.copy(buffer2, pos);
3460
3825
  } else {
3461
3826
  Uint8Array.prototype.set.call(
3462
3827
  buffer2,
@@ -3485,10 +3850,10 @@ function requireBuffer() {
3485
3850
  'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
3486
3851
  );
3487
3852
  }
3488
- var len = string.length;
3489
- var mustMatch = arguments.length > 2 && arguments[2] === true;
3853
+ const len = string.length;
3854
+ const mustMatch = arguments.length > 2 && arguments[2] === true;
3490
3855
  if (!mustMatch && len === 0) return 0;
3491
- var loweredCase = false;
3856
+ let loweredCase = false;
3492
3857
  for (; ; ) {
3493
3858
  switch (encoding) {
3494
3859
  case "ascii":
@@ -3518,7 +3883,7 @@ function requireBuffer() {
3518
3883
  }
3519
3884
  Buffer2.byteLength = byteLength;
3520
3885
  function slowToString(encoding, start, end) {
3521
- var loweredCase = false;
3886
+ let loweredCase = false;
3522
3887
  if (start === void 0 || start < 0) {
3523
3888
  start = 0;
3524
3889
  }
@@ -3565,37 +3930,37 @@ function requireBuffer() {
3565
3930
  }
3566
3931
  Buffer2.prototype._isBuffer = true;
3567
3932
  function swap(b, n, m) {
3568
- var i = b[n];
3933
+ const i = b[n];
3569
3934
  b[n] = b[m];
3570
3935
  b[m] = i;
3571
3936
  }
3572
3937
  Buffer2.prototype.swap16 = function swap16() {
3573
- var len = this.length;
3938
+ const len = this.length;
3574
3939
  if (len % 2 !== 0) {
3575
3940
  throw new RangeError("Buffer size must be a multiple of 16-bits");
3576
3941
  }
3577
- for (var i = 0; i < len; i += 2) {
3942
+ for (let i = 0; i < len; i += 2) {
3578
3943
  swap(this, i, i + 1);
3579
3944
  }
3580
3945
  return this;
3581
3946
  };
3582
3947
  Buffer2.prototype.swap32 = function swap32() {
3583
- var len = this.length;
3948
+ const len = this.length;
3584
3949
  if (len % 4 !== 0) {
3585
3950
  throw new RangeError("Buffer size must be a multiple of 32-bits");
3586
3951
  }
3587
- for (var i = 0; i < len; i += 4) {
3952
+ for (let i = 0; i < len; i += 4) {
3588
3953
  swap(this, i, i + 3);
3589
3954
  swap(this, i + 1, i + 2);
3590
3955
  }
3591
3956
  return this;
3592
3957
  };
3593
3958
  Buffer2.prototype.swap64 = function swap64() {
3594
- var len = this.length;
3959
+ const len = this.length;
3595
3960
  if (len % 8 !== 0) {
3596
3961
  throw new RangeError("Buffer size must be a multiple of 64-bits");
3597
3962
  }
3598
- for (var i = 0; i < len; i += 8) {
3963
+ for (let i = 0; i < len; i += 8) {
3599
3964
  swap(this, i, i + 7);
3600
3965
  swap(this, i + 1, i + 6);
3601
3966
  swap(this, i + 2, i + 5);
@@ -3604,7 +3969,7 @@ function requireBuffer() {
3604
3969
  return this;
3605
3970
  };
3606
3971
  Buffer2.prototype.toString = function toString() {
3607
- var length = this.length;
3972
+ const length = this.length;
3608
3973
  if (length === 0) return "";
3609
3974
  if (arguments.length === 0) return utf8Slice(this, 0, length);
3610
3975
  return slowToString.apply(this, arguments);
@@ -3616,8 +3981,8 @@ function requireBuffer() {
3616
3981
  return Buffer2.compare(this, b) === 0;
3617
3982
  };
3618
3983
  Buffer2.prototype.inspect = function inspect() {
3619
- var str = "";
3620
- var max = exports$1.INSPECT_MAX_BYTES;
3984
+ let str = "";
3985
+ const max = exports$1.INSPECT_MAX_BYTES;
3621
3986
  str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
3622
3987
  if (this.length > max) str += " ... ";
3623
3988
  return "<Buffer " + str + ">";
@@ -3663,12 +4028,12 @@ function requireBuffer() {
3663
4028
  thisStart >>>= 0;
3664
4029
  thisEnd >>>= 0;
3665
4030
  if (this === target) return 0;
3666
- var x = thisEnd - thisStart;
3667
- var y = end - start;
3668
- var len = Math.min(x, y);
3669
- var thisCopy = this.slice(thisStart, thisEnd);
3670
- var targetCopy = target.slice(start, end);
3671
- for (var i = 0; i < len; ++i) {
4031
+ let x = thisEnd - thisStart;
4032
+ let y = end - start;
4033
+ const len = Math.min(x, y);
4034
+ const thisCopy = this.slice(thisStart, thisEnd);
4035
+ const targetCopy = target.slice(start, end);
4036
+ for (let i = 0; i < len; ++i) {
3672
4037
  if (thisCopy[i] !== targetCopy[i]) {
3673
4038
  x = thisCopy[i];
3674
4039
  y = targetCopy[i];
@@ -3723,9 +4088,9 @@ function requireBuffer() {
3723
4088
  throw new TypeError("val must be string, number or Buffer");
3724
4089
  }
3725
4090
  function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
3726
- var indexSize = 1;
3727
- var arrLength = arr.length;
3728
- var valLength = val.length;
4091
+ let indexSize = 1;
4092
+ let arrLength = arr.length;
4093
+ let valLength = val.length;
3729
4094
  if (encoding !== void 0) {
3730
4095
  encoding = String(encoding).toLowerCase();
3731
4096
  if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
@@ -3745,9 +4110,9 @@ function requireBuffer() {
3745
4110
  return buf.readUInt16BE(i2 * indexSize);
3746
4111
  }
3747
4112
  }
3748
- var i;
4113
+ let i;
3749
4114
  if (dir) {
3750
- var foundIndex = -1;
4115
+ let foundIndex = -1;
3751
4116
  for (i = byteOffset; i < arrLength; i++) {
3752
4117
  if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
3753
4118
  if (foundIndex === -1) foundIndex = i;
@@ -3760,8 +4125,8 @@ function requireBuffer() {
3760
4125
  } else {
3761
4126
  if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
3762
4127
  for (i = byteOffset; i >= 0; i--) {
3763
- var found = true;
3764
- for (var j = 0; j < valLength; j++) {
4128
+ let found = true;
4129
+ for (let j = 0; j < valLength; j++) {
3765
4130
  if (read(arr, i + j) !== read(val, j)) {
3766
4131
  found = false;
3767
4132
  break;
@@ -3783,7 +4148,7 @@ function requireBuffer() {
3783
4148
  };
3784
4149
  function hexWrite(buf, string, offset, length) {
3785
4150
  offset = Number(offset) || 0;
3786
- var remaining = buf.length - offset;
4151
+ const remaining = buf.length - offset;
3787
4152
  if (!length) {
3788
4153
  length = remaining;
3789
4154
  } else {
@@ -3792,12 +4157,13 @@ function requireBuffer() {
3792
4157
  length = remaining;
3793
4158
  }
3794
4159
  }
3795
- var strLen = string.length;
4160
+ const strLen = string.length;
3796
4161
  if (length > strLen / 2) {
3797
4162
  length = strLen / 2;
3798
4163
  }
3799
- for (var i = 0; i < length; ++i) {
3800
- var parsed = parseInt(string.substr(i * 2, 2), 16);
4164
+ let i;
4165
+ for (i = 0; i < length; ++i) {
4166
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
3801
4167
  if (numberIsNaN(parsed)) return i;
3802
4168
  buf[offset + i] = parsed;
3803
4169
  }
@@ -3838,13 +4204,13 @@ function requireBuffer() {
3838
4204
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
3839
4205
  );
3840
4206
  }
3841
- var remaining = this.length - offset;
4207
+ const remaining = this.length - offset;
3842
4208
  if (length === void 0 || length > remaining) length = remaining;
3843
4209
  if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
3844
4210
  throw new RangeError("Attempt to write outside buffer bounds");
3845
4211
  }
3846
4212
  if (!encoding) encoding = "utf8";
3847
- var loweredCase = false;
4213
+ let loweredCase = false;
3848
4214
  for (; ; ) {
3849
4215
  switch (encoding) {
3850
4216
  case "hex":
@@ -3885,14 +4251,14 @@ function requireBuffer() {
3885
4251
  }
3886
4252
  function utf8Slice(buf, start, end) {
3887
4253
  end = Math.min(buf.length, end);
3888
- var res = [];
3889
- var i = start;
4254
+ const res = [];
4255
+ let i = start;
3890
4256
  while (i < end) {
3891
- var firstByte = buf[i];
3892
- var codePoint = null;
3893
- var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
4257
+ const firstByte = buf[i];
4258
+ let codePoint = null;
4259
+ let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
3894
4260
  if (i + bytesPerSequence <= end) {
3895
- var secondByte, thirdByte, fourthByte, tempCodePoint;
4261
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
3896
4262
  switch (bytesPerSequence) {
3897
4263
  case 1:
3898
4264
  if (firstByte < 128) {
@@ -3943,14 +4309,14 @@ function requireBuffer() {
3943
4309
  }
3944
4310
  return decodeCodePointsArray(res);
3945
4311
  }
3946
- var MAX_ARGUMENTS_LENGTH = 4096;
4312
+ const MAX_ARGUMENTS_LENGTH = 4096;
3947
4313
  function decodeCodePointsArray(codePoints) {
3948
- var len = codePoints.length;
4314
+ const len = codePoints.length;
3949
4315
  if (len <= MAX_ARGUMENTS_LENGTH) {
3950
4316
  return String.fromCharCode.apply(String, codePoints);
3951
4317
  }
3952
- var res = "";
3953
- var i = 0;
4318
+ let res = "";
4319
+ let i = 0;
3954
4320
  while (i < len) {
3955
4321
  res += String.fromCharCode.apply(
3956
4322
  String,
@@ -3960,41 +4326,41 @@ function requireBuffer() {
3960
4326
  return res;
3961
4327
  }
3962
4328
  function asciiSlice(buf, start, end) {
3963
- var ret = "";
4329
+ let ret = "";
3964
4330
  end = Math.min(buf.length, end);
3965
- for (var i = start; i < end; ++i) {
4331
+ for (let i = start; i < end; ++i) {
3966
4332
  ret += String.fromCharCode(buf[i] & 127);
3967
4333
  }
3968
4334
  return ret;
3969
4335
  }
3970
4336
  function latin1Slice(buf, start, end) {
3971
- var ret = "";
4337
+ let ret = "";
3972
4338
  end = Math.min(buf.length, end);
3973
- for (var i = start; i < end; ++i) {
4339
+ for (let i = start; i < end; ++i) {
3974
4340
  ret += String.fromCharCode(buf[i]);
3975
4341
  }
3976
4342
  return ret;
3977
4343
  }
3978
4344
  function hexSlice(buf, start, end) {
3979
- var len = buf.length;
4345
+ const len = buf.length;
3980
4346
  if (!start || start < 0) start = 0;
3981
4347
  if (!end || end < 0 || end > len) end = len;
3982
- var out = "";
3983
- for (var i = start; i < end; ++i) {
4348
+ let out = "";
4349
+ for (let i = start; i < end; ++i) {
3984
4350
  out += hexSliceLookupTable[buf[i]];
3985
4351
  }
3986
4352
  return out;
3987
4353
  }
3988
4354
  function utf16leSlice(buf, start, end) {
3989
- var bytes = buf.slice(start, end);
3990
- var res = "";
3991
- for (var i = 0; i < bytes.length - 1; i += 2) {
4355
+ const bytes = buf.slice(start, end);
4356
+ let res = "";
4357
+ for (let i = 0; i < bytes.length - 1; i += 2) {
3992
4358
  res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
3993
4359
  }
3994
4360
  return res;
3995
4361
  }
3996
4362
  Buffer2.prototype.slice = function slice(start, end) {
3997
- var len = this.length;
4363
+ const len = this.length;
3998
4364
  start = ~~start;
3999
4365
  end = end === void 0 ? len : ~~end;
4000
4366
  if (start < 0) {
@@ -4010,7 +4376,7 @@ function requireBuffer() {
4010
4376
  end = len;
4011
4377
  }
4012
4378
  if (end < start) end = start;
4013
- var newBuf = this.subarray(start, end);
4379
+ const newBuf = this.subarray(start, end);
4014
4380
  Object.setPrototypeOf(newBuf, Buffer2.prototype);
4015
4381
  return newBuf;
4016
4382
  };
@@ -4022,9 +4388,9 @@ function requireBuffer() {
4022
4388
  offset = offset >>> 0;
4023
4389
  byteLength2 = byteLength2 >>> 0;
4024
4390
  if (!noAssert) checkOffset(offset, byteLength2, this.length);
4025
- var val = this[offset];
4026
- var mul = 1;
4027
- var i = 0;
4391
+ let val = this[offset];
4392
+ let mul = 1;
4393
+ let i = 0;
4028
4394
  while (++i < byteLength2 && (mul *= 256)) {
4029
4395
  val += this[offset + i] * mul;
4030
4396
  }
@@ -4036,8 +4402,8 @@ function requireBuffer() {
4036
4402
  if (!noAssert) {
4037
4403
  checkOffset(offset, byteLength2, this.length);
4038
4404
  }
4039
- var val = this[offset + --byteLength2];
4040
- var mul = 1;
4405
+ let val = this[offset + --byteLength2];
4406
+ let mul = 1;
4041
4407
  while (byteLength2 > 0 && (mul *= 256)) {
4042
4408
  val += this[offset + --byteLength2] * mul;
4043
4409
  }
@@ -4068,13 +4434,37 @@ function requireBuffer() {
4068
4434
  if (!noAssert) checkOffset(offset, 4, this.length);
4069
4435
  return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
4070
4436
  };
4437
+ Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
4438
+ offset = offset >>> 0;
4439
+ validateNumber(offset, "offset");
4440
+ const first = this[offset];
4441
+ const last = this[offset + 7];
4442
+ if (first === void 0 || last === void 0) {
4443
+ boundsError(offset, this.length - 8);
4444
+ }
4445
+ const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
4446
+ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
4447
+ return BigInt(lo) + (BigInt(hi) << BigInt(32));
4448
+ });
4449
+ Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
4450
+ offset = offset >>> 0;
4451
+ validateNumber(offset, "offset");
4452
+ const first = this[offset];
4453
+ const last = this[offset + 7];
4454
+ if (first === void 0 || last === void 0) {
4455
+ boundsError(offset, this.length - 8);
4456
+ }
4457
+ const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
4458
+ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
4459
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo);
4460
+ });
4071
4461
  Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
4072
4462
  offset = offset >>> 0;
4073
4463
  byteLength2 = byteLength2 >>> 0;
4074
4464
  if (!noAssert) checkOffset(offset, byteLength2, this.length);
4075
- var val = this[offset];
4076
- var mul = 1;
4077
- var i = 0;
4465
+ let val = this[offset];
4466
+ let mul = 1;
4467
+ let i = 0;
4078
4468
  while (++i < byteLength2 && (mul *= 256)) {
4079
4469
  val += this[offset + i] * mul;
4080
4470
  }
@@ -4086,9 +4476,9 @@ function requireBuffer() {
4086
4476
  offset = offset >>> 0;
4087
4477
  byteLength2 = byteLength2 >>> 0;
4088
4478
  if (!noAssert) checkOffset(offset, byteLength2, this.length);
4089
- var i = byteLength2;
4090
- var mul = 1;
4091
- var val = this[offset + --i];
4479
+ let i = byteLength2;
4480
+ let mul = 1;
4481
+ let val = this[offset + --i];
4092
4482
  while (i > 0 && (mul *= 256)) {
4093
4483
  val += this[offset + --i] * mul;
4094
4484
  }
@@ -4105,13 +4495,13 @@ function requireBuffer() {
4105
4495
  Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
4106
4496
  offset = offset >>> 0;
4107
4497
  if (!noAssert) checkOffset(offset, 2, this.length);
4108
- var val = this[offset] | this[offset + 1] << 8;
4498
+ const val = this[offset] | this[offset + 1] << 8;
4109
4499
  return val & 32768 ? val | 4294901760 : val;
4110
4500
  };
4111
4501
  Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
4112
4502
  offset = offset >>> 0;
4113
4503
  if (!noAssert) checkOffset(offset, 2, this.length);
4114
- var val = this[offset + 1] | this[offset] << 8;
4504
+ const val = this[offset + 1] | this[offset] << 8;
4115
4505
  return val & 32768 ? val | 4294901760 : val;
4116
4506
  };
4117
4507
  Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
@@ -4124,6 +4514,29 @@ function requireBuffer() {
4124
4514
  if (!noAssert) checkOffset(offset, 4, this.length);
4125
4515
  return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
4126
4516
  };
4517
+ Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
4518
+ offset = offset >>> 0;
4519
+ validateNumber(offset, "offset");
4520
+ const first = this[offset];
4521
+ const last = this[offset + 7];
4522
+ if (first === void 0 || last === void 0) {
4523
+ boundsError(offset, this.length - 8);
4524
+ }
4525
+ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
4526
+ return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
4527
+ });
4528
+ Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
4529
+ offset = offset >>> 0;
4530
+ validateNumber(offset, "offset");
4531
+ const first = this[offset];
4532
+ const last = this[offset + 7];
4533
+ if (first === void 0 || last === void 0) {
4534
+ boundsError(offset, this.length - 8);
4535
+ }
4536
+ const val = (first << 24) + // Overflow
4537
+ this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
4538
+ return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
4539
+ });
4127
4540
  Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
4128
4541
  offset = offset >>> 0;
4129
4542
  if (!noAssert) checkOffset(offset, 4, this.length);
@@ -4154,11 +4567,11 @@ function requireBuffer() {
4154
4567
  offset = offset >>> 0;
4155
4568
  byteLength2 = byteLength2 >>> 0;
4156
4569
  if (!noAssert) {
4157
- var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
4570
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
4158
4571
  checkInt(this, value, offset, byteLength2, maxBytes, 0);
4159
4572
  }
4160
- var mul = 1;
4161
- var i = 0;
4573
+ let mul = 1;
4574
+ let i = 0;
4162
4575
  this[offset] = value & 255;
4163
4576
  while (++i < byteLength2 && (mul *= 256)) {
4164
4577
  this[offset + i] = value / mul & 255;
@@ -4170,11 +4583,11 @@ function requireBuffer() {
4170
4583
  offset = offset >>> 0;
4171
4584
  byteLength2 = byteLength2 >>> 0;
4172
4585
  if (!noAssert) {
4173
- var maxBytes = Math.pow(2, 8 * byteLength2) - 1;
4586
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
4174
4587
  checkInt(this, value, offset, byteLength2, maxBytes, 0);
4175
4588
  }
4176
- var i = byteLength2 - 1;
4177
- var mul = 1;
4589
+ let i = byteLength2 - 1;
4590
+ let mul = 1;
4178
4591
  this[offset + i] = value & 255;
4179
4592
  while (--i >= 0 && (mul *= 256)) {
4180
4593
  this[offset + i] = value / mul & 255;
@@ -4224,16 +4637,62 @@ function requireBuffer() {
4224
4637
  this[offset + 3] = value & 255;
4225
4638
  return offset + 4;
4226
4639
  };
4640
+ function wrtBigUInt64LE(buf, value, offset, min, max) {
4641
+ checkIntBI(value, min, max, buf, offset, 7);
4642
+ let lo = Number(value & BigInt(4294967295));
4643
+ buf[offset++] = lo;
4644
+ lo = lo >> 8;
4645
+ buf[offset++] = lo;
4646
+ lo = lo >> 8;
4647
+ buf[offset++] = lo;
4648
+ lo = lo >> 8;
4649
+ buf[offset++] = lo;
4650
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
4651
+ buf[offset++] = hi;
4652
+ hi = hi >> 8;
4653
+ buf[offset++] = hi;
4654
+ hi = hi >> 8;
4655
+ buf[offset++] = hi;
4656
+ hi = hi >> 8;
4657
+ buf[offset++] = hi;
4658
+ return offset;
4659
+ }
4660
+ function wrtBigUInt64BE(buf, value, offset, min, max) {
4661
+ checkIntBI(value, min, max, buf, offset, 7);
4662
+ let lo = Number(value & BigInt(4294967295));
4663
+ buf[offset + 7] = lo;
4664
+ lo = lo >> 8;
4665
+ buf[offset + 6] = lo;
4666
+ lo = lo >> 8;
4667
+ buf[offset + 5] = lo;
4668
+ lo = lo >> 8;
4669
+ buf[offset + 4] = lo;
4670
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
4671
+ buf[offset + 3] = hi;
4672
+ hi = hi >> 8;
4673
+ buf[offset + 2] = hi;
4674
+ hi = hi >> 8;
4675
+ buf[offset + 1] = hi;
4676
+ hi = hi >> 8;
4677
+ buf[offset] = hi;
4678
+ return offset + 8;
4679
+ }
4680
+ Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
4681
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
4682
+ });
4683
+ Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
4684
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
4685
+ });
4227
4686
  Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
4228
4687
  value = +value;
4229
4688
  offset = offset >>> 0;
4230
4689
  if (!noAssert) {
4231
- var limit = Math.pow(2, 8 * byteLength2 - 1);
4690
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
4232
4691
  checkInt(this, value, offset, byteLength2, limit - 1, -limit);
4233
4692
  }
4234
- var i = 0;
4235
- var mul = 1;
4236
- var sub = 0;
4693
+ let i = 0;
4694
+ let mul = 1;
4695
+ let sub = 0;
4237
4696
  this[offset] = value & 255;
4238
4697
  while (++i < byteLength2 && (mul *= 256)) {
4239
4698
  if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
@@ -4247,12 +4706,12 @@ function requireBuffer() {
4247
4706
  value = +value;
4248
4707
  offset = offset >>> 0;
4249
4708
  if (!noAssert) {
4250
- var limit = Math.pow(2, 8 * byteLength2 - 1);
4709
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
4251
4710
  checkInt(this, value, offset, byteLength2, limit - 1, -limit);
4252
4711
  }
4253
- var i = byteLength2 - 1;
4254
- var mul = 1;
4255
- var sub = 0;
4712
+ let i = byteLength2 - 1;
4713
+ let mul = 1;
4714
+ let sub = 0;
4256
4715
  this[offset + i] = value & 255;
4257
4716
  while (--i >= 0 && (mul *= 256)) {
4258
4717
  if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
@@ -4307,6 +4766,12 @@ function requireBuffer() {
4307
4766
  this[offset + 3] = value & 255;
4308
4767
  return offset + 4;
4309
4768
  };
4769
+ Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
4770
+ return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
4771
+ });
4772
+ Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
4773
+ return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
4774
+ });
4310
4775
  function checkIEEE754(buf, value, offset, ext, max, min) {
4311
4776
  if (offset + ext > buf.length) throw new RangeError("Index out of range");
4312
4777
  if (offset < 0) throw new RangeError("Index out of range");
@@ -4359,7 +4824,7 @@ function requireBuffer() {
4359
4824
  if (target.length - targetStart < end - start) {
4360
4825
  end = target.length - targetStart + start;
4361
4826
  }
4362
- var len = end - start;
4827
+ const len = end - start;
4363
4828
  if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
4364
4829
  this.copyWithin(targetStart, start, end);
4365
4830
  } else {
@@ -4388,7 +4853,7 @@ function requireBuffer() {
4388
4853
  throw new TypeError("Unknown encoding: " + encoding);
4389
4854
  }
4390
4855
  if (val.length === 1) {
4391
- var code = val.charCodeAt(0);
4856
+ const code = val.charCodeAt(0);
4392
4857
  if (encoding === "utf8" && code < 128 || encoding === "latin1") {
4393
4858
  val = code;
4394
4859
  }
@@ -4407,14 +4872,14 @@ function requireBuffer() {
4407
4872
  start = start >>> 0;
4408
4873
  end = end === void 0 ? this.length : end >>> 0;
4409
4874
  if (!val) val = 0;
4410
- var i;
4875
+ let i;
4411
4876
  if (typeof val === "number") {
4412
4877
  for (i = start; i < end; ++i) {
4413
4878
  this[i] = val;
4414
4879
  }
4415
4880
  } else {
4416
- var bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);
4417
- var len = bytes.length;
4881
+ const bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);
4882
+ const len = bytes.length;
4418
4883
  if (len === 0) {
4419
4884
  throw new TypeError('The value "' + val + '" is invalid for argument "value"');
4420
4885
  }
@@ -4424,7 +4889,122 @@ function requireBuffer() {
4424
4889
  }
4425
4890
  return this;
4426
4891
  };
4427
- var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
4892
+ const errors2 = {};
4893
+ function E(sym, getMessage, Base) {
4894
+ errors2[sym] = class NodeError extends Base {
4895
+ constructor() {
4896
+ super();
4897
+ Object.defineProperty(this, "message", {
4898
+ value: getMessage.apply(this, arguments),
4899
+ writable: true,
4900
+ configurable: true
4901
+ });
4902
+ this.name = `${this.name} [${sym}]`;
4903
+ this.stack;
4904
+ delete this.name;
4905
+ }
4906
+ get code() {
4907
+ return sym;
4908
+ }
4909
+ set code(value) {
4910
+ Object.defineProperty(this, "code", {
4911
+ configurable: true,
4912
+ enumerable: true,
4913
+ value,
4914
+ writable: true
4915
+ });
4916
+ }
4917
+ toString() {
4918
+ return `${this.name} [${sym}]: ${this.message}`;
4919
+ }
4920
+ };
4921
+ }
4922
+ E(
4923
+ "ERR_BUFFER_OUT_OF_BOUNDS",
4924
+ function(name) {
4925
+ if (name) {
4926
+ return `${name} is outside of buffer bounds`;
4927
+ }
4928
+ return "Attempt to access memory outside buffer bounds";
4929
+ },
4930
+ RangeError
4931
+ );
4932
+ E(
4933
+ "ERR_INVALID_ARG_TYPE",
4934
+ function(name, actual) {
4935
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
4936
+ },
4937
+ TypeError
4938
+ );
4939
+ E(
4940
+ "ERR_OUT_OF_RANGE",
4941
+ function(str, range, input) {
4942
+ let msg = `The value of "${str}" is out of range.`;
4943
+ let received = input;
4944
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
4945
+ received = addNumericalSeparator(String(input));
4946
+ } else if (typeof input === "bigint") {
4947
+ received = String(input);
4948
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
4949
+ received = addNumericalSeparator(received);
4950
+ }
4951
+ received += "n";
4952
+ }
4953
+ msg += ` It must be ${range}. Received ${received}`;
4954
+ return msg;
4955
+ },
4956
+ RangeError
4957
+ );
4958
+ function addNumericalSeparator(val) {
4959
+ let res = "";
4960
+ let i = val.length;
4961
+ const start = val[0] === "-" ? 1 : 0;
4962
+ for (; i >= start + 4; i -= 3) {
4963
+ res = `_${val.slice(i - 3, i)}${res}`;
4964
+ }
4965
+ return `${val.slice(0, i)}${res}`;
4966
+ }
4967
+ function checkBounds(buf, offset, byteLength2) {
4968
+ validateNumber(offset, "offset");
4969
+ if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
4970
+ boundsError(offset, buf.length - (byteLength2 + 1));
4971
+ }
4972
+ }
4973
+ function checkIntBI(value, min, max, buf, offset, byteLength2) {
4974
+ if (value > max || value < min) {
4975
+ const n = typeof min === "bigint" ? "n" : "";
4976
+ let range;
4977
+ {
4978
+ if (min === 0 || min === BigInt(0)) {
4979
+ range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
4980
+ } else {
4981
+ range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
4982
+ }
4983
+ }
4984
+ throw new errors2.ERR_OUT_OF_RANGE("value", range, value);
4985
+ }
4986
+ checkBounds(buf, offset, byteLength2);
4987
+ }
4988
+ function validateNumber(value, name) {
4989
+ if (typeof value !== "number") {
4990
+ throw new errors2.ERR_INVALID_ARG_TYPE(name, "number", value);
4991
+ }
4992
+ }
4993
+ function boundsError(value, length, type) {
4994
+ if (Math.floor(value) !== value) {
4995
+ validateNumber(value, type);
4996
+ throw new errors2.ERR_OUT_OF_RANGE("offset", "an integer", value);
4997
+ }
4998
+ if (length < 0) {
4999
+ throw new errors2.ERR_BUFFER_OUT_OF_BOUNDS();
5000
+ }
5001
+ throw new errors2.ERR_OUT_OF_RANGE(
5002
+ "offset",
5003
+ `>= ${0} and <= ${length}`,
5004
+ value
5005
+ );
5006
+ }
5007
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
4428
5008
  function base64clean(str) {
4429
5009
  str = str.split("=")[0];
4430
5010
  str = str.trim().replace(INVALID_BASE64_RE, "");
@@ -4436,11 +5016,11 @@ function requireBuffer() {
4436
5016
  }
4437
5017
  function utf8ToBytes(string, units) {
4438
5018
  units = units || Infinity;
4439
- var codePoint;
4440
- var length = string.length;
4441
- var leadSurrogate = null;
4442
- var bytes = [];
4443
- for (var i = 0; i < length; ++i) {
5019
+ let codePoint;
5020
+ const length = string.length;
5021
+ let leadSurrogate = null;
5022
+ const bytes = [];
5023
+ for (let i = 0; i < length; ++i) {
4444
5024
  codePoint = string.charCodeAt(i);
4445
5025
  if (codePoint > 55295 && codePoint < 57344) {
4446
5026
  if (!leadSurrogate) {
@@ -4495,16 +5075,16 @@ function requireBuffer() {
4495
5075
  return bytes;
4496
5076
  }
4497
5077
  function asciiToBytes(str) {
4498
- var byteArray = [];
4499
- for (var i = 0; i < str.length; ++i) {
5078
+ const byteArray = [];
5079
+ for (let i = 0; i < str.length; ++i) {
4500
5080
  byteArray.push(str.charCodeAt(i) & 255);
4501
5081
  }
4502
5082
  return byteArray;
4503
5083
  }
4504
5084
  function utf16leToBytes(str, units) {
4505
- var c, hi, lo;
4506
- var byteArray = [];
4507
- for (var i = 0; i < str.length; ++i) {
5085
+ let c, hi, lo;
5086
+ const byteArray = [];
5087
+ for (let i = 0; i < str.length; ++i) {
4508
5088
  if ((units -= 2) < 0) break;
4509
5089
  c = str.charCodeAt(i);
4510
5090
  hi = c >> 8;
@@ -4518,7 +5098,8 @@ function requireBuffer() {
4518
5098
  return base64.toByteArray(base64clean(str));
4519
5099
  }
4520
5100
  function blitBuffer(src, dst, offset, length) {
4521
- for (var i = 0; i < length; ++i) {
5101
+ let i;
5102
+ for (i = 0; i < length; ++i) {
4522
5103
  if (i + offset >= dst.length || i >= src.length) break;
4523
5104
  dst[i + offset] = src[i];
4524
5105
  }
@@ -4530,17 +5111,23 @@ function requireBuffer() {
4530
5111
  function numberIsNaN(obj) {
4531
5112
  return obj !== obj;
4532
5113
  }
4533
- var hexSliceLookupTable = (function() {
4534
- var alphabet = "0123456789abcdef";
4535
- var table = new Array(256);
4536
- for (var i = 0; i < 16; ++i) {
4537
- var i16 = i * 16;
4538
- for (var j = 0; j < 16; ++j) {
5114
+ const hexSliceLookupTable = (function() {
5115
+ const alphabet = "0123456789abcdef";
5116
+ const table = new Array(256);
5117
+ for (let i = 0; i < 16; ++i) {
5118
+ const i16 = i * 16;
5119
+ for (let j = 0; j < 16; ++j) {
4539
5120
  table[i16 + j] = alphabet[i] + alphabet[j];
4540
5121
  }
4541
5122
  }
4542
5123
  return table;
4543
5124
  })();
5125
+ function defineBigIntMethod(fn) {
5126
+ return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
5127
+ }
5128
+ function BufferBigIntNotDefined() {
5129
+ throw new Error("BigInt not supported");
5130
+ }
4544
5131
  })(buffer);
4545
5132
  return buffer;
4546
5133
  }
@@ -5628,7 +6215,7 @@ function require_stream_readable() {
5628
6215
  _stream_readable = Readable;
5629
6216
  var Duplex;
5630
6217
  Readable.ReadableState = ReadableState;
5631
- require$$0$1.EventEmitter;
6218
+ requireEvents().EventEmitter;
5632
6219
  var EElistenerCount = function EElistenerCount2(emitter, type) {
5633
6220
  return emitter.listeners(type).length;
5634
6221
  };