@kiloscribe/inscription-sdk
Version:
SDK for inscribing files on Hedera
7,139 lines • 247 kB
JavaScript
import { c as global$3, d as process$1$2 } from "./index-DreXNew1.js";
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global$3 !== "undefined" ? global$3 : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var dist = {};
var hasRequiredDist;
function requireDist() {
if (hasRequiredDist) return dist;
hasRequiredDist = 1;
(function(exports) {
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
var buffer = {};
var base64Js = {};
base64Js.byteLength = byteLength;
base64Js.toByteArray = toByteArray;
base64Js.fromByteArray = fromByteArray;
var lookup = [];
var revLookup = [];
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i];
revLookup[code.charCodeAt(i)] = i;
}
revLookup["-".charCodeAt(0)] = 62;
revLookup["_".charCodeAt(0)] = 63;
function getLens(b64) {
var len2 = b64.length;
if (len2 % 4 > 0) {
throw new Error("Invalid string. Length must be a multiple of 4");
}
var validLen = b64.indexOf("=");
if (validLen === -1) validLen = len2;
var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
return [validLen, placeHoldersLen];
}
function byteLength(b64) {
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function _byteLength(b64, validLen, placeHoldersLen) {
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function toByteArray(b64) {
var tmp;
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
var curByte = 0;
var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
var i2;
for (i2 = 0; i2 < len2; i2 += 4) {
tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
arr[curByte++] = tmp >> 16 & 255;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 2) {
tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
arr[curByte++] = tmp & 255;
}
if (placeHoldersLen === 1) {
tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
arr[curByte++] = tmp >> 8 & 255;
arr[curByte++] = tmp & 255;
}
return arr;
}
function tripletToBase64(num) {
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
}
function encodeChunk(uint8, start, end) {
var tmp;
var output = [];
for (var i2 = start; i2 < end; i2 += 3) {
tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
output.push(tripletToBase64(tmp));
}
return output.join("");
}
function fromByteArray(uint8) {
var tmp;
var len2 = uint8.length;
var extraBytes = len2 % 3;
var parts = [];
var maxChunkLength = 16383;
for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
}
if (extraBytes === 1) {
tmp = uint8[len2 - 1];
parts.push(
lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
);
} else if (extraBytes === 2) {
tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
parts.push(
lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
);
}
return parts.join("");
}
var ieee754 = {};
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
ieee754.read = function(buffer2, offset, isLE, mLen, nBytes) {
var e, m;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var nBits = -7;
var i2 = isLE ? nBytes - 1 : 0;
var d = isLE ? -1 : 1;
var s = buffer2[offset + i2];
i2 += d;
e = s & (1 << -nBits) - 1;
s >>= -nBits;
nBits += eLen;
for (; nBits > 0; e = e * 256 + buffer2[offset + i2], i2 += d, nBits -= 8) {
}
m = e & (1 << -nBits) - 1;
e >>= -nBits;
nBits += mLen;
for (; nBits > 0; m = m * 256 + buffer2[offset + i2], i2 += d, nBits -= 8) {
}
if (e === 0) {
e = 1 - eBias;
} else if (e === eMax) {
return m ? NaN : (s ? -1 : 1) * Infinity;
} else {
m = m + Math.pow(2, mLen);
e = e - eBias;
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
};
ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
var e, m, c;
var eLen = nBytes * 8 - mLen - 1;
var eMax = (1 << eLen) - 1;
var eBias = eMax >> 1;
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
var i2 = isLE ? 0 : nBytes - 1;
var d = isLE ? 1 : -1;
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
value = Math.abs(value);
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0;
e = eMax;
} else {
e = Math.floor(Math.log(value) / Math.LN2);
if (value * (c = Math.pow(2, -e)) < 1) {
e--;
c *= 2;
}
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
}
if (value * c >= 2) {
e++;
c /= 2;
}
if (e + eBias >= eMax) {
m = 0;
e = eMax;
} else if (e + eBias >= 1) {
m = (value * c - 1) * Math.pow(2, mLen);
e = e + eBias;
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
e = 0;
}
}
for (; mLen >= 8; buffer2[offset + i2] = m & 255, i2 += d, m /= 256, mLen -= 8) {
}
e = e << mLen | m;
eLen += mLen;
for (; eLen > 0; buffer2[offset + i2] = e & 255, i2 += d, e /= 256, eLen -= 8) {
}
buffer2[offset + i2 - d] |= s * 128;
};
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
(function(exports2) {
const base64 = base64Js;
const ieee754$1 = ieee754;
const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
exports2.Buffer = Buffer2;
exports2.SlowBuffer = SlowBuffer;
exports2.INSPECT_MAX_BYTES = 50;
const K_MAX_LENGTH = 2147483647;
exports2.kMaxLength = K_MAX_LENGTH;
const { Uint8Array: GlobalUint8Array, ArrayBuffer: GlobalArrayBuffer, SharedArrayBuffer: GlobalSharedArrayBuffer } = globalThis;
Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
console.error(
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
);
}
function typedArraySupport() {
try {
const arr = new GlobalUint8Array(1);
const proto = { foo: function() {
return 42;
} };
Object.setPrototypeOf(proto, GlobalUint8Array.prototype);
Object.setPrototypeOf(arr, proto);
return arr.foo() === 42;
} catch (e) {
return false;
}
}
Object.defineProperty(Buffer2.prototype, "parent", {
enumerable: true,
get: function() {
if (!Buffer2.isBuffer(this)) return void 0;
return this.buffer;
}
});
Object.defineProperty(Buffer2.prototype, "offset", {
enumerable: true,
get: function() {
if (!Buffer2.isBuffer(this)) return void 0;
return this.byteOffset;
}
});
function createBuffer(length) {
if (length > K_MAX_LENGTH) {
throw new RangeError('The value "' + length + '" is invalid for option "size"');
}
const buf = new GlobalUint8Array(length);
Object.setPrototypeOf(buf, Buffer2.prototype);
return buf;
}
function Buffer2(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
if (typeof encodingOrOffset === "string") {
throw new TypeError(
'The "string" argument must be of type string. Received type number'
);
}
return allocUnsafe(arg);
}
return from(arg, encodingOrOffset, length);
}
Buffer2.poolSize = 8192;
function from(value, encodingOrOffset, length) {
if (typeof value === "string") {
return fromString(value, encodingOrOffset);
}
if (GlobalArrayBuffer.isView(value)) {
return fromArrayView(value);
}
if (value == null) {
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
);
}
if (isInstance(value, GlobalArrayBuffer) || value && isInstance(value.buffer, GlobalArrayBuffer)) {
return fromArrayBuffer(value, encodingOrOffset, length);
}
if (typeof GlobalSharedArrayBuffer !== "undefined" && (isInstance(value, GlobalSharedArrayBuffer) || value && isInstance(value.buffer, GlobalSharedArrayBuffer))) {
return fromArrayBuffer(value, encodingOrOffset, length);
}
if (typeof value === "number") {
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
);
}
const valueOf = value.valueOf && value.valueOf();
if (valueOf != null && valueOf !== value) {
return Buffer2.from(valueOf, encodingOrOffset, length);
}
const b = fromObject(value);
if (b) return b;
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
return Buffer2.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
}
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
);
}
Buffer2.from = function(value, encodingOrOffset, length) {
return from(value, encodingOrOffset, length);
};
Object.setPrototypeOf(Buffer2.prototype, GlobalUint8Array.prototype);
Object.setPrototypeOf(Buffer2, GlobalUint8Array);
function assertSize(size) {
if (typeof size !== "number") {
throw new TypeError('"size" argument must be of type number');
} else if (size < 0) {
throw new RangeError('The value "' + size + '" is invalid for option "size"');
}
}
function alloc(size, fill, encoding) {
assertSize(size);
if (size <= 0) {
return createBuffer(size);
}
if (fill !== void 0) {
return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
}
return createBuffer(size);
}
Buffer2.alloc = function(size, fill, encoding) {
return alloc(size, fill, encoding);
};
function allocUnsafe(size) {
assertSize(size);
return createBuffer(size < 0 ? 0 : checked(size) | 0);
}
Buffer2.allocUnsafe = function(size) {
return allocUnsafe(size);
};
Buffer2.allocUnsafeSlow = function(size) {
return allocUnsafe(size);
};
function fromString(string, encoding) {
if (typeof encoding !== "string" || encoding === "") {
encoding = "utf8";
}
if (!Buffer2.isEncoding(encoding)) {
throw new TypeError("Unknown encoding: " + encoding);
}
const length = byteLength2(string, encoding) | 0;
let buf = createBuffer(length);
const actual = buf.write(string, encoding);
if (actual !== length) {
buf = buf.slice(0, actual);
}
return buf;
}
function fromArrayLike(array) {
const length = array.length < 0 ? 0 : checked(array.length) | 0;
const buf = createBuffer(length);
for (let i2 = 0; i2 < length; i2 += 1) {
buf[i2] = array[i2] & 255;
}
return buf;
}
function fromArrayView(arrayView) {
if (isInstance(arrayView, GlobalUint8Array)) {
const copy = new GlobalUint8Array(arrayView);
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
}
return fromArrayLike(arrayView);
}
function fromArrayBuffer(array, byteOffset, length) {
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('"offset" is outside of buffer bounds');
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('"length" is outside of buffer bounds');
}
let buf;
if (byteOffset === void 0 && length === void 0) {
buf = new GlobalUint8Array(array);
} else if (length === void 0) {
buf = new GlobalUint8Array(array, byteOffset);
} else {
buf = new GlobalUint8Array(array, byteOffset, length);
}
Object.setPrototypeOf(buf, Buffer2.prototype);
return buf;
}
function fromObject(obj) {
if (Buffer2.isBuffer(obj)) {
const len2 = checked(obj.length) | 0;
const buf = createBuffer(len2);
if (buf.length === 0) {
return buf;
}
obj.copy(buf, 0, 0, len2);
return buf;
}
if (obj.length !== void 0) {
if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
return createBuffer(0);
}
return fromArrayLike(obj);
}
if (obj.type === "Buffer" && Array.isArray(obj.data)) {
return fromArrayLike(obj.data);
}
}
function checked(length) {
if (length >= K_MAX_LENGTH) {
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
}
return length | 0;
}
function SlowBuffer(length) {
if (+length != length) {
length = 0;
}
return Buffer2.alloc(+length);
}
Buffer2.isBuffer = function isBuffer(b) {
return b != null && b._isBuffer === true && b !== Buffer2.prototype;
};
Buffer2.compare = function compare(a, b) {
if (isInstance(a, GlobalUint8Array)) a = Buffer2.from(a, a.offset, a.byteLength);
if (isInstance(b, GlobalUint8Array)) b = Buffer2.from(b, b.offset, b.byteLength);
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
);
}
if (a === b) return 0;
let x = a.length;
let y = b.length;
for (let i2 = 0, len2 = Math.min(x, y); i2 < len2; ++i2) {
if (a[i2] !== b[i2]) {
x = a[i2];
y = b[i2];
break;
}
}
if (x < y) return -1;
if (y < x) return 1;
return 0;
};
Buffer2.isEncoding = function isEncoding(encoding) {
switch (String(encoding).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "latin1":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return true;
default:
return false;
}
};
Buffer2.concat = function concat(list, length) {
if (!Array.isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers');
}
if (list.length === 0) {
return Buffer2.alloc(0);
}
let i2;
if (length === void 0) {
length = 0;
for (i2 = 0; i2 < list.length; ++i2) {
length += list[i2].length;
}
}
const buffer2 = Buffer2.allocUnsafe(length);
let pos = 0;
for (i2 = 0; i2 < list.length; ++i2) {
let buf = list[i2];
if (isInstance(buf, GlobalUint8Array)) {
if (pos + buf.length > buffer2.length) {
if (!Buffer2.isBuffer(buf)) buf = Buffer2.from(buf);
buf.copy(buffer2, pos);
} else {
GlobalUint8Array.prototype.set.call(
buffer2,
buf,
pos
);
}
} else if (!Buffer2.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers');
} else {
buf.copy(buffer2, pos);
}
pos += buf.length;
}
return buffer2;
};
function byteLength2(string, encoding) {
if (Buffer2.isBuffer(string)) {
return string.length;
}
if (GlobalArrayBuffer.isView(string) || isInstance(string, GlobalArrayBuffer)) {
return string.byteLength;
}
if (typeof string !== "string") {
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string
);
}
const len2 = string.length;
const mustMatch = arguments.length > 2 && arguments[2] === true;
if (!mustMatch && len2 === 0) return 0;
let loweredCase = false;
for (; ; ) {
switch (encoding) {
case "ascii":
case "latin1":
case "binary":
return len2;
case "utf8":
case "utf-8":
return utf8ToBytes(string).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return len2 * 2;
case "hex":
return len2 >>> 1;
case "base64":
return base64ToBytes(string).length;
default:
if (loweredCase) {
return mustMatch ? -1 : utf8ToBytes(string).length;
}
encoding = ("" + encoding).toLowerCase();
loweredCase = true;
}
}
}
Buffer2.byteLength = byteLength2;
function slowToString(encoding, start, end) {
let loweredCase = false;
if (start === void 0 || start < 0) {
start = 0;
}
if (start > this.length) {
return "";
}
if (end === void 0 || end > this.length) {
end = this.length;
}
if (end <= 0) {
return "";
}
end >>>= 0;
start >>>= 0;
if (end <= start) {
return "";
}
if (!encoding) encoding = "utf8";
while (true) {
switch (encoding) {
case "hex":
return hexSlice(this, start, end);
case "utf8":
case "utf-8":
return utf8Slice(this, start, end);
case "ascii":
return asciiSlice(this, start, end);
case "latin1":
case "binary":
return latin1Slice(this, start, end);
case "base64":
return base64Slice(this, start, end);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return utf16leSlice(this, start, end);
default:
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
encoding = (encoding + "").toLowerCase();
loweredCase = true;
}
}
}
Buffer2.prototype._isBuffer = true;
function swap(b, n, m) {
const i2 = b[n];
b[n] = b[m];
b[m] = i2;
}
Buffer2.prototype.swap16 = function swap16() {
const len2 = this.length;
if (len2 % 2 !== 0) {
throw new RangeError("Buffer size must be a multiple of 16-bits");
}
for (let i2 = 0; i2 < len2; i2 += 2) {
swap(this, i2, i2 + 1);
}
return this;
};
Buffer2.prototype.swap32 = function swap32() {
const len2 = this.length;
if (len2 % 4 !== 0) {
throw new RangeError("Buffer size must be a multiple of 32-bits");
}
for (let i2 = 0; i2 < len2; i2 += 4) {
swap(this, i2, i2 + 3);
swap(this, i2 + 1, i2 + 2);
}
return this;
};
Buffer2.prototype.swap64 = function swap64() {
const len2 = this.length;
if (len2 % 8 !== 0) {
throw new RangeError("Buffer size must be a multiple of 64-bits");
}
for (let i2 = 0; i2 < len2; i2 += 8) {
swap(this, i2, i2 + 7);
swap(this, i2 + 1, i2 + 6);
swap(this, i2 + 2, i2 + 5);
swap(this, i2 + 3, i2 + 4);
}
return this;
};
Buffer2.prototype.toString = function toString() {
const length = this.length;
if (length === 0) return "";
if (arguments.length === 0) return utf8Slice(this, 0, length);
return slowToString.apply(this, arguments);
};
Buffer2.prototype.toLocaleString = Buffer2.prototype.toString;
Buffer2.prototype.equals = function equals(b) {
if (!Buffer2.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
if (this === b) return true;
return Buffer2.compare(this, b) === 0;
};
Buffer2.prototype.inspect = function inspect() {
let str = "";
const max2 = exports2.INSPECT_MAX_BYTES;
str = this.toString("hex", 0, max2).replace(/(.{2})/g, "$1 ").trim();
if (this.length > max2) str += " ... ";
return "<Buffer " + str + ">";
};
if (customInspectSymbol) {
Buffer2.prototype[customInspectSymbol] = Buffer2.prototype.inspect;
}
Buffer2.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
if (isInstance(target, GlobalUint8Array)) {
target = Buffer2.from(target, target.offset, target.byteLength);
}
if (!Buffer2.isBuffer(target)) {
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
);
}
if (start === void 0) {
start = 0;
}
if (end === void 0) {
end = target ? target.length : 0;
}
if (thisStart === void 0) {
thisStart = 0;
}
if (thisEnd === void 0) {
thisEnd = this.length;
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError("out of range index");
}
if (thisStart >= thisEnd && start >= end) {
return 0;
}
if (thisStart >= thisEnd) {
return -1;
}
if (start >= end) {
return 1;
}
start >>>= 0;
end >>>= 0;
thisStart >>>= 0;
thisEnd >>>= 0;
if (this === target) return 0;
let x = thisEnd - thisStart;
let y = end - start;
const len2 = Math.min(x, y);
const thisCopy = this.slice(thisStart, thisEnd);
const targetCopy = target.slice(start, end);
for (let i2 = 0; i2 < len2; ++i2) {
if (thisCopy[i2] !== targetCopy[i2]) {
x = thisCopy[i2];
y = targetCopy[i2];
break;
}
}
if (x < y) return -1;
if (y < x) return 1;
return 0;
};
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
if (buffer2.length === 0) return -1;
if (typeof byteOffset === "string") {
encoding = byteOffset;
byteOffset = 0;
} else if (byteOffset > 2147483647) {
byteOffset = 2147483647;
} else if (byteOffset < -2147483648) {
byteOffset = -2147483648;
}
byteOffset = +byteOffset;
if (numberIsNaN(byteOffset)) {
byteOffset = dir ? 0 : buffer2.length - 1;
}
if (byteOffset < 0) byteOffset = buffer2.length + byteOffset;
if (byteOffset >= buffer2.length) {
if (dir) return -1;
else byteOffset = buffer2.length - 1;
} else if (byteOffset < 0) {
if (dir) byteOffset = 0;
else return -1;
}
if (typeof val === "string") {
val = Buffer2.from(val, encoding);
}
if (Buffer2.isBuffer(val)) {
if (val.length === 0) {
return -1;
}
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir);
} else if (typeof val === "number") {
val = val & 255;
if (typeof GlobalUint8Array.prototype.indexOf === "function") {
if (dir) {
return GlobalUint8Array.prototype.indexOf.call(buffer2, val, byteOffset);
} else {
return GlobalUint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset);
}
}
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir);
}
throw new TypeError("val must be string, number or Buffer");
}
function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
let indexSize = 1;
let arrLength = arr.length;
let valLength = val.length;
if (encoding !== void 0) {
encoding = String(encoding).toLowerCase();
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
if (arr.length < 2 || val.length < 2) {
return -1;
}
indexSize = 2;
arrLength /= 2;
valLength /= 2;
byteOffset /= 2;
}
}
function read(buf, i3) {
if (indexSize === 1) {
return buf[i3];
} else {
return buf.readUInt16BE(i3 * indexSize);
}
}
let i2;
if (dir) {
let foundIndex = -1;
for (i2 = byteOffset; i2 < arrLength; i2++) {
if (read(arr, i2) === read(val, foundIndex === -1 ? 0 : i2 - foundIndex)) {
if (foundIndex === -1) foundIndex = i2;
if (i2 - foundIndex + 1 === valLength) return foundIndex * indexSize;
} else {
if (foundIndex !== -1) i2 -= i2 - foundIndex;
foundIndex = -1;
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
for (i2 = byteOffset; i2 >= 0; i2--) {
let found = true;
for (let j = 0; j < valLength; j++) {
if (read(arr, i2 + j) !== read(val, j)) {
found = false;
break;
}
}
if (found) return i2;
}
}
return -1;
}
Buffer2.prototype.includes = function includes(val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1;
};
Buffer2.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
};
Buffer2.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
};
function hexWrite(buf, string, offset, length) {
offset = Number(offset) || 0;
const remaining = buf.length - offset;
if (!length) {
length = remaining;
} else {
length = Number(length);
if (length > remaining) {
length = remaining;
}
}
const strLen = string.length;
if (length > strLen / 2) {
length = strLen / 2;
}
let i2;
for (i2 = 0; i2 < length; ++i2) {
const parsed = parseInt(string.substr(i2 * 2, 2), 16);
if (numberIsNaN(parsed)) return i2;
buf[offset + i2] = parsed;
}
return i2;
}
function utf8Write(buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
}
function asciiWrite(buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length);
}
function base64Write(buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length);
}
function ucs2Write(buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
}
Buffer2.prototype.write = function write(string, offset, length, encoding) {
if (offset === void 0) {
encoding = "utf8";
length = this.length;
offset = 0;
} else if (length === void 0 && typeof offset === "string") {
encoding = offset;
length = this.length;
offset = 0;
} else if (isFinite(offset)) {
offset = offset >>> 0;
if (isFinite(length)) {
length = length >>> 0;
if (encoding === void 0) encoding = "utf8";
} else {
encoding = length;
length = void 0;
}
} else {
throw new Error(
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
);
}
const remaining = this.length - offset;
if (length === void 0 || length > remaining) length = remaining;
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
throw new RangeError("Attempt to write outside buffer bounds");
}
if (!encoding) encoding = "utf8";
let loweredCase = false;
for (; ; ) {
switch (encoding) {
case "hex":
return hexWrite(this, string, offset, length);
case "utf8":
case "utf-8":
return utf8Write(this, string, offset, length);
case "ascii":
case "latin1":
case "binary":
return asciiWrite(this, string, offset, length);
case "base64":
return base64Write(this, string, offset, length);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return ucs2Write(this, string, offset, length);
default:
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
encoding = ("" + encoding).toLowerCase();
loweredCase = true;
}
}
};
Buffer2.prototype.toJSON = function toJSON() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
};
};
function base64Slice(buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf);
} else {
return base64.fromByteArray(buf.slice(start, end));
}
}
function utf8Slice(buf, start, end) {
end = Math.min(buf.length, end);
const res = [];
let i2 = start;
while (i2 < end) {
const firstByte = buf[i2];
let codePoint = null;
let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
if (i2 + bytesPerSequence <= end) {
let secondByte, thirdByte, fourthByte, tempCodePoint;
switch (bytesPerSequence) {
case 1:
if (firstByte < 128) {
codePoint = firstByte;
}
break;
case 2:
secondByte = buf[i2 + 1];
if ((secondByte & 192) === 128) {
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
if (tempCodePoint > 127) {
codePoint = tempCodePoint;
}
}
break;
case 3:
secondByte = buf[i2 + 1];
thirdByte = buf[i2 + 2];
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
codePoint = tempCodePoint;
}
}
break;
case 4:
secondByte = buf[i2 + 1];
thirdByte = buf[i2 + 2];
fourthByte = buf[i2 + 3];
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
codePoint = tempCodePoint;
}
}
}
}
if (codePoint === null) {
codePoint = 65533;
bytesPerSequence = 1;
} else if (codePoint > 65535) {
codePoint -= 65536;
res.push(codePoint >>> 10 & 1023 | 55296);
codePoint = 56320 | codePoint & 1023;
}
res.push(codePoint);
i2 += bytesPerSequence;
}
return decodeCodePointsArray(res);
}
const MAX_ARGUMENTS_LENGTH = 4096;
function decodeCodePointsArray(codePoints) {
const len2 = codePoints.length;
if (len2 <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints);
}
let res = "";
let i2 = 0;
while (i2 < len2) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i2, i2 += MAX_ARGUMENTS_LENGTH)
);
}
return res;
}
function asciiSlice(buf, start, end) {
let ret = "";
end = Math.min(buf.length, end);
for (let i2 = start; i2 < end; ++i2) {
ret += String.fromCharCode(buf[i2] & 127);
}
return ret;
}
function latin1Slice(buf, start, end) {
let ret = "";
end = Math.min(buf.length, end);
for (let i2 = start; i2 < end; ++i2) {
ret += String.fromCharCode(buf[i2]);
}
return ret;
}
function hexSlice(buf, start, end) {
const len2 = buf.length;
if (!start || start < 0) start = 0;
if (!end || end < 0 || end > len2) end = len2;
let out = "";
for (let i2 = start; i2 < end; ++i2) {
out += hexSliceLookupTable[buf[i2]];
}
return out;
}
function utf16leSlice(buf, start, end) {
const bytes = buf.slice(start, end);
let res = "";
for (let i2 = 0; i2 < bytes.length - 1; i2 += 2) {
res += String.fromCharCode(bytes[i2] + bytes[i2 + 1] * 256);
}
return res;
}
Buffer2.prototype.slice = function slice(start, end) {
const len2 = this.length;
start = ~~start;
end = end === void 0 ? len2 : ~~end;
if (start < 0) {
start += len2;
if (start < 0) start = 0;
} else if (start > len2) {
start = len2;
}
if (end < 0) {
end += len2;
if (end < 0) end = 0;
} else if (end > len2) {
end = len2;
}
if (end < start) end = start;
const newBuf = this.subarray(start, end);
Object.setPrototypeOf(newBuf, Buffer2.prototype);
return newBuf;
};
function checkOffset(offset, ext, length) {
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
}
Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) checkOffset(offset, byteLength3, this.length);
let val = this[offset];
let mul = 1;
let i2 = 0;
while (++i2 < byteLength3 && (mul *= 256)) {
val += this[offset + i2] * mul;
}
return val;
};
Buffer2.prototype.readUintBE = Buffer2.prototype.readUIntBE = function readUIntBE(offset, byteLength3, noAssert) {
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) {
checkOffset(offset, byteLength3, this.length);
}
let val = this[offset + --byteLength3];
let mul = 1;
while (byteLength3 > 0 && (mul *= 256)) {
val += this[offset + --byteLength3] * mul;
}
return val;
};
Buffer2.prototype.readUint8 = Buffer2.prototype.readUInt8 = function readUInt8(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 1, this.length);
return this[offset];
};
Buffer2.prototype.readUint16LE = Buffer2.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
return this[offset] | this[offset + 1] << 8;
};
Buffer2.prototype.readUint16BE = Buffer2.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
return this[offset] << 8 | this[offset + 1];
};
Buffer2.prototype.readUint32LE = Buffer2.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
};
Buffer2.prototype.readUint32BE = Buffer2.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
};
Buffer2.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
offset = offset >>> 0;
validateNumber(offset, "offset");
const first = this[offset];
const last = this[offset + 7];
if (first === void 0 || last === void 0) {
boundsError(offset, this.length - 8);
}
const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
return BigInt(lo) + (BigInt(hi) << BigInt(32));
});
Buffer2.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
offset = offset >>> 0;
validateNumber(offset, "offset");
const first = this[offset];
const last = this[offset + 7];
if (first === void 0 || last === void 0) {
boundsError(offset, this.length - 8);
}
const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
});
Buffer2.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) checkOffset(offset, byteLength3, this.length);
let val = this[offset];
let mul = 1;
let i2 = 0;
while (++i2 < byteLength3 && (mul *= 256)) {
val += this[offset + i2] * mul;
}
mul *= 128;
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
return val;
};
Buffer2.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) checkOffset(offset, byteLength3, this.length);
let i2 = byteLength3;
let mul = 1;
let val = this[offset + --i2];
while (i2 > 0 && (mul *= 256)) {
val += this[offset + --i2] * mul;
}
mul *= 128;
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
return val;
};
Buffer2.prototype.readInt8 = function readInt8(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 1, this.length);
if (!(this[offset] & 128)) return this[offset];
return (255 - this[offset] + 1) * -1;
};
Buffer2.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
const val = this[offset] | this[offset + 1] << 8;
return val & 32768 ? val | 4294901760 : val;
};
Buffer2.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 2, this.length);
const val = this[offset + 1] | this[offset] << 8;
return val & 32768 ? val | 4294901760 : val;
};
Buffer2.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
};
Buffer2.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
};
Buffer2.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
offset = offset >>> 0;
validateNumber(offset, "offset");
const first = this[offset];
const last = this[offset + 7];
if (first === void 0 || last === void 0) {
boundsError(offset, this.length - 8);
}
const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);
return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
});
Buffer2.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
offset = offset >>> 0;
validateNumber(offset, "offset");
const first = this[offset];
const last = this[offset + 7];
if (first === void 0 || last === void 0) {
boundsError(offset, this.length - 8);
}
const val = (first << 24) + // Overflow
this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
});
Buffer2.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return ieee754$1.read(this, offset, true, 23, 4);
};
Buffer2.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 4, this.length);
return ieee754$1.read(this, offset, false, 23, 4);
};
Buffer2.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 8, this.length);
return ieee754$1.read(this, offset, true, 52, 8);
};
Buffer2.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
offset = offset >>> 0;
if (!noAssert) checkOffset(offset, 8, this.length);
return ieee754$1.read(this, offset, false, 52, 8);
};
function checkInt(buf, value, offset, ext, max2, min2) {
if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (value > max2 || value < min2) throw new RangeError('"value" argument is out of bounds');
if (offset + ext > buf.length) throw new RangeError("Index out of range");
}
Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {
value = +value;
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) {
const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
checkInt(this, value, offset, byteLength3, maxBytes, 0);
}
let mul = 1;
let i2 = 0;
this[offset] = value & 255;
while (++i2 < byteLength3 && (mul *= 256)) {
this[offset + i2] = value / mul & 255;
}
return offset + byteLength3;
};
Buffer2.prototype.writeUintBE = Buffer2.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength3, noAssert) {
value = +value;
offset = offset >>> 0;
byteLength3 = byteLength3 >>> 0;
if (!noAssert) {
const maxBytes = Math.pow(2, 8 * byteLength3) - 1;
checkInt(this, value, offset, byteLength3, maxBytes, 0);
}
let i2 = byteLength3 - 1;
let mul = 1;
this[offset + i2] = value & 255;
while (--i2 >= 0 && (mul *= 256)) {
this[offset + i2] = value / mul & 255;
}
return offset + byteLength3;
};
Buffer2.prototype.writeUint8 = Buffer2.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
this[offset] = value & 255;
return offset + 1;
};
Buffer2.prototype.writeUint16LE = Buffer2.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
this[offset] = value & 255;
this[offset + 1] = value >>> 8;
return offset + 2;
};
Buffer2.prototype.writeUint16BE = Buffer2.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
this[offset] = value >>> 8;
this[offset + 1] = value & 255;
return offset + 2;
};
Buffer2.prototype.writeUint32LE = Buffer2.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
this[offset + 3] = value >>> 24;
this[offset + 2] = value >>> 16;
this[offset + 1] = value >>> 8;
this[offset] = value & 255;
return offset + 4;
};
Buffer2.prototype.writeUint32BE = Buffer2.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
this[offset] = value >>> 24;
this[offset + 1] = value >>> 16;
this[offset + 2] = value >>> 8;
this[offset + 3] = value & 255;
return offset + 4;
};
function wrtBigUInt64LE(buf, value, offset, min2, max2) {
checkIntBI(value, min2, max2, buf, offset, 7);
let lo = Number(value & BigInt(4294967295));
buf[offset++] = lo;
lo = lo >> 8;
buf[offset++] = lo;
lo = lo >> 8;
buf[offset++] = lo;
lo = lo >> 8;
buf[offset++] = lo;
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
buf[offset++] = hi;
hi = hi >> 8;
buf[offset++] = hi;
hi = hi >> 8;
buf[offset++] = hi;
hi = hi >> 8;
buf[offset++] = hi;
return offset;
}
function wrtBigUInt64BE(buf, value, offset, min2, max2) {
checkIntBI(value, min2, max2, buf, offset, 7);
let lo = Number(value & BigInt(4294967295));
buf[offset + 7] = lo;
lo = lo >> 8;
buf[offset + 6] = lo;
lo = lo >> 8;
buf[offset + 5] = lo;
lo = lo >> 8;
buf[offset + 4] = lo;
let hi = Number(value >> BigInt(32) & BigInt(4294967295));
buf[offset + 3] = hi;
hi = hi >> 8;
buf[offset + 2] = hi;
hi = hi >> 8;
buf[offset + 1] = hi;
hi = hi >> 8;
buf[offset] = hi;
return offset + 8;
}
Buffer2.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
});
Buffer2.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
});
Buffer2.prototype.writeIntLE = function writeIntLE(value, offset, byteLength3, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
const limit = Math.pow(2, 8 * byteLength3 - 1);
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
}
let i2 = 0;
let mul = 1;
let sub = 0;
this[offset] = value & 255;
while (++i2 < byteLength3 && (mul *= 256)) {
if (value < 0 && sub === 0 && this[offset + i2 - 1] !== 0) {
sub = 1;
}
this[offset + i2] = (value / mul >> 0) - sub & 255;
}
return offset + byteLength3;
};
Buffer2.prototype.writeIntBE = function writeIntBE(value, offset, byteLength3, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
const limit = Math.pow(2, 8 * byteLength3 - 1);
checkInt(this, value, offset, byteLength3, limit - 1, -limit);
}
let i2 = byteLength3 - 1;
let mul = 1;
let sub = 0;
this[offset + i2] = value & 255;
while (--i2 >= 0 && (mul *= 256)) {
if (value < 0 && sub === 0 && this[offset + i2 + 1] !== 0) {
sub = 1;
}
this[offset + i2] = (value / mul >> 0) - sub & 255;
}
return offset + byteLength3;
};
Buffer2.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
if (value < 0) value = 255 + value + 1;
this[offset] = value & 255;
return offset + 1;
};
Buffer2.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
this[offset] = value & 255;
this[offset + 1] = value >>> 8;
return offset + 2;
};
Buffer2.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
this[offset] = value >>> 8;
this[offset + 1] = value & 255;
return offset + 2;
};
Buffer2.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
this[offset] = value & 255;
this[offset + 1] = value >>> 8;
this[offset + 2] = value >>> 16;
this[offset + 3] = value >>> 24;
return offset + 4;
};
Buffer2.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
if (value < 0) value = 4294967295 + value + 1;
this[offset] = value >>> 24;
this[offset + 1] = value >>> 16;
this[offset + 2] = value >>> 8;
this[offset + 3] = value & 255;
return offset + 4;
};
Buffer2.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
});
Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
});
function checkIEEE754(buf, value, offset, ext, max2, min2) {
if (offset + ext > buf.length) throw new RangeError("Index out of range");
if (offset < 0) throw new RangeError("Index out of range");
}
function writeFloat(buf, value, offset, littleEndian, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
checkIEEE754(buf, value, offset, 4);
}
ieee754$1.write(buf, value, offset, littleEndian, 23, 4);
return offset + 4;
}
Buffer2.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert);
};
Buffer2.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert);
};
function writeDouble(buf, value, offset, littleEndian, noAssert) {
value = +value;
offset = offset >>> 0;
if (!noAssert) {
checkIEEE754(buf, value, offset, 8);
}
ieee754$1.write(buf, value, offset, littleEndian, 52, 8);
return offset + 8;
}
Buffer2.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert);
};
Buffer2.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert);
};
Buffer2.prototype.copy = function copy(target, targetStart, start, end) {
if (!Buffer2.isBuffer(target)) throw new TypeError("argument should be a Buffer");
if (!start) start = 0;
if (!end && end !== 0) end = this.length;
if (targetStart >= target.length) targetStart = target.length;
if (!targetStart) targetStart = 0;
if (end > 0 && end < start) end = start;
if (end === start) return 0;
if (target.length === 0 || this.length === 0) return 0;
if (targetStart < 0) {
throw new RangeError("targetStart out of bounds");
}
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
if (end < 0) throw new RangeError("sourceEnd out of bounds");
if (end > this.length) end = this.length;
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start;
}
const len2 = end - start;
if (this === target && typeof GlobalUint8Array.prototype.copyWithin === "function") {
this.copyWithin(targetStart, start, end);
} else {
GlobalUint8Array.prototype.set.call(
target,
this.subarray(start, end),
targetStart
);
}
return len2;
};
Buffer2.prototype.fill = function fill(val, start, end, encoding) {
if (typeof val === "string") {
if (typeof start === "string") {
encoding = start;
start = 0;
end = this.length;
} else if (typeof end === "string") {
encoding = end;
end = this.length;
}
if (encoding !== void 0 && typeof encoding !== "string") {
throw new TypeError("encoding must be a string");
}
if (typeof encoding === "string" && !Buffer2.isEncoding(encoding)) {
throw new TypeError("Unknown encoding: " + encoding);
}
if (val.length === 1) {
const code2 = val.charCodeAt(0);
if (encoding === "utf8" && code2 < 128 || encoding === "latin1") {
val = code2;
}
}
} else if (typeof val === "number") {
val = val & 255;
} else if (typeof val === "boolean") {
val = Number(val);
}
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError("Out of range index");
}
if (end <= start) {
return this;
}
start = start >>> 0;
end = end === void 0 ? this.length : end >>> 0;
if (!val) val = 0;
let i2;
if (typeof val === "number") {
for (i2 = start; i2 < end; ++i2) {
this[i2] = val;
}
} else {
const bytes = Buffer2.isBuffer(val) ? val : Buffer2.from(val, encoding);
const len2 = bytes.length;
if (len2 === 0) {
throw new TypeError('The value "' + val + '" is invalid for argument "value"');
}
for (i2 = 0; i2 < end - start; ++i2) {
this[i2 + start] = bytes[i2 % len2];
}
}
return this;
};
const errors = {};
function E(sym, getMessage, Base) {
errors[sym] = class NodeError extends Base {
constructor() {
super();
Object.defineProperty(this, "message", {
value: getMessage.apply(this, arguments),
writable: true,
configurable: true
});
this.name = `${this.name} [${sym}]`;
this.stack;
delete this.name;
}
get code() {
return sym;
}
set code(value) {
Object.defineProperty(this, "code", {
configurable: true,
enumerable: true,
value,
writable: true
});
}
toString() {
return `${this.name} [${sym}]: ${this.message}`;
}
};
}
E(
"ERR_BUFFER_OUT_OF_BOUNDS",
function(name) {
if (name) {
return `${name} is outside of buffer bounds`;
}
return "Attempt to access memory outside buffer bounds";
},
RangeError
);
E(
"ERR_INVALID_ARG_TYPE",
function(name, actual) {
return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
},
TypeError
);
E(
"ERR_OUT_OF_RANGE",
function(str, range2, input) {
let msg = `The value of "${str}" is out of range.`;
let received = input;
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
received = addNumericalSeparator(String(input));
} else if (typeof input === "bigint") {
received = String(input);
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
received = addNumericalSeparator(received);
}
received += "n";
}
msg += ` It must be ${range2}. Received ${received}`;
return msg;
},
RangeError
);
function addNumericalSeparator(val) {
let res = "";
let i2 = val.length;
const start = val[0] === "-" ? 1 : 0;
for (; i2 >= start + 4; i2 -= 3) {
res = `_${val.slice(i2 - 3, i2)}${res}`;
}
return `${val.slice(0, i2)}${res}`;
}
function checkBounds(buf, offset, byteLength3) {
validateNumber(offset, "offset");
if (buf[offset] === void 0 || buf[offset + byteLength3] === void 0) {
boundsError(offset, buf.length - (byteLength3 + 1));
}
}
function checkIntBI(value, min2, max2, buf, offset, byteLength3) {
if (value > max2 || value < min2) {
const n = typeof min2 === "bigint" ? "n" : "";
let range2;
{
if (min2 === 0 || min2 === BigInt(0)) {
range2 = `>= 0${n} and < 2${n} ** ${(byteLength3 + 1) * 8}${n}`;
} else {
range2 = `>= -(2${n} ** ${(byteLength3 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength3 + 1) * 8 - 1}${n}`;
}
}
throw new errors.ERR_OUT_OF_RANGE("value", range2, value);
}
checkBounds(buf, offset, byteLength3);
}
function validateNumber(value, name) {
if (typeof value !== "number") {
throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
}
}
function boundsError(value, length, type2) {
if (Math.floor(value) !== value) {
validateNumber(value, type2);
throw new errors.ERR_OUT_OF_RANGE("offset", "an integer", value);
}
if (length < 0) {
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
}
throw new errors.ERR_OUT_OF_RANGE(
"offset",
`>= ${0} and <= ${length}`,
value
);
}
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
function base64clean(str) {
str = str.split("=")[0];
str = str.trim().replace(INVALID_BASE64_RE, "");
if (str.length < 2) return "";
while (str.length % 4 !== 0) {
str = str + "=";
}
return str;
}
function utf8ToBytes(string, units) {
units = units || Infinity;
let codePoint;
const length = string.length;
let leadSurrogate = null;
const bytes = [];
for (let i2 = 0; i2 < length; ++i2) {
codePoint = string.charCodeAt(i2);
if (codePoint > 55295 && codePoint < 57344) {
if (!leadSurrogate) {
if (codePoint > 56319) {
if ((units -= 3) > -1) bytes.push(239, 191, 189);
continue;
} else if (i2 + 1 === length) {
if ((units -= 3) > -1) bytes.push(239, 191, 189);
continue;
}
leadSurrogate = codePoint;
continue;
}
if (codePoint < 56320) {
if ((units -= 3) > -1) bytes.push(239, 191, 189);
leadSurrogate = codePoint;
continue;
}
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
} else if (leadSurrogate) {
if ((units -= 3) > -1) bytes.push(239, 191, 189);
}
leadSurrogate = null;
if (codePoint < 128) {
if ((units -= 1) < 0) break;
bytes.push(codePoint);
} else if (codePoint < 2048) {
if ((units -= 2) < 0) break;
bytes.push(
codePoint >> 6 | 192,
codePoint & 63 | 128
);
} else if (codePoint < 65536) {
if ((units -= 3) < 0) break;
bytes.push(
codePoint >> 12 | 224,
codePoint >> 6 & 63 | 128,
codePoint & 63 | 128
);
} else if (codePoint < 1114112) {
if ((units -= 4) < 0) break;
bytes.push(
codePoint >> 18 | 240,
codePoint >> 12 & 63 | 128,
codePoint >> 6 & 63 | 128,
codePoint & 63 | 128
);
} else {
throw new Error("Invalid code point");
}
}
return bytes;
}
function asciiToBytes(str) {
const byteArray = [];
for (let i2 = 0; i2 < str.length; ++i2) {
byteArray.push(str.charCodeAt(i2) & 255);
}
return byteArray;
}
function utf16leToBytes(str, units) {
let c, hi, lo;
const byteArray = [];
for (let i2 = 0; i2 < str.length; ++i2) {
if ((units -= 2) < 0) break;
c = str.charCodeAt(i2);
hi = c >> 8;
lo = c % 256;
byteArray.push(lo);
byteArray.push(hi);
}
return byteArray;
}
function base64ToBytes(str) {
return base64.toByteArray(base64clean(str));
}
function blitBuffer(src, dst, offset, length) {
let i2;
for (i2 = 0; i2 < length; ++i2) {
if (i2 + offset >= dst.length || i2 >= src.length) break;
dst[i2 + offset] = src[i2];
}
return i2;
}
function isInstance(obj, type2) {
return obj instanceof type2 || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type2.name;
}
function numberIsNaN(obj) {
return obj !== obj;
}
const hexSliceLookupTable = function() {
const alphabet = "0123456789abcdef";
const table = new Array(256);
for (let i2 = 0; i2 < 16; ++i2) {
const i16 = i2 * 16;
for (let j = 0; j < 16; ++j) {
table[i16 + j] = alphabet[i2] + alphabet[j];
}
}
return table;
}();
function defineBigIntMethod(fn) {
return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
}
function BufferBigIntNotDefined() {
throw new Error("BigInt not supported");
}
})(buffer);
const Buffer = buffer.Buffer;
exports.Blob = buffer.Blob;
exports.BlobOptions = buffer.BlobOptions;
exports.Buffer = buffer.Buffer;
exports.File = buffer.File;
exports.FileOptions = buffer.FileOptions;
exports.INSPECT_MAX_BYTES = buffer.INSPECT_MAX_BYTES;
exports.SlowBuffer = buffer.SlowBuffer;
exports.TranscodeEncoding = buffer.TranscodeEncoding;
exports.atob = buffer.atob;
exports.btoa = buffer.btoa;
exports.constants = buffer.constants;
exports.default = Buffer;
exports.isAscii = buffer.isAscii;
exports.isUtf8 = buffer.isUtf8;
exports.kMaxLength = buffer.kMaxLength;
exports.kStringMaxLength = buffer.kStringMaxLength;
exports.resolveObjectURL = buffer.resolveObjectURL;
exports.transcode = buffer.transcode;
})(dist);
return dist;
}
var events = { exports: {} };
var hasRequiredEvents;
function requireEvents() {
if (hasRequiredEvents) return events.exports;
hasRequiredEvents = 1;
var R = typeof Reflect === "object" ? Reflect : null;
var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
return Function.prototype.apply.call(target, receiver, args);
};
var ReflectOwnKeys;
if (R && typeof R.ownKeys === "function") {
ReflectOwnKeys = R.ownKeys;
} else if (Object.getOwnPropertySymbols) {
ReflectOwnKeys = function ReflectOwnKeys2(target) {
return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
};
} else {
ReflectOwnKeys = function ReflectOwnKeys2(target) {
return Object.getOwnPropertyNames(target);
};
}
function ProcessEmitWarning(warning) {
if (console && console.warn) console.warn(warning);
}
var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
return value !== value;
};
function EventEmitter() {
EventEmitter.init.call(this);
}
events.exports = EventEmitter;
events.exports.once = once;
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = void 0;
EventEmitter.prototype._eventsCount = 0;
EventEmitter.prototype._maxListeners = void 0;
var defaultMaxListeners = 10;
function checkListener(listener) {
if (typeof listener !== "function") {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
}
Object.defineProperty(EventEmitter, "defaultMaxListeners", {
enumerable: true,
get: function() {
return defaultMaxListeners;
},
set: function(arg) {
if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
}
defaultMaxListeners = arg;
}
});
EventEmitter.init = function() {
if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || void 0;
};
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
}
this._maxListeners = n;
return this;
};
function _getMaxListeners(that) {
if (that._maxListeners === void 0)
return EventEmitter.defaultMaxListeners;
return that._maxListeners;
}
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
return _getMaxListeners(this);
};
EventEmitter.prototype.emit = function emit(type2) {
var args = [];
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
var doError = type2 === "error";
var events2 = this._events;
if (events2 !== void 0)
doError = doError && events2.error === void 0;
else if (!doError)
return false;
if (doError) {
var er;
if (args.length > 0)
er = args[0];
if (er instanceof Error) {
throw er;
}
var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
err.context = er;
throw err;
}
var handler = events2[type2];
if (handler === void 0)
return false;
if (typeof handler === "function") {
ReflectApply(handler, this, args);
} else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
ReflectApply(listeners[i], this, args);
}
return true;
};
function _addListener(target, type2, listener, prepend) {
var m;
var events2;
var existing;
checkListener(listener);
events2 = target._events;
if (events2 === void 0) {
events2 = target._events = /* @__PURE__ */ Object.create(null);
target._eventsCount = 0;
} else {
if (events2.newListener !== void 0) {
target.emit(
"newListener",
type2,
listener.listener ? listener.listener : listener
);
events2 = target._events;
}
existing = events2[type2];
}
if (existing === void 0) {
existing = events2[type2] = listener;
++target._eventsCount;
} else {
if (typeof existing === "function") {
existing = events2[type2] = prepend ? [listener, existing] : [existing, listener];
} else if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
m = _getMaxListeners(target);
if (m > 0 && existing.length > m && !existing.warned) {
existing.warned = true;
var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
w.name = "MaxListenersExceededWarning";
w.emitter = target;
w.type = type2;
w.count = existing.length;
ProcessEmitWarning(w);
}
}
return target;
}
EventEmitter.prototype.addListener = function addListener(type2, listener) {
return _addListener(this, type2, listener, false);
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
return _addListener(this, type2, listener, true);
};
function onceWrapper() {
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
if (arguments.length === 0)
return this.listener.call(this.target);
return this.listener.apply(this.target, arguments);
}
}
function _onceWrap(target, type2, listener) {
var state2 = { fired: false, wrapFn: void 0, target, type: type2, listener };
var wrapped = onceWrapper.bind(state2);
wrapped.listener = listener;
state2.wrapFn = wrapped;
return wrapped;
}
EventEmitter.prototype.once = function once2(type2, listener) {
checkListener(listener);
this.on(type2, _onceWrap(this, type2, listener));
return this;
};
EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
checkListener(listener);
this.prependListener(type2, _onceWrap(this, type2, listener));
return this;
};
EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
var list, events2, position, i, originalListener;
checkListener(listener);
events2 = this._events;
if (events2 === void 0)
return this;
list = events2[type2];
if (list === void 0)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = /* @__PURE__ */ Object.create(null);
else {
delete events2[type2];
if (events2.removeListener)
this.emit("removeListener", type2, list.listener || listener);
}
} else if (typeof list !== "function") {
position = -1;
for (i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
spliceOne(list, position);
}
if (list.length === 1)
events2[type2] = list[0];
if (events2.removeListener !== void 0)
this.emit("removeListener", type2, originalListener || listener);
}
return this;
};
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
var listeners, events2, i;
events2 = this._events;
if (events2 === void 0)
return this;
if (events2.removeListener === void 0) {
if (arguments.length === 0) {
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
} else if (events2[type2] !== void 0) {
if (--this._eventsCount === 0)
this._events = /* @__PURE__ */ Object.create(null);
else
delete events2[type2];
}
return this;
}
if (arguments.length === 0) {
var keys = Object.keys(events2);
var key;
for (i = 0; i < keys.length; ++i) {
key = keys[i];
if (key === "removeListener") continue;
this.removeAllListeners(key);
}
this.removeAllListeners("removeListener");
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
return this;
}
listeners = events2[type2];
if (typeof listeners === "function") {
this.removeListener(type2, listeners);
} else if (listeners !== void 0) {
for (i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type2, listeners[i]);
}
}
return this;
};
function _listeners(target, type2, unwrap) {
var events2 = target._events;
if (events2 === void 0)
return [];
var evlistener = events2[type2];
if (evlistener === void 0)
return [];
if (typeof evlistener === "function")
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter.prototype.listeners = function listeners(type2) {
return _listeners(this, type2, true);
};
EventEmitter.prototype.rawListeners = function rawListeners(type2) {
return _listeners(this, type2, false);
};
EventEmitter.listenerCount = function(emitter, type2) {
if (typeof emitter.listenerCount === "function") {
return emitter.listenerCount(type2);
} else {
return listenerCount.call(emitter, type2);
}
};
EventEmitter.prototype.listenerCount = listenerCount;
function listenerCount(type2) {
var events2 = this._events;
if (events2 !== void 0) {
var evlistener = events2[type2];
if (typeof evlistener === "function") {
return 1;
} else if (evlistener !== void 0) {
return evlistener.length;
}
}
return 0;
}
EventEmitter.prototype.eventNames = function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
};
function arrayClone(arr, n) {
var copy = new Array(n);
for (var i = 0; i < n; ++i)
copy[i] = arr[i];
return copy;
}
function spliceOne(list, index2) {
for (; index2 + 1 < list.length; index2++)
list[index2] = list[index2 + 1];
list.pop();
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
function once(emitter, name) {
return new Promise(function(resolve, reject) {
function errorListener(err) {
emitter.removeListener(name, resolver);
reject(err);
}
function resolver() {
if (typeof emitter.removeListener === "function") {
emitter.removeListener("error", errorListener);
}
resolve([].slice.call(arguments));
}
eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
if (name !== "error") {
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
}
});
}
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
if (typeof emitter.on === "function") {
eventTargetAgnosticAddListener(emitter, "error", handler, flags);
}
}
function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
if (typeof emitter.on === "function") {
if (flags.once) {
emitter.once(name, listener);
} else {
emitter.on(name, listener);
}
} else if (typeof emitter.addEventListener === "function") {
emitter.addEventListener(name, function wrapListener(arg) {
if (flags.once) {
emitter.removeEventListener(name, wrapListener);
}
listener(arg);
});
} else {
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
}
}
return events.exports;
}
var string_decoder = {};
var safeBuffer = { exports: {} };
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var hasRequiredSafeBuffer;
function requireSafeBuffer() {
if (hasRequiredSafeBuffer) return safeBuffer.exports;
hasRequiredSafeBuffer = 1;
(function(module, exports) {
var buffer = requireDist();
var Buffer = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length);
}
SafeBuffer.prototype = Object.create(Buffer.prototype);
copyProps(Buffer, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
})(safeBuffer, safeBuffer.exports);
return safeBuffer.exports;
}
var hasRequiredString_decoder;
function requireString_decoder() {
if (hasRequiredString_decoder) return string_decoder;
hasRequiredString_decoder = 1;
var Buffer = requireSafeBuffer().Buffer;
var isEncoding = Buffer.isEncoding || function(encoding) {
encoding = "" + encoding;
switch (encoding && encoding.toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
case "raw":
return true;
default:
return false;
}
};
function _normalizeEncoding(enc) {
if (!enc) return "utf8";
var retried;
while (true) {
switch (enc) {
case "utf8":
case "utf-8":
return "utf8";
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return "utf16le";
case "latin1":
case "binary":
return "latin1";
case "base64":
case "ascii":
case "hex":
return enc;
default:
if (retried) return;
enc = ("" + enc).toLowerCase();
retried = true;
}
}
}
function normalizeEncoding(enc) {
var nenc = _normalizeEncoding(enc);
if (typeof nenc !== "string" && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
return nenc || enc;
}
string_decoder.StringDecoder = StringDecoder;
function StringDecoder(encoding) {
this.encoding = normalizeEncoding(encoding);
var nb;
switch (this.encoding) {
case "utf16le":
this.text = utf16Text;
this.end = utf16End;
nb = 4;
break;
case "utf8":
this.fillLast = utf8FillLast;
nb = 4;
break;
case "base64":
this.text = base64Text;
this.end = base64End;
nb = 3;
break;
default:
this.write = simpleWrite;
this.end = simpleEnd;
return;
}
this.lastNeed = 0;
this.lastTotal = 0;
this.lastChar = Buffer.allocUnsafe(nb);
}
StringDecoder.prototype.write = function(buf) {
if (buf.length === 0) return "";
var r;
var i;
if (this.lastNeed) {
r = this.fillLast(buf);
if (r === void 0) return "";
i = this.lastNeed;
this.lastNeed = 0;
} else {
i = 0;
}
if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
return r || "";
};
StringDecoder.prototype.end = utf8End;
StringDecoder.prototype.text = utf8Text;
StringDecoder.prototype.fillLast = function(buf) {
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
this.lastNeed -= buf.length;
};
function utf8CheckByte(byte) {
if (byte <= 127) return 0;
else if (byte >> 5 === 6) return 2;
else if (byte >> 4 === 14) return 3;
else if (byte >> 3 === 30) return 4;
return byte >> 6 === 2 ? -1 : -2;
}
function utf8CheckIncomplete(self2, buf, i) {
var j = buf.length - 1;
if (j < i) return 0;
var nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) self2.lastNeed = nb - 1;
return nb;
}
if (--j < i || nb === -2) return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) self2.lastNeed = nb - 2;
return nb;
}
if (--j < i || nb === -2) return 0;
nb = utf8CheckByte(buf[j]);
if (nb >= 0) {
if (nb > 0) {
if (nb === 2) nb = 0;
else self2.lastNeed = nb - 3;
}
return nb;
}
return 0;
}
function utf8CheckExtraBytes(self2, buf, p) {
if ((buf[0] & 192) !== 128) {
self2.lastNeed = 0;
return "�";
}
if (self2.lastNeed > 1 && buf.length > 1) {
if ((buf[1] & 192) !== 128) {
self2.lastNeed = 1;
return "�";
}
if (self2.lastNeed > 2 && buf.length > 2) {
if ((buf[2] & 192) !== 128) {
self2.lastNeed = 2;
return "�";
}
}
}
}
function utf8FillLast(buf) {
var p = this.lastTotal - this.lastNeed;
var r = utf8CheckExtraBytes(this, buf);
if (r !== void 0) return r;
if (this.lastNeed <= buf.length) {
buf.copy(this.lastChar, p, 0, this.lastNeed);
return this.lastChar.toString(this.encoding, 0, this.lastTotal);
}
buf.copy(this.lastChar, p, 0, buf.length);
this.lastNeed -= buf.length;
}
function utf8Text(buf, i) {
var total = utf8CheckIncomplete(this, buf, i);
if (!this.lastNeed) return buf.toString("utf8", i);
this.lastTotal = total;
var end = buf.length - (total - this.lastNeed);
buf.copy(this.lastChar, 0, end);
return buf.toString("utf8", i, end);
}
function utf8End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) return r + "�";
return r;
}
function utf16Text(buf, i) {
if ((buf.length - i) % 2 === 0) {
var r = buf.toString("utf16le", i);
if (r) {
var c = r.charCodeAt(r.length - 1);
if (c >= 55296 && c <= 56319) {
this.lastNeed = 2;
this.lastTotal = 4;
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
return r.slice(0, -1);
}
}
return r;
}
this.lastNeed = 1;
this.lastTotal = 2;
this.lastChar[0] = buf[buf.length - 1];
return buf.toString("utf16le", i, buf.length - 1);
}
function utf16End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) {
var end = this.lastTotal - this.lastNeed;
return r + this.lastChar.toString("utf16le", 0, end);
}
return r;
}
function base64Text(buf, i) {
var n = (buf.length - i) % 3;
if (n === 0) return buf.toString("base64", i);
this.lastNeed = 3 - n;
this.lastTotal = 3;
if (n === 1) {
this.lastChar[0] = buf[buf.length - 1];
} else {
this.lastChar[0] = buf[buf.length - 2];
this.lastChar[1] = buf[buf.length - 1];
}
return buf.toString("base64", i, buf.length - n);
}
function base64End(buf) {
var r = buf && buf.length ? this.write(buf) : "";
if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
return r;
}
function simpleWrite(buf) {
return buf.toString(this.encoding);
}
function simpleEnd(buf) {
return buf && buf.length ? this.write(buf) : "";
}
return string_decoder;
}
var inherits_browser = { exports: {} };
var hasRequiredInherits_browser;
function requireInherits_browser() {
if (hasRequiredInherits_browser) return inherits_browser.exports;
hasRequiredInherits_browser = 1;
if (typeof Object.create === "function") {
inherits_browser.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
inherits_browser.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {
};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
}
};
}
return inherits_browser.exports;
}
var streamBrowser;
var hasRequiredStreamBrowser;
function requireStreamBrowser() {
if (hasRequiredStreamBrowser) return streamBrowser;
hasRequiredStreamBrowser = 1;
streamBrowser = requireEvents().EventEmitter;
return streamBrowser;
}
var util = {};
var types = {};
var shams$1;
var hasRequiredShams$1;
function requireShams$1() {
if (hasRequiredShams$1) return shams$1;
hasRequiredShams$1 = 1;
shams$1 = function hasSymbols2() {
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
return false;
}
if (typeof Symbol.iterator === "symbol") {
return true;
}
var obj = {};
var sym = Symbol("test");
var symObj = Object(sym);
if (typeof sym === "string") {
return false;
}
if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
return false;
}
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
return false;
}
var symVal = 42;
obj[sym] = symVal;
for (var _ in obj) {
return false;
}
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
return false;
}
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
return false;
}
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) {
return false;
}
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
return false;
}
if (typeof Object.getOwnPropertyDescriptor === "function") {
var descriptor = (
/** @type {PropertyDescriptor} */
Object.getOwnPropertyDescriptor(obj, sym)
);
if (descriptor.value !== symVal || descriptor.enumerable !== true) {
return false;
}
}
return true;
};
return shams$1;
}
var shams;
var hasRequiredShams;
function requireShams() {
if (hasRequiredShams) return shams;
hasRequiredShams = 1;
var hasSymbols2 = requireShams$1();
shams = function hasToStringTagShams() {
return hasSymbols2() && !!Symbol.toStringTag;
};
return shams;
}
var esObjectAtoms;
var hasRequiredEsObjectAtoms;
function requireEsObjectAtoms() {
if (hasRequiredEsObjectAtoms) return esObjectAtoms;
hasRequiredEsObjectAtoms = 1;
esObjectAtoms = Object;
return esObjectAtoms;
}
var esErrors;
var hasRequiredEsErrors;
function requireEsErrors() {
if (hasRequiredEsErrors) return esErrors;
hasRequiredEsErrors = 1;
esErrors = Error;
return esErrors;
}
var _eval;
var hasRequired_eval;
function require_eval() {
if (hasRequired_eval) return _eval;
hasRequired_eval = 1;
_eval = EvalError;
return _eval;
}
var range;
var hasRequiredRange;
function requireRange() {
if (hasRequiredRange) return range;
hasRequiredRange = 1;
range = RangeError;
return range;
}
var ref;
var hasRequiredRef;
function requireRef() {
if (hasRequiredRef) return ref;
hasRequiredRef = 1;
ref = ReferenceError;
return ref;
}
var syntax;
var hasRequiredSyntax;
function requireSyntax() {
if (hasRequiredSyntax) return syntax;
hasRequiredSyntax = 1;
syntax = SyntaxError;
return syntax;
}
var type;
var hasRequiredType;
function requireType() {
if (hasRequiredType) return type;
hasRequiredType = 1;
type = TypeError;
return type;
}
var uri;
var hasRequiredUri;
function requireUri() {
if (hasRequiredUri) return uri;
hasRequiredUri = 1;
uri = URIError;
return uri;
}
var abs;
var hasRequiredAbs;
function requireAbs() {
if (hasRequiredAbs) return abs;
hasRequiredAbs = 1;
abs = Math.abs;
return abs;
}
var floor;
var hasRequiredFloor;
function requireFloor() {
if (hasRequiredFloor) return floor;
hasRequiredFloor = 1;
floor = Math.floor;
return floor;
}
var max;
var hasRequiredMax;
function requireMax() {
if (hasRequiredMax) return max;
hasRequiredMax = 1;
max = Math.max;
return max;
}
var min;
var hasRequiredMin;
function requireMin() {
if (hasRequiredMin) return min;
hasRequiredMin = 1;
min = Math.min;
return min;
}
var pow;
var hasRequiredPow;
function requirePow() {
if (hasRequiredPow) return pow;
hasRequiredPow = 1;
pow = Math.pow;
return pow;
}
var round;
var hasRequiredRound;
function requireRound() {
if (hasRequiredRound) return round;
hasRequiredRound = 1;
round = Math.round;
return round;
}
var _isNaN;
var hasRequired_isNaN;
function require_isNaN() {
if (hasRequired_isNaN) return _isNaN;
hasRequired_isNaN = 1;
_isNaN = Number.isNaN || function isNaN2(a) {
return a !== a;
};
return _isNaN;
}
var sign;
var hasRequiredSign;
function requireSign() {
if (hasRequiredSign) return sign;
hasRequiredSign = 1;
var $isNaN = /* @__PURE__ */ require_isNaN();
sign = function sign2(number) {
if ($isNaN(number) || number === 0) {
return number;
}
return number < 0 ? -1 : 1;
};
return sign;
}
var gOPD;
var hasRequiredGOPD;
function requireGOPD() {
if (hasRequiredGOPD) return gOPD;
hasRequiredGOPD = 1;
gOPD = Object.getOwnPropertyDescriptor;
return gOPD;
}
var gopd;
var hasRequiredGopd;
function requireGopd() {
if (hasRequiredGopd) return gopd;
hasRequiredGopd = 1;
var $gOPD = /* @__PURE__ */ requireGOPD();
if ($gOPD) {
try {
$gOPD([], "length");
} catch (e) {
$gOPD = null;
}
}
gopd = $gOPD;
return gopd;
}
var esDefineProperty;
var hasRequiredEsDefineProperty;
function requireEsDefineProperty() {
if (hasRequiredEsDefineProperty) return esDefineProperty;
hasRequiredEsDefineProperty = 1;
var $defineProperty = Object.defineProperty || false;
if ($defineProperty) {
try {
$defineProperty({}, "a", { value: 1 });
} catch (e) {
$defineProperty = false;
}
}
esDefineProperty = $defineProperty;
return esDefineProperty;
}
var hasSymbols;
var hasRequiredHasSymbols;
function requireHasSymbols() {
if (hasRequiredHasSymbols) return hasSymbols;
hasRequiredHasSymbols = 1;
var origSymbol = typeof Symbol !== "undefined" && Symbol;
var hasSymbolSham = requireShams$1();
hasSymbols = function hasNativeSymbols() {
if (typeof origSymbol !== "function") {
return false;
}
if (typeof Symbol !== "function") {
return false;
}
if (typeof origSymbol("foo") !== "symbol") {
return false;
}
if (typeof Symbol("bar") !== "symbol") {
return false;
}
return hasSymbolSham();
};
return hasSymbols;
}
var Reflect_getPrototypeOf;
var hasRequiredReflect_getPrototypeOf;
function requireReflect_getPrototypeOf() {
if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf;
hasRequiredReflect_getPrototypeOf = 1;
Reflect_getPrototypeOf = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
return Reflect_getPrototypeOf;
}
var Object_getPrototypeOf;
var hasRequiredObject_getPrototypeOf;
function requireObject_getPrototypeOf() {
if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
hasRequiredObject_getPrototypeOf = 1;
var $Object = /* @__PURE__ */ requireEsObjectAtoms();
Object_getPrototypeOf = $Object.getPrototypeOf || null;
return Object_getPrototypeOf;
}
var implementation;
var hasRequiredImplementation;
function requireImplementation() {
if (hasRequiredImplementation) return implementation;
hasRequiredImplementation = 1;
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
var toStr = Object.prototype.toString;
var max2 = Math.max;
var funcType = "[object Function]";
var concatty = function concatty2(a, b) {
var arr = [];
for (var i = 0; i < a.length; i += 1) {
arr[i] = a[i];
}
for (var j = 0; j < b.length; j += 1) {
arr[j + a.length] = b[j];
}
return arr;
};
var slicy = function slicy2(arrLike, offset) {
var arr = [];
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
arr[j] = arrLike[i];
}
return arr;
};
var joiny = function(arr, joiner) {
var str = "";
for (var i = 0; i < arr.length; i += 1) {
str += arr[i];
if (i + 1 < arr.length) {
str += joiner;
}
}
return str;
};
implementation = function bind(that) {
var target = this;
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slicy(arguments, 1);
var bound;
var binder = function() {
if (this instanceof bound) {
var result = target.apply(
this,
concatty(args, arguments)
);
if (Object(result) === result) {
return result;
}
return this;
}
return target.apply(
that,
concatty(args, arguments)
);
};
var boundLength = max2(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs[i] = "$" + i;
}
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
if (target.prototype) {
var Empty = function Empty2() {
};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
return implementation;
}
var functionBind;
var hasRequiredFunctionBind;
function requireFunctionBind() {
if (hasRequiredFunctionBind) return functionBind;
hasRequiredFunctionBind = 1;
var implementation2 = requireImplementation();
functionBind = Function.prototype.bind || implementation2;
return functionBind;
}
var functionCall;
var hasRequiredFunctionCall;
function requireFunctionCall() {
if (hasRequiredFunctionCall) return functionCall;
hasRequiredFunctionCall = 1;
functionCall = Function.prototype.call;
return functionCall;
}
var functionApply;
var hasRequiredFunctionApply;
function requireFunctionApply() {
if (hasRequiredFunctionApply) return functionApply;
hasRequiredFunctionApply = 1;
functionApply = Function.prototype.apply;
return functionApply;
}
var reflectApply;
var hasRequiredReflectApply;
function requireReflectApply() {
if (hasRequiredReflectApply) return reflectApply;
hasRequiredReflectApply = 1;
reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
return reflectApply;
}
var actualApply;
var hasRequiredActualApply;
function requireActualApply() {
if (hasRequiredActualApply) return actualApply;
hasRequiredActualApply = 1;
var bind = requireFunctionBind();
var $apply = requireFunctionApply();
var $call = requireFunctionCall();
var $reflectApply = requireReflectApply();
actualApply = $reflectApply || bind.call($call, $apply);
return actualApply;
}
var callBindApplyHelpers;
var hasRequiredCallBindApplyHelpers;
function requireCallBindApplyHelpers() {
if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
hasRequiredCallBindApplyHelpers = 1;
var bind = requireFunctionBind();
var $TypeError = /* @__PURE__ */ requireType();
var $call = requireFunctionCall();
var $actualApply = requireActualApply();
callBindApplyHelpers = function callBindBasic(args) {
if (args.length < 1 || typeof args[0] !== "function") {
throw new $TypeError("a function is required");
}
return $actualApply(bind, $call, args);
};
return callBindApplyHelpers;
}
var get;
var hasRequiredGet;
function requireGet() {
if (hasRequiredGet) return get;
hasRequiredGet = 1;
var callBind2 = requireCallBindApplyHelpers();
var gOPD2 = /* @__PURE__ */ requireGopd();
var hasProtoAccessor;
try {
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
[].__proto__ === Array.prototype;
} catch (e) {
if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
throw e;
}
}
var desc = !!hasProtoAccessor && gOPD2 && gOPD2(
Object.prototype,
/** @type {keyof typeof Object.prototype} */
"__proto__"
);
var $Object = Object;
var $getPrototypeOf = $Object.getPrototypeOf;
get = desc && typeof desc.get === "function" ? callBind2([desc.get]) : typeof $getPrototypeOf === "function" ? (
/** @type {import('./get')} */
function getDunder(value) {
return $getPrototypeOf(value == null ? value : $Object(value));
}
) : false;
return get;
}
var getProto;
var hasRequiredGetProto;
function requireGetProto() {
if (hasRequiredGetProto) return getProto;
hasRequiredGetProto = 1;
var reflectGetProto = requireReflect_getPrototypeOf();
var originalGetProto = requireObject_getPrototypeOf();
var getDunderProto = /* @__PURE__ */ requireGet();
getProto = reflectGetProto ? function getProto2(O) {
return reflectGetProto(O);
} : originalGetProto ? function getProto2(O) {
if (!O || typeof O !== "object" && typeof O !== "function") {
throw new TypeError("getProto: not an object");
}
return originalGetProto(O);
} : getDunderProto ? function getProto2(O) {
return getDunderProto(O);
} : null;
return getProto;
}
var hasown;
var hasRequiredHasown;
function requireHasown() {
if (hasRequiredHasown) return hasown;
hasRequiredHasown = 1;
var call = Function.prototype.call;
var $hasOwn = Object.prototype.hasOwnProperty;
var bind = requireFunctionBind();
hasown = bind.call(call, $hasOwn);
return hasown;
}
var getIntrinsic;
var hasRequiredGetIntrinsic;
function requireGetIntrinsic() {
if (hasRequiredGetIntrinsic) return getIntrinsic;
hasRequiredGetIntrinsic = 1;
var undefined$1;
var $Object = /* @__PURE__ */ requireEsObjectAtoms();
var $Error = /* @__PURE__ */ requireEsErrors();
var $EvalError = /* @__PURE__ */ require_eval();
var $RangeError = /* @__PURE__ */ requireRange();
var $ReferenceError = /* @__PURE__ */ requireRef();
var $SyntaxError = /* @__PURE__ */ requireSyntax();
var $TypeError = /* @__PURE__ */ requireType();
var $URIError = /* @__PURE__ */ requireUri();
var abs2 = /* @__PURE__ */ requireAbs();
var floor2 = /* @__PURE__ */ requireFloor();
var max2 = /* @__PURE__ */ requireMax();
var min2 = /* @__PURE__ */ requireMin();
var pow2 = /* @__PURE__ */ requirePow();
var round2 = /* @__PURE__ */ requireRound();
var sign2 = /* @__PURE__ */ requireSign();
var $Function = Function;
var getEvalledConstructor = function(expressionSyntax) {
try {
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
} catch (e) {
}
};
var $gOPD = /* @__PURE__ */ requireGopd();
var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
var throwTypeError = function() {
throw new $TypeError();
};
var ThrowTypeError = $gOPD ? function() {
try {
arguments.callee;
return throwTypeError;
} catch (calleeThrows) {
try {
return $gOPD(arguments, "callee").get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}() : throwTypeError;
var hasSymbols2 = requireHasSymbols()();
var getProto2 = requireGetProto();
var $ObjectGPO = requireObject_getPrototypeOf();
var $ReflectGPO = requireReflect_getPrototypeOf();
var $apply = requireFunctionApply();
var $call = requireFunctionCall();
var needsEval = {};
var TypedArray = typeof Uint8Array === "undefined" || !getProto2 ? undefined$1 : getProto2(Uint8Array);
var INTRINSICS = {
__proto__: null,
"%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
"%ArrayIteratorPrototype%": hasSymbols2 && getProto2 ? getProto2([][Symbol.iterator]()) : undefined$1,
"%AsyncFromSyncIteratorPrototype%": undefined$1,
"%AsyncFunction%": needsEval,
"%AsyncGenerator%": needsEval,
"%AsyncGeneratorFunction%": needsEval,
"%AsyncIteratorPrototype%": needsEval,
"%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics,
"%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt,
"%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array,
"%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array,
"%Boolean%": Boolean,
"%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": $Error,
"%eval%": eval,
// eslint-disable-line no-eval
"%EvalError%": $EvalError,
"%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
"%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
"%Function%": $Function,
"%GeneratorFunction%": needsEval,
"%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array,
"%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array,
"%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": hasSymbols2 && getProto2 ? getProto2(getProto2([][Symbol.iterator]())) : undefined$1,
"%JSON%": typeof JSON === "object" ? JSON : undefined$1,
"%Map%": typeof Map === "undefined" ? undefined$1 : Map,
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols2 || !getProto2 ? undefined$1 : getProto2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": $Object,
"%Object.getOwnPropertyDescriptor%": $gOPD,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
"%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
"%RangeError%": $RangeError,
"%ReferenceError%": $ReferenceError,
"%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set === "undefined" ? undefined$1 : Set,
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols2 || !getProto2 ? undefined$1 : getProto2((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": hasSymbols2 && getProto2 ? getProto2(""[Symbol.iterator]()) : undefined$1,
"%Symbol%": hasSymbols2 ? Symbol : undefined$1,
"%SyntaxError%": $SyntaxError,
"%ThrowTypeError%": ThrowTypeError,
"%TypedArray%": TypedArray,
"%TypeError%": $TypeError,
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
"%URIError%": $URIError,
"%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
"%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
"%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet,
"%Function.prototype.call%": $call,
"%Function.prototype.apply%": $apply,
"%Object.defineProperty%": $defineProperty,
"%Object.getPrototypeOf%": $ObjectGPO,
"%Math.abs%": abs2,
"%Math.floor%": floor2,
"%Math.max%": max2,
"%Math.min%": min2,
"%Math.pow%": pow2,
"%Math.round%": round2,
"%Math.sign%": sign2,
"%Reflect.getPrototypeOf%": $ReflectGPO
};
if (getProto2) {
try {
null.error;
} catch (e) {
var errorProto = getProto2(getProto2(e));
INTRINSICS["%Error.prototype%"] = errorProto;
}
}
var doEval = function doEval2(name) {
var value;
if (name === "%AsyncFunction%") {
value = getEvalledConstructor("async function () {}");
} else if (name === "%GeneratorFunction%") {
value = getEvalledConstructor("function* () {}");
} else if (name === "%AsyncGeneratorFunction%") {
value = getEvalledConstructor("async function* () {}");
} else if (name === "%AsyncGenerator%") {
var fn = doEval2("%AsyncGeneratorFunction%");
if (fn) {
value = fn.prototype;
}
} else if (name === "%AsyncIteratorPrototype%") {
var gen = doEval2("%AsyncGenerator%");
if (gen && getProto2) {
value = getProto2(gen.prototype);
}
}
INTRINSICS[name] = value;
return value;
};
var LEGACY_ALIASES = {
__proto__: null,
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
};
var bind = requireFunctionBind();
var hasOwn = /* @__PURE__ */ requireHasown();
var $concat = bind.call($call, Array.prototype.concat);
var $spliceApply = bind.call($apply, Array.prototype.splice);
var $replace = bind.call($call, String.prototype.replace);
var $strSlice = bind.call($call, String.prototype.slice);
var $exec = bind.call($call, RegExp.prototype.exec);
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = function stringToPath2(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === "%" && last !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
} else if (last === "%" && first !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
}
var result = [];
$replace(string, rePropName, function(match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
});
return result;
};
var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = "%" + alias[0] + "%";
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (value === needsEval) {
value = doEval(intrinsicName);
}
if (typeof value === "undefined" && !allowMissing) {
throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
}
return {
alias,
name: intrinsicName,
value
};
}
throw new $SyntaxError("intrinsic " + name + " does not exist!");
};
getIntrinsic = function GetIntrinsic(name, allowMissing) {
if (typeof name !== "string" || name.length === 0) {
throw new $TypeError("intrinsic name must be a non-empty string");
}
if (arguments.length > 1 && typeof allowMissing !== "boolean") {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
if ($exec(/^%?[^%]*%?$/, name) === null) {
throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
throw new $SyntaxError("property names with quotes must have matching quotes");
}
if (part === "constructor" || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += "." + part;
intrinsicRealName = "%" + intrinsicBaseName + "%";
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
}
return void 0;
}
if ($gOPD && i + 1 >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
return getIntrinsic;
}
var callBound;
var hasRequiredCallBound;
function requireCallBound() {
if (hasRequiredCallBound) return callBound;
hasRequiredCallBound = 1;
var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
var callBindBasic = requireCallBindApplyHelpers();
var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
callBound = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = (
/** @type {Parameters<typeof callBindBasic>[0][0]} */
GetIntrinsic(name, !!allowMissing)
);
if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
return callBindBasic([intrinsic]);
}
return intrinsic;
};
return callBound;
}
var isArguments;
var hasRequiredIsArguments;
function requireIsArguments() {
if (hasRequiredIsArguments) return isArguments;
hasRequiredIsArguments = 1;
var hasToStringTag = requireShams()();
var callBound2 = /* @__PURE__ */ requireCallBound();
var $toString = callBound2("Object.prototype.toString");
var isStandardArguments = function isArguments2(value) {
if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) {
return false;
}
return $toString(value) === "[object Arguments]";
};
var isLegacyArguments = function isArguments2(value) {
if (isStandardArguments(value)) {
return true;
}
return value !== null && typeof value === "object" && "length" in value && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && "callee" in value && $toString(value.callee) === "[object Function]";
};
var supportsStandardArguments = function() {
return isStandardArguments(arguments);
}();
isStandardArguments.isLegacyArguments = isLegacyArguments;
isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
return isArguments;
}
var isRegex;
var hasRequiredIsRegex;
function requireIsRegex() {
if (hasRequiredIsRegex) return isRegex;
hasRequiredIsRegex = 1;
var callBound2 = /* @__PURE__ */ requireCallBound();
var hasToStringTag = requireShams()();
var hasOwn = /* @__PURE__ */ requireHasown();
var gOPD2 = /* @__PURE__ */ requireGopd();
var fn;
if (hasToStringTag) {
var $exec = callBound2("RegExp.prototype.exec");
var isRegexMarker = {};
var throwRegexMarker = function() {
throw isRegexMarker;
};
var badStringifier = {
toString: throwRegexMarker,
valueOf: throwRegexMarker
};
if (typeof Symbol.toPrimitive === "symbol") {
badStringifier[Symbol.toPrimitive] = throwRegexMarker;
}
fn = function isRegex2(value) {
if (!value || typeof value !== "object") {
return false;
}
var descriptor = (
/** @type {NonNullable<typeof gOPD>} */
gOPD2(
/** @type {{ lastIndex?: unknown }} */
value,
"lastIndex"
)
);
var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, "value");
if (!hasLastIndexDataProperty) {
return false;
}
try {
$exec(
value,
/** @type {string} */
/** @type {unknown} */
badStringifier
);
} catch (e) {
return e === isRegexMarker;
}
};
} else {
var $toString = callBound2("Object.prototype.toString");
var regexClass = "[object RegExp]";
fn = function isRegex2(value) {
if (!value || typeof value !== "object" && typeof value !== "function") {
return false;
}
return $toString(value) === regexClass;
};
}
isRegex = fn;
return isRegex;
}
var safeRegexTest;
var hasRequiredSafeRegexTest;
function requireSafeRegexTest() {
if (hasRequiredSafeRegexTest) return safeRegexTest;
hasRequiredSafeRegexTest = 1;
var callBound2 = /* @__PURE__ */ requireCallBound();
var isRegex2 = requireIsRegex();
var $exec = callBound2("RegExp.prototype.exec");
var $TypeError = /* @__PURE__ */ requireType();
safeRegexTest = function regexTester(regex) {
if (!isRegex2(regex)) {
throw new $TypeError("`regex` must be a RegExp");
}
return function test(s) {
return $exec(regex, s) !== null;
};
};
return safeRegexTest;
}
var isGeneratorFunction;
var hasRequiredIsGeneratorFunction;
function requireIsGeneratorFunction() {
if (hasRequiredIsGeneratorFunction) return isGeneratorFunction;
hasRequiredIsGeneratorFunction = 1;
var callBound2 = /* @__PURE__ */ requireCallBound();
var safeRegexTest2 = /* @__PURE__ */ requireSafeRegexTest();
var isFnRegex = safeRegexTest2(/^\s*(?:function)?\*/);
var hasToStringTag = requireShams()();
var getProto2 = requireGetProto();
var toStr = callBound2("Object.prototype.toString");
var fnToStr = callBound2("Function.prototype.toString");
var getGeneratorFunc = function() {
if (!hasToStringTag) {
return false;
}
try {
return Function("return function*() {}")();
} catch (e) {
}
};
var GeneratorFunction;
isGeneratorFunction = function isGeneratorFunction2(fn) {
if (typeof fn !== "function") {
return false;
}
if (isFnRegex(fnToStr(fn))) {
return true;
}
if (!hasToStringTag) {
var str = toStr(fn);
return str === "[object GeneratorFunction]";
}
if (!getProto2) {
return false;
}
if (typeof GeneratorFunction === "undefined") {
var generatorFunc = getGeneratorFunc();
GeneratorFunction = generatorFunc ? (
/** @type {GeneratorFunctionConstructor} */
getProto2(generatorFunc)
) : false;
}
return getProto2(fn) === GeneratorFunction;
};
return isGeneratorFunction;
}
var isCallable;
var hasRequiredIsCallable;
function requireIsCallable() {
if (hasRequiredIsCallable) return isCallable;
hasRequiredIsCallable = 1;
var fnToStr = Function.prototype.toString;
var reflectApply2 = typeof Reflect === "object" && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply2 === "function" && typeof Object.defineProperty === "function") {
try {
badArrayLike = Object.defineProperty({}, "length", {
get: function() {
throw isCallableMarker;
}
});
isCallableMarker = {};
reflectApply2(function() {
throw 42;
}, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply2 = null;
}
}
} else {
reflectApply2 = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false;
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) {
return false;
}
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var objectClass = "[object Object]";
var fnClass = "[object Function]";
var genClass = "[object GeneratorFunction]";
var ddaClass = "[object HTMLAllCollection]";
var ddaClass2 = "[object HTML document.all class]";
var ddaClass3 = "[object HTMLCollection]";
var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag;
var isIE68 = !(0 in [,]);
var isDDA = function isDocumentDotAll() {
return false;
};
if (typeof document === "object") {
var all = document.all;
if (toStr.call(all) === toStr.call(document.all)) {
isDDA = function isDocumentDotAll(value) {
if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) {
try {
var str = toStr.call(value);
return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null;
} catch (e) {
}
}
return false;
};
}
}
isCallable = reflectApply2 ? function isCallable2(value) {
if (isDDA(value)) {
return true;
}
if (!value) {
return false;
}
if (typeof value !== "function" && typeof value !== "object") {
return false;
}
try {
reflectApply2(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) {
return false;
}
}
return !isES6ClassFn(value) && tryFunctionObject(value);
} : function isCallable2(value) {
if (isDDA(value)) {
return true;
}
if (!value) {
return false;
}
if (typeof value !== "function" && typeof value !== "object") {
return false;
}
if (hasToStringTag) {
return tryFunctionObject(value);
}
if (isES6ClassFn(value)) {
return false;
}
var strClass = toStr.call(value);
if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) {
return false;
}
return tryFunctionObject(value);
};
return isCallable;
}
var forEach_1;
var hasRequiredForEach;
function requireForEach() {
if (hasRequiredForEach) return forEach_1;
hasRequiredForEach = 1;
var isCallable2 = requireIsCallable();
var toStr = Object.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var forEachArray = function forEachArray2(array, iterator, receiver) {
for (var i = 0, len = array.length; i < len; i++) {
if (hasOwnProperty.call(array, i)) {
if (receiver == null) {
iterator(array[i], i, array);
} else {
iterator.call(receiver, array[i], i, array);
}
}
}
};
var forEachString = function forEachString2(string, iterator, receiver) {
for (var i = 0, len = string.length; i < len; i++) {
if (receiver == null) {
iterator(string.charAt(i), i, string);
} else {
iterator.call(receiver, string.charAt(i), i, string);
}
}
};
var forEachObject = function forEachObject2(object, iterator, receiver) {
for (var k in object) {
if (hasOwnProperty.call(object, k)) {
if (receiver == null) {
iterator(object[k], k, object);
} else {
iterator.call(receiver, object[k], k, object);
}
}
}
};
var forEach = function forEach2(list, iterator, thisArg) {
if (!isCallable2(iterator)) {
throw new TypeError("iterator must be a function");
}
var receiver;
if (arguments.length >= 3) {
receiver = thisArg;
}
if (toStr.call(list) === "[object Array]") {
forEachArray(list, iterator, receiver);
} else if (typeof list === "string") {
forEachString(list, iterator, receiver);
} else {
forEachObject(list, iterator, receiver);
}
};
forEach_1 = forEach;
return forEach_1;
}
var possibleTypedArrayNames;
var hasRequiredPossibleTypedArrayNames;
function requirePossibleTypedArrayNames() {
if (hasRequiredPossibleTypedArrayNames) return possibleTypedArrayNames;
hasRequiredPossibleTypedArrayNames = 1;
possibleTypedArrayNames = [
"Float32Array",
"Float64Array",
"Int8Array",
"Int16Array",
"Int32Array",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"BigInt64Array",
"BigUint64Array"
];
return possibleTypedArrayNames;
}
var availableTypedArrays;
var hasRequiredAvailableTypedArrays;
function requireAvailableTypedArrays() {
if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
hasRequiredAvailableTypedArrays = 1;
var possibleNames = /* @__PURE__ */ requirePossibleTypedArrayNames();
var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis;
availableTypedArrays = function availableTypedArrays2() {
var out = [];
for (var i = 0; i < possibleNames.length; i++) {
if (typeof g[possibleNames[i]] === "function") {
out[out.length] = possibleNames[i];
}
}
return out;
};
return availableTypedArrays;
}
var callBind = { exports: {} };
var defineDataProperty;
var hasRequiredDefineDataProperty;
function requireDefineDataProperty() {
if (hasRequiredDefineDataProperty) return defineDataProperty;
hasRequiredDefineDataProperty = 1;
var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
var $SyntaxError = /* @__PURE__ */ requireSyntax();
var $TypeError = /* @__PURE__ */ requireType();
var gopd2 = /* @__PURE__ */ requireGopd();
defineDataProperty = function defineDataProperty2(obj, property, value) {
if (!obj || typeof obj !== "object" && typeof obj !== "function") {
throw new $TypeError("`obj` must be an object or a function`");
}
if (typeof property !== "string" && typeof property !== "symbol") {
throw new $TypeError("`property` must be a string or a symbol`");
}
if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
}
if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
}
if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
}
if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
throw new $TypeError("`loose`, if provided, must be a boolean");
}
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
var nonWritable = arguments.length > 4 ? arguments[4] : null;
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
var loose = arguments.length > 6 ? arguments[6] : false;
var desc = !!gopd2 && gopd2(obj, property);
if ($defineProperty) {
$defineProperty(obj, property, {
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
value,
writable: nonWritable === null && desc ? desc.writable : !nonWritable
});
} else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
obj[property] = value;
} else {
throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
}
};
return defineDataProperty;
}
var hasPropertyDescriptors_1;
var hasRequiredHasPropertyDescriptors;
function requireHasPropertyDescriptors() {
if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
hasRequiredHasPropertyDescriptors = 1;
var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
var hasPropertyDescriptors = function hasPropertyDescriptors2() {
return !!$defineProperty;
};
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
if (!$defineProperty) {
return null;
}
try {
return $defineProperty([], "length", { value: 1 }).length !== 1;
} catch (e) {
return true;
}
};
hasPropertyDescriptors_1 = hasPropertyDescriptors;
return hasPropertyDescriptors_1;
}
var setFunctionLength;
var hasRequiredSetFunctionLength;
function requireSetFunctionLength() {
if (hasRequiredSetFunctionLength) return setFunctionLength;
hasRequiredSetFunctionLength = 1;
var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
var define = /* @__PURE__ */ requireDefineDataProperty();
var hasDescriptors = /* @__PURE__ */ requireHasPropertyDescriptors()();
var gOPD2 = /* @__PURE__ */ requireGopd();
var $TypeError = /* @__PURE__ */ requireType();
var $floor = GetIntrinsic("%Math.floor%");
setFunctionLength = function setFunctionLength2(fn, length) {
if (typeof fn !== "function") {
throw new $TypeError("`fn` is not a function");
}
if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) {
throw new $TypeError("`length` must be a positive 32-bit integer");
}
var loose = arguments.length > 2 && !!arguments[2];
var functionLengthIsConfigurable = true;
var functionLengthIsWritable = true;
if ("length" in fn && gOPD2) {
var desc = gOPD2(fn, "length");
if (desc && !desc.configurable) {
functionLengthIsConfigurable = false;
}
if (desc && !desc.writable) {
functionLengthIsWritable = false;
}
}
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(
/** @type {Parameters<define>[0]} */
fn,
"length",
length,
true,
true
);
} else {
define(
/** @type {Parameters<define>[0]} */
fn,
"length",
length
);
}
}
return fn;
};
return setFunctionLength;
}
var applyBind;
var hasRequiredApplyBind;
function requireApplyBind() {
if (hasRequiredApplyBind) return applyBind;
hasRequiredApplyBind = 1;
var bind = requireFunctionBind();
var $apply = requireFunctionApply();
var actualApply2 = requireActualApply();
applyBind = function applyBind2() {
return actualApply2(bind, $apply, arguments);
};
return applyBind;
}
var hasRequiredCallBind;
function requireCallBind() {
if (hasRequiredCallBind) return callBind.exports;
hasRequiredCallBind = 1;
(function(module) {
var setFunctionLength2 = /* @__PURE__ */ requireSetFunctionLength();
var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
var callBindBasic = requireCallBindApplyHelpers();
var applyBind2 = requireApplyBind();
module.exports = function callBind2(originalFunction) {
var func = callBindBasic(arguments);
var adjustedLength = originalFunction.length - (arguments.length - 1);
return setFunctionLength2(
func,
1 + (adjustedLength > 0 ? adjustedLength : 0),
true
);
};
if ($defineProperty) {
$defineProperty(module.exports, "apply", { value: applyBind2 });
} else {
module.exports.apply = applyBind2;
}
})(callBind);
return callBind.exports;
}
var whichTypedArray;
var hasRequiredWhichTypedArray;
function requireWhichTypedArray() {
if (hasRequiredWhichTypedArray) return whichTypedArray;
hasRequiredWhichTypedArray = 1;
var forEach = requireForEach();
var availableTypedArrays2 = /* @__PURE__ */ requireAvailableTypedArrays();
var callBind2 = requireCallBind();
var callBound2 = /* @__PURE__ */ requireCallBound();
var gOPD2 = /* @__PURE__ */ requireGopd();
var $toString = callBound2("Object.prototype.toString");
var hasToStringTag = requireShams()();
var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis;
var typedArrays = availableTypedArrays2();
var $slice = callBound2("String.prototype.slice");
var getPrototypeOf = Object.getPrototypeOf;
var $indexOf = callBound2("Array.prototype.indexOf", true) || function indexOf(array, value) {
for (var i = 0; i < array.length; i += 1) {
if (array[i] === value) {
return i;
}
}
return -1;
};
var cache = { __proto__: null };
if (hasToStringTag && gOPD2 && getPrototypeOf) {
forEach(typedArrays, function(typedArray) {
var arr = new g[typedArray]();
if (Symbol.toStringTag in arr) {
var proto = getPrototypeOf(arr);
var descriptor = gOPD2(proto, Symbol.toStringTag);
if (!descriptor) {
var superProto = getPrototypeOf(proto);
descriptor = gOPD2(superProto, Symbol.toStringTag);
}
cache["$" + typedArray] = callBind2(descriptor.get);
}
});
} else {
forEach(typedArrays, function(typedArray) {
var arr = new g[typedArray]();
var fn = arr.slice || arr.set;
if (fn) {
cache["$" + typedArray] = callBind2(fn);
}
});
}
var tryTypedArrays = function tryAllTypedArrays(value) {
var found = false;
forEach(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
cache,
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function(getter, typedArray) {
if (!found) {
try {
if ("$" + getter(value) === typedArray) {
found = $slice(typedArray, 1);
}
} catch (e) {
}
}
}
);
return found;
};
var trySlices = function tryAllSlices(value) {
var found = false;
forEach(
// eslint-disable-next-line no-extra-parens
/** @type {Record<`\$${TypedArrayName}`, Getter>} */
/** @type {any} */
cache,
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
function(getter, name) {
if (!found) {
try {
getter(value);
found = $slice(name, 1);
} catch (e) {
}
}
}
);
return found;
};
whichTypedArray = function whichTypedArray2(value) {
if (!value || typeof value !== "object") {
return false;
}
if (!hasToStringTag) {
var tag = $slice($toString(value), 8, -1);
if ($indexOf(typedArrays, tag) > -1) {
return tag;
}
if (tag !== "Object") {
return false;
}
return trySlices(value);
}
if (!gOPD2) {
return null;
}
return tryTypedArrays(value);
};
return whichTypedArray;
}
var isTypedArray;
var hasRequiredIsTypedArray;
function requireIsTypedArray() {
if (hasRequiredIsTypedArray) return isTypedArray;
hasRequiredIsTypedArray = 1;
var whichTypedArray2 = /* @__PURE__ */ requireWhichTypedArray();
isTypedArray = function isTypedArray2(value) {
return !!whichTypedArray2(value);
};
return isTypedArray;
}
var hasRequiredTypes;
function requireTypes() {
if (hasRequiredTypes) return types;
hasRequiredTypes = 1;
(function(exports) {
var isArgumentsObject = /* @__PURE__ */ requireIsArguments();
var isGeneratorFunction2 = requireIsGeneratorFunction();
var whichTypedArray2 = /* @__PURE__ */ requireWhichTypedArray();
var isTypedArray2 = /* @__PURE__ */ requireIsTypedArray();
function uncurryThis(f) {
return f.call.bind(f);
}
var BigIntSupported = typeof BigInt !== "undefined";
var SymbolSupported = typeof Symbol !== "undefined";
var ObjectToString = uncurryThis(Object.prototype.toString);
var numberValue = uncurryThis(Number.prototype.valueOf);
var stringValue = uncurryThis(String.prototype.valueOf);
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
if (BigIntSupported) {
var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
}
if (SymbolSupported) {
var symbolValue = uncurryThis(Symbol.prototype.valueOf);
}
function checkBoxedPrimitive(value, prototypeValueOf) {
if (typeof value !== "object") {
return false;
}
try {
prototypeValueOf(value);
return true;
} catch (e) {
return false;
}
}
exports.isArgumentsObject = isArgumentsObject;
exports.isGeneratorFunction = isGeneratorFunction2;
exports.isTypedArray = isTypedArray2;
function isPromise(input) {
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
}
exports.isPromise = isPromise;
function isArrayBufferView(value) {
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
return ArrayBuffer.isView(value);
}
return isTypedArray2(value) || isDataView(value);
}
exports.isArrayBufferView = isArrayBufferView;
function isUint8Array(value) {
return whichTypedArray2(value) === "Uint8Array";
}
exports.isUint8Array = isUint8Array;
function isUint8ClampedArray(value) {
return whichTypedArray2(value) === "Uint8ClampedArray";
}
exports.isUint8ClampedArray = isUint8ClampedArray;
function isUint16Array(value) {
return whichTypedArray2(value) === "Uint16Array";
}
exports.isUint16Array = isUint16Array;
function isUint32Array(value) {
return whichTypedArray2(value) === "Uint32Array";
}
exports.isUint32Array = isUint32Array;
function isInt8Array(value) {
return whichTypedArray2(value) === "Int8Array";
}
exports.isInt8Array = isInt8Array;
function isInt16Array(value) {
return whichTypedArray2(value) === "Int16Array";
}
exports.isInt16Array = isInt16Array;
function isInt32Array(value) {
return whichTypedArray2(value) === "Int32Array";
}
exports.isInt32Array = isInt32Array;
function isFloat32Array(value) {
return whichTypedArray2(value) === "Float32Array";
}
exports.isFloat32Array = isFloat32Array;
function isFloat64Array(value) {
return whichTypedArray2(value) === "Float64Array";
}
exports.isFloat64Array = isFloat64Array;
function isBigInt64Array(value) {
return whichTypedArray2(value) === "BigInt64Array";
}
exports.isBigInt64Array = isBigInt64Array;
function isBigUint64Array(value) {
return whichTypedArray2(value) === "BigUint64Array";
}
exports.isBigUint64Array = isBigUint64Array;
function isMapToString(value) {
return ObjectToString(value) === "[object Map]";
}
isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map());
function isMap(value) {
if (typeof Map === "undefined") {
return false;
}
return isMapToString.working ? isMapToString(value) : value instanceof Map;
}
exports.isMap = isMap;
function isSetToString(value) {
return ObjectToString(value) === "[object Set]";
}
isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set());
function isSet(value) {
if (typeof Set === "undefined") {
return false;
}
return isSetToString.working ? isSetToString(value) : value instanceof Set;
}
exports.isSet = isSet;
function isWeakMapToString(value) {
return ObjectToString(value) === "[object WeakMap]";
}
isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap());
function isWeakMap(value) {
if (typeof WeakMap === "undefined") {
return false;
}
return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
}
exports.isWeakMap = isWeakMap;
function isWeakSetToString(value) {
return ObjectToString(value) === "[object WeakSet]";
}
isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet());
function isWeakSet(value) {
return isWeakSetToString(value);
}
exports.isWeakSet = isWeakSet;
function isArrayBufferToString(value) {
return ObjectToString(value) === "[object ArrayBuffer]";
}
isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer());
function isArrayBuffer(value) {
if (typeof ArrayBuffer === "undefined") {
return false;
}
return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
}
exports.isArrayBuffer = isArrayBuffer;
function isDataViewToString(value) {
return ObjectToString(value) === "[object DataView]";
}
isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1));
function isDataView(value) {
if (typeof DataView === "undefined") {
return false;
}
return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
}
exports.isDataView = isDataView;
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
function isSharedArrayBufferToString(value) {
return ObjectToString(value) === "[object SharedArrayBuffer]";
}
function isSharedArrayBuffer(value) {
if (typeof SharedArrayBufferCopy === "undefined") {
return false;
}
if (typeof isSharedArrayBufferToString.working === "undefined") {
isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
}
return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
}
exports.isSharedArrayBuffer = isSharedArrayBuffer;
function isAsyncFunction(value) {
return ObjectToString(value) === "[object AsyncFunction]";
}
exports.isAsyncFunction = isAsyncFunction;
function isMapIterator(value) {
return ObjectToString(value) === "[object Map Iterator]";
}
exports.isMapIterator = isMapIterator;
function isSetIterator(value) {
return ObjectToString(value) === "[object Set Iterator]";
}
exports.isSetIterator = isSetIterator;
function isGeneratorObject(value) {
return ObjectToString(value) === "[object Generator]";
}
exports.isGeneratorObject = isGeneratorObject;
function isWebAssemblyCompiledModule(value) {
return ObjectToString(value) === "[object WebAssembly.Module]";
}
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
function isNumberObject(value) {
return checkBoxedPrimitive(value, numberValue);
}
exports.isNumberObject = isNumberObject;
function isStringObject(value) {
return checkBoxedPrimitive(value, stringValue);
}
exports.isStringObject = isStringObject;
function isBooleanObject(value) {
return checkBoxedPrimitive(value, booleanValue);
}
exports.isBooleanObject = isBooleanObject;
function isBigIntObject(value) {
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
}
exports.isBigIntObject = isBigIntObject;
function isSymbolObject(value) {
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
}
exports.isSymbolObject = isSymbolObject;
function isBoxedPrimitive(value) {
return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
}
exports.isBoxedPrimitive = isBoxedPrimitive;
function isAnyArrayBuffer(value) {
return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
}
exports.isAnyArrayBuffer = isAnyArrayBuffer;
["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
Object.defineProperty(exports, method, {
enumerable: false,
value: function() {
throw new Error(method + " is not supported in userland");
}
});
});
})(types);
return types;
}
var isBufferBrowser;
var hasRequiredIsBufferBrowser;
function requireIsBufferBrowser() {
if (hasRequiredIsBufferBrowser) return isBufferBrowser;
hasRequiredIsBufferBrowser = 1;
isBufferBrowser = function isBuffer(arg) {
return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
};
return isBufferBrowser;
}
var hasRequiredUtil;
function requireUtil() {
if (hasRequiredUtil) return util;
hasRequiredUtil = 1;
(function(exports) {
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
var keys = Object.keys(obj);
var descriptors = {};
for (var i = 0; i < keys.length; i++) {
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
}
return descriptors;
};
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(" ");
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x2) {
if (x2 === "%%") return "%";
if (i >= len) return x2;
switch (x2) {
case "%s":
return String(args[i++]);
case "%d":
return Number(args[i++]);
case "%j":
try {
return JSON.stringify(args[i++]);
} catch (_) {
return "[Circular]";
}
default:
return x2;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += " " + x;
} else {
str += " " + inspect(x);
}
}
return str;
};
exports.deprecate = function(fn, msg) {
if (typeof process$1$2 !== "undefined" && process$1$2.noDeprecation === true) {
return fn;
}
if (typeof process$1$2 === "undefined") {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
if (process$1$2.throwDeprecation) {
throw new Error(msg);
} else if (process$1$2.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnvRegex = /^$/;
if (process$1$2.env.NODE_DEBUG) {
var debugEnv = process$1$2.env.NODE_DEBUG;
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
}
exports.debuglog = function(set) {
set = set.toUpperCase();
if (!debugs[set]) {
if (debugEnvRegex.test(set)) {
var pid = process$1$2.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error("%s %d: %s", set, pid, msg);
};
} else {
debugs[set] = function() {
};
}
}
return debugs[set];
};
function inspect(obj, opts) {
var ctx = {
seen: [],
stylize: stylizeNoColor
};
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
ctx.showHidden = opts;
} else if (opts) {
exports._extend(ctx, opts);
}
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
inspect.colors = {
"bold": [1, 22],
"italic": [3, 23],
"underline": [4, 24],
"inverse": [7, 27],
"white": [37, 39],
"grey": [90, 39],
"black": [30, 39],
"blue": [34, 39],
"cyan": [36, 39],
"green": [32, 39],
"magenta": [35, 39],
"red": [31, 39],
"yellow": [33, 39]
};
inspect.styles = {
"special": "cyan",
"number": "yellow",
"boolean": "yellow",
"undefined": "grey",
"null": "bold",
"string": "green",
"date": "magenta",
// "name": intentionally not styling
"regexp": "red"
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
return formatError(value);
}
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ": " + value.name : "";
return ctx.stylize("[Function" + name + "]", "special");
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), "date");
}
if (isError(value)) {
return formatError(value);
}
}
var base = "", array = false, braces = ["{", "}"];
if (isArray(value)) {
array = true;
braces = ["[", "]"];
}
if (isFunction(value)) {
var n = value.name ? ": " + value.name : "";
base = " [Function" + n + "]";
}
if (isRegExp(value)) {
base = " " + RegExp.prototype.toString.call(value);
}
if (isDate(value)) {
base = " " + Date.prototype.toUTCString.call(value);
}
if (isError(value)) {
base = " " + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
} else {
return ctx.stylize("[Object]", "special");
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize("undefined", "undefined");
if (isString(value)) {
var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
return ctx.stylize(simple, "string");
}
if (isNumber(value))
return ctx.stylize("" + value, "number");
if (isBoolean(value))
return ctx.stylize("" + value, "boolean");
if (isNull(value))
return ctx.stylize("null", "null");
}
function formatError(value) {
return "[" + Error.prototype.toString.call(value) + "]";
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(
ctx,
value,
recurseTimes,
visibleKeys,
String(i),
true
));
} else {
output.push("");
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(
ctx,
value,
recurseTimes,
visibleKeys,
key,
true
));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize("[Getter/Setter]", "special");
} else {
str = ctx.stylize("[Getter]", "special");
}
} else {
if (desc.set) {
str = ctx.stylize("[Setter]", "special");
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = "[" + key + "]";
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf("\n") > -1) {
if (array) {
str = str.split("\n").map(function(line) {
return " " + line;
}).join("\n").slice(2);
} else {
str = "\n" + str.split("\n").map(function(line) {
return " " + line;
}).join("\n");
}
}
} else {
str = ctx.stylize("[Circular]", "special");
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify("" + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.slice(1, -1);
name = ctx.stylize(name, "name");
} else {
name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, "string");
}
}
return name + ": " + str;
}
function reduceToSingleString(output, base, braces) {
var length = output.reduce(function(prev, cur) {
if (cur.indexOf("\n") >= 0) ;
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
if (length > 60) {
return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
}
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
}
exports.types = requireTypes();
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === "boolean";
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === "number";
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === "string";
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === "symbol";
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === "[object RegExp]";
}
exports.isRegExp = isRegExp;
exports.types.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === "object" && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === "[object Date]";
}
exports.isDate = isDate;
exports.types.isDate = isDate;
function isError(e) {
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
}
exports.isError = isError;
exports.types.isNativeError = isError;
function isFunction(arg) {
return typeof arg === "function";
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
typeof arg === "undefined";
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = requireIsBufferBrowser();
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? "0" + n.toString(10) : n.toString(10);
}
var months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
];
function timestamp() {
var d = /* @__PURE__ */ new Date();
var time = [
pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())
].join(":");
return [d.getDate(), months[d.getMonth()], time].join(" ");
}
exports.log = function() {
console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
};
exports.inherits = requireInherits_browser();
exports._extend = function(origin, add) {
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
exports.promisify = function promisify(original) {
if (typeof original !== "function")
throw new TypeError('The "original" argument must be of type Function');
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== "function") {
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return fn;
}
function fn() {
var promiseResolve, promiseReject;
var promise = new Promise(function(resolve, reject) {
promiseResolve = resolve;
promiseReject = reject;
});
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
args.push(function(err, value) {
if (err) {
promiseReject(err);
} else {
promiseResolve(value);
}
});
try {
original.apply(this, args);
} catch (err) {
promiseReject(err);
}
return promise;
}
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
enumerable: false,
writable: false,
configurable: true
});
return Object.defineProperties(
fn,
getOwnPropertyDescriptors(original)
);
};
exports.promisify.custom = kCustomPromisifiedSymbol;
function callbackifyOnRejected(reason, cb) {
if (!reason) {
var newReason = new Error("Promise was rejected with a falsy value");
newReason.reason = reason;
reason = newReason;
}
return cb(reason);
}
function callbackify(original) {
if (typeof original !== "function") {
throw new TypeError('The "original" argument must be of type Function');
}
function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== "function") {
throw new TypeError("The last argument must be of type Function");
}
var self2 = this;
var cb = function() {
return maybeCb.apply(self2, arguments);
};
original.apply(this, args).then(
function(ret) {
process$1$2.nextTick(cb.bind(null, null, ret));
},
function(rej) {
process$1$2.nextTick(callbackifyOnRejected.bind(null, rej, cb));
}
);
}
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
Object.defineProperties(
callbackified,
getOwnPropertyDescriptors(original)
);
return callbackified;
}
exports.callbackify = callbackify;
})(util);
return util;
}
var buffer_list;
var hasRequiredBuffer_list;
function requireBuffer_list() {
if (hasRequiredBuffer_list) return buffer_list;
hasRequiredBuffer_list = 1;
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
_defineProperties(Constructor.prototype, protoProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== void 0) {
var res = prim.call(input, hint);
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(input);
}
var _require = requireDist(), Buffer = _require.Buffer;
var _require2 = requireUtil(), inspect = _require2.inspect;
var custom = inspect && inspect.custom || "inspect";
function copyBuffer(src, target, offset) {
Buffer.prototype.copy.call(src, target, offset);
}
buffer_list = /* @__PURE__ */ function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
_createClass(BufferList, [{
key: "push",
value: function push(v) {
var entry = {
data: v,
next: null
};
if (this.length > 0) this.tail.next = entry;
else this.head = entry;
this.tail = entry;
++this.length;
}
}, {
key: "unshift",
value: function unshift(v) {
var entry = {
data: v,
next: this.head
};
if (this.length === 0) this.tail = entry;
this.head = entry;
++this.length;
}
}, {
key: "shift",
value: function shift() {
if (this.length === 0) return;
var ret = this.head.data;
if (this.length === 1) this.head = this.tail = null;
else this.head = this.head.next;
--this.length;
return ret;
}
}, {
key: "clear",
value: function clear() {
this.head = this.tail = null;
this.length = 0;
}
}, {
key: "join",
value: function join(s) {
if (this.length === 0) return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next) ret += s + p.data;
return ret;
}
}, {
key: "concat",
value: function concat(n) {
if (this.length === 0) return Buffer.alloc(0);
var ret = Buffer.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
}
// Consumes a specified amount of bytes or characters from the buffered data.
}, {
key: "consume",
value: function consume(n, hasStrings) {
var ret;
if (n < this.head.data.length) {
ret = this.head.data.slice(0, n);
this.head.data = this.head.data.slice(n);
} else if (n === this.head.data.length) {
ret = this.shift();
} else {
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
}
return ret;
}
}, {
key: "first",
value: function first() {
return this.head.data;
}
// Consumes a specified amount of characters from the buffered data.
}, {
key: "_getString",
value: function _getString(n) {
var p = this.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length) ret += str;
else ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next) this.head = p.next;
else this.head = this.tail = null;
} else {
this.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Consumes a specified amount of bytes from the buffered data.
}, {
key: "_getBuffer",
value: function _getBuffer(n) {
var ret = Buffer.allocUnsafe(n);
var p = this.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next) this.head = p.next;
else this.head = this.tail = null;
} else {
this.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Make sure the linked list only shows the minimal necessary information.
}, {
key: custom,
value: function value(_, options) {
return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
}));
}
}]);
return BufferList;
}();
return buffer_list;
}
var destroy_1;
var hasRequiredDestroy;
function requireDestroy() {
if (hasRequiredDestroy) return destroy_1;
hasRequiredDestroy = 1;
function destroy(err, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
} else if (err) {
if (!this._writableState) {
process$1$2.nextTick(emitErrorNT, this, err);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
process$1$2.nextTick(emitErrorNT, this, err);
}
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function(err2) {
if (!cb && err2) {
if (!_this._writableState) {
process$1$2.nextTick(emitErrorAndCloseNT, _this, err2);
} else if (!_this._writableState.errorEmitted) {
_this._writableState.errorEmitted = true;
process$1$2.nextTick(emitErrorAndCloseNT, _this, err2);
} else {
process$1$2.nextTick(emitCloseNT, _this);
}
} else if (cb) {
process$1$2.nextTick(emitCloseNT, _this);
cb(err2);
} else {
process$1$2.nextTick(emitCloseNT, _this);
}
});
return this;
}
function emitErrorAndCloseNT(self2, err) {
emitErrorNT(self2, err);
emitCloseNT(self2);
}
function emitCloseNT(self2) {
if (self2._writableState && !self2._writableState.emitClose) return;
if (self2._readableState && !self2._readableState.emitClose) return;
self2.emit("close");
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err) {
self2.emit("error", err);
}
function errorOrDestroy(stream, err) {
var rState = stream._readableState;
var wState = stream._writableState;
if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);
else stream.emit("error", err);
}
destroy_1 = {
destroy,
undestroy,
errorOrDestroy
};
return destroy_1;
}
var errorsBrowser = {};
var hasRequiredErrorsBrowser;
function requireErrorsBrowser() {
if (hasRequiredErrorsBrowser) return errorsBrowser;
hasRequiredErrorsBrowser = 1;
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var codes = {};
function createErrorType(code, message, Base) {
if (!Base) {
Base = Error;
}
function getMessage(arg1, arg2, arg3) {
if (typeof message === "string") {
return message;
} else {
return message(arg1, arg2, arg3);
}
}
var NodeError = /* @__PURE__ */ function(_Base) {
_inheritsLoose(NodeError2, _Base);
function NodeError2(arg1, arg2, arg3) {
return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
}
return NodeError2;
}(Base);
NodeError.prototype.name = Base.name;
NodeError.prototype.code = code;
codes[code] = NodeError;
}
function oneOf(expected, thing) {
if (Array.isArray(expected)) {
var len = expected.length;
expected = expected.map(function(i) {
return String(i);
});
if (len > 2) {
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1];
} else if (len === 2) {
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
} else {
return "of ".concat(thing, " ").concat(expected[0]);
}
} else {
return "of ".concat(thing, " ").concat(String(expected));
}
}
function startsWith(str, search, pos) {
return str.substr(0, search.length) === search;
}
function endsWith(str, search, this_len) {
if (this_len === void 0 || this_len > str.length) {
this_len = str.length;
}
return str.substring(this_len - search.length, this_len) === search;
}
function includes(str, search, start) {
if (typeof start !== "number") {
start = 0;
}
if (start + search.length > str.length) {
return false;
} else {
return str.indexOf(search, start) !== -1;
}
}
createErrorType("ERR_INVALID_OPT_VALUE", function(name, value) {
return 'The value "' + value + '" is invalid for option "' + name + '"';
}, TypeError);
createErrorType("ERR_INVALID_ARG_TYPE", function(name, expected, actual) {
var determiner;
if (typeof expected === "string" && startsWith(expected, "not ")) {
determiner = "must not be";
expected = expected.replace(/^not /, "");
} else {
determiner = "must be";
}
var msg;
if (endsWith(name, " argument")) {
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
} else {
var type2 = includes(name, ".") ? "property" : "argument";
msg = 'The "'.concat(name, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
}
msg += ". Received type ".concat(typeof actual);
return msg;
}, TypeError);
createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
createErrorType("ERR_METHOD_NOT_IMPLEMENTED", function(name) {
return "The " + name + " method is not implemented";
});
createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
createErrorType("ERR_STREAM_DESTROYED", function(name) {
return "Cannot call " + name + " after a stream was destroyed";
});
createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
createErrorType("ERR_UNKNOWN_ENCODING", function(arg) {
return "Unknown encoding: " + arg;
}, TypeError);
createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
errorsBrowser.codes = codes;
return errorsBrowser;
}
var state;
var hasRequiredState;
function requireState() {
if (hasRequiredState) return state;
hasRequiredState = 1;
var ERR_INVALID_OPT_VALUE = requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;
function highWaterMarkFrom(options, isDuplex, duplexKey) {
return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}
function getHighWaterMark(state2, options, duplexKey, isDuplex) {
var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
if (hwm != null) {
if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
var name = isDuplex ? duplexKey : "highWaterMark";
throw new ERR_INVALID_OPT_VALUE(name, hwm);
}
return Math.floor(hwm);
}
return state2.objectMode ? 16 : 16 * 1024;
}
state = {
getHighWaterMark
};
return state;
}
var browser;
var hasRequiredBrowser;
function requireBrowser() {
if (hasRequiredBrowser) return browser;
hasRequiredBrowser = 1;
browser = deprecate;
function deprecate(fn, msg) {
if (config("noDeprecation")) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (config("throwDeprecation")) {
throw new Error(msg);
} else if (config("traceDeprecation")) {
console.trace(msg);
} else {
console.warn(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
}
function config(name) {
try {
if (!commonjsGlobal.localStorage) return false;
} catch (_) {
return false;
}
var val = commonjsGlobal.localStorage[name];
if (null == val) return false;
return String(val).toLowerCase() === "true";
}
return browser;
}
var _stream_writable;
var hasRequired_stream_writable;
function require_stream_writable() {
if (hasRequired_stream_writable) return _stream_writable;
hasRequired_stream_writable = 1;
_stream_writable = Writable;
function CorkedRequest(state2) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state2);
};
}
var Duplex;
Writable.WritableState = WritableState;
var internalUtil = {
deprecate: requireBrowser()
};
var Stream = requireStreamBrowser();
var Buffer = requireDist().Buffer;
var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = requireDestroy();
var _require = requireState(), getHighWaterMark = _require.getHighWaterMark;
var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
var errorOrDestroy = destroyImpl.errorOrDestroy;
requireInherits_browser()(Writable, Stream);
function nop() {
}
function WritableState(options, stream, isDuplex) {
Duplex = Duplex || require_stream_duplex();
options = options || {};
if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function writableStateBufferGetter() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
});
} catch (_) {
}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function value(object) {
if (realHasInstance.call(this, object)) return true;
if (this !== Writable) return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function realHasInstance2(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require_stream_duplex();
var isDuplex = this instanceof Duplex;
if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
this._writableState = new WritableState(options, this, isDuplex);
this.writable = true;
if (options) {
if (typeof options.write === "function") this._write = options.write;
if (typeof options.writev === "function") this._writev = options.writev;
if (typeof options.destroy === "function") this._destroy = options.destroy;
if (typeof options.final === "function") this._final = options.final;
}
Stream.call(this);
}
Writable.prototype.pipe = function() {
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
};
function writeAfterEnd(stream, cb) {
var er = new ERR_STREAM_WRITE_AFTER_END();
errorOrDestroy(stream, er);
process$1$2.nextTick(cb, er);
}
function validChunk(stream, state2, chunk, cb) {
var er;
if (chunk === null) {
er = new ERR_STREAM_NULL_VALUES();
} else if (typeof chunk !== "string" && !state2.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
}
if (er) {
errorOrDestroy(stream, er);
process$1$2.nextTick(cb, er);
return false;
}
return true;
}
Writable.prototype.write = function(chunk, encoding, cb) {
var state2 = this._writableState;
var ret = false;
var isBuf = !state2.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer.isBuffer(chunk)) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (isBuf) encoding = "buffer";
else if (!encoding) encoding = state2.defaultEncoding;
if (typeof cb !== "function") cb = nop;
if (state2.ending) writeAfterEnd(this, cb);
else if (isBuf || validChunk(this, state2, chunk, cb)) {
state2.pendingcb++;
ret = writeOrBuffer(this, state2, isBuf, chunk, encoding, cb);
}
return ret;
};
Writable.prototype.cork = function() {
this._writableState.corked++;
};
Writable.prototype.uncork = function() {
var state2 = this._writableState;
if (state2.corked) {
state2.corked--;
if (!state2.writing && !state2.corked && !state2.bufferProcessing && state2.bufferedRequest) clearBuffer(this, state2);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
if (typeof encoding === "string") encoding = encoding.toLowerCase();
if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
Object.defineProperty(Writable.prototype, "writableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState && this._writableState.getBuffer();
}
});
function decodeChunk(state2, chunk, encoding) {
if (!state2.objectMode && state2.decodeStrings !== false && typeof chunk === "string") {
chunk = Buffer.from(chunk, encoding);
}
return chunk;
}
Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState.highWaterMark;
}
});
function writeOrBuffer(stream, state2, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state2, chunk, encoding);
if (chunk !== newChunk) {
isBuf = true;
encoding = "buffer";
chunk = newChunk;
}
}
var len = state2.objectMode ? 1 : chunk.length;
state2.length += len;
var ret = state2.length < state2.highWaterMark;
if (!ret) state2.needDrain = true;
if (state2.writing || state2.corked) {
var last = state2.lastBufferedRequest;
state2.lastBufferedRequest = {
chunk,
encoding,
isBuf,
callback: cb,
next: null
};
if (last) {
last.next = state2.lastBufferedRequest;
} else {
state2.bufferedRequest = state2.lastBufferedRequest;
}
state2.bufferedRequestCount += 1;
} else {
doWrite(stream, state2, false, len, chunk, encoding, cb);
}
return ret;
}
function doWrite(stream, state2, writev, len, chunk, encoding, cb) {
state2.writelen = len;
state2.writecb = cb;
state2.writing = true;
state2.sync = true;
if (state2.destroyed) state2.onwrite(new ERR_STREAM_DESTROYED("write"));
else if (writev) stream._writev(chunk, state2.onwrite);
else stream._write(chunk, encoding, state2.onwrite);
state2.sync = false;
}
function onwriteError(stream, state2, sync, er, cb) {
--state2.pendingcb;
if (sync) {
process$1$2.nextTick(cb, er);
process$1$2.nextTick(finishMaybe, stream, state2);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
} else {
cb(er);
stream._writableState.errorEmitted = true;
errorOrDestroy(stream, er);
finishMaybe(stream, state2);
}
}
function onwriteStateUpdate(state2) {
state2.writing = false;
state2.writecb = null;
state2.length -= state2.writelen;
state2.writelen = 0;
}
function onwrite(stream, er) {
var state2 = stream._writableState;
var sync = state2.sync;
var cb = state2.writecb;
if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK();
onwriteStateUpdate(state2);
if (er) onwriteError(stream, state2, sync, er, cb);
else {
var finished = needFinish(state2) || stream.destroyed;
if (!finished && !state2.corked && !state2.bufferProcessing && state2.bufferedRequest) {
clearBuffer(stream, state2);
}
if (sync) {
process$1$2.nextTick(afterWrite, stream, state2, finished, cb);
} else {
afterWrite(stream, state2, finished, cb);
}
}
}
function afterWrite(stream, state2, finished, cb) {
if (!finished) onwriteDrain(stream, state2);
state2.pendingcb--;
cb();
finishMaybe(stream, state2);
}
function onwriteDrain(stream, state2) {
if (state2.length === 0 && state2.needDrain) {
state2.needDrain = false;
stream.emit("drain");
}
}
function clearBuffer(stream, state2) {
state2.bufferProcessing = true;
var entry = state2.bufferedRequest;
if (stream._writev && entry && entry.next) {
var l = state2.bufferedRequestCount;
var buffer = new Array(l);
var holder = state2.corkedRequestsFree;
holder.entry = entry;
var count = 0;
var allBuffers = true;
while (entry) {
buffer[count] = entry;
if (!entry.isBuf) allBuffers = false;
entry = entry.next;
count += 1;
}
buffer.allBuffers = allBuffers;
doWrite(stream, state2, true, state2.length, buffer, "", holder.finish);
state2.pendingcb++;
state2.lastBufferedRequest = null;
if (holder.next) {
state2.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state2.corkedRequestsFree = new CorkedRequest(state2);
}
state2.bufferedRequestCount = 0;
} else {
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state2.objectMode ? 1 : chunk.length;
doWrite(stream, state2, false, len, chunk, encoding, cb);
entry = entry.next;
state2.bufferedRequestCount--;
if (state2.writing) {
break;
}
}
if (entry === null) state2.lastBufferedRequest = null;
}
state2.bufferedRequest = entry;
state2.bufferProcessing = false;
}
Writable.prototype._write = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
};
Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {
var state2 = this._writableState;
if (typeof chunk === "function") {
cb = chunk;
chunk = null;
encoding = null;
} else if (typeof encoding === "function") {
cb = encoding;
encoding = null;
}
if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
if (state2.corked) {
state2.corked = 1;
this.uncork();
}
if (!state2.ending) endWritable(this, state2, cb);
return this;
};
Object.defineProperty(Writable.prototype, "writableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState.length;
}
});
function needFinish(state2) {
return state2.ending && state2.length === 0 && state2.bufferedRequest === null && !state2.finished && !state2.writing;
}
function callFinal(stream, state2) {
stream._final(function(err) {
state2.pendingcb--;
if (err) {
errorOrDestroy(stream, err);
}
state2.prefinished = true;
stream.emit("prefinish");
finishMaybe(stream, state2);
});
}
function prefinish(stream, state2) {
if (!state2.prefinished && !state2.finalCalled) {
if (typeof stream._final === "function" && !state2.destroyed) {
state2.pendingcb++;
state2.finalCalled = true;
process$1$2.nextTick(callFinal, stream, state2);
} else {
state2.prefinished = true;
stream.emit("prefinish");
}
}
}
function finishMaybe(stream, state2) {
var need = needFinish(state2);
if (need) {
prefinish(stream, state2);
if (state2.pendingcb === 0) {
state2.finished = true;
stream.emit("finish");
if (state2.autoDestroy) {
var rState = stream._readableState;
if (!rState || rState.autoDestroy && rState.endEmitted) {
stream.destroy();
}
}
}
}
return need;
}
function endWritable(stream, state2, cb) {
state2.ending = true;
finishMaybe(stream, state2);
if (cb) {
if (state2.finished) process$1$2.nextTick(cb);
else stream.once("finish", cb);
}
state2.ended = true;
stream.writable = false;
}
function onCorkedFinish(corkReq, state2, err) {
var entry = corkReq.entry;
corkReq.entry = null;
while (entry) {
var cb = entry.callback;
state2.pendingcb--;
cb(err);
entry = entry.next;
}
state2.corkedRequestsFree.next = corkReq;
}
Object.defineProperty(Writable.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
if (this._writableState === void 0) {
return false;
}
return this._writableState.destroyed;
},
set: function set(value) {
if (!this._writableState) {
return;
}
this._writableState.destroyed = value;
}
});
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
Writable.prototype._destroy = function(err, cb) {
cb(err);
};
return _stream_writable;
}
var _stream_duplex;
var hasRequired_stream_duplex;
function require_stream_duplex() {
if (hasRequired_stream_duplex) return _stream_duplex;
hasRequired_stream_duplex = 1;
var objectKeys = Object.keys || function(obj) {
var keys2 = [];
for (var key in obj) keys2.push(key);
return keys2;
};
_stream_duplex = Duplex;
var Readable = require_stream_readable();
var Writable = require_stream_writable();
requireInherits_browser()(Duplex, Readable);
{
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
}
function Duplex(options) {
if (!(this instanceof Duplex)) return new Duplex(options);
Readable.call(this, options);
Writable.call(this, options);
this.allowHalfOpen = true;
if (options) {
if (options.readable === false) this.readable = false;
if (options.writable === false) this.writable = false;
if (options.allowHalfOpen === false) {
this.allowHalfOpen = false;
this.once("end", onend);
}
}
}
Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState.highWaterMark;
}
});
Object.defineProperty(Duplex.prototype, "writableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState && this._writableState.getBuffer();
}
});
Object.defineProperty(Duplex.prototype, "writableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._writableState.length;
}
});
function onend() {
if (this._writableState.ended) return;
process$1$2.nextTick(onEndNT, this);
}
function onEndNT(self2) {
self2.end();
}
Object.defineProperty(Duplex.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
if (this._readableState === void 0 || this._writableState === void 0) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set: function set(value) {
if (this._readableState === void 0 || this._writableState === void 0) {
return;
}
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
});
return _stream_duplex;
}
var endOfStream;
var hasRequiredEndOfStream;
function requireEndOfStream() {
if (hasRequiredEndOfStream) return endOfStream;
hasRequiredEndOfStream = 1;
var ERR_STREAM_PREMATURE_CLOSE = requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;
function once(callback) {
var called = false;
return function() {
if (called) return;
called = true;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
callback.apply(this, args);
};
}
function noop() {
}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function eos(stream, opts, callback) {
if (typeof opts === "function") return eos(stream, null, opts);
if (!opts) opts = {};
callback = once(callback || noop);
var readable = opts.readable || opts.readable !== false && stream.readable;
var writable = opts.writable || opts.writable !== false && stream.writable;
var onlegacyfinish = function onlegacyfinish2() {
if (!stream.writable) onfinish();
};
var writableEnded = stream._writableState && stream._writableState.finished;
var onfinish = function onfinish2() {
writable = false;
writableEnded = true;
if (!readable) callback.call(stream);
};
var readableEnded = stream._readableState && stream._readableState.endEmitted;
var onend = function onend2() {
readable = false;
readableEnded = true;
if (!writable) callback.call(stream);
};
var onerror = function onerror2(err) {
callback.call(stream, err);
};
var onclose = function onclose2() {
var err;
if (readable && !readableEnded) {
if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
return callback.call(stream, err);
}
if (writable && !writableEnded) {
if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
return callback.call(stream, err);
}
};
var onrequest = function onrequest2() {
stream.req.on("finish", onfinish);
};
if (isRequest(stream)) {
stream.on("complete", onfinish);
stream.on("abort", onclose);
if (stream.req) onrequest();
else stream.on("request", onrequest);
} else if (writable && !stream._writableState) {
stream.on("end", onlegacyfinish);
stream.on("close", onlegacyfinish);
}
stream.on("end", onend);
stream.on("finish", onfinish);
if (opts.error !== false) stream.on("error", onerror);
stream.on("close", onclose);
return function() {
stream.removeListener("complete", onfinish);
stream.removeListener("abort", onclose);
stream.removeListener("request", onrequest);
if (stream.req) stream.req.removeListener("finish", onfinish);
stream.removeListener("end", onlegacyfinish);
stream.removeListener("close", onlegacyfinish);
stream.removeListener("finish", onfinish);
stream.removeListener("end", onend);
stream.removeListener("error", onerror);
stream.removeListener("close", onclose);
};
}
endOfStream = eos;
return endOfStream;
}
var async_iterator;
var hasRequiredAsync_iterator;
function requireAsync_iterator() {
if (hasRequiredAsync_iterator) return async_iterator;
hasRequiredAsync_iterator = 1;
var _Object$setPrototypeO;
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== void 0) {
var res = prim.call(input, hint);
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var finished = requireEndOfStream();
var kLastResolve = Symbol("lastResolve");
var kLastReject = Symbol("lastReject");
var kError = Symbol("error");
var kEnded = Symbol("ended");
var kLastPromise = Symbol("lastPromise");
var kHandlePromise = Symbol("handlePromise");
var kStream = Symbol("stream");
function createIterResult(value, done) {
return {
value,
done
};
}
function readAndResolve(iter) {
var resolve = iter[kLastResolve];
if (resolve !== null) {
var data = iter[kStream].read();
if (data !== null) {
iter[kLastPromise] = null;
iter[kLastResolve] = null;
iter[kLastReject] = null;
resolve(createIterResult(data, false));
}
}
}
function onReadable(iter) {
process$1$2.nextTick(readAndResolve, iter);
}
function wrapForNext(lastPromise, iter) {
return function(resolve, reject) {
lastPromise.then(function() {
if (iter[kEnded]) {
resolve(createIterResult(void 0, true));
return;
}
iter[kHandlePromise](resolve, reject);
}, reject);
};
}
var AsyncIteratorPrototype = Object.getPrototypeOf(function() {
});
var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
get stream() {
return this[kStream];
},
next: function next() {
var _this = this;
var error = this[kError];
if (error !== null) {
return Promise.reject(error);
}
if (this[kEnded]) {
return Promise.resolve(createIterResult(void 0, true));
}
if (this[kStream].destroyed) {
return new Promise(function(resolve, reject) {
process$1$2.nextTick(function() {
if (_this[kError]) {
reject(_this[kError]);
} else {
resolve(createIterResult(void 0, true));
}
});
});
}
var lastPromise = this[kLastPromise];
var promise;
if (lastPromise) {
promise = new Promise(wrapForNext(lastPromise, this));
} else {
var data = this[kStream].read();
if (data !== null) {
return Promise.resolve(createIterResult(data, false));
}
promise = new Promise(this[kHandlePromise]);
}
this[kLastPromise] = promise;
return promise;
}
}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function() {
return this;
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
var _this2 = this;
return new Promise(function(resolve, reject) {
_this2[kStream].destroy(null, function(err) {
if (err) {
reject(err);
return;
}
resolve(createIterResult(void 0, true));
});
});
}), _Object$setPrototypeO), AsyncIteratorPrototype);
var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator2(stream) {
var _Object$create;
var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
value: stream,
writable: true
}), _defineProperty(_Object$create, kLastResolve, {
value: null,
writable: true
}), _defineProperty(_Object$create, kLastReject, {
value: null,
writable: true
}), _defineProperty(_Object$create, kError, {
value: null,
writable: true
}), _defineProperty(_Object$create, kEnded, {
value: stream._readableState.endEmitted,
writable: true
}), _defineProperty(_Object$create, kHandlePromise, {
value: function value(resolve, reject) {
var data = iterator[kStream].read();
if (data) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(data, false));
} else {
iterator[kLastResolve] = resolve;
iterator[kLastReject] = reject;
}
},
writable: true
}), _Object$create));
iterator[kLastPromise] = null;
finished(stream, function(err) {
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
var reject = iterator[kLastReject];
if (reject !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
reject(err);
}
iterator[kError] = err;
return;
}
var resolve = iterator[kLastResolve];
if (resolve !== null) {
iterator[kLastPromise] = null;
iterator[kLastResolve] = null;
iterator[kLastReject] = null;
resolve(createIterResult(void 0, true));
}
iterator[kEnded] = true;
});
stream.on("readable", onReadable.bind(null, iterator));
return iterator;
};
async_iterator = createReadableStreamAsyncIterator;
return async_iterator;
}
var fromBrowser;
var hasRequiredFromBrowser;
function requireFromBrowser() {
if (hasRequiredFromBrowser) return fromBrowser;
hasRequiredFromBrowser = 1;
fromBrowser = function() {
throw new Error("Readable.from is not available in the browser");
};
return fromBrowser;
}
var _stream_readable;
var hasRequired_stream_readable;
function require_stream_readable() {
if (hasRequired_stream_readable) return _stream_readable;
hasRequired_stream_readable = 1;
_stream_readable = Readable;
var Duplex;
Readable.ReadableState = ReadableState;
requireEvents().EventEmitter;
var EElistenerCount = function EElistenerCount2(emitter, type2) {
return emitter.listeners(type2).length;
};
var Stream = requireStreamBrowser();
var Buffer = requireDist().Buffer;
var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
var debugUtil = requireUtil();
var debug;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog("stream");
} else {
debug = function debug2() {
};
}
var BufferList = requireBuffer_list();
var destroyImpl = requireDestroy();
var _require = requireState(), getHighWaterMark = _require.getHighWaterMark;
var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
var StringDecoder;
var createReadableStreamAsyncIterator;
var from;
requireInherits_browser()(Readable, Stream);
var errorOrDestroy = destroyImpl.errorOrDestroy;
var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
function prependListener(emitter, event, fn) {
if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
else emitter._events[event] = [fn, emitter._events[event]];
}
function ReadableState(options, stream, isDuplex) {
Duplex = Duplex || require_stream_duplex();
options = options || {};
if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
this.flowing = null;
this.ended = false;
this.endEmitted = false;
this.reading = false;
this.sync = true;
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
this.paused = true;
this.emitClose = options.emitClose !== false;
this.autoDestroy = !!options.autoDestroy;
this.destroyed = false;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.awaitDrain = 0;
this.readingMore = false;
this.decoder = null;
this.encoding = null;
if (options.encoding) {
if (!StringDecoder) StringDecoder = requireString_decoder().StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
Duplex = Duplex || require_stream_duplex();
if (!(this instanceof Readable)) return new Readable(options);
var isDuplex = this instanceof Duplex;
this._readableState = new ReadableState(options, this, isDuplex);
this.readable = true;
if (options) {
if (typeof options.read === "function") this._read = options.read;
if (typeof options.destroy === "function") this._destroy = options.destroy;
}
Stream.call(this);
}
Object.defineProperty(Readable.prototype, "destroyed", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
if (this._readableState === void 0) {
return false;
}
return this._readableState.destroyed;
},
set: function set(value) {
if (!this._readableState) {
return;
}
this._readableState.destroyed = value;
}
});
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
Readable.prototype._destroy = function(err, cb) {
cb(err);
};
Readable.prototype.push = function(chunk, encoding) {
var state2 = this._readableState;
var skipChunkCheck;
if (!state2.objectMode) {
if (typeof chunk === "string") {
encoding = encoding || state2.defaultEncoding;
if (encoding !== state2.encoding) {
chunk = Buffer.from(chunk, encoding);
encoding = "";
}
skipChunkCheck = true;
}
} else {
skipChunkCheck = true;
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
};
Readable.prototype.unshift = function(chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
debug("readableAddChunk", chunk);
var state2 = stream._readableState;
if (chunk === null) {
state2.reading = false;
onEofChunk(stream, state2);
} else {
var er;
if (!skipChunkCheck) er = chunkInvalid(state2, chunk);
if (er) {
errorOrDestroy(stream, er);
} else if (state2.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== "string" && !state2.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
if (state2.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
else addChunk(stream, state2, chunk, true);
} else if (state2.ended) {
errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
} else if (state2.destroyed) {
return false;
} else {
state2.reading = false;
if (state2.decoder && !encoding) {
chunk = state2.decoder.write(chunk);
if (state2.objectMode || chunk.length !== 0) addChunk(stream, state2, chunk, false);
else maybeReadMore(stream, state2);
} else {
addChunk(stream, state2, chunk, false);
}
}
} else if (!addToFront) {
state2.reading = false;
maybeReadMore(stream, state2);
}
}
return !state2.ended && (state2.length < state2.highWaterMark || state2.length === 0);
}
function addChunk(stream, state2, chunk, addToFront) {
if (state2.flowing && state2.length === 0 && !state2.sync) {
state2.awaitDrain = 0;
stream.emit("data", chunk);
} else {
state2.length += state2.objectMode ? 1 : chunk.length;
if (addToFront) state2.buffer.unshift(chunk);
else state2.buffer.push(chunk);
if (state2.needReadable) emitReadable(stream);
}
maybeReadMore(stream, state2);
}
function chunkInvalid(state2, chunk) {
var er;
if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state2.objectMode) {
er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
return er;
}
Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder) StringDecoder = requireString_decoder().StringDecoder;
var decoder = new StringDecoder(enc);
this._readableState.decoder = decoder;
this._readableState.encoding = this._readableState.decoder.encoding;
var p = this._readableState.buffer.head;
var content = "";
while (p !== null) {
content += decoder.write(p.data);
p = p.next;
}
this._readableState.buffer.clear();
if (content !== "") this._readableState.buffer.push(content);
this._readableState.length = content.length;
return this;
};
var MAX_HWM = 1073741824;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
n--;
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
n++;
}
return n;
}
function howMuchToRead(n, state2) {
if (n <= 0 || state2.length === 0 && state2.ended) return 0;
if (state2.objectMode) return 1;
if (n !== n) {
if (state2.flowing && state2.length) return state2.buffer.head.data.length;
else return state2.length;
}
if (n > state2.highWaterMark) state2.highWaterMark = computeNewHighWaterMark(n);
if (n <= state2.length) return n;
if (!state2.ended) {
state2.needReadable = true;
return 0;
}
return state2.length;
}
Readable.prototype.read = function(n) {
debug("read", n);
n = parseInt(n, 10);
var state2 = this._readableState;
var nOrig = n;
if (n !== 0) state2.emittedReadable = false;
if (n === 0 && state2.needReadable && ((state2.highWaterMark !== 0 ? state2.length >= state2.highWaterMark : state2.length > 0) || state2.ended)) {
debug("read: emitReadable", state2.length, state2.ended);
if (state2.length === 0 && state2.ended) endReadable(this);
else emitReadable(this);
return null;
}
n = howMuchToRead(n, state2);
if (n === 0 && state2.ended) {
if (state2.length === 0) endReadable(this);
return null;
}
var doRead = state2.needReadable;
debug("need readable", doRead);
if (state2.length === 0 || state2.length - n < state2.highWaterMark) {
doRead = true;
debug("length less than watermark", doRead);
}
if (state2.ended || state2.reading) {
doRead = false;
debug("reading or ended", doRead);
} else if (doRead) {
debug("do read");
state2.reading = true;
state2.sync = true;
if (state2.length === 0) state2.needReadable = true;
this._read(state2.highWaterMark);
state2.sync = false;
if (!state2.reading) n = howMuchToRead(nOrig, state2);
}
var ret;
if (n > 0) ret = fromList(n, state2);
else ret = null;
if (ret === null) {
state2.needReadable = state2.length <= state2.highWaterMark;
n = 0;
} else {
state2.length -= n;
state2.awaitDrain = 0;
}
if (state2.length === 0) {
if (!state2.ended) state2.needReadable = true;
if (nOrig !== n && state2.ended) endReadable(this);
}
if (ret !== null) this.emit("data", ret);
return ret;
};
function onEofChunk(stream, state2) {
debug("onEofChunk");
if (state2.ended) return;
if (state2.decoder) {
var chunk = state2.decoder.end();
if (chunk && chunk.length) {
state2.buffer.push(chunk);
state2.length += state2.objectMode ? 1 : chunk.length;
}
}
state2.ended = true;
if (state2.sync) {
emitReadable(stream);
} else {
state2.needReadable = false;
if (!state2.emittedReadable) {
state2.emittedReadable = true;
emitReadable_(stream);
}
}
}
function emitReadable(stream) {
var state2 = stream._readableState;
debug("emitReadable", state2.needReadable, state2.emittedReadable);
state2.needReadable = false;
if (!state2.emittedReadable) {
debug("emitReadable", state2.flowing);
state2.emittedReadable = true;
process$1$2.nextTick(emitReadable_, stream);
}
}
function emitReadable_(stream) {
var state2 = stream._readableState;
debug("emitReadable_", state2.destroyed, state2.length, state2.ended);
if (!state2.destroyed && (state2.length || state2.ended)) {
stream.emit("readable");
state2.emittedReadable = false;
}
state2.needReadable = !state2.flowing && !state2.ended && state2.length <= state2.highWaterMark;
flow(stream);
}
function maybeReadMore(stream, state2) {
if (!state2.readingMore) {
state2.readingMore = true;
process$1$2.nextTick(maybeReadMore_, stream, state2);
}
}
function maybeReadMore_(stream, state2) {
while (!state2.reading && !state2.ended && (state2.length < state2.highWaterMark || state2.flowing && state2.length === 0)) {
var len = state2.length;
debug("maybeReadMore read 0");
stream.read(0);
if (len === state2.length)
break;
}
state2.readingMore = false;
}
Readable.prototype._read = function(n) {
errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
};
Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state2 = this._readableState;
switch (state2.pipesCount) {
case 0:
state2.pipes = dest;
break;
case 1:
state2.pipes = [state2.pipes, dest];
break;
default:
state2.pipes.push(dest);
break;
}
state2.pipesCount += 1;
debug("pipe count=%d opts=%j", state2.pipesCount, pipeOpts);
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process$1$2.stdout && dest !== process$1$2.stderr;
var endFn = doEnd ? onend : unpipe;
if (state2.endEmitted) process$1$2.nextTick(endFn);
else src.once("end", endFn);
dest.on("unpipe", onunpipe);
function onunpipe(readable, unpipeInfo) {
debug("onunpipe");
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
cleanup();
}
}
}
function onend() {
debug("onend");
dest.end();
}
var ondrain = pipeOnDrain(src);
dest.on("drain", ondrain);
var cleanedUp = false;
function cleanup() {
debug("cleanup");
dest.removeListener("close", onclose);
dest.removeListener("finish", onfinish);
dest.removeListener("drain", ondrain);
dest.removeListener("error", onerror);
dest.removeListener("unpipe", onunpipe);
src.removeListener("end", onend);
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
if (state2.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
src.on("data", ondata);
function ondata(chunk) {
debug("ondata");
var ret = dest.write(chunk);
debug("dest.write", ret);
if (ret === false) {
if ((state2.pipesCount === 1 && state2.pipes === dest || state2.pipesCount > 1 && indexOf(state2.pipes, dest) !== -1) && !cleanedUp) {
debug("false write response, pause", state2.awaitDrain);
state2.awaitDrain++;
}
src.pause();
}
}
function onerror(er) {
debug("onerror", er);
unpipe();
dest.removeListener("error", onerror);
if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
}
prependListener(dest, "error", onerror);
function onclose() {
dest.removeListener("finish", onfinish);
unpipe();
}
dest.once("close", onclose);
function onfinish() {
debug("onfinish");
dest.removeListener("close", onclose);
unpipe();
}
dest.once("finish", onfinish);
function unpipe() {
debug("unpipe");
src.unpipe(dest);
}
dest.emit("pipe", src);
if (!state2.flowing) {
debug("pipe resume");
src.resume();
}
return dest;
};
function pipeOnDrain(src) {
return function pipeOnDrainFunctionResult() {
var state2 = src._readableState;
debug("pipeOnDrain", state2.awaitDrain);
if (state2.awaitDrain) state2.awaitDrain--;
if (state2.awaitDrain === 0 && EElistenerCount(src, "data")) {
state2.flowing = true;
flow(src);
}
};
}
Readable.prototype.unpipe = function(dest) {
var state2 = this._readableState;
var unpipeInfo = {
hasUnpiped: false
};
if (state2.pipesCount === 0) return this;
if (state2.pipesCount === 1) {
if (dest && dest !== state2.pipes) return this;
if (!dest) dest = state2.pipes;
state2.pipes = null;
state2.pipesCount = 0;
state2.flowing = false;
if (dest) dest.emit("unpipe", this, unpipeInfo);
return this;
}
if (!dest) {
var dests = state2.pipes;
var len = state2.pipesCount;
state2.pipes = null;
state2.pipesCount = 0;
state2.flowing = false;
for (var i = 0; i < len; i++) dests[i].emit("unpipe", this, {
hasUnpiped: false
});
return this;
}
var index2 = indexOf(state2.pipes, dest);
if (index2 === -1) return this;
state2.pipes.splice(index2, 1);
state2.pipesCount -= 1;
if (state2.pipesCount === 1) state2.pipes = state2.pipes[0];
dest.emit("unpipe", this, unpipeInfo);
return this;
};
Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
var state2 = this._readableState;
if (ev === "data") {
state2.readableListening = this.listenerCount("readable") > 0;
if (state2.flowing !== false) this.resume();
} else if (ev === "readable") {
if (!state2.endEmitted && !state2.readableListening) {
state2.readableListening = state2.needReadable = true;
state2.flowing = false;
state2.emittedReadable = false;
debug("on readable", state2.length, state2.reading);
if (state2.length) {
emitReadable(this);
} else if (!state2.reading) {
process$1$2.nextTick(nReadingNextTick, this);
}
}
}
return res;
};
Readable.prototype.addListener = Readable.prototype.on;
Readable.prototype.removeListener = function(ev, fn) {
var res = Stream.prototype.removeListener.call(this, ev, fn);
if (ev === "readable") {
process$1$2.nextTick(updateReadableListening, this);
}
return res;
};
Readable.prototype.removeAllListeners = function(ev) {
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
if (ev === "readable" || ev === void 0) {
process$1$2.nextTick(updateReadableListening, this);
}
return res;
};
function updateReadableListening(self2) {
var state2 = self2._readableState;
state2.readableListening = self2.listenerCount("readable") > 0;
if (state2.resumeScheduled && !state2.paused) {
state2.flowing = true;
} else if (self2.listenerCount("data") > 0) {
self2.resume();
}
}
function nReadingNextTick(self2) {
debug("readable nexttick read 0");
self2.read(0);
}
Readable.prototype.resume = function() {
var state2 = this._readableState;
if (!state2.flowing) {
debug("resume");
state2.flowing = !state2.readableListening;
resume(this, state2);
}
state2.paused = false;
return this;
};
function resume(stream, state2) {
if (!state2.resumeScheduled) {
state2.resumeScheduled = true;
process$1$2.nextTick(resume_, stream, state2);
}
}
function resume_(stream, state2) {
debug("resume", state2.reading);
if (!state2.reading) {
stream.read(0);
}
state2.resumeScheduled = false;
stream.emit("resume");
flow(stream);
if (state2.flowing && !state2.reading) stream.read(0);
}
Readable.prototype.pause = function() {
debug("call pause flowing=%j", this._readableState.flowing);
if (this._readableState.flowing !== false) {
debug("pause");
this._readableState.flowing = false;
this.emit("pause");
}
this._readableState.paused = true;
return this;
};
function flow(stream) {
var state2 = stream._readableState;
debug("flow", state2.flowing);
while (state2.flowing && stream.read() !== null) ;
}
Readable.prototype.wrap = function(stream) {
var _this = this;
var state2 = this._readableState;
var paused = false;
stream.on("end", function() {
debug("wrapped end");
if (state2.decoder && !state2.ended) {
var chunk = state2.decoder.end();
if (chunk && chunk.length) _this.push(chunk);
}
_this.push(null);
});
stream.on("data", function(chunk) {
debug("wrapped data");
if (state2.decoder) chunk = state2.decoder.write(chunk);
if (state2.objectMode && (chunk === null || chunk === void 0)) return;
else if (!state2.objectMode && (!chunk || !chunk.length)) return;
var ret = _this.push(chunk);
if (!ret) {
paused = true;
stream.pause();
}
});
for (var i in stream) {
if (this[i] === void 0 && typeof stream[i] === "function") {
this[i] = /* @__PURE__ */ function methodWrap(method) {
return function methodWrapReturnFunction() {
return stream[method].apply(stream, arguments);
};
}(i);
}
}
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
this._read = function(n2) {
debug("wrapped _read", n2);
if (paused) {
paused = false;
stream.resume();
}
};
return this;
};
if (typeof Symbol === "function") {
Readable.prototype[Symbol.asyncIterator] = function() {
if (createReadableStreamAsyncIterator === void 0) {
createReadableStreamAsyncIterator = requireAsync_iterator();
}
return createReadableStreamAsyncIterator(this);
};
}
Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._readableState.highWaterMark;
}
});
Object.defineProperty(Readable.prototype, "readableBuffer", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._readableState && this._readableState.buffer;
}
});
Object.defineProperty(Readable.prototype, "readableFlowing", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._readableState.flowing;
},
set: function set(state2) {
if (this._readableState) {
this._readableState.flowing = state2;
}
}
});
Readable._fromList = fromList;
Object.defineProperty(Readable.prototype, "readableLength", {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
get: function get2() {
return this._readableState.length;
}
});
function fromList(n, state2) {
if (state2.length === 0) return null;
var ret;
if (state2.objectMode) ret = state2.buffer.shift();
else if (!n || n >= state2.length) {
if (state2.decoder) ret = state2.buffer.join("");
else if (state2.buffer.length === 1) ret = state2.buffer.first();
else ret = state2.buffer.concat(state2.length);
state2.buffer.clear();
} else {
ret = state2.buffer.consume(n, state2.decoder);
}
return ret;
}
function endReadable(stream) {
var state2 = stream._readableState;
debug("endReadable", state2.endEmitted);
if (!state2.endEmitted) {
state2.ended = true;
process$1$2.nextTick(endReadableNT, state2, stream);
}
}
function endReadableNT(state2, stream) {
debug("endReadableNT", state2.endEmitted, state2.length);
if (!state2.endEmitted && state2.length === 0) {
state2.endEmitted = true;
stream.readable = false;
stream.emit("end");
if (state2.autoDestroy) {
var wState = stream._writableState;
if (!wState || wState.autoDestroy && wState.finished) {
stream.destroy();
}
}
}
}
if (typeof Symbol === "function") {
Readable.from = function(iterable, opts) {
if (from === void 0) {
from = requireFromBrowser();
}
return from(Readable, iterable, opts);
};
}
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
return _stream_readable;
}
var _stream_transform;
var hasRequired_stream_transform;
function require_stream_transform() {
if (hasRequired_stream_transform) return _stream_transform;
hasRequired_stream_transform = 1;
_stream_transform = Transform;
var _require$codes = requireErrorsBrowser().codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
var Duplex = require_stream_duplex();
requireInherits_browser()(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
var cb = ts.writecb;
if (cb === null) {
return this.emit("error", new ERR_MULTIPLE_CALLBACK());
}
ts.writechunk = null;
ts.writecb = null;
if (data != null)
this.push(data);
cb(er);
var rs = this._readableState;
rs.reading = false;
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
}
function Transform(options) {
if (!(this instanceof Transform)) return new Transform(options);
Duplex.call(this, options);
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: null
};
this._readableState.needReadable = true;
this._readableState.sync = false;
if (options) {
if (typeof options.transform === "function") this._transform = options.transform;
if (typeof options.flush === "function") this._flush = options.flush;
}
this.on("prefinish", prefinish);
}
function prefinish() {
var _this = this;
if (typeof this._flush === "function" && !this._readableState.destroyed) {
this._flush(function(er, data) {
done(_this, er, data);
});
} else {
done(this, null, null);
}
}
Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
Transform.prototype._transform = function(chunk, encoding, cb) {
cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
};
Transform.prototype._write = function(chunk, encoding, cb) {
var ts = this._transformState;
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
}
};
Transform.prototype._read = function(n) {
var ts = this._transformState;
if (ts.writechunk !== null && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
ts.needTransform = true;
}
};
Transform.prototype._destroy = function(err, cb) {
Duplex.prototype._destroy.call(this, err, function(err2) {
cb(err2);
});
};
function done(stream, er, data) {
if (er) return stream.emit("error", er);
if (data != null)
stream.push(data);
if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
return stream.push(null);
}
return _stream_transform;
}
var _stream_passthrough;
var hasRequired_stream_passthrough;
function require_stream_passthrough() {
if (hasRequired_stream_passthrough) return _stream_passthrough;
hasRequired_stream_passthrough = 1;
_stream_passthrough = PassThrough;
var Transform = require_stream_transform();
requireInherits_browser()(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough)) return new PassThrough(options);
Transform.call(this, options);
}
PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
return _stream_passthrough;
}
var pipeline_1;
var hasRequiredPipeline;
function requirePipeline() {
if (hasRequiredPipeline) return pipeline_1;
hasRequiredPipeline = 1;
var eos;
function once(callback) {
var called = false;
return function() {
if (called) return;
called = true;
callback.apply(void 0, arguments);
};
}
var _require$codes = requireErrorsBrowser().codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
function noop(err) {
if (err) throw err;
}
function isRequest(stream) {
return stream.setHeader && typeof stream.abort === "function";
}
function destroyer(stream, reading, writing, callback) {
callback = once(callback);
var closed = false;
stream.on("close", function() {
closed = true;
});
if (eos === void 0) eos = requireEndOfStream();
eos(stream, {
readable: reading,
writable: writing
}, function(err) {
if (err) return callback(err);
closed = true;
callback();
});
var destroyed = false;
return function(err) {
if (closed) return;
if (destroyed) return;
destroyed = true;
if (isRequest(stream)) return stream.abort();
if (typeof stream.destroy === "function") return stream.destroy();
callback(err || new ERR_STREAM_DESTROYED("pipe"));
};
}
function call(fn) {
fn();
}
function pipe(from, to) {
return from.pipe(to);
}
function popCallback(streams) {
if (!streams.length) return noop;
if (typeof streams[streams.length - 1] !== "function") return noop;
return streams.pop();
}
function pipeline() {
for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
streams[_key] = arguments[_key];
}
var callback = popCallback(streams);
if (Array.isArray(streams[0])) streams = streams[0];
if (streams.length < 2) {
throw new ERR_MISSING_ARGS("streams");
}
var error;
var destroys = streams.map(function(stream, i) {
var reading = i < streams.length - 1;
var writing = i > 0;
return destroyer(stream, reading, writing, function(err) {
if (!error) error = err;
if (err) destroys.forEach(call);
if (reading) return;
destroys.forEach(call);
callback(error);
});
});
return streams.reduce(pipe);
}
pipeline_1 = pipeline;
return pipeline_1;
}
var streamBrowserify;
var hasRequiredStreamBrowserify;
function requireStreamBrowserify() {
if (hasRequiredStreamBrowserify) return streamBrowserify;
hasRequiredStreamBrowserify = 1;
streamBrowserify = Stream;
var EE = requireEvents().EventEmitter;
var inherits = requireInherits_browser();
inherits(Stream, EE);
Stream.Readable = require_stream_readable();
Stream.Writable = require_stream_writable();
Stream.Duplex = require_stream_duplex();
Stream.Transform = require_stream_transform();
Stream.PassThrough = require_stream_passthrough();
Stream.finished = requireEndOfStream();
Stream.pipeline = requirePipeline();
Stream.Stream = Stream;
function Stream() {
EE.call(this);
}
Stream.prototype.pipe = function(dest, options) {
var source = this;
function ondata(chunk) {
if (dest.writable) {
if (false === dest.write(chunk) && source.pause) {
source.pause();
}
}
}
source.on("data", ondata);
function ondrain() {
if (source.readable && source.resume) {
source.resume();
}
}
dest.on("drain", ondrain);
if (!dest._isStdio && (!options || options.end !== false)) {
source.on("end", onend);
source.on("close", onclose);
}
var didOnEnd = false;
function onend() {
if (didOnEnd) return;
didOnEnd = true;
dest.end();
}
function onclose() {
if (didOnEnd) return;
didOnEnd = true;
if (typeof dest.destroy === "function") dest.destroy();
}
function onerror(er) {
cleanup();
if (EE.listenerCount(this, "error") === 0) {
throw er;
}
}
source.on("error", onerror);
dest.on("error", onerror);
function cleanup() {
source.removeListener("data", ondata);
dest.removeListener("drain", ondrain);
source.removeListener("end", onend);
source.removeListener("close", onclose);
source.removeListener("error", onerror);
dest.removeListener("error", onerror);
source.removeListener("end", cleanup);
source.removeListener("close", cleanup);
dest.removeListener("close", cleanup);
}
source.on("end", cleanup);
source.on("close", cleanup);
dest.on("close", cleanup);
dest.emit("pipe", source);
return dest;
};
return streamBrowserify;
}
var streamBrowserifyExports = requireStreamBrowserify();
const index = /* @__PURE__ */ getDefaultExportFromCjs(streamBrowserifyExports);
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: index
}, Symbol.toStringTag, { value: "Module" }));
export {
index$1 as i
};
//# sourceMappingURL=standards-sdk.es49-BoFc-ELK.js.map