var __bare_os_bundle_exports__ = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); var __commonJS = (cb, mod) => function __require2() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // ../../node_modules/bare-buffer/binding.js var require_binding = __commonJS({ "../../node_modules/bare-buffer/binding.js"(exports, module) { module.exports = __require.addon(); } }); // ../../node_modules/bare-buffer/lib/constants.js var require_constants = __commonJS({ "../../node_modules/bare-buffer/lib/constants.js"(exports, module) { var binding = require_binding(); module.exports = binding.constants; } }); // ../../node_modules/bare-buffer/lib/ascii.js var require_ascii = __commonJS({ "../../node_modules/bare-buffer/lib/ascii.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { return string.length; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { const offset = buffer.byteOffset + start; const len = end - start; if (binding.validateAscii(buffer.buffer, offset, len)) { return binding.toStringLatin1(buffer.buffer, offset, len); } let result = ""; for (let i = start; i < end; i++) { result += String.fromCharCode(buffer[i] & 127); } return result; }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeLatin1(buffer.buffer, buffer.byteOffset + start, end - start, string); }; exports.validate = function validate(buffer) { return binding.validateAscii(buffer.buffer, buffer.byteOffset, buffer.byteLength); }; } }); // ../../node_modules/bare-buffer/lib/base64.js var require_base64 = __commonJS({ "../../node_modules/bare-buffer/lib/base64.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { let len = string.length; if (string.charCodeAt(len - 1) === 61) len--; if (len > 1 && string.charCodeAt(len - 1) === 61) len--; return len * 3 >>> 2; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringBase64(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeBase64(buffer.buffer, buffer.byteOffset + start, end - start, string); }; } }); // ../../node_modules/bare-buffer/lib/base64url.js var require_base64url = __commonJS({ "../../node_modules/bare-buffer/lib/base64url.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { let len = string.length; if (string.charCodeAt(len - 1) === 61) len--; if (len > 1 && string.charCodeAt(len - 1) === 61) len--; return len * 3 >>> 2; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringBase64URL(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeBase64(buffer.buffer, buffer.byteOffset + start, end - start, string); }; } }); // ../../node_modules/bare-buffer/lib/hex.js var require_hex = __commonJS({ "../../node_modules/bare-buffer/lib/hex.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { return string.length >>> 1; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringHex(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeHex(buffer.buffer, buffer.byteOffset + start, end - start, string); }; } }); // ../../node_modules/bare-buffer/lib/utf8.js var require_utf8 = __commonJS({ "../../node_modules/bare-buffer/lib/utf8.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { return binding.byteLengthUTF8(string); }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringUTF8(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeUTF8(buffer.buffer, buffer.byteOffset + start, end - start, string); }; exports.validate = function validate(buffer) { return binding.validateUTF8(buffer.buffer, buffer.byteOffset, buffer.byteLength); }; } }); // ../../node_modules/bare-buffer/lib/utf16le.js var require_utf16le = __commonJS({ "../../node_modules/bare-buffer/lib/utf16le.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { return string.length * 2; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringUTF16LE(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeUTF16LE(buffer.buffer, buffer.byteOffset + start, end - start, string); }; } }); // ../../node_modules/bare-buffer/lib/latin1.js var require_latin1 = __commonJS({ "../../node_modules/bare-buffer/lib/latin1.js"(exports) { var binding = require_binding(); exports.byteLength = function byteLength(string) { return string.length; }; exports.toString = function toString(buffer, start = 0, end = buffer.byteLength) { return binding.toStringLatin1(buffer.buffer, buffer.byteOffset + start, end - start); }; exports.write = function write(buffer, string, start = 0, end = buffer.byteLength) { return binding.writeLatin1(buffer.buffer, buffer.byteOffset + start, end - start, string); }; } }); // ../../node_modules/bare-buffer/index.js var require_bare_buffer = __commonJS({ "../../node_modules/bare-buffer/index.js"(exports, module) { var constants = require_constants(); var ascii = require_ascii(); var base64 = require_base64(); var base64url = require_base64url(); var hex = require_hex(); var utf8 = require_utf8(); var utf16le = require_utf16le(); var latin1 = require_latin1(); var binding = require_binding(); var kind = Symbol.for("bare.buffer.kind"); var SWAP_MIN_LENGTH = 128; var poolSize = 65536; var pool = null; var poolLength = 0; var poolOffset = 0; var Buffer2 = class _Buffer extends Uint8Array { static get [kind]() { return 0; } static get poolSize() { return poolSize; } static set poolSize(value) { poolSize = Math.max(0, value); } constructor(arrayBuffer, offset, length, opts = {}) { if (typeof arrayBuffer === "number") { opts = offset || {}; const { uninitialized = false } = opts; offset = 0; length = arrayBuffer; if (Number.isNaN(length) || length < 0 || length > constants.MAX_LENGTH) { throw new RangeError(`Buffer length must be between 0 and ${constants.MAX_LENGTH}`); } arrayBuffer = uninitialized ? binding.allocUnsafe(length) : binding.alloc(length); } else { if (length > constants.MAX_LENGTH) { throw new RangeError(`Buffer length must be at most ${constants.MAX_LENGTH}`); } if (typeof offset === "object" && offset !== null) { opts = offset; offset = 0; length = arrayBuffer.byteLength; } else if (typeof length === "object" && length !== null) { opts = length; length = arrayBuffer.byteLength - offset; } } super(arrayBuffer, offset, length); } get [kind]() { return _Buffer[kind]; } copy(target, targetStart = 0, sourceStart = 0, sourceEnd = this.byteLength) { const source = this; if (targetStart < 0) targetStart = 0; if (targetStart >= target.byteLength) return 0; const targetLength = target.byteLength - targetStart; if (sourceStart < 0) sourceStart = 0; if (sourceStart >= source.byteLength) return 0; if (sourceEnd <= sourceStart) return 0; if (sourceEnd > source.byteLength) sourceEnd = source.byteLength; if (sourceEnd - sourceStart > targetLength) { sourceEnd = sourceStart + targetLength; } const sourceLength = sourceEnd - sourceStart; if (source === target) { target.copyWithin(targetStart, sourceStart, sourceEnd); } else if (sourceStart === 0 && sourceEnd === source.byteLength) { target.set(source, targetStart); } else { target.set( new Uint8Array(source.buffer, source.byteOffset + sourceStart, sourceLength), targetStart ); } return sourceLength; } equals(target) { const source = this; if (source === target) return true; if (source.byteLength !== target.byteLength) return false; return binding.compare( source.buffer, source.byteOffset, source.byteLength, target.buffer, target.byteOffset, target.byteLength ) === 0; } compare(target, targetStart = 0, targetEnd = target.byteLength, sourceStart = 0, sourceEnd = this.byteLength) { const source = this; if (source === target) return 0; if (arguments.length === 1) { targetStart = 0; targetEnd = target.byteLength; sourceStart = 0; sourceEnd = source.byteLength; } else { if (targetStart < 0) targetStart = 0; if (targetStart > target.byteLength) targetStart = target.byteLength; if (targetEnd < targetStart) targetEnd = targetStart; if (targetEnd > target.byteLength) targetEnd = target.byteLength; if (sourceStart < 0) sourceStart = 0; if (sourceStart > source.byteLength) sourceStart = source.byteLength; if (sourceEnd < sourceStart) sourceEnd = sourceStart; if (sourceEnd > source.byteLength) sourceEnd = source.byteLength; } return binding.compare( source.buffer, source.byteOffset + sourceStart, sourceEnd - sourceStart, target.buffer, target.byteOffset + targetStart, targetEnd - targetStart ); } fill(value, offset = 0, end = this.byteLength, encoding = "utf8") { if (typeof value === "string") { if (typeof offset === "string") { encoding = offset; offset = 0; end = this.byteLength; } else if (typeof end === "string") { encoding = end; end = this.byteLength; } } else if (typeof value === "number") { value = value & 255; } else if (typeof value === "boolean") { value = +value; } if (offset < 0) offset = 0; if (offset >= this.byteLength) return this; if (end <= offset) return this; if (end > this.byteLength) end = this.byteLength; if (typeof value === "number") return super.fill(value, offset, end); if (typeof value === "string") value = exports.from(value, encoding); const length = value.byteLength; if (length === 0) return super.fill(0, offset, end); if (length === 1) return super.fill(value[0], offset, end); return fillPattern(this, value, length, offset, end); } includes(value, offset, encoding) { return this.indexOf(value, offset, encoding) !== -1; } indexOf(value, offset = 0, encoding) { if (typeof value === "boolean") value = +value; if (typeof value === "number") { return super.indexOf(value & 255, offset); } return bidirectionalIndexOf( this, value, offset, encoding, true /* first */ ); } lastIndexOf(value, offset = this.byteLength - 1, encoding) { if (typeof value === "boolean") value = +value; if (typeof value === "number") { return super.lastIndexOf(value & 255, offset); } return bidirectionalIndexOf( this, value, offset, encoding, false /* last */ ); } swap16() { const length = this.byteLength; if (length % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); } if (length < SWAP_MIN_LENGTH) { for (let i = 0; i < length; i += 2) swap(this, i, i + 1); } else { binding.swap16(this.buffer, this.byteOffset, length); } return this; } swap32() { const length = this.byteLength; if (length % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); } if (length < SWAP_MIN_LENGTH) { for (let i = 0; i < length; i += 4) { swap(this, i, i + 3); swap(this, i + 1, i + 2); } } else { binding.swap32(this.buffer, this.byteOffset, length); } return this; } swap64() { const length = this.byteLength; if (length % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); } if (length < SWAP_MIN_LENGTH) { for (let i = 0; i < length; i += 8) { swap(this, i, i + 7); swap(this, i + 1, i + 6); swap(this, i + 2, i + 5); swap(this, i + 3, i + 4); } } else { binding.swap64(this.buffer, this.byteOffset, length); } return this; } toString(encoding = "utf8", start = 0, end = this.byteLength) { if (arguments.length === 0) return utf8.toString(this); if (arguments.length === 1) return codecFor(encoding).toString(this); if (start < 0) start = 0; if (start >= this.byteLength) return ""; if (end <= start) return ""; if (end > this.byteLength) end = this.byteLength; return codecFor(encoding).toString(this, start, end); } toJSON() { const length = this.byteLength; const data = new Array(length); for (let i = 0; i < length; i++) data[i] = this[i]; return data; } write(string, offset = 0, length = this.byteLength - offset, encoding = "utf8") { if (arguments.length === 1) return utf8.write(this, string); if (typeof offset === "string") { encoding = offset; offset = 0; length = this.byteLength; } else if (typeof length === "string") { encoding = length; length = this.byteLength - offset; } length = Math.min(length, exports.byteLength(string, encoding)); let start = offset; if (start < 0) start = 0; if (start >= this.byteLength) return 0; let end = offset + length; if (end <= start) return 0; if (end > this.byteLength) end = this.byteLength; return codecFor(encoding).write(this, string, start, end); } readBigInt64BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getBigInt64(offset, false); } readBigInt64LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getBigInt64(offset, true); } readBigUint64BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getBigUint64(offset, false); } readBigUint64LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getBigUint64(offset, true); } readDoubleBE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getFloat64(offset, false); } readDoubleLE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getFloat64(offset, true); } readFloatBE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getFloat32(offset, false); } readFloatLE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); return viewOf(this).getFloat32(offset, true); } readInt8(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const value = this[offset]; if (value === void 0) boundsError(); return value << 24 >> 24; } readInt16BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 1]; if (first === void 0 || last === void 0) boundsError(); return (first << 8 | last) << 16 >> 16; } readInt16LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 1]; if (first === void 0 || last === void 0) boundsError(); return (last << 8 | first) << 16 >> 16; } readInt32BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 3]; if (first === void 0 || last === void 0) boundsError(); return first << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | last; } readInt32LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 3]; if (first === void 0 || last === void 0) boundsError(); return first | this[offset + 1] << 8 | this[offset + 2] << 16 | last << 24; } readIntBE(offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return readInt48BE(this, offset); if (byteLength === 5) return readInt40BE(this, offset); if (byteLength === 3) return readInt24BE(this, offset); if (byteLength === 4) return this.readInt32BE(offset); if (byteLength === 2) return this.readInt16BE(offset); if (byteLength === 1) return this.readInt8(offset); throw new RangeError(`Byte length must be between 1 and 6`); } readIntLE(offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return readInt48LE(this, offset); if (byteLength === 5) return readInt40LE(this, offset); if (byteLength === 3) return readInt24LE(this, offset); if (byteLength === 4) return this.readInt32LE(offset); if (byteLength === 2) return this.readInt16LE(offset); if (byteLength === 1) return this.readInt8(offset); throw new RangeError(`Byte length must be between 1 and 6`); } readUint8(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const value = this[offset]; if (value === void 0) boundsError(); return value; } readUint16BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 1]; if (first === void 0 || last === void 0) boundsError(); return first << 8 | last; } readUint16LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 1]; if (first === void 0 || last === void 0) boundsError(); return last << 8 | first; } readUint32BE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 3]; if (first === void 0 || last === void 0) boundsError(); return first * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | last); } readUint32LE(offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); const first = this[offset]; const last = this[offset + 3]; if (first === void 0 || last === void 0) boundsError(); return last * 16777216 + (this[offset + 2] << 16 | this[offset + 1] << 8 | first); } readUintBE(offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return readUint48BE(this, offset); if (byteLength === 5) return readUint40BE(this, offset); if (byteLength === 3) return readUint24BE(this, offset); if (byteLength === 4) return this.readUint32BE(offset); if (byteLength === 2) return this.readUint16BE(offset); if (byteLength === 1) return this.readUint8(offset); throw new RangeError(`Byte length must be between 1 and 6`); } readUintLE(offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return readUint48LE(this, offset); if (byteLength === 5) return readUint40LE(this, offset); if (byteLength === 3) return readUint24LE(this, offset); if (byteLength === 4) return this.readUint32LE(offset); if (byteLength === 2) return this.readUint16LE(offset); if (byteLength === 1) return this.readUint8(offset); throw new RangeError(`Byte length must be between 1 and 6`); } writeBigInt64BE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setBigInt64(offset, value, false); return offset + 8; } writeBigInt64LE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setBigInt64(offset, value, true); return offset + 8; } writeBigUint64BE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setBigUint64(offset, value, false); return offset + 8; } writeBigUint64LE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setBigUint64(offset, value, true); return offset + 8; } writeDoubleBE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setFloat64(offset, value, false); return offset + 8; } writeDoubleLE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setFloat64(offset, value, true); return offset + 8; } writeFloatBE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setFloat32(offset, value, false); return offset + 4; } writeFloatLE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); viewOf(this).setFloat32(offset, value, true); return offset + 4; } writeInt8(value, offset = 0) { return this.writeUint8(value, offset); } writeInt16BE(value, offset = 0) { return this.writeUint16BE(value, offset); } writeInt16LE(value, offset = 0) { return this.writeUint16LE(value, offset); } writeInt32BE(value, offset = 0) { return this.writeUint32BE(value, offset); } writeInt32LE(value, offset = 0) { return this.writeUint32LE(value, offset); } writeIntBE(value, offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return writeInt48BE(this, value, offset); if (byteLength === 5) return writeInt40BE(this, value, offset); if (byteLength === 3) return writeInt24BE(this, value, offset); if (byteLength === 4) return this.writeInt32BE(value, offset); if (byteLength === 2) return this.writeInt16BE(value, offset); if (byteLength === 1) return this.writeInt8(value, offset); throw new RangeError(`Byte length must be between 1 and 6`); } writeIntLE(value, offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return writeInt48LE(this, value, offset); if (byteLength === 5) return writeInt40LE(this, value, offset); if (byteLength === 3) return writeInt24LE(this, value, offset); if (byteLength === 4) return this.writeInt32LE(value, offset); if (byteLength === 2) return this.writeInt16LE(value, offset); if (byteLength === 1) return this.writeInt8(value, offset); throw new RangeError(`Byte length must be between 1 and 6`); } writeUint8(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); if (this[offset] === void 0) boundsError(); this[offset] = value; return offset + 1; } writeUint16BE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); if (this[offset] === void 0 || this[offset + 1] === void 0) boundsError(); this[offset] = value >>> 8; this[offset + 1] = value; return offset + 2; } writeUint16LE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); if (this[offset] === void 0 || this[offset + 1] === void 0) boundsError(); this[offset] = value; this[offset + 1] = value >>> 8; return offset + 2; } writeUint32LE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); if (this[offset] === void 0 || this[offset + 3] === void 0) boundsError(); this[offset] = value; this[offset + 1] = value >>> 8; this[offset + 2] = value >>> 16; this[offset + 3] = value >>> 24; return offset + 4; } writeUint32BE(value, offset = 0) { if (!Number.isInteger(offset)) offsetError(offset); if (this[offset] === void 0 || this[offset + 3] === void 0) boundsError(); this[offset] = value >>> 24; this[offset + 1] = value >>> 16; this[offset + 2] = value >>> 8; this[offset + 3] = value; return offset + 4; } writeUintBE(value, offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return writeUint48BE(this, value, offset); if (byteLength === 5) return writeUint40BE(this, value, offset); if (byteLength === 3) return writeUint24BE(this, value, offset); if (byteLength === 4) return this.writeUint32BE(value, offset); if (byteLength === 2) return this.writeUint16BE(value, offset); if (byteLength === 1) return this.writeUint8(value, offset); throw new RangeError(`Byte length must be between 1 and 6`); } writeUintLE(value, offset, byteLength) { if (!Number.isInteger(offset)) offsetError(offset); if (byteLength === 6) return writeUint48LE(this, value, offset); if (byteLength === 5) return writeUint40LE(this, value, offset); if (byteLength === 3) return writeUint24LE(this, value, offset); if (byteLength === 4) return this.writeUint32LE(value, offset); if (byteLength === 2) return this.writeUint16LE(value, offset); if (byteLength === 1) return this.writeUint8(value, offset); throw new RangeError(`Byte length must be between 1 and 6`); } }; for (const [alias, name] of [ ["readBigUInt64BE", "readBigUint64BE"], ["readBigUInt64LE", "readBigUint64LE"], ["readUInt8", "readUint8"], ["readUInt16BE", "readUint16BE"], ["readUInt16LE", "readUint16LE"], ["readUInt32BE", "readUint32BE"], ["readUInt32LE", "readUint32LE"], ["readUIntBE", "readUintBE"], ["readUIntLE", "readUintLE"], ["writeBigUInt64BE", "writeBigUint64BE"], ["writeBigUInt64LE", "writeBigUint64LE"], ["writeUInt8", "writeUint8"], ["writeUInt16BE", "writeUint16BE"], ["writeUInt16LE", "writeUint16LE"], ["writeUInt32BE", "writeUint32BE"], ["writeUInt32LE", "writeUint32LE"], ["writeUIntBE", "writeUintBE"], ["writeUIntLE", "writeUintLE"] ]) { Object.defineProperty(Buffer2.prototype, alias, { value: Buffer2.prototype[name], writable: true, configurable: true }); } module.exports = exports = Buffer2; exports.Buffer = Buffer2; exports.constants = constants; var codecs = /* @__PURE__ */ Object.create(null); codecs.ascii = ascii; codecs.base64 = base64; codecs.base64url = base64url; codecs.hex = hex; codecs.utf8 = codecs["utf-8"] = utf8; codecs.utf16le = codecs.ucs2 = codecs["utf-16le"] = codecs["ucs-2"] = utf16le; codecs.latin1 = codecs.binary = latin1; function codecFor(encoding) { if (encoding === void 0) return utf8; let codec = codecs[encoding]; if (codec !== void 0) return codec; codec = codecs[encoding.toLowerCase()]; if (codec !== void 0) return codec; throw new Error(`Unknown encoding '${encoding}'`); } var views = /* @__PURE__ */ new WeakMap(); function viewOf(buffer) { let view = views.get(buffer); if (view === void 0) { view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength); views.set(buffer, view); } return view; } exports.isBuffer = function isBuffer(value) { if (value instanceof Buffer2) return true; return typeof value === "object" && value !== null && value[kind] === Buffer2[kind]; }; exports.isEncoding = function isEncoding(encoding) { try { codecFor(encoding); return true; } catch { return false; } }; exports.isASCII = function isASCII(buffer) { return ascii.validate(buffer); }; exports.isAscii = exports.isASCII; exports.isUTF8 = function isUTF8(buffer) { return utf8.validate(buffer); }; exports.isUtf8 = exports.isUTF8; exports.alloc = function alloc(size, fill, encoding) { if (fill !== void 0 && fill !== 0) { const buffer = new Buffer2(size, { uninitialized: true }); return buffer.fill(fill, 0, buffer.byteLength, encoding); } return new Buffer2(size); }; exports.allocUnsafe = function allocUnsafe(size) { return allocate(size); }; exports.allocUnsafeSlow = function allocUnsafeSlow(size) { return new Buffer2(size, { uninitialized: true }); }; exports.byteLength = function byteLength(string, encoding) { if (typeof string === "string") { return codecFor(encoding).byteLength(string); } return string.byteLength; }; exports.compare = function compare(a, b) { return binding.compare(a.buffer, a.byteOffset, a.byteLength, b.buffer, b.byteOffset, b.byteLength); }; exports.concat = function concat(buffers, length) { const n = buffers.length; if (length === void 0) { length = 0; for (let i = 0; i < n; i++) length += buffers[i].byteLength; } const result = allocate(length); let offset = 0; for (let i = 0; i < n; i++) { const buffer = buffers[i]; if (offset + buffer.byteLength > length) { result.set(new Uint8Array(buffer.buffer, buffer.byteOffset, length - offset), offset); return result; } result.set(buffer, offset); offset += buffer.byteLength; } if (offset < length) result.fill(0, offset, length); return result; }; exports.coerce = function coerce(buffer) { if (exports.isBuffer(buffer)) return buffer; return new Buffer2(buffer.buffer, buffer.byteOffset, buffer.byteLength); }; exports.copyBytesFrom = function copyBytesFrom(view, offset = 0, length = view.length - offset) { if (offset + length > view.length) { throw new RangeError("View length is out of range"); } if (offset !== 0 || length !== view.length) { view = view.subarray(offset, offset + length); } return new Buffer2(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength)); }; exports.from = function from(value, encodingOrOffset, length) { if (typeof value === "string") return fromString(value, encodingOrOffset); if (Array.isArray(value)) return fromArray(value); if (ArrayBuffer.isView(value)) return fromBuffer(value); return fromArrayBuffer(value, encodingOrOffset, length); }; function fromString(string, encoding) { const codec = codecFor(encoding); const length = codec.byteLength(string); const buffer = allocate(length); const written = codec.write(buffer, string, 0, length); if (written < length) return buffer.subarray(0, written); return buffer; } function fromArray(array) { const buffer = allocate(array.length); buffer.set(array); return buffer; } function fromBuffer(buffer) { const copy = allocate(buffer.byteLength); copy.set(buffer); return copy; } function fromArrayBuffer(arrayBuffer, offset, length) { return new Buffer2(arrayBuffer, offset, length); } function bidirectionalIndexOf(buffer, value, offset, encoding, first) { if (buffer.byteLength === 0) return -1; if (typeof offset === "string") { encoding = offset; offset = 0; } else if (offset === void 0) { offset = first ? 0 : buffer.byteLength - 1; } else if (offset < 0) { offset += buffer.byteLength; } if (offset >= buffer.byteLength) { if (first) return -1; else offset = buffer.byteLength - 1; } else if (offset < 0) { if (first) offset = 0; else return -1; } if (typeof value === "string") value = exports.from(value, encoding); const needleLength = value.byteLength; if (needleLength === 0) return -1; const length = buffer.byteLength; const last = length - needleLength; if (first) { if (offset > last) return -1; } else { if (offset > last) offset = last; if (offset < 0) return -1; } let j = 0; while (j < needleLength && buffer[offset + j] === value[j]) j++; if (j === needleLength) return offset; if (first) { if (offset === last) return -1; return binding.indexOf( buffer.buffer, buffer.byteOffset, length, value.buffer, value.byteOffset, needleLength, offset + 1 ); } if (offset === 0) return -1; return binding.lastIndexOf( buffer.buffer, buffer.byteOffset, length, value.buffer, value.byteOffset, needleLength, offset - 1 ); } function fillPattern(buffer, value, length, offset, end) { const n = end - offset; if (n < 64) { for (let i = 0; i < n; i++) buffer[offset + i] = value[i % length]; return buffer; } let filled = length < n ? length : n; for (let i = 0; i < filled; i++) buffer[offset + i] = value[i]; while (filled < n) { const copy = filled < n - filled ? filled : n - filled; buffer.copyWithin(offset + filled, offset, offset + copy); filled += copy; } return buffer; } function allocate(size) { if (Number.isNaN(size) || size <= 0 || size >= poolSize >>> 1) { return new Buffer2(size, { uninitialized: true }); } if (pool === null || poolLength !== poolSize || poolLength - poolOffset < size) { pool = binding.allocUnsafe(poolSize); poolLength = poolSize; poolOffset = 0; } const buffer = new Buffer2(pool, poolOffset, size); poolOffset = poolOffset + size + 7 & ~7; return buffer; } function swap(buffer, n, m) { const i = buffer[n]; buffer[n] = buffer[m]; buffer[m] = i; } exports.atob = function atob(data) { return Buffer2.from(data, "base64").toString("latin1"); }; exports.btoa = function btoa(data) { if (typeof data !== "string") data = String(data); return Buffer2.from(data, "latin1").toString("base64"); }; exports.transcode = function transcode(buffer, from, to) { return Buffer2.from(buffer.toString(from), to); }; function boundsError() { throw new RangeError("Offset is outside the bounds of the buffer"); } function offsetError(offset) { if (typeof offset !== "number") { throw new TypeError(`Offset must be a number, received type ${typeof offset}`); } throw new RangeError("Offset is outside the bounds of the buffer"); } function readInt48BE(buffer, offset) { const value = readUint48BE(buffer, offset); return value >= 140737488355328 ? value - 281474976710656 : value; } function readInt48LE(buffer, offset) { const value = readUint48LE(buffer, offset); return value >= 140737488355328 ? value - 281474976710656 : value; } function readInt40BE(buffer, offset) { const value = readUint40BE(buffer, offset); return value >= 549755813888 ? value - 1099511627776 : value; } function readInt40LE(buffer, offset) { const value = readUint40LE(buffer, offset); return value >= 549755813888 ? value - 1099511627776 : value; } function readInt24BE(buffer, offset) { const value = readUint24BE(buffer, offset); return value & 8388608 ? value - 16777216 : value; } function readInt24LE(buffer, offset) { const value = readUint24LE(buffer, offset); return value & 8388608 ? value - 16777216 : value; } function readUint48BE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 5]; if (first === void 0 || last === void 0) boundsError(); return (first * 256 + buffer[offset + 1]) * 4294967296 + (buffer[offset + 2] << 24 >>> 0) + (buffer[offset + 3] << 16) + (buffer[offset + 4] << 8) + last; } function readUint48LE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 5]; if (first === void 0 || last === void 0) boundsError(); return (buffer[offset + 4] + last * 256) * 4294967296 + (buffer[offset + 3] << 24 >>> 0) + (buffer[offset + 2] << 16) + (buffer[offset + 1] << 8) + first; } function readUint40BE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 4]; if (first === void 0 || last === void 0) boundsError(); return first * 4294967296 + (buffer[offset + 1] << 24 >>> 0) + (buffer[offset + 2] << 16) + (buffer[offset + 3] << 8) + last; } function readUint40LE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 4]; if (first === void 0 || last === void 0) boundsError(); return last * 4294967296 + (buffer[offset + 3] << 24 >>> 0) + (buffer[offset + 2] << 16) + (buffer[offset + 1] << 8) + first; } function readUint24BE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 2]; if (first === void 0 || last === void 0) boundsError(); return first << 16 | buffer[offset + 1] << 8 | last; } function readUint24LE(buffer, offset) { const first = buffer[offset]; const last = buffer[offset + 2]; if (first === void 0 || last === void 0) boundsError(); return last << 16 | buffer[offset + 1] << 8 | first; } function writeInt48BE(buffer, value, offset) { if (value < 0) value += 281474976710656; return writeUint48BE(buffer, value, offset); } function writeInt48LE(buffer, value, offset) { if (value < 0) value += 281474976710656; return writeUint48LE(buffer, value, offset); } function writeInt40BE(buffer, value, offset) { if (value < 0) value += 1099511627776; return writeUint40BE(buffer, value, offset); } function writeInt40LE(buffer, value, offset) { if (value < 0) value += 1099511627776; return writeUint40LE(buffer, value, offset); } function writeInt24BE(buffer, value, offset) { if (value < 0) value += 16777216; return writeUint24BE(buffer, value, offset); } function writeInt24LE(buffer, value, offset) { if (value < 0) value += 16777216; return writeUint24LE(buffer, value, offset); } function writeUint48BE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 5] === void 0) boundsError(); const hi = Math.floor(value / 4294967296); const lo = value >>> 0; buffer[offset] = hi >>> 8; buffer[offset + 1] = hi; buffer[offset + 2] = lo >>> 24; buffer[offset + 3] = lo >>> 16; buffer[offset + 4] = lo >>> 8; buffer[offset + 5] = lo; return offset + 6; } function writeUint48LE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 5] === void 0) boundsError(); const hi = Math.floor(value / 4294967296); const lo = value >>> 0; buffer[offset] = lo; buffer[offset + 1] = lo >>> 8; buffer[offset + 2] = lo >>> 16; buffer[offset + 3] = lo >>> 24; buffer[offset + 4] = hi; buffer[offset + 5] = hi >>> 8; return offset + 6; } function writeUint40BE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 4] === void 0) boundsError(); const lo = value >>> 0; buffer[offset] = Math.floor(value / 4294967296); buffer[offset + 1] = lo >>> 24; buffer[offset + 2] = lo >>> 16; buffer[offset + 3] = lo >>> 8; buffer[offset + 4] = lo; return offset + 5; } function writeUint40LE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 4] === void 0) boundsError(); const lo = value >>> 0; buffer[offset] = lo; buffer[offset + 1] = lo >>> 8; buffer[offset + 2] = lo >>> 16; buffer[offset + 3] = lo >>> 24; buffer[offset + 4] = Math.floor(value / 4294967296); return offset + 5; } function writeUint24BE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 2] === void 0) boundsError(); buffer[offset] = value >>> 16; buffer[offset + 1] = value >>> 8; buffer[offset + 2] = value; return offset + 3; } function writeUint24LE(buffer, value, offset) { if (buffer[offset] === void 0 || buffer[offset + 2] === void 0) boundsError(); buffer[offset] = value; buffer[offset + 1] = value >>> 8; buffer[offset + 2] = value >>> 16; return offset + 3; } } }); // ../../bare-lib-entry-bareBuffer.js var bare_lib_entry_bareBuffer_exports = {}; __export(bare_lib_entry_bareBuffer_exports, { default: () => bare_lib_entry_bareBuffer_default }); var import_bare_buffer = __toESM(require_bare_buffer()); var bare_lib_entry_bareBuffer_default = import_bare_buffer.default; return __toCommonJS(bare_lib_entry_bareBuffer_exports); })(); ;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};var e=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;var v=e!=null&&typeof e==="object"&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;g[s]["bareBuffer"]=v;})();