{"async_hooks.js":"'use strict';\n\nconst {\n ArrayPrototypeIncludes,\n ArrayPrototypeIndexOf,\n ArrayPrototypePush,\n ArrayPrototypeSplice,\n ArrayPrototypeUnshift,\n FunctionPrototypeBind,\n NumberIsSafeInteger,\n ObjectDefineProperties,\n ObjectFreeze,\n ReflectApply,\n Symbol,\n} = primordials;\n\nconst {\n ERR_ASYNC_CALLBACK,\n ERR_ASYNC_TYPE,\n ERR_INVALID_ASYNC_ID,\n ERR_INVALID_ARG_VALUE,\n} = require('internal/errors').codes;\nconst {\n kEmptyObject,\n} = require('internal/util');\nconst {\n validateBoolean,\n validateFunction,\n validateString,\n} = require('internal/validators');\nconst internal_async_hooks = require('internal/async_hooks');\n\nconst AsyncContextFrame = require('internal/async_context_frame');\n\n\n\n\nconst { registerDestroyHook, kNoPromiseHook } = internal_async_hooks;\nconst {\n asyncWrap,\n executionAsyncId,\n triggerAsyncId,\n\n hasAsyncIdStack,\n getHookArrays,\n enableHooks,\n disableHooks,\n updatePromiseHookMode,\n executionAsyncResource,\n\n newAsyncId,\n getDefaultTriggerAsyncId,\n emitInit,\n emitBefore,\n emitAfter,\n emitDestroy,\n initHooksExist,\n destroyHooksExist,\n} = internal_async_hooks;\n\n\nconst {\n async_id_symbol, trigger_async_id_symbol,\n init_symbol, before_symbol, after_symbol, destroy_symbol,\n promise_resolve_symbol,\n} = internal_async_hooks.symbols;\n\n\nconst {\n kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,\n} = internal_async_hooks.constants;\n\n\n\nclass AsyncHook {\n constructor({ init, before, after, destroy, promiseResolve, trackPromises }) {\n if (init !== undefined && typeof init !== 'function')\n throw new ERR_ASYNC_CALLBACK('hook.init');\n if (before !== undefined && typeof before !== 'function')\n throw new ERR_ASYNC_CALLBACK('hook.before');\n if (after !== undefined && typeof after !== 'function')\n throw new ERR_ASYNC_CALLBACK('hook.after');\n if (destroy !== undefined && typeof destroy !== 'function')\n throw new ERR_ASYNC_CALLBACK('hook.destroy');\n if (promiseResolve !== undefined && typeof promiseResolve !== 'function')\n throw new ERR_ASYNC_CALLBACK('hook.promiseResolve');\n if (trackPromises !== undefined) {\n validateBoolean(trackPromises, 'trackPromises');\n }\n\n this[init_symbol] = init;\n this[before_symbol] = before;\n this[after_symbol] = after;\n this[destroy_symbol] = destroy;\n this[promise_resolve_symbol] = promiseResolve;\n if (trackPromises === false) {\n if (promiseResolve) {\n throw new ERR_INVALID_ARG_VALUE('trackPromises',\n trackPromises, 'must not be false when promiseResolve is enabled');\n }\n this[kNoPromiseHook] = true;\n } else {\n\n this[kNoPromiseHook] = false;\n }\n }\n\n enable() {\n\n\n\n\n const { 0: hooks_array, 1: hook_fields } = getHookArrays();\n\n\n if (ArrayPrototypeIncludes(hooks_array, this))\n return this;\n\n const prev_kTotals = hook_fields[kTotals];\n\n\n\n\n hook_fields[kTotals] = hook_fields[kInit] += +!!this[init_symbol];\n hook_fields[kTotals] += hook_fields[kBefore] += +!!this[before_symbol];\n hook_fields[kTotals] += hook_fields[kAfter] += +!!this[after_symbol];\n hook_fields[kTotals] += hook_fields[kDestroy] += +!!this[destroy_symbol];\n hook_fields[kTotals] +=\n hook_fields[kPromiseResolve] += +!!this[promise_resolve_symbol];\n ArrayPrototypePush(hooks_array, this);\n\n if (prev_kTotals === 0 && hook_fields[kTotals] > 0) {\n enableHooks();\n }\n\n if (!this[kNoPromiseHook]) {\n updatePromiseHookMode();\n }\n\n return this;\n }\n\n disable() {\n const { 0: hooks_array, 1: hook_fields } = getHookArrays();\n\n const index = ArrayPrototypeIndexOf(hooks_array, this);\n if (index === -1)\n return this;\n\n const prev_kTotals = hook_fields[kTotals];\n\n hook_fields[kTotals] = hook_fields[kInit] -= +!!this[init_symbol];\n hook_fields[kTotals] += hook_fields[kBefore] -= +!!this[before_symbol];\n hook_fields[kTotals] += hook_fields[kAfter] -= +!!this[after_symbol];\n hook_fields[kTotals] += hook_fields[kDestroy] -= +!!this[destroy_symbol];\n hook_fields[kTotals] +=\n hook_fields[kPromiseResolve] -= +!!this[promise_resolve_symbol];\n ArrayPrototypeSplice(hooks_array, index, 1);\n\n if (prev_kTotals > 0 && hook_fields[kTotals] === 0) {\n disableHooks();\n }\n\n return this;\n }\n}\n\n\nfunction createHook(fns) {\n return new AsyncHook(fns);\n}\n\n\n\n\nconst destroyedSymbol = Symbol('destroyed');\nconst contextFrameSymbol = Symbol('context_frame');\n\nclass AsyncResource {\n constructor(type, opts = kEmptyObject) {\n validateString(type, 'type');\n\n let triggerAsyncId = opts;\n let requireManualDestroy = false;\n if (typeof opts !== 'number') {\n triggerAsyncId = opts.triggerAsyncId === undefined ?\n getDefaultTriggerAsyncId() : opts.triggerAsyncId;\n requireManualDestroy = !!opts.requireManualDestroy;\n }\n\n\n\n if (!NumberIsSafeInteger(triggerAsyncId) || triggerAsyncId < -1) {\n throw new ERR_INVALID_ASYNC_ID('triggerAsyncId', triggerAsyncId);\n }\n\n this[contextFrameSymbol] = AsyncContextFrame.current();\n\n const asyncId = newAsyncId();\n this[async_id_symbol] = asyncId;\n this[trigger_async_id_symbol] = triggerAsyncId;\n\n if (initHooksExist()) {\n if (type.length === 0) {\n throw new ERR_ASYNC_TYPE(type);\n }\n\n emitInit(asyncId, type, triggerAsyncId, this);\n }\n\n if (!requireManualDestroy && destroyHooksExist()) {\n\n const destroyed = { destroyed: false };\n this[destroyedSymbol] = destroyed;\n registerDestroyHook(this, asyncId, destroyed);\n }\n }\n\n runInAsyncScope(fn, thisArg, ...args) {\n const asyncId = this[async_id_symbol];\n emitBefore(asyncId, this[trigger_async_id_symbol], this);\n\n const contextFrame = this[contextFrameSymbol];\n const prior = AsyncContextFrame.exchange(contextFrame);\n try {\n return ReflectApply(fn, thisArg, args);\n } finally {\n AsyncContextFrame.set(prior);\n if (hasAsyncIdStack())\n emitAfter(asyncId);\n }\n }\n\n emitDestroy() {\n if (this[destroyedSymbol] !== undefined) {\n this[destroyedSymbol].destroyed = true;\n }\n emitDestroy(this[async_id_symbol]);\n return this;\n }\n\n asyncId() {\n return this[async_id_symbol];\n }\n\n triggerAsyncId() {\n return this[trigger_async_id_symbol];\n }\n\n bind(fn, thisArg) {\n validateFunction(fn, 'fn');\n let bound;\n if (thisArg === undefined) {\n const resource = this;\n bound = function(...args) {\n ArrayPrototypeUnshift(args, fn, this);\n return ReflectApply(resource.runInAsyncScope, resource, args);\n };\n } else {\n bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);\n }\n ObjectDefineProperties(bound, {\n 'length': {\n __proto__: null,\n configurable: true,\n enumerable: false,\n value: fn.length,\n writable: false,\n },\n });\n return bound;\n }\n\n static bind(fn, type, thisArg) {\n type ||= fn.name;\n return (new AsyncResource(type || 'bound-anonymous-fn')).bind(fn, thisArg);\n }\n}\n\n\n\nmodule.exports = {\n\n get AsyncLocalStorage() {\n return AsyncContextFrame.enabled ?\n require('internal/async_local_storage/async_context_frame') :\n require('internal/async_local_storage/async_hooks');\n },\n createHook,\n executionAsyncId,\n triggerAsyncId,\n executionAsyncResource,\n asyncWrapProviders: ObjectFreeze({ __proto__: null, ...asyncWrap.Providers }),\n\n AsyncResource,\n};\n","buffer.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n Array,\n ArrayBufferIsView,\n ArrayIsArray,\n ArrayPrototypeForEach,\n MathFloor,\n MathMin,\n MathTrunc,\n NumberIsInteger,\n NumberIsNaN,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectPrototypeHasOwnProperty,\n ObjectSetPrototypeOf,\n RegExpPrototypeSymbolReplace,\n StringPrototypeCharCodeAt,\n StringPrototypeSlice,\n StringPrototypeToLowerCase,\n StringPrototypeTrim,\n SymbolSpecies,\n SymbolToPrimitive,\n TypedArrayPrototypeFill,\n TypedArrayPrototypeGetBuffer,\n TypedArrayPrototypeGetByteLength,\n TypedArrayPrototypeGetByteOffset,\n TypedArrayPrototypeGetLength,\n TypedArrayPrototypeSet,\n TypedArrayPrototypeSubarray,\n Uint8Array,\n} = primordials;\n\nconst {\n byteLengthUtf8,\n compare: _compare,\n compareOffset,\n copy: _copy,\n fill: bindingFill,\n isAscii: bindingIsAscii,\n isUtf8: bindingIsUtf8,\n indexOfBuffer,\n indexOfNumber,\n indexOfString,\n swap16: _swap16,\n swap32: _swap32,\n swap64: _swap64,\n kMaxLength,\n kStringMaxLength,\n atob: _atob,\n btoa: _btoa,\n asciiSlice,\n base64Slice,\n base64urlSlice,\n latin1Slice,\n hexSlice,\n ucs2Slice,\n utf8Slice,\n base64Write,\n base64urlWrite,\n hexWrite,\n ucs2Write,\n} = internalBinding('buffer');\nconst {\n constants: {\n ALL_PROPERTIES,\n ONLY_ENUMERABLE,\n },\n getOwnNonIndexProperties,\n isInsideNodeModules,\n} = internalBinding('util');\nconst {\n customInspectSymbol,\n lazyDOMException,\n normalizeEncoding,\n kIsEncodingSymbol,\n defineLazyProperties,\n encodingsMap,\n} = require('internal/util');\nconst {\n isAnyArrayBuffer,\n isArrayBufferView,\n isUint8Array,\n isTypedArray,\n} = require('internal/util/types');\nconst {\n inspect: utilInspect,\n} = require('internal/util/inspect');\n\nconst assert = require('internal/assert');\n\nconst {\n codes: {\n ERR_BUFFER_OUT_OF_BOUNDS,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_INVALID_BUFFER_SIZE,\n ERR_MISSING_ARGS,\n ERR_OUT_OF_RANGE,\n ERR_UNKNOWN_ENCODING,\n },\n genericNodeError,\n} = require('internal/errors');\nconst {\n validateArray,\n validateBuffer,\n validateInteger,\n validateNumber,\n validateString,\n} = require('internal/validators');\n\nconst validateOffset = (value, name, min = 0, max = kMaxLength) =>\n validateInteger(value, name, min, max);\n\nconst {\n FastBuffer,\n markAsUntransferable,\n addBufferPrototypeMethods,\n createUnsafeBuffer,\n createUnsafeAlignedBuffer,\n alignmentPadding,\n asciiWrite,\n latin1Write,\n utf8Write,\n} = require('internal/buffer');\n\nconst {\n namespace: {\n addDeserializeCallback,\n isBuildingSnapshot,\n },\n} = require('internal/v8/startup_snapshot');\n\nFastBuffer.prototype.constructor = Buffer;\nBuffer.prototype = FastBuffer.prototype;\naddBufferPrototypeMethods(Buffer.prototype);\n\nconst constants = ObjectDefineProperties({}, {\n MAX_LENGTH: {\n __proto__: null,\n value: kMaxLength,\n writable: false,\n enumerable: true,\n },\n MAX_STRING_LENGTH: {\n __proto__: null,\n value: kStringMaxLength,\n writable: false,\n enumerable: true,\n },\n});\n\n\n\n\nconst kMaxAlignment = 2 ** 30;\n\n\n\n\nconst kPoolAlignment = 64;\n\nBuffer.poolSize = 64 * 1024;\n\n\n\nlet poolSize, poolOffset, poolBase, allocPool, allocBuffer;\n\nfunction createPool() {\n poolSize = Buffer.poolSize;\n allocBuffer = createUnsafeAlignedBuffer(poolSize, kPoolAlignment);\n allocPool = allocBuffer.buffer;\n poolBase = TypedArrayPrototypeGetByteOffset(allocBuffer);\n markAsUntransferable(allocPool);\n poolOffset = 0;\n}\ncreatePool();\nif (isBuildingSnapshot()) {\n addDeserializeCallback(() => {\n\n\n createPool();\n });\n}\n\nfunction alignPool() {\n\n if (poolOffset & 0x7) {\n poolOffset |= 0x7;\n poolOffset++;\n }\n}\n\nlet bufferWarningAlreadyEmitted = false;\nlet nodeModulesCheckCounter = 0;\nconst bufferWarning = 'Buffer() is deprecated due to security and usability ' +\n 'issues. Please use the Buffer.alloc(), ' +\n 'Buffer.allocUnsafe(), or Buffer.from() methods instead.';\n\nfunction showFlaggedDeprecation() {\n if (bufferWarningAlreadyEmitted ||\n ++nodeModulesCheckCounter > 10000 ||\n (!require('internal/options').getOptionValue('--pending-deprecation') &&\n isInsideNodeModules(3))) {\n\n\n\n\n\n\n\n return;\n }\n\n process.emitWarning(bufferWarning, 'DeprecationWarning', 'DEP0005');\n bufferWarningAlreadyEmitted = true;\n}\n\nfunction toInteger(n, defaultVal) {\n n = +n;\n if (!NumberIsNaN(n) &&\n n >= NumberMIN_SAFE_INTEGER &&\n n <= NumberMAX_SAFE_INTEGER) {\n return ((n % 1) === 0 ? n : MathFloor(n));\n }\n return defaultVal;\n}\n\nfunction copyImpl(source, target, targetStart, sourceStart, sourceEnd) {\n if (!ArrayBufferIsView(source))\n throw new ERR_INVALID_ARG_TYPE('source', ['Buffer', 'Uint8Array'], source);\n if (!ArrayBufferIsView(target))\n throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);\n\n if (targetStart === undefined) {\n targetStart = 0;\n } else {\n targetStart = NumberIsInteger(targetStart) ? targetStart : toInteger(targetStart, 0);\n if (targetStart < 0)\n throw new ERR_OUT_OF_RANGE('targetStart', '>= 0', targetStart);\n }\n\n if (sourceStart === undefined) {\n sourceStart = 0;\n } else {\n sourceStart = NumberIsInteger(sourceStart) ? sourceStart : toInteger(sourceStart, 0);\n if (sourceStart < 0 || sourceStart > source.byteLength)\n throw new ERR_OUT_OF_RANGE('sourceStart', `>= 0 && <= ${source.byteLength}`, sourceStart);\n }\n\n if (sourceEnd === undefined) {\n sourceEnd = source.byteLength;\n } else {\n sourceEnd = NumberIsInteger(sourceEnd) ? sourceEnd : toInteger(sourceEnd, 0);\n if (sourceEnd < 0)\n throw new ERR_OUT_OF_RANGE('sourceEnd', '>= 0', sourceEnd);\n }\n\n if (targetStart >= target.byteLength || sourceStart >= sourceEnd)\n return 0;\n\n return _copyActual(source, target, targetStart, sourceStart, sourceEnd);\n}\n\nfunction _copyActual(source, target, targetStart, sourceStart, sourceEnd) {\n if (sourceEnd - sourceStart > target.byteLength - targetStart)\n sourceEnd = sourceStart + target.byteLength - targetStart;\n\n let nb = sourceEnd - sourceStart;\n const sourceLen = source.byteLength - sourceStart;\n if (nb > sourceLen)\n nb = sourceLen;\n\n if (nb <= 0)\n return 0;\n\n\n\n\n return _copy(source, target, targetStart, sourceStart, nb);\n}\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Buffer(arg, encodingOrOffset, length) {\n showFlaggedDeprecation();\n\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new ERR_INVALID_ARG_TYPE('string', 'string', arg);\n }\n return Buffer.alloc(arg);\n }\n return Buffer.from(arg, encodingOrOffset, length);\n}\n\nObjectDefineProperty(Buffer, SymbolSpecies, {\n __proto__: null,\n enumerable: false,\n configurable: true,\n get() { return FastBuffer; },\n});\n\n\n\n\n\n\n\n\n\n\n\n\n\nBuffer.from = function from(value, encodingOrOffset, length) {\n if (typeof value === 'string')\n return fromString(value, encodingOrOffset);\n\n if (typeof value === 'object' && value !== null) {\n if (isAnyArrayBuffer(value))\n return fromArrayBuffer(value, encodingOrOffset, length);\n\n const valueOf = value.valueOf && value.valueOf();\n if (valueOf != null &&\n valueOf !== value &&\n (typeof valueOf === 'string' || typeof valueOf === 'object')) {\n return from(valueOf, encodingOrOffset, length);\n }\n\n const b = fromObject(value);\n if (b)\n return b;\n\n if (typeof value[SymbolToPrimitive] === 'function') {\n const primitive = value[SymbolToPrimitive]('string');\n if (typeof primitive === 'string') {\n return fromString(primitive, encodingOrOffset);\n }\n }\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'first argument',\n ['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],\n value,\n );\n};\n\n\n\n\n\n\n\n\n\nBuffer.copyBytesFrom = function copyBytesFrom(view, offset, length) {\n if (!isTypedArray(view)) {\n throw new ERR_INVALID_ARG_TYPE('view', [ 'TypedArray' ], view);\n }\n\n const viewLength = TypedArrayPrototypeGetLength(view);\n if (viewLength === 0) {\n return new FastBuffer();\n }\n\n let start = 0;\n let end = viewLength;\n\n if (offset !== undefined) {\n validateInteger(offset, 'offset', 0);\n if (offset >= viewLength) return new FastBuffer();\n start = offset;\n }\n\n if (length !== undefined) {\n validateInteger(length, 'length', 0);\n\n end = MathMin(start + length, viewLength);\n }\n\n if (end <= start) return new FastBuffer();\n\n const viewByteLength = TypedArrayPrototypeGetByteLength(view);\n const elementSize = viewByteLength / viewLength;\n const srcByteOffset = TypedArrayPrototypeGetByteOffset(view) +\n start * elementSize;\n const srcByteLength = (end - start) * elementSize;\n\n return fromArrayLike(new Uint8Array(\n TypedArrayPrototypeGetBuffer(view),\n srcByteOffset,\n srcByteLength));\n};\n\n\n\n\n\n\n\nconst of = (...items) => {\n const len = items.length;\n const newObj = new FastBuffer(len);\n for (let k = 0; k < len; k++)\n newObj[k] = items[k];\n return newObj;\n};\nBuffer.of = of;\n\nObjectSetPrototypeOf(Buffer, Uint8Array);\n\n\n\n\n\n\nBuffer.alloc = function alloc(size, fill, encoding) {\n validateNumber(size, 'size', 0, kMaxLength);\n if (fill !== undefined && fill !== 0 && size > 0) {\n const buf = createUnsafeBuffer(size);\n return _fill(buf, fill, 0, buf.length, encoding);\n }\n return new FastBuffer(size);\n};\n\n\n\n\n\n\n\n\n\n\n\nBuffer.allocUnsafe = function allocUnsafe(size, alignment) {\n validateNumber(size, 'size', 0, kMaxLength);\n if (alignment === undefined) {\n return allocate(size);\n }\n validateAlignment(size, alignment);\n return allocateAligned(size, alignment);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBuffer.allocUnsafeSlow = function allocUnsafeSlow(size, alignment) {\n validateNumber(size, 'size', 0, kMaxLength);\n if (alignment === undefined) {\n return createUnsafeBuffer(size);\n }\n validateAlignment(size, alignment);\n return createUnsafeAlignedBuffer(size, alignment);\n};\n\nfunction validateAlignment(size, alignment) {\n validateInteger(alignment, 'alignment', 1, kMaxAlignment);\n if ((alignment & (alignment - 1)) !== 0) {\n throw new ERR_INVALID_ARG_VALUE(\n 'alignment', alignment, 'must be a power of two');\n }\n const padding = alignmentPadding(alignment);\n if (size > kMaxLength - padding) {\n throw new ERR_OUT_OF_RANGE(\n 'size', `<= ${kMaxLength - padding}`, size);\n }\n}\n\nfunction allocate(size) {\n if (size <= 0) {\n return new FastBuffer();\n }\n if (size < (Buffer.poolSize >>> 1)) {\n if (size > (poolSize - poolOffset))\n createPool();\n const b = new FastBuffer(allocPool, poolBase + poolOffset, size);\n poolOffset += size;\n alignPool();\n return b;\n }\n return createUnsafeBuffer(size);\n}\n\nfunction allocateAligned(size, alignment) {\n if (size <= 0) {\n return new FastBuffer();\n }\n\n\n\n if (alignment > kPoolAlignment || size >= (Buffer.poolSize >>> 1)) {\n return createUnsafeAlignedBuffer(size, alignment);\n }\n poolOffset = (poolOffset + alignment - 1) & ~(alignment - 1);\n if (size > (poolSize - poolOffset))\n createPool();\n const b = new FastBuffer(allocPool, poolBase + poolOffset, size);\n poolOffset += size;\n alignPool();\n return b;\n}\n\nfunction fromStringFast(string, ops) {\n const maxLength = Buffer.poolSize >>> 1;\n\n let length = string.length;\n\n if (length >= maxLength)\n return createFromString(string, ops);\n\n length *= 4;\n\n if (length >= maxLength)\n length = ops.byteLength(string);\n\n if (length >= maxLength)\n return createFromString(string, ops, length);\n\n if (length > (poolSize - poolOffset))\n createPool();\n\n const actual = ops.write(allocBuffer, string, poolOffset, length);\n const b = new FastBuffer(allocPool, poolBase + poolOffset, actual);\n\n poolOffset += actual;\n alignPool();\n return b;\n}\n\nfunction createFromString(string, ops, length = ops.byteLength(string)) {\n const buf = Buffer.allocUnsafeSlow(length);\n const actual = ops.write(buf, string, 0, length);\n return actual < length ? new FastBuffer(buf.buffer, 0, actual) : buf;\n}\n\nfunction fromString(string, encoding) {\n let ops;\n if (!encoding || encoding === 'utf8' || typeof encoding !== 'string') {\n ops = encodingOps.utf8;\n } else {\n ops = getEncodingOps(encoding);\n if (ops === undefined)\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n\n return string.length === 0 ? new FastBuffer() : fromStringFast(string, ops);\n}\n\nfunction fromArrayBuffer(obj, byteOffset, length) {\n\n if (byteOffset === undefined) {\n byteOffset = 0;\n } else {\n byteOffset = +byteOffset;\n if (NumberIsNaN(byteOffset))\n byteOffset = 0;\n }\n\n const maxLength = obj.byteLength - byteOffset;\n\n if (maxLength < 0)\n throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');\n\n if (length !== undefined) {\n\n length = +length;\n if (length > 0) {\n if (length > maxLength)\n throw new ERR_BUFFER_OUT_OF_BOUNDS('length');\n } else {\n length = 0;\n }\n }\n\n return new FastBuffer(obj, byteOffset, length);\n}\n\nfunction fromArrayLike(obj) {\n const { length } = obj;\n if (length <= 0)\n return new FastBuffer();\n if (length < (Buffer.poolSize >>> 1)) {\n if (length > (poolSize - poolOffset))\n createPool();\n const b = new FastBuffer(allocPool, poolBase + poolOffset, length);\n TypedArrayPrototypeSet(b, obj, 0);\n poolOffset += length;\n alignPool();\n return b;\n }\n return new FastBuffer(obj);\n}\n\nfunction fromObject(obj) {\n if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {\n if (typeof obj.length !== 'number') {\n return new FastBuffer();\n }\n return fromArrayLike(obj);\n }\n\n if (obj.type === 'Buffer' && ArrayIsArray(obj.data)) {\n return fromArrayLike(obj.data);\n }\n}\n\n\n\nBuffer.isBuffer = function isBuffer(b) {\n return b instanceof Buffer;\n};\n\nBuffer.compare = function compare(buf1, buf2) {\n if (!isUint8Array(buf1)) {\n throw new ERR_INVALID_ARG_TYPE('buf1', ['Buffer', 'Uint8Array'], buf1);\n }\n\n if (!isUint8Array(buf2)) {\n throw new ERR_INVALID_ARG_TYPE('buf2', ['Buffer', 'Uint8Array'], buf2);\n }\n\n if (buf1 === buf2) {\n return 0;\n }\n\n return _compare(buf1, buf2);\n};\n\nBuffer.isEncoding = function isEncoding(encoding) {\n return typeof encoding === 'string' && encoding.length !== 0 &&\n normalizeEncoding(encoding) !== undefined;\n};\nBuffer[kIsEncodingSymbol] = Buffer.isEncoding;\n\nBuffer.concat = function concat(list, length) {\n validateArray(list, 'list');\n\n if (list.length === 0)\n return new FastBuffer();\n\n if (length === undefined) {\n length = 0;\n for (let i = 0; i < list.length; i++) {\n const buf = list[i];\n if (!isUint8Array(buf)) {\n\n\n throw new ERR_INVALID_ARG_TYPE(\n `list[${i}]`, ['Buffer', 'Uint8Array'], buf);\n }\n length += TypedArrayPrototypeGetByteLength(buf);\n }\n\n const buffer = allocate(length);\n let pos = 0;\n for (let i = 0; i < list.length; i++) {\n const buf = list[i];\n const bufLength = TypedArrayPrototypeGetByteLength(buf);\n TypedArrayPrototypeSet(buffer, buf, pos);\n pos += bufLength;\n }\n\n if (pos < length) {\n TypedArrayPrototypeFill(buffer, 0, pos, length);\n }\n return buffer;\n }\n\n validateOffset(length, 'length');\n for (let i = 0; i < list.length; i++) {\n if (!isUint8Array(list[i])) {\n\n\n throw new ERR_INVALID_ARG_TYPE(\n `list[${i}]`, ['Buffer', 'Uint8Array'], list[i]);\n }\n }\n\n const buffer = allocate(length);\n let pos = 0;\n for (let i = 0; i < list.length; i++) {\n const buf = list[i];\n const bufLength = TypedArrayPrototypeGetByteLength(buf);\n if (pos + bufLength > length) {\n TypedArrayPrototypeSet(buffer,\n TypedArrayPrototypeSubarray(buf, 0, length - pos),\n pos);\n pos = length;\n break;\n }\n TypedArrayPrototypeSet(buffer, buf, pos);\n pos += bufLength;\n }\n\n\n if (pos < length) {\n\n\n\n TypedArrayPrototypeFill(buffer, 0, pos, length);\n }\n\n return buffer;\n};\n\nfunction base64ByteLength(str, bytes) {\n\n if (StringPrototypeCharCodeAt(str, bytes - 1) === 0x3D)\n bytes--;\n if (bytes > 1 && StringPrototypeCharCodeAt(str, bytes - 1) === 0x3D)\n bytes--;\n\n\n return (bytes * 3) >>> 2;\n}\n\nconst encodingOps = {\n utf8: {\n encoding: 'utf8',\n encodingVal: encodingsMap.utf8,\n byteLength: byteLengthUtf8,\n write: utf8Write,\n slice: utf8Slice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfString(buf, val, byteOffset, encodingsMap.utf8, dir, end),\n },\n ucs2: {\n encoding: 'ucs2',\n encodingVal: encodingsMap.utf16le,\n byteLength: (string) => string.length * 2,\n write: ucs2Write,\n slice: ucs2Slice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir, end),\n },\n utf16le: {\n encoding: 'utf16le',\n encodingVal: encodingsMap.utf16le,\n byteLength: (string) => string.length * 2,\n write: ucs2Write,\n slice: ucs2Slice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir, end),\n },\n latin1: {\n encoding: 'latin1',\n encodingVal: encodingsMap.latin1,\n byteLength: (string) => string.length,\n write: latin1Write,\n slice: latin1Slice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir, end),\n },\n ascii: {\n encoding: 'ascii',\n encodingVal: encodingsMap.ascii,\n byteLength: (string) => string.length,\n write: asciiWrite,\n slice: asciiSlice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfBuffer(buf,\n fromStringFast(val, encodingOps.ascii),\n byteOffset,\n encodingsMap.ascii,\n dir,\n end),\n },\n base64: {\n encoding: 'base64',\n encodingVal: encodingsMap.base64,\n byteLength: (string) => base64ByteLength(string, string.length),\n write: base64Write,\n slice: base64Slice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfBuffer(buf,\n fromStringFast(val, encodingOps.base64),\n byteOffset,\n encodingsMap.base64,\n dir,\n end),\n },\n base64url: {\n encoding: 'base64url',\n encodingVal: encodingsMap.base64url,\n byteLength: (string) => base64ByteLength(string, string.length),\n write: base64urlWrite,\n slice: base64urlSlice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfBuffer(buf,\n fromStringFast(val, encodingOps.base64url),\n byteOffset,\n encodingsMap.base64url,\n dir,\n end),\n },\n hex: {\n encoding: 'hex',\n encodingVal: encodingsMap.hex,\n byteLength: (string) => string.length >>> 1,\n write: hexWrite,\n slice: hexSlice,\n indexOf: (buf, val, byteOffset, dir, end) =>\n indexOfBuffer(buf,\n fromStringFast(val, encodingOps.hex),\n byteOffset,\n encodingsMap.hex,\n dir,\n end),\n },\n};\nfunction getEncodingOps(encoding) {\n encoding += '';\n switch (encoding.length) {\n case 4:\n if (encoding === 'utf8') return encodingOps.utf8;\n if (encoding === 'ucs2') return encodingOps.ucs2;\n encoding = StringPrototypeToLowerCase(encoding);\n if (encoding === 'utf8') return encodingOps.utf8;\n if (encoding === 'ucs2') return encodingOps.ucs2;\n break;\n case 5:\n if (encoding === 'utf-8') return encodingOps.utf8;\n if (encoding === 'ascii') return encodingOps.ascii;\n if (encoding === 'ucs-2') return encodingOps.ucs2;\n encoding = StringPrototypeToLowerCase(encoding);\n if (encoding === 'utf-8') return encodingOps.utf8;\n if (encoding === 'ascii') return encodingOps.ascii;\n if (encoding === 'ucs-2') return encodingOps.ucs2;\n break;\n case 7:\n if (encoding === 'utf16le' ||\n StringPrototypeToLowerCase(encoding) === 'utf16le')\n return encodingOps.utf16le;\n break;\n case 8:\n if (encoding === 'utf-16le' ||\n StringPrototypeToLowerCase(encoding) === 'utf-16le')\n return encodingOps.utf16le;\n break;\n case 6:\n if (encoding === 'latin1' || encoding === 'binary')\n return encodingOps.latin1;\n if (encoding === 'base64') return encodingOps.base64;\n encoding = StringPrototypeToLowerCase(encoding);\n if (encoding === 'latin1' || encoding === 'binary')\n return encodingOps.latin1;\n if (encoding === 'base64') return encodingOps.base64;\n break;\n case 3:\n if (encoding === 'hex' || StringPrototypeToLowerCase(encoding) === 'hex')\n return encodingOps.hex;\n break;\n case 9:\n if (encoding === 'base64url' ||\n StringPrototypeToLowerCase(encoding) === 'base64url')\n return encodingOps.base64url;\n break;\n }\n}\n\nfunction byteLength(string, encoding) {\n if (typeof string !== 'string') {\n if (isArrayBufferView(string) || isAnyArrayBuffer(string)) {\n return string.byteLength;\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'string', ['string', 'Buffer', 'ArrayBuffer'], string,\n );\n }\n\n const len = string.length;\n if (len === 0)\n return 0;\n\n if (!encoding || encoding === 'utf8') {\n return byteLengthUtf8(string);\n }\n\n if (encoding === 'ascii') {\n return len;\n }\n\n const ops = getEncodingOps(encoding);\n if (ops === undefined) {\n\n\n return byteLengthUtf8(string);\n }\n\n return ops.byteLength(string);\n}\n\nBuffer.byteLength = byteLength;\n\n\nObjectDefineProperty(Buffer.prototype, 'parent', {\n __proto__: null,\n enumerable: true,\n get() {\n if (!(this instanceof Buffer))\n return undefined;\n return this.buffer;\n },\n});\nObjectDefineProperty(Buffer.prototype, 'offset', {\n __proto__: null,\n enumerable: true,\n get() {\n if (!(this instanceof Buffer))\n return undefined;\n return this.byteOffset;\n },\n});\n\nBuffer.prototype.copy =\n function copy(target, targetStart, sourceStart, sourceEnd) {\n return copyImpl(this, target, targetStart, sourceStart, sourceEnd);\n };\n\n\n\n\n\nBuffer.prototype.toString = function toString(encoding, start, end) {\n if (arguments.length === 0) {\n return utf8Slice(this, 0, this.length);\n }\n\n const bufferLength = TypedArrayPrototypeGetLength(this);\n\n if (start <= 0)\n start = 0;\n else if (start >= bufferLength)\n return '';\n else\n start = MathTrunc(start) || 0;\n\n if (end === undefined || end > bufferLength)\n end = bufferLength;\n else\n end = MathTrunc(end) || 0;\n\n if (end <= start)\n return '';\n\n if (encoding === undefined)\n return utf8Slice(this, start, end);\n\n const ops = getEncodingOps(encoding);\n if (ops === undefined)\n throw new ERR_UNKNOWN_ENCODING(encoding);\n\n return ops.slice(this, start, end);\n};\n\nBuffer.prototype.equals = function equals(otherBuffer) {\n if (!isUint8Array(otherBuffer)) {\n throw new ERR_INVALID_ARG_TYPE(\n 'otherBuffer', ['Buffer', 'Uint8Array'], otherBuffer);\n }\n\n if (this === otherBuffer)\n return true;\n const len = TypedArrayPrototypeGetByteLength(this);\n if (len !== TypedArrayPrototypeGetByteLength(otherBuffer))\n return false;\n\n return len === 0 || _compare(this, otherBuffer) === 0;\n};\n\nlet INSPECT_MAX_BYTES = 50;\n\nBuffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {\n const max = INSPECT_MAX_BYTES;\n const actualMax = MathMin(max, this.length);\n const remaining = this.length - max;\n let str = StringPrototypeTrim(RegExpPrototypeSymbolReplace(\n /(.{2})/g, hexSlice(this, 0, actualMax), '$1 '));\n if (remaining > 0)\n str += ` ... ${remaining} more byte${remaining > 1 ? 's' : ''}`;\n\n if (ctx) {\n let extras = false;\n const filter = ctx.showHidden ? ALL_PROPERTIES : ONLY_ENUMERABLE;\n const obj = { __proto__: null };\n ArrayPrototypeForEach(getOwnNonIndexProperties(this, filter),\n (key) => {\n extras = true;\n obj[key] = this[key];\n });\n if (extras) {\n if (this.length !== 0)\n str += ', ';\n\n\n str += StringPrototypeSlice(utilInspect(obj, {\n ...ctx,\n breakLength: Infinity,\n compact: true,\n }), 27, -2);\n }\n }\n let constructorName = 'Buffer';\n try {\n const { constructor } = this;\n if (typeof constructor === 'function' && ObjectPrototypeHasOwnProperty(constructor, 'name')) {\n constructorName = constructor.name;\n }\n } catch { }\n return `<${constructorName} ${str}>`;\n};\nBuffer.prototype.inspect = Buffer.prototype[customInspectSymbol];\n\nBuffer.prototype.compare = function compare(target,\n targetStart,\n targetEnd,\n sourceStart,\n sourceEnd) {\n if (!isUint8Array(target)) {\n throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);\n }\n if (arguments.length === 1)\n return _compare(this, target);\n\n if (targetStart === undefined)\n targetStart = 0;\n else\n validateOffset(targetStart, 'targetStart');\n\n if (targetEnd === undefined)\n targetEnd = target.length;\n else\n validateOffset(targetEnd, 'targetEnd', 0, target.length);\n\n if (sourceStart === undefined)\n sourceStart = 0;\n else\n validateOffset(sourceStart, 'sourceStart');\n\n if (sourceEnd === undefined)\n sourceEnd = this.length;\n else\n validateOffset(sourceEnd, 'sourceEnd', 0, this.length);\n\n if (sourceStart >= sourceEnd)\n return (targetStart >= targetEnd ? 0 : -1);\n if (targetStart >= targetEnd)\n return 1;\n\n return compareOffset(this, target, targetStart, sourceStart, targetEnd,\n sourceEnd);\n};\n\n\n\n\n\n\n\n\n\n\n\nfunction bidirectionalIndexOf(buffer, val, byteOffset, end, encoding, dir) {\n validateBuffer(buffer);\n\n if (typeof byteOffset === 'string') {\n encoding = byteOffset;\n byteOffset = undefined;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n\n byteOffset = +byteOffset;\n\n if (NumberIsNaN(byteOffset)) {\n byteOffset = dir ? 0 : (buffer.length || buffer.byteLength);\n }\n dir = !!dir;\n\n if (typeof val === 'number')\n return indexOfNumber(buffer, val >>> 0, byteOffset, dir, end);\n\n let ops;\n if (encoding === undefined)\n ops = encodingOps.utf8;\n else\n ops = getEncodingOps(encoding);\n\n if (typeof val === 'string') {\n if (ops === undefined)\n throw new ERR_UNKNOWN_ENCODING(encoding);\n return ops.indexOf(buffer, val, byteOffset, dir, end);\n }\n\n if (isUint8Array(val)) {\n const encodingVal =\n (ops === undefined ? encodingsMap.utf8 : ops.encodingVal);\n return indexOfBuffer(buffer, val, byteOffset, encodingVal, dir, end);\n }\n\n throw new ERR_INVALID_ARG_TYPE(\n 'value', ['number', 'string', 'Buffer', 'Uint8Array'], val,\n );\n}\n\nBuffer.prototype.indexOf = function indexOf(val, offset, end, encoding) {\n if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n } else if (end === undefined) {\n end = this.length;\n }\n return bidirectionalIndexOf(this, val, offset, end, encoding, true);\n};\n\nBuffer.prototype.lastIndexOf = function lastIndexOf(val, offset, end, encoding) {\n if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n } else if (end === undefined) {\n end = this.length;\n }\n return bidirectionalIndexOf(this, val, offset, end, encoding, false);\n};\n\nBuffer.prototype.includes = function includes(val, offset, end, encoding) {\n if (typeof end === 'string') {\n encoding = end;\n end = this.length;\n } else if (end === undefined) {\n end = this.length;\n }\n return bidirectionalIndexOf(this, val, offset, end, encoding, true) !== -1;\n};\n\n\n\n\n\nBuffer.prototype.fill = function fill(value, offset, end, encoding) {\n return _fill(this, value, offset, end, encoding);\n};\n\nfunction _fill(buf, value, offset, end, encoding) {\n if (typeof value === 'string') {\n if (offset === undefined || typeof offset === 'string') {\n encoding = offset;\n offset = 0;\n end = buf.length;\n } else if (typeof end === 'string') {\n encoding = end;\n end = buf.length;\n }\n\n const normalizedEncoding = normalizeEncoding(encoding);\n if (normalizedEncoding === undefined) {\n validateString(encoding, 'encoding');\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n\n if (value.length === 0) {\n\n value = 0;\n } else if (value.length === 1) {\n\n\n\n if (normalizedEncoding === 'utf8' || normalizedEncoding === 'ascii') {\n const code = StringPrototypeCharCodeAt(value, 0);\n if (code < 128) {\n value = code;\n }\n } else if (normalizedEncoding === 'latin1') {\n value = StringPrototypeCharCodeAt(value, 0);\n }\n }\n } else {\n encoding = undefined;\n }\n\n if (offset === undefined) {\n offset = 0;\n end = buf.length;\n } else {\n validateOffset(offset, 'offset');\n\n if (end === undefined) {\n end = buf.length;\n } else {\n validateOffset(end, 'end', 0, buf.length);\n }\n if (offset >= end)\n return buf;\n }\n\n\n if (typeof value === 'number') {\n\n const byteLen = TypedArrayPrototypeGetByteLength(buf);\n const fillLength = end - offset;\n if (offset > end || fillLength + offset > byteLen)\n throw new ERR_BUFFER_OUT_OF_BOUNDS();\n\n TypedArrayPrototypeFill(buf, value, offset, end);\n } else {\n const res = bindingFill(buf, value, offset, end, encoding);\n if (res < 0) {\n if (res === -1)\n throw new ERR_INVALID_ARG_VALUE('value', value);\n throw new ERR_BUFFER_OUT_OF_BOUNDS();\n }\n }\n\n return buf;\n}\n\nBuffer.prototype.write = function write(string, offset, length, encoding) {\n const bufferLength = TypedArrayPrototypeGetLength(this);\n\n if (offset === undefined) {\n return utf8Write(this, string, 0, bufferLength);\n }\n\n if (length === undefined && typeof offset === 'string') {\n encoding = offset;\n length = bufferLength;\n offset = 0;\n\n\n } else {\n validateOffset(offset, 'offset', 0, bufferLength);\n\n const remaining = bufferLength - offset;\n\n if (length === undefined) {\n length = remaining;\n } else if (typeof length === 'string') {\n encoding = length;\n length = remaining;\n } else {\n validateOffset(length, 'length', 0, bufferLength);\n if (length > remaining)\n length = remaining;\n }\n }\n\n if (!encoding || encoding === 'utf8')\n return utf8Write(this, string, offset, length);\n if (encoding === 'ascii')\n return asciiWrite(this, string, offset, length);\n\n const ops = getEncodingOps(encoding);\n if (ops === undefined)\n throw new ERR_UNKNOWN_ENCODING(encoding);\n return ops.write(this, string, offset, length);\n};\n\nBuffer.prototype.toJSON = function toJSON() {\n const bufferLength = TypedArrayPrototypeGetLength(this);\n if (bufferLength > 0) {\n const data = new Array(bufferLength);\n for (let i = 0; i < bufferLength; ++i)\n data[i] = this[i];\n return { type: 'Buffer', data };\n }\n return { type: 'Buffer', data: [] };\n};\n\nfunction adjustOffset(offset, length) {\n\n\n offset = MathTrunc(offset);\n if (offset === 0) {\n return 0;\n }\n if (offset < 0) {\n offset += length;\n return offset > 0 ? offset : 0;\n }\n if (offset < length) {\n return offset;\n }\n return NumberIsNaN(offset) ? 0 : length;\n}\n\nBuffer.prototype.subarray = function subarray(start, end) {\n const srcLength = TypedArrayPrototypeGetLength(this);\n start = adjustOffset(start, srcLength);\n end = end !== undefined ? adjustOffset(end, srcLength) : srcLength;\n const newLength = end > start ? end - start : 0;\n return new FastBuffer(this.buffer, this.byteOffset + start, newLength);\n};\n\nBuffer.prototype.slice = function slice(start, end) {\n return this.subarray(start, end);\n};\n\nfunction swap(b, n, m) {\n const i = b[n];\n b[n] = b[m];\n b[m] = i;\n}\n\nBuffer.prototype.swap16 = function swap16() {\n\n\n\n\n const len = TypedArrayPrototypeGetLength(this);\n if (len % 2 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('16-bits');\n if (len <= 32) {\n for (let i = 0; i < len; i += 2)\n swap(this, i, i + 1);\n return this;\n }\n _swap16(this);\n return this;\n};\n\nBuffer.prototype.swap32 = function swap32() {\n\n\n\n\n const len = TypedArrayPrototypeGetLength(this);\n if (len % 4 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('32-bits');\n if (len <= 32) {\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this;\n }\n _swap32(this);\n return this;\n};\n\nBuffer.prototype.swap64 = function swap64() {\n\n\n\n\n\n\n const len = TypedArrayPrototypeGetLength(this);\n if (len % 8 !== 0)\n throw new ERR_INVALID_BUFFER_SIZE('64-bits');\n if (len < 48) {\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this;\n }\n _swap64(this);\n return this;\n};\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString;\n\nlet transcode;\nif (internalBinding('config').hasIntl) {\n const {\n icuErrName,\n transcode: _transcode,\n } = internalBinding('icu');\n\n\n\n transcode = function transcode(source, fromEncoding, toEncoding) {\n if (!isUint8Array(source)) {\n throw new ERR_INVALID_ARG_TYPE('source',\n ['Buffer', 'Uint8Array'], source);\n }\n if (source.length === 0) return new FastBuffer();\n\n fromEncoding = normalizeEncoding(fromEncoding) || fromEncoding;\n toEncoding = normalizeEncoding(toEncoding) || toEncoding;\n const result = _transcode(source, fromEncoding, toEncoding);\n if (typeof result !== 'number')\n return result;\n\n const code = icuErrName(result);\n const err = genericNodeError(\n `Unable to transcode Buffer [${code}]`,\n { code: code, errno: result },\n );\n throw err;\n };\n}\n\nfunction btoa(input) {\n\n\n\n if (arguments.length === 0) {\n throw new ERR_MISSING_ARGS('input');\n }\n const result = _btoa(`${input}`);\n if (result === -1) {\n throw lazyDOMException('Invalid character', 'InvalidCharacterError');\n }\n return result;\n}\n\nfunction atob(input) {\n if (arguments.length === 0) {\n throw new ERR_MISSING_ARGS('input');\n }\n\n const result = _atob(`${input}`);\n\n switch (result) {\n case -2:\n throw lazyDOMException('Invalid character', 'InvalidCharacterError');\n case -1:\n throw lazyDOMException(\n 'The string to be decoded is not correctly encoded.',\n 'InvalidCharacterError');\n case -3:\n assert.fail('Unrecognized simdutf error');\n break;\n default:\n return result;\n }\n}\n\nfunction isUtf8(input) {\n if (isTypedArray(input) || isAnyArrayBuffer(input)) {\n return bindingIsUtf8(input);\n }\n\n throw new ERR_INVALID_ARG_TYPE('input', ['ArrayBuffer', 'Buffer', 'TypedArray'], input);\n}\n\nfunction isAscii(input) {\n if (isTypedArray(input) || isAnyArrayBuffer(input)) {\n return bindingIsAscii(input);\n }\n\n throw new ERR_INVALID_ARG_TYPE('input', ['ArrayBuffer', 'Buffer', 'TypedArray'], input);\n}\n\nmodule.exports = {\n Buffer,\n transcode,\n isUtf8,\n isAscii,\n\n\n kMaxLength,\n kStringMaxLength,\n btoa,\n atob,\n};\n\nObjectDefineProperties(module.exports, {\n constants: {\n __proto__: null,\n configurable: false,\n enumerable: true,\n value: constants,\n },\n INSPECT_MAX_BYTES: {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() { return INSPECT_MAX_BYTES; },\n set(val) {\n validateNumber(val, 'INSPECT_MAX_BYTES', 0);\n INSPECT_MAX_BYTES = val;\n },\n },\n});\n\ndefineLazyProperties(\n module.exports,\n 'internal/blob',\n ['Blob', 'resolveObjectURL'],\n);\ndefineLazyProperties(\n module.exports,\n 'internal/file',\n ['File'],\n);\n","console.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = require('internal/console/global');\n","diagnostics_channel.js":"'use strict';\n\nconst {\n ArrayPrototypeAt,\n ArrayPrototypeIndexOf,\n ArrayPrototypePush,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n ArrayPrototypeSplice,\n ObjectDefineProperty,\n ObjectGetPrototypeOf,\n ObjectSetPrototypeOf,\n PromisePrototype,\n PromisePrototypeThen,\n ReflectApply,\n SafeFinalizationRegistry,\n SafeMap,\n SymbolDispose,\n SymbolHasInstance,\n} = primordials;\n\nconst {\n codes: {\n ERR_INVALID_ARG_TYPE,\n },\n} = require('internal/errors');\nconst {\n validateFunction,\n} = require('internal/validators');\n\nconst { triggerUncaughtException } = internalBinding('errors');\n\n\n\nconst dc_binding = internalBinding('diagnostics_channel');\n\nconst { WeakReference, kEmptyObject } = require('internal/util');\nconst { isPromise } = require('internal/util/types');\n\n\n\nclass WeakRefMap extends SafeMap {\n #finalizers = new SafeFinalizationRegistry((key) => {\n\n\n if (!this.has(key)) this.delete(key);\n });\n\n set(key, value) {\n this.#finalizers.register(value, key);\n return super.set(key, new WeakReference(value));\n }\n\n get(key) {\n return super.get(key)?.get();\n }\n\n has(key) {\n return !!this.get(key);\n }\n\n incRef(key) {\n return super.get(key)?.incRef();\n }\n\n decRef(key) {\n return super.get(key)?.decRef();\n }\n}\n\nfunction markActive(channel) {\n\n ObjectSetPrototypeOf(channel, ActiveChannel.prototype);\n channel._subscribers = [];\n channel._stores = new SafeMap();\n\n\n if (channel._index !== undefined)\n dc_binding.notifyChannelActive(channel._index);\n}\n\nfunction maybeMarkInactive(channel) {\n\n if (!channel._subscribers.length && !channel._stores.size) {\n\n if (channel._index !== undefined)\n dc_binding.notifyChannelInactive(channel._index);\n\n\n ObjectSetPrototypeOf(channel, Channel.prototype);\n channel._subscribers = undefined;\n channel._stores = undefined;\n }\n}\n\nclass RunStoresScope {\n #stack;\n\n constructor(activeChannel, data) {\n\n using stack = new DisposableStack();\n\n\n if (activeChannel._stores) {\n for (const entry of activeChannel._stores.entries()) {\n const store = entry[0];\n const transform = entry[1];\n\n let newContext = data;\n if (transform) {\n try {\n newContext = transform(data);\n } catch (err) {\n process.nextTick(() => {\n triggerUncaughtException(err, false);\n });\n continue;\n }\n }\n\n stack.use(store.withScope(newContext));\n }\n }\n\n\n activeChannel.publish(data);\n\n\n this.#stack = stack.move();\n }\n\n [SymbolDispose]() {\n this.#stack[SymbolDispose]();\n }\n}\n\n\nclass ActiveChannel {\n subscribe(subscription) {\n validateFunction(subscription, 'subscription');\n this._subscribers = ArrayPrototypeSlice(this._subscribers);\n ArrayPrototypePush(this._subscribers, subscription);\n channels.incRef(this.name);\n if (this._index !== undefined) dc_binding.subscribers[this._index]++;\n }\n\n unsubscribe(subscription) {\n const index = ArrayPrototypeIndexOf(this._subscribers, subscription);\n if (index === -1) return false;\n\n const before = ArrayPrototypeSlice(this._subscribers, 0, index);\n const after = ArrayPrototypeSlice(this._subscribers, index + 1);\n this._subscribers = before;\n ArrayPrototypePushApply(this._subscribers, after);\n\n channels.decRef(this.name);\n if (this._index !== undefined) dc_binding.subscribers[this._index]--;\n maybeMarkInactive(this);\n\n return true;\n }\n\n bindStore(store, transform) {\n const replacing = this._stores.has(store);\n if (!replacing) {\n channels.incRef(this.name);\n if (this._index !== undefined) dc_binding.subscribers[this._index]++;\n }\n this._stores.set(store, transform);\n }\n\n unbindStore(store) {\n if (!this._stores.has(store)) {\n return false;\n }\n\n this._stores.delete(store);\n\n channels.decRef(this.name);\n if (this._index !== undefined) dc_binding.subscribers[this._index]--;\n maybeMarkInactive(this);\n\n return true;\n }\n\n get hasSubscribers() {\n return true;\n }\n\n publish(data) {\n const subscribers = this._subscribers;\n for (let i = 0; i < (subscribers?.length || 0); i++) {\n try {\n const onMessage = subscribers[i];\n onMessage(data, this.name);\n } catch (err) {\n process.nextTick(() => {\n triggerUncaughtException(err, false);\n });\n }\n }\n }\n\n withStoreScope(data) {\n return new RunStoresScope(this, data);\n }\n\n runStores(data, fn, thisArg, ...args) {\n\n using scope = this.withStoreScope(data);\n return ReflectApply(fn, thisArg, args);\n }\n}\n\nclass Channel {\n constructor(name) {\n this._subscribers = undefined;\n this._stores = undefined;\n this.name = name;\n this._index = undefined;\n\n channels.set(name, this);\n }\n\n static [SymbolHasInstance](instance) {\n const prototype = ObjectGetPrototypeOf(instance);\n return prototype === Channel.prototype ||\n prototype === ActiveChannel.prototype;\n }\n\n subscribe(subscription) {\n validateFunction(subscription, 'subscription');\n markActive(this);\n this.subscribe(subscription);\n }\n\n unsubscribe() {\n return false;\n }\n\n bindStore(store, transform) {\n markActive(this);\n this.bindStore(store, transform);\n }\n\n unbindStore() {\n return false;\n }\n\n get hasSubscribers() {\n return false;\n }\n\n publish() {}\n\n runStores(data, fn, thisArg, ...args) {\n return ReflectApply(fn, thisArg, args);\n }\n\n withStoreScope() {\n\n return {\n [SymbolDispose]() {},\n };\n }\n}\n\nconst channels = new WeakRefMap();\n\nfunction channel(name) {\n const channel = channels.get(name);\n if (channel) return channel;\n\n if (typeof name !== 'string' && typeof name !== 'symbol') {\n throw new ERR_INVALID_ARG_TYPE('channel', ['string', 'symbol'], name);\n }\n\n return new Channel(name);\n}\n\nfunction subscribe(name, subscription) {\n return channel(name).subscribe(subscription);\n}\n\nfunction unsubscribe(name, subscription) {\n return channel(name).unsubscribe(subscription);\n}\n\nfunction hasSubscribers(name) {\n const channel = channels.get(name);\n if (!channel) return false;\n\n return channel.hasSubscribers;\n}\n\nconst boundedEvents = [\n 'start',\n 'end',\n];\n\nfunction assertChannel(value, name) {\n if (!(value instanceof Channel)) {\n throw new ERR_INVALID_ARG_TYPE(name, ['Channel'], value);\n }\n}\n\nfunction emitNonThenableWarning(fn) {\n process.emitWarning(`tracePromise was called with the function '${fn.name || ''}', ` +\n 'which returned a non-thenable.');\n}\n\nfunction channelFromMap(nameOrChannels, name, className) {\n if (typeof nameOrChannels === 'string') {\n return channel(`tracing:${nameOrChannels}:${name}`);\n }\n\n if (typeof nameOrChannels === 'object' && nameOrChannels !== null) {\n const channel = nameOrChannels[name];\n assertChannel(channel, `nameOrChannels.${name}`);\n return channel;\n }\n\n throw new ERR_INVALID_ARG_TYPE('nameOrChannels',\n ['string', 'object', className],\n nameOrChannels);\n}\n\nclass BoundedChannelScope {\n #context;\n #end;\n #scope;\n\n constructor(boundedChannel, context) {\n\n if (!boundedChannel.hasSubscribers) {\n return;\n }\n\n const { start, end } = boundedChannel;\n this.#context = context;\n this.#end = end;\n\n\n this.#scope = new RunStoresScope(start, context);\n }\n\n [SymbolDispose]() {\n if (!this.#scope) {\n return;\n }\n\n\n this.#end.publish(this.#context);\n\n\n this.#scope[SymbolDispose]();\n this.#scope = undefined;\n }\n}\n\nclass BoundedChannel {\n constructor(nameOrChannels) {\n for (let i = 0; i < boundedEvents.length; ++i) {\n const eventName = boundedEvents[i];\n ObjectDefineProperty(this, eventName, {\n __proto__: null,\n value: channelFromMap(nameOrChannels, eventName, 'BoundedChannel'),\n });\n }\n }\n\n get hasSubscribers() {\n return this.start?.hasSubscribers ||\n this.end?.hasSubscribers;\n }\n\n subscribe(handlers) {\n for (let i = 0; i < boundedEvents.length; ++i) {\n const name = boundedEvents[i];\n if (!handlers[name]) continue;\n\n this[name]?.subscribe(handlers[name]);\n }\n }\n\n unsubscribe(handlers) {\n let done = true;\n\n for (let i = 0; i < boundedEvents.length; ++i) {\n const name = boundedEvents[i];\n if (!handlers[name]) continue;\n\n if (!this[name]?.unsubscribe(handlers[name])) {\n done = false;\n }\n }\n\n return done;\n }\n\n withScope(context = kEmptyObject) {\n return new BoundedChannelScope(this, context);\n }\n\n run(context, fn, thisArg, ...args) {\n context ??= {};\n\n using scope = this.withScope(context);\n return ReflectApply(fn, thisArg, args);\n }\n}\n\nfunction boundedChannel(nameOrChannels) {\n return new BoundedChannel(nameOrChannels);\n}\n\nclass TracingChannel {\n #callWindow;\n #continuationWindow;\n\n constructor(nameOrChannels) {\n\n if (typeof nameOrChannels === 'string') {\n this.#callWindow = new BoundedChannel(nameOrChannels);\n this.#continuationWindow = new BoundedChannel({\n start: channel(`tracing:${nameOrChannels}:asyncStart`),\n end: channel(`tracing:${nameOrChannels}:asyncEnd`),\n });\n } else if (typeof nameOrChannels === 'object') {\n this.#callWindow = new BoundedChannel({\n start: nameOrChannels.start,\n end: nameOrChannels.end,\n });\n this.#continuationWindow = new BoundedChannel({\n start: nameOrChannels.asyncStart,\n end: nameOrChannels.asyncEnd,\n });\n }\n\n\n ObjectDefineProperty(this, 'error', {\n __proto__: null,\n value: channelFromMap(nameOrChannels, 'error', 'TracingChannel'),\n });\n }\n\n get start() {\n return this.#callWindow.start;\n }\n\n get end() {\n return this.#callWindow.end;\n }\n\n get asyncStart() {\n return this.#continuationWindow.start;\n }\n\n get asyncEnd() {\n return this.#continuationWindow.end;\n }\n\n get hasSubscribers() {\n return this.#callWindow.hasSubscribers ||\n this.#continuationWindow.hasSubscribers ||\n this.error?.hasSubscribers;\n }\n\n subscribe(handlers) {\n\n if (handlers.start || handlers.end) {\n this.#callWindow.subscribe({\n start: handlers.start,\n end: handlers.end,\n });\n }\n\n\n if (handlers.asyncStart || handlers.asyncEnd) {\n this.#continuationWindow.subscribe({\n start: handlers.asyncStart,\n end: handlers.asyncEnd,\n });\n }\n\n\n if (handlers.error) {\n this.error.subscribe(handlers.error);\n }\n }\n\n unsubscribe(handlers) {\n let done = true;\n\n\n if (handlers.start || handlers.end) {\n if (!this.#callWindow.unsubscribe({\n start: handlers.start,\n end: handlers.end,\n })) {\n done = false;\n }\n }\n\n\n if (handlers.asyncStart || handlers.asyncEnd) {\n if (!this.#continuationWindow.unsubscribe({\n start: handlers.asyncStart,\n end: handlers.asyncEnd,\n })) {\n done = false;\n }\n }\n\n\n if (handlers.error) {\n if (!this.error.unsubscribe(handlers.error)) {\n done = false;\n }\n }\n\n return done;\n }\n\n traceSync(fn, context = undefined, thisArg, ...args) {\n if (!this.hasSubscribers) {\n return ReflectApply(fn, thisArg, args);\n }\n\n if (context === undefined) {\n context = { __proto__: null };\n }\n\n const { error } = this;\n\n\n using scope = this.#callWindow.withScope(context);\n try {\n const result = ReflectApply(fn, thisArg, args);\n context.result = result;\n return result;\n } catch (err) {\n context.error = err;\n error.publish(context);\n throw err;\n }\n }\n\n tracePromise(fn, context = undefined, thisArg, ...args) {\n if (!this.hasSubscribers) {\n const result = ReflectApply(fn, thisArg, args);\n if (typeof result?.then !== 'function') {\n emitNonThenableWarning(fn);\n }\n return result;\n }\n\n if (context === undefined) {\n context = { __proto__: null };\n }\n\n const { error } = this;\n const continuationWindow = this.#continuationWindow;\n\n function onReject(err) {\n context.error = err;\n error.publish(context);\n\n\n using scope = continuationWindow.withScope(context);\n\n }\n\n function onRejectWithRethrow(err) {\n onReject(err);\n throw err;\n }\n\n function onResolve(result) {\n context.result = result;\n\n\n using scope = continuationWindow.withScope(context);\n\n return result;\n }\n\n\n using scope = this.#callWindow.withScope(context);\n try {\n const result = ReflectApply(fn, thisArg, args);\n\n\n if (typeof result?.then !== 'function') {\n emitNonThenableWarning(fn);\n context.result = result;\n return result;\n }\n\n\n if (isPromise(result) && ObjectGetPrototypeOf(result) === PromisePrototype) {\n return PromisePrototypeThen(result, onResolve, onRejectWithRethrow);\n }\n\n\n\n\n result.then(onResolve, onReject);\n return result;\n } catch (err) {\n context.error = err;\n error.publish(context);\n throw err;\n }\n }\n\n traceCallback(fn, position = -1, context = kEmptyObject, thisArg, ...args) {\n if (!this.hasSubscribers) {\n return ReflectApply(fn, thisArg, args);\n }\n\n const { error } = this;\n const continuationWindow = this.#continuationWindow;\n\n function wrappedCallback(err, res) {\n if (err) {\n context.error = err;\n error.publish(context);\n } else {\n context.result = res;\n }\n\n\n\n using scope = continuationWindow.withScope(context);\n return ReflectApply(callback, this, arguments);\n }\n\n const callback = ArrayPrototypeAt(args, position);\n validateFunction(callback, 'callback');\n ArrayPrototypeSplice(args, position, 1, wrappedCallback);\n\n\n using scope = this.#callWindow.withScope(context);\n try {\n return ReflectApply(fn, thisArg, args);\n } catch (err) {\n context.error = err;\n error.publish(context);\n throw err;\n }\n }\n}\n\nfunction tracingChannel(nameOrChannels) {\n return new TracingChannel(nameOrChannels);\n}\n\n\ndc_binding.linkNativeChannel((name, index) => {\n const linkedChannel = channel(name);\n linkedChannel._index = index;\n dc_binding.subscribers[index] =\n (linkedChannel._subscribers?.length || 0) +\n (linkedChannel._stores?.size || 0);\n return linkedChannel;\n});\n\nmodule.exports = {\n channel,\n hasSubscribers,\n subscribe,\n tracingChannel,\n unsubscribe,\n boundedChannel,\n Channel,\n BoundedChannel,\n};\n","events.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n ArrayPrototypeJoin,\n ArrayPrototypePop,\n ArrayPrototypePush,\n ArrayPrototypeSlice,\n ArrayPrototypeSplice,\n ArrayPrototypeUnshift,\n AsyncIteratorPrototype,\n Boolean,\n Error,\n ErrorCaptureStackTrace,\n FunctionPrototypeBind,\n NumberMAX_SAFE_INTEGER,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectGetPrototypeOf,\n ObjectSetPrototypeOf,\n Promise,\n PromiseReject,\n PromiseResolve,\n ReflectApply,\n ReflectOwnKeys,\n String,\n StringPrototypeSplit,\n Symbol,\n SymbolAsyncIterator,\n SymbolDispose,\n SymbolFor,\n} = primordials;\nconst kRejection = SymbolFor('nodejs.rejection');\n\nconst { kEmptyObject, spliceOne } = require('internal/util');\n\nconst {\n inspect,\n identicalSequenceRange,\n} = require('internal/util/inspect');\n\nlet FixedQueue;\nlet kFirstEventParam;\nlet kResistStopPropagation;\n\nconst {\n AbortError,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_UNHANDLED_ERROR,\n },\n genericNodeError,\n kEnhanceStackBeforeInspector,\n} = require('internal/errors');\n\nconst {\n validateInteger,\n validateAbortSignal,\n validateBoolean,\n validateFunction,\n validateNumber,\n validateObject,\n validateString,\n} = require('internal/validators');\nconst { addAbortListener } = require('internal/events/abort_listener');\n\nconst kCapture = Symbol('kCapture');\nconst kErrorMonitor = Symbol('events.errorMonitor');\nconst kShapeMode = Symbol('shapeMode');\nconst kEmitting = Symbol('events.emitting');\nconst kMaxEventTargetListeners = Symbol('events.maxEventTargetListeners');\nconst kMaxEventTargetListenersWarned =\n Symbol('events.maxEventTargetListenersWarned');\nconst kWatermarkData = SymbolFor('nodejs.watermarkData');\n\nlet EventEmitterAsyncResource;\n\n\n\n\n\n\nfunction lazyEventEmitterAsyncResource() {\n if (EventEmitterAsyncResource === undefined) {\n const {\n AsyncResource,\n } = require('async_hooks');\n\n class EventEmitterReferencingAsyncResource extends AsyncResource {\n #eventEmitter;\n\n\n\n\n\n\n\n\n\n constructor(ee, type, options) {\n super(type, options);\n this.#eventEmitter = ee;\n }\n\n\n\n\n get eventEmitter() {\n return this.#eventEmitter;\n }\n }\n\n EventEmitterAsyncResource =\n class EventEmitterAsyncResource extends EventEmitter {\n #asyncResource;\n\n\n\n\n\n\n\n\n constructor(options = undefined) {\n let name;\n if (typeof options === 'string') {\n name = options;\n options = undefined;\n } else {\n if (new.target === EventEmitterAsyncResource) {\n validateString(options?.name, 'options.name');\n }\n name = options?.name || new.target.name;\n }\n super(options);\n\n this.#asyncResource = new EventEmitterReferencingAsyncResource(this, name, options);\n }\n\n\n\n\n\n\n emit(event, ...args) {\n const asyncResource = this.#asyncResource;\n ArrayPrototypeUnshift(args, super.emit, this, event);\n return ReflectApply(asyncResource.runInAsyncScope, asyncResource,\n args);\n }\n\n\n\n\n emitDestroy() {\n this.#asyncResource.emitDestroy();\n }\n\n\n\n\n get asyncId() {\n return this.#asyncResource.asyncId();\n }\n\n\n\n\n get triggerAsyncId() {\n return this.#asyncResource.triggerAsyncId();\n }\n\n\n\n\n get asyncResource() {\n return this.#asyncResource;\n }\n };\n }\n return EventEmitterAsyncResource;\n}\n\n\n\n\n\n\nfunction EventEmitter(opts) {\n EventEmitter.init.call(this, opts);\n}\nmodule.exports = EventEmitter;\nmodule.exports.addAbortListener = addAbortListener;\nmodule.exports.once = once;\nmodule.exports.on = on;\nmodule.exports.getEventListeners = getEventListeners;\nmodule.exports.getMaxListeners = getMaxListeners;\nmodule.exports.listenerCount = listenerCount;\n\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.usingDomains = false;\n\nEventEmitter.captureRejectionSymbol = kRejection;\nObjectDefineProperty(EventEmitter, 'captureRejections', {\n __proto__: null,\n get() {\n return EventEmitter.prototype[kCapture];\n },\n set(value) {\n validateBoolean(value, 'EventEmitter.captureRejections');\n\n EventEmitter.prototype[kCapture] = value;\n },\n enumerable: true,\n});\n\nObjectDefineProperty(EventEmitter, 'EventEmitterAsyncResource', {\n __proto__: null,\n enumerable: true,\n get: lazyEventEmitterAsyncResource,\n set: undefined,\n configurable: true,\n});\n\nEventEmitter.errorMonitor = kErrorMonitor;\n\n\nObjectDefineProperty(EventEmitter.prototype, kCapture, {\n __proto__: null,\n value: false,\n writable: true,\n enumerable: false,\n});\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n\n\nlet defaultMaxListeners = 10;\nlet isEventTarget;\n\nfunction checkListener(listener) {\n validateFunction(listener, 'listener');\n}\n\nObjectDefineProperty(EventEmitter, 'defaultMaxListeners', {\n __proto__: null,\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n validateNumber(arg, 'defaultMaxListeners', 0);\n defaultMaxListeners = arg;\n },\n});\n\nObjectDefineProperties(EventEmitter, {\n kMaxEventTargetListeners: {\n __proto__: null,\n value: kMaxEventTargetListeners,\n enumerable: false,\n configurable: false,\n writable: false,\n },\n kMaxEventTargetListenersWarned: {\n __proto__: null,\n value: kMaxEventTargetListenersWarned,\n enumerable: false,\n configurable: false,\n writable: false,\n },\n});\n\n\n\n\n\n\n\nEventEmitter.setMaxListeners =\n function(n = defaultMaxListeners, ...eventTargets) {\n validateNumber(n, 'setMaxListeners', 0);\n if (eventTargets.length === 0) {\n defaultMaxListeners = n;\n } else {\n if (isEventTarget === undefined)\n isEventTarget = require('internal/event_target').isEventTarget;\n\n for (let i = 0; i < eventTargets.length; i++) {\n const target = eventTargets[i];\n if (isEventTarget(target)) {\n target[kMaxEventTargetListeners] = n;\n target[kMaxEventTargetListenersWarned] = false;\n } else if (typeof target.setMaxListeners === 'function') {\n target.setMaxListeners(n);\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'eventTargets',\n ['EventEmitter', 'EventTarget'],\n target);\n }\n }\n }\n };\n\n\n\nEventEmitter.init = function(opts) {\n\n if (this._events === undefined ||\n this._events === ObjectGetPrototypeOf(this)._events) {\n this._events = { __proto__: null };\n this._eventsCount = 0;\n this[kShapeMode] = false;\n } else {\n this[kShapeMode] = true;\n }\n\n this._maxListeners ||= undefined;\n\n\n if (opts?.captureRejections) {\n validateBoolean(opts.captureRejections, 'options.captureRejections');\n this[kCapture] = Boolean(opts.captureRejections);\n } else {\n\n\n this[kCapture] = EventEmitter.prototype[kCapture];\n }\n};\n\nfunction addCatch(that, promise, type, args) {\n if (!that[kCapture]) {\n return;\n }\n\n\n\n try {\n const then = promise.then;\n\n if (typeof then === 'function') {\n then.call(promise, undefined, function(err) {\n\n\n process.nextTick(emitUnhandledRejectionOrErr, that, err, type, args);\n });\n }\n } catch (err) {\n that.emit('error', err);\n }\n}\n\nfunction emitUnhandledRejectionOrErr(ee, err, type, args) {\n if (typeof ee[kRejection] === 'function') {\n ee[kRejection](err, type, ...args);\n } else {\n\n\n const prev = ee[kCapture];\n\n\n\n\n\n try {\n ee[kCapture] = false;\n ee.emit('error', err);\n } finally {\n ee[kCapture] = prev;\n }\n }\n}\n\n\n\n\n\n\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n validateNumber(n, 'setMaxListeners', 0);\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\n\n\n\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nfunction enhanceStackTrace(err, own) {\n let ctorInfo = '';\n try {\n const { name } = this.constructor;\n if (name !== 'EventEmitter')\n ctorInfo = ` on ${name} instance`;\n } catch {\n\n }\n const sep = `\\nEmitted 'error' event${ctorInfo} at:\\n`;\n\n const errStack = ArrayPrototypeSlice(\n StringPrototypeSplit(err.stack, '\\n'), 1);\n const ownStack = ArrayPrototypeSlice(\n StringPrototypeSplit(own.stack, '\\n'), 1);\n\n const { len, offset } = identicalSequenceRange(ownStack, errStack);\n if (len > 0) {\n ArrayPrototypeSplice(ownStack, offset + 1, len - 2,\n ' [... lines matching original stack trace ...]');\n }\n\n return err.stack + sep + ArrayPrototypeJoin(ownStack, '\\n');\n}\n\nfunction getUnhandledErrorException(ee, args) {\n let er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n try {\n const capture = {};\n ErrorCaptureStackTrace(capture, EventEmitter.prototype.emit);\n ObjectDefineProperty(er, kEnhanceStackBeforeInspector, {\n __proto__: null,\n value: FunctionPrototypeBind(enhanceStackTrace, ee, er, capture),\n configurable: true,\n });\n } catch {\n\n }\n\n return er;\n }\n\n let stringifiedEr;\n try {\n stringifiedEr = inspect(er);\n } catch {\n stringifiedEr = er;\n }\n\n\n const err = new ERR_UNHANDLED_ERROR(stringifiedEr);\n err.context = er;\n return err;\n}\n\n\n\n\n\n\n\n\nEventEmitter.prototype.emit = function emit(type, ...args) {\n let doError = (type === 'error');\n\n const events = this._events;\n if (events !== undefined) {\n if (doError && events[kErrorMonitor] !== undefined)\n this.emit(kErrorMonitor, ...args);\n doError &&= events.error === undefined;\n } else if (!doError)\n return false;\n\n\n if (doError) {\n const er = getUnhandledErrorException(this, args);\n\n\n throw er;\n }\n\n const handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n const result = ReflectApply(handler, this, args);\n\n\n\n\n if (result !== undefined && result !== null) {\n addCatch(this, result, type, args);\n }\n } else {\n handler[kEmitting]++;\n try {\n for (let i = 0; i < handler.length; ++i) {\n const result = ReflectApply(handler[i], this, args);\n\n\n\n\n\n\n if (result !== undefined && result !== null) {\n addCatch(this, result, type, args);\n }\n }\n } finally {\n handler[kEmitting]--;\n }\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n let m;\n let events;\n let existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = { __proto__: null };\n target._eventsCount = 0;\n } else {\n\n\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ?? listener);\n\n\n\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n\n events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n\n existing = prepend ? [listener, existing] : [existing, listener];\n existing[kEmitting] = 0;\n events[type] = existing;\n\n } else {\n existing = ensureMutableListenerArray(events, type, existing);\n if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n }\n\n\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned)\n warnMaxListenersExceeded(target, type, existing, m);\n }\n\n return target;\n}\n\nfunction warnMaxListenersExceeded(target, type, existing, m) {\n existing.warned = true;\n\n const w = genericNodeError(\n `Possible EventEmitter memory leak detected. ${existing.length} ${String(type)} listeners ` +\n `added to ${inspect(target, { depth: -1 })}. MaxListeners is ${m}. Use emitter.setMaxListeners() to increase limit`,\n { name: 'MaxListenersExceededWarning', emitter: target, type: type, count: existing.length });\n process.emitWarning(w);\n}\n\n\n\n\n\n\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\n\n\n\n\n\n\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction _onceWrap(target, type, listener) {\n let fired = false;\n function wrapper(...args) {\n if (fired) return;\n fired = true;\n target.removeListener(type, wrapper);\n return ReflectApply(listener, target, args);\n }\n wrapper.listener = listener;\n return wrapper;\n}\n\n\n\n\n\n\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\n\n\n\n\n\n\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n\n\n\n\n\n\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n checkListener(listener);\n\n const events = this._events;\n if (events === undefined)\n return this;\n\n let list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n this._eventsCount -= 1;\n\n if (this[kShapeMode]) {\n events[type] = undefined;\n } else if (this._eventsCount === 0) {\n this._events = { __proto__: null };\n } else {\n delete events[type];\n }\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, list.listener || listener);\n } else if (typeof list !== 'function') {\n list = ensureMutableListenerArray(events, type, list);\n let position = -1;\n\n for (let i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\n\n\n\n\n\n\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n const events = this._events;\n if (events === undefined)\n return this;\n\n\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = { __proto__: null };\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = { __proto__: null };\n else\n delete events[type];\n }\n this[kShapeMode] = false;\n return this;\n }\n\n\n if (arguments.length === 0) {\n for (const key of ReflectOwnKeys(events)) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = { __proto__: null };\n this._eventsCount = 0;\n this[kShapeMode] = false;\n return this;\n }\n\n const listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n\n for (let i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n const events = target._events;\n\n if (events === undefined)\n return [];\n\n const evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener);\n}\n\n\n\n\n\n\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\n\n\n\n\n\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\n\n\n\n\n\n\n\nEventEmitter.prototype.listenerCount = function listenerCount(type, listener) {\n const events = this._events;\n\n if (events !== undefined) {\n const evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n if (listener != null) {\n return listener === evlistener || listener === evlistener.listener ? 1 : 0;\n }\n\n return 1;\n } else if (evlistener !== undefined) {\n if (listener != null) {\n let matching = 0;\n\n for (let i = 0, l = evlistener.length; i < l; i++) {\n if (evlistener[i] === listener || evlistener[i].listener === listener) {\n matching++;\n }\n }\n\n return matching;\n }\n\n return evlistener.length;\n }\n }\n\n return 0;\n};\n\n\n\n\n\n\nEventEmitter.prototype.eventNames = function eventNames() {\n if (this._eventsCount === 0)\n return [];\n const events = this._events;\n const names = [];\n for (const key of ReflectOwnKeys(events)) {\n\n if (events[key] !== undefined)\n ArrayPrototypePush(names, key);\n }\n return names;\n};\n\nfunction arrayClone(arr) {\n\n\n switch (arr.length) {\n case 2: return [arr[0], arr[1]];\n case 3: return [arr[0], arr[1], arr[2]];\n case 4: return [arr[0], arr[1], arr[2], arr[3]];\n case 5: return [arr[0], arr[1], arr[2], arr[3], arr[4]];\n case 6: return [arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]];\n }\n return ArrayPrototypeSlice(arr);\n}\n\nfunction cloneEventListenerArray(arr) {\n const copy = arrayClone(arr);\n copy[kEmitting] = 0;\n if (arr.warned) {\n copy.warned = true;\n }\n return copy;\n}\n\nfunction ensureMutableListenerArray(events, type, handler) {\n if (handler[kEmitting] > 0) {\n const copy = cloneEventListenerArray(handler);\n events[type] = copy;\n return copy;\n }\n return handler;\n}\n\nfunction unwrapListeners(arr) {\n const ret = arrayClone(arr);\n for (let i = 0; i < ret.length; ++i) {\n const orig = ret[i].listener;\n if (typeof orig === 'function')\n ret[i] = orig;\n }\n return ret;\n}\n\n\n\n\n\n\n\n\nfunction getEventListeners(emitterOrTarget, type) {\n\n if (typeof emitterOrTarget.listeners === 'function') {\n return emitterOrTarget.listeners(type);\n }\n\n const { isEventTarget, kEvents } = require('internal/event_target');\n if (isEventTarget(emitterOrTarget)) {\n const root = emitterOrTarget[kEvents]?.get(type);\n const listeners = [];\n let handler = root?.next;\n while (handler?.listener !== undefined) {\n const listener = handler.listener?.deref ?\n handler.listener.deref() : handler.listener;\n listeners.push(listener);\n handler = handler.next;\n }\n return listeners;\n }\n throw new ERR_INVALID_ARG_TYPE('emitter',\n ['EventEmitter', 'EventTarget'],\n emitterOrTarget);\n}\n\n\n\n\n\n\nfunction getMaxListeners(emitterOrTarget) {\n if (typeof emitterOrTarget?.getMaxListeners === 'function') {\n return _getMaxListeners(emitterOrTarget);\n } else if (typeof emitterOrTarget?.[kMaxEventTargetListeners] === 'number') {\n return emitterOrTarget[kMaxEventTargetListeners];\n }\n\n throw new ERR_INVALID_ARG_TYPE('emitter',\n ['EventEmitter', 'EventTarget'],\n emitterOrTarget);\n}\n\n\n\n\n\n\n\nfunction listenerCount(emitterOrTarget, type) {\n if (typeof emitterOrTarget.listenerCount === 'function') {\n return emitterOrTarget.listenerCount(type);\n }\n const { isEventTarget, kEvents } = require('internal/event_target');\n if (isEventTarget(emitterOrTarget)) {\n return emitterOrTarget[kEvents]?.get(type)?.size ?? 0;\n }\n throw new ERR_INVALID_ARG_TYPE('emitter',\n ['EventEmitter', 'EventTarget'],\n emitterOrTarget);\n}\n\n\n\n\n\n\n\n\n\nasync function once(emitter, name, options = kEmptyObject) {\n validateObject(options, 'options');\n const { signal } = options;\n validateAbortSignal(signal, 'options.signal');\n if (signal?.aborted)\n throw new AbortError(undefined, { cause: signal.reason });\n return new Promise((resolve, reject) => {\n const errorListener = (err) => {\n emitter.removeListener(name, resolver);\n if (signal != null) {\n eventTargetAgnosticRemoveListener(signal, 'abort', abortListener);\n }\n reject(err);\n };\n const resolver = (...args) => {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n if (signal != null) {\n eventTargetAgnosticRemoveListener(signal, 'abort', abortListener);\n }\n resolve(args);\n };\n\n kResistStopPropagation ??= require('internal/event_target').kResistStopPropagation;\n const opts = { __proto__: null, once: true, [kResistStopPropagation]: true };\n eventTargetAgnosticAddListener(emitter, name, resolver, opts);\n if (name !== 'error' && typeof emitter.once === 'function') {\n\n\n emitter.once('error', errorListener);\n }\n function abortListener() {\n eventTargetAgnosticRemoveListener(emitter, name, resolver);\n eventTargetAgnosticRemoveListener(emitter, 'error', errorListener);\n reject(new AbortError(undefined, { cause: signal?.reason }));\n }\n if (signal != null) {\n eventTargetAgnosticAddListener(\n signal, 'abort', abortListener, { __proto__: null, once: true, [kResistStopPropagation]: true });\n }\n });\n}\n\nfunction createIterResult(value, done) {\n return { done, value };\n}\n\nfunction eventTargetAgnosticRemoveListener(emitter, name, listener, flags) {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener(name, listener);\n } else if (typeof emitter.removeEventListener === 'function') {\n emitter.removeEventListener(name, listener, flags);\n } else {\n throw new ERR_INVALID_ARG_TYPE('emitter', 'EventEmitter', emitter);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags?.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n emitter.addEventListener(name, listener, flags);\n } else {\n throw new ERR_INVALID_ARG_TYPE('emitter', 'EventEmitter', emitter);\n }\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction on(emitter, event, options = kEmptyObject) {\n\n validateObject(options, 'options');\n const signal = options.signal;\n validateAbortSignal(signal, 'options.signal');\n if (signal?.aborted)\n throw new AbortError(undefined, { cause: signal.reason });\n\n const highWatermark = options.highWaterMark ?? options.highWatermark ?? NumberMAX_SAFE_INTEGER;\n validateInteger(highWatermark, 'options.highWaterMark', 1);\n\n const lowWatermark = options.lowWaterMark ?? options.lowWatermark ?? 1;\n validateInteger(lowWatermark, 'options.lowWaterMark', 1);\n\n\n FixedQueue ??= require('internal/fixed_queue');\n const unconsumedEvents = new FixedQueue();\n const unconsumedPromises = new FixedQueue();\n let paused = false;\n let error = null;\n let finished = false;\n let size = 0;\n\n const iterator = ObjectSetPrototypeOf({\n next() {\n\n if (size) {\n const value = unconsumedEvents.shift();\n size--;\n if (paused && size < lowWatermark) {\n emitter.resume();\n paused = false;\n }\n return PromiseResolve(createIterResult(value, false));\n }\n\n\n\n\n if (error) {\n const p = PromiseReject(error);\n\n error = null;\n return p;\n }\n\n\n if (finished) return closeHandler();\n\n\n return new Promise(function(resolve, reject) {\n unconsumedPromises.push({ resolve, reject });\n });\n },\n\n return() {\n return closeHandler();\n },\n\n throw(err) {\n if (!err || !(err instanceof Error)) {\n throw new ERR_INVALID_ARG_TYPE('EventEmitter.AsyncIterator',\n 'Error', err);\n }\n errorHandler(err);\n },\n [SymbolAsyncIterator]() {\n return this;\n },\n [kWatermarkData]: {\n\n\n\n\n get size() {\n return size;\n },\n\n\n\n\n get low() {\n return lowWatermark;\n },\n\n\n\n\n get high() {\n return highWatermark;\n },\n\n\n\n\n get isPaused() {\n return paused;\n },\n },\n }, AsyncIteratorPrototype);\n\n\n const { addEventListener, removeAll } = listenersController();\n kFirstEventParam ??= require('internal/events/symbols').kFirstEventParam;\n addEventListener(emitter, event, options[kFirstEventParam] ? eventHandler : function(...args) {\n return eventHandler(args);\n });\n if (event !== 'error' && typeof emitter.on === 'function') {\n addEventListener(emitter, 'error', errorHandler);\n }\n const closeEvents = options?.close;\n if (closeEvents?.length) {\n for (let i = 0; i < closeEvents.length; i++) {\n addEventListener(emitter, closeEvents[i], closeHandler);\n }\n }\n\n const abortListenerDisposable = signal ? addAbortListener(signal, abortListener) : null;\n\n return iterator;\n\n function abortListener() {\n errorHandler(new AbortError(undefined, { cause: signal?.reason }));\n }\n\n function eventHandler(value) {\n if (unconsumedPromises.isEmpty()) {\n size++;\n if (!paused && size > highWatermark) {\n paused = true;\n emitter.pause();\n }\n unconsumedEvents.push(value);\n } else unconsumedPromises.shift().resolve(createIterResult(value, false));\n }\n\n function errorHandler(err) {\n if (unconsumedPromises.isEmpty()) error = err;\n else unconsumedPromises.shift().reject(err);\n\n closeHandler();\n }\n\n function closeHandler() {\n abortListenerDisposable?.[SymbolDispose]();\n removeAll();\n finished = true;\n paused = false;\n const doneResult = createIterResult(undefined, true);\n while (!unconsumedPromises.isEmpty()) {\n unconsumedPromises.shift().resolve(doneResult);\n }\n\n return PromiseResolve(doneResult);\n }\n}\n\nfunction listenersController() {\n const listeners = [];\n\n return {\n addEventListener(emitter, event, handler, flags) {\n eventTargetAgnosticAddListener(emitter, event, handler, flags);\n ArrayPrototypePush(listeners, [emitter, event, handler, flags]);\n },\n removeAll() {\n while (listeners.length > 0) {\n ReflectApply(eventTargetAgnosticRemoveListener, undefined, ArrayPrototypePop(listeners));\n }\n },\n };\n}\n","internal/abort_controller.js":"'use strict';\n\n\n\n\nconst {\n ArrayPrototypePush,\n ObjectAssign,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectSetPrototypeOf,\n PromiseResolve,\n PromiseWithResolvers,\n SafeFinalizationRegistry,\n SafeSet,\n SafeWeakRef,\n Symbol,\n SymbolToStringTag,\n} = primordials;\n\nconst {\n defineEventHandler,\n EventTarget,\n Event,\n kTrustEvent,\n kNewListener,\n kRemoveListener,\n kResistStopPropagation,\n kWeakHandler,\n} = require('internal/event_target');\nconst { kMaxEventTargetListeners } = require('events');\nconst {\n customInspectSymbol,\n kEmptyObject,\n kEnumerableProperty,\n} = require('internal/util');\nconst { inspect } = require('internal/util/inspect');\nconst {\n codes: {\n ERR_ILLEGAL_CONSTRUCTOR,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_THIS,\n },\n} = require('internal/errors');\nconst {\n converters,\n createInterfaceConverter,\n createSequenceConverter,\n} = require('internal/webidl');\n\nconst {\n validateObject,\n validateUint32,\n kValidateObjectAllowObjects,\n} = require('internal/validators');\n\nconst {\n DOMException,\n} = internalBinding('messaging');\n\nconst {\n clearTimeout,\n setTimeout,\n} = require('timers');\nconst assert = require('internal/assert');\n\nconst {\n kDeserialize,\n kTransfer,\n kTransferList,\n markTransferMode,\n} = require('internal/worker/js_transferable');\n\nlet _MessageChannel;\n\nconst kDontThrowSymbol = Symbol('kDontThrowSymbol');\n\n\n\n\n\nfunction lazyMessageChannel() {\n _MessageChannel ??= require('internal/worker/io').MessageChannel;\n return new _MessageChannel();\n}\n\nconst clearTimeoutRegistry = new SafeFinalizationRegistry(clearTimeout);\nconst dependantSignalsCleanupRegistry = new SafeFinalizationRegistry(\n ({ sourceSignalRef, dependantSignalRef, sourceSignalsCleanupToken }) => {\n sourceSignalsCleanupRegistry.unregister(sourceSignalsCleanupToken);\n\n const sourceSignal = sourceSignalRef.deref();\n if (sourceSignal === undefined) {\n return;\n }\n sourceSignal[kDependantSignals].delete(dependantSignalRef);\n });\n\nconst gcPersistentSignals = new SafeSet();\n\nconst sourceSignalsCleanupRegistry = new SafeFinalizationRegistry(({ sourceSignalRef, composedSignalRef }) => {\n const composedSignal = composedSignalRef.deref();\n if (composedSignal !== undefined) {\n composedSignal[kSourceSignals].delete(sourceSignalRef);\n\n if (composedSignal[kSourceSignals].size === 0) {\n\n gcPersistentSignals.delete(composedSignal);\n }\n }\n});\n\nconst kAborted = Symbol('kAborted');\nconst kReason = Symbol('kReason');\nconst kCloneData = Symbol('kCloneData');\nconst kTimeout = Symbol('kTimeout');\nconst kMakeTransferable = Symbol('kMakeTransferable');\nconst kComposite = Symbol('kComposite');\nconst kFollowing = Symbol('kFollowing');\nconst kResultSignalWeakRef = Symbol('kResultSignalWeakRef');\nconst kSourceSignals = Symbol('kSourceSignals');\nconst kDependantSignals = Symbol('kDependantSignals');\n\nfunction customInspect(self, obj, depth, options) {\n if (depth < 0)\n return self;\n\n const opts = ObjectAssign({}, options, {\n depth: options.depth === null ? null : options.depth - 1,\n });\n\n return `${self.constructor.name} ${inspect(obj, opts)}`;\n}\n\nfunction validateThisAbortSignal(obj) {\n if (obj?.[kAborted] === undefined)\n throw new ERR_INVALID_THIS('AbortSignal');\n}\n\nfunction refreshCompositeSignal(signal) {\n if (!signal[kComposite] || signal[kAborted] || !signal[kSourceSignals]?.size) {\n return;\n }\n\n for (const sourceSignalWeakRef of signal[kSourceSignals]) {\n const sourceSignal = sourceSignalWeakRef.deref();\n if (sourceSignal === undefined) {\n signal[kSourceSignals].delete(sourceSignalWeakRef);\n continue;\n }\n\n if (sourceSignal.aborted) {\n abortSignal(signal, sourceSignal.reason);\n return;\n }\n }\n}\n\nfunction followCompositeSignal(signal) {\n if (signal[kFollowing] || signal[kAborted] || !signal[kSourceSignals]?.size) {\n return;\n }\n\n const resultSignalWeakRef = signal[kResultSignalWeakRef] ??= new SafeWeakRef(signal);\n\n for (const sourceSignalWeakRef of signal[kSourceSignals]) {\n const sourceSignal = sourceSignalWeakRef.deref();\n if (sourceSignal === undefined) {\n signal[kSourceSignals].delete(sourceSignalWeakRef);\n continue;\n }\n\n if (sourceSignal.aborted) {\n abortSignal(signal, sourceSignal.reason);\n return;\n }\n\n sourceSignal[kDependantSignals] ??= new SafeSet();\n sourceSignal[kDependantSignals].add(resultSignalWeakRef);\n dependantSignalsCleanupRegistry.register(signal, {\n sourceSignalRef: sourceSignalWeakRef,\n dependantSignalRef: resultSignalWeakRef,\n sourceSignalsCleanupToken: sourceSignalWeakRef,\n });\n sourceSignalsCleanupRegistry.register(sourceSignal, {\n sourceSignalRef: sourceSignalWeakRef,\n composedSignalRef: resultSignalWeakRef,\n }, sourceSignalWeakRef);\n }\n\n signal[kFollowing] = true;\n}\n\n\n\n\n\n\n\n\n\nfunction setWeakAbortSignalTimeout(weakRef, delay) {\n const timeout = setTimeout(() => {\n const signal = weakRef.deref();\n if (signal !== undefined) {\n clearTimeoutRegistry.unregister(signal);\n gcPersistentSignals.delete(signal);\n abortSignal(\n signal,\n new DOMException(\n 'The operation was aborted due to timeout',\n 'TimeoutError'));\n }\n }, delay);\n timeout.unref();\n return timeout;\n}\n\nclass AbortSignal extends EventTarget {\n\n\n\n\n\n\n\n\n\n\n\n constructor(dontThrowSymbol = undefined, init = kEmptyObject) {\n if (dontThrowSymbol !== kDontThrowSymbol) {\n throw new ERR_ILLEGAL_CONSTRUCTOR();\n }\n super();\n\n this[kMaxEventTargetListeners] = 0;\n const {\n aborted = false,\n reason = undefined,\n transferable = false,\n composite = false,\n } = init;\n this[kAborted] = aborted;\n this[kReason] = reason;\n this[kComposite] = composite;\n if (transferable) {\n markTransferMode(this, false, true);\n }\n }\n\n\n\n\n get aborted() {\n validateThisAbortSignal(this);\n refreshCompositeSignal(this);\n return !!this[kAborted];\n }\n\n\n\n\n get reason() {\n validateThisAbortSignal(this);\n refreshCompositeSignal(this);\n return this[kReason];\n }\n\n throwIfAborted() {\n validateThisAbortSignal(this);\n refreshCompositeSignal(this);\n if (this[kAborted]) {\n throw this[kReason];\n }\n }\n\n [customInspectSymbol](depth, options) {\n return customInspect(this, {\n aborted: this.aborted,\n }, depth, options);\n }\n\n\n\n\n\n static abort(\n reason = new DOMException('This operation was aborted', 'AbortError')) {\n return new AbortSignal(kDontThrowSymbol, { aborted: true, reason });\n }\n\n\n\n\n\n static timeout(delay) {\n validateUint32(delay, 'delay', false);\n const signal = new AbortSignal(kDontThrowSymbol);\n signal[kTimeout] = true;\n clearTimeoutRegistry.register(\n signal,\n setWeakAbortSignalTimeout(new SafeWeakRef(signal), delay),\n signal);\n return signal;\n }\n\n\n\n\n\n static any(signals) {\n const signalsArray = converters['sequence'](\n signals,\n { __proto__: null, context: 'signals' },\n );\n\n const resultSignal = new AbortSignal(kDontThrowSymbol, { composite: true });\n if (!signalsArray.length) {\n return resultSignal;\n }\n\n resultSignal[kSourceSignals] = new SafeSet();\n\n\n let hasTimeoutSignals = false;\n\n for (let i = 0; i < signalsArray.length; i++) {\n const signal = signalsArray[i];\n\n\n if (signal[kTimeout]) {\n hasTimeoutSignals = true;\n\n\n\n gcPersistentSignals.add(signal);\n }\n\n if (signal.aborted) {\n abortSignal(resultSignal, signal.reason);\n return resultSignal;\n }\n\n if (!signal[kComposite]) {\n const signalWeakRef = new SafeWeakRef(signal);\n resultSignal[kSourceSignals].add(signalWeakRef);\n } else if (!signal[kSourceSignals]) {\n continue;\n } else {\n refreshCompositeSignal(signal);\n if (signal.aborted) {\n abortSignal(resultSignal, signal.reason);\n return resultSignal;\n }\n for (const sourceSignalWeakRef of signal[kSourceSignals]) {\n const sourceSignal = sourceSignalWeakRef.deref();\n if (!sourceSignal) {\n continue;\n }\n assert(!sourceSignal[kComposite]);\n\n if (sourceSignal.aborted) {\n abortSignal(resultSignal, sourceSignal.reason);\n return resultSignal;\n }\n\n if (resultSignal[kSourceSignals].has(sourceSignalWeakRef)) {\n continue;\n }\n resultSignal[kSourceSignals].add(sourceSignalWeakRef);\n }\n }\n }\n\n if (hasTimeoutSignals && resultSignal[kSourceSignals].size > 0) {\n resultSignal[kTimeout] = true;\n }\n\n return resultSignal;\n }\n\n [kNewListener](size, type, listener, once, capture, passive, weak) {\n super[kNewListener](size, type, listener, once, capture, passive, weak);\n\n if (this[kComposite] && type === 'abort' && !this.aborted && size === 1) {\n followCompositeSignal(this);\n }\n\n const isTimeoutOrNonEmptyCompositeSignal = this[kTimeout] || (this[kComposite] && this[kSourceSignals]?.size);\n if (isTimeoutOrNonEmptyCompositeSignal &&\n type === 'abort' &&\n !this.aborted &&\n !weak &&\n size === 1) {\n\n\n\n\n gcPersistentSignals.add(this);\n }\n }\n\n [kRemoveListener](size, type, listener, capture) {\n super[kRemoveListener](size, type, listener, capture);\n const isTimeoutOrNonEmptyCompositeSignal = this[kTimeout] || (this[kComposite] && this[kSourceSignals]?.size);\n if (isTimeoutOrNonEmptyCompositeSignal && type === 'abort' && size === 0) {\n gcPersistentSignals.delete(this);\n }\n }\n\n [kTransfer]() {\n validateThisAbortSignal(this);\n const aborted = this.aborted;\n if (aborted) {\n const reason = this.reason;\n return {\n data: { aborted, reason },\n deserializeInfo: 'internal/abort_controller:ClonedAbortSignal',\n };\n }\n\n const { port1, port2 } = this[kCloneData];\n this[kCloneData] = undefined;\n\n this.addEventListener('abort', () => {\n port1.postMessage(this.reason);\n port1.close();\n }, { once: true });\n\n return {\n data: { port: port2 },\n deserializeInfo: 'internal/abort_controller:ClonedAbortSignal',\n };\n }\n\n [kTransferList]() {\n if (!this.aborted) {\n const { port1, port2 } = lazyMessageChannel();\n port1.unref();\n port2.unref();\n this[kCloneData] = {\n port1,\n port2,\n };\n return [port2];\n }\n return [];\n }\n\n [kDeserialize]({ aborted, reason, port }) {\n if (aborted) {\n this[kAborted] = aborted;\n this[kReason] = reason;\n return;\n }\n\n port.onmessage = ({ data }) => {\n abortSignal(this, data);\n port.close();\n port.onmessage = undefined;\n };\n\n\n port.unref();\n }\n}\n\nconverters.AbortSignal = createInterfaceConverter('AbortSignal', AbortSignal.prototype);\nconverters['sequence'] = createSequenceConverter(converters.AbortSignal);\n\nfunction ClonedAbortSignal() {\n return new AbortSignal(kDontThrowSymbol, { transferable: true });\n}\nClonedAbortSignal.prototype[kDeserialize] = () => {};\n\nObjectDefineProperties(AbortSignal.prototype, {\n aborted: kEnumerableProperty,\n});\n\nObjectDefineProperty(AbortSignal.prototype, SymbolToStringTag, {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'AbortSignal',\n});\n\ndefineEventHandler(AbortSignal.prototype, 'abort');\n\n\nfunction abortSignal(signal, reason) {\n\n if (signal[kAborted]) return;\n\n\n\n signal[kAborted] = true;\n signal[kReason] = reason;\n\n\n const dependentSignalsToAbort = ObjectSetPrototypeOf([], null);\n\n\n signal[kDependantSignals]?.forEach((s) => {\n const dependentSignal = s.deref();\n\n if (dependentSignal && !dependentSignal[kAborted]) {\n\n dependentSignal[kReason] = reason;\n dependentSignal[kAborted] = true;\n\n ArrayPrototypePush(dependentSignalsToAbort, dependentSignal);\n }\n });\n\n\n runAbort(signal);\n\n\n\n for (let i = 0; i < dependentSignalsToAbort.length; i++) {\n const dependentSignal = dependentSignalsToAbort[i];\n runAbort(dependentSignal);\n\n\n\n\n\n\n gcPersistentSignals.delete(dependentSignal);\n }\n\n\n gcPersistentSignals.delete(signal);\n\n\n\n if (signal[kComposite] && signal[kSourceSignals]) {\n signal[kSourceSignals].forEach((sourceWeakRef) => {\n const sourceSignal = sourceWeakRef.deref();\n if (sourceSignal) {\n gcPersistentSignals.delete(sourceSignal);\n }\n });\n }\n}\n\n\nfunction runAbort(signal) {\n const event = new Event('abort', {\n [kTrustEvent]: true,\n });\n signal.dispatchEvent(event);\n}\n\nclass AbortController {\n #signal;\n\n\n\n\n get signal() {\n this.#signal ??= new AbortSignal(kDontThrowSymbol);\n\n return this.#signal;\n }\n\n\n\n\n abort(reason = new DOMException('This operation was aborted', 'AbortError')) {\n abortSignal(this.#signal ??= new AbortSignal(kDontThrowSymbol), reason);\n }\n\n [customInspectSymbol](depth, options) {\n return customInspect(this, {\n signal: this.signal,\n }, depth, options);\n }\n\n static [kMakeTransferable]() {\n const controller = new AbortController();\n controller.#signal = new AbortSignal(kDontThrowSymbol, { transferable: true });\n return controller;\n }\n}\n\n\n\n\n\n\nfunction transferableAbortSignal(signal) {\n if (signal?.[kAborted] === undefined)\n throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal);\n markTransferMode(signal, false, true);\n return signal;\n}\n\n\n\n\n\nfunction transferableAbortController() {\n return AbortController[kMakeTransferable]();\n}\n\n\n\n\n\n\nasync function aborted(signal, resource) {\n converters.AbortSignal(signal, { __proto__: null, context: 'signal' });\n validateObject(resource, 'resource', kValidateObjectAllowObjects);\n if (signal.aborted)\n return PromiseResolve();\n const abortPromise = PromiseWithResolvers();\n const opts = { __proto__: null, [kWeakHandler]: resource, once: true, [kResistStopPropagation]: true };\n signal.addEventListener('abort', abortPromise.resolve, opts);\n return abortPromise.promise;\n}\n\nObjectDefineProperties(AbortController.prototype, {\n signal: kEnumerableProperty,\n abort: kEnumerableProperty,\n});\n\nObjectDefineProperty(AbortController.prototype, SymbolToStringTag, {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'AbortController',\n});\n\nmodule.exports = {\n AbortController,\n AbortSignal,\n ClonedAbortSignal,\n aborted,\n transferableAbortSignal,\n transferableAbortController,\n};\n","internal/assert.js":"'use strict';\n\nlet error;\nfunction lazyError() {\n return error ??= require('internal/errors').codes.ERR_INTERNAL_ASSERTION;\n}\n\nfunction assert(value, message) {\n if (!value) {\n const ERR_INTERNAL_ASSERTION = lazyError();\n throw new ERR_INTERNAL_ASSERTION(message);\n }\n}\n\nfunction fail(message) {\n const ERR_INTERNAL_ASSERTION = lazyError();\n throw new ERR_INTERNAL_ASSERTION(message);\n}\n\nassert.fail = fail;\n\nmodule.exports = assert;\n","internal/async_context_frame.js":"'use strict';\n\nconst {\n SafeMap,\n} = primordials;\n\nconst {\n getContinuationPreservedEmbedderData,\n setContinuationPreservedEmbedderData,\n} = internalBinding('async_context_frame');\n\nfunction activeCurrent() {\n return getContinuationPreservedEmbedderData();\n}\n\nfunction activeSet(frame) {\n setContinuationPreservedEmbedderData(frame);\n}\n\nfunction activeExchange(frame) {\n const prior = getContinuationPreservedEmbedderData();\n setContinuationPreservedEmbedderData(frame);\n return prior;\n}\n\nfunction activeDisable(store) {\n getContinuationPreservedEmbedderData()?.disable(store);\n}\n\nclass InactiveAsyncContextFrame extends SafeMap {\n static get enabled() {\n enabled_ ??= checkEnabled();\n return enabled_;\n }\n\n static current() {}\n static set(frame) {}\n static exchange(frame) {}\n static disable(store) {}\n}\n\nclass AsyncContextFrame extends InactiveAsyncContextFrame {\n constructor(store, data) {\n super(AsyncContextFrame.current());\n this.set(store, data);\n }\n\n disable(store) {\n this.delete(store);\n }\n}\n\nlet enabled_;\n\nfunction checkEnabled() {\n const enabled = require('internal/options')\n .getOptionValue('--async-context-frame');\n\n\n\n if (enabled) {\n AsyncContextFrame.current = activeCurrent;\n AsyncContextFrame.set = activeSet;\n AsyncContextFrame.exchange = activeExchange;\n AsyncContextFrame.disable = activeDisable;\n }\n\n return enabled;\n}\n\nmodule.exports = AsyncContextFrame;\n","internal/async_hooks.js":"'use strict';\n\nconst {\n ArrayPrototypeSlice,\n ErrorCaptureStackTrace,\n ObjectDefineProperty,\n ObjectPrototypeHasOwnProperty,\n ReflectApply,\n Symbol,\n} = primordials;\n\nconst { exitCodes: { kGenericUserError } } = internalBinding('errors');\n\nconst async_wrap = internalBinding('async_wrap');\nconst { setCallbackTrampoline } = async_wrap;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n async_hook_fields,\n async_id_fields,\n execution_async_resources,\n} = async_wrap;\n\n\n\n\n\nconst {\n pushAsyncContext: pushAsyncContext_,\n popAsyncContext: popAsyncContext_,\n executionAsyncResource: executionAsyncResource_,\n clearAsyncIdStack,\n} = async_wrap;\n\n\n\nconst active_hooks = {\n\n\n\n\n array: [],\n\n\n call_depth: 0,\n\n\n\n\n\n\n\n tmp_array: null,\n\n\n\n tmp_fields: null,\n};\n\nconst { registerDestroyHook } = async_wrap;\nconst { enqueueMicrotask } = internalBinding('task_queue');\nconst { resource_symbol, owner_symbol } = internalBinding('symbols');\n\n\n\n\nconst {\n kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,\n kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,\n kDefaultTriggerAsyncId, kStackLength, kUsesExecutionAsyncResource,\n} = async_wrap.constants;\n\nconst { async_id_symbol,\n trigger_async_id_symbol } = internalBinding('symbols');\n\n\nlet inspect;\n\n\nconst init_symbol = Symbol('init');\nconst before_symbol = Symbol('before');\nconst after_symbol = Symbol('after');\nconst destroy_symbol = Symbol('destroy');\nconst promise_resolve_symbol = Symbol('promiseResolve');\nconst async_local_storage_context_symbol = Symbol('kAsyncLocalStorageContext');\nconst emitBeforeNative = emitHookFactory(before_symbol, 'emitBeforeNative');\nconst emitAfterNative = emitHookFactory(after_symbol, 'emitAfterNative');\nconst emitDestroyNative = emitHookFactory(destroy_symbol, 'emitDestroyNative');\nconst emitPromiseResolveNative =\n emitHookFactory(promise_resolve_symbol, 'emitPromiseResolveNative');\n\nlet domain_cb;\nfunction useDomainTrampoline(fn) {\n domain_cb = fn;\n}\n\nfunction callbackTrampoline(asyncId, resource, cb, ...args) {\n const index = async_hook_fields[kStackLength] - 1;\n execution_async_resources[index] = resource;\n\n if (asyncId !== 0 && hasHooks(kBefore))\n emitBeforeNative(asyncId);\n\n let result;\n if (asyncId === 0 && typeof domain_cb === 'function') {\n args.unshift(cb);\n result = ReflectApply(domain_cb, this, args);\n } else {\n result = ReflectApply(cb, this, args);\n }\n\n if (asyncId !== 0 && hasHooks(kAfter))\n emitAfterNative(asyncId);\n\n execution_async_resources.pop();\n return result;\n}\n\nconst topLevelResource = {};\n\nfunction executionAsyncResource() {\n\n\n\n async_hook_fields[kUsesExecutionAsyncResource] = 1;\n\n const index = async_hook_fields[kStackLength] - 1;\n if (index === -1) return topLevelResource;\n const resource = execution_async_resources[index] ||\n executionAsyncResource_(index);\n return lookupPublicResource(resource);\n}\n\nfunction inspectExceptionValue(e) {\n inspect ??= require('internal/util/inspect').inspect;\n return { message: inspect(e) };\n}\n\n\nfunction fatalError(e) {\n if (typeof e?.stack === 'string') {\n process._rawDebug(e.stack);\n } else {\n const o = inspectExceptionValue(e);\n ErrorCaptureStackTrace(o, fatalError);\n process._rawDebug(o.stack);\n }\n\n const { getOptionValue } = require('internal/options');\n if (getOptionValue('--abort-on-uncaught-exception')) {\n process.abort();\n }\n process.exit(kGenericUserError);\n}\n\nfunction lookupPublicResource(resource) {\n if (typeof resource !== 'object' || resource === null) return resource;\n\n\n const publicResource = resource[resource_symbol];\n if (publicResource !== undefined)\n return publicResource;\n return resource;\n}\n\n\n\n\n\n\nfunction emitInitNative(asyncId, type, triggerAsyncId, resource, isPromiseHook) {\n active_hooks.call_depth += 1;\n resource = lookupPublicResource(resource);\n\n try {\n\n\n\n for (var i = 0; i < active_hooks.array.length; i++) {\n if (typeof active_hooks.array[i][init_symbol] === 'function') {\n if (isPromiseHook &&\n active_hooks.array[i][kNoPromiseHook]) {\n continue;\n }\n active_hooks.array[i][init_symbol](\n asyncId, type, triggerAsyncId,\n resource,\n );\n }\n }\n } catch (e) {\n fatalError(e);\n } finally {\n active_hooks.call_depth -= 1;\n }\n\n\n\n\n\n if (active_hooks.call_depth === 0 && active_hooks.tmp_array !== null) {\n restoreActiveHooks();\n }\n}\n\n\n\nfunction emitHook(symbol, asyncId, isPromiseHook) {\n active_hooks.call_depth += 1;\n\n\n try {\n\n\n\n for (var i = 0; i < active_hooks.array.length; i++) {\n if (typeof active_hooks.array[i][symbol] === 'function') {\n if (isPromiseHook &&\n active_hooks.array[i][kNoPromiseHook]) {\n continue;\n }\n active_hooks.array[i][symbol](asyncId);\n }\n }\n } catch (e) {\n fatalError(e);\n } finally {\n active_hooks.call_depth -= 1;\n }\n\n\n\n\n\n if (active_hooks.call_depth === 0 && active_hooks.tmp_array !== null) {\n restoreActiveHooks();\n }\n}\n\nfunction emitHookFactory(symbol, name) {\n const fn = emitHook.bind(undefined, symbol);\n\n\n ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n value: name,\n });\n return fn;\n}\n\n\n\nfunction getHookArrays() {\n if (active_hooks.call_depth === 0)\n return [active_hooks.array, async_hook_fields];\n\n\n\n\n if (active_hooks.tmp_array === null)\n storeActiveHooks();\n return [active_hooks.tmp_array, active_hooks.tmp_fields];\n}\n\n\nfunction storeActiveHooks() {\n active_hooks.tmp_array = ArrayPrototypeSlice(active_hooks.array);\n\n\n active_hooks.tmp_fields = [];\n copyHooks(active_hooks.tmp_fields, async_hook_fields);\n}\n\nfunction copyHooks(destination, source) {\n destination[kInit] = source[kInit];\n destination[kBefore] = source[kBefore];\n destination[kAfter] = source[kAfter];\n destination[kDestroy] = source[kDestroy];\n destination[kPromiseResolve] = source[kPromiseResolve];\n}\n\n\n\n\nfunction restoreActiveHooks() {\n active_hooks.array = active_hooks.tmp_array;\n copyHooks(async_hook_fields, active_hooks.tmp_fields);\n\n active_hooks.tmp_array = null;\n active_hooks.tmp_fields = null;\n}\n\nfunction trackPromise(promise, parent) {\n if (promise[async_id_symbol]) {\n return;\n }\n\n\n\n const triggerAsyncId = parent ? getOrSetAsyncId(parent) :\n getDefaultTriggerAsyncId();\n\n promise[async_id_symbol] = newAsyncId();\n promise[trigger_async_id_symbol] = triggerAsyncId;\n}\n\nfunction promiseInitHook(promise, parent) {\n trackPromise(promise, parent);\n const asyncId = promise[async_id_symbol];\n const triggerAsyncId = promise[trigger_async_id_symbol];\n emitInitScript(asyncId, 'PROMISE', triggerAsyncId, promise, true);\n}\n\nfunction promiseInitHookWithDestroyTracking(promise, parent) {\n promiseInitHook(promise, parent);\n destroyTracking(promise, parent);\n}\n\nfunction destroyTracking(promise, parent) {\n trackPromise(promise, parent);\n const asyncId = promise[async_id_symbol];\n registerDestroyHook(promise, asyncId);\n}\n\nfunction promiseBeforeHook(promise) {\n trackPromise(promise);\n const asyncId = promise[async_id_symbol];\n const triggerId = promise[trigger_async_id_symbol];\n emitBeforeScript(asyncId, triggerId, promise, true);\n}\n\nfunction promiseAfterHook(promise) {\n trackPromise(promise);\n const asyncId = promise[async_id_symbol];\n if (hasHooks(kAfter)) {\n emitAfterNative(asyncId, true);\n }\n if (asyncId === executionAsyncId()) {\n\n\n\n\n\n popAsyncContext(asyncId);\n }\n}\n\nfunction promiseResolveHook(promise) {\n trackPromise(promise);\n const asyncId = promise[async_id_symbol];\n emitPromiseResolveNative(asyncId, true);\n}\n\nlet wantPromiseHook = false;\nfunction enableHooks() {\n async_hook_fields[kCheck] += 1;\n\n setCallbackTrampoline(callbackTrampoline);\n}\n\nlet stopPromiseHook;\nfunction updatePromiseHookMode() {\n wantPromiseHook = true;\n let initHook;\n if (initHooksExist()) {\n initHook = destroyHooksExist() ? promiseInitHookWithDestroyTracking :\n promiseInitHook;\n } else if (destroyHooksExist()) {\n initHook = destroyTracking;\n }\n if (stopPromiseHook) stopPromiseHook();\n const promiseHooks = require('internal/promise_hooks');\n stopPromiseHook = promiseHooks.createHook({\n init: initHook,\n before: promiseBeforeHook,\n after: promiseAfterHook,\n settled: promiseResolveHooksExist() ? promiseResolveHook : undefined,\n });\n}\n\nfunction disableHooks() {\n async_hook_fields[kCheck] -= 1;\n\n wantPromiseHook = false;\n\n setCallbackTrampoline();\n\n\n\n enqueueMicrotask(disablePromiseHookIfNecessary);\n}\n\nfunction disablePromiseHookIfNecessary() {\n if (!wantPromiseHook && stopPromiseHook) {\n stopPromiseHook();\n }\n}\n\n\n\n\n\n\nfunction newAsyncId() {\n return ++async_id_fields[kAsyncIdCounter];\n}\n\nfunction getOrSetAsyncId(object) {\n if (ObjectPrototypeHasOwnProperty(object, async_id_symbol)) {\n return object[async_id_symbol];\n }\n\n return object[async_id_symbol] = newAsyncId();\n}\n\n\n\n\n\nfunction getDefaultTriggerAsyncId() {\n const defaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];\n\n if (defaultTriggerAsyncId < 0)\n return async_id_fields[kExecutionAsyncId];\n return defaultTriggerAsyncId;\n}\n\n\nfunction clearDefaultTriggerAsyncId() {\n async_id_fields[kDefaultTriggerAsyncId] = -1;\n}\n\n\n\n\n\n\n\n\n\n\nfunction defaultTriggerAsyncIdScope(triggerAsyncId, block, ...args) {\n if (triggerAsyncId === undefined)\n return ReflectApply(block, null, args);\n\n\n const oldDefaultTriggerAsyncId = async_id_fields[kDefaultTriggerAsyncId];\n async_id_fields[kDefaultTriggerAsyncId] = triggerAsyncId;\n\n try {\n return ReflectApply(block, null, args);\n } finally {\n async_id_fields[kDefaultTriggerAsyncId] = oldDefaultTriggerAsyncId;\n }\n}\n\nfunction hasHooks(key) {\n return async_hook_fields[key] > 0;\n}\n\nfunction enabledHooksExist() {\n return active_hooks.array.length > 0;\n}\n\nfunction initHooksExist() {\n return hasHooks(kInit);\n}\n\nfunction afterHooksExist() {\n return hasHooks(kAfter);\n}\n\nfunction destroyHooksExist() {\n return hasHooks(kDestroy);\n}\n\nfunction promiseResolveHooksExist() {\n return hasHooks(kPromiseResolve);\n}\n\n\nfunction emitInitScript(asyncId, type, triggerAsyncId, resource, isPromiseHook = false) {\n\n\n if (!hasHooks(kInit))\n return;\n\n if (triggerAsyncId === null) {\n triggerAsyncId = getDefaultTriggerAsyncId();\n }\n\n emitInitNative(asyncId, type, triggerAsyncId, resource, isPromiseHook);\n}\n\n\nfunction emitBeforeScript(asyncId, triggerAsyncId, resource, isPromiseHook = false) {\n pushAsyncContext(asyncId, triggerAsyncId, resource);\n\n if (hasHooks(kBefore))\n emitBeforeNative(asyncId, isPromiseHook);\n}\n\n\nfunction emitAfterScript(asyncId) {\n if (hasHooks(kAfter))\n emitAfterNative(asyncId);\n\n popAsyncContext(asyncId);\n}\n\n\nfunction emitDestroyScript(asyncId) {\n\n if (!hasHooks(kDestroy) || !(asyncId > 0))\n return;\n async_wrap.queueDestroyAsyncId(asyncId);\n}\n\n\nfunction hasAsyncIdStack() {\n return hasHooks(kStackLength);\n}\n\n\n\nfunction pushAsyncContext(asyncId, triggerAsyncId, resource) {\n const offset = async_hook_fields[kStackLength];\n execution_async_resources[offset] = resource;\n if (offset * 2 >= async_wrap.async_ids_stack.length)\n return pushAsyncContext_(asyncId, triggerAsyncId);\n async_wrap.async_ids_stack[offset * 2] = async_id_fields[kExecutionAsyncId];\n async_wrap.async_ids_stack[offset * 2 + 1] = async_id_fields[kTriggerAsyncId];\n async_hook_fields[kStackLength]++;\n async_id_fields[kExecutionAsyncId] = asyncId;\n async_id_fields[kTriggerAsyncId] = triggerAsyncId;\n}\n\n\n\nfunction popAsyncContext(asyncId) {\n const stackLength = async_hook_fields[kStackLength];\n if (stackLength === 0) return false;\n\n if (async_hook_fields[kCheck] > 0 && async_id_fields[kExecutionAsyncId] !== asyncId) {\n\n return popAsyncContext_(asyncId);\n }\n\n const offset = stackLength - 1;\n async_id_fields[kExecutionAsyncId] = async_wrap.async_ids_stack[2 * offset];\n async_id_fields[kTriggerAsyncId] = async_wrap.async_ids_stack[2 * offset + 1];\n execution_async_resources.pop();\n async_hook_fields[kStackLength] = offset;\n return offset > 0;\n}\n\n\nfunction executionAsyncId() {\n return async_id_fields[kExecutionAsyncId];\n}\n\nfunction triggerAsyncId() {\n return async_id_fields[kTriggerAsyncId];\n}\n\nconst kNoPromiseHook = Symbol('kNoPromiseHook');\n\nmodule.exports = {\n executionAsyncId,\n triggerAsyncId,\n\n getHookArrays,\n symbols: {\n async_id_symbol, trigger_async_id_symbol,\n init_symbol, before_symbol, after_symbol, destroy_symbol,\n promise_resolve_symbol, async_local_storage_context_symbol,\n owner_symbol,\n },\n constants: {\n kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,\n },\n enableHooks,\n disableHooks,\n updatePromiseHookMode,\n clearDefaultTriggerAsyncId,\n clearAsyncIdStack,\n hasAsyncIdStack,\n executionAsyncResource,\n\n newAsyncId,\n getOrSetAsyncId,\n getDefaultTriggerAsyncId,\n defaultTriggerAsyncIdScope,\n enabledHooksExist,\n initHooksExist,\n afterHooksExist,\n destroyHooksExist,\n emitInit: emitInitScript,\n emitBefore: emitBeforeScript,\n emitAfter: emitAfterScript,\n emitDestroy: emitDestroyScript,\n pushAsyncContext,\n popAsyncContext,\n registerDestroyHook,\n useDomainTrampoline,\n nativeHooks: {\n init: emitInitNative,\n before: emitBeforeNative,\n after: emitAfterNative,\n destroy: emitDestroyNative,\n promise_resolve: emitPromiseResolveNative,\n },\n asyncWrap: {\n Providers: async_wrap.Providers,\n },\n kNoPromiseHook,\n};\n","internal/blob.js":"'use strict';\n\nconst {\n ArrayPrototypePush,\n MathMax,\n MathMin,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectSetPrototypeOf,\n PromisePrototypeThen,\n PromiseReject,\n PromiseWithResolvers,\n RegExpPrototypeExec,\n RegExpPrototypeSymbolReplace,\n StringPrototypeSplit,\n StringPrototypeToLowerCase,\n Symbol,\n SymbolToStringTag,\n Uint8Array,\n} = primordials;\n\nconst {\n createBlob: _createBlob,\n createBlobFromFilePath: _createBlobFromFilePath,\n concat,\n getDataObject,\n} = internalBinding('blob');\nconst {\n kMaxLength,\n} = internalBinding('buffer');\n\nconst {\n getUtf8Decoder,\n TextEncoder,\n} = require('internal/encoding');\nconst { URL } = require('internal/url');\n\nconst {\n markTransferMode,\n kClone,\n kDeserialize,\n} = require('internal/worker/js_transferable');\n\nconst {\n isAnyArrayBuffer,\n isArrayBufferView,\n} = require('internal/util/types');\n\nconst {\n customInspectSymbol: kInspect,\n kEmptyObject,\n kEnumerableProperty,\n lazyDOMException,\n} = require('internal/util');\nconst { inspect } = require('internal/util/inspect');\nconst {\n converters,\n createSequenceConverter,\n} = require('internal/webidl');\n\nconst {\n codes: {\n ERR_BUFFER_TOO_LARGE,\n ERR_INVALID_ARG_VALUE,\n ERR_INVALID_STATE,\n ERR_INVALID_THIS,\n },\n} = require('internal/errors');\n\nconst {\n validateDictionary,\n} = require('internal/validators');\n\nconst {\n setImmediate,\n} = require('timers');\n\nconst { queueMicrotask } = require('internal/process/task_queues');\n\nconst kHandle = Symbol('kHandle');\nconst kType = Symbol('kType');\nconst kLength = Symbol('kLength');\nconst kNotCloneable = Symbol('kNotCloneable');\n\nconst disallowedTypeCharacters = /[^\\u{0020}-\\u{007E}]/u;\n\nlet ReadableStream;\nlet TextDecoderStream;\n\nconst enc = new TextEncoder();\n\n\n\n\n\nfunction lazyReadableStream(options) {\n\n ReadableStream ??=\n require('internal/webstreams/readablestream').ReadableStream;\n return new ReadableStream(options);\n}\n\nfunction lazyTextDecoderStream() {\n\n TextDecoderStream ??=\n require('internal/webstreams/encoding').TextDecoderStream;\n return new TextDecoderStream();\n}\n\nconst { EOL } = require('internal/constants');\n\nfunction isBlob(object) {\n return object?.[kHandle] !== undefined;\n}\n\nfunction getSource(source, endings) {\n if (isBlob(source))\n return [source.size, source[kHandle]];\n\n if (isAnyArrayBuffer(source)) {\n source = new Uint8Array(source);\n } else if (!isArrayBufferView(source)) {\n if (endings === 'native')\n source = RegExpPrototypeSymbolReplace(/\\r\\n|\\r|\\n/g, source, EOL);\n source = enc.encode(source);\n }\n\n\n\n\n const { buffer, byteOffset, byteLength } = source;\n const slice = buffer.slice(byteOffset, byteOffset + byteLength);\n return [byteLength, new Uint8Array(slice)];\n}\n\nconst sourcesConverter = createSequenceConverter((source, opts = kEmptyObject) => {\n if (isBlob(source) || isAnyArrayBuffer(source) || isArrayBufferView(source)) {\n return source;\n }\n return converters.DOMString(source, opts);\n});\n\nclass Blob {\n\n\n\n\n\n\n\n\n\n\n\n\n constructor(sources = [], options) {\n markTransferMode(this, true, false);\n\n const sources_ = sourcesConverter(sources);\n\n validateDictionary(options, 'options');\n let {\n endings = 'transparent',\n type = '',\n } = options ?? kEmptyObject;\n\n endings = `${endings}`;\n if (endings !== 'transparent' && endings !== 'native')\n throw new ERR_INVALID_ARG_VALUE('options.endings', endings);\n\n let length = 0;\n for (let i = 0; i < sources_.length; ++i) {\n const { 0: len, 1: src } = getSource(sources_[i], endings);\n length += len;\n sources_[i] = src;\n }\n\n if (length > kMaxLength)\n throw new ERR_BUFFER_TOO_LARGE(kMaxLength);\n\n this[kHandle] = _createBlob(sources_, length);\n this[kLength] = length;\n\n type = `${type}`;\n this[kType] = RegExpPrototypeExec(disallowedTypeCharacters, type) !== null ?\n '' : StringPrototypeToLowerCase(type);\n }\n\n [kInspect](depth, options) {\n if (depth < 0)\n return this;\n\n const opts = {\n ...options,\n depth: options.depth == null ? null : options.depth - 1,\n };\n\n return `Blob ${inspect({\n size: this.size,\n type: this.type,\n }, opts)}`;\n }\n\n [kClone]() {\n if (this[kNotCloneable]) {\n\n\n throw new ERR_INVALID_STATE.TypeError('File-backed Blobs are not cloneable');\n }\n const handle = this[kHandle];\n const type = this[kType];\n const length = this[kLength];\n return {\n data: { handle, type, length },\n deserializeInfo: 'internal/blob:Blob',\n };\n }\n\n [kDeserialize]({ handle, type, length }) {\n this[kHandle] = handle;\n this[kType] = type;\n this[kLength] = length;\n }\n\n\n\n\n\n get type() {\n if (!isBlob(this))\n throw new ERR_INVALID_THIS('Blob');\n return this[kType];\n }\n\n\n\n\n\n get size() {\n if (!isBlob(this))\n throw new ERR_INVALID_THIS('Blob');\n return this[kLength];\n }\n\n\n\n\n\n\n\n slice(start = 0, end = this[kLength], contentType = '') {\n if (!isBlob(this))\n throw new ERR_INVALID_THIS('Blob');\n\n start = converters['long long'](\n start,\n { __proto__: null, context: 'start', clamp: true },\n );\n end = converters['long long'](\n end,\n { __proto__: null, context: 'end', clamp: true },\n );\n\n if (start < 0) {\n start = MathMax(this[kLength] + start, 0);\n } else {\n start = MathMin(start, this[kLength]);\n }\n\n if (end < 0) {\n end = MathMax(this[kLength] + end, 0);\n } else {\n end = MathMin(end, this[kLength]);\n }\n\n contentType = `${contentType}`;\n if (RegExpPrototypeExec(disallowedTypeCharacters, contentType) !== null) {\n contentType = '';\n } else {\n contentType = StringPrototypeToLowerCase(contentType);\n }\n\n const span = MathMax(end - start, 0);\n\n return createBlob(\n this[kHandle].slice(start, start + span),\n span,\n contentType);\n }\n\n\n\n\n arrayBuffer() {\n if (!isBlob(this))\n return PromiseReject(new ERR_INVALID_THIS('Blob'));\n\n return arrayBuffer(this);\n }\n\n\n\n\n text() {\n if (!isBlob(this))\n return PromiseReject(new ERR_INVALID_THIS('Blob'));\n\n const dec = getUtf8Decoder();\n\n return PromisePrototypeThen(\n arrayBuffer(this),\n (buffer) => dec.decode(buffer));\n }\n\n\n\n\n bytes() {\n if (!isBlob(this))\n return PromiseReject(new ERR_INVALID_THIS('Blob'));\n\n return PromisePrototypeThen(\n arrayBuffer(this),\n (buffer) => new Uint8Array(buffer));\n }\n\n\n\n\n stream() {\n if (!isBlob(this))\n throw new ERR_INVALID_THIS('Blob');\n return createBlobReaderStream(this[kHandle].getReader());\n }\n\n\n\n\n textStream() {\n if (!isBlob(this))\n throw new ERR_INVALID_THIS('Blob');\n const stream = createBlobReaderStream(this[kHandle].getReader());\n const decoder = lazyTextDecoderStream();\n return stream.pipeThrough(decoder);\n }\n}\n\nfunction TransferableBlob(handle, length, type = '') {\n ObjectSetPrototypeOf(this, Blob.prototype);\n markTransferMode(this, true, false);\n this[kHandle] = handle;\n this[kType] = type;\n this[kLength] = length;\n}\n\nObjectSetPrototypeOf(TransferableBlob.prototype, Blob.prototype);\nObjectSetPrototypeOf(TransferableBlob, Blob);\n\nfunction createBlob(handle, length, type = '') {\n const transferredBlob = new TransferableBlob(handle, length, type);\n\n\n transferredBlob.constructor = Blob;\n\n return transferredBlob;\n}\n\nObjectDefineProperty(Blob.prototype, SymbolToStringTag, {\n __proto__: null,\n configurable: true,\n value: 'Blob',\n});\n\nObjectDefineProperties(Blob.prototype, {\n size: kEnumerableProperty,\n type: kEnumerableProperty,\n slice: kEnumerableProperty,\n stream: kEnumerableProperty,\n textStream: kEnumerableProperty,\n text: kEnumerableProperty,\n arrayBuffer: kEnumerableProperty,\n bytes: kEnumerableProperty,\n});\n\nfunction resolveObjectURL(url) {\n url = `${url}`;\n try {\n const parsed = new URL(url);\n\n const split = StringPrototypeSplit(parsed.pathname, ':', 3);\n\n if (split.length !== 2)\n return;\n\n const {\n 0: base,\n 1: id,\n } = split;\n\n if (base !== 'nodedata')\n return;\n\n const ret = getDataObject(id);\n\n if (ret === undefined)\n return;\n\n const {\n 0: handle,\n 1: length,\n 2: type,\n } = ret;\n\n if (handle !== undefined)\n return createBlob(handle, length, type);\n } catch {\n\n }\n}\n\n\n\nfunction createBlobFromFilePath(path, options) {\n const maybeBlob = _createBlobFromFilePath(path);\n if (maybeBlob === undefined) {\n return lazyDOMException('The blob could not be read', 'NotReadableError');\n }\n const { 0: blob, 1: length } = maybeBlob;\n const res = createBlob(blob, length, options?.type);\n res[kNotCloneable] = true;\n return res;\n}\n\nfunction arrayBuffer(blob) {\n const { promise, resolve, reject } = PromiseWithResolvers();\n const reader = blob[kHandle].getReader();\n const buffers = [];\n const readNext = () => {\n reader.pull((status, buffer) => {\n if (status === 0) {\n\n\n resolve(concat(buffers));\n return;\n } else if (status < 0) {\n\n\n\n const error = lazyDOMException('The blob could not be read', 'NotReadableError');\n reject(error);\n return;\n }\n if (buffer !== undefined)\n buffers.push(buffer);\n queueMicrotask(() => readNext());\n });\n };\n readNext();\n return promise;\n}\n\n\n\n\n\n\n\n\n\nfunction getBlobDataSync(blob) {\n const reader = blob[kHandle].getReader();\n const buffers = [];\n let result;\n let ended = false;\n while (!ended) {\n let sync = false;\n reader.pull((status, buffer) => {\n sync = true;\n if (status === 0) {\n\n result = concat(buffers);\n ended = true;\n return;\n } else if (status < 0) {\n ended = true;\n return;\n }\n if (buffer !== undefined)\n ArrayPrototypePush(buffers, buffer);\n });\n if (!sync) {\n\n break;\n }\n }\n return result;\n}\n\nfunction createBlobReaderStream(reader) {\n return new lazyReadableStream({\n type: 'bytes',\n start(c) {\n\n\n this.pendingPulls = [];\n\n\n let immediate;\n this.wakeup = () => {\n if (this.pendingPulls.length > 0) {\n immediate ??= setImmediate(() => {\n immediate = undefined;\n this.readNext(c);\n });\n }\n };\n },\n pull(c) {\n const { promise, resolve, reject } = PromiseWithResolvers();\n if (this.pendingPulls.length === 0) {\n reader.setWakeup(this.wakeup);\n }\n this.pendingPulls.push({ resolve, reject });\n this.readNext(c);\n return promise;\n },\n clearWakeupIfIdle() {\n if (this.pendingPulls.length === 0) {\n reader.setWakeup(undefined);\n }\n },\n readNext(c) {\n reader.pull((status, buffer) => {\n\n\n\n if (this.pendingPulls.length === 0) {\n reader.setWakeup(undefined);\n return;\n }\n if (status === 0) {\n\n reader.setWakeup(undefined);\n c.close();\n\n\n c.byobRequest?.respond(0);\n const pending = this.pendingPulls.shift();\n pending.resolve();\n return;\n } else if (status < 0) {\n\n\n\n reader.setWakeup(undefined);\n const error =\n lazyDOMException('The blob could not be read',\n 'NotReadableError');\n const pending = this.pendingPulls.shift();\n c.error(error);\n pending.reject(error);\n return;\n } else if (status === 2) {\n\n\n\n return;\n }\n\n\n if (buffer !== undefined && buffer.byteLength !== 0) {\n c.enqueue(new Uint8Array(buffer));\n }\n\n\n\n\n\n setImmediate(() => {\n if (c.desiredSize < 0) {\n\n if (this.pendingPulls.length !== 0) {\n const pending = this.pendingPulls.shift();\n pending.resolve();\n this.clearWakeupIfIdle();\n }\n return;\n }\n this.readNext(c);\n });\n });\n },\n cancel(reason) {\n reader.setWakeup(undefined);\n\n for (const pending of this.pendingPulls) {\n pending.reject(reason);\n }\n this.pendingPulls = [];\n },\n\n\n\n }, { highWaterMark: 0 });\n}\n\n\n\n\n\nconst kMaxBatchChunks = 16;\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst kDefaultMaxBatchBytes = 65536;\n\nasync function* createBlobReaderIterable(reader, options = kEmptyObject) {\n const { getReadError, maxBatchBytes = kDefaultMaxBatchBytes } = options;\n let wakeup = PromiseWithResolvers();\n let immediate;\n reader.setWakeup(() => {\n immediate ??= setImmediate(() => {\n immediate = undefined;\n wakeup.resolve?.();\n });\n });\n\n try {\n while (true) {\n const batch = [];\n let batchBytes = 0;\n let blocked = false;\n let eos = false;\n let error = null;\n\n\n\n\n\n while (true) {\n let pullResult;\n reader.pull((status, buffer) => {\n pullResult = { status, buffer };\n });\n\n if (pullResult.status === 0) {\n eos = true;\n break;\n }\n if (pullResult.status < 0) {\n error = typeof getReadError === 'function' ?\n getReadError(pullResult.status) :\n new ERR_INVALID_STATE('The reader is not readable');\n break;\n }\n if (pullResult.status === 2) {\n blocked = true;\n break;\n }\n const chunk = new Uint8Array(pullResult.buffer);\n ArrayPrototypePush(batch, chunk);\n\n\n\n batchBytes += chunk.byteLength;\n if (batchBytes >= maxBatchBytes || batch.length >= kMaxBatchChunks) {\n break;\n }\n }\n\n if (batch.length > 0) {\n yield batch;\n }\n\n if (eos) return;\n if (error) throw error;\n\n if (blocked) {\n await wakeup.promise;\n wakeup = PromiseWithResolvers();\n }\n }\n } finally {\n reader.setWakeup(undefined);\n }\n}\n\nmodule.exports = {\n Blob,\n createBlob,\n createBlobFromFilePath,\n createBlobReaderIterable,\n createBlobReaderStream,\n getBlobDataSync,\n isBlob,\n kHandle,\n kType,\n resolveObjectURL,\n TransferableBlob,\n};\n","internal/buffer.js":"'use strict';\n\nconst {\n BigInt,\n Float32Array,\n Float64Array,\n MathFloor,\n MathMax,\n Number,\n Symbol,\n Uint8Array,\n} = primordials;\n\nconst {\n ERR_BUFFER_OUT_OF_BOUNDS,\n ERR_INVALID_ARG_TYPE,\n ERR_OUT_OF_RANGE,\n} = require('internal/errors').codes;\nconst { validateNumber } = require('internal/validators');\nconst { isArrayBuffer } = require('util/types');\n\nconst {\n asciiSlice,\n base64Slice,\n base64urlSlice,\n latin1Slice,\n hexSlice,\n ucs2Slice,\n utf8Slice,\n asciiWriteStatic,\n base64Write,\n base64urlWrite,\n latin1WriteStatic,\n hexWrite,\n ucs2Write,\n utf8WriteStatic,\n arrayBufferAlignedOffset,\n createUnsafeArrayBuffer,\n setDetachKey,\n} = internalBinding('buffer');\n\nconst {\n privateSymbols: {\n untransferable_object_private_symbol,\n },\n} = internalBinding('util');\n\n\nconst float32Array = new Float32Array(1);\nconst uInt8Float32Array = new Uint8Array(float32Array.buffer);\nconst float64Array = new Float64Array(1);\nconst uInt8Float64Array = new Uint8Array(float64Array.buffer);\n\n\nfloat32Array[0] = -1;\n\n\nconst bigEndian = uInt8Float32Array[3] === 0;\n\nfunction checkBounds(buf, offset, byteLength) {\n validateNumber(offset, 'offset');\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined)\n boundsError(offset, buf.length - (byteLength + 1));\n}\n\nfunction checkInt(value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : '';\n let range;\n if (byteLength > 3) {\n if (min === 0 || min === 0n) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and ` +\n `< 2${n} ** ${(byteLength + 1) * 8 - 1}${n}`;\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`;\n }\n throw new ERR_OUT_OF_RANGE('value', range, value);\n }\n checkBounds(buf, offset, byteLength);\n}\n\nfunction boundsError(value, length, type) {\n if (MathFloor(value) !== value) {\n validateNumber(value, type);\n throw new ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value);\n }\n\n if (length < 0)\n throw new ERR_BUFFER_OUT_OF_BOUNDS();\n\n throw new ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value);\n}\n\n\nfunction readBigUInt64LE(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24;\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24;\n\n return BigInt(lo) + (BigInt(hi) << 32n);\n}\n\nfunction readBigUInt64BE(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last;\n\n return (BigInt(hi) << 32n) + BigInt(lo);\n}\n\nfunction readBigInt64LE(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24);\n return (BigInt(val) << 32n) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24);\n}\n\nfunction readBigInt64BE(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n const val = (first << 24) +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset];\n return (BigInt(val) << 32n) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last);\n}\n\nfunction readUIntLE(offset, byteLength) {\n if (offset === undefined)\n throw new ERR_INVALID_ARG_TYPE('offset', 'number', offset);\n if (byteLength === 6)\n return readUInt48LE(this, offset);\n if (byteLength === 5)\n return readUInt40LE(this, offset);\n if (byteLength === 3)\n return readUInt24LE(this, offset);\n if (byteLength === 4)\n return readUInt32LE(this, offset);\n if (byteLength === 2)\n return readUInt16LE(this, offset);\n if (byteLength === 1)\n return readUInt8(this, offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readUInt48LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24 +\n (buf[++offset] + last * 2 ** 8) * 2 ** 32;\n}\n\nfunction readUInt40LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24 +\n last * 2 ** 32;\n}\n\nfunction readUInt32LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 4);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n last * 2 ** 24;\n}\n\nfunction readUInt24LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n return first + buf[++offset] * 2 ** 8 + last * 2 ** 16;\n}\n\nfunction readUInt16LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 2);\n\n return first + last * 2 ** 8;\n}\n\nfunction readUInt8(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const val = buf[offset];\n if (val === undefined)\n boundsError(offset, buf.length - 1);\n\n return val;\n}\n\nfunction readUIntBE(offset, byteLength) {\n if (offset === undefined)\n throw new ERR_INVALID_ARG_TYPE('offset', 'number', offset);\n if (byteLength === 6)\n return readUInt48BE(this, offset);\n if (byteLength === 5)\n return readUInt40BE(this, offset);\n if (byteLength === 3)\n return readUInt24BE(this, offset);\n if (byteLength === 4)\n return readUInt32BE(this, offset);\n if (byteLength === 2)\n return readUInt16BE(this, offset);\n if (byteLength === 1)\n return readUInt8(this, offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readUInt48BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n return (first * 2 ** 8 + buf[++offset]) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt40BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return first * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt32BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 4);\n\n return first * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readUInt24BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n return first * 2 ** 16 + buf[++offset] * 2 ** 8 + last;\n}\n\nfunction readUInt16BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 2);\n\n return first * 2 ** 8 + last;\n}\n\nfunction readIntLE(offset, byteLength) {\n if (offset === undefined)\n throw new ERR_INVALID_ARG_TYPE('offset', 'number', offset);\n if (byteLength === 6)\n return readInt48LE(this, offset);\n if (byteLength === 5)\n return readInt40LE(this, offset);\n if (byteLength === 3)\n return readInt24LE(this, offset);\n if (byteLength === 4)\n return readInt32LE(this, offset);\n if (byteLength === 2)\n return readInt16LE(this, offset);\n if (byteLength === 1)\n return readInt8(this, offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readInt48LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n const val = buf[offset + 4] + last * 2 ** 8;\n return (val | (val & 2 ** 15) * 0x1fffe) * 2 ** 32 +\n first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24;\n}\n\nfunction readInt40LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return (last | (last & 2 ** 7) * 0x1fffffe) * 2 ** 32 +\n first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 24;\n}\n\nfunction readInt32LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 4);\n\n return first +\n buf[++offset] * 2 ** 8 +\n buf[++offset] * 2 ** 16 +\n (last << 24);\n}\n\nfunction readInt24LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n const val = first + buf[++offset] * 2 ** 8 + last * 2 ** 16;\n return val | (val & 2 ** 23) * 0x1fe;\n}\n\nfunction readInt16LE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 2);\n\n const val = first + last * 2 ** 8;\n return val | (val & 2 ** 15) * 0x1fffe;\n}\n\nfunction readInt8(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const val = buf[offset];\n if (val === undefined)\n boundsError(offset, buf.length - 1);\n\n return val | (val & 2 ** 7) * 0x1fffffe;\n}\n\nfunction readIntBE(offset, byteLength) {\n if (offset === undefined)\n throw new ERR_INVALID_ARG_TYPE('offset', 'number', offset);\n if (byteLength === 6)\n return readInt48BE(this, offset);\n if (byteLength === 5)\n return readInt40BE(this, offset);\n if (byteLength === 3)\n return readInt24BE(this, offset);\n if (byteLength === 4)\n return readInt32BE(this, offset);\n if (byteLength === 2)\n return readInt16BE(this, offset);\n if (byteLength === 1)\n return readInt8(this, offset);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction readInt48BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 5];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 6);\n\n const val = buf[++offset] + first * 2 ** 8;\n return (val | (val & 2 ** 15) * 0x1fffe) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt40BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 4];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 5);\n\n return (first | (first & 2 ** 7) * 0x1fffffe) * 2 ** 32 +\n buf[++offset] * 2 ** 24 +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt32BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 4);\n\n return (first << 24) +\n buf[++offset] * 2 ** 16 +\n buf[++offset] * 2 ** 8 +\n last;\n}\n\nfunction readInt24BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 2];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 3);\n\n const val = first * 2 ** 16 + buf[++offset] * 2 ** 8 + last;\n return val | (val & 2 ** 23) * 0x1fe;\n}\n\nfunction readInt16BE(buf, offset = 0) {\n validateNumber(offset, 'offset');\n const first = buf[offset];\n const last = buf[offset + 1];\n if (first === undefined || last === undefined)\n boundsError(offset, buf.length - 2);\n\n const val = first * 2 ** 8 + last;\n return val | (val & 2 ** 15) * 0x1fffe;\n}\n\n\nfunction readFloatBackwards(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n uInt8Float32Array[3] = first;\n uInt8Float32Array[2] = this[++offset];\n uInt8Float32Array[1] = this[++offset];\n uInt8Float32Array[0] = last;\n return float32Array[0];\n}\n\nfunction readFloatForwards(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 3];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 4);\n\n uInt8Float32Array[0] = first;\n uInt8Float32Array[1] = this[++offset];\n uInt8Float32Array[2] = this[++offset];\n uInt8Float32Array[3] = last;\n return float32Array[0];\n}\n\nfunction readDoubleBackwards(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n uInt8Float64Array[7] = first;\n uInt8Float64Array[6] = this[++offset];\n uInt8Float64Array[5] = this[++offset];\n uInt8Float64Array[4] = this[++offset];\n uInt8Float64Array[3] = this[++offset];\n uInt8Float64Array[2] = this[++offset];\n uInt8Float64Array[1] = this[++offset];\n uInt8Float64Array[0] = last;\n return float64Array[0];\n}\n\nfunction readDoubleForwards(offset = 0) {\n validateNumber(offset, 'offset');\n const first = this[offset];\n const last = this[offset + 7];\n if (first === undefined || last === undefined)\n boundsError(offset, this.length - 8);\n\n uInt8Float64Array[0] = first;\n uInt8Float64Array[1] = this[++offset];\n uInt8Float64Array[2] = this[++offset];\n uInt8Float64Array[3] = this[++offset];\n uInt8Float64Array[4] = this[++offset];\n uInt8Float64Array[5] = this[++offset];\n uInt8Float64Array[6] = this[++offset];\n uInt8Float64Array[7] = last;\n return float64Array[0];\n}\n\n\nfunction writeBigU_Int64LE(buf, value, offset, min, max) {\n checkInt(value, min, max, buf, offset, 7);\n\n let lo = Number(value & 0xffffffffn);\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n lo = lo >> 8;\n buf[offset++] = lo;\n let hi = Number(value >> 32n & 0xffffffffn);\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n hi = hi >> 8;\n buf[offset++] = hi;\n return offset;\n}\n\nfunction writeBigUInt64LE(value, offset = 0) {\n return writeBigU_Int64LE(this, value, offset, 0n, 0xffffffffffffffffn);\n}\n\nfunction writeBigU_Int64BE(buf, value, offset, min, max) {\n checkInt(value, min, max, buf, offset, 7);\n\n let lo = Number(value & 0xffffffffn);\n buf[offset + 7] = lo;\n lo = lo >> 8;\n buf[offset + 6] = lo;\n lo = lo >> 8;\n buf[offset + 5] = lo;\n lo = lo >> 8;\n buf[offset + 4] = lo;\n let hi = Number(value >> 32n & 0xffffffffn);\n buf[offset + 3] = hi;\n hi = hi >> 8;\n buf[offset + 2] = hi;\n hi = hi >> 8;\n buf[offset + 1] = hi;\n hi = hi >> 8;\n buf[offset] = hi;\n return offset + 8;\n}\n\nfunction writeBigUInt64BE(value, offset = 0) {\n return writeBigU_Int64BE(this, value, offset, 0n, 0xffffffffffffffffn);\n}\n\nfunction writeBigInt64LE(value, offset = 0) {\n return writeBigU_Int64LE(\n this, value, offset, -0x8000000000000000n, 0x7fffffffffffffffn);\n}\n\nfunction writeBigInt64BE(value, offset = 0) {\n return writeBigU_Int64BE(\n this, value, offset, -0x8000000000000000n, 0x7fffffffffffffffn);\n}\n\nfunction writeUIntLE(value, offset, byteLength) {\n if (byteLength === 6)\n return writeU_Int48LE(this, value, offset, 0, 0xffffffffffff);\n if (byteLength === 5)\n return writeU_Int40LE(this, value, offset, 0, 0xffffffffff);\n if (byteLength === 3)\n return writeU_Int24LE(this, value, offset, 0, 0xffffff);\n if (byteLength === 4)\n return writeU_Int32LE(this, value, offset, 0, 0xffffffff);\n if (byteLength === 2)\n return writeU_Int16LE(this, value, offset, 0, 0xffff);\n if (byteLength === 1)\n return writeU_Int8(this, value, offset, 0, 0xff);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeU_Int48LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 5);\n\n const newVal = MathFloor(value * 2 ** -32);\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n buf[offset++] = newVal;\n buf[offset++] = (newVal >>> 8);\n return offset;\n}\n\nfunction writeU_Int40LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 4);\n\n const newVal = value;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n buf[offset++] = MathFloor(newVal * 2 ** -32);\n return offset;\n}\n\nfunction writeU_Int32LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 3);\n\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeUInt32LE(value, offset = 0) {\n return writeU_Int32LE(this, value, offset, 0, 0xffffffff);\n}\n\nfunction writeU_Int24LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 2);\n\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n value = value >>> 8;\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeU_Int16LE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 1);\n\n buf[offset++] = value;\n buf[offset++] = (value >>> 8);\n return offset;\n}\n\nfunction writeUInt16LE(value, offset = 0) {\n return writeU_Int16LE(this, value, offset, 0, 0xffff);\n}\n\nfunction writeU_Int8(buf, value, offset, min, max) {\n value = +value;\n\n validateNumber(offset, 'offset');\n if (value > max || value < min) {\n throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value);\n }\n if (buf[offset] === undefined)\n boundsError(offset, buf.length - 1);\n\n buf[offset] = value;\n return offset + 1;\n}\n\nfunction writeUInt8(value, offset = 0) {\n return writeU_Int8(this, value, offset, 0, 0xff);\n}\n\nfunction writeUIntBE(value, offset, byteLength) {\n if (byteLength === 6)\n return writeU_Int48BE(this, value, offset, 0, 0xffffffffffff);\n if (byteLength === 5)\n return writeU_Int40BE(this, value, offset, 0, 0xffffffffff);\n if (byteLength === 3)\n return writeU_Int24BE(this, value, offset, 0, 0xffffff);\n if (byteLength === 4)\n return writeU_Int32BE(this, value, offset, 0, 0xffffffff);\n if (byteLength === 2)\n return writeU_Int16BE(this, value, offset, 0, 0xffff);\n if (byteLength === 1)\n return writeU_Int8(this, value, offset, 0, 0xff);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeU_Int48BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 5);\n\n const newVal = MathFloor(value * 2 ** -32);\n buf[offset++] = (newVal >>> 8);\n buf[offset++] = newVal;\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeU_Int40BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 4);\n\n buf[offset++] = MathFloor(value * 2 ** -32);\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeU_Int32BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 3);\n\n buf[offset + 3] = value;\n value = value >>> 8;\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 4;\n}\n\nfunction writeUInt32BE(value, offset = 0) {\n return writeU_Int32BE(this, value, offset, 0, 0xffffffff);\n}\n\nfunction writeU_Int24BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 2);\n\n buf[offset + 2] = value;\n value = value >>> 8;\n buf[offset + 1] = value;\n value = value >>> 8;\n buf[offset] = value;\n return offset + 3;\n}\n\nfunction writeU_Int16BE(buf, value, offset, min, max) {\n value = +value;\n checkInt(value, min, max, buf, offset, 1);\n\n buf[offset++] = (value >>> 8);\n buf[offset++] = value;\n return offset;\n}\n\nfunction writeUInt16BE(value, offset = 0) {\n return writeU_Int16BE(this, value, offset, 0, 0xffff);\n}\n\nfunction writeIntLE(value, offset, byteLength) {\n if (byteLength === 6)\n return writeU_Int48LE(this, value, offset, -0x800000000000, 0x7fffffffffff);\n if (byteLength === 5)\n return writeU_Int40LE(this, value, offset, -0x8000000000, 0x7fffffffff);\n if (byteLength === 3)\n return writeU_Int24LE(this, value, offset, -0x800000, 0x7fffff);\n if (byteLength === 4)\n return writeU_Int32LE(this, value, offset, -0x80000000, 0x7fffffff);\n if (byteLength === 2)\n return writeU_Int16LE(this, value, offset, -0x8000, 0x7fff);\n if (byteLength === 1)\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeInt32LE(value, offset = 0) {\n return writeU_Int32LE(this, value, offset, -0x80000000, 0x7fffffff);\n}\n\nfunction writeInt16LE(value, offset = 0) {\n return writeU_Int16LE(this, value, offset, -0x8000, 0x7fff);\n}\n\nfunction writeInt8(value, offset = 0) {\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n}\n\nfunction writeIntBE(value, offset, byteLength) {\n if (byteLength === 6)\n return writeU_Int48BE(this, value, offset, -0x800000000000, 0x7fffffffffff);\n if (byteLength === 5)\n return writeU_Int40BE(this, value, offset, -0x8000000000, 0x7fffffffff);\n if (byteLength === 3)\n return writeU_Int24BE(this, value, offset, -0x800000, 0x7fffff);\n if (byteLength === 4)\n return writeU_Int32BE(this, value, offset, -0x80000000, 0x7fffffff);\n if (byteLength === 2)\n return writeU_Int16BE(this, value, offset, -0x8000, 0x7fff);\n if (byteLength === 1)\n return writeU_Int8(this, value, offset, -0x80, 0x7f);\n\n boundsError(byteLength, 6, 'byteLength');\n}\n\nfunction writeInt32BE(value, offset = 0) {\n return writeU_Int32BE(this, value, offset, -0x80000000, 0x7fffffff);\n}\n\nfunction writeInt16BE(value, offset = 0) {\n return writeU_Int16BE(this, value, offset, -0x8000, 0x7fff);\n}\n\n\nfunction writeDoubleForwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 7);\n\n float64Array[0] = val;\n this[offset++] = uInt8Float64Array[0];\n this[offset++] = uInt8Float64Array[1];\n this[offset++] = uInt8Float64Array[2];\n this[offset++] = uInt8Float64Array[3];\n this[offset++] = uInt8Float64Array[4];\n this[offset++] = uInt8Float64Array[5];\n this[offset++] = uInt8Float64Array[6];\n this[offset++] = uInt8Float64Array[7];\n return offset;\n}\n\nfunction writeDoubleBackwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 7);\n\n float64Array[0] = val;\n this[offset++] = uInt8Float64Array[7];\n this[offset++] = uInt8Float64Array[6];\n this[offset++] = uInt8Float64Array[5];\n this[offset++] = uInt8Float64Array[4];\n this[offset++] = uInt8Float64Array[3];\n this[offset++] = uInt8Float64Array[2];\n this[offset++] = uInt8Float64Array[1];\n this[offset++] = uInt8Float64Array[0];\n return offset;\n}\n\nfunction writeFloatForwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 3);\n\n float32Array[0] = val;\n this[offset++] = uInt8Float32Array[0];\n this[offset++] = uInt8Float32Array[1];\n this[offset++] = uInt8Float32Array[2];\n this[offset++] = uInt8Float32Array[3];\n return offset;\n}\n\nfunction writeFloatBackwards(val, offset = 0) {\n val = +val;\n checkBounds(this, offset, 3);\n\n float32Array[0] = val;\n this[offset++] = uInt8Float32Array[3];\n this[offset++] = uInt8Float32Array[2];\n this[offset++] = uInt8Float32Array[1];\n this[offset++] = uInt8Float32Array[0];\n return offset;\n}\n\nclass FastBuffer extends Uint8Array {}\n\nfunction asciiWrite(buf, string, offset = 0, length) {\n offset = Number(offset);\n if (offset < 0 || offset > buf.byteLength) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');\n }\n if (length === undefined) length = buf.byteLength - offset;\n else length = Number(length);\n if (length < 0 || length > buf.byteLength - offset) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('length');\n }\n return asciiWriteStatic(buf, string, offset, length);\n}\n\nfunction latin1Write(buf, string, offset = 0, length) {\n offset = Number(offset);\n if (offset < 0 || offset > buf.byteLength) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');\n }\n if (length === undefined) length = buf.byteLength - offset;\n else length = Number(length);\n if (length < 0 || length > buf.byteLength - offset) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('length');\n }\n return latin1WriteStatic(buf, string, offset, length);\n}\n\nfunction utf8Write(buf, string, offset = 0, length) {\n offset = Number(offset);\n if (offset < 0 || offset > buf.byteLength) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');\n }\n if (length === undefined) length = buf.byteLength - offset;\n else length = Number(length);\n if (length < 0 || length > buf.byteLength - offset) {\n throw new ERR_BUFFER_OUT_OF_BOUNDS('length');\n }\n return utf8WriteStatic(buf, string, offset, length);\n}\n\nfunction addBufferPrototypeMethods(proto) {\n proto.readBigUInt64LE = readBigUInt64LE;\n proto.readBigUInt64BE = readBigUInt64BE;\n proto.readBigUint64LE = readBigUInt64LE;\n proto.readBigUint64BE = readBigUInt64BE;\n proto.readBigInt64LE = readBigInt64LE;\n proto.readBigInt64BE = readBigInt64BE;\n proto.writeBigUInt64LE = writeBigUInt64LE;\n proto.writeBigUInt64BE = writeBigUInt64BE;\n proto.writeBigUint64LE = writeBigUInt64LE;\n proto.writeBigUint64BE = writeBigUInt64BE;\n proto.writeBigInt64LE = writeBigInt64LE;\n proto.writeBigInt64BE = writeBigInt64BE;\n\n proto.readUIntLE = readUIntLE;\n proto.readUInt32LE = function(offset) { return readUInt32LE(this, offset); };\n proto.readUInt16LE = function(offset) { return readUInt16LE(this, offset); };\n proto.readUInt8 = function(offset) { return readUInt8(this, offset); };\n proto.readUIntBE = readUIntBE;\n proto.readUInt32BE = function(offset) { return readUInt32BE(this, offset); };\n proto.readUInt16BE = function(offset) { return readUInt16BE(this, offset); };\n proto.readUintLE = readUIntLE;\n proto.readUint32LE = proto.readUInt32LE;\n proto.readUint16LE = proto.readUInt16LE;\n proto.readUint8 = proto.readUInt8;\n proto.readUintBE = readUIntBE;\n proto.readUint32BE = proto.readUInt32BE;\n proto.readUint16BE = proto.readUInt16BE;\n proto.readIntLE = readIntLE;\n proto.readInt32LE = function(offset) { return readInt32LE(this, offset); };\n proto.readInt16LE = function(offset) { return readInt16LE(this, offset); };\n proto.readInt8 = function(offset) { return readInt8(this, offset); };\n proto.readIntBE = readIntBE;\n proto.readInt32BE = function(offset) { return readInt32BE(this, offset); };\n proto.readInt16BE = function(offset) { return readInt16BE(this, offset); };\n\n proto.writeUIntLE = writeUIntLE;\n proto.writeUInt32LE = writeUInt32LE;\n proto.writeUInt16LE = writeUInt16LE;\n proto.writeUInt8 = writeUInt8;\n proto.writeUIntBE = writeUIntBE;\n proto.writeUInt32BE = writeUInt32BE;\n proto.writeUInt16BE = writeUInt16BE;\n proto.writeUintLE = writeUIntLE;\n proto.writeUint32LE = writeUInt32LE;\n proto.writeUint16LE = writeUInt16LE;\n proto.writeUint8 = writeUInt8;\n proto.writeUintBE = writeUIntBE;\n proto.writeUint32BE = writeUInt32BE;\n proto.writeUint16BE = writeUInt16BE;\n proto.writeIntLE = writeIntLE;\n proto.writeInt32LE = writeInt32LE;\n proto.writeInt16LE = writeInt16LE;\n proto.writeInt8 = writeInt8;\n proto.writeIntBE = writeIntBE;\n proto.writeInt32BE = writeInt32BE;\n proto.writeInt16BE = writeInt16BE;\n\n proto.readFloatLE = bigEndian ? readFloatBackwards : readFloatForwards;\n proto.readFloatBE = bigEndian ? readFloatForwards : readFloatBackwards;\n proto.readDoubleLE = bigEndian ? readDoubleBackwards : readDoubleForwards;\n proto.readDoubleBE = bigEndian ? readDoubleForwards : readDoubleBackwards;\n proto.writeFloatLE = bigEndian ? writeFloatBackwards : writeFloatForwards;\n proto.writeFloatBE = bigEndian ? writeFloatForwards : writeFloatBackwards;\n proto.writeDoubleLE = bigEndian ? writeDoubleBackwards : writeDoubleForwards;\n proto.writeDoubleBE = bigEndian ? writeDoubleForwards : writeDoubleBackwards;\n\n proto.asciiSlice = function(start, end) { return asciiSlice(this, start, end); };\n proto.base64Slice = function(start, end) { return base64Slice(this, start, end); };\n proto.base64urlSlice = function(start, end) { return base64urlSlice(this, start, end); };\n proto.latin1Slice = function(start, end) { return latin1Slice(this, start, end); };\n proto.hexSlice = function(start, end) { return hexSlice(this, start, end); };\n proto.ucs2Slice = function(start, end) { return ucs2Slice(this, start, end); };\n proto.utf8Slice = function(start, end) { return utf8Slice(this, start, end); };\n proto.asciiWrite = function(string, offset, length) { return asciiWrite(this, string, offset, length); };\n proto.base64Write = function(string, offset, length) { return base64Write(this, string, offset, length); };\n proto.base64urlWrite = function(string, offset, length) { return base64urlWrite(this, string, offset, length); };\n proto.latin1Write = function(string, offset, length) { return latin1Write(this, string, offset, length); };\n proto.hexWrite = function(string, offset, length) { return hexWrite(this, string, offset, length); };\n proto.ucs2Write = function(string, offset, length) { return ucs2Write(this, string, offset, length); };\n proto.utf8Write = function(string, offset, length) { return utf8Write(this, string, offset, length); };\n}\n\nconst kDetachKey = Symbol('detach_key_for_untransferable_arraybuffer');\n\n\nfunction markAsUntransferable(obj) {\n if ((typeof obj !== 'object' && typeof obj !== 'function') || obj === null)\n return;\n obj[untransferable_object_private_symbol] = true;\n\n if (isArrayBuffer(obj)) {\n setDetachKey(obj, kDetachKey);\n }\n}\n\n\n\nfunction isMarkedAsUntransferable(obj) {\n if (obj == null)\n return false;\n\n return obj[untransferable_object_private_symbol] !== undefined;\n}\n\nfunction createUnsafeBuffer(size) {\n if (size <= 64) {\n\n\n return new FastBuffer(size);\n }\n\n return new FastBuffer(createUnsafeArrayBuffer(size));\n}\n\n\n\n\n\nfunction alignmentPadding(alignment) {\n return MathMax(alignment, 8);\n}\n\n\n\n\n\n\n\nfunction createUnsafeAlignedBuffer(size, alignment) {\n if (size === 0) {\n return new FastBuffer();\n }\n\n const ab = createUnsafeArrayBuffer(size + alignmentPadding(alignment));\n return new FastBuffer(ab, arrayBufferAlignedOffset(ab, alignment), size);\n}\n\nmodule.exports = {\n FastBuffer,\n addBufferPrototypeMethods,\n alignmentPadding,\n markAsUntransferable,\n isMarkedAsUntransferable,\n createUnsafeBuffer,\n createUnsafeAlignedBuffer,\n readUInt16BE,\n readUInt32BE,\n asciiWrite,\n latin1Write,\n utf8Write,\n};\n","internal/console/constructor.js":"'use strict';\n\n\n\n\nconst {\n ArrayFrom,\n ArrayIsArray,\n ArrayPrototypeForEach,\n ArrayPrototypePush,\n ArrayPrototypeUnshift,\n Boolean,\n ErrorCaptureStackTrace,\n FunctionPrototypeBind,\n MapPrototypeGet,\n MapPrototypeValues,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectKeys,\n ObjectPrototypeHasOwnProperty,\n ObjectValues,\n ReflectApply,\n ReflectConstruct,\n ReflectOwnKeys,\n RegExpPrototypeSymbolReplace,\n SafeArrayIterator,\n SafeMap,\n SafeSet,\n SafeWeakMap,\n StringPrototypeIncludes,\n StringPrototypeRepeat,\n StringPrototypeSlice,\n Symbol,\n SymbolHasInstance,\n SymbolToStringTag,\n} = primordials;\n\nconst { trace, nodeTraceEventCategory, kTraceCount } = require('internal/trace_events');\nconst {\n codes: {\n ERR_CONSOLE_WRITABLE_STREAM,\n ERR_INCOMPATIBLE_OPTION_PAIR,\n },\n isStackOverflowError,\n} = require('internal/errors');\nconst {\n validateArray,\n validateInteger,\n validateObject,\n validateOneOf,\n} = require('internal/validators');\nconst { previewEntries } = internalBinding('util');\nconst { Buffer: { isBuffer } } = require('buffer');\nconst { assignFunctionName } = require('internal/util');\nconst {\n inspect,\n formatWithOptions,\n} = require('internal/util/inspect');\nconst {\n isTypedArray, isSet, isMap, isSetIterator, isMapIterator,\n} = require('internal/util/types');\nconst kCounts = Symbol('counts');\nconst { time, timeLog, timeEnd, kNone } = require('internal/util/debuglog');\nconst { channel } = require('diagnostics_channel');\n\nconst onLog = channel('console.log');\nconst onWarn = channel('console.warn');\nconst onError = channel('console.error');\nconst onInfo = channel('console.info');\nconst onDebug = channel('console.debug');\n\nconst kTraceConsoleCategory = nodeTraceEventCategory('node.console');\n\nconst kMaxGroupIndentation = 1000;\n\n\nlet cliTable;\n\nlet utilColors;\nfunction lazyUtilColors() {\n utilColors ??= require('internal/util/colors');\n return utilColors;\n}\n\n\nconst kGroupIndentationWidth = Symbol('kGroupIndentWidth');\nconst kFormatForStderr = Symbol('kFormatForStderr');\nconst kFormatForStdout = Symbol('kFormatForStdout');\nconst kGetInspectOptions = Symbol('kGetInspectOptions');\nconst kColorMode = Symbol('kColorMode');\nconst kIsConsole = Symbol('kIsConsole');\nconst kWriteToConsole = Symbol('kWriteToConsole');\nconst kBindProperties = Symbol('kBindProperties');\nconst kBindStreamsEager = Symbol('kBindStreamsEager');\nconst kBindStreamsLazy = Symbol('kBindStreamsLazy');\nconst kUseStdout = Symbol('kUseStdout');\nconst kUseStderr = Symbol('kUseStderr');\n\nconst optionsMap = new SafeWeakMap();\nfunction Console(options ) {\n\n\n\n if (new.target === undefined) {\n return ReflectConstruct(Console, arguments);\n }\n\n if (!options || typeof options.write === 'function') {\n options = {\n stdout: options,\n stderr: arguments[1],\n ignoreErrors: arguments[2],\n };\n }\n\n const {\n stdout,\n stderr = stdout,\n ignoreErrors = true,\n colorMode = 'auto',\n inspectOptions,\n groupIndentation,\n } = options;\n\n if (!stdout || typeof stdout.write !== 'function') {\n throw new ERR_CONSOLE_WRITABLE_STREAM('stdout');\n }\n if (!stderr || typeof stderr.write !== 'function') {\n throw new ERR_CONSOLE_WRITABLE_STREAM('stderr');\n }\n\n validateOneOf(colorMode, 'colorMode', ['auto', true, false]);\n\n if (groupIndentation !== undefined) {\n validateInteger(groupIndentation, 'groupIndentation',\n 0, kMaxGroupIndentation);\n }\n\n if (inspectOptions !== undefined) {\n validateObject(inspectOptions, 'options.inspectOptions');\n\n const inspectOptionsMap = isMap(inspectOptions) ?\n inspectOptions : new SafeMap([\n [stdout, inspectOptions],\n [stderr, inspectOptions],\n ]);\n\n for (const inspectOptions of MapPrototypeValues(inspectOptionsMap)) {\n if (inspectOptions.colors !== undefined &&\n options.colorMode !== undefined) {\n throw new ERR_INCOMPATIBLE_OPTION_PAIR(\n 'options.inspectOptions.color', 'colorMode');\n }\n }\n optionsMap.set(this, inspectOptionsMap);\n }\n\n\n ArrayPrototypeForEach(ObjectKeys(Console.prototype), (key) => {\n\n\n\n this[key] = FunctionPrototypeBind(this[key], this);\n ObjectDefineProperty(this[key], 'name', {\n __proto__: null,\n value: key,\n });\n });\n\n this[kBindStreamsEager](stdout, stderr);\n this[kBindProperties](ignoreErrors, colorMode, groupIndentation);\n}\n\nconst consolePropAttributes = {\n writable: true,\n enumerable: false,\n configurable: true,\n};\n\n\nObjectDefineProperty(Console, SymbolHasInstance, {\n __proto__: null,\n value: assignFunctionName(SymbolHasInstance, function(instance) {\n return instance[kIsConsole];\n }),\n});\n\nconst kColorInspectOptions = { colors: true };\nconst kNoColorInspectOptions = {};\n\nconst kGroupIndentationString = Symbol('kGroupIndentationString');\n\nObjectDefineProperties(Console.prototype, {\n [kBindStreamsEager]: {\n __proto__: null,\n ...consolePropAttributes,\n\n value: assignFunctionName(kBindStreamsEager, function(stdout, stderr) {\n ObjectDefineProperties(this, {\n '_stdout': { __proto__: null, ...consolePropAttributes, value: stdout },\n '_stderr': { __proto__: null, ...consolePropAttributes, value: stderr },\n });\n }),\n },\n [kBindStreamsLazy]: {\n __proto__: null,\n ...consolePropAttributes,\n\n\n value: assignFunctionName(kBindStreamsLazy, function(object) {\n let stdout;\n let stderr;\n ObjectDefineProperties(this, {\n '_stdout': {\n __proto__: null,\n enumerable: false,\n configurable: true,\n get() {\n return stdout ||= object.stdout;\n },\n set(value) { stdout = value; },\n },\n '_stderr': {\n __proto__: null,\n enumerable: false,\n configurable: true,\n get() {\n return stderr ||= object.stderr;\n },\n set(value) { stderr = value; },\n },\n });\n }),\n },\n [kBindProperties]: {\n __proto__: null,\n ...consolePropAttributes,\n value: assignFunctionName(kBindProperties, function(ignoreErrors, colorMode, groupIndentation = 2) {\n ObjectDefineProperties(this, {\n '_stdoutErrorHandler': {\n __proto__: null,\n ...consolePropAttributes,\n value: createWriteErrorHandler(this, kUseStdout),\n },\n '_stderrErrorHandler': {\n ...consolePropAttributes,\n __proto__: null,\n value: createWriteErrorHandler(this, kUseStderr),\n },\n '_ignoreErrors': {\n __proto__: null,\n ...consolePropAttributes,\n value: Boolean(ignoreErrors),\n },\n '_times': { __proto__: null, ...consolePropAttributes, value: new SafeMap() },\n\n [kCounts]: { __proto__: null, ...consolePropAttributes, value: new SafeMap() },\n [kColorMode]: { __proto__: null, ...consolePropAttributes, value: colorMode },\n [kIsConsole]: { __proto__: null, ...consolePropAttributes, value: true },\n [kGroupIndentationWidth]: {\n __proto__: null,\n ...consolePropAttributes,\n value: groupIndentation,\n },\n [kGroupIndentationString]: {\n __proto__: null,\n ...consolePropAttributes,\n value: '',\n },\n [SymbolToStringTag]: {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'console',\n },\n });\n }),\n },\n [kWriteToConsole]: {\n __proto__: null,\n ...consolePropAttributes,\n value: assignFunctionName(kWriteToConsole, function(streamSymbol, string) {\n const ignoreErrors = this._ignoreErrors;\n const groupIndent = this[kGroupIndentationString];\n\n const useStdout = streamSymbol === kUseStdout;\n const stream = useStdout ? this._stdout : this._stderr;\n const errorHandler = useStdout ?\n this._stdoutErrorHandler : this._stderrErrorHandler;\n\n if (groupIndent.length !== 0) {\n if (StringPrototypeIncludes(string, '\\n')) {\n string = RegExpPrototypeSymbolReplace(/\\n/g, string, `\\n${groupIndent}`);\n }\n string = groupIndent + string;\n }\n string += '\\n';\n\n if (ignoreErrors === false) return stream.write(string);\n\n\n\n\n try {\n\n\n if (stream.listenerCount('error') === 0)\n stream.once('error', noop);\n\n stream.write(string, errorHandler);\n } catch (e) {\n\n\n if (isStackOverflowError(e))\n throw e;\n\n } finally {\n stream.removeListener('error', noop);\n }\n }),\n },\n [kGetInspectOptions]: {\n __proto__: null,\n ...consolePropAttributes,\n value: assignFunctionName(kGetInspectOptions, function(stream) {\n let color = this[kColorMode];\n if (color === 'auto') {\n color = lazyUtilColors().shouldColorize(stream);\n }\n\n const inspectOptionsMap = optionsMap.get(this);\n const options = inspectOptionsMap ? MapPrototypeGet(inspectOptionsMap, stream) : undefined;\n if (options) {\n if (options.colors === undefined) {\n options.colors = color;\n }\n return options;\n }\n\n return color ? kColorInspectOptions : kNoColorInspectOptions;\n }),\n },\n [kFormatForStdout]: {\n __proto__: null,\n ...consolePropAttributes,\n value: assignFunctionName(kFormatForStdout, function(args) {\n if (args.length === 1) {\n\n\n const a0 = args[0];\n if (typeof a0 === 'string') {\n return a0;\n }\n }\n const opts = this[kGetInspectOptions](this._stdout);\n ArrayPrototypeUnshift(args, opts);\n return ReflectApply(formatWithOptions, null, args);\n }),\n },\n [kFormatForStderr]: {\n __proto__: null,\n ...consolePropAttributes,\n value: assignFunctionName(kFormatForStderr, function(args) {\n if (args.length === 1) {\n\n\n const a0 = args[0];\n if (typeof a0 === 'string') {\n return a0;\n }\n }\n const opts = this[kGetInspectOptions](this._stderr);\n ArrayPrototypeUnshift(args, opts);\n return ReflectApply(formatWithOptions, null, args);\n }),\n },\n});\n\n\nfunction createWriteErrorHandler(instance, streamSymbol) {\n return (err) => {\n\n\n\n const stream = streamSymbol === kUseStdout ?\n instance._stdout : instance._stderr;\n if (err !== null && !stream._writableState.errorEmitted) {\n\n\n\n\n\n if (stream.listenerCount('error') === 0) {\n stream.once('error', noop);\n }\n }\n };\n}\n\nfunction timeLogImpl(consoleRef, label, formatted, args) {\n if (args === undefined) {\n consoleRef.log('%s: %s', label, formatted);\n } else {\n consoleRef.log('%s: %s', label, formatted, ...new SafeArrayIterator(args));\n }\n}\n\nconst consoleMethods = {\n log(...args) {\n if (onLog.hasSubscribers) {\n onLog.publish(args);\n }\n this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));\n },\n\n info(...args) {\n if (onInfo.hasSubscribers) {\n onInfo.publish(args);\n }\n this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));\n },\n\n debug(...args) {\n if (onDebug.hasSubscribers) {\n onDebug.publish(args);\n }\n this[kWriteToConsole](kUseStdout, this[kFormatForStdout](args));\n },\n\n warn(...args) {\n if (onWarn.hasSubscribers) {\n onWarn.publish(args);\n }\n this[kWriteToConsole](kUseStderr, this[kFormatForStderr](args));\n },\n\n error(...args) {\n if (onError.hasSubscribers) {\n onError.publish(args);\n }\n this[kWriteToConsole](kUseStderr, this[kFormatForStderr](args));\n },\n\n dir(object, options) {\n this[kWriteToConsole](kUseStdout, inspect(object, {\n customInspect: false,\n ...this[kGetInspectOptions](this._stdout),\n ...options,\n }));\n },\n\n time(label = 'default') {\n time(this._times, kTraceConsoleCategory, 'console.time()', kNone, label, `time::${label}`);\n },\n\n timeEnd(label = 'default') {\n timeEnd(this._times, kTraceConsoleCategory, 'console.timeEnd()', kNone, (label, formatted, args) => timeLogImpl(this, label, formatted, args), label, `time::${label}`);\n },\n\n timeLog(label = 'default', ...data) {\n timeLog(this._times, kTraceConsoleCategory, 'console.timeLog()', kNone, (label, formatted, args) => timeLogImpl(this, label, formatted, args), label, `time::${label}`, data);\n },\n\n trace: function trace(...args) {\n const err = {\n name: 'Trace',\n message: this[kFormatForStderr](args),\n };\n ErrorCaptureStackTrace(err, trace);\n this.error(err.stack);\n },\n\n\n assert(expression, ...args) {\n if (!expression) {\n if (args.length && typeof args[0] === 'string') {\n args[0] = `Assertion failed: ${args[0]}`;\n } else {\n ArrayPrototypeUnshift(args, 'Assertion failed');\n }\n\n ReflectApply(this.warn, this, args);\n }\n },\n\n\n clear() {\n\n\n if (this._stdout.isTTY && process.env.TERM !== 'dumb') {\n\n\n const {\n cursorTo,\n clearScreenDown,\n } = require('internal/readline/callbacks');\n cursorTo(this._stdout, 0, 0);\n clearScreenDown(this._stdout);\n }\n },\n\n\n count(label = 'default') {\n\n\n label = `${label}`;\n const counts = this[kCounts];\n let count = counts.get(label);\n if (count === undefined)\n count = 1;\n else\n count++;\n counts.set(label, count);\n trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, count);\n this.log(`${label}: ${count}`);\n },\n\n\n countReset(label = 'default') {\n const counts = this[kCounts];\n if (!counts.has(label)) {\n process.emitWarning(`Count for '${label}' does not exist`);\n return;\n }\n trace(kTraceCount, kTraceConsoleCategory, `count::${label}`, 0, 0);\n counts.delete(`${label}`);\n },\n\n group(...data) {\n if (data.length > 0) {\n ReflectApply(this.log, this, data);\n }\n\n let currentIndentation = this[kGroupIndentationString];\n currentIndentation += StringPrototypeRepeat(' ', this[kGroupIndentationWidth]);\n this[kGroupIndentationString] = currentIndentation;\n },\n\n groupEnd() {\n const currentIndentation = this[kGroupIndentationString];\n const newIndentation = StringPrototypeSlice(\n currentIndentation,\n 0,\n currentIndentation.length - this[kGroupIndentationWidth],\n );\n\n this[kGroupIndentationString] = newIndentation;\n },\n\n\n table(tabularData, properties) {\n if (properties !== undefined)\n validateArray(properties, 'properties');\n\n if (tabularData === null || typeof tabularData !== 'object')\n return this.log(tabularData);\n\n cliTable ??= require('internal/cli_table');\n const final = (k, v) => this.log(cliTable(k, v));\n\n const _inspect = (v) => {\n const depth = v !== null &&\n typeof v === 'object' &&\n !isArray(v) &&\n ObjectKeys(v).length > 2 ? -1 : 0;\n const opt = {\n depth,\n maxArrayLength: 3,\n breakLength: Infinity,\n ...this[kGetInspectOptions](this._stdout),\n };\n return inspect(v, opt);\n };\n const getIndexArray = (length) => ArrayFrom(\n { length }, (_, i) => _inspect(i));\n\n const mapIter = isMapIterator(tabularData);\n let isKeyValue = false;\n let i = 0;\n if (mapIter) {\n const res = previewEntries(tabularData, true);\n tabularData = res[0];\n isKeyValue = res[1];\n }\n\n if (isKeyValue || isMap(tabularData)) {\n const keys = [];\n const values = [];\n let length = 0;\n if (mapIter) {\n for (; i < tabularData.length / 2; ++i) {\n ArrayPrototypePush(keys, _inspect(tabularData[i * 2]));\n ArrayPrototypePush(values, _inspect(tabularData[i * 2 + 1]));\n length++;\n }\n } else {\n for (const { 0: k, 1: v } of tabularData) {\n ArrayPrototypePush(keys, _inspect(k));\n ArrayPrototypePush(values, _inspect(v));\n length++;\n }\n }\n return final([\n iterKey, keyKey, valuesKey,\n ], [\n getIndexArray(length),\n keys,\n values,\n ]);\n }\n\n const setIter = isSetIterator(tabularData);\n if (setIter)\n tabularData = previewEntries(tabularData);\n\n const setlike = setIter || mapIter || isSet(tabularData);\n if (setlike) {\n const values = [];\n let length = 0;\n for (const v of tabularData) {\n ArrayPrototypePush(values, _inspect(v));\n length++;\n }\n return final([iterKey, valuesKey], [getIndexArray(length), values]);\n }\n\n const map = { __proto__: null };\n let hasPrimitives = false;\n const valuesKeyArray = [];\n const indexKeyArray = ObjectKeys(tabularData);\n\n for (; i < indexKeyArray.length; i++) {\n const item = tabularData[indexKeyArray[i]];\n const primitive = item === null ||\n (typeof item !== 'function' && typeof item !== 'object');\n if (properties === undefined && primitive) {\n hasPrimitives = true;\n valuesKeyArray[i] = _inspect(item);\n } else {\n const keys = properties || ObjectKeys(item);\n for (const key of keys) {\n map[key] ??= [];\n if ((primitive && properties) ||\n !ObjectPrototypeHasOwnProperty(item, key))\n map[key][i] = '';\n else\n map[key][i] = _inspect(item[key]);\n }\n }\n }\n\n const keys = ObjectKeys(map);\n const values = ObjectValues(map);\n if (hasPrimitives) {\n ArrayPrototypePush(keys, valuesKey);\n ArrayPrototypePush(values, valuesKeyArray);\n }\n ArrayPrototypeUnshift(keys, indexKey);\n ArrayPrototypeUnshift(values, indexKeyArray);\n\n return final(keys, values);\n },\n};\n\nconst keyKey = 'Key';\nconst valuesKey = 'Values';\nconst indexKey = '(index)';\nconst iterKey = '(iteration index)';\n\nconst isArray = (v) => ArrayIsArray(v) || isTypedArray(v) || isBuffer(v);\n\nfunction noop() {}\n\nfor (const method of ReflectOwnKeys(consoleMethods))\n Console.prototype[method] = consoleMethods[method];\n\nConsole.prototype.dirxml = Console.prototype.log;\nConsole.prototype.groupCollapsed = Console.prototype.group;\n\nfunction initializeGlobalConsole(globalConsole) {\n globalConsole[kBindStreamsLazy](process);\n const {\n namespace: {\n addSerializeCallback,\n isBuildingSnapshot,\n },\n } = require('internal/v8/startup_snapshot');\n\n if (!internalBinding('config').hasInspector || !isBuildingSnapshot()) {\n return;\n }\n const { console: consoleFromVM } = internalBinding('inspector');\n const nodeConsoleKeys = ObjectKeys(Console.prototype);\n const vmConsoleKeys = ObjectKeys(consoleFromVM);\n const originalKeys = new SafeSet(vmConsoleKeys.concat(nodeConsoleKeys));\n const inspectorConsoleKeys = new SafeSet();\n for (const key of ObjectKeys(globalConsole)) {\n if (!originalKeys.has(key)) {\n inspectorConsoleKeys.add(key);\n }\n }\n\n\n addSerializeCallback(() => {\n for (const key of inspectorConsoleKeys) {\n globalConsole[key] = undefined;\n }\n });\n}\n\nmodule.exports = {\n Console,\n kBindStreamsLazy,\n kBindProperties,\n initializeGlobalConsole,\n};\n","internal/console/global.js":"'use strict';\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n FunctionPrototypeBind,\n ReflectDefineProperty,\n ReflectGetOwnPropertyDescriptor,\n ReflectOwnKeys,\n} = primordials;\n\nconst {\n Console,\n kBindProperties,\n} = require('internal/console/constructor');\n\nconst globalConsole = { __proto__: {} };\n\n\n\n\n\n\nfor (const prop of ReflectOwnKeys(Console.prototype)) {\n if (prop === 'constructor') { continue; }\n const desc = ReflectGetOwnPropertyDescriptor(Console.prototype, prop);\n if (typeof desc.value === 'function') {\n const name = desc.value.name;\n desc.value = FunctionPrototypeBind(desc.value, globalConsole);\n ReflectDefineProperty(desc.value, 'name', { __proto__: null, value: name });\n }\n ReflectDefineProperty(globalConsole, prop, desc);\n}\n\nglobalConsole[kBindProperties](true, 'auto');\n\n\n\nglobalConsole.Console = Console;\n\nmodule.exports = globalConsole;\n","internal/constants.js":"'use strict';\n\nconst isWindows = process.platform === 'win32';\n\nmodule.exports = {\n\n CHAR_UPPERCASE_A: 65,\n CHAR_LOWERCASE_A: 97,\n CHAR_UPPERCASE_Z: 90,\n CHAR_LOWERCASE_Z: 122,\n CHAR_UPPERCASE_C: 67,\n CHAR_UPPERCASE_B: 66,\n CHAR_LOWERCASE_B: 98,\n CHAR_UPPERCASE_E: 69,\n CHAR_LOWERCASE_E: 101,\n CHAR_LOWERCASE_N: 110,\n\n\n CHAR_DOT: 46,\n CHAR_FORWARD_SLASH: 47,\n CHAR_BACKWARD_SLASH: 92,\n CHAR_VERTICAL_LINE: 124,\n CHAR_COLON: 58,\n CHAR_QUESTION_MARK: 63,\n CHAR_UNDERSCORE: 95,\n CHAR_LINE_FEED: 10,\n CHAR_CARRIAGE_RETURN: 13,\n CHAR_TAB: 9,\n CHAR_FORM_FEED: 12,\n CHAR_EXCLAMATION_MARK: 33,\n CHAR_HASH: 35,\n CHAR_SPACE: 32,\n CHAR_NO_BREAK_SPACE: 160,\n CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,\n CHAR_LEFT_SQUARE_BRACKET: 91,\n CHAR_RIGHT_SQUARE_BRACKET: 93,\n CHAR_LEFT_ANGLE_BRACKET: 60,\n CHAR_RIGHT_ANGLE_BRACKET: 62,\n CHAR_LEFT_CURLY_BRACKET: 123,\n CHAR_RIGHT_CURLY_BRACKET: 125,\n CHAR_HYPHEN_MINUS: 45,\n CHAR_PLUS: 43,\n CHAR_DOUBLE_QUOTE: 34,\n CHAR_SINGLE_QUOTE: 39,\n CHAR_PERCENT: 37,\n CHAR_SEMICOLON: 59,\n CHAR_CIRCUMFLEX_ACCENT: 94,\n CHAR_GRAVE_ACCENT: 96,\n CHAR_AT: 64,\n CHAR_AMPERSAND: 38,\n CHAR_EQUAL: 61,\n\n\n CHAR_0: 48,\n CHAR_9: 57,\n\n EOL: isWindows ? '\\r\\n' : '\\n',\n};\n","internal/event_target.js":"'use strict';\n\nconst {\n ArrayFrom,\n ArrayPrototypeReduce,\n Boolean,\n Error,\n FunctionPrototypeCall,\n NumberIsInteger,\n ObjectAssign,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectGetOwnPropertyDescriptor,\n ReflectApply,\n SafeFinalizationRegistry,\n SafeMap,\n SafeSet,\n SafeWeakMap,\n SafeWeakRef,\n SafeWeakSet,\n String,\n Symbol,\n SymbolFor,\n SymbolToStringTag,\n} = primordials;\n\nconst {\n codes: {\n ERR_EVENT_RECURSION,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_THIS,\n ERR_MISSING_ARGS,\n },\n} = require('internal/errors');\nconst {\n validateAbortSignal,\n validateObject,\n validateString,\n validateThisInternalField,\n kValidateObjectAllowObjects,\n} = require('internal/validators');\n\nconst {\n customInspectSymbol,\n kEmptyObject,\n kEnumerableProperty,\n} = require('internal/util');\nconst { inspect } = require('util');\nconst webidl = require('internal/webidl');\n\nconst kIsEventTarget = SymbolFor('nodejs.event_target');\nconst kIsNodeEventTarget = Symbol('kIsNodeEventTarget');\n\nconst EventEmitter = require('events');\nconst {\n kMaxEventTargetListeners,\n kMaxEventTargetListenersWarned,\n} = EventEmitter;\n\nconst kEvents = Symbol('kEvents');\nconst kIsBeingDispatched = Symbol('kIsBeingDispatched');\nconst kStop = Symbol('kStop');\nconst kTarget = Symbol('kTarget');\nconst kHandlers = Symbol('kHandlers');\nconst kWeakHandler = Symbol('kWeak');\nconst kResistStopPropagation = Symbol('kResistStopPropagation');\n\nconst kHybridDispatch = SymbolFor('nodejs.internal.kHybridDispatch');\nconst kRemoveWeakListenerHelper = Symbol('kRemoveWeakListenerHelper');\nconst kCreateEvent = Symbol('kCreateEvent');\nconst kNewListener = Symbol('kNewListener');\nconst kRemoveListener = Symbol('kRemoveListener');\nconst kIsNodeStyleListener = Symbol('kIsNodeStyleListener');\nconst kTrustEvent = Symbol('kTrustEvent');\n\nconst { now } = require('internal/perf/utils');\n\nconst kType = Symbol('type');\nconst kDetail = Symbol('detail');\nconst kInPassiveListener = Symbol('kInPassiveListener');\n\nconst isTrustedSet = new SafeWeakSet();\nconst isTrusted = ObjectGetOwnPropertyDescriptor({\n get isTrusted() {\n return isTrustedSet.has(this);\n },\n}, 'isTrusted').get;\n\nconst isTrustedDescriptor = {\n __proto__: null,\n configurable: false,\n enumerable: true,\n get: isTrusted,\n};\n\nfunction isEvent(value) {\n return typeof value?.[kType] === 'string';\n}\n\nclass Event {\n #cancelable = false;\n #bubbles = false;\n #composed = false;\n #defaultPrevented = false;\n #timestamp = now();\n #propagationStopped = false;\n\n\n\n\n\n\n\n\n\n constructor(type, options = undefined) {\n if (arguments.length === 0)\n throw new ERR_MISSING_ARGS('type');\n if (options != null)\n validateObject(options, 'options');\n this.#bubbles = !!options?.bubbles;\n this.#cancelable = !!options?.cancelable;\n this.#composed = !!options?.composed;\n\n this[kType] = `${type}`;\n if (options?.[kTrustEvent]) {\n isTrustedSet.add(this);\n }\n\n this[kTarget] = null;\n this[kIsBeingDispatched] = false;\n this[kInPassiveListener] = false;\n }\n\n\n\n\n\n\n initEvent(type, bubbles = false, cancelable = false) {\n if (arguments.length === 0)\n throw new ERR_MISSING_ARGS('type');\n\n if (this[kIsBeingDispatched]) {\n return;\n }\n this[kType] = `${type}`;\n this.#bubbles = !!bubbles;\n this.#cancelable = !!cancelable;\n }\n\n [customInspectSymbol](depth, options) {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n const name = this.constructor.name;\n if (depth < 0)\n return name;\n\n const opts = ObjectAssign({}, options, {\n depth: NumberIsInteger(options.depth) ? options.depth - 1 : options.depth,\n });\n\n return `${name} ${inspect({\n type: this[kType],\n defaultPrevented: this.#defaultPrevented,\n cancelable: this.#cancelable,\n timeStamp: this.#timestamp,\n }, opts)}`;\n }\n\n stopImmediatePropagation() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n\n\n\n this.stopPropagation();\n this[kStop] = true;\n }\n\n preventDefault() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n if (!this.#cancelable || this[kInPassiveListener]) return;\n this.#defaultPrevented = true;\n }\n\n\n\n\n get target() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kTarget];\n }\n\n\n\n\n get currentTarget() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kIsBeingDispatched] ? this[kTarget] : null;\n }\n\n\n\n\n get srcElement() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kTarget];\n }\n\n\n\n\n get type() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kType];\n }\n\n\n\n\n get cancelable() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#cancelable;\n }\n\n\n\n\n get defaultPrevented() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#cancelable && this.#defaultPrevented;\n }\n\n\n\n\n get timeStamp() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#timestamp;\n }\n\n\n\n\n\n\n\n\n composedPath() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kIsBeingDispatched] ? [this[kTarget]] : [];\n }\n\n\n\n\n get returnValue() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return !this.#cancelable || !this.#defaultPrevented;\n }\n\n\n\n\n set returnValue(value) {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n\n if (!value) {\n if (!this.#cancelable || this[kInPassiveListener]) return;\n this.#defaultPrevented = true;\n }\n }\n\n\n\n\n get bubbles() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#bubbles;\n }\n\n\n\n\n get composed() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#composed;\n }\n\n\n\n\n get eventPhase() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this[kIsBeingDispatched] ? Event.AT_TARGET : Event.NONE;\n }\n\n\n\n\n get cancelBubble() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n return this.#propagationStopped;\n }\n\n\n\n\n set cancelBubble(value) {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n if (value) {\n this.#propagationStopped = true;\n }\n }\n\n stopPropagation() {\n if (!isEvent(this))\n throw new ERR_INVALID_THIS('Event');\n this.#propagationStopped = true;\n }\n}\n\nObjectDefineProperties(\n Event.prototype, {\n [SymbolToStringTag]: {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'Event',\n },\n initEvent: kEnumerableProperty,\n stopImmediatePropagation: kEnumerableProperty,\n preventDefault: kEnumerableProperty,\n target: kEnumerableProperty,\n currentTarget: kEnumerableProperty,\n srcElement: kEnumerableProperty,\n type: kEnumerableProperty,\n cancelable: kEnumerableProperty,\n defaultPrevented: kEnumerableProperty,\n timeStamp: kEnumerableProperty,\n composedPath: kEnumerableProperty,\n returnValue: kEnumerableProperty,\n bubbles: kEnumerableProperty,\n composed: kEnumerableProperty,\n eventPhase: kEnumerableProperty,\n cancelBubble: kEnumerableProperty,\n stopPropagation: kEnumerableProperty,\n\n\n\n\n isTrusted: isTrustedDescriptor,\n });\n\nconst staticProps = ['NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE'];\n\nObjectDefineProperties(\n Event,\n ArrayPrototypeReduce(staticProps, (result, staticProp, index = 0) => {\n result[staticProp] = {\n __proto__: null,\n writable: false,\n configurable: false,\n enumerable: true,\n value: index,\n };\n return result;\n }, {}),\n);\n\nfunction isCustomEvent(value) {\n return isEvent(value) && (value?.[kDetail] !== undefined);\n}\n\nclass CustomEvent extends Event {\n\n\n\n\n\n\n\n\n\n constructor(type, options = kEmptyObject) {\n if (arguments.length === 0)\n throw new ERR_MISSING_ARGS('type');\n super(type, options);\n this[kDetail] = options?.detail ?? null;\n }\n\n\n\n\n get detail() {\n if (!isCustomEvent(this))\n throw new ERR_INVALID_THIS('CustomEvent');\n return this[kDetail];\n }\n}\n\nObjectDefineProperties(CustomEvent.prototype, {\n [SymbolToStringTag]: {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'CustomEvent',\n },\n detail: kEnumerableProperty,\n});\n\n\n\nlet weakListenersState = null;\n\n\nlet objectToWeakListenerMap = null;\nfunction weakListeners() {\n weakListenersState ??= new SafeFinalizationRegistry(\n ({ eventTarget, listener, eventType }) => eventTarget.deref()?.[kRemoveWeakListenerHelper](eventType, listener),\n );\n objectToWeakListenerMap ??= new SafeWeakMap();\n return { registry: weakListenersState, map: objectToWeakListenerMap };\n}\n\nconst kFlagOnce = 1 << 0;\nconst kFlagCapture = 1 << 1;\nconst kFlagPassive = 1 << 2;\nconst kFlagNodeStyle = 1 << 3;\nconst kFlagWeak = 1 << 4;\nconst kFlagRemoved = 1 << 5;\nconst kFlagResistStopPropagation = 1 << 6;\n\n\n\n\n\n\n\n\nclass Listener {\n constructor(eventTarget, eventType, previous, listener, once, capture, passive,\n isNodeStyleListener, weak, resistStopPropagation) {\n this.next = undefined;\n if (previous !== undefined)\n previous.next = this;\n this.previous = previous;\n this.listener = listener;\n\n let flags = 0b0;\n if (once)\n flags |= kFlagOnce;\n if (capture)\n flags |= kFlagCapture;\n if (passive)\n flags |= kFlagPassive;\n if (isNodeStyleListener)\n flags |= kFlagNodeStyle;\n if (weak)\n flags |= kFlagWeak;\n if (resistStopPropagation)\n flags |= kFlagResistStopPropagation;\n this.flags = flags;\n\n this.removed = false;\n\n if (this.weak) {\n this.callback = new SafeWeakRef(listener);\n weakListeners().registry.register(listener, {\n __proto__: null,\n\n eventTarget: new SafeWeakRef(eventTarget),\n listener: this,\n eventType,\n }, this);\n\n\n\n\n this.weakKeyRef = new SafeWeakRef(weak);\n let retained = weakListeners().map.get(weak);\n if (retained === undefined) {\n retained = new SafeSet();\n weakListeners().map.set(weak, retained);\n }\n retained.add(listener);\n this.listener = this.callback;\n } else if (typeof listener === 'function') {\n this.callback = listener;\n this.listener = listener;\n } else {\n this.callback = async (...args) => {\n if (listener.handleEvent)\n await ReflectApply(listener.handleEvent, listener, args);\n };\n this.listener = listener;\n }\n }\n\n get once() {\n return Boolean(this.flags & kFlagOnce);\n }\n get capture() {\n return Boolean(this.flags & kFlagCapture);\n }\n get passive() {\n return Boolean(this.flags & kFlagPassive);\n }\n get isNodeStyleListener() {\n return Boolean(this.flags & kFlagNodeStyle);\n }\n get weak() {\n return Boolean(this.flags & kFlagWeak);\n }\n get resistStopPropagation() {\n return Boolean(this.flags & kFlagResistStopPropagation);\n }\n get removed() {\n return Boolean(this.flags & kFlagRemoved);\n }\n set removed(value) {\n if (value)\n this.flags |= kFlagRemoved;\n else\n this.flags &= ~kFlagRemoved;\n }\n\n same(listener, capture) {\n const myListener = this.weak ? this.listener.deref() : this.listener;\n return myListener === listener && this.capture === capture;\n }\n\n remove() {\n if (this.previous !== undefined)\n this.previous.next = this.next;\n if (this.next !== undefined)\n this.next.previous = this.previous;\n this.removed = true;\n if (this.weak) {\n weakListeners().registry.unregister(this);\n const weakKey = this.weakKeyRef?.deref();\n const listener = this.callback?.deref();\n if (weakKey !== undefined && listener !== undefined) {\n const retained = weakListeners().map.get(weakKey);\n if (retained !== undefined) {\n retained.delete(listener);\n if (retained.size === 0)\n weakListeners().map.delete(weakKey);\n }\n }\n }\n }\n}\n\nfunction initEventTarget(self) {\n self[kEvents] = undefined;\n self[kMaxEventTargetListeners] = EventEmitter.defaultMaxListeners;\n self[kMaxEventTargetListenersWarned] = false;\n self[kHandlers] = undefined;\n}\n\nfunction getEventsMap(self) {\n if (self[kEvents] === undefined)\n self[kEvents] = new SafeMap();\n return self[kEvents];\n}\n\nclass EventTarget {\n\n\n\n static [kIsEventTarget] = true;\n\n constructor() {\n initEventTarget(this);\n }\n\n [kNewListener](size, type, listener, once, capture, passive, weak) {\n if (this[kMaxEventTargetListeners] > 0 &&\n size > this[kMaxEventTargetListeners] &&\n !this[kMaxEventTargetListenersWarned]) {\n this[kMaxEventTargetListenersWarned] = true;\n\n\n const w = new Error('Possible EventTarget memory leak detected. ' +\n `${size} ${type} listeners ` +\n `added to ${inspect(this, { depth: -1 })}. MaxListeners is ${this[kMaxEventTargetListeners]}. Use ` +\n 'events.setMaxListeners() to increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.target = this;\n w.type = type;\n w.count = size;\n process.emitWarning(w);\n }\n }\n [kRemoveListener](size, type, listener, capture) {}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n addEventListener(type, listener, options = kEmptyObject) {\n if (!isEventTarget(this))\n throw new ERR_INVALID_THIS('EventTarget');\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS('type', 'listener');\n\n let once = false;\n let capture = false;\n let passive = false;\n let isNodeStyleListener = false;\n let weak = false;\n let resistStopPropagation = false;\n\n if (options !== kEmptyObject) {\n\n\n options = validateEventListenerOptions(options);\n\n once = options.once;\n capture = options.capture;\n passive = options.passive;\n isNodeStyleListener = options.isNodeStyleListener;\n weak = options.weak;\n resistStopPropagation = options.resistStopPropagation;\n\n const signal = options.signal;\n\n validateAbortSignal(signal, 'options.signal');\n\n if (signal) {\n if (signal.aborted) {\n return;\n }\n signal.addEventListener('abort', () => {\n this.removeEventListener(type, listener, options);\n }, { __proto__: null, once: true, [kWeakHandler]: this, [kResistStopPropagation]: true });\n }\n }\n\n if (!validateEventListener(listener)) {\n\n\n\n const w = new Error(`addEventListener called with ${listener}` +\n ' which has no effect.');\n w.name = 'AddEventListenerArgumentTypeWarning';\n w.target = this;\n w.type = type;\n process.emitWarning(w);\n return;\n }\n\n type = webidl.converters.DOMString(type);\n\n const eventsMap = getEventsMap(this);\n let root = eventsMap.get(type);\n\n if (root === undefined) {\n root = { size: 1, next: undefined, resistStopPropagation: Boolean(resistStopPropagation) };\n\n new Listener(this, type, root, listener, once, capture, passive,\n isNodeStyleListener, weak, resistStopPropagation);\n this[kNewListener](\n root.size,\n type,\n listener,\n once,\n capture,\n passive,\n weak);\n eventsMap.set(type, root);\n return;\n }\n\n let handler = root.next;\n let previous = root;\n\n\n while (handler !== undefined && !handler.same(listener, capture)) {\n previous = handler;\n handler = handler.next;\n }\n\n if (handler !== undefined) {\n return;\n }\n\n new Listener(this, type, previous, listener, once, capture, passive,\n isNodeStyleListener, weak, resistStopPropagation);\n root.size++;\n root.resistStopPropagation ||= Boolean(resistStopPropagation);\n this[kNewListener](root.size, type, listener, once, capture, passive, weak);\n }\n\n\n\n\n\n\n\n\n removeEventListener(type, listener, options = kEmptyObject) {\n if (!isEventTarget(this))\n throw new ERR_INVALID_THIS('EventTarget');\n if (arguments.length < 2)\n throw new ERR_MISSING_ARGS('type', 'listener');\n if (!validateEventListener(listener))\n return;\n\n type = webidl.converters.DOMString(type);\n\n\n const capture = typeof options === 'boolean' ?\n options : options?.capture === true;\n\n if (this[kEvents] === undefined)\n return;\n\n const root = this[kEvents].get(type);\n if (root === undefined || root.next === undefined)\n return;\n\n let handler = root.next;\n while (handler !== undefined) {\n if (handler.same(listener, capture)) {\n handler.remove();\n root.size--;\n if (root.size === 0)\n this[kEvents].delete(type);\n this[kRemoveListener](root.size, type, listener, capture);\n break;\n }\n handler = handler.next;\n }\n }\n\n [kRemoveWeakListenerHelper](type, listener) {\n if (this[kEvents] === undefined)\n return;\n\n const root = this[kEvents].get(type);\n if (root === undefined || root.next === undefined)\n return;\n\n const capture = listener.capture === true;\n\n let handler = root.next;\n while (handler !== undefined) {\n if (handler === listener) {\n handler.remove();\n root.size--;\n if (root.size === 0)\n this[kEvents].delete(type);\n\n this[kRemoveListener](root.size, type, undefined, capture);\n break;\n }\n handler = handler.next;\n }\n }\n\n\n\n\n\n dispatchEvent(event) {\n if (!isEventTarget(this))\n throw new ERR_INVALID_THIS('EventTarget');\n if (arguments.length < 1)\n throw new ERR_MISSING_ARGS('event');\n\n if (!(event instanceof Event))\n throw new ERR_INVALID_ARG_TYPE('event', 'Event', event);\n\n if (event[kIsBeingDispatched])\n throw new ERR_EVENT_RECURSION(event.type);\n\n this[kHybridDispatch](event, event.type, event);\n return event.defaultPrevented !== true;\n }\n\n [kHybridDispatch](nodeValue, type, event) {\n if (event !== undefined) {\n event[kTarget] = this;\n event[kIsBeingDispatched] = true;\n }\n\n const root = this[kEvents]?.get(type);\n if (root === undefined || root.next === undefined) {\n if (event !== undefined)\n event[kIsBeingDispatched] = false;\n return true;\n }\n\n let handler = root.next;\n let next;\n\n while (handler !== undefined &&\n (root.resistStopPropagation || handler.passive || event?.[kStop] !== true)) {\n\n next = handler.next;\n\n if (handler.removed || (event?.[kStop] === true && !handler.resistStopPropagation)) {\n\n\n\n\n handler = next;\n continue;\n }\n if (handler.once) {\n handler.remove();\n root.size--;\n const { listener, capture } = handler;\n this[kRemoveListener](root.size, type, listener, capture);\n }\n\n let arg;\n try {\n if (handler.isNodeStyleListener) {\n arg = nodeValue;\n } else {\n if (event === undefined) {\n event = this[kCreateEvent](nodeValue, type);\n event[kTarget] = this;\n event[kIsBeingDispatched] = true;\n }\n arg = event;\n }\n const callback = handler.weak ?\n handler.callback.deref() : handler.callback;\n let result;\n if (callback) {\n if (handler.passive && !handler.isNodeStyleListener) {\n arg[kInPassiveListener] = true;\n }\n result = FunctionPrototypeCall(callback, this, arg);\n if (!handler.isNodeStyleListener) {\n arg[kIsBeingDispatched] = false;\n }\n }\n if (result !== undefined && result !== null)\n addCatch(result);\n } catch (err) {\n emitUncaughtException(err);\n } finally {\n if (arg?.[kInPassiveListener])\n arg[kInPassiveListener] = false;\n }\n\n handler = next;\n }\n\n if (event !== undefined)\n event[kIsBeingDispatched] = false;\n }\n\n [kCreateEvent](nodeValue, type) {\n return new CustomEvent(type, { detail: nodeValue });\n }\n [customInspectSymbol](depth, options) {\n const name = this.constructor.name;\n if (depth < 0)\n return name;\n\n const opts = ObjectAssign({}, options, {\n depth: NumberIsInteger(options.depth) ? options.depth - 1 : options.depth,\n });\n\n return `${name} ${inspect({}, opts)}`;\n }\n}\n\nObjectDefineProperties(EventTarget.prototype, {\n addEventListener: kEnumerableProperty,\n removeEventListener: kEnumerableProperty,\n dispatchEvent: kEnumerableProperty,\n [SymbolToStringTag]: {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n value: 'EventTarget',\n },\n});\n\nfunction initNodeEventTarget(self) {\n initEventTarget(self);\n}\n\nclass NodeEventTarget extends EventTarget {\n static [kIsNodeEventTarget] = true;\n static defaultMaxListeners = 10;\n\n constructor() {\n super();\n initNodeEventTarget(this);\n }\n\n\n\n\n setMaxListeners(n) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n EventEmitter.setMaxListeners(n, this);\n }\n\n\n\n\n getMaxListeners() {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n return this[kMaxEventTargetListeners];\n }\n\n\n\n\n eventNames() {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n if (this[kEvents] === undefined)\n return [];\n return ArrayFrom(this[kEvents].keys());\n }\n\n\n\n\n\n listenerCount(type) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n if (this[kEvents] === undefined)\n return 0;\n const root = this[kEvents].get(String(type));\n return root !== undefined ? root.size : 0;\n }\n\n\n\n\n\n\n\n\n\n off(type, listener, options) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n this.removeEventListener(type, listener, options);\n return this;\n }\n\n\n\n\n\n\n\n\n\n removeListener(type, listener, options) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n this.removeEventListener(type, listener, options);\n return this;\n }\n\n\n\n\n\n\n on(type, listener) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });\n return this;\n }\n\n\n\n\n\n\n addListener(type, listener) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });\n return this;\n }\n\n\n\n\n\n\n emit(type, arg) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n validateString(type, 'type');\n const hadListeners = this.listenerCount(type) > 0;\n this[kHybridDispatch](arg, type);\n return hadListeners;\n }\n\n\n\n\n\n\n once(type, listener) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n this.addEventListener(type, listener,\n { once: true, [kIsNodeStyleListener]: true });\n return this;\n }\n\n\n\n\n\n removeAllListeners(type) {\n if (!isNodeEventTarget(this))\n throw new ERR_INVALID_THIS('NodeEventTarget');\n if (this[kEvents] === undefined)\n return this;\n if (type !== undefined)\n this[kEvents].delete(String(type));\n else\n this[kEvents].clear();\n\n return this;\n }\n}\n\nObjectDefineProperties(NodeEventTarget.prototype, {\n setMaxListeners: kEnumerableProperty,\n getMaxListeners: kEnumerableProperty,\n eventNames: kEnumerableProperty,\n listenerCount: kEnumerableProperty,\n off: kEnumerableProperty,\n removeListener: kEnumerableProperty,\n on: kEnumerableProperty,\n addListener: kEnumerableProperty,\n once: kEnumerableProperty,\n emit: kEnumerableProperty,\n removeAllListeners: kEnumerableProperty,\n});\n\n\n\nfunction validateEventListener(listener) {\n if (typeof listener === 'function' ||\n typeof listener?.handleEvent === 'function') {\n return true;\n }\n\n if (listener == null)\n return false;\n\n if (typeof listener === 'object') {\n\n return true;\n }\n\n throw new ERR_INVALID_ARG_TYPE('listener', 'EventListener', listener);\n}\n\nfunction validateEventListenerOptions(options) {\n if (typeof options === 'boolean')\n return { capture: options };\n\n if (options === null)\n return kEmptyObject;\n validateObject(options, 'options', kValidateObjectAllowObjects);\n return {\n once: Boolean(options.once),\n capture: Boolean(options.capture),\n passive: Boolean(options.passive),\n signal: options.signal,\n weak: options[kWeakHandler],\n resistStopPropagation: options[kResistStopPropagation] ?? false,\n isNodeStyleListener: Boolean(options[kIsNodeStyleListener]),\n };\n}\n\n\n\n\n\n\nfunction isEventTarget(obj) {\n return obj?.constructor?.[kIsEventTarget];\n}\n\nfunction isNodeEventTarget(obj) {\n return obj?.constructor?.[kIsNodeEventTarget];\n}\n\nfunction addCatch(promise) {\n const then = promise.then;\n if (typeof then === 'function') {\n FunctionPrototypeCall(then, promise, undefined, function(err) {\n\n\n emitUncaughtException(err);\n });\n }\n}\n\nfunction emitUncaughtException(err) {\n process.nextTick(() => { throw err; });\n}\n\nfunction makeEventHandler(handler) {\n\n\n function eventHandler(...args) {\n if (typeof eventHandler.handler !== 'function') {\n return;\n }\n return ReflectApply(eventHandler.handler, this, args);\n }\n eventHandler.handler = handler;\n return eventHandler;\n}\n\nfunction defineEventHandler(emitter, name, event = name) {\n\n const propName = `on${name}`;\n function get() {\n validateThisInternalField(this, kHandlers, 'EventTarget');\n return this[kHandlers]?.get(event)?.handler ?? null;\n }\n ObjectDefineProperty(get, 'name', {\n __proto__: null,\n value: `get ${propName}`,\n });\n\n function set(value) {\n validateThisInternalField(this, kHandlers, 'EventTarget');\n\n\n\n if (typeof value !== 'function' &&\n (typeof value !== 'object' || value === null)) {\n value = null;\n }\n if (this[kHandlers] === undefined)\n this[kHandlers] = new SafeMap();\n let wrappedHandler = this[kHandlers].get(event);\n if (wrappedHandler) {\n const eventsMap = getEventsMap(this);\n if (typeof wrappedHandler.handler === 'function') {\n const root = eventsMap.get(event);\n if (root !== undefined) {\n root.size--;\n this[kRemoveListener](root.size, event, wrappedHandler.handler, false);\n }\n }\n wrappedHandler.handler = value;\n if (typeof wrappedHandler.handler === 'function') {\n const root = eventsMap.get(event);\n if (root !== undefined) {\n root.size++;\n this[kNewListener](root.size, event, value, false, false, false, false);\n } else {\n\n\n this.addEventListener(event, wrappedHandler);\n }\n }\n } else {\n wrappedHandler = makeEventHandler(value);\n this.addEventListener(event, wrappedHandler);\n }\n this[kHandlers].set(event, wrappedHandler);\n }\n ObjectDefineProperty(set, 'name', {\n __proto__: null,\n value: `set ${propName}`,\n });\n\n ObjectDefineProperty(emitter, propName, {\n __proto__: null,\n get,\n set,\n configurable: true,\n enumerable: true,\n });\n}\n\nmodule.exports = {\n Event,\n CustomEvent,\n EventTarget,\n NodeEventTarget,\n defineEventHandler,\n initEventTarget,\n initNodeEventTarget,\n kCreateEvent,\n kNewListener,\n kTrustEvent,\n kRemoveListener,\n kEvents,\n kWeakHandler,\n kResistStopPropagation,\n isEventTarget,\n};\n","internal/file.js":"'use strict';\n\nconst {\n DateNow,\n FunctionPrototypeCall,\n NumberIsNaN,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToWellFormed,\n Symbol,\n SymbolToStringTag,\n} = primordials;\n\nconst {\n Blob,\n TransferableBlob,\n} = require('internal/blob');\n\nconst {\n customInspectSymbol: kInspect,\n kEnumerableProperty,\n kEmptyObject,\n} = require('internal/util');\n\nconst {\n codes: {\n ERR_INVALID_THIS,\n ERR_MISSING_ARGS,\n },\n} = require('internal/errors');\n\nconst {\n inspect,\n} = require('internal/util/inspect');\n\nconst {\n kClone,\n kDeserialize,\n} = require('internal/worker/js_transferable');\n\nconst kState = Symbol('state');\n\nfunction isFile(object) {\n return object?.[kState] !== undefined;\n}\n\nclass FileState {\n name;\n lastModified;\n\n\n\n\n\n constructor(name, lastModified) {\n this.name = name;\n this.lastModified = lastModified;\n }\n}\n\nclass File extends Blob {\n constructor(fileBits, fileName, options = kEmptyObject) {\n if (arguments.length < 2) {\n throw new ERR_MISSING_ARGS('fileBits', 'fileName');\n }\n\n super(fileBits, options);\n\n let { lastModified } = options ?? kEmptyObject;\n\n if (lastModified !== undefined) {\n\n lastModified = +lastModified;\n\n if (NumberIsNaN(lastModified)) {\n lastModified = 0;\n }\n } else {\n lastModified = DateNow();\n }\n\n this[kState] = new FileState(StringPrototypeToWellFormed(`${fileName}`), lastModified);\n }\n\n get name() {\n if (!isFile(this))\n throw new ERR_INVALID_THIS('File');\n\n return this[kState].name;\n }\n\n get lastModified() {\n if (!isFile(this))\n throw new ERR_INVALID_THIS('File');\n\n return this[kState].lastModified;\n }\n\n [kInspect](depth, options) {\n if (depth < 0) {\n return this;\n }\n\n const opts = {\n ...options,\n depth: options.depth == null ? null : options.depth - 1,\n };\n\n return `File ${inspect({\n size: this.size,\n type: this.type,\n name: this[kState].name,\n lastModified: this[kState].lastModified,\n }, opts)}`;\n }\n\n [kClone]() {\n return {\n data: { ...super[kClone]().data, ...this[kState] },\n deserializeInfo: 'internal/file:TransferableFile',\n };\n }\n\n [kDeserialize](data) {\n super[kDeserialize](data);\n\n this[kState] = new FileState(data.name, data.lastModified);\n }\n}\n\nfunction TransferableFile(handle, length, type = '') {\n FunctionPrototypeCall(TransferableBlob, this, handle, length, type);\n ObjectSetPrototypeOf(this, File.prototype);\n}\n\nObjectSetPrototypeOf(TransferableFile.prototype, File.prototype);\nObjectSetPrototypeOf(TransferableFile, File);\n\nObjectDefineProperties(File.prototype, {\n name: kEnumerableProperty,\n lastModified: kEnumerableProperty,\n [SymbolToStringTag]: {\n __proto__: null,\n configurable: true,\n value: 'File',\n },\n});\n\nmodule.exports = {\n File,\n TransferableFile,\n};\n","internal/fixed_queue.js":"'use strict';\n\nconst {\n Array,\n ArrayPrototypeFill,\n} = primordials;\n\n\nconst kSize = 2048;\nconst kMask = kSize - 1;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nclass FixedCircularBuffer {\n constructor() {\n this.bottom = 0;\n this.top = 0;\n this.list = ArrayPrototypeFill(new Array(kSize), undefined);\n this.next = null;\n }\n\n isEmpty() {\n return this.top === this.bottom;\n }\n\n isFull() {\n return ((this.top + 1) & kMask) === this.bottom;\n }\n\n push(data) {\n this.list[this.top] = data;\n this.top = (this.top + 1) & kMask;\n }\n\n shift() {\n const nextItem = this.list[this.bottom];\n if (nextItem === undefined)\n return null;\n this.list[this.bottom] = undefined;\n this.bottom = (this.bottom + 1) & kMask;\n return nextItem;\n }\n}\n\nmodule.exports = class FixedQueue {\n static #pool = [];\n\n constructor() {\n this.head = this.tail = FixedQueue.#pool.pop() ?? new FixedCircularBuffer();\n }\n\n isEmpty() {\n return this.head.isEmpty();\n }\n\n push(data) {\n if (this.head.isFull()) {\n\n\n this.head = this.head.next = FixedQueue.#pool.pop() ?? new FixedCircularBuffer();\n }\n this.head.push(data);\n }\n\n shift() {\n const tail = this.tail;\n const next = tail.shift();\n if (tail.isEmpty() && tail.next !== null) {\n\n this.tail = tail.next;\n tail.next = null;\n tail.bottom = 0;\n tail.top = 0;\n\n if (FixedQueue.#pool.length < 64) {\n FixedQueue.#pool.push(tail);\n }\n }\n return next;\n }\n};\n","internal/linkedlist.js":"'use strict';\n\nfunction init(list) {\n list._idleNext = list;\n list._idlePrev = list;\n return list;\n}\n\n\nfunction peek(list) {\n if (list._idlePrev === list) return null;\n return list._idlePrev;\n}\n\n\nfunction remove(item) {\n if (item._idleNext) {\n item._idleNext._idlePrev = item._idlePrev;\n }\n\n if (item._idlePrev) {\n item._idlePrev._idleNext = item._idleNext;\n }\n\n item._idleNext = null;\n item._idlePrev = null;\n}\n\n\nfunction append(list, item) {\n if (item._idleNext || item._idlePrev) {\n remove(item);\n }\n\n\n\n item._idleNext = list._idleNext;\n item._idlePrev = list;\n\n\n list._idleNext._idlePrev = item;\n list._idleNext = item;\n}\n\nfunction isEmpty(list) {\n return list._idleNext === list;\n}\n\nmodule.exports = {\n init,\n peek,\n remove,\n append,\n isEmpty,\n};\n","internal/per_context/primordials.js":"'use strict';\n\n\n\n\n\n\n\n\n\n\n\nconst {\n defineProperty: ReflectDefineProperty,\n getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor,\n ownKeys: ReflectOwnKeys,\n} = Reflect;\n\n\n\n\nconst { apply, bind, call } = Function.prototype;\nconst uncurryThis = bind.bind(call);\nprimordials.uncurryThis = uncurryThis;\n\n\n\n\nconst applyBind = bind.bind(apply);\nprimordials.applyBind = applyBind;\n\n\n\n\n\nconst varargsMethods = [\n\n\n\n 'ArrayOf',\n 'ArrayPrototypePush',\n 'ArrayPrototypeUnshift',\n\n\n 'MathHypot',\n 'MathMax',\n 'MathMin',\n 'StringFromCharCode',\n 'StringFromCodePoint',\n 'StringPrototypeConcat',\n 'TypedArrayOf',\n];\n\nfunction getNewKey(key) {\n return typeof key === 'symbol' ?\n `Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` :\n `${key[0].toUpperCase()}${key.slice(1)}`;\n}\n\nfunction copyAccessor(dest, prefix, key, { enumerable, get, set }) {\n ReflectDefineProperty(dest, `${prefix}Get${key}`, {\n __proto__: null,\n value: uncurryThis(get),\n enumerable,\n });\n if (set !== undefined) {\n ReflectDefineProperty(dest, `${prefix}Set${key}`, {\n __proto__: null,\n value: uncurryThis(set),\n enumerable,\n });\n }\n}\n\nfunction copyPropsRenamed(src, dest, prefix) {\n for (const key of ReflectOwnKeys(src)) {\n const newKey = getNewKey(key);\n const desc = ReflectGetOwnPropertyDescriptor(src, key);\n if ('get' in desc) {\n copyAccessor(dest, prefix, newKey, desc);\n } else {\n const name = `${prefix}${newKey}`;\n ReflectDefineProperty(dest, name, { __proto__: null, ...desc });\n if (varargsMethods.includes(name)) {\n ReflectDefineProperty(dest, `${name}Apply`, {\n __proto__: null,\n\n\n\n value: applyBind(desc.value, src),\n });\n }\n }\n }\n}\n\nfunction copyPropsRenamedBound(src, dest, prefix) {\n for (const key of ReflectOwnKeys(src)) {\n const newKey = getNewKey(key);\n const desc = ReflectGetOwnPropertyDescriptor(src, key);\n if ('get' in desc) {\n copyAccessor(dest, prefix, newKey, desc);\n } else {\n const { value } = desc;\n if (typeof value === 'function') {\n desc.value = value.bind(src);\n }\n\n const name = `${prefix}${newKey}`;\n ReflectDefineProperty(dest, name, { __proto__: null, ...desc });\n if (varargsMethods.includes(name)) {\n ReflectDefineProperty(dest, `${name}Apply`, {\n __proto__: null,\n value: applyBind(value, src),\n });\n }\n }\n }\n}\n\nfunction copyPrototype(src, dest, prefix) {\n for (const key of ReflectOwnKeys(src)) {\n const newKey = getNewKey(key);\n const desc = ReflectGetOwnPropertyDescriptor(src, key);\n if ('get' in desc) {\n copyAccessor(dest, prefix, newKey, desc);\n } else {\n const { value } = desc;\n if (typeof value === 'function') {\n desc.value = uncurryThis(value);\n }\n\n const name = `${prefix}${newKey}`;\n ReflectDefineProperty(dest, name, { __proto__: null, ...desc });\n if (varargsMethods.includes(name)) {\n ReflectDefineProperty(dest, `${name}Apply`, {\n __proto__: null,\n value: applyBind(value),\n });\n }\n }\n }\n}\n\n\n[\n 'Proxy',\n 'globalThis',\n].forEach((name) => {\n\n primordials[name] = globalThis[name];\n});\n\n\n[\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n].forEach((fn) => {\n primordials[fn.name] = fn;\n});\n\n\n[\n escape,\n eval,\n unescape,\n].forEach((fn) => {\n primordials[fn.name] = fn;\n});\n\n\n[\n 'Atomics',\n 'JSON',\n 'Math',\n 'Proxy',\n 'Reflect',\n].forEach((name) => {\n\n\n if (globalThis[name] === undefined) return;\n copyPropsRenamed(globalThis[name], primordials, name);\n});\n\n\n[\n 'AggregateError',\n 'Array',\n 'ArrayBuffer',\n 'BigInt',\n 'BigInt64Array',\n 'BigUint64Array',\n 'Boolean',\n 'DataView',\n 'Date',\n 'Error',\n 'EvalError',\n 'FinalizationRegistry',\n 'Float16Array',\n 'Float32Array',\n 'Float64Array',\n 'Function',\n 'Int16Array',\n 'Int32Array',\n 'Int8Array',\n 'Iterator',\n 'Map',\n 'Number',\n 'Object',\n 'RangeError',\n 'ReferenceError',\n 'RegExp',\n 'Set',\n 'String',\n 'Symbol',\n 'SyntaxError',\n 'TypeError',\n 'URIError',\n 'Uint16Array',\n 'Uint32Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'WeakMap',\n 'WeakRef',\n 'WeakSet',\n].forEach((name) => {\n\n\n const original = globalThis[name];\n if (original === undefined) return;\n primordials[name] = original;\n copyPropsRenamed(original, primordials, name);\n copyPrototype(original.prototype, primordials, `${name}Prototype`);\n});\n\n\n\n\n[\n\n 'Promise',\n].forEach((name) => {\n\n\n const original = globalThis[name];\n if (original === undefined) return;\n primordials[name] = original;\n copyPropsRenamedBound(original, primordials, name);\n copyPrototype(original.prototype, primordials, `${name}Prototype`);\n});\n\n\n\n\n[\n\n { name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) },\n].forEach(({ name, original }) => {\n primordials[name] = original;\n copyPrototype(original, primordials, name);\n copyPrototype(original.prototype, primordials, `${name}Prototype`);\n});\n\n\n\n[\n {\n name: 'ArrayIteratorPrototype',\n original: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()),\n },\n {\n name: 'AsyncFunctionPrototype',\n original: Reflect.getPrototypeOf(async function() {}),\n },\n {\n name: 'AsyncGeneratorFunctionPrototype',\n original: Reflect.getPrototypeOf(async function*() {}),\n },\n {\n name: 'AsyncIteratorPrototype',\n original: Reflect.getPrototypeOf(Reflect.getPrototypeOf(async function*() {}).prototype),\n },\n {\n name: 'GeneratorFunctionPrototype',\n original: Reflect.getPrototypeOf(function*() {}),\n },\n {\n name: 'IteratorHelperPrototype',\n original: Reflect.getPrototypeOf(primordials.IteratorPrototypeDrop({ __proto__: null }, null)),\n },\n {\n name: 'MapIteratorPrototype',\n original: Reflect.getPrototypeOf(new primordials.Map()[Symbol.iterator]()),\n },\n {\n name: 'RegExpStringIteratorPrototype',\n original: Reflect.getPrototypeOf(primordials.RegExp.prototype[Symbol.matchAll]()),\n },\n {\n name: 'SetIteratorPrototype',\n original: Reflect.getPrototypeOf(new primordials.Set()[Symbol.iterator]()),\n },\n {\n name: 'StringIteratorPrototype',\n original: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()),\n },\n {\n name: 'WrapForValidIteratorPrototype',\n original: Reflect.getPrototypeOf(primordials.IteratorFrom({ __proto__: null })),\n },\n].forEach(({ name, original }) => {\n primordials[name] = original;\n copyPrototype(original, primordials, name);\n});\n\n\n\nconst {\n Array: ArrayConstructor,\n ArrayPrototypeForEach,\n ArrayPrototypeMap,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n FinalizationRegistry,\n FunctionPrototypeCall,\n Map,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectFreeze,\n ObjectSetPrototypeOf,\n Promise,\n PromisePrototypeThen,\n PromiseResolve,\n ReflectApply,\n ReflectConstruct,\n ReflectGet,\n ReflectSet,\n RegExp,\n RegExpPrototype,\n RegExpPrototypeExec,\n RegExpPrototypeGetDotAll,\n RegExpPrototypeGetFlags,\n RegExpPrototypeGetGlobal,\n RegExpPrototypeGetHasIndices,\n RegExpPrototypeGetIgnoreCase,\n RegExpPrototypeGetMultiline,\n RegExpPrototypeGetSource,\n RegExpPrototypeGetSticky,\n RegExpPrototypeGetUnicode,\n Set,\n SymbolIterator,\n SymbolMatch,\n SymbolMatchAll,\n SymbolReplace,\n SymbolSearch,\n SymbolSpecies,\n SymbolSplit,\n WeakMap,\n WeakRef,\n WeakSet,\n} = primordials;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst createSafeIterator = (factory, next) => {\n class SafeIterator {\n constructor(iterable) {\n this._iterator = factory(iterable);\n }\n next() {\n return next(this._iterator);\n }\n [SymbolIterator]() {\n return this;\n }\n }\n ObjectSetPrototypeOf(SafeIterator.prototype, null);\n ObjectFreeze(SafeIterator.prototype);\n ObjectFreeze(SafeIterator);\n return SafeIterator;\n};\n\nprimordials.SafeArrayIterator = createSafeIterator(\n primordials.ArrayPrototypeSymbolIterator,\n primordials.ArrayIteratorPrototypeNext,\n);\nprimordials.SafeStringIterator = createSafeIterator(\n primordials.StringPrototypeSymbolIterator,\n primordials.StringIteratorPrototypeNext,\n);\n\nconst copyProps = (src, dest) => {\n ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => {\n if (!ReflectGetOwnPropertyDescriptor(dest, key)) {\n ReflectDefineProperty(\n dest,\n key,\n { __proto__: null, ...ReflectGetOwnPropertyDescriptor(src, key) });\n }\n });\n};\n\n\n\n\nconst makeSafe = (unsafe, safe, next) => {\n if (next) {\n const dummy = new unsafe();\n ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => {\n if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) {\n const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key);\n if (\n typeof desc.value === 'function' &&\n desc.value.length === 0 &&\n FunctionPrototypeCall(desc.value, dummy)?.next === next\n ) {\n const createIterator = uncurryThis(desc.value);\n const SafeIterator = createSafeIterator(createIterator, next);\n desc.value = function() {\n return new SafeIterator(this);\n };\n }\n ReflectDefineProperty(safe.prototype, key, { __proto__: null, ...desc });\n }\n });\n } else {\n copyProps(unsafe.prototype, safe.prototype);\n }\n copyProps(unsafe, safe);\n\n ObjectSetPrototypeOf(safe.prototype, null);\n ObjectFreeze(safe.prototype);\n ObjectFreeze(safe);\n return safe;\n};\nprimordials.makeSafe = makeSafe;\n\n\n\nprimordials.SafeMap = makeSafe(\n Map,\n class SafeMap extends Map {},\n primordials.MapIteratorPrototypeNext,\n);\nprimordials.SafeWeakMap = makeSafe(\n WeakMap,\n class SafeWeakMap extends WeakMap {},\n);\n\nprimordials.SafeSet = makeSafe(\n Set,\n class SafeSet extends Set {},\n primordials.SetIteratorPrototypeNext,\n);\nprimordials.SafeWeakSet = makeSafe(\n WeakSet,\n class SafeWeakSet extends WeakSet {},\n);\n\nprimordials.SafeFinalizationRegistry = makeSafe(\n FinalizationRegistry,\n class SafeFinalizationRegistry extends FinalizationRegistry {},\n);\nprimordials.SafeWeakRef = makeSafe(\n WeakRef,\n class SafeWeakRef extends WeakRef {},\n);\n\nconst SafePromise = makeSafe(\n Promise,\n class SafePromise extends Promise {},\n);\n\n\n\n\n\n\n\n\n\n\nprimordials.SafePromisePrototypeFinally = (thisPromise, onFinally) =>\n\n\n new Promise((a, b) =>\n new SafePromise((a, b) => PromisePrototypeThen(thisPromise, a, b))\n .finally(onFinally)\n .then(a, b),\n );\n\nconst arrayToSafePromiseIterable = (promises, mapFn) =>\n new primordials.SafeArrayIterator(\n ArrayPrototypeMap(\n promises,\n (promise, i) =>\n new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b)),\n ),\n );\n\n\n\n\n\n\n\nprimordials.SafePromiseAll = (promises, mapFn) =>\n\n\n new Promise((a, b) =>\n SafePromise.all(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),\n );\n\n\n\n\n\n\n\n\n\n\nprimordials.SafePromiseAllReturnArrayLike = (promises, mapFn) =>\n new Promise((resolve, reject) => {\n const { length } = promises;\n\n const returnVal = ArrayConstructor(length);\n ObjectSetPrototypeOf(returnVal, null);\n if (length === 0) resolve(returnVal);\n\n let pendingPromises = length;\n for (let i = 0; i < length; i++) {\n const promise = mapFn != null ? mapFn(promises[i], i) : promises[i];\n PromisePrototypeThen(PromiseResolve(promise), (result) => {\n returnVal[i] = result;\n if (--pendingPromises === 0) resolve(returnVal);\n }, reject);\n }\n });\n\n\n\n\n\n\n\n\n\nprimordials.SafePromiseAllReturnVoid = (promises, mapFn) =>\n new Promise((resolve, reject) => {\n let pendingPromises = promises.length;\n if (pendingPromises === 0) resolve();\n const onFulfilled = () => {\n if (--pendingPromises === 0) {\n resolve();\n }\n };\n for (let i = 0; i < promises.length; i++) {\n const promise = mapFn != null ? mapFn(promises[i], i) : promises[i];\n PromisePrototypeThen(PromiseResolve(promise), onFulfilled, reject);\n }\n });\n\n\n\n\n\n\n\nprimordials.SafePromiseAllSettled = (promises, mapFn) =>\n\n\n new Promise((a, b) =>\n SafePromise.allSettled(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),\n );\n\n\n\n\n\n\n\n\n\nprimordials.SafePromiseAllSettledReturnVoid = (promises, mapFn) => new Promise((resolve) => {\n let pendingPromises = promises.length;\n if (pendingPromises === 0) resolve();\n const onSettle = () => {\n if (--pendingPromises === 0) resolve();\n };\n for (let i = 0; i < promises.length; i++) {\n const promise = mapFn != null ? mapFn(promises[i], i) : promises[i];\n PromisePrototypeThen(PromiseResolve(promise), onSettle, onSettle);\n }\n});\n\n\n\n\n\n\n\nprimordials.SafePromiseAny = (promises, mapFn) =>\n\n\n new Promise((a, b) =>\n SafePromise.any(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),\n );\n\n\n\n\n\n\n\nprimordials.SafePromiseRace = (promises, mapFn) =>\n\n\n new Promise((a, b) =>\n SafePromise.race(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),\n );\n\n\nconst {\n exec: OriginalRegExpPrototypeExec,\n [SymbolMatch]: OriginalRegExpPrototypeSymbolMatch,\n [SymbolMatchAll]: OriginalRegExpPrototypeSymbolMatchAll,\n [SymbolReplace]: OriginalRegExpPrototypeSymbolReplace,\n [SymbolSearch]: OriginalRegExpPrototypeSymbolSearch,\n [SymbolSplit]: OriginalRegExpPrototypeSymbolSplit,\n} = RegExpPrototype;\n\nclass RegExpLikeForStringSplitting {\n #regex;\n constructor() {\n this.#regex = ReflectConstruct(RegExp, arguments);\n }\n\n get lastIndex() {\n return ReflectGet(this.#regex, 'lastIndex');\n }\n set lastIndex(value) {\n ReflectSet(this.#regex, 'lastIndex', value);\n }\n\n exec() {\n return ReflectApply(OriginalRegExpPrototypeExec, this.#regex, arguments);\n }\n}\nObjectSetPrototypeOf(RegExpLikeForStringSplitting.prototype, null);\n\n\n\n\n\nprimordials.hardenRegExp = function hardenRegExp(pattern) {\n ObjectDefineProperties(pattern, {\n [SymbolMatch]: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeSymbolMatch,\n },\n [SymbolMatchAll]: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeSymbolMatchAll,\n },\n [SymbolReplace]: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeSymbolReplace,\n },\n [SymbolSearch]: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeSymbolSearch,\n },\n [SymbolSplit]: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeSymbolSplit,\n },\n constructor: {\n __proto__: null,\n configurable: true,\n value: {\n [SymbolSpecies]: RegExpLikeForStringSplitting,\n },\n },\n dotAll: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetDotAll(pattern),\n },\n exec: {\n __proto__: null,\n configurable: true,\n value: OriginalRegExpPrototypeExec,\n },\n global: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetGlobal(pattern),\n },\n hasIndices: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetHasIndices(pattern),\n },\n ignoreCase: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetIgnoreCase(pattern),\n },\n multiline: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetMultiline(pattern),\n },\n source: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetSource(pattern),\n },\n sticky: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetSticky(pattern),\n },\n unicode: {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetUnicode(pattern),\n },\n });\n ObjectDefineProperty(pattern, 'flags', {\n __proto__: null,\n configurable: true,\n value: RegExpPrototypeGetFlags(pattern),\n });\n return pattern;\n};\n\n\n\n\n\n\n\nprimordials.SafeStringPrototypeSearch = (str, regexp) => {\n regexp.lastIndex = 0;\n const match = RegExpPrototypeExec(regexp, str);\n return match ? match.index : -1;\n};\n\n\n\n\n\n\n\n\n\nprimordials.SafeArrayPrototypePushApply = (arr, items) => {\n let end = 0x10000;\n if (end < items.length) {\n let start = 0;\n do {\n ArrayPrototypePushApply(arr, ArrayPrototypeSlice(items, start, start = end));\n end += 0x10000;\n } while (end < items.length);\n items = ArrayPrototypeSlice(items, start);\n }\n return ArrayPrototypePushApply(arr, items);\n};\n\nObjectSetPrototypeOf(primordials, null);\nObjectFreeze(primordials);\n","internal/perf/utils.js":"'use strict';\n\nconst {\n constants: {\n NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN,\n NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN_TIMESTAMP,\n },\n milestones,\n now,\n} = internalBinding('performance');\n\nfunction getTimeOrigin() {\n\n\n return milestones[NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN] / 1e6;\n}\n\n\nfunction getMilestoneTimestamp(milestoneIdx) {\n const ns = milestones[milestoneIdx];\n if (ns === -1)\n return ns;\n return ns / 1e6 - getTimeOrigin();\n}\n\nfunction getTimeOriginTimestamp() {\n return milestones[NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN_TIMESTAMP] / 1e3;\n}\n\nmodule.exports = {\n now,\n getMilestoneTimestamp,\n getTimeOriginTimestamp,\n};\n","internal/priority_queue.js":"'use strict';\n\n\n\n\n\n\n\nmodule.exports = class PriorityQueue {\n #compare = (a, b) => a - b;\n #heap = [undefined, undefined];\n #setPosition;\n #size = 0;\n\n constructor(comparator, setPosition) {\n if (comparator !== undefined)\n this.#compare = comparator;\n if (setPosition !== undefined)\n this.#setPosition = setPosition;\n }\n\n insert(value) {\n const heap = this.#heap;\n const pos = ++this.#size;\n heap[pos] = value;\n\n this.percolateUp(pos);\n }\n\n peek() {\n return this.#heap[1];\n }\n\n peekBottom() {\n return this.#heap[this.#size];\n }\n\n percolateDown(pos) {\n const compare = this.#compare;\n const setPosition = this.#setPosition;\n const hasSetPosition = setPosition !== undefined;\n const heap = this.#heap;\n const size = this.#size;\n const hsize = size >> 1;\n const item = heap[pos];\n\n while (pos <= hsize) {\n let child = pos << 1;\n const nextChild = child + 1;\n let childItem = heap[child];\n\n if (nextChild <= size && compare(heap[nextChild], childItem) < 0) {\n child = nextChild;\n childItem = heap[nextChild];\n }\n\n if (compare(item, childItem) <= 0) break;\n\n if (hasSetPosition)\n setPosition(childItem, pos);\n\n heap[pos] = childItem;\n pos = child;\n }\n\n heap[pos] = item;\n if (hasSetPosition)\n setPosition(item, pos);\n }\n\n percolateUp(pos) {\n const heap = this.#heap;\n const compare = this.#compare;\n const setPosition = this.#setPosition;\n const hasSetPosition = setPosition !== undefined;\n const item = heap[pos];\n\n while (pos > 1) {\n const parent = pos >> 1;\n const parentItem = heap[parent];\n if (compare(parentItem, item) <= 0)\n break;\n heap[pos] = parentItem;\n if (hasSetPosition)\n setPosition(parentItem, pos);\n pos = parent;\n }\n\n heap[pos] = item;\n if (hasSetPosition)\n setPosition(item, pos);\n }\n\n removeAt(pos) {\n const heap = this.#heap;\n let size = this.#size;\n heap[pos] = heap[size];\n heap[size] = undefined;\n size = --this.#size;\n\n if (size > 0 && pos <= size) {\n if (pos > 1 && this.#compare(heap[pos >> 1], heap[pos]) > 0)\n this.percolateUp(pos);\n else\n this.percolateDown(pos);\n }\n }\n\n shift() {\n const heap = this.#heap;\n const value = heap[1];\n if (value === undefined)\n return;\n\n this.removeAt(1);\n\n return value;\n }\n};\n","internal/streams/add-abort-signal.js":"'use strict';\n\nconst {\n SymbolDispose,\n} = primordials;\n\nconst {\n AbortError,\n codes: {\n ERR_INVALID_ARG_TYPE,\n },\n} = require('internal/errors');\n\nconst {\n isNodeStream,\n isWebStream,\n kControllerErrorFunction,\n} = require('internal/streams/utils');\n\nconst { eos } = require('internal/streams/end-of-stream');\nlet addAbortListener;\n\n\n\n\nconst validateAbortSignal = (signal, name) => {\n if (typeof signal !== 'object' ||\n !('aborted' in signal)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal);\n }\n};\n\nmodule.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n validateAbortSignal(signal, 'signal');\n if (!isNodeStream(stream) && !isWebStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream);\n }\n return module.exports.addAbortSignalNoValidate(signal, stream);\n};\n\nmodule.exports.addAbortSignalNoValidate = function(signal, stream) {\n if (typeof signal !== 'object' || !('aborted' in signal)) {\n return stream;\n }\n const onAbort = isNodeStream(stream) ?\n () => {\n stream.destroy(new AbortError(undefined, { cause: signal.reason }));\n } :\n () => {\n stream[kControllerErrorFunction](new AbortError(undefined, { cause: signal.reason }));\n };\n if (signal.aborted) {\n onAbort();\n } else {\n addAbortListener ??= require('internal/events/abort_listener').addAbortListener;\n const disposable = addAbortListener(signal, onAbort);\n eos(stream, disposable[SymbolDispose]);\n }\n return stream;\n};\n","internal/streams/compose.js":"'use strict';\n\nconst {\n ArrayPrototypeSlice,\n} = primordials;\n\nconst { pipeline } = require('internal/streams/pipeline');\nconst Duplex = require('internal/streams/duplex');\nconst { destroyer } = require('internal/streams/destroy');\nconst {\n isNodeStream,\n isReadable,\n isWritable,\n isWebStream,\n isTransformStream,\n isWritableStream,\n isReadableStream,\n} = require('internal/streams/utils');\nconst {\n AbortError,\n codes: {\n ERR_INVALID_ARG_VALUE,\n ERR_MISSING_ARGS,\n },\n} = require('internal/errors');\nconst { eos } = require('internal/streams/end-of-stream');\n\nmodule.exports = function compose(...streams) {\n if (streams.length === 0) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n if (streams.length === 1) {\n return Duplex.from(streams[0]);\n }\n\n const orgStreams = ArrayPrototypeSlice(streams);\n\n if (typeof streams[0] === 'function') {\n streams[0] = Duplex.from(streams[0]);\n }\n\n if (typeof streams[streams.length - 1] === 'function') {\n const idx = streams.length - 1;\n streams[idx] = Duplex.from(streams[idx]);\n }\n\n for (let n = 0; n < streams.length; ++n) {\n if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {\n\n continue;\n }\n if (\n n < streams.length - 1 &&\n !(\n isReadable(streams[n]) ||\n isReadableStream(streams[n]) ||\n isTransformStream(streams[n])\n )\n ) {\n throw new ERR_INVALID_ARG_VALUE(\n `streams[${n}]`,\n orgStreams[n],\n 'must be readable',\n );\n }\n if (\n n > 0 &&\n !(\n isWritable(streams[n]) ||\n isWritableStream(streams[n]) ||\n isTransformStream(streams[n])\n )\n ) {\n throw new ERR_INVALID_ARG_VALUE(\n `streams[${n}]`,\n orgStreams[n],\n 'must be writable',\n );\n }\n }\n\n let ondrain;\n let onfinish;\n let onclose;\n let d;\n\n function onfinished(err) {\n const cb = onclose;\n onclose = null;\n\n if (cb) {\n cb(err);\n } else if (err) {\n d.destroy(err);\n } else if (!readable && !writable) {\n d.destroy();\n }\n }\n\n const head = streams[0];\n const tail = pipeline(streams, onfinished);\n\n const writable = !!(\n isWritable(head) ||\n isWritableStream(head) ||\n isTransformStream(head)\n );\n const readable = !!(\n isReadable(tail) ||\n isReadableStream(tail) ||\n isTransformStream(tail)\n );\n\n\n\n\n d = new Duplex({\n\n writableObjectMode: !!head?.writableObjectMode,\n readableObjectMode: !!tail?.readableObjectMode,\n writable,\n readable,\n });\n\n if (writable) {\n if (isNodeStream(head)) {\n d._write = function(chunk, encoding, callback) {\n if (head.write(chunk, encoding)) {\n callback();\n } else {\n ondrain = callback;\n }\n };\n\n d._final = function(callback) {\n head.end();\n onfinish = callback;\n };\n\n head.on('drain', function() {\n if (ondrain) {\n const cb = ondrain;\n ondrain = null;\n cb();\n }\n });\n } else if (isWebStream(head)) {\n const writable = isTransformStream(head) ? head.writable : head;\n const writer = writable.getWriter();\n\n d._write = async function(chunk, encoding, callback) {\n try {\n await writer.ready;\n writer.write(chunk).catch(() => {});\n callback();\n } catch (err) {\n callback(err);\n }\n };\n\n d._final = async function(callback) {\n try {\n await writer.ready;\n writer.close().catch(() => {});\n onfinish = callback;\n } catch (err) {\n callback(err);\n }\n };\n }\n\n const toRead = isTransformStream(tail) ? tail.readable : tail;\n\n eos(toRead, () => {\n if (onfinish) {\n const cb = onfinish;\n onfinish = null;\n cb();\n }\n });\n }\n\n if (readable) {\n if (isNodeStream(tail)) {\n d._read = function() {\n tail.resume();\n };\n\n tail.on('data', function(chunk) {\n if (!d.push(chunk)) {\n tail.pause();\n }\n });\n\n tail.on('end', function() {\n d.push(null);\n });\n } else if (isWebStream(tail)) {\n const readable = isTransformStream(tail) ? tail.readable : tail;\n const reader = readable.getReader();\n d._read = async function() {\n while (true) {\n try {\n const { value, done } = await reader.read();\n\n if (done) {\n d.push(null);\n return;\n }\n\n if (!d.push(value)) {\n return;\n }\n } catch {\n return;\n }\n }\n };\n }\n }\n\n d._destroy = function(err, callback) {\n if (!err && onclose !== null) {\n err = new AbortError();\n }\n\n ondrain = null;\n onfinish = null;\n\n if (isNodeStream(tail)) {\n destroyer(tail, err);\n }\n\n if (onclose === null) {\n callback(err);\n } else {\n onclose = callback;\n }\n };\n\n return d;\n};\n","internal/streams/destroy.js":"'use strict';\n\nconst {\n Symbol,\n} = primordials;\n\nconst {\n AbortError,\n aggregateTwoErrors,\n codes: {\n ERR_MULTIPLE_CALLBACK,\n },\n} = require('internal/errors');\nconst {\n kIsDestroyed,\n isDestroyed,\n isFinished,\n isServerRequest,\n kState,\n kErrorEmitted,\n kEmitClose,\n kClosed,\n kCloseEmitted,\n kConstructed,\n kDestroyed,\n kAutoDestroy,\n kErrored,\n} = require('internal/streams/utils');\n\nconst kDestroy = Symbol('kDestroy');\nconst kConstruct = Symbol('kConstruct');\n\nfunction checkError(err, w, r) {\n if (err) {\n\n err.stack;\n\n if (w && !w.errored) {\n w.errored = err;\n }\n if (r && !r.errored) {\n r.errored = err;\n }\n }\n}\n\n\n\nfunction destroy(err, cb) {\n const r = this._readableState;\n const w = this._writableState;\n\n const s = w || r;\n\n if (\n (w && (w[kState] & kDestroyed) !== 0) ||\n (r && (r[kState] & kDestroyed) !== 0)\n ) {\n if (typeof cb === 'function') {\n cb();\n }\n\n return this;\n }\n\n\n\n\n checkError(err, w, r);\n\n if (w) {\n w[kState] |= kDestroyed;\n }\n if (r) {\n r[kState] |= kDestroyed;\n }\n\n\n if ((s[kState] & kConstructed) === 0) {\n this.once(kDestroy, function(er) {\n _destroy(this, aggregateTwoErrors(er, err), cb);\n });\n } else {\n _destroy(this, err, cb);\n }\n\n return this;\n}\n\nfunction _destroy(self, err, cb) {\n let called = false;\n\n function onDestroy(err) {\n if (called) {\n return;\n }\n called = true;\n\n const r = self._readableState;\n const w = self._writableState;\n\n checkError(err, w, r);\n\n if (w) {\n w[kState] |= kClosed;\n }\n if (r) {\n r[kState] |= kClosed;\n }\n\n if (typeof cb === 'function') {\n cb(err);\n }\n\n if (err) {\n process.nextTick(emitErrorCloseNT, self, err);\n } else {\n process.nextTick(emitCloseNT, self);\n }\n }\n try {\n self._destroy(err || null, onDestroy);\n } catch (err) {\n onDestroy(err);\n }\n}\n\nfunction emitErrorCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n const r = self._readableState;\n const w = self._writableState;\n\n if (w) {\n w[kState] |= kCloseEmitted;\n }\n if (r) {\n r[kState] |= kCloseEmitted;\n }\n\n if (\n (w && (w[kState] & kEmitClose) !== 0) ||\n (r && (r[kState] & kEmitClose) !== 0)\n ) {\n self.emit('close');\n }\n}\n\nfunction emitErrorNT(self, err) {\n const r = self._readableState;\n const w = self._writableState;\n\n if (\n (w && (w[kState] & kErrorEmitted) !== 0) ||\n (r && (r[kState] & kErrorEmitted) !== 0)\n ) {\n return;\n }\n\n if (w) {\n w[kState] |= kErrorEmitted;\n }\n if (r) {\n r[kState] |= kErrorEmitted;\n }\n\n self.emit('error', err);\n}\n\nfunction undestroy() {\n const r = this._readableState;\n const w = this._writableState;\n\n if (r) {\n r.constructed = true;\n r.closed = false;\n r.closeEmitted = false;\n r.destroyed = false;\n r.errored = null;\n r.errorEmitted = false;\n r.reading = false;\n r.ended = r.readable === false;\n r.endEmitted = r.readable === false;\n }\n\n if (w) {\n w.constructed = true;\n w.destroyed = false;\n w.closed = false;\n w.closeEmitted = false;\n w.errored = null;\n w.errorEmitted = false;\n w.finalCalled = false;\n w.prefinished = false;\n w.ended = w.writable === false;\n w.ending = w.writable === false;\n w.finished = w.writable === false;\n }\n}\n\nfunction errorOrDestroy(stream, err, sync) {\n\n\n\n\n\n\n const r = stream._readableState;\n const w = stream._writableState;\n\n if (\n (w && (w[kState] ? (w[kState] & kDestroyed) !== 0 : w.destroyed)) ||\n (r && (r[kState] ? (r[kState] & kDestroyed) !== 0 : r.destroyed))\n ) {\n return this;\n }\n\n if (\n (r && (r[kState] & kAutoDestroy) !== 0) ||\n (w && (w[kState] & kAutoDestroy) !== 0)\n ) {\n stream.destroy(err);\n } else if (err) {\n\n err.stack;\n\n if (w && (w[kState] & kErrored) === 0) {\n w.errored = err;\n }\n if (r && (r[kState] & kErrored) === 0) {\n r.errored = err;\n }\n if (sync) {\n process.nextTick(emitErrorNT, stream, err);\n } else {\n emitErrorNT(stream, err);\n }\n }\n}\n\nfunction construct(stream, cb) {\n if (typeof stream._construct !== 'function') {\n return;\n }\n\n const r = stream._readableState;\n const w = stream._writableState;\n\n if (r) {\n r[kState] &= ~kConstructed;\n }\n if (w) {\n w[kState] &= ~kConstructed;\n }\n\n stream.once(kConstruct, cb);\n\n if (stream.listenerCount(kConstruct) > 1) {\n\n return;\n }\n\n process.nextTick(constructNT, stream);\n}\n\nfunction constructNT(stream) {\n let called = false;\n\n function onConstruct(err) {\n if (called) {\n errorOrDestroy(stream, err ?? new ERR_MULTIPLE_CALLBACK());\n return;\n }\n called = true;\n\n const r = stream._readableState;\n const w = stream._writableState;\n const s = w || r;\n\n if (r) {\n r[kState] |= kConstructed;\n }\n if (w) {\n w[kState] |= kConstructed;\n }\n\n if (s.destroyed) {\n stream.emit(kDestroy, err);\n } else if (err) {\n errorOrDestroy(stream, err, true);\n } else {\n stream.emit(kConstruct);\n }\n }\n\n try {\n stream._construct((err) => {\n process.nextTick(onConstruct, err);\n });\n } catch (err) {\n process.nextTick(onConstruct, err);\n }\n}\n\nfunction isRequest(stream) {\n return stream?.setHeader && typeof stream.abort === 'function';\n}\n\nfunction emitCloseLegacy(stream) {\n stream.emit('close');\n}\n\nfunction emitErrorCloseLegacy(stream, err) {\n stream.emit('error', err);\n process.nextTick(emitCloseLegacy, stream);\n}\n\n\nfunction destroyer(stream, err) {\n if (!stream || isDestroyed(stream)) {\n return;\n }\n\n if (!err && !isFinished(stream)) {\n err = new AbortError();\n }\n\n\n if (isServerRequest(stream)) {\n stream.socket = null;\n stream.destroy(err);\n } else if (isRequest(stream)) {\n stream.abort();\n } else if (isRequest(stream.req)) {\n stream.req.abort();\n } else if (typeof stream.destroy === 'function') {\n stream.destroy(err);\n } else if (typeof stream.close === 'function') {\n\n stream.close();\n } else if (err) {\n process.nextTick(emitErrorCloseLegacy, stream, err);\n } else {\n process.nextTick(emitCloseLegacy, stream);\n }\n\n if (!stream.destroyed) {\n stream[kIsDestroyed] = true;\n }\n}\n\nmodule.exports = {\n construct,\n destroyer,\n destroy,\n undestroy,\n errorOrDestroy,\n};\n","internal/streams/duplex.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n\n'use strict';\n\nconst {\n ObjectDefineProperties,\n ObjectGetOwnPropertyDescriptor,\n ObjectKeys,\n ObjectSetPrototypeOf,\n} = primordials;\n\nmodule.exports = Duplex;\n\nconst Stream = require('internal/streams/legacy').Stream;\nconst Readable = require('internal/streams/readable');\nconst Writable = require('internal/streams/writable');\n\nconst {\n addAbortSignal,\n} = require('internal/streams/add-abort-signal');\n\nconst destroyImpl = require('internal/streams/destroy');\nconst { kOnConstructed } = require('internal/streams/utils');\n\nObjectSetPrototypeOf(Duplex.prototype, Readable.prototype);\nObjectSetPrototypeOf(Duplex, Readable);\n\n{\n const keys = ObjectKeys(Writable.prototype);\n\n for (let i = 0; i < keys.length; i++) {\n const method = keys[i];\n Duplex.prototype[method] ||= Writable.prototype[method];\n }\n}\n\n\nDuplex.prototype.destroy = Writable.prototype.destroy;\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex))\n return new Duplex(options);\n\n this._events ??= {\n close: undefined,\n error: undefined,\n prefinish: undefined,\n finish: undefined,\n drain: undefined,\n data: undefined,\n end: undefined,\n readable: undefined,\n\n\n\n\n\n\n\n };\n\n this._readableState = new Readable.ReadableState(options, this, true);\n this._writableState = new Writable.WritableState(options, this, true);\n\n if (options) {\n this.allowHalfOpen = options.allowHalfOpen !== false;\n\n if (options.readable === false) {\n this._readableState.readable = false;\n this._readableState.ended = true;\n this._readableState.endEmitted = true;\n }\n\n if (options.writable === false) {\n this._writableState.writable = false;\n this._writableState.ending = true;\n this._writableState.ended = true;\n this._writableState.finished = true;\n }\n\n if (typeof options.read === 'function')\n this._read = options.read;\n\n if (typeof options.write === 'function')\n this._write = options.write;\n\n if (typeof options.writev === 'function')\n this._writev = options.writev;\n\n if (typeof options.destroy === 'function')\n this._destroy = options.destroy;\n\n if (typeof options.final === 'function')\n this._final = options.final;\n\n if (typeof options.construct === 'function')\n this._construct = options.construct;\n\n if (options.signal)\n addAbortSignal(options.signal, this);\n } else {\n this.allowHalfOpen = true;\n }\n\n Stream.call(this, options);\n\n if (this._construct != null) {\n destroyImpl.construct(this, () => {\n this._readableState[kOnConstructed](this);\n this._writableState[kOnConstructed](this);\n });\n }\n}\n\nObjectDefineProperties(Duplex.prototype, {\n writable:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') },\n writableHighWaterMark:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') },\n writableObjectMode:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') },\n writableBuffer:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') },\n writableLength:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') },\n writableFinished:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') },\n writableCorked:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') },\n writableEnded:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') },\n writableNeedDrain:\n { __proto__: null, ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') },\n\n destroyed: {\n __proto__: null,\n get() {\n if (this._readableState === undefined ||\n this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set(value) {\n\n\n if (this._readableState && this._writableState) {\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n },\n },\n});\n\nlet webStreamsAdapters;\n\n\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined)\n webStreamsAdapters = require('internal/webstreams/adapters');\n return webStreamsAdapters;\n}\n\nDuplex.fromWeb = function(pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(\n pair,\n options);\n};\n\nDuplex.toWeb = function(duplex, options) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex, options);\n};\n\nlet duplexify;\n\nDuplex.from = function(body) {\n duplexify ??= require('internal/streams/duplexify');\n return duplexify(body, 'body');\n};\n","internal/streams/duplexpair.js":"'use strict';\nconst {\n Symbol,\n} = primordials;\n\nconst { Duplex } = require('stream');\nconst assert = require('internal/assert');\n\nconst kCallback = Symbol('Callback');\nconst kInitOtherSide = Symbol('InitOtherSide');\n\nclass DuplexSide extends Duplex {\n #otherSide = null;\n\n constructor(options) {\n super(options);\n this[kCallback] = null;\n this.#otherSide = null;\n }\n\n [kInitOtherSide](otherSide) {\n\n if (this.#otherSide === null) {\n this.#otherSide = otherSide;\n } else {\n assert(this.#otherSide === null);\n }\n }\n\n _read() {\n const callback = this[kCallback];\n if (callback) {\n this[kCallback] = null;\n callback();\n }\n }\n\n _write(chunk, encoding, callback) {\n assert(this.#otherSide !== null);\n assert(this.#otherSide[kCallback] === null);\n if (chunk.length === 0) {\n process.nextTick(callback);\n } else {\n this.#otherSide.push(chunk);\n this.#otherSide[kCallback] = callback;\n }\n }\n\n _final(callback) {\n this.#otherSide.on('end', callback);\n this.#otherSide.push(null);\n }\n\n\n _destroy(err, callback) {\n const otherSide = this.#otherSide;\n\n if (otherSide !== null && !otherSide.destroyed) {\n\n process.nextTick(() => {\n if (otherSide.destroyed) return;\n\n if (err) {\n\n\n\n otherSide.destroy();\n } else {\n\n otherSide.push(null);\n }\n });\n }\n\n callback(err);\n }\n}\n\nfunction duplexPair(options) {\n const side0 = new DuplexSide(options);\n const side1 = new DuplexSide(options);\n side0[kInitOtherSide](side1);\n side1[kInitOtherSide](side0);\n return [side0, side1];\n}\nmodule.exports = duplexPair;\n","internal/streams/end-of-stream.js":"\n\n\n'use strict';\n\nconst {\n Promise,\n PromisePrototypeThen,\n ReflectApply,\n Symbol,\n SymbolDispose,\n} = primordials;\n\nconst {\n AbortError,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PREMATURE_CLOSE,\n },\n} = require('internal/errors');\nconst {\n kEmptyObject,\n once,\n} = require('internal/util');\nconst {\n validateAbortSignal,\n validateFunction,\n validateObject,\n validateBoolean,\n} = require('internal/validators');\n\nconst {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose,\n kIsClosedPromise,\n} = require('internal/streams/utils');\n\nconst { enabledHooksExist } = require('internal/async_hooks');\nconst AsyncContextFrame = require('internal/async_context_frame');\n\n\nlet AsyncResource;\nlet addAbortListener;\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nconst nop = () => {};\n\nfunction bindAsyncResource(fn, type) {\n AsyncResource ??= require('async_hooks').AsyncResource;\n const resource = new AsyncResource(type);\n return function(...args) {\n return resource.runInAsyncScope(fn, this, ...args);\n };\n}\n\n\n\n\n\n\nfunction getEosErrored(stream) {\n const errored = isWritableErrored(stream) || isReadableErrored(stream);\n return typeof errored !== 'boolean' && errored || null;\n}\n\n\n\n\n\n\n\n\n\n\n\nfunction getEosOnCloseError(stream, readable, readableFinished, writable, writableFinished) {\n const errored = getEosErrored(stream);\n if (errored) {\n return errored;\n }\n\n if (readable && !readableFinished && isReadableNodeStream(stream, true)) {\n if (!isReadableFinished(stream, false)) {\n return new ERR_STREAM_PREMATURE_CLOSE();\n }\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, false)) {\n return new ERR_STREAM_PREMATURE_CLOSE();\n }\n }\n\n return null;\n}\n\n\n\nconst kEosNodeSynchronousCallback = Symbol('kEosNodeSynchronousCallback');\n\nfunction eos(stream, options, callback) {\n if (arguments.length === 2) {\n callback = options;\n options = kEmptyObject;\n } else if (options == null) {\n options = kEmptyObject;\n } else {\n validateObject(options, 'options');\n }\n validateFunction(callback, 'callback');\n validateAbortSignal(options.signal, 'options.signal');\n\n if (isReadableStream(stream) || isWritableStream(stream)) {\n return eosWeb(stream, options, callback);\n }\n\n if (!isNodeStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream);\n }\n\n const readable = options.readable ?? isReadableNodeStream(stream);\n const writable = options.writable ?? isWritableNodeStream(stream);\n\n\n\n\n let willEmitClose = (\n _willEmitClose(stream) &&\n isReadableNodeStream(stream) === readable &&\n isWritableNodeStream(stream) === writable\n );\n let writableFinished = isWritableFinished(stream, false);\n let readableFinished = isReadableFinished(stream, false);\n\n const wState = stream._writableState;\n const rState = stream._readableState;\n\n\n\n\n\n\n\n let immediateResult;\n if (isClosed(stream)) {\n immediateResult = getEosOnCloseError(\n stream,\n readable,\n readableFinished,\n writable,\n writableFinished,\n );\n } else if (wState?.errorEmitted || rState?.errorEmitted) {\n if (!willEmitClose) {\n immediateResult = getEosErrored(stream);\n }\n } else if (\n !readable &&\n (!willEmitClose || isReadable(stream)) &&\n (writableFinished || isWritable(stream) === false) &&\n (wState == null || wState.pendingcb === undefined || wState.pendingcb === 0)\n ) {\n immediateResult = getEosErrored(stream);\n } else if (\n !writable &&\n (!willEmitClose || isWritable(stream)) &&\n (readableFinished || isReadable(stream) === false)\n ) {\n immediateResult = getEosErrored(stream);\n } else if ((rState && stream.req && stream.aborted)) {\n immediateResult = getEosErrored(stream);\n }\n let cleanup = () => {\n callback = nop;\n };\n if (immediateResult !== undefined) {\n if (options.error !== false) {\n stream.on('error', nop);\n cleanup = () => {\n callback = nop;\n stream.removeListener('error', nop);\n };\n }\n } else if (options.signal?.aborted) {\n immediateResult = new AbortError(undefined, { cause: options.signal.reason });\n }\n if (immediateResult !== undefined && options[kEosNodeSynchronousCallback]) {\n ReflectApply(callback, stream, immediateResult === null ? [] : [immediateResult]);\n return cleanup;\n }\n\n if (AsyncContextFrame.current() || enabledHooksExist()) {\n\n\n callback = bindAsyncResource(callback, 'STREAM_END_OF_STREAM');\n }\n\n if (immediateResult !== undefined) {\n process.nextTick(() => ReflectApply(callback, stream, immediateResult === null ? [] : [immediateResult]));\n return cleanup;\n }\n\n callback = once(callback);\n\n const onlegacyfinish = () => {\n if (!stream.writable) {\n onfinish();\n }\n };\n\n const onfinish = () => {\n writableFinished = true;\n\n\n\n if (stream.destroyed) {\n willEmitClose = false;\n }\n\n if (willEmitClose && (!stream.readable || readable)) {\n return;\n }\n\n if (!readable || readableFinished) {\n callback.call(stream);\n }\n };\n\n const onend = () => {\n readableFinished = true;\n\n\n\n if (stream.destroyed) {\n willEmitClose = false;\n }\n\n if (willEmitClose && (!stream.writable || writable)) {\n return;\n }\n\n if (!writable || writableFinished) {\n callback.call(stream);\n }\n };\n\n const onerror = (err) => {\n callback.call(stream, err);\n };\n\n const onclose = () => {\n const error = getEosOnCloseError(stream, readable, readableFinished, writable, writableFinished);\n if (error === null) {\n callback.call(stream);\n } else {\n callback.call(stream, error);\n }\n };\n\n const onrequest = () => {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n if (!willEmitClose) {\n stream.on('abort', onclose);\n }\n if (stream.req) {\n onrequest();\n } else {\n stream.on('request', onrequest);\n }\n } else if (writable && !wState) {\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n\n if (!willEmitClose && typeof stream.aborted === 'boolean') {\n stream.on('aborted', onclose);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (options.error !== false) {\n stream.on('error', onerror);\n }\n stream.on('close', onclose);\n\n cleanup = () => {\n callback = nop;\n stream.removeListener('aborted', onclose);\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n\n if (options.signal) {\n const abort = () => {\n\n const endCallback = callback;\n cleanup();\n endCallback.call(\n stream,\n new AbortError(undefined, { cause: options.signal.reason }));\n };\n addAbortListener ??= require('internal/events/abort_listener').addAbortListener;\n const disposable = addAbortListener(options.signal, abort);\n const originalCallback = callback;\n callback = once((...args) => {\n disposable[SymbolDispose]();\n ReflectApply(originalCallback, stream, args);\n });\n }\n\n return cleanup;\n}\n\nfunction eosWeb(stream, options, callback) {\n if (AsyncContextFrame.current() || enabledHooksExist()) {\n\n\n callback = once(bindAsyncResource(callback, 'STREAM_END_OF_STREAM'));\n } else {\n callback = once(callback);\n }\n\n let isAborted = false;\n let abort = nop;\n if (options.signal) {\n abort = () => {\n isAborted = true;\n callback.call(stream, new AbortError(undefined, { cause: options.signal.reason }));\n };\n if (options.signal.aborted) {\n process.nextTick(abort);\n } else {\n addAbortListener ??= require('internal/events/abort_listener').addAbortListener;\n const disposable = addAbortListener(options.signal, abort);\n const originalCallback = callback;\n callback = once((...args) => {\n disposable[SymbolDispose]();\n ReflectApply(originalCallback, stream, args);\n });\n }\n }\n const resolverFn = (...args) => {\n if (!isAborted) {\n process.nextTick(() => ReflectApply(callback, stream, args));\n }\n };\n PromisePrototypeThen(\n stream[kIsClosedPromise].promise,\n resolverFn,\n resolverFn,\n );\n return nop;\n}\n\nfunction finished(stream, opts) {\n let autoCleanup = false;\n if (opts === null) {\n opts = kEmptyObject;\n }\n if (opts?.cleanup) {\n validateBoolean(opts.cleanup, 'cleanup');\n autoCleanup = opts.cleanup;\n }\n return new Promise((resolve, reject) => {\n const cleanup = eos(stream, opts, (err) => {\n if (autoCleanup) {\n cleanup();\n }\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n}\n\nmodule.exports = {\n eos,\n finished,\n kEosNodeSynchronousCallback,\n};\n","internal/streams/from.js":"'use strict';\n\nconst {\n PromisePrototypeThen,\n SymbolAsyncIterator,\n SymbolIterator,\n} = primordials;\nconst { Buffer } = require('buffer');\n\nconst {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_STREAM_NULL_VALUES,\n },\n} = require('internal/errors');\n\nfunction from(Readable, iterable, opts) {\n let iterator;\n if (typeof iterable === 'string' || iterable instanceof Buffer) {\n return new Readable({\n objectMode: true,\n ...opts,\n read() {\n this.push(iterable);\n this.push(null);\n },\n });\n }\n\n let isAsync;\n if (iterable?.[SymbolAsyncIterator]) {\n isAsync = true;\n iterator = iterable[SymbolAsyncIterator]();\n } else if (iterable?.[SymbolIterator]) {\n isAsync = false;\n iterator = iterable[SymbolIterator]();\n } else {\n throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);\n }\n\n\n const readable = new Readable({\n objectMode: true,\n highWaterMark: 1,\n\n ...opts,\n });\n const originalDestroy = readable._destroy;\n\n\n\n let reading = false;\n let isAsyncValues = false;\n\n readable._read = function() {\n if (!reading) {\n reading = true;\n\n if (isAsync) {\n nextAsync();\n } else if (isAsyncValues) {\n nextSyncWithAsyncValues();\n } else {\n nextSyncWithSyncValues();\n }\n }\n };\n\n readable._destroy = function(error, cb) {\n originalDestroy.call(this, error, (destroyError) => {\n const combinedError = destroyError || error;\n PromisePrototypeThen(\n close(combinedError),\n\n () => process.nextTick(cb, combinedError),\n (closeError) => process.nextTick(\n cb,\n aggregateTwoErrors(combinedError, closeError),\n ),\n );\n });\n };\n\n async function close(error) {\n const hadError = (error !== undefined) && (error !== null);\n const hasThrow = typeof iterator.throw === 'function';\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error);\n await value;\n if (done) {\n return;\n }\n }\n if (typeof iterator.return === 'function') {\n const { value } = await iterator.return();\n await value;\n }\n }\n\n\n\n\n function nextSyncWithSyncValues() {\n for (;;) {\n try {\n const { value, done } = iterator.next();\n\n if (done) {\n readable.push(null);\n return;\n }\n\n if (value &&\n typeof value.then === 'function') {\n return changeToAsyncValues(value);\n }\n\n if (value === null) {\n reading = false;\n throw new ERR_STREAM_NULL_VALUES();\n }\n\n if (readable.push(value)) {\n continue;\n }\n\n reading = false;\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n\n async function changeToAsyncValues(value) {\n isAsyncValues = true;\n\n try {\n const res = await value;\n\n if (res === null) {\n reading = false;\n throw new ERR_STREAM_NULL_VALUES();\n }\n\n if (readable.push(res)) {\n nextSyncWithAsyncValues();\n return;\n }\n\n reading = false;\n } catch (err) {\n readable.destroy(err);\n }\n }\n\n async function nextSyncWithAsyncValues() {\n for (;;) {\n try {\n const { value, done } = iterator.next();\n\n if (done) {\n readable.push(null);\n return;\n }\n\n const res = (value &&\n typeof value.then === 'function') ?\n await value :\n value;\n\n if (res === null) {\n reading = false;\n throw new ERR_STREAM_NULL_VALUES();\n }\n\n if (readable.push(res)) {\n continue;\n }\n\n reading = false;\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n\n async function nextAsync() {\n for (;;) {\n try {\n const { value, done } = await iterator.next();\n\n if (done) {\n readable.push(null);\n return;\n }\n\n if (value === null) {\n reading = false;\n throw new ERR_STREAM_NULL_VALUES();\n }\n\n if (readable.push(value)) {\n continue;\n }\n\n reading = false;\n } catch (err) {\n readable.destroy(err);\n }\n break;\n }\n }\n return readable;\n}\n\nmodule.exports = from;\n","internal/streams/legacy.js":"'use strict';\n\nconst {\n ArrayIsArray,\n ObjectSetPrototypeOf,\n ReflectOwnKeys,\n} = primordials;\n\nconst EE = require('events');\n\nfunction Stream(opts) {\n EE.call(this, opts);\n}\nObjectSetPrototypeOf(Stream.prototype, EE.prototype);\nObjectSetPrototypeOf(Stream, EE);\n\nStream.prototype.pipe = function(dest, options) {\n const source = this;\n\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === false && source.pause) {\n source.pause();\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n\n\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n let didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n\n function onerror(er) {\n cleanup();\n\n if (this.listenerCount?.('error') === 0) {\n this.emit('error', er);\n }\n }\n\n prependListener(source, 'error', onerror);\n prependListener(dest, 'error', onerror);\n\n\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n dest.emit('pipe', source);\n\n\n return dest;\n};\n\nStream.prototype.eventNames = function eventNames() {\n const names = [];\n for (const key of ReflectOwnKeys(this._events)) {\n if (typeof this._events[key] === 'function' || (ArrayIsArray(this._events[key]) && this._events[key].length > 0)) {\n names.push(key);\n }\n }\n return names;\n};\n\nfunction prependListener(emitter, event, fn) {\n\n\n if (typeof emitter.prependListener === 'function')\n return emitter.prependListener(event, fn);\n\n\n\n\n\n if (!emitter._events || !emitter._events[event])\n emitter.on(event, fn);\n else if (ArrayIsArray(emitter._events[event]))\n emitter._events[event].unshift(fn);\n else\n emitter._events[event] = [fn, emitter._events[event]];\n}\n\nmodule.exports = { Stream, prependListener };\n","internal/streams/operators.js":"'use strict';\n\nconst {\n ArrayPrototypePush,\n Boolean,\n MathFloor,\n Number,\n NumberIsNaN,\n Promise,\n PromisePrototypeThen,\n PromiseReject,\n PromiseResolve,\n Symbol,\n} = primordials;\n\nconst { AbortController, AbortSignal } = require('internal/abort_controller');\n\nconst {\n AbortError,\n codes: {\n ERR_MISSING_ARGS,\n ERR_OUT_OF_RANGE,\n },\n} = require('internal/errors');\nconst {\n validateAbortSignal,\n validateInteger,\n validateObject,\n validateFunction,\n} = require('internal/validators');\nconst { kWeakHandler, kResistStopPropagation } = require('internal/event_target');\nconst { finished } = require('internal/streams/end-of-stream');\n\nconst kEmpty = Symbol('kEmpty');\nconst kEof = Symbol('kEof');\n\nfunction map(fn, options) {\n validateFunction(fn, 'fn');\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n let concurrency = 1;\n if (options?.concurrency != null) {\n concurrency = MathFloor(options.concurrency);\n }\n\n let highWaterMark = concurrency - 1;\n if (options?.highWaterMark != null) {\n highWaterMark = MathFloor(options.highWaterMark);\n }\n\n validateInteger(concurrency, 'options.concurrency', 1);\n validateInteger(highWaterMark, 'options.highWaterMark', 0);\n\n highWaterMark += concurrency;\n\n return async function* map() {\n const signal = AbortSignal.any([options?.signal].filter(Boolean));\n const stream = this;\n const queue = [];\n const signalOpt = { signal };\n\n let next;\n let resume;\n let done = false;\n let cnt = 0;\n\n function onCatch() {\n done = true;\n afterItemProcessed();\n }\n\n function afterItemProcessed() {\n cnt -= 1;\n maybeResume();\n }\n\n function maybeResume() {\n if (\n resume &&\n !done &&\n cnt < concurrency &&\n queue.length < highWaterMark\n ) {\n resume();\n resume = null;\n }\n }\n\n async function pump() {\n try {\n for await (let val of stream) {\n if (done) {\n return;\n }\n\n if (signal.aborted) {\n throw new AbortError();\n }\n\n try {\n val = fn(val, signalOpt);\n\n if (val === kEmpty) {\n continue;\n }\n\n val = PromiseResolve(val);\n } catch (err) {\n val = PromiseReject(err);\n }\n\n cnt += 1;\n\n PromisePrototypeThen(val, afterItemProcessed, onCatch);\n\n queue.push(val);\n if (next) {\n next();\n next = null;\n }\n\n if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {\n await new Promise((resolve) => {\n resume = resolve;\n });\n }\n }\n queue.push(kEof);\n } catch (err) {\n const val = PromiseReject(err);\n PromisePrototypeThen(val, afterItemProcessed, onCatch);\n queue.push(val);\n } finally {\n done = true;\n if (next) {\n next();\n next = null;\n }\n }\n }\n\n pump();\n\n try {\n while (true) {\n while (queue.length > 0) {\n const val = await queue[0];\n\n if (val === kEof) {\n return;\n }\n\n if (signal.aborted) {\n throw new AbortError();\n }\n\n if (val !== kEmpty) {\n yield val;\n }\n\n queue.shift();\n maybeResume();\n }\n\n await new Promise((resolve) => {\n next = resolve;\n });\n }\n } finally {\n done = true;\n if (resume) {\n resume();\n resume = null;\n }\n }\n }.call(this);\n}\n\nasync function some(fn, options = undefined) {\n for await (const unused of filter.call(this, fn, options)) {\n return true;\n }\n return false;\n}\n\nasync function every(fn, options = undefined) {\n validateFunction(fn, 'fn');\n\n return !(await some.call(this, async (...args) => {\n return !(await fn(...args));\n }, options));\n}\n\nasync function find(fn, options) {\n for await (const result of filter.call(this, fn, options)) {\n return result;\n }\n return undefined;\n}\n\nasync function forEach(fn, options) {\n validateFunction(fn, 'fn');\n async function forEachFn(value, options) {\n await fn(value, options);\n return kEmpty;\n }\n\n for await (const unused of map.call(this, forEachFn, options));\n}\n\nfunction filter(fn, options) {\n validateFunction(fn, 'fn');\n async function filterFn(value, options) {\n if (await fn(value, options)) {\n return value;\n }\n return kEmpty;\n }\n return map.call(this, filterFn, options);\n}\n\n\n\nclass ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS {\n constructor() {\n super('reduce');\n this.message = 'Reduce of an empty stream requires an initial value';\n }\n}\n\nasync function reduce(reducer, initialValue, options) {\n validateFunction(reducer, 'reducer');\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n let hasInitialValue = arguments.length > 1;\n if (options?.signal?.aborted) {\n const err = new AbortError(undefined, { cause: options.signal.reason });\n this.once('error', () => {});\n await finished(this.destroy(err));\n throw err;\n }\n const ac = new AbortController();\n const signal = ac.signal;\n if (options?.signal) {\n const opts = { once: true, [kWeakHandler]: this, [kResistStopPropagation]: true };\n options.signal.addEventListener('abort', () => ac.abort(), opts);\n }\n let gotAnyItemFromStream = false;\n try {\n for await (const value of this) {\n gotAnyItemFromStream = true;\n if (options?.signal?.aborted) {\n throw new AbortError();\n }\n if (!hasInitialValue) {\n initialValue = value;\n hasInitialValue = true;\n } else {\n initialValue = await reducer(initialValue, value, { signal });\n }\n }\n if (!gotAnyItemFromStream && !hasInitialValue) {\n throw new ReduceAwareErrMissingArgs();\n }\n } finally {\n ac.abort();\n }\n return initialValue;\n}\n\nasync function toArray(options) {\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n const result = [];\n for await (const val of this) {\n if (options?.signal?.aborted) {\n throw new AbortError(undefined, { cause: options.signal.reason });\n }\n ArrayPrototypePush(result, val);\n }\n return result;\n}\n\nfunction flatMap(fn, options) {\n const values = map.call(this, fn, options);\n return async function* flatMap() {\n for await (const val of values) {\n yield* val;\n }\n }.call(this);\n}\n\nfunction toIntegerOrInfinity(number) {\n\n\n number = Number(number);\n if (NumberIsNaN(number)) {\n return 0;\n }\n if (number < 0) {\n throw new ERR_OUT_OF_RANGE('number', '>= 0', number);\n }\n return number;\n}\n\nfunction drop(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n number = toIntegerOrInfinity(number);\n return async function* drop() {\n if (options?.signal?.aborted) {\n throw new AbortError();\n }\n for await (const val of this) {\n if (options?.signal?.aborted) {\n throw new AbortError();\n }\n if (number-- <= 0) {\n yield val;\n }\n }\n }.call(this);\n}\n\nfunction take(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n number = toIntegerOrInfinity(number);\n return async function* take() {\n if (options?.signal?.aborted) {\n throw new AbortError();\n }\n for await (const val of this) {\n if (options?.signal?.aborted) {\n throw new AbortError();\n }\n if (number-- > 0) {\n yield val;\n }\n\n\n if (number <= 0) {\n return;\n }\n }\n }.call(this);\n}\n\nmodule.exports.streamReturningOperators = {\n drop,\n filter,\n flatMap,\n map,\n take,\n};\n\nmodule.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find,\n};\n","internal/streams/passthrough.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n'use strict';\n\nconst {\n ObjectSetPrototypeOf,\n} = primordials;\n\nmodule.exports = PassThrough;\n\nconst Transform = require('internal/streams/transform');\nObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype);\nObjectSetPrototypeOf(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough))\n return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function(chunk, encoding, cb) {\n cb(null, chunk);\n};\n","internal/streams/pipeline.js":"\n\n\n'use strict';\n\nconst {\n ArrayIsArray,\n Promise,\n SymbolAsyncIterator,\n SymbolDispose,\n} = primordials;\n\nconst { eos } = require('internal/streams/end-of-stream');\nconst { once } = require('internal/util');\nconst destroyImpl = require('internal/streams/destroy');\nconst Duplex = require('internal/streams/duplex');\nconst {\n AbortError,\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_PREMATURE_CLOSE,\n ERR_STREAM_UNABLE_TO_PIPE,\n },\n} = require('internal/errors');\n\nconst {\n validateFunction,\n validateAbortSignal,\n} = require('internal/validators');\n\nconst {\n isIterable,\n isReadable,\n isReadableNodeStream,\n isNodeStream,\n isTransformStream,\n isWebStream,\n isReadableStream,\n isReadableFinished,\n} = require('internal/streams/utils');\nconst { AbortController } = require('internal/abort_controller');\n\nlet PassThrough;\nlet Readable;\nlet addAbortListener;\n\nfunction destroyer(stream, reading, writing) {\n let finished = false;\n stream.on('close', () => {\n finished = true;\n });\n\n const cleanup = eos(stream, { readable: reading, writable: writing }, (err) => {\n finished = !err;\n });\n\n return {\n destroy: (err) => {\n if (finished) return;\n finished = true;\n destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe'));\n },\n cleanup,\n };\n}\n\nfunction popCallback(streams) {\n\n\n\n validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]');\n return streams.pop();\n}\n\nfunction makeAsyncIterable(val) {\n if (isIterable(val)) {\n return val;\n } else if (isReadableNodeStream(val)) {\n\n return fromReadable(val);\n }\n throw new ERR_INVALID_ARG_TYPE(\n 'val', ['Readable', 'Iterable', 'AsyncIterable'], val);\n}\n\nasync function* fromReadable(val) {\n Readable ??= require('internal/streams/readable');\n yield* Readable.prototype[SymbolAsyncIterator].call(val);\n}\n\nasync function pumpToNode(iterable, writable, finish, { end }) {\n let error;\n let onresolve = null;\n\n const resume = (err) => {\n if (err) {\n error = err;\n }\n\n if (onresolve) {\n const callback = onresolve;\n onresolve = null;\n callback();\n }\n };\n\n const wait = () => new Promise((resolve, reject) => {\n if (error) {\n reject(error);\n } else {\n onresolve = () => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n };\n }\n });\n\n writable.on('drain', resume);\n const cleanup = eos(writable, { readable: false }, resume);\n\n try {\n if (writable.writableNeedDrain) {\n await wait();\n }\n\n for await (const chunk of iterable) {\n if (!writable.write(chunk)) {\n await wait();\n }\n }\n\n if (end) {\n writable.end();\n await wait();\n }\n\n finish();\n } catch (err) {\n finish(error !== err ? aggregateTwoErrors(error, err) : err);\n } finally {\n cleanup();\n writable.off('drain', resume);\n }\n}\n\nasync function pumpToWeb(readable, writable, finish, { end }) {\n if (isTransformStream(writable)) {\n writable = writable.writable;\n }\n\n const writer = writable.getWriter();\n try {\n for await (const chunk of readable) {\n await writer.ready;\n writer.write(chunk).catch(() => {});\n }\n\n await writer.ready;\n\n if (end) {\n await writer.close();\n }\n\n finish();\n } catch (err) {\n try {\n await writer.abort(err);\n finish(err);\n } catch (err) {\n finish(err);\n }\n }\n}\n\nfunction pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)));\n}\n\nfunction pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray(streams[0])) {\n streams = streams[0];\n }\n\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n const ac = new AbortController();\n const signal = ac.signal;\n const outerSignal = opts?.signal;\n\n\n\n const lastStreamCleanup = [];\n\n validateAbortSignal(outerSignal, 'options.signal');\n\n function abort() {\n finishImpl(new AbortError(undefined, { cause: outerSignal?.reason }));\n }\n\n addAbortListener ??= require('internal/events/abort_listener').addAbortListener;\n let disposable;\n if (outerSignal) {\n disposable = addAbortListener(outerSignal, abort);\n }\n\n let error;\n let value;\n const destroys = [];\n\n let finishCount = 0;\n\n function finish(err) {\n finishImpl(err, --finishCount === 0);\n }\n\n function finishOnlyHandleError(err) {\n finishImpl(err, false);\n }\n\n function finishImpl(err, final) {\n if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE' || error.name === 'AbortError')) {\n error = err;\n }\n\n if (!error && !final) {\n return;\n }\n\n while (destroys.length) {\n destroys.shift()(error);\n }\n\n disposable?.[SymbolDispose]();\n ac.abort();\n\n if (final) {\n if (!error) {\n lastStreamCleanup.forEach((fn) => fn());\n }\n process.nextTick(callback, error, value);\n }\n }\n\n let ret;\n for (let i = 0; i < streams.length; i++) {\n const stream = streams[i];\n const reading = i < streams.length - 1;\n const writing = i > 0;\n const next = i + 1 < streams.length ? streams[i + 1] : null;\n const end = reading || opts?.end !== false;\n const isLastStream = i === streams.length - 1;\n\n if (isNodeStream(stream)) {\n if (next !== null && (next?.closed || next?.destroyed)) {\n throw new ERR_STREAM_UNABLE_TO_PIPE();\n }\n\n if (end) {\n const { destroy, cleanup } = destroyer(stream, reading, writing);\n destroys.push(destroy);\n\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup);\n }\n }\n\n\n function onError(err) {\n if (\n err &&\n err.name !== 'AbortError' &&\n err.code !== 'ERR_STREAM_PREMATURE_CLOSE'\n ) {\n finishOnlyHandleError(err);\n }\n }\n stream.on('error', onError);\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(() => {\n stream.removeListener('error', onError);\n });\n }\n }\n\n if (i === 0) {\n if (typeof stream === 'function') {\n ret = stream({ signal });\n if (!isIterable(ret)) {\n throw new ERR_INVALID_RETURN_VALUE(\n 'Iterable, AsyncIterable or Stream', 'source', ret);\n }\n } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) {\n ret = stream;\n } else {\n ret = Duplex.from(stream);\n }\n } else if (typeof stream === 'function') {\n if (isTransformStream(ret)) {\n ret = makeAsyncIterable(ret?.readable);\n } else {\n ret = makeAsyncIterable(ret);\n }\n ret = stream(ret, { signal });\n\n if (reading) {\n if (!isIterable(ret, true)) {\n throw new ERR_INVALID_RETURN_VALUE(\n 'AsyncIterable', `transform[${i - 1}]`, ret);\n }\n } else {\n PassThrough ??= require('internal/streams/passthrough');\n\n\n\n\n\n\n const pt = new PassThrough({\n objectMode: true,\n });\n\n\n\n const then = ret?.then;\n if (typeof then === 'function') {\n finishCount++;\n then.call(ret,\n (val) => {\n value = val;\n if (val != null) {\n pt.write(val);\n }\n if (end) {\n pt.end();\n }\n process.nextTick(finish);\n }, (err) => {\n pt.destroy(err);\n process.nextTick(finish, err);\n },\n );\n } else if (isIterable(ret, true)) {\n finishCount++;\n pumpToNode(ret, pt, finish, { end });\n } else if (isReadableStream(ret) || isTransformStream(ret)) {\n const toRead = ret.readable || ret;\n finishCount++;\n pumpToNode(toRead, pt, finish, { end });\n } else {\n throw new ERR_INVALID_RETURN_VALUE(\n 'AsyncIterable or Promise', 'destination', ret);\n }\n\n ret = pt;\n\n const { destroy, cleanup } = destroyer(ret, false, true);\n destroys.push(destroy);\n if (isLastStream) {\n lastStreamCleanup.push(cleanup);\n }\n }\n } else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2;\n const cleanup = pipe(ret, stream, finish, finishOnlyHandleError, { end });\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup);\n }\n } else if (isTransformStream(ret) || isReadableStream(ret)) {\n const toRead = ret.readable || ret;\n finishCount++;\n pumpToNode(toRead, stream, finish, { end });\n } else if (isIterable(ret)) {\n finishCount++;\n pumpToNode(ret, stream, finish, { end });\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val', ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], ret);\n }\n ret = stream;\n } else if (isWebStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount++;\n pumpToWeb(makeAsyncIterable(ret), stream, finish, { end });\n } else if (isReadableStream(ret) || isIterable(ret)) {\n finishCount++;\n pumpToWeb(ret, stream, finish, { end });\n } else if (isTransformStream(ret)) {\n finishCount++;\n pumpToWeb(ret.readable, stream, finish, { end });\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val', ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], ret);\n }\n ret = stream;\n } else {\n ret = Duplex.from(stream);\n }\n }\n\n if (signal?.aborted || outerSignal?.aborted) {\n process.nextTick(abort);\n }\n\n return ret;\n}\n\nfunction pipe(src, dst, finish, finishOnlyHandleError, { end }) {\n let ended = false;\n dst.on('close', () => {\n if (!ended) {\n\n finishOnlyHandleError(new ERR_STREAM_PREMATURE_CLOSE());\n }\n });\n\n src.pipe(dst, { end: false });\n\n if (end) {\n\n\n\n\n function endFn() {\n ended = true;\n dst.end();\n }\n\n if (isReadableFinished(src)) {\n process.nextTick(endFn);\n } else {\n src.once('end', endFn);\n }\n } else {\n finish();\n }\n\n eos(src, { readable: true, writable: false }, (err) => {\n const rState = src._readableState;\n if (\n err &&\n err.code === 'ERR_STREAM_PREMATURE_CLOSE' &&\n (rState?.ended && !rState.errored && !rState.errorEmitted)\n ) {\n\n\n\n\n\n\n\n\n src\n .once('end', finish)\n .once('error', finish);\n } else {\n finish(err);\n }\n });\n return eos(dst, { readable: false, writable: true }, finish);\n}\n\nmodule.exports = { pipelineImpl, pipeline };\n","internal/streams/readable.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n ArrayPrototypeIndexOf,\n AsyncIteratorPrototype,\n FunctionPrototypeCall,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise,\n PromisePrototypeThen,\n PromiseReject,\n PromiseResolve,\n ReflectApply,\n SafeSet,\n Symbol,\n SymbolAsyncDispose,\n SymbolAsyncIterator,\n SymbolFor,\n SymbolSpecies,\n TypedArrayPrototypeSet,\n} = primordials;\n\nmodule.exports = Readable;\nReadable.ReadableState = ReadableState;\n\nconst EE = require('events');\nconst { Stream, prependListener } = require('internal/streams/legacy');\nconst { Buffer } = require('buffer');\n\nconst {\n addAbortSignal,\n addAbortSignalNoValidate,\n} = require('internal/streams/add-abort-signal');\nconst { eos } = require('internal/streams/end-of-stream');\n\nconst { getOptionValue } = require('internal/options');\n\nlet debug = require('internal/util/debuglog').debuglog('stream', (fn) => {\n debug = fn;\n});\nconst destroyImpl = require('internal/streams/destroy');\nconst {\n getHighWaterMark,\n getDefaultHighWaterMark,\n} = require('internal/streams/state');\nconst {\n kState,\n\n kObjectMode,\n kErrorEmitted,\n kAutoDestroy,\n kEmitClose,\n kDestroyed,\n kClosed,\n kCloseEmitted,\n kErrored,\n kConstructed,\n kOnConstructed,\n} = require('internal/streams/utils');\n\nconst {\n AbortError,\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_ITER_MISSING_FLAG,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT,\n ERR_UNKNOWN_ENCODING,\n },\n} = require('internal/errors');\nconst {\n validateAbortSignal,\n validateObject,\n} = require('internal/validators');\n\nconst FastBuffer = Buffer[SymbolSpecies];\n\nconst { StringDecoder } = require('string_decoder');\nconst from = require('internal/streams/from');\nconst FixedQueue = require('internal/fixed_queue');\n\nObjectSetPrototypeOf(Readable.prototype, Stream.prototype);\nObjectSetPrototypeOf(Readable, Stream);\nconst nop = () => {};\n\nconst { errorOrDestroy } = destroyImpl;\n\nconst kErroredValue = Symbol('kErroredValue');\nconst kDefaultEncodingValue = Symbol('kDefaultEncodingValue');\nconst kDecoderValue = Symbol('kDecoderValue');\nconst kEncodingValue = Symbol('kEncodingValue');\n\nconst kEnded = 1 << 9;\nconst kEndEmitted = 1 << 10;\nconst kReading = 1 << 11;\nconst kSync = 1 << 12;\nconst kNeedReadable = 1 << 13;\nconst kEmittedReadable = 1 << 14;\nconst kReadableListening = 1 << 15;\nconst kResumeScheduled = 1 << 16;\nconst kMultiAwaitDrain = 1 << 17;\nconst kReadingMore = 1 << 18;\nconst kDataEmitted = 1 << 19;\nconst kDefaultUTF8Encoding = 1 << 20;\nconst kDecoder = 1 << 21;\nconst kEncoding = 1 << 22;\nconst kHasFlowing = 1 << 23;\nconst kFlowing = 1 << 24;\nconst kHasPaused = 1 << 25;\nconst kPaused = 1 << 26;\nconst kDataListening = 1 << 27;\nconst kEndScheduled = 1 << 28;\nconst kEofReadablePending = 1 << 29;\n\n\nfunction makeBitMapDescriptor(bit) {\n return {\n enumerable: false,\n get() { return (this[kState] & bit) !== 0; },\n set(value) {\n if (value) this[kState] |= bit;\n else this[kState] &= ~bit;\n },\n };\n}\nObjectDefineProperties(ReadableState.prototype, {\n objectMode: makeBitMapDescriptor(kObjectMode),\n ended: makeBitMapDescriptor(kEnded),\n endEmitted: makeBitMapDescriptor(kEndEmitted),\n reading: makeBitMapDescriptor(kReading),\n\n\n\n\n constructed: makeBitMapDescriptor(kConstructed),\n\n\n\n\n sync: makeBitMapDescriptor(kSync),\n\n\n needReadable: makeBitMapDescriptor(kNeedReadable),\n emittedReadable: makeBitMapDescriptor(kEmittedReadable),\n readableListening: makeBitMapDescriptor(kReadableListening),\n resumeScheduled: makeBitMapDescriptor(kResumeScheduled),\n\n errorEmitted: makeBitMapDescriptor(kErrorEmitted),\n emitClose: makeBitMapDescriptor(kEmitClose),\n autoDestroy: makeBitMapDescriptor(kAutoDestroy),\n\n destroyed: makeBitMapDescriptor(kDestroyed),\n\n closed: makeBitMapDescriptor(kClosed),\n\n\n closeEmitted: makeBitMapDescriptor(kCloseEmitted),\n multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain),\n\n readingMore: makeBitMapDescriptor(kReadingMore),\n dataEmitted: makeBitMapDescriptor(kDataEmitted),\n\n\n\n\n\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return (this[kState] & kErrored) !== 0 ? this[kErroredValue] : null;\n },\n set(value) {\n if (value) {\n this[kErroredValue] = value;\n this[kState] |= kErrored;\n } else {\n this[kState] &= ~kErrored;\n }\n },\n },\n\n defaultEncoding: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : this[kDefaultEncodingValue]; },\n set(value) {\n if (value === 'utf8' || value === 'utf-8') {\n this[kState] |= kDefaultUTF8Encoding;\n } else {\n this[kState] &= ~kDefaultUTF8Encoding;\n this[kDefaultEncodingValue] = value;\n }\n },\n },\n\n decoder: {\n __proto__: null,\n enumerable: false,\n get() {\n return (this[kState] & kDecoder) !== 0 ? this[kDecoderValue] : null;\n },\n set(value) {\n if (value) {\n this[kDecoderValue] = value;\n this[kState] |= kDecoder;\n } else {\n this[kState] &= ~kDecoder;\n }\n },\n },\n\n encoding: {\n __proto__: null,\n enumerable: false,\n get() {\n return (this[kState] & kEncoding) !== 0 ? this[kEncodingValue] : null;\n },\n set(value) {\n if (value) {\n this[kEncodingValue] = value;\n this[kState] |= kEncoding;\n } else {\n this[kState] &= ~kEncoding;\n }\n },\n },\n\n flowing: {\n __proto__: null,\n enumerable: false,\n get() {\n return (this[kState] & kHasFlowing) !== 0 ? (this[kState] & kFlowing) !== 0 : null;\n },\n set(value) {\n if (value == null) {\n this[kState] &= ~(kHasFlowing | kFlowing);\n } else if (value) {\n this[kState] |= (kHasFlowing | kFlowing);\n } else {\n this[kState] |= kHasFlowing;\n this[kState] &= ~kFlowing;\n }\n },\n },\n});\n\n\nfunction ReadableState(options, stream, isDuplex) {\n\n\n this[kState] = kEmitClose | kAutoDestroy | kConstructed | kSync;\n\n\n\n if (options?.objectMode)\n this[kState] |= kObjectMode;\n\n if (isDuplex && options?.readableObjectMode)\n this[kState] |= kObjectMode;\n\n\n\n this.highWaterMark = options ?\n getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) :\n getDefaultHighWaterMark(false);\n\n this.buffer = [];\n this.bufferIndex = 0;\n this.length = 0;\n this.pipes = [];\n\n\n if (options && options.emitClose === false) this[kState] &= ~kEmitClose;\n\n\n if (options && options.autoDestroy === false) this[kState] &= ~kAutoDestroy;\n\n\n\n\n const defaultEncoding = options?.defaultEncoding;\n if (defaultEncoding == null || defaultEncoding === 'utf8' || defaultEncoding === 'utf-8') {\n this[kState] |= kDefaultUTF8Encoding;\n } else if (Buffer.isEncoding(defaultEncoding)) {\n this.defaultEncoding = defaultEncoding;\n } else {\n throw new ERR_UNKNOWN_ENCODING(defaultEncoding);\n }\n\n\n\n this.awaitDrainWriters = null;\n\n if (options?.encoding) {\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nReadableState.prototype[kOnConstructed] = function onConstructed(stream) {\n if ((this[kState] & kNeedReadable) !== 0) {\n maybeReadMore(stream, this);\n }\n};\n\nfunction Readable(options) {\n if (!(this instanceof Readable))\n return new Readable(options);\n\n this._events ??= {\n close: undefined,\n error: undefined,\n data: undefined,\n end: undefined,\n readable: undefined,\n\n\n\n\n\n\n\n };\n\n this._readableState = new ReadableState(options, this, false);\n\n if (options) {\n if (typeof options.read === 'function')\n this._read = options.read;\n\n if (typeof options.destroy === 'function')\n this._destroy = options.destroy;\n\n if (typeof options.construct === 'function')\n this._construct = options.construct;\n\n if (options.signal)\n addAbortSignal(options.signal, this);\n }\n\n Stream.call(this, options);\n\n if (this._construct != null) {\n destroyImpl.construct(this, () => {\n this._readableState[kOnConstructed](this);\n });\n }\n}\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function(err, cb) {\n cb(err);\n};\n\nReadable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n};\n\nReadable.prototype[SymbolAsyncDispose] = async function() {\n let error;\n if (!this.destroyed) {\n error = this.readableEnded ? null : new AbortError();\n this.destroy(error);\n }\n await new Promise((resolve, reject) => eos(this, (err) => (err && err !== error ? reject(err) : resolve(null))));\n};\n\n\n\n\n\nReadable.prototype.push = function(chunk, encoding) {\n debug('push', chunk);\n\n const state = this._readableState;\n return (state[kState] & kObjectMode) === 0 ?\n readableAddChunkPushByteMode(this, state, chunk, encoding) :\n readableAddChunkPushObjectMode(this, state, chunk, encoding);\n};\n\n\nReadable.prototype.unshift = function(chunk, encoding) {\n debug('unshift', chunk);\n const state = this._readableState;\n return (state[kState] & kObjectMode) === 0 ?\n readableAddChunkUnshiftByteMode(this, state, chunk, encoding) :\n readableAddChunkUnshiftObjectMode(this, state, chunk);\n};\n\n\nfunction readableAddChunkUnshiftByteMode(stream, state, chunk, encoding) {\n if (chunk === null) {\n state[kState] &= ~kReading;\n onEofChunk(stream, state);\n\n return false;\n }\n\n if (typeof chunk === 'string') {\n encoding ||= state.defaultEncoding;\n if (state.encoding !== encoding) {\n if (state.encoding) {\n\n\n chunk = Buffer.from(chunk, encoding).toString(state.encoding);\n } else {\n chunk = Buffer.from(chunk, encoding);\n }\n }\n } else if (Stream._isArrayBufferView(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk);\n } else if (chunk !== undefined && !(chunk instanceof Buffer)) {\n errorOrDestroy(stream, new ERR_INVALID_ARG_TYPE(\n 'chunk', ['string', 'Buffer', 'TypedArray', 'DataView'], chunk));\n return false;\n }\n\n\n if (!(chunk && chunk.length > 0)) {\n return canPushMore(state);\n }\n\n return readableAddChunkUnshiftValue(stream, state, chunk);\n}\n\nfunction readableAddChunkUnshiftObjectMode(stream, state, chunk) {\n if (chunk === null) {\n state[kState] &= ~kReading;\n onEofChunk(stream, state);\n\n return false;\n }\n\n return readableAddChunkUnshiftValue(stream, state, chunk);\n}\n\nfunction readableAddChunkUnshiftValue(stream, state, chunk) {\n if ((state[kState] & kEndEmitted) !== 0)\n errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());\n else if ((state[kState] & (kDestroyed | kErrored)) !== 0)\n return false;\n else\n addChunk(stream, state, chunk, true);\n\n return canPushMore(state);\n}\n\nfunction readableAddChunkPushByteMode(stream, state, chunk, encoding) {\n if (chunk === null) {\n state[kState] &= ~kReading;\n onEofChunk(stream, state);\n return false;\n }\n\n if (typeof chunk === 'string') {\n encoding ||= state.defaultEncoding;\n if (state.encoding !== encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n } else if (chunk instanceof Buffer) {\n encoding = '';\n } else if (Stream._isArrayBufferView(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk);\n encoding = '';\n } else if (chunk !== undefined) {\n errorOrDestroy(stream, new ERR_INVALID_ARG_TYPE(\n 'chunk', ['string', 'Buffer', 'TypedArray', 'DataView'], chunk));\n return false;\n }\n\n if (!chunk || chunk.length <= 0) {\n state[kState] &= ~kReading;\n maybeReadMore(stream, state);\n\n return canPushMore(state);\n }\n\n if ((state[kState] & kEnded) !== 0) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n return false;\n }\n\n if ((state[kState] & (kDestroyed | kErrored)) !== 0) {\n return false;\n }\n\n state[kState] &= ~kReading;\n if ((state[kState] & kDecoder) !== 0 && !encoding) {\n chunk = state[kDecoderValue].write(chunk);\n if (chunk.length === 0) {\n maybeReadMore(stream, state);\n return canPushMore(state);\n }\n }\n\n addChunk(stream, state, chunk, false);\n return canPushMore(state);\n}\n\nfunction readableAddChunkPushObjectMode(stream, state, chunk, encoding) {\n if (chunk === null) {\n state[kState] &= ~kReading;\n onEofChunk(stream, state);\n return false;\n }\n\n if ((state[kState] & kEnded) !== 0) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n return false;\n }\n\n if ((state[kState] & (kDestroyed | kErrored)) !== 0) {\n return false;\n }\n\n state[kState] &= ~kReading;\n\n if ((state[kState] & kDecoder) !== 0 && !encoding) {\n chunk = state[kDecoderValue].write(chunk);\n }\n\n addChunk(stream, state, chunk, false);\n return canPushMore(state);\n}\n\nfunction canPushMore(state) {\n\n\n\n return (state[kState] & kEnded) === 0 &&\n (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if ((state[kState] & (kFlowing | kSync | kDataListening)) === (kFlowing | kDataListening) && state.length === 0) {\n\n\n if ((state[kState] & kMultiAwaitDrain) !== 0) {\n state.awaitDrainWriters.clear();\n } else {\n state.awaitDrainWriters = null;\n }\n\n state[kState] |= kDataEmitted;\n stream.emit('data', chunk);\n } else {\n\n state.length += (state[kState] & kObjectMode) !== 0 ? 1 : chunk.length;\n if (addToFront) {\n if (state.bufferIndex > 0) {\n state.buffer[--state.bufferIndex] = chunk;\n } else {\n state.buffer.unshift(chunk);\n }\n } else {\n state.buffer.push(chunk);\n }\n\n if ((state[kState] & kNeedReadable) !== 0)\n emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nReadable.prototype.isPaused = function() {\n const state = this._readableState;\n return (state[kState] & kPaused) !== 0 || (state[kState] & (kHasFlowing | kFlowing)) === kHasFlowing;\n};\n\n\nReadable.prototype.setEncoding = function(enc) {\n const state = this._readableState;\n\n const decoder = new StringDecoder(enc);\n state.decoder = decoder;\n\n state.encoding = state.decoder.encoding;\n\n\n let content = '';\n for (const data of state.buffer.slice(state.bufferIndex)) {\n content += decoder.write(data);\n }\n if ((state[kState] & kEnded) !== 0)\n content += decoder.end();\n state.buffer.length = 0;\n state.bufferIndex = 0;\n\n if (content !== '')\n state.buffer.push(content);\n state.length = content.length;\n return this;\n};\n\n\nconst MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n > MAX_HWM) {\n throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n);\n } else {\n\n\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || (state.length === 0 && (state[kState] & kEnded) !== 0))\n return 0;\n if ((state[kState] & kObjectMode) !== 0)\n return 1;\n if (NumberIsNaN(n)) {\n\n if ((state[kState] & kDecoder) === 0 && state.length)\n return state.buffer[state.bufferIndex].length;\n\n\n if ((state[kState] & kFlowing) !== 0 && state.length)\n return state.buffer[state.bufferIndex].length;\n\n return state.length;\n }\n if (n <= state.length)\n return n;\n return (state[kState] & kEnded) !== 0 ? state.length : 0;\n}\n\n\nReadable.prototype.read = function(n) {\n debug('read', n);\n\n\n if (n === undefined) {\n n = NaN;\n } else if (!NumberIsInteger(n)) {\n n = NumberParseInt(n, 10);\n }\n const state = this._readableState;\n const nOrig = n;\n\n\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n\n if (n !== 0)\n state[kState] &= ~(kEmittedReadable | kEofReadablePending);\n\n\n\n\n\n const stateLength = state.length;\n if (n === 0 &&\n (state[kState] & kNeedReadable) !== 0 &&\n ((state.highWaterMark !== 0 ?\n stateLength >= state.highWaterMark :\n stateLength > 0) ||\n (state[kState] & kEnded) !== 0)) {\n debug('read: emitReadable');\n if (stateLength === 0 && (state[kState] & kEnded) !== 0)\n endReadable(this);\n else\n emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n\n if (n === 0 && (state[kState] & kEnded) !== 0) {\n if (state.length === 0)\n endReadable(this);\n return null;\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n let doRead = (state[kState] & kNeedReadable) !== 0;\n debug('need readable', doRead);\n\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n\n\n\n if ((state[kState] & (kReading | kEnded | kDestroyed | kErrored | kConstructed)) !== kConstructed) {\n doRead = false;\n debug('reading, ended or constructing', doRead);\n } else if (doRead) {\n debug('do read');\n state[kState] |= kReading | kSync;\n\n if (state.length === 0)\n state[kState] |= kNeedReadable;\n\n\n try {\n this._read(state.highWaterMark);\n } catch (err) {\n errorOrDestroy(this, err);\n }\n state[kState] &= ~kSync;\n\n\n\n if ((state[kState] & kReading) === 0)\n n = howMuchToRead(nOrig, state);\n }\n\n let ret;\n if (n > 0)\n ret = fromList(n, state);\n else\n ret = null;\n\n if (ret === null) {\n state[kState] |= state.length <= state.highWaterMark ? kNeedReadable : 0;\n n = 0;\n } else {\n state.length -= n;\n if ((state[kState] & kMultiAwaitDrain) !== 0) {\n state.awaitDrainWriters.clear();\n } else {\n state.awaitDrainWriters = null;\n }\n }\n\n if (state.length === 0) {\n\n\n if ((state[kState] & kEnded) === 0)\n state[kState] |= kNeedReadable;\n\n\n if (nOrig !== n && (state[kState] & kEnded) !== 0)\n endReadable(this);\n }\n\n if (ret !== null && (state[kState] & (kErrorEmitted | kCloseEmitted)) === 0) {\n state[kState] |= kDataEmitted;\n this.emit('data', ret);\n }\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if ((state[kState] & kEnded) !== 0) return;\n const decoder = (state[kState] & kDecoder) !== 0 ? state[kDecoderValue] : null;\n if (decoder) {\n const chunk = decoder.end();\n if (chunk?.length) {\n state.buffer.push(chunk);\n state.length += (state[kState] & kObjectMode) !== 0 ? 1 : chunk.length;\n }\n }\n state[kState] |= kEnded;\n\n if ((state[kState] & kSync) !== 0) {\n\n\n\n if ((state[kState] & (kFlowing | kNeedReadable)) !== 0 ||\n stream.listenerCount('readable') > 0) {\n emitReadable(stream);\n } else {\n\n\n\n\n state[kState] |= kEofReadablePending;\n }\n } else {\n\n state[kState] &= ~kNeedReadable;\n state[kState] |= kEmittedReadable;\n\n\n emitReadable_(stream);\n }\n}\n\n\n\n\nfunction emitReadable(stream) {\n const state = stream._readableState;\n debug('emitReadable');\n state[kState] &= ~kNeedReadable;\n if ((state[kState] & kEmittedReadable) === 0) {\n debug('emitReadable', (state[kState] & kFlowing) !== 0);\n state[kState] |= kEmittedReadable;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n const state = stream._readableState;\n debug('emitReadable_');\n if ((state[kState] & (kDestroyed | kErrored)) === 0 && (state.length || (state[kState] & kEnded) !== 0)) {\n stream.emit('readable');\n state[kState] &= ~kEmittedReadable;\n }\n\n\n\n\n\n\n\n state[kState] |=\n (state[kState] & (kFlowing | kEnded)) === 0 &&\n state.length <= state.highWaterMark ? kNeedReadable : 0;\n flow(stream);\n}\n\n\n\n\n\n\n\n\nfunction maybeReadMore(stream, state) {\n if ((state[kState] & (kReadingMore | kReading | kConstructed)) === kConstructed) {\n state[kState] |= kReadingMore;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n while ((state[kState] & (kReading | kEnded)) === 0 &&\n (state.length < state.highWaterMark ||\n ((state[kState] & kFlowing) !== 0 && state.length === 0))) {\n const len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n\n break;\n }\n state[kState] &= ~kReadingMore;\n}\n\n\n\n\n\nReadable.prototype._read = function(n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_read()');\n};\n\nReadable.prototype.pipe = function(dest, pipeOpts) {\n const src = this;\n const state = this._readableState;\n\n if (state.pipes.length === 1) {\n if ((state[kState] & kMultiAwaitDrain) === 0) {\n state[kState] |= kMultiAwaitDrain;\n state.awaitDrainWriters = new SafeSet(\n state.awaitDrainWriters ? [state.awaitDrainWriters] : [],\n );\n }\n }\n\n state.pipes.push(dest);\n debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts);\n\n const doEnd = (!pipeOpts || pipeOpts.end !== false) &&\n dest !== process.stdout &&\n dest !== process.stderr;\n\n const endFn = doEnd ? onend : unpipe;\n if ((state[kState] & kEndEmitted) !== 0)\n process.nextTick(endFn);\n else\n src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n let ondrain;\n\n let cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n if (ondrain) {\n dest.removeListener('drain', ondrain);\n }\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n\n\n\n\n\n\n\n\n\n\n if (ondrain && state.awaitDrainWriters)\n ondrain();\n }\n\n function pause() {\n\n\n\n\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest) {\n debug('false write response, pause', 0);\n state.awaitDrainWriters = dest;\n state[kState] &= ~kMultiAwaitDrain;\n } else if (state.pipes.length > 1 && state.pipes.includes(dest)) {\n debug('false write response, pause', state.awaitDrainWriters.size);\n state.awaitDrainWriters.add(dest);\n }\n src.pause();\n }\n if (!ondrain) {\n\n\n\n\n ondrain = pipeOnDrain(src, dest);\n dest.on('drain', ondrain);\n }\n }\n\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n try {\n const ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n pause();\n }\n } catch (error) {\n dest.destroy(error);\n }\n }\n\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (dest.listenerCount('error') === 0) {\n const s = dest._writableState || dest._readableState;\n if (s && !s.errorEmitted) {\n\n errorOrDestroy(dest, er);\n } else {\n dest.emit('error', er);\n }\n }\n }\n\n\n prependListener(dest, 'error', onerror);\n\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n\n dest.emit('pipe', src);\n\n\n\n if (dest.writableNeedDrain === true) {\n pause();\n } else if ((state[kState] & kFlowing) === 0) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState;\n\n\n\n\n if (state.awaitDrainWriters === dest) {\n debug('pipeOnDrain', 1);\n state.awaitDrainWriters = null;\n } else if ((state[kState] & kMultiAwaitDrain) !== 0) {\n debug('pipeOnDrain', state.awaitDrainWriters.size);\n state.awaitDrainWriters.delete(dest);\n }\n\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) &&\n (state[kState] & kDataListening) !== 0) {\n src.resume();\n }\n };\n}\n\n\nReadable.prototype.unpipe = function(dest) {\n const state = this._readableState;\n const unpipeInfo = { hasUnpiped: false };\n\n\n if (state.pipes.length === 0)\n return this;\n\n if (!dest) {\n\n const dests = state.pipes;\n state.pipes = [];\n this.pause();\n\n for (let i = 0; i < dests.length; i++)\n dests[i].emit('unpipe', this, { hasUnpiped: false });\n return this;\n }\n\n\n const index = ArrayPrototypeIndexOf(state.pipes, dest);\n if (index === -1)\n return this;\n\n state.pipes.splice(index, 1);\n if (state.pipes.length === 0)\n this.pause();\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n\n\nReadable.prototype.on = function(ev, fn) {\n const res = Stream.prototype.on.call(this, ev, fn);\n const state = this._readableState;\n\n if (ev === 'data') {\n state[kState] |= kDataListening;\n\n\n\n state[kState] |= this.listenerCount('readable') > 0 ? kReadableListening : 0;\n\n\n if ((state[kState] & (kHasFlowing | kFlowing)) !== kHasFlowing) {\n this.resume();\n }\n } else if (ev === 'readable') {\n if ((state[kState] & (kEndEmitted | kReadableListening)) === 0) {\n state[kState] |= kReadableListening | kNeedReadable | kHasFlowing;\n state[kState] &= ~(kFlowing | kEmittedReadable);\n debug('on readable');\n if (state.length) {\n emitReadable(this);\n } else {\n if ((state[kState] & kEofReadablePending) !== 0) {\n\n\n\n state[kState] &= ~kEofReadablePending;\n emitReadable(this);\n }\n if ((state[kState] & kReading) === 0) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function(ev, fn) {\n const state = this._readableState;\n\n const res = Stream.prototype.removeListener.call(this,\n ev, fn);\n\n if (ev === 'readable') {\n\n\n\n\n\n\n process.nextTick(updateReadableListening, this);\n } else if (ev === 'data' && this.listenerCount('data') === 0) {\n state[kState] &= ~kDataListening;\n }\n\n return res;\n};\nReadable.prototype.off = Readable.prototype.removeListener;\n\nReadable.prototype.removeAllListeners = function(ev) {\n const res = ReflectApply(Stream.prototype.removeAllListeners, this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n\n\n\n\n\n\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n const state = self._readableState;\n\n if (self.listenerCount('readable') > 0) {\n state[kState] |= kReadableListening;\n } else {\n state[kState] &= ~kReadableListening;\n }\n\n if ((state[kState] & (kHasPaused | kPaused | kResumeScheduled)) === (kHasPaused | kResumeScheduled)) {\n\n\n state[kState] |= kHasFlowing | kFlowing;\n\n\n } else if ((state[kState] & kDataListening) !== 0) {\n self.resume();\n } else if ((state[kState] & kReadableListening) === 0) {\n state[kState] &= ~(kHasFlowing | kFlowing);\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n\n\nReadable.prototype.resume = function() {\n const state = this._readableState;\n if ((state[kState] & kDestroyed) !== 0) {\n return this;\n }\n if ((state[kState] & kFlowing) === 0) {\n debug('resume');\n\n\n\n state[kState] |= kHasFlowing;\n if ((state[kState] & kReadableListening) === 0) {\n state[kState] |= kFlowing;\n } else {\n state[kState] &= ~kFlowing;\n }\n resume(this, state);\n }\n state[kState] |= kHasPaused;\n state[kState] &= ~kPaused;\n return this;\n};\n\nfunction resume(stream, state) {\n if ((state[kState] & kResumeScheduled) === 0) {\n state[kState] |= kResumeScheduled;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', (state[kState] & kReading) !== 0);\n if ((state[kState] & kReading) === 0) {\n stream.read(0);\n }\n\n state[kState] &= ~kResumeScheduled;\n stream.emit('resume');\n flow(stream);\n if ((state[kState] & (kFlowing | kReading)) === kFlowing)\n stream.read(0);\n}\n\nReadable.prototype.pause = function() {\n const state = this._readableState;\n if ((state[kState] & kDestroyed) !== 0) {\n return this;\n }\n debug('call pause');\n if ((state[kState] & (kHasFlowing | kFlowing)) !== kHasFlowing) {\n debug('pause');\n state[kState] |= kHasFlowing;\n state[kState] &= ~kFlowing;\n this.emit('pause');\n }\n state[kState] |= kHasPaused | kPaused;\n return this;\n};\n\nfunction flow(stream) {\n const state = stream._readableState;\n debug('flow');\n while ((state[kState] & kFlowing) !== 0 && stream.read() !== null);\n}\n\n\n\n\nReadable.prototype.wrap = function(stream) {\n let paused = false;\n\n\n\n\n\n stream.on('data', (chunk) => {\n if (!this.push(chunk) && stream.pause) {\n paused = true;\n stream.pause();\n }\n });\n\n stream.on('end', () => {\n this.push(null);\n });\n\n stream.on('error', (err) => {\n errorOrDestroy(this, err);\n });\n\n stream.on('close', () => {\n this.destroy();\n });\n\n stream.on('destroy', () => {\n this.destroy();\n });\n\n this._read = () => {\n if (paused && stream.resume) {\n paused = false;\n stream.resume();\n }\n };\n\n\n const streamKeys = ObjectKeys(stream);\n for (let j = 0; j < streamKeys.length; j++) {\n const i = streamKeys[j];\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = stream[i].bind(stream);\n }\n }\n\n return this;\n};\n\nReadable.prototype[SymbolAsyncIterator] = function() {\n return streamToAsyncIterator(this);\n};\n\nReadable.prototype.iterator = function(options) {\n if (options !== undefined) {\n validateObject(options, 'options');\n }\n return streamToAsyncIterator(this, options);\n};\n\nfunction streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== 'function') {\n stream = Readable.wrap(stream, { objectMode: true });\n }\n\n const iter = createAsyncIterator(stream, options);\n iter.stream = stream;\n return iter;\n}\n\n\n\nfunction createAsyncIterator(stream, options) {\n let callback = nop;\n let error;\n let started = false;\n let completed = false;\n let inFlight = false;\n let queue = null;\n let draining = false;\n let cleanup;\n\n\n\n\n function wakeup(resolve) {\n if (this === stream) {\n callback();\n callback = nop;\n } else {\n callback = resolve;\n }\n }\n\n function start() {\n started = true;\n\n stream.on('readable', wakeup);\n\n cleanup = eos(stream, { writable: false }, (err) => {\n error = err ? aggregateTwoErrors(error, err) : null;\n callback();\n callback = nop;\n });\n }\n\n\n\n function finalize() {\n completed = true;\n\n const preserveHalfOpenDuplex =\n error === null &&\n stream.allowHalfOpen === true &&\n stream.writable === true &&\n stream.writableEnded !== true;\n\n if (\n (error || options?.destroyOnReturn !== false) &&\n (error === undefined || stream._readableState.autoDestroy) &&\n !preserveHalfOpenDuplex\n ) {\n destroyImpl.destroyer(stream, null);\n } else {\n stream.off('readable', wakeup);\n cleanup();\n }\n }\n\n function settleError(err, reject) {\n error = aggregateTwoErrors(error, err);\n finalize();\n reject(error);\n }\n\n function drain() {\n\n\n if (draining) {\n return;\n }\n draining = true;\n try {\n while (!inFlight && !queue.isEmpty()) {\n const req = queue.shift();\n if (req.type === 'next') {\n processNext(req.resolve, req.reject);\n } else if (req.type === 'return') {\n processReturn(req.value, req.resolve);\n } else {\n processThrow(req.value, req.reject);\n }\n }\n } finally {\n draining = false;\n }\n }\n\n\n\n function onChunkFulfilled(value) {\n inFlight = false;\n if (queue !== null) drain();\n return { done: false, value };\n }\n\n function onChunkRejected(err) {\n inFlight = false;\n error = aggregateTwoErrors(error, err);\n finalize();\n if (queue !== null) drain();\n throw error;\n }\n\n\n\n function pump(resolve, reject) {\n const chunk = stream.destroyed ? null : stream.read();\n if (chunk !== null) {\n\n\n const then = chunk.then;\n if (typeof then === 'function') {\n FunctionPrototypeCall(then, chunk, (value) => {\n inFlight = false;\n resolve({ done: false, value });\n if (queue !== null) drain();\n }, (err) => {\n inFlight = false;\n settleError(err, reject);\n if (queue !== null) drain();\n });\n return;\n }\n inFlight = false;\n resolve({ done: false, value: chunk });\n if (queue !== null) drain();\n } else if (error) {\n inFlight = false;\n settleError(error, reject);\n if (queue !== null) drain();\n } else if (error === null) {\n inFlight = false;\n finalize();\n resolve({ done: true, value: undefined });\n if (queue !== null) drain();\n } else {\n\n\n PromisePrototypeThen(new Promise(wakeup), () => pump(resolve, reject));\n }\n }\n\n function processNext(resolve, reject) {\n if (completed) {\n resolve({ done: true, value: undefined });\n return;\n }\n if (!started) start();\n inFlight = true;\n pump(resolve, reject);\n }\n\n function processReturn(value, resolve) {\n if (!completed) {\n if (started) {\n finalize();\n } else {\n\n completed = true;\n }\n }\n resolve({ done: true, value });\n }\n\n function processThrow(err, reject) {\n if (completed || !started) {\n completed = true;\n reject(err);\n return;\n }\n settleError(err, reject);\n }\n\n return {\n __proto__: AsyncIteratorPrototype,\n next() {\n if (!inFlight && !completed) {\n if (!started) start();\n\n const chunk = stream.destroyed ? null : stream.read();\n if (chunk !== null) {\n\n\n const then = chunk.then;\n if (typeof then === 'function') {\n inFlight = true;\n return FunctionPrototypeCall(\n then, chunk, onChunkFulfilled, onChunkRejected);\n }\n return PromiseResolve({ done: false, value: chunk });\n }\n if (error) {\n finalize();\n return PromiseReject(error);\n }\n if (error === null) {\n finalize();\n return PromiseResolve({ done: true, value: undefined });\n }\n\n inFlight = true;\n return new Promise((resolve, reject) => {\n PromisePrototypeThen(new Promise(wakeup), () => pump(resolve, reject));\n });\n }\n return new Promise((resolve, reject) => {\n if (inFlight) {\n queue ??= new FixedQueue();\n queue.push({ __proto__: null, type: 'next', value: undefined, resolve, reject });\n } else {\n resolve({ done: true, value: undefined });\n }\n });\n },\n return(value) {\n return new Promise((resolve, reject) => {\n if (inFlight) {\n queue ??= new FixedQueue();\n queue.push({ __proto__: null, type: 'return', value, resolve, reject });\n } else {\n processReturn(value, resolve);\n }\n });\n },\n throw(err) {\n return new Promise((resolve, reject) => {\n if (inFlight) {\n queue ??= new FixedQueue();\n queue.push({ __proto__: null, type: 'throw', value: err, resolve, reject });\n } else {\n processThrow(err, reject);\n }\n });\n },\n };\n}\n\nlet composeImpl;\n\nReadable.prototype.compose = function compose(stream, options) {\n if (options != null) {\n validateObject(options, 'options');\n }\n if (options?.signal != null) {\n validateAbortSignal(options.signal, 'options.signal');\n }\n\n composeImpl ??= require('internal/streams/compose');\n const composedStream = composeImpl(this, stream);\n\n if (options?.signal) {\n\n addAbortSignalNoValidate(\n options.signal,\n composedStream,\n );\n }\n\n return composedStream;\n};\n\n\n\n\nObjectDefineProperties(Readable.prototype, {\n readable: {\n __proto__: null,\n get() {\n const r = this._readableState;\n\n\n\n\n return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted &&\n !r.endEmitted;\n },\n set(val) {\n\n if (this._readableState) {\n this._readableState.readable = !!val;\n }\n },\n },\n\n readableDidRead: {\n __proto__: null,\n enumerable: false,\n get: function() {\n return this._readableState.dataEmitted;\n },\n },\n\n readableAborted: {\n __proto__: null,\n enumerable: false,\n get: function() {\n return !!(\n this._readableState.readable !== false &&\n (this._readableState.destroyed || this._readableState.errored) &&\n !this._readableState.endEmitted\n );\n },\n },\n\n readableHighWaterMark: {\n __proto__: null,\n enumerable: false,\n get: function() {\n return this._readableState.highWaterMark;\n },\n },\n\n readableBuffer: {\n __proto__: null,\n enumerable: false,\n get: function() {\n return this._readableState?.buffer;\n },\n },\n\n readableFlowing: {\n __proto__: null,\n enumerable: false,\n get: function() {\n return this._readableState.flowing;\n },\n set: function(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n },\n },\n\n readableLength: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState.length;\n },\n },\n\n readableObjectMode: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.objectMode : false;\n },\n },\n\n readableEncoding: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.encoding : null;\n },\n },\n\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.errored : null;\n },\n },\n\n closed: {\n __proto__: null,\n get() {\n return this._readableState ? this._readableState.closed : false;\n },\n },\n\n destroyed: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.destroyed : false;\n },\n set(value) {\n\n\n if (!this._readableState) {\n return;\n }\n\n\n\n this._readableState.destroyed = value;\n },\n },\n\n readableEnded: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.endEmitted : false;\n },\n },\n\n});\n\nObjectDefineProperties(ReadableState.prototype, {\n\n pipesCount: {\n __proto__: null,\n get() {\n return this.pipes.length;\n },\n },\n\n\n paused: {\n __proto__: null,\n get() {\n return (this[kState] & kPaused) !== 0;\n },\n set(value) {\n this[kState] |= kHasPaused;\n if (value) {\n this[kState] |= kPaused;\n } else {\n this[kState] &= ~kPaused;\n }\n },\n },\n});\n\n\nReadable._fromList = fromList;\n\n\n\n\n\nfunction fromList(n, state) {\n\n\n\n\n const stateLength = state.length;\n\n\n if (stateLength === 0)\n return null;\n\n let idx = state.bufferIndex;\n let ret;\n\n const buf = state.buffer;\n const len = buf.length;\n\n if ((state[kState] & kObjectMode) !== 0) {\n ret = buf[idx];\n buf[idx++] = null;\n } else if (!n || n >= stateLength) {\n\n if ((state[kState] & kDecoder) !== 0) {\n ret = '';\n while (idx < len) {\n ret += buf[idx];\n buf[idx++] = null;\n }\n } else if (len - idx === 0) {\n ret = new FastBuffer();\n } else if (len - idx === 1) {\n ret = buf[idx];\n buf[idx++] = null;\n } else {\n ret = Buffer.allocUnsafe(stateLength);\n\n let i = 0;\n while (idx < len) {\n const data = buf[idx];\n TypedArrayPrototypeSet(ret, data, i);\n i += data.length;\n buf[idx++] = null;\n }\n }\n } else {\n const first = buf[idx];\n const firstLength = first.length;\n if (n < firstLength) {\n\n ret = first.slice(0, n);\n buf[idx] = first.slice(n);\n } else if (n === firstLength) {\n\n ret = first;\n buf[idx++] = null;\n } else if ((state[kState] & kDecoder) !== 0) {\n ret = '';\n while (idx < len) {\n const str = buf[idx];\n const strLength = str.length;\n if (n > strLength) {\n ret += str;\n n -= strLength;\n buf[idx++] = null;\n } else {\n if (n === strLength) {\n ret += str;\n buf[idx++] = null;\n } else {\n ret += str.slice(0, n);\n buf[idx] = str.slice(n);\n }\n break;\n }\n }\n } else {\n ret = Buffer.allocUnsafe(n);\n\n const retLen = n;\n while (idx < len) {\n const data = buf[idx];\n const dataLength = data.length;\n if (n > dataLength) {\n TypedArrayPrototypeSet(ret, data, retLen - n);\n n -= dataLength;\n buf[idx++] = null;\n } else {\n if (n === dataLength) {\n TypedArrayPrototypeSet(ret, data, retLen - n);\n buf[idx++] = null;\n } else {\n TypedArrayPrototypeSet(ret, new FastBuffer(data.buffer, data.byteOffset, n), retLen - n);\n buf[idx] = new FastBuffer(data.buffer, data.byteOffset + n, dataLength - n);\n }\n break;\n }\n }\n }\n }\n\n if (idx === len) {\n state.buffer.length = 0;\n state.bufferIndex = 0;\n } else if (idx > 1024) {\n state.buffer.splice(0, idx);\n state.bufferIndex = 0;\n } else {\n state.bufferIndex = idx;\n }\n\n return ret;\n}\n\nfunction endReadable(stream) {\n const state = stream._readableState;\n\n debug('endReadable');\n if ((state[kState] & (kEndEmitted | kEndScheduled)) === 0) {\n state[kState] |= kEnded | kEndScheduled;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT');\n\n\n\n\n\n state[kState] &= ~kEndScheduled;\n\n\n if ((state[kState] & (kErrored | kCloseEmitted | kEndEmitted)) === 0 && state.length === 0) {\n state[kState] |= kEndEmitted;\n stream.emit('end');\n\n if (stream.writable && stream.allowHalfOpen === false) {\n process.nextTick(endWritableNT, stream);\n } else if (state.autoDestroy) {\n\n\n const wState = stream._writableState;\n const autoDestroy = !wState || (\n wState.autoDestroy &&\n\n\n (wState.finished || wState.writable === false)\n );\n\n if (autoDestroy) {\n stream.destroy();\n }\n }\n }\n}\n\nfunction endWritableNT(stream) {\n const writable = stream.writable && !stream.writableEnded &&\n !stream.destroyed;\n if (writable) {\n stream.end();\n }\n}\n\nReadable.from = function(iterable, opts) {\n return from(Readable, iterable, opts);\n};\n\nlet webStreamsAdapters;\n\n\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined)\n webStreamsAdapters = require('internal/webstreams/adapters');\n return webStreamsAdapters;\n}\n\nReadable.fromWeb = function(readableStream, options) {\n return lazyWebStreams().newStreamReadableFromReadableStream(\n readableStream,\n options);\n};\n\nReadable.toWeb = function(streamReadable, options) {\n return lazyWebStreams().newReadableStreamFromStreamReadable(\n streamReadable,\n options);\n};\n\nReadable.wrap = function(src, options) {\n return new Readable({\n objectMode: src.readableObjectMode ?? src.objectMode ?? true,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err);\n callback(err);\n },\n }).wrap(src);\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\n{\n const toAsyncStreamable = SymbolFor('Stream.toAsyncStreamable');\n let createBatchedAsyncIterator;\n let normalizeBatch;\n let kValidatedSource;\n\n Readable.prototype[toAsyncStreamable] = function() {\n if (createBatchedAsyncIterator === undefined) {\n if (!getOptionValue('--experimental-stream-iter')) {\n throw new ERR_STREAM_ITER_MISSING_FLAG();\n }\n ({\n createBatchedAsyncIterator,\n normalizeBatch,\n } = require('internal/streams/iter/classic'));\n ({ kValidatedSource } = require('internal/streams/iter/types'));\n }\n const state = this._readableState;\n const normalize = (state.objectMode || state.encoding) ?\n normalizeBatch : null;\n const iter = createBatchedAsyncIterator(this, normalize);\n iter[kValidatedSource] = true;\n iter.stream = this;\n return iter;\n };\n}\n","internal/streams/state.js":"'use strict';\n\nconst {\n MathFloor,\n NumberIsInteger,\n} = primordials;\nconst { validateInteger } = require('internal/validators');\n\nconst { ERR_INVALID_ARG_VALUE } = require('internal/errors').codes;\n\n\nlet defaultHighWaterMarkBytes = process.platform === 'win32' ? 16 * 1024 : 64 * 1024;\nlet defaultHighWaterMarkObjectMode = 16;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark :\n isDuplex ? options[duplexKey] : null;\n}\n\nfunction getDefaultHighWaterMark(objectMode) {\n return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes;\n}\n\nfunction setDefaultHighWaterMark(objectMode, value) {\n validateInteger(value, 'value', 0);\n if (objectMode) {\n defaultHighWaterMarkObjectMode = value;\n } else {\n defaultHighWaterMarkBytes = value;\n }\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark';\n throw new ERR_INVALID_ARG_VALUE(name, hwm);\n }\n return MathFloor(hwm);\n }\n\n\n return getDefaultHighWaterMark(state.objectMode);\n}\n\nmodule.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark,\n setDefaultHighWaterMark,\n};\n","internal/streams/transform.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'use strict';\n\nconst {\n ObjectSetPrototypeOf,\n Symbol,\n} = primordials;\n\nmodule.exports = Transform;\nconst {\n ERR_METHOD_NOT_IMPLEMENTED,\n} = require('internal/errors').codes;\nconst Duplex = require('internal/streams/duplex');\nconst { getHighWaterMark } = require('internal/streams/state');\nObjectSetPrototypeOf(Transform.prototype, Duplex.prototype);\nObjectSetPrototypeOf(Transform, Duplex);\n\nconst kCallback = Symbol('kCallback');\n\nfunction Transform(options) {\n if (!(this instanceof Transform))\n return new Transform(options);\n\n\n\n\n const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null;\n if (readableHighWaterMark === 0) {\n\n\n\n options = {\n ...options,\n highWaterMark: null,\n readableHighWaterMark,\n writableHighWaterMark: options.writableHighWaterMark || 0,\n };\n }\n\n Duplex.call(this, options);\n\n\n\n\n this._readableState.sync = false;\n\n this[kCallback] = null;\n\n if (options) {\n if (typeof options.transform === 'function')\n this._transform = options.transform;\n\n if (typeof options.flush === 'function')\n this._flush = options.flush;\n }\n\n\n\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction final(cb) {\n if (typeof this._flush === 'function' && !this.destroyed) {\n this._flush((er, data) => {\n if (er) {\n if (cb) {\n cb(er);\n } else {\n this.destroy(er);\n }\n return;\n }\n\n if (data != null) {\n this.push(data);\n }\n this.push(null);\n if (cb) {\n cb();\n }\n });\n } else {\n this.push(null);\n if (cb) {\n cb();\n }\n }\n}\n\nfunction prefinish() {\n if (this._final !== final) {\n final.call(this);\n }\n}\n\nTransform.prototype._final = final;\n\nTransform.prototype._transform = function(chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()');\n};\n\nTransform.prototype._write = function(chunk, encoding, callback) {\n const rState = this._readableState;\n const wState = this._writableState;\n const length = rState.length;\n\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err);\n return;\n }\n\n if (val != null) {\n this.push(val);\n }\n\n if (rState.ended) {\n\n\n\n process.nextTick(callback);\n } else if (\n wState.ended ||\n length === rState.length ||\n rState.length < rState.highWaterMark\n ) {\n callback();\n } else {\n this[kCallback] = callback;\n }\n });\n};\n\nTransform.prototype._read = function() {\n if (this[kCallback]) {\n const callback = this[kCallback];\n this[kCallback] = null;\n callback();\n }\n};\n","internal/streams/utils.js":"'use strict';\n\nconst {\n Symbol,\n SymbolAsyncIterator,\n SymbolFor,\n SymbolIterator,\n} = primordials;\n\n\n\n\n\nconst kIsDestroyed = SymbolFor('nodejs.stream.destroyed');\nconst kIsErrored = SymbolFor('nodejs.stream.errored');\nconst kIsReadable = SymbolFor('nodejs.stream.readable');\nconst kIsWritable = SymbolFor('nodejs.stream.writable');\nconst kIsDisturbed = SymbolFor('nodejs.stream.disturbed');\n\nconst kOnConstructed = Symbol('kOnConstructed');\n\nconst kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise');\nconst kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction');\n\nconst kState = Symbol('kState');\nconst kObjectMode = 1 << 0;\nconst kErrorEmitted = 1 << 1;\nconst kAutoDestroy = 1 << 2;\nconst kEmitClose = 1 << 3;\nconst kDestroyed = 1 << 4;\nconst kClosed = 1 << 5;\nconst kCloseEmitted = 1 << 6;\nconst kErrored = 1 << 7;\nconst kConstructed = 1 << 8;\n\nfunction isReadableNodeStream(obj, strict = false) {\n return !!(\n obj &&\n typeof obj.pipe === 'function' &&\n typeof obj.on === 'function' &&\n (\n !strict ||\n (typeof obj.pause === 'function' && typeof obj.resume === 'function')\n ) &&\n (!obj._writableState || obj._readableState?.readable !== false) &&\n (!obj._writableState || obj._readableState)\n );\n}\n\nfunction isWritableNodeStream(obj) {\n return !!(\n obj &&\n typeof obj.write === 'function' &&\n typeof obj.on === 'function' &&\n (!obj._readableState || obj._writableState?.writable !== false)\n );\n}\n\nfunction isDuplexNodeStream(obj) {\n return !!(\n obj &&\n (typeof obj.pipe === 'function' && obj._readableState) &&\n typeof obj.on === 'function' &&\n typeof obj.write === 'function'\n );\n}\n\nfunction isNodeStream(obj) {\n return (\n obj &&\n (\n obj._readableState ||\n obj._writableState ||\n (typeof obj.write === 'function' && typeof obj.on === 'function') ||\n (typeof obj.pipe === 'function' && typeof obj.on === 'function')\n )\n );\n}\n\nfunction isReadableStream(obj) {\n return !!(\n obj &&\n !isNodeStream(obj) &&\n typeof obj.pipeThrough === 'function' &&\n typeof obj.getReader === 'function' &&\n typeof obj.cancel === 'function'\n );\n}\n\nfunction isWritableStream(obj) {\n return !!(\n obj &&\n !isNodeStream(obj) &&\n typeof obj.getWriter === 'function' &&\n typeof obj.abort === 'function'\n );\n}\n\nfunction isTransformStream(obj) {\n return !!(\n obj &&\n !isNodeStream(obj) &&\n typeof obj.readable === 'object' &&\n typeof obj.writable === 'object'\n );\n}\n\nfunction isWebStream(obj) {\n return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj);\n}\n\nfunction isIterable(obj, isAsync) {\n if (obj == null) return false;\n if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function';\n if (isAsync === false) return typeof obj[SymbolIterator] === 'function';\n return typeof obj[SymbolAsyncIterator] === 'function' ||\n typeof obj[SymbolIterator] === 'function';\n}\n\nfunction isDestroyed(stream) {\n if (!isNodeStream(stream)) return null;\n const wState = stream._writableState;\n const rState = stream._readableState;\n const state = wState || rState;\n return !!(stream.destroyed || stream[kIsDestroyed] || state?.destroyed);\n}\n\n\nfunction isWritableEnded(stream) {\n if (!isWritableNodeStream(stream)) return null;\n if (stream.writableEnded === true) return true;\n const wState = stream._writableState;\n if (wState?.errored) return false;\n if (typeof wState?.ended !== 'boolean') return null;\n return wState.ended;\n}\n\n\nfunction isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream)) return null;\n if (stream.writableFinished === true) return true;\n const wState = stream._writableState;\n if (wState?.errored) return false;\n if (typeof wState?.finished !== 'boolean') return null;\n return !!(\n wState.finished ||\n (strict === false && wState.ended === true && wState.length === 0)\n );\n}\n\n\nfunction isReadableEnded(stream) {\n if (!isReadableNodeStream(stream)) return null;\n if (stream.readableEnded === true) return true;\n const rState = stream._readableState;\n if (!rState || rState.errored) return false;\n if (typeof rState?.ended !== 'boolean') return null;\n return rState.ended;\n}\n\n\nfunction isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream)) return null;\n const rState = stream._readableState;\n if (rState?.errored) return false;\n if (typeof rState?.endEmitted !== 'boolean') return null;\n return !!(\n rState.endEmitted ||\n (strict === false && rState.ended === true && rState.length === 0)\n );\n}\n\nfunction isReadable(stream) {\n if (stream && stream[kIsReadable] != null) return stream[kIsReadable];\n if (typeof stream?.readable !== 'boolean') return null;\n if (isDestroyed(stream)) return false;\n return isReadableNodeStream(stream) &&\n stream.readable &&\n !isReadableFinished(stream);\n}\n\nfunction isWritable(stream) {\n if (stream && stream[kIsWritable] != null) return stream[kIsWritable];\n if (typeof stream?.writable !== 'boolean') return null;\n if (isDestroyed(stream)) return false;\n return isWritableNodeStream(stream) &&\n stream.writable &&\n !isWritableEnded(stream);\n}\n\nfunction isFinished(stream, opts) {\n if (!isNodeStream(stream)) {\n return null;\n }\n\n if (isDestroyed(stream)) {\n return true;\n }\n\n if (opts?.readable !== false && isReadable(stream)) {\n return false;\n }\n\n if (opts?.writable !== false && isWritable(stream)) {\n return false;\n }\n\n return true;\n}\n\nfunction isWritableErrored(stream) {\n if (!isNodeStream(stream)) {\n return null;\n }\n\n if (stream.writableErrored) {\n return stream.writableErrored;\n }\n\n return stream._writableState?.errored ?? null;\n}\n\nfunction isReadableErrored(stream) {\n if (!isNodeStream(stream)) {\n return null;\n }\n\n if (stream.readableErrored) {\n return stream.readableErrored;\n }\n\n return stream._readableState?.errored ?? null;\n}\n\nfunction isClosed(stream) {\n if (!isNodeStream(stream)) {\n return null;\n }\n\n if (typeof stream.closed === 'boolean') {\n return stream.closed;\n }\n\n const wState = stream._writableState;\n const rState = stream._readableState;\n\n if (\n typeof wState?.closed === 'boolean' ||\n typeof rState?.closed === 'boolean'\n ) {\n return wState?.closed || rState?.closed;\n }\n\n if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) {\n return stream._closed;\n }\n\n return null;\n}\n\nfunction isOutgoingMessage(stream) {\n return (\n typeof stream._closed === 'boolean' &&\n typeof stream._defaultKeepAlive === 'boolean' &&\n typeof stream._removedConnection === 'boolean' &&\n typeof stream._removedContLen === 'boolean'\n );\n}\n\nfunction isServerResponse(stream) {\n return (\n typeof stream._sent100 === 'boolean' &&\n isOutgoingMessage(stream)\n );\n}\n\nfunction isServerRequest(stream) {\n return (\n typeof stream._consuming === 'boolean' &&\n typeof stream._dumped === 'boolean' &&\n stream.req?.upgradeOrConnect === undefined\n );\n}\n\nfunction willEmitClose(stream) {\n if (!isNodeStream(stream)) return null;\n\n const wState = stream._writableState;\n const rState = stream._readableState;\n const state = wState || rState;\n\n return (!state && isServerResponse(stream)) || !!(\n state?.autoDestroy &&\n state.emitClose &&\n state.closed === false\n );\n}\n\nfunction isDisturbed(stream) {\n return !!(stream && (\n stream[kIsDisturbed] ??\n (stream.readableDidRead || stream.readableAborted)\n ));\n}\n\nfunction isErrored(stream) {\n return !!(stream && (\n stream[kIsErrored] ??\n stream.readableErrored ??\n stream.writableErrored ??\n stream._readableState?.errorEmitted ??\n stream._writableState?.errorEmitted ??\n stream._readableState?.errored ??\n stream._writableState?.errored\n ));\n}\n\nmodule.exports = {\n kOnConstructed,\n isDestroyed,\n kIsDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n kIsClosedPromise,\n kControllerErrorFunction,\n kIsWritable,\n isClosed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWebStream,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose,\n isTransformStream,\n kState,\n\n kObjectMode,\n kErrorEmitted,\n kAutoDestroy,\n kEmitClose,\n kDestroyed,\n kClosed,\n kCloseEmitted,\n kErrored,\n kConstructed,\n};\n","internal/streams/writable.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n\n\n'use strict';\n\nconst {\n ArrayPrototypeSlice,\n Error,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectSetPrototypeOf,\n Promise,\n StringPrototypeToLowerCase,\n Symbol,\n SymbolAsyncDispose,\n SymbolHasInstance,\n} = primordials;\n\nmodule.exports = Writable;\nWritable.WritableState = WritableState;\n\nconst EE = require('events');\nconst Stream = require('internal/streams/legacy').Stream;\nconst { Buffer } = require('buffer');\nconst destroyImpl = require('internal/streams/destroy');\nconst { eos } = require('internal/streams/end-of-stream');\nconst {\n addAbortSignal,\n} = require('internal/streams/add-abort-signal');\n\nconst {\n getHighWaterMark,\n getDefaultHighWaterMark,\n} = require('internal/streams/state');\nconst {\n AbortError,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING,\n },\n} = require('internal/errors');\nconst {\n kState,\n\n kObjectMode,\n kErrorEmitted,\n kAutoDestroy,\n kEmitClose,\n kDestroyed,\n kClosed,\n kCloseEmitted,\n kErrored,\n kConstructed,\n kOnConstructed,\n} = require('internal/streams/utils');\n\nconst { assignFunctionName } = require('internal/util');\n\nconst { errorOrDestroy } = destroyImpl;\n\nObjectSetPrototypeOf(Writable.prototype, Stream.prototype);\nObjectSetPrototypeOf(Writable, Stream);\n\nfunction nop() {}\n\nconst kOnFinishedValue = Symbol('kOnFinishedValue');\nconst kErroredValue = Symbol('kErroredValue');\nconst kDefaultEncodingValue = Symbol('kDefaultEncodingValue');\nconst kWriteCbValue = Symbol('kWriteCbValue');\nconst kAfterWriteTickInfoValue = Symbol('kAfterWriteTickInfoValue');\nconst kBufferedValue = Symbol('kBufferedValue');\n\nconst kSync = 1 << 9;\nconst kFinalCalled = 1 << 10;\nconst kNeedDrain = 1 << 11;\nconst kEnding = 1 << 12;\nconst kFinished = 1 << 13;\nconst kDecodeStrings = 1 << 14;\nconst kWriting = 1 << 15;\nconst kBufferProcessing = 1 << 16;\nconst kPrefinished = 1 << 17;\nconst kAllBuffers = 1 << 18;\nconst kAllNoop = 1 << 19;\nconst kOnFinished = 1 << 20;\nconst kHasWritable = 1 << 21;\nconst kWritable = 1 << 22;\nconst kCorked = 1 << 23;\nconst kDefaultUTF8Encoding = 1 << 24;\nconst kWriteCb = 1 << 25;\nconst kExpectWriteCb = 1 << 26;\nconst kAfterWriteTickInfo = 1 << 27;\nconst kAfterWritePending = 1 << 28;\nconst kBuffered = 1 << 29;\nconst kEnded = 1 << 30;\n\n\nfunction makeBitMapDescriptor(bit) {\n return {\n enumerable: false,\n get() { return (this[kState] & bit) !== 0; },\n set(value) {\n if (value) this[kState] |= bit;\n else this[kState] &= ~bit;\n },\n };\n}\nObjectDefineProperties(WritableState.prototype, {\n\n\n objectMode: makeBitMapDescriptor(kObjectMode),\n\n\n finalCalled: makeBitMapDescriptor(kFinalCalled),\n\n\n needDrain: makeBitMapDescriptor(kNeedDrain),\n\n\n ending: makeBitMapDescriptor(kEnding),\n\n\n ended: makeBitMapDescriptor(kEnded),\n\n\n finished: makeBitMapDescriptor(kFinished),\n\n\n destroyed: makeBitMapDescriptor(kDestroyed),\n\n\n\n\n decodeStrings: makeBitMapDescriptor(kDecodeStrings),\n\n\n writing: makeBitMapDescriptor(kWriting),\n\n\n\n\n\n sync: makeBitMapDescriptor(kSync),\n\n\n\n\n bufferProcessing: makeBitMapDescriptor(kBufferProcessing),\n\n\n\n\n\n constructed: makeBitMapDescriptor(kConstructed),\n\n\n\n prefinished: makeBitMapDescriptor(kPrefinished),\n\n\n errorEmitted: makeBitMapDescriptor(kErrorEmitted),\n\n\n emitClose: makeBitMapDescriptor(kEmitClose),\n\n\n autoDestroy: makeBitMapDescriptor(kAutoDestroy),\n\n\n closed: makeBitMapDescriptor(kClosed),\n\n\n\n closeEmitted: makeBitMapDescriptor(kCloseEmitted),\n\n allBuffers: makeBitMapDescriptor(kAllBuffers),\n allNoop: makeBitMapDescriptor(kAllNoop),\n\n\n\n\n\n errored: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kErrored) !== 0 ? this[kErroredValue] : null; },\n set(value) {\n if (value) {\n this[kErroredValue] = value;\n this[kState] |= kErrored;\n } else {\n this[kState] &= ~kErrored;\n }\n },\n },\n\n writable: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kHasWritable) !== 0 ? (this[kState] & kWritable) !== 0 : undefined; },\n set(value) {\n if (value == null) {\n this[kState] &= ~(kHasWritable | kWritable);\n } else if (value) {\n this[kState] |= (kHasWritable | kWritable);\n } else {\n this[kState] |= kHasWritable;\n this[kState] &= ~kWritable;\n }\n },\n },\n\n defaultEncoding: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : this[kDefaultEncodingValue]; },\n set(value) {\n if (value === 'utf8' || value === 'utf-8') {\n this[kState] |= kDefaultUTF8Encoding;\n } else {\n this[kState] &= ~kDefaultUTF8Encoding;\n this[kDefaultEncodingValue] = value;\n }\n },\n },\n\n\n writecb: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kWriteCb) !== 0 ? this[kWriteCbValue] : nop; },\n set(value) {\n this[kWriteCbValue] = value;\n if (value) {\n this[kState] |= kWriteCb;\n } else {\n this[kState] &= ~kWriteCb;\n }\n },\n },\n\n\n\n afterWriteTickInfo: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kAfterWriteTickInfo) !== 0 ? this[kAfterWriteTickInfoValue] : null; },\n set(value) {\n this[kAfterWriteTickInfoValue] = value;\n if (value) {\n this[kState] |= kAfterWriteTickInfo;\n } else {\n this[kState] &= ~kAfterWriteTickInfo;\n }\n },\n },\n\n buffered: {\n __proto__: null,\n enumerable: false,\n get() { return (this[kState] & kBuffered) !== 0 ? this[kBufferedValue] : []; },\n set(value) {\n this[kBufferedValue] = value;\n if (value) {\n this[kState] |= kBuffered;\n } else {\n this[kState] &= ~kBuffered;\n }\n },\n },\n\n});\n\nfunction WritableState(options, stream, isDuplex) {\n\n\n this[kState] = kSync | kConstructed | kEmitClose | kAutoDestroy;\n\n if (options?.objectMode)\n this[kState] |= kObjectMode;\n\n if (isDuplex && options?.writableObjectMode)\n this[kState] |= kObjectMode;\n\n\n\n\n this.highWaterMark = options ?\n getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) :\n getDefaultHighWaterMark(false);\n\n if (!options || options.decodeStrings !== false) this[kState] |= kDecodeStrings;\n\n\n if (options && options.emitClose === false) this[kState] &= ~kEmitClose;\n\n\n if (options && options.autoDestroy === false) this[kState] &= ~kAutoDestroy;\n\n\n\n\n const defaultEncoding = options ? options.defaultEncoding : null;\n if (defaultEncoding == null || defaultEncoding === 'utf8' || defaultEncoding === 'utf-8') {\n this[kState] |= kDefaultUTF8Encoding;\n } else if (Buffer.isEncoding(defaultEncoding)) {\n this[kState] &= ~kDefaultUTF8Encoding;\n this[kDefaultEncodingValue] = defaultEncoding;\n } else {\n throw new ERR_UNKNOWN_ENCODING(defaultEncoding);\n }\n\n\n\n\n this.length = 0;\n\n\n this.corked = 0;\n\n\n this.onwrite = (er) => onwrite(stream, er);\n\n\n this.writelen = 0;\n\n resetBuffer(this);\n\n\n\n this.pendingcb = 0;\n}\n\nfunction resetBuffer(state) {\n state[kBufferedValue] = null;\n state.bufferedIndex = 0;\n state[kState] |= kAllBuffers | kAllNoop;\n state[kState] &= ~kBuffered;\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n return (this[kState] & kBuffered) === 0 ? [] : ArrayPrototypeSlice(this.buffered, this.bufferedIndex);\n};\n\nObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', {\n __proto__: null,\n get() {\n return (this[kState] & kBuffered) === 0 ? 0 : this[kBufferedValue].length - this.bufferedIndex;\n },\n});\n\nWritableState.prototype[kOnConstructed] = function onConstructed(stream) {\n if ((this[kState] & kWriting) === 0) {\n clearBuffer(stream, this);\n }\n\n if ((this[kState] & kEnding) !== 0) {\n finishMaybe(stream, this);\n }\n};\n\nfunction Writable(options) {\n if (!(this instanceof Writable))\n return new Writable(options);\n\n this._events ??= {\n close: undefined,\n error: undefined,\n prefinish: undefined,\n finish: undefined,\n drain: undefined,\n\n\n\n };\n\n this._writableState = new WritableState(options, this, false);\n\n if (options) {\n if (typeof options.write === 'function')\n this._write = options.write;\n\n if (typeof options.writev === 'function')\n this._writev = options.writev;\n\n if (typeof options.destroy === 'function')\n this._destroy = options.destroy;\n\n if (typeof options.final === 'function')\n this._final = options.final;\n\n if (typeof options.construct === 'function')\n this._construct = options.construct;\n\n if (options.signal)\n addAbortSignal(options.signal, this);\n }\n\n Stream.call(this, options);\n\n if (this._construct != null) {\n destroyImpl.construct(this, () => {\n this._writableState[kOnConstructed](this);\n });\n }\n}\n\nObjectDefineProperty(Writable, SymbolHasInstance, {\n __proto__: null,\n value: assignFunctionName(SymbolHasInstance, function(instance) {\n if (FunctionPrototypeSymbolHasInstance(this, instance)) return true;\n if (this !== Writable) return false;\n\n return instance && instance._writableState instanceof WritableState;\n }),\n});\n\n\nWritable.prototype.pipe = function() {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction _write(stream, chunk, encoding, cb) {\n const state = stream._writableState;\n\n if (cb == null || typeof cb !== 'function') {\n cb = nop;\n }\n\n if (chunk === null) {\n throw new ERR_STREAM_NULL_VALUES();\n }\n\n if ((state[kState] & kObjectMode) === 0) {\n if (!encoding) {\n encoding = (state[kState] & kDefaultUTF8Encoding) !== 0 ? 'utf8' : state.defaultEncoding;\n } else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) {\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n\n if (typeof chunk === 'string') {\n if (encoding === 'buffer') {\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n if ((state[kState] & kDecodeStrings) !== 0) {\n chunk = Buffer.from(chunk, encoding);\n encoding = 'buffer';\n }\n } else if (chunk instanceof Buffer) {\n encoding = 'buffer';\n } else if (Stream._isArrayBufferView(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk);\n encoding = 'buffer';\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'chunk', ['string', 'Buffer', 'TypedArray', 'DataView'], chunk);\n }\n }\n\n let err;\n if ((state[kState] & kEnding) !== 0) {\n err = new ERR_STREAM_WRITE_AFTER_END();\n } else if ((state[kState] & kDestroyed) !== 0) {\n err = new ERR_STREAM_DESTROYED('write');\n }\n\n if (err) {\n process.nextTick(cb, err);\n errorOrDestroy(stream, err, true);\n return err;\n }\n\n state.pendingcb++;\n return writeOrBuffer(stream, state, chunk, encoding, cb);\n}\n\nWritable.prototype.write = function(chunk, encoding, cb) {\n if (encoding != null && typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n return _write(this, chunk, encoding, cb) === true;\n};\n\nWritable.prototype.cork = function() {\n const state = this._writableState;\n\n state[kState] |= kCorked;\n state.corked++;\n};\n\nWritable.prototype.uncork = function() {\n const state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.corked) {\n state[kState] &= ~kCorked;\n }\n\n if ((state[kState] & kWriting) === 0)\n clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n\n if (typeof encoding === 'string')\n encoding = StringPrototypeToLowerCase(encoding);\n if (!Buffer.isEncoding(encoding))\n throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\n\n\n\nfunction writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = (state[kState] & kObjectMode) !== 0 ? 1 : chunk.length;\n\n state.length += len;\n\n if ((state[kState] & (kWriting | kErrored | kCorked | kConstructed)) !== kConstructed) {\n if ((state[kState] & kBuffered) === 0) {\n state[kState] |= kBuffered;\n state[kBufferedValue] = [];\n }\n\n state[kBufferedValue].push({ chunk, encoding, callback });\n if ((state[kState] & kAllBuffers) !== 0 && encoding !== 'buffer') {\n state[kState] &= ~kAllBuffers;\n }\n if ((state[kState] & kAllNoop) !== 0 && callback !== nop) {\n state[kState] &= ~kAllNoop;\n }\n } else {\n state.writelen = len;\n if (callback !== nop) {\n state.writecb = callback;\n }\n state[kState] |= kWriting | kSync | kExpectWriteCb;\n stream._write(chunk, encoding, state.onwrite);\n state[kState] &= ~kSync;\n }\n\n const ret = state.length < state.highWaterMark || state.length === 0;\n\n if (!ret) {\n state[kState] |= kNeedDrain;\n }\n\n\n\n return ret && (state[kState] & (kDestroyed | kErrored)) === 0;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n if (cb !== nop) {\n state.writecb = cb;\n }\n state[kState] |= kWriting | kSync | kExpectWriteCb;\n if ((state[kState] & kDestroyed) !== 0)\n state.onwrite(new ERR_STREAM_DESTROYED('write'));\n else if (writev)\n stream._writev(chunk, state.onwrite);\n else\n stream._write(chunk, encoding, state.onwrite);\n state[kState] &= ~kSync;\n}\n\nfunction onwriteError(stream, state, er, cb) {\n --state.pendingcb;\n\n cb(er);\n\n\n\n\n errorBuffer(state);\n\n errorOrDestroy(stream, er);\n}\n\nfunction onwrite(stream, er) {\n const state = stream._writableState;\n\n if ((state[kState] & kExpectWriteCb) === 0) {\n errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK());\n return;\n }\n\n const sync = (state[kState] & kSync) !== 0;\n const cb = (state[kState] & kWriteCb) !== 0 ? state[kWriteCbValue] : nop;\n\n state.writecb = null;\n state[kState] &= ~(kWriting | kExpectWriteCb);\n state.length -= state.writelen;\n state.writelen = 0;\n\n if (er) {\n\n er.stack;\n\n if ((state[kState] & kErrored) === 0) {\n state[kErroredValue] = er;\n state[kState] |= kErrored;\n }\n\n\n\n if (stream._readableState && !stream._readableState.errored) {\n stream._readableState.errored = er;\n }\n\n if (sync) {\n process.nextTick(onwriteError, stream, state, er, cb);\n } else {\n onwriteError(stream, state, er, cb);\n }\n } else {\n if ((state[kState] & kBuffered) !== 0) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n const needDrain = (state[kState] & kNeedDrain) !== 0 && state.length === 0;\n const needTick = needDrain || (state[kState] & kDestroyed !== 0) || cb !== nop;\n\n\n\n\n\n if (cb === nop) {\n if ((state[kState] & kAfterWritePending) === 0 && needTick) {\n process.nextTick(afterWrite, stream, state, 1, cb);\n state[kState] |= kAfterWritePending;\n } else {\n state.pendingcb--;\n if ((state[kState] & kEnding) !== 0) {\n finishMaybe(stream, state, true);\n }\n }\n } else if ((state[kState] & kAfterWriteTickInfo) !== 0 &&\n state[kAfterWriteTickInfoValue].cb === cb) {\n state[kAfterWriteTickInfoValue].count++;\n } else if (needTick) {\n state[kAfterWriteTickInfoValue] = { count: 1, cb, stream, state };\n process.nextTick(afterWriteTick, state[kAfterWriteTickInfoValue]);\n state[kState] |= (kAfterWritePending | kAfterWriteTickInfo);\n } else {\n state.pendingcb--;\n if ((state[kState] & kEnding) !== 0) {\n finishMaybe(stream, state, true);\n }\n }\n } else {\n afterWrite(stream, state, 1, cb);\n }\n }\n}\n\nfunction afterWriteTick({ stream, state, count, cb }) {\n state[kState] &= ~kAfterWriteTickInfo;\n state[kAfterWriteTickInfoValue] = null;\n return afterWrite(stream, state, count, cb);\n}\n\nfunction afterWrite(stream, state, count, cb) {\n state[kState] &= ~kAfterWritePending;\n\n const needDrain = (state[kState] & (kEnding | kNeedDrain | kDestroyed)) === kNeedDrain && state.length === 0;\n if (needDrain) {\n state[kState] &= ~kNeedDrain;\n stream.emit('drain');\n }\n\n while (count-- > 0) {\n state.pendingcb--;\n cb(null);\n }\n\n if ((state[kState] & kDestroyed) !== 0) {\n errorBuffer(state);\n }\n\n if ((state[kState] & kEnding) !== 0) {\n finishMaybe(stream, state, true);\n }\n}\n\n\nfunction errorBuffer(state) {\n if ((state[kState] & kWriting) !== 0) {\n return;\n }\n\n if ((state[kState] & kBuffered) !== 0) {\n for (let n = state.bufferedIndex; n < state.buffered.length; ++n) {\n const { chunk, callback } = state[kBufferedValue][n];\n const len = (state[kState] & kObjectMode) !== 0 ? 1 : chunk.length;\n state.length -= len;\n callback(state.errored ?? new ERR_STREAM_DESTROYED('write'));\n }\n }\n\n\n callFinishedCallbacks(state, state.errored ?? new ERR_STREAM_DESTROYED('end'));\n\n resetBuffer(state);\n}\n\n\nfunction clearBuffer(stream, state) {\n if ((state[kState] & (kDestroyed | kBufferProcessing | kCorked | kBuffered | kConstructed)) !==\n (kBuffered | kConstructed)) {\n return;\n }\n\n const objectMode = (state[kState] & kObjectMode) !== 0;\n const { [kBufferedValue]: buffered, bufferedIndex } = state;\n const bufferedLength = buffered.length - bufferedIndex;\n\n if (!bufferedLength) {\n return;\n }\n\n let i = bufferedIndex;\n\n state[kState] |= kBufferProcessing;\n if (bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1;\n\n const callback = (state[kState] & kAllNoop) !== 0 ? nop : (err) => {\n for (let n = i; n < buffered.length; ++n) {\n buffered[n].callback(err);\n }\n };\n\n\n const chunks = (state[kState] & kAllNoop) !== 0 && i === 0 ?\n buffered : ArrayPrototypeSlice(buffered, i);\n chunks.allBuffers = (state[kState] & kAllBuffers) !== 0;\n\n doWrite(stream, state, true, state.length, chunks, '', callback);\n\n resetBuffer(state);\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i];\n buffered[i++] = null;\n const len = objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, callback);\n } while (i < buffered.length && (state[kState] & kWriting) === 0);\n\n if (i === buffered.length) {\n resetBuffer(state);\n } else if (i > 256) {\n buffered.splice(0, i);\n state.bufferedIndex = 0;\n } else {\n state.bufferedIndex = i;\n }\n }\n state[kState] &= ~kBufferProcessing;\n}\n\nWritable.prototype._write = function(chunk, encoding, cb) {\n if (this._writev) {\n this._writev([{ chunk, encoding }], cb);\n } else {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_write()');\n }\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function(chunk, encoding, cb) {\n const state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n let err;\n\n if (chunk != null) {\n const ret = _write(this, chunk, encoding);\n if (ret instanceof Error) {\n err = ret;\n }\n }\n\n\n if ((state[kState] & kCorked) !== 0) {\n state.corked = 1;\n this.uncork();\n }\n\n if (err) {\n\n } else if ((state[kState] & (kEnding | kErrored)) === 0) {\n\n\n\n\n\n\n state[kState] |= kEnding;\n finishMaybe(this, state, true);\n state[kState] |= kEnded;\n } else if ((state[kState] & kFinished) !== 0) {\n err = new ERR_STREAM_ALREADY_FINISHED('end');\n } else if ((state[kState] & kDestroyed) !== 0) {\n err = new ERR_STREAM_DESTROYED('end');\n }\n\n if (typeof cb === 'function') {\n if (err) {\n process.nextTick(cb, err);\n } else if ((state[kState] & kErrored) !== 0) {\n process.nextTick(cb, state[kErroredValue]);\n } else if ((state[kState] & kFinished) !== 0) {\n process.nextTick(cb, null);\n } else {\n state[kState] |= kOnFinished;\n state[kOnFinishedValue] ??= [];\n state[kOnFinishedValue].push(cb);\n }\n }\n\n return this;\n};\n\nfunction needFinish(state) {\n return (\n\n (state[kState] & (\n kEnding |\n kDestroyed |\n kConstructed |\n kFinished |\n kWriting |\n kErrorEmitted |\n kCloseEmitted |\n kErrored |\n kBuffered\n )) === (kEnding | kConstructed) && state.length === 0);\n}\n\nfunction onFinish(stream, state, err) {\n if ((state[kState] & kPrefinished) !== 0) {\n errorOrDestroy(stream, err ?? new ERR_MULTIPLE_CALLBACK());\n return;\n }\n state.pendingcb--;\n if (err) {\n callFinishedCallbacks(state, err);\n errorOrDestroy(stream, err, (state[kState] & kSync) !== 0);\n } else if (needFinish(state)) {\n state[kState] |= kPrefinished;\n stream.emit('prefinish');\n\n\n\n state.pendingcb++;\n process.nextTick(finish, stream, state);\n }\n}\n\nfunction prefinish(stream, state) {\n if ((state[kState] & (kPrefinished | kFinalCalled)) !== 0) {\n return;\n }\n\n if (typeof stream._final === 'function' && (state[kState] & kDestroyed) === 0) {\n state[kState] |= kFinalCalled | kSync;\n state.pendingcb++;\n\n try {\n stream._final((err) => onFinish(stream, state, err));\n } catch (err) {\n onFinish(stream, state, err);\n }\n\n state[kState] &= ~kSync;\n } else {\n state[kState] |= kFinalCalled | kPrefinished;\n stream.emit('prefinish');\n }\n}\n\nfunction finishMaybe(stream, state, sync) {\n if (needFinish(state)) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n if (sync) {\n state.pendingcb++;\n process.nextTick((stream, state) => {\n if (needFinish(state)) {\n finish(stream, state);\n } else {\n state.pendingcb--;\n }\n }, stream, state);\n } else if (needFinish(state)) {\n state.pendingcb++;\n finish(stream, state);\n }\n }\n }\n}\n\nfunction finish(stream, state) {\n state.pendingcb--;\n state[kState] |= kFinished;\n\n callFinishedCallbacks(state, null);\n\n stream.emit('finish');\n\n if ((state[kState] & kAutoDestroy) !== 0) {\n\n\n const rState = stream._readableState;\n const autoDestroy = !rState || (\n rState.autoDestroy &&\n\n\n (rState.endEmitted || rState.readable === false)\n );\n if (autoDestroy) {\n stream.destroy();\n }\n }\n}\n\nfunction callFinishedCallbacks(state, err) {\n if ((state[kState] & kOnFinished) === 0) {\n return;\n }\n\n const onfinishCallbacks = state[kOnFinishedValue];\n state[kOnFinishedValue] = null;\n state[kState] &= ~kOnFinished;\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n onfinishCallbacks[i](err);\n }\n}\n\nObjectDefineProperties(Writable.prototype, {\n closed: {\n __proto__: null,\n get() {\n return this._writableState ? (this._writableState[kState] & kClosed) !== 0 : false;\n },\n },\n\n destroyed: {\n __proto__: null,\n get() {\n return this._writableState ? (this._writableState[kState] & kDestroyed) !== 0 : false;\n },\n set(value) {\n\n if (!this._writableState) return;\n\n if (value) this._writableState[kState] |= kDestroyed;\n else this._writableState[kState] &= ~kDestroyed;\n },\n },\n\n writable: {\n __proto__: null,\n get() {\n const w = this._writableState;\n\n\n\n\n return !!w && w.writable !== false &&\n (w[kState] & (kEnding | kEnded | kDestroyed | kErrored)) === 0;\n },\n set(val) {\n\n if (this._writableState) {\n this._writableState.writable = !!val;\n }\n },\n },\n\n writableFinished: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state ? (state[kState] & kFinished) !== 0 : false;\n },\n },\n\n writableObjectMode: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state ? (state[kState] & kObjectMode) !== 0 : false;\n },\n },\n\n writableBuffer: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state && state.getBuffer();\n },\n },\n\n writableEnded: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state ? (state[kState] & kEnding) !== 0 : false;\n },\n },\n\n writableNeedDrain: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state ? (state[kState] & (kDestroyed | kEnding | kNeedDrain)) === kNeedDrain : false;\n },\n },\n\n writableHighWaterMark: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state?.highWaterMark;\n },\n },\n\n writableCorked: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state ? state.corked : 0;\n },\n },\n\n writableLength: {\n __proto__: null,\n get() {\n const state = this._writableState;\n return state?.length;\n },\n },\n\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n const state = this._writableState;\n return state ? state.errored : null;\n },\n },\n\n writableAborted: {\n __proto__: null,\n get: function() {\n const state = this._writableState;\n return (\n (state[kState] & (kHasWritable | kWritable)) !== kHasWritable &&\n (state[kState] & (kDestroyed | kErrored)) !== 0 &&\n (state[kState] & kFinished) === 0\n );\n },\n },\n});\n\nconst destroy = destroyImpl.destroy;\nWritable.prototype.destroy = function(err, cb) {\n const state = this._writableState;\n\n\n if ((state[kState] & (kBuffered | kOnFinished)) !== 0 && (state[kState] & kDestroyed) === 0) {\n process.nextTick(errorBuffer, state);\n }\n\n destroy.call(this, err, cb);\n return this;\n};\n\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function(err, cb) {\n cb(err);\n};\n\nWritable.prototype[EE.captureRejectionSymbol] = function(err) {\n this.destroy(err);\n};\n\nlet webStreamsAdapters;\n\n\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined)\n webStreamsAdapters = require('internal/webstreams/adapters');\n return webStreamsAdapters;\n}\n\nWritable.fromWeb = function(writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(\n writableStream,\n options);\n};\n\nWritable.toWeb = function(streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);\n};\n\nWritable.prototype[SymbolAsyncDispose] = async function() {\n let error;\n if (!this.destroyed) {\n error = this.writableFinished ? null : new AbortError();\n this.destroy(error);\n }\n await new Promise((resolve, reject) =>\n eos(this, (err) => (err && err.name !== 'AbortError' ? reject(err) : resolve(null))),\n );\n};\n","internal/timers.js":"'use strict';\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n MathMax,\n MathTrunc,\n NumberIsFinite,\n NumberIsNaN,\n NumberMIN_SAFE_INTEGER,\n ReflectApply,\n Symbol,\n} = primordials;\n\nconst binding = internalBinding('timers');\nconst {\n immediateInfo,\n timeoutInfo,\n} = binding;\nconst {\n enqueueMicrotask,\n} = internalBinding('task_queue');\n\nconst {\n getDefaultTriggerAsyncId,\n newAsyncId,\n initHooksExist,\n\n emitInit,\n emitBefore,\n emitAfter,\n emitDestroy,\n symbols: {\n async_local_storage_context_symbol,\n },\n} = require('internal/async_hooks');\n\n\nconst async_id_symbol = Symbol('asyncId');\nconst trigger_async_id_symbol = Symbol('triggerId');\n\nconst kHasPrimitive = Symbol('kHasPrimitive');\n\nconst {\n ERR_OUT_OF_RANGE,\n} = require('internal/errors').codes;\nconst {\n validateFunction,\n validateNumber,\n} = require('internal/validators');\n\nconst L = require('internal/linkedlist');\nconst PriorityQueue = require('internal/priority_queue');\n\nconst { inspect } = require('internal/util/inspect');\nlet debug = require('internal/util/debuglog').debuglog('timer', (fn) => {\n debug = fn;\n});\n\nconst AsyncContextFrame = require('internal/async_context_frame');\n\nconst async_context_frame = Symbol('kAsyncContextFrame');\n\nfunction removeStoresFromResource(resource) {\n if (AsyncContextFrame.enabled) {\n if (resource[async_context_frame] !== undefined) {\n resource[async_context_frame] = undefined;\n }\n } else if (resource[async_local_storage_context_symbol] !== undefined) {\n resource[async_local_storage_context_symbol] = undefined;\n }\n}\n\nfunction cleanTimer(timer) {\n removeStoresFromResource(timer);\n timer._onTimeout = undefined;\n timer._timerArgs = undefined;\n}\n\nfunction cleanImmediate(immediate) {\n removeStoresFromResource(immediate);\n immediate._onImmediate = undefined;\n immediate._argv = undefined;\n}\n\nfunction enqueueRemoveStoresFromResource(resource) {\n enqueueMicrotask(() => removeStoresFromResource(resource));\n}\n\nfunction enqueueRemoveStoresIfNotReinserted(resource) {\n enqueueMicrotask(() => {\n if (!resource._idleNext && !resource._idlePrev)\n removeStoresFromResource(resource);\n });\n}\n\n\nconst kCount = 0;\nconst kRefCount = 1;\nconst kHasOutstanding = 2;\n\n\nconst TIMEOUT_MAX = 2 ** 31 - 1;\n\nlet timerListId = NumberMIN_SAFE_INTEGER;\n\nconst kRefed = Symbol('refed');\n\nlet nextExpiry = Infinity;\n\n\n\n\ntimeoutInfo[0] = 0;\n\n\n\n\nconst timerListQueue = new PriorityQueue(compareTimersLists, setPosition);\n\n\n\n\n\n\nconst timerListMap = { __proto__: null };\n\n\n\n\nconst knownTimersById = { __proto__: null };\n\nfunction initAsyncResource(resource, type) {\n const asyncId = resource[async_id_symbol] = newAsyncId();\n const triggerAsyncId =\n resource[trigger_async_id_symbol] = getDefaultTriggerAsyncId();\n resource[async_context_frame] = AsyncContextFrame.current();\n if (initHooksExist())\n emitInit(asyncId, type, triggerAsyncId, resource);\n}\n\nlet warnedNegativeNumber = false;\nlet warnedNotNumber = false;\n\nclass Timeout {\n\n\n constructor(callback, after, args, isRepeat, isRefed) {\n if (after === undefined) {\n after = 1;\n } else {\n after *= 1;\n }\n\n if (!(after >= 1 && after <= TIMEOUT_MAX)) {\n if (after > TIMEOUT_MAX) {\n process.emitWarning(`${after} does not fit into` +\n ' a 32-bit signed integer.' +\n '\\nTimeout duration was set to 1.',\n 'TimeoutOverflowWarning');\n } else if (after < 0 && !warnedNegativeNumber) {\n warnedNegativeNumber = true;\n process.emitWarning(`${after} is a negative number.` +\n '\\nTimeout duration was set to 1.',\n 'TimeoutNegativeWarning');\n } else if (NumberIsNaN(after) && !warnedNotNumber) {\n warnedNotNumber = true;\n process.emitWarning(`${after} is not a number.` +\n '\\nTimeout duration was set to 1.',\n 'TimeoutNaNWarning');\n }\n after = 1;\n }\n\n this._idleTimeout = after;\n this._idlePrev = this;\n this._idleNext = this;\n this._idleStart = null;\n this._onTimeout = callback;\n this._timerArgs = args;\n this._repeat = isRepeat ? after : null;\n this._destroyed = false;\n\n if (isRefed)\n incRefCount();\n this[kRefed] = isRefed;\n this[kHasPrimitive] = false;\n\n initAsyncResource(this, 'Timeout');\n }\n\n\n [inspect.custom](_, options) {\n return inspect(this, {\n ...options,\n\n depth: 0,\n\n customInspect: false,\n });\n }\n\n refresh() {\n if (this[kRefed])\n active(this);\n else\n unrefActive(this);\n\n return this;\n }\n\n unref() {\n if (this[kRefed]) {\n this[kRefed] = false;\n if (!this._destroyed)\n decRefCount();\n }\n return this;\n }\n\n ref() {\n if (!this[kRefed]) {\n this[kRefed] = true;\n if (!this._destroyed)\n incRefCount();\n }\n return this;\n }\n\n hasRef() {\n return this[kRefed];\n }\n}\n\nclass TimersList {\n constructor(expiry, msecs) {\n this._idleNext = this;\n this._idlePrev = this;\n this.expiry = expiry;\n this.id = timerListId++;\n this.msecs = msecs;\n this.priorityQueuePosition = null;\n }\n\n\n [inspect.custom](_, options) {\n return inspect(this, {\n ...options,\n\n depth: 0,\n\n customInspect: false,\n });\n }\n}\n\n\nclass ImmediateList {\n constructor() {\n this.head = null;\n this.tail = null;\n }\n\n\n\n append(item) {\n if (this.tail !== null) {\n this.tail._idleNext = item;\n item._idlePrev = this.tail;\n } else {\n this.head = item;\n }\n this.tail = item;\n }\n\n\n\n remove(item) {\n if (item._idleNext) {\n item._idleNext._idlePrev = item._idlePrev;\n }\n\n if (item._idlePrev) {\n item._idlePrev._idleNext = item._idleNext;\n }\n\n if (item === this.head)\n this.head = item._idleNext;\n if (item === this.tail)\n this.tail = item._idlePrev;\n\n item._idleNext = null;\n item._idlePrev = null;\n }\n}\n\n\nconst immediateQueue = new ImmediateList();\n\nfunction incRefCount() {\n if (timeoutInfo[0]++ === 0) {\n\n binding.toggleTimerRef(true);\n }\n}\n\nfunction decRefCount() {\n if (--timeoutInfo[0] === 0) {\n\n binding.toggleTimerRef(false);\n }\n}\n\n\n\nfunction active(item) {\n insertGuarded(item, true);\n}\n\n\n\nfunction unrefActive(item) {\n insertGuarded(item, false);\n}\n\n\n\n\n\nfunction insertGuarded(item, refed) {\n const msecs = item._idleTimeout;\n if (msecs < 0 || msecs === undefined)\n return;\n\n insert(item, msecs);\n\n const isDestroyed = item._destroyed;\n if (isDestroyed || !item[async_id_symbol]) {\n item._destroyed = false;\n initAsyncResource(item, 'Timeout');\n }\n\n if (isDestroyed) {\n if (refed)\n incRefCount();\n } else if (refed === !item[kRefed]) {\n if (refed)\n incRefCount();\n else\n decRefCount();\n }\n item[kRefed] = refed;\n}\n\n\nfunction insert(item, msecs, start = binding.getLibuvNow()) {\n\n msecs = MathTrunc(msecs);\n item._idleStart = start;\n\n\n let list = timerListMap[msecs];\n if (list === undefined) {\n debug('no %d list was found in insert, creating a new one', msecs);\n const expiry = start + msecs;\n timerListMap[msecs] = list = new TimersList(expiry, msecs);\n timerListQueue.insert(list);\n\n if (nextExpiry > expiry) {\n\n binding.scheduleTimer(msecs);\n nextExpiry = expiry;\n }\n }\n\n L.append(list, item);\n}\n\nfunction setUnrefTimeout(callback, after) {\n\n validateFunction(callback, 'callback');\n\n const timer = new Timeout(callback, after, undefined, false, false);\n insert(timer, timer._idleTimeout);\n\n return timer;\n}\n\n\n\n\n\n\n\nfunction reuseOrCreateUnrefTimeout(timer, callback, after, arg) {\n if (timer !== undefined && timer !== null &&\n timer._destroyed && timer._repeat === null && !timer[kHasPrimitive]) {\n timer._idleTimeout = after;\n timer._onTimeout = callback;\n const args = timer._timerArgs;\n if (args === undefined) {\n timer._timerArgs = [arg];\n } else {\n args[0] = arg;\n }\n\n\n\n unrefActive(timer);\n return timer;\n }\n\n timer = new Timeout(callback, after, [arg], false, false);\n insert(timer, timer._idleTimeout);\n\n return timer;\n}\n\n\nfunction getTimerDuration(msecs, name) {\n validateNumber(msecs, name);\n if (msecs < 0 || !NumberIsFinite(msecs)) {\n throw new ERR_OUT_OF_RANGE(name, 'a non-negative finite number', msecs);\n }\n\n\n if (msecs > TIMEOUT_MAX) {\n process.emitWarning(`${msecs} does not fit into a 32-bit signed integer.` +\n `\\nTimer duration was truncated to ${TIMEOUT_MAX}.`,\n 'TimeoutOverflowWarning');\n return TIMEOUT_MAX;\n }\n\n return msecs;\n}\n\nfunction compareTimersLists(a, b) {\n const expiryDiff = a.expiry - b.expiry;\n if (expiryDiff === 0) {\n return a.id - b.id;\n }\n return expiryDiff;\n}\n\nfunction setPosition(node, pos) {\n node.priorityQueuePosition = pos;\n}\n\nfunction getTimerCallbacks(runNextTicks) {\n\n\n\n const outstandingQueue = new ImmediateList();\n\n function processImmediate() {\n const queue = outstandingQueue.head !== null ?\n outstandingQueue : immediateQueue;\n let immediate = queue.head;\n\n\n\n if (queue !== outstandingQueue) {\n queue.head = queue.tail = null;\n immediateInfo[kHasOutstanding] = 1;\n }\n\n let prevImmediate;\n let ranAtLeastOneImmediate = false;\n while (immediate !== null) {\n if (ranAtLeastOneImmediate)\n runNextTicks();\n else\n ranAtLeastOneImmediate = true;\n\n\n\n\n if (immediate._destroyed) {\n outstandingQueue.head = immediate = prevImmediate._idleNext;\n continue;\n }\n\n\n\n immediate._destroyed = true;\n\n immediateInfo[kCount]--;\n if (immediate[kRefed])\n immediateInfo[kRefCount]--;\n immediate[kRefed] = null;\n\n prevImmediate = immediate;\n\n const priorContextFrame =\n AsyncContextFrame.exchange(immediate[async_context_frame]);\n\n const asyncId = immediate[async_id_symbol];\n emitBefore(asyncId, immediate[trigger_async_id_symbol], immediate);\n\n let threw = true;\n try {\n const argv = immediate._argv;\n if (!argv)\n immediate._onImmediate();\n else\n immediate._onImmediate(...argv);\n threw = false;\n } finally {\n if (threw) {\n immediate._onImmediate = undefined;\n immediate._argv = undefined;\n enqueueRemoveStoresFromResource(immediate);\n } else {\n cleanImmediate(immediate);\n }\n\n emitDestroy(asyncId);\n\n outstandingQueue.head = immediate = immediate._idleNext;\n }\n\n emitAfter(asyncId);\n\n AsyncContextFrame.set(priorContextFrame);\n }\n\n if (queue === outstandingQueue)\n outstandingQueue.head = null;\n immediateInfo[kHasOutstanding] = 0;\n }\n\n\n function processTimers(now) {\n debug('process timer lists %d', now);\n nextExpiry = Infinity;\n\n let list;\n let ranAtLeastOneList = false;\n while ((list = timerListQueue.peek()) != null) {\n if (list.expiry > now) {\n nextExpiry = list.expiry;\n return timeoutInfo[0] > 0 ? nextExpiry : -nextExpiry;\n }\n if (ranAtLeastOneList)\n runNextTicks();\n else\n ranAtLeastOneList = true;\n listOnTimeout(list, now);\n }\n return 0;\n }\n\n function listOnTimeout(list, now) {\n const msecs = list.msecs;\n\n debug('timeout callback %d', msecs);\n\n let ranAtLeastOneTimer = false;\n let timer;\n while ((timer = L.peek(list)) != null) {\n const diff = now - timer._idleStart;\n\n\n\n if (diff < msecs) {\n list.expiry = MathMax(timer._idleStart + msecs, now + 1);\n list.id = timerListId++;\n timerListQueue.percolateDown(1);\n debug('%d list wait because diff is %d', msecs, diff);\n return;\n }\n\n if (ranAtLeastOneTimer)\n runNextTicks();\n else\n ranAtLeastOneTimer = true;\n\n\n L.remove(timer);\n\n const asyncId = timer[async_id_symbol];\n\n if (!timer._onTimeout) {\n if (!timer._destroyed) {\n timer._destroyed = true;\n\n cleanTimer(timer);\n\n if (timer[kHasPrimitive])\n delete knownTimersById[asyncId];\n\n if (timer[kRefed])\n timeoutInfo[0]--;\n\n emitDestroy(asyncId);\n }\n continue;\n }\n\n const priorContextFrame =\n AsyncContextFrame.exchange(timer[async_context_frame]);\n\n emitBefore(asyncId, timer[trigger_async_id_symbol], timer);\n\n let start;\n if (timer._repeat) {\n\n start = binding.getLibuvNow();\n }\n\n let threw = true;\n try {\n const args = timer._timerArgs;\n if (args === undefined)\n timer._onTimeout();\n else\n ReflectApply(timer._onTimeout, timer, args);\n threw = false;\n } finally {\n if (timer._repeat && timer._idleTimeout !== -1) {\n timer._idleTimeout = timer._repeat;\n insert(timer, timer._idleTimeout, start);\n } else if (!timer._idleNext && !timer._idlePrev) {\n if (timer._destroyed) {\n timer._onTimeout = undefined;\n timer._timerArgs = undefined;\n if (threw)\n enqueueRemoveStoresIfNotReinserted(timer);\n else\n removeStoresFromResource(timer);\n } else {\n if (threw)\n enqueueRemoveStoresIfNotReinserted(timer);\n else\n removeStoresFromResource(timer);\n\n timer._destroyed = true;\n\n if (timer[kHasPrimitive])\n delete knownTimersById[asyncId];\n\n if (timer[kRefed])\n timeoutInfo[0]--;\n\n emitDestroy(asyncId);\n }\n }\n }\n\n emitAfter(asyncId);\n\n AsyncContextFrame.set(priorContextFrame);\n }\n\n\n\n\n\n debug('%d list empty', msecs);\n\n\n\n\n if (list === timerListMap[msecs]) {\n delete timerListMap[msecs];\n timerListQueue.shift();\n }\n }\n\n return {\n processImmediate,\n processTimers,\n };\n}\n\nclass Immediate {\n constructor(callback, args) {\n this._idleNext = null;\n this._idlePrev = null;\n this._onImmediate = callback;\n this._argv = args;\n this._destroyed = false;\n this[kRefed] = false;\n\n initAsyncResource(this, 'Immediate');\n\n this.ref();\n immediateInfo[kCount]++;\n\n immediateQueue.append(this);\n }\n\n ref() {\n if (this[kRefed] === false) {\n this[kRefed] = true;\n\n if (immediateInfo[kRefCount]++ === 0) {\n\n binding.toggleImmediateRef(true);\n }\n }\n return this;\n }\n\n unref() {\n if (this[kRefed] === true) {\n this[kRefed] = false;\n if (--immediateInfo[kRefCount] === 0) {\n\n binding.toggleImmediateRef(false);\n }\n }\n return this;\n }\n\n hasRef() {\n return !!this[kRefed];\n }\n}\n\nmodule.exports = {\n TIMEOUT_MAX,\n kTimeout: Symbol('timeout'),\n async_id_symbol,\n trigger_async_id_symbol,\n async_context_frame,\n Timeout,\n Immediate,\n cleanImmediate,\n cleanTimer,\n kRefed,\n kHasPrimitive,\n initAsyncResource,\n setUnrefTimeout,\n reuseOrCreateUnrefTimeout,\n getTimerDuration,\n immediateQueue,\n getTimerCallbacks,\n immediateInfoFields: {\n kCount,\n kRefCount,\n kHasOutstanding,\n },\n active,\n unrefActive,\n insert,\n timerListMap,\n timerListQueue,\n decRefCount,\n incRefCount,\n knownTimersById,\n};\n","internal/trace_events.js":"'use strict';\n\nconst { getCategoryEnabledBuffer, trace, usePerfetto } = internalBinding('trace_events');\nconst {\n CHAR_UPPERCASE_B,\n CHAR_LOWERCASE_B,\n CHAR_UPPERCASE_C,\n CHAR_LOWERCASE_E,\n CHAR_UPPERCASE_E,\n CHAR_LOWERCASE_N,\n} = require('internal/constants');\n\nlet nodeTraceEventCategory;\nif (usePerfetto) {\n nodeTraceEventCategory = (category) => `${category}`;\n} else {\n nodeTraceEventCategory = (category) => `node,${category}`;\n}\n\n\n\n\n\n\nconst kAsyncBegin = usePerfetto ? CHAR_UPPERCASE_B : CHAR_LOWERCASE_B;\nconst kAsyncEnd = usePerfetto ? CHAR_UPPERCASE_E : CHAR_LOWERCASE_E;\n\n\n\n\n\nconst kSyncBegin = CHAR_UPPERCASE_B;\nconst kSyncEnd = CHAR_UPPERCASE_E;\n\n\n\n\n\nconst kTraceCount = usePerfetto ? CHAR_LOWERCASE_N : CHAR_UPPERCASE_C;\n\n\n\nconst kTraceInstant = CHAR_LOWERCASE_N;\n\nmodule.exports = {\n usePerfetto,\n getCategoryEnabledBuffer,\n trace,\n nodeTraceEventCategory,\n kAsyncBegin,\n kAsyncEnd,\n kSyncBegin,\n kSyncEnd,\n kTraceCount,\n kTraceInstant,\n};\n","internal/util.js":"'use strict';\n\nconst {\n ArrayFrom,\n ArrayPrototypePush,\n ArrayPrototypeSlice,\n ArrayPrototypeSort,\n Error,\n ErrorCaptureStackTrace,\n FunctionPrototypeCall,\n FunctionPrototypeSymbolHasInstance,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectFreeze,\n ObjectGetOwnPropertyDescriptor,\n ObjectGetOwnPropertyDescriptors,\n ObjectGetPrototypeOf,\n ObjectKeys,\n ObjectSetPrototypeOf,\n ObjectValues,\n Promise,\n ReflectApply,\n ReflectConstruct,\n RegExpPrototypeExec,\n RegExpPrototypeGetDotAll,\n RegExpPrototypeGetGlobal,\n RegExpPrototypeGetHasIndices,\n RegExpPrototypeGetIgnoreCase,\n RegExpPrototypeGetMultiline,\n RegExpPrototypeGetSource,\n RegExpPrototypeGetSticky,\n RegExpPrototypeGetUnicode,\n SafeMap,\n SafeSet,\n SafeWeakMap,\n SafeWeakRef,\n StringPrototypeIncludes,\n StringPrototypeReplace,\n StringPrototypeSlice,\n StringPrototypeToLowerCase,\n StringPrototypeToUpperCase,\n Symbol,\n SymbolFor,\n SymbolPrototypeGetDescription,\n SymbolReplace,\n SymbolSplit,\n globalThis,\n} = primordials;\n\nconst {\n codes: {\n ERR_NO_CRYPTO,\n ERR_NO_TYPESCRIPT,\n ERR_UNKNOWN_SIGNAL,\n ERR_WEBASSEMBLY_NOT_SUPPORTED,\n },\n isErrorStackTraceLimitWritable,\n overrideStackTrace,\n uvErrmapGet,\n} = require('internal/errors');\nconst { signals } = internalBinding('constants').os;\nconst {\n constructSharedArrayBuffer,\n guessHandleType: _guessHandleType,\n defineLazyProperties,\n privateSymbols: {\n arrow_message_private_symbol,\n decorated_private_symbol,\n },\n sleep: _sleep,\n} = internalBinding('util');\nconst { isNativeError, isPromise } = internalBinding('types');\nconst { getOptionValue } = require('internal/options');\nconst assert = require('internal/assert');\nconst { encodings } = internalBinding('string_decoder');\n\nconst noCrypto = !process.versions.openssl;\nconst noTypeScript = !process.versions.amaro;\n\nconst isWindows = process.platform === 'win32';\nconst isMacOS = process.platform === 'darwin';\n\nconst experimentalWarnings = new SafeSet();\n\nconst colorRegExp = /\\u001b\\[\\d\\d?m/g;\n\nlet uvBinding;\n\nfunction lazyUv() {\n uvBinding ??= internalBinding('uv');\n return uvBinding;\n}\n\nfunction removeColors(str) {\n return StringPrototypeReplace(str, colorRegExp, '');\n}\n\nfunction isError(e) {\n\n\n\n return isNativeError(e) || FunctionPrototypeSymbolHasInstance(Error, e);\n}\n\n\n\nconst codesWarned = new SafeSet();\n\nlet validateString;\nlet validateOneOf;\n\nfunction getDeprecationWarningEmitter(\n code, msg, deprecated, useEmitSync,\n shouldEmitWarning = () => true,\n) {\n let warned = false;\n return function(arg) {\n if (!warned && shouldEmitWarning(arg)) {\n warned = true;\n if (code === 'ExperimentalWarning') {\n process.emitWarning(msg, code, deprecated);\n } else if (code !== undefined) {\n if (!codesWarned.has(code)) {\n const emitWarning = useEmitSync ?\n require('internal/process/warning').emitWarningSync :\n process.emitWarning;\n emitWarning(msg, 'DeprecationWarning', code, deprecated);\n codesWarned.add(code);\n }\n } else {\n process.emitWarning(msg, 'DeprecationWarning', deprecated);\n }\n }\n };\n}\n\nfunction isPendingDeprecation() {\n return getOptionValue('--pending-deprecation') &&\n !getOptionValue('--no-deprecation');\n}\n\nfunction deprecateProperty(key, msg, code, isPendingDeprecation) {\n const emitDeprecationWarning = getDeprecationWarningEmitter(\n code, msg, undefined, false, isPendingDeprecation,\n );\n return (options) => {\n if (key in options) {\n emitDeprecationWarning();\n }\n };\n}\n\n\n\n\nfunction pendingDeprecate(fn, msg, code) {\n const emitDeprecationWarning = getDeprecationWarningEmitter(\n code, msg, deprecated, false, isPendingDeprecation,\n );\n function deprecated(...args) {\n emitDeprecationWarning();\n return ReflectApply(fn, this, args);\n }\n\n ObjectDefineProperty(deprecated, 'length', {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(fn, 'length'),\n });\n\n return deprecated;\n}\n\n\n\n\nfunction deprecate(fn, msg, code, useEmitSync, modifyPrototype = true) {\n\n if (validateString === undefined)\n ({ validateString } = require('internal/validators'));\n\n if (code !== undefined)\n validateString(code, 'code');\n\n const emitDeprecationWarning = getDeprecationWarningEmitter(\n code, msg, deprecated, useEmitSync,\n );\n\n function deprecated(...args) {\n if (!process.noDeprecation) {\n emitDeprecationWarning();\n }\n if (new.target) {\n return ReflectConstruct(fn, args, new.target);\n }\n return ReflectApply(fn, this, args);\n }\n\n if (modifyPrototype) {\n\n\n\n ObjectSetPrototypeOf(deprecated, fn);\n if (fn.prototype) {\n\n\n\n deprecated.prototype = fn.prototype;\n }\n\n ObjectDefineProperty(deprecated, 'length', {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(fn, 'length'),\n });\n }\n\n return deprecated;\n}\n\nfunction deprecateInstantiation(target, code, ...args) {\n assert(typeof code === 'string');\n\n getDeprecationWarningEmitter(code, `Instantiating ${target.name} without the 'new' keyword has been deprecated.`, target)();\n\n return ReflectConstruct(target, args);\n}\n\nfunction decorateErrorStack(err) {\n if (!(isError(err) && err.stack) || err[decorated_private_symbol])\n return;\n\n const arrow = err[arrow_message_private_symbol];\n\n if (arrow) {\n err.stack = arrow + err.stack;\n err[decorated_private_symbol] = true;\n }\n}\n\nfunction assertCrypto() {\n if (noCrypto)\n throw new ERR_NO_CRYPTO();\n}\n\nfunction assertTypeScript() {\n if (noTypeScript)\n throw new ERR_NO_TYPESCRIPT();\n if (globalThis.WebAssembly === undefined)\n throw new ERR_WEBASSEMBLY_NOT_SUPPORTED('TypeScript');\n}\n\n\n\n\n\n\n\nfunction normalizeEncoding(enc) {\n if (enc == null || enc === 'utf8' || enc === 'utf-8') return 'utf8';\n return slowCases(enc);\n}\n\nfunction slowCases(enc) {\n switch (enc.length) {\n case 4:\n if (enc === 'UTF8') return 'utf8';\n if (enc === 'ucs2' || enc === 'UCS2') return 'utf16le';\n enc = StringPrototypeToLowerCase(enc);\n if (enc === 'utf8') return 'utf8';\n if (enc === 'ucs2') return 'utf16le';\n break;\n case 3:\n if (enc === 'hex' || enc === 'HEX' ||\n StringPrototypeToLowerCase(enc) === 'hex')\n return 'hex';\n break;\n case 5:\n if (enc === 'ascii') return 'ascii';\n if (enc === 'ucs-2') return 'utf16le';\n if (enc === 'UTF-8') return 'utf8';\n if (enc === 'ASCII') return 'ascii';\n if (enc === 'UCS-2') return 'utf16le';\n enc = StringPrototypeToLowerCase(enc);\n if (enc === 'utf-8') return 'utf8';\n if (enc === 'ascii') return 'ascii';\n if (enc === 'ucs-2') return 'utf16le';\n break;\n case 6:\n if (enc === 'base64') return 'base64';\n if (enc === 'latin1' || enc === 'binary') return 'latin1';\n if (enc === 'BASE64') return 'base64';\n if (enc === 'LATIN1' || enc === 'BINARY') return 'latin1';\n enc = StringPrototypeToLowerCase(enc);\n if (enc === 'base64') return 'base64';\n if (enc === 'latin1' || enc === 'binary') return 'latin1';\n break;\n case 7:\n if (enc === 'utf16le' || enc === 'UTF16LE' ||\n StringPrototypeToLowerCase(enc) === 'utf16le')\n return 'utf16le';\n break;\n case 8:\n if (enc === 'utf-16le' || enc === 'UTF-16LE' ||\n StringPrototypeToLowerCase(enc) === 'utf-16le')\n return 'utf16le';\n break;\n case 9:\n if (enc === 'base64url' || enc === 'BASE64URL' ||\n StringPrototypeToLowerCase(enc) === 'base64url')\n return 'base64url';\n break;\n default:\n if (enc === '') return 'utf8';\n }\n}\n\n\n\n\n\n\n\nfunction emitExperimentalWarning(feature, messagePrefix, code, ctor) {\n if (experimentalWarnings.has(feature)) return;\n experimentalWarnings.add(feature);\n let msg = `${feature} is an experimental feature and might change at any time`;\n if (messagePrefix) {\n msg = messagePrefix + msg;\n }\n process.emitWarning(msg, 'ExperimentalWarning', code, ctor);\n}\n\nfunction filterDuplicateStrings(items, low) {\n const map = new SafeMap();\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n const key = StringPrototypeToLowerCase(item);\n if (low) {\n map.set(key, key);\n } else {\n map.set(key, item);\n }\n }\n return ArrayPrototypeSort(ArrayFrom(map.values()));\n}\n\nfunction cachedResult(fn) {\n let result;\n return () => {\n if (result === undefined)\n result = fn();\n return ArrayPrototypeSlice(result);\n };\n}\n\nlet signalsToNamesMapping;\nfunction getSignalsToNamesMapping() {\n if (signalsToNamesMapping !== undefined)\n return signalsToNamesMapping;\n\n signalsToNamesMapping = { __proto__: null };\n for (const key in signals) {\n signalsToNamesMapping[signals[key]] = key;\n }\n\n return signalsToNamesMapping;\n}\n\nfunction convertToValidSignal(signal) {\n if (typeof signal === 'number' && getSignalsToNamesMapping()[signal])\n return signal;\n\n if (typeof signal === 'string') {\n const signalName = signals[StringPrototypeToUpperCase(signal)];\n if (signalName) return signalName;\n }\n\n throw new ERR_UNKNOWN_SIGNAL(signal);\n}\n\nfunction convertProcessSignalToExitCode(signalCode) {\n\n if (validateOneOf === undefined)\n ({ validateOneOf } = require('internal/validators'));\n\n validateOneOf(signalCode, 'signalCode', ObjectKeys(signals));\n\n\n return 128 + signals[signalCode];\n}\n\nfunction getConstructorOf(obj) {\n while (obj) {\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');\n if (descriptor !== undefined &&\n typeof descriptor.value === 'function' &&\n descriptor.value.name !== '') {\n return descriptor.value;\n }\n\n obj = ObjectGetPrototypeOf(obj);\n }\n\n return null;\n}\n\nlet cachedURL;\nlet cachedCWD;\n\n\n\n\n\n\nfunction getCWDURL() {\n const { sep } = require('path');\n const { pathToFileURL } = require('internal/url');\n\n let cwd;\n\n try {\n\n\n cwd = process.cwd();\n } catch {\n cachedURL ??= pathToFileURL(sep);\n }\n\n if (cwd != null && cwd !== cachedCWD) {\n cachedURL = pathToFileURL(cwd + sep);\n cachedCWD = cwd;\n }\n\n return cachedURL;\n}\n\nfunction getSystemErrorMessage(err) {\n return lazyUv().getErrorMessage(err);\n}\n\nfunction getSystemErrorName(err) {\n const entry = uvErrmapGet(err);\n return entry ? entry[0] : `Unknown system error ${err}`;\n}\n\nfunction getSystemErrorMap() {\n return lazyUv().getErrorMap();\n}\n\nconst kCustomPromisifiedSymbol = SymbolFor('nodejs.util.promisify.custom');\nconst kCustomPromisifyArgsSymbol = Symbol('customPromisifyArgs');\n\nlet validateFunction;\n\nfunction promisify(original) {\n\n if (validateFunction === undefined)\n ({ validateFunction } = require('internal/validators'));\n\n validateFunction(original, 'original');\n\n if (original[kCustomPromisifiedSymbol]) {\n const fn = original[kCustomPromisifiedSymbol];\n\n validateFunction(fn, 'util.promisify.custom');\n\n return ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn, enumerable: false, writable: false, configurable: true,\n });\n }\n\n\n\n const argumentNames = original[kCustomPromisifyArgsSymbol];\n\n function fn(...args) {\n return new Promise((resolve, reject) => {\n ArrayPrototypePush(args, (err, ...values) => {\n if (err) {\n return reject(err);\n }\n if (argumentNames !== undefined && values.length > 1) {\n const obj = {};\n for (let i = 0; i < argumentNames.length; i++)\n obj[argumentNames[i]] = values[i];\n resolve(obj);\n } else {\n resolve(values[0]);\n }\n });\n if (isPromise(ReflectApply(original, this, args))) {\n process.emitWarning('Calling promisify on a function that returns a Promise is likely a mistake.',\n 'DeprecationWarning', 'DEP0174');\n }\n });\n }\n\n ObjectSetPrototypeOf(fn, ObjectGetPrototypeOf(original));\n\n ObjectDefineProperty(fn, kCustomPromisifiedSymbol, {\n __proto__: null,\n value: fn, enumerable: false, writable: false, configurable: true,\n });\n\n const descriptors = ObjectGetOwnPropertyDescriptors(original);\n const propertiesValues = ObjectValues(descriptors);\n for (let i = 0; i < propertiesValues.length; i++) {\n\n\n ObjectSetPrototypeOf(propertiesValues[i], null);\n }\n return ObjectDefineProperties(fn, descriptors);\n}\n\npromisify.custom = kCustomPromisifiedSymbol;\n\n\nfunction join(output, separator) {\n let str = '';\n if (output.length !== 0) {\n const lastIndex = output.length - 1;\n for (let i = 0; i < lastIndex; i++) {\n\n str += output[i];\n str += separator;\n }\n str += output[lastIndex];\n }\n return str;\n}\n\n\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nconst kNodeModulesRE = /^(?:.*)[\\\\/]node_modules[\\\\/]/;\n\nfunction isUnderNodeModules(filename) {\n return filename && (RegExpPrototypeExec(kNodeModulesRE, filename) !== null);\n}\n\nlet getStructuredStackImpl;\n\nfunction lazyGetStructuredStack() {\n if (getStructuredStackImpl === undefined) {\n\n const { runInNewContext } = require('vm');\n\n\n\n getStructuredStackImpl = runInNewContext(`(function() {\n try { Error.stackTraceLimit = Infinity; } catch {}\n return function structuredStack() {\n const e = new Error();\n overrideStackTrace.set(e, (err, trace) => trace);\n return e.stack;\n };\n })()`, { overrideStackTrace }, { filename: 'structured-stack' });\n }\n\n return getStructuredStackImpl;\n}\n\nfunction getStructuredStack() {\n const getStructuredStackImpl = lazyGetStructuredStack();\n\n return getStructuredStackImpl();\n}\n\nfunction once(callback, { preserveReturnValue = false } = kEmptyObject) {\n let called = false;\n let returnValue;\n return function(...args) {\n if (called) return returnValue;\n called = true;\n const result = ReflectApply(callback, this, args);\n returnValue = preserveReturnValue ? result : undefined;\n return result;\n };\n}\n\nlet validateUint32;\n\nfunction sleep(msec) {\n\n if (validateUint32 === undefined)\n ({ validateUint32 } = require('internal/validators'));\n\n validateUint32(msec, 'msec');\n _sleep(msec);\n}\n\n\nfunction defineOperation(target, name, method) {\n ObjectDefineProperty(target, name, {\n __proto__: null,\n writable: true,\n enumerable: true,\n configurable: true,\n value: method,\n });\n}\n\n\nfunction exposeInterface(target, name, interfaceObject) {\n ObjectDefineProperty(target, name, {\n __proto__: null,\n writable: true,\n enumerable: false,\n configurable: true,\n value: interfaceObject,\n });\n}\n\n\nfunction exposeNamespace(target, name, namespaceObject) {\n ObjectDefineProperty(target, name, {\n __proto__: null,\n writable: true,\n enumerable: false,\n configurable: true,\n value: namespaceObject,\n });\n}\n\nfunction defineReplaceableLazyAttribute(target, id, keys, writable = true, check) {\n let mod;\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n let value;\n let setterCalled = false;\n\n function get() {\n if (check !== undefined) {\n FunctionPrototypeCall(check, this);\n }\n if (setterCalled) {\n return value;\n }\n mod ??= require(id);\n value ??= mod[key];\n return value;\n }\n\n ObjectDefineProperty(get, 'name', {\n __proto__: null,\n value: `get ${key}`,\n });\n\n function set(val) {\n setterCalled = true;\n value = val;\n }\n ObjectDefineProperty(set, 'name', {\n __proto__: null,\n value: `set ${key}`,\n });\n\n ObjectDefineProperty(target, key, {\n __proto__: null,\n enumerable: true,\n configurable: true,\n get,\n set: writable ? set : undefined,\n });\n }\n}\n\nfunction exposeLazyInterfaces(target, id, keys) {\n defineLazyProperties(target, id, keys, false);\n}\n\nlet _DOMException;\nconst lazyDOMExceptionClass = () => {\n _DOMException ??= internalBinding('messaging').DOMException;\n return _DOMException;\n};\n\nconst lazyDOMException = (message, name) => {\n _DOMException ??= internalBinding('messaging').DOMException;\n if (isErrorStackTraceLimitWritable()) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const ex = new _DOMException(message, name);\n Error.stackTraceLimit = limit;\n ErrorCaptureStackTrace(ex, lazyDOMException);\n return ex;\n }\n return new _DOMException(message, name);\n\n};\n\nconst kEnumerableProperty = ObjectFreeze({\n __proto__: null,\n enumerable: true,\n});\n\nconst kEmptyObject = ObjectFreeze({ __proto__: null });\n\n\n\n\n\n\n\n\nfunction setOwnProperty(obj, key, value) {\n ObjectDefineProperty(obj, key, {\n __proto__: null,\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n return value;\n}\n\nlet internalGlobal;\nfunction getInternalGlobal() {\n if (internalGlobal == null) {\n\n const { runInNewContext } = require('vm');\n internalGlobal = runInNewContext('this', undefined, { contextName: 'internal' });\n }\n return internalGlobal;\n}\n\nfunction SideEffectFreeRegExpPrototypeExec(regex, string) {\n const { RegExp: RegExpFromAnotherRealm } = getInternalGlobal();\n return FunctionPrototypeCall(RegExpFromAnotherRealm.prototype.exec, regex, string);\n}\n\nconst crossRealmRegexes = new SafeWeakMap();\nfunction getCrossRealmRegex(regex) {\n const cached = crossRealmRegexes.get(regex);\n if (cached) return cached;\n\n let flagString = '';\n if (RegExpPrototypeGetHasIndices(regex)) flagString += 'd';\n if (RegExpPrototypeGetGlobal(regex)) flagString += 'g';\n if (RegExpPrototypeGetIgnoreCase(regex)) flagString += 'i';\n if (RegExpPrototypeGetMultiline(regex)) flagString += 'm';\n if (RegExpPrototypeGetDotAll(regex)) flagString += 's';\n if (RegExpPrototypeGetUnicode(regex)) flagString += 'u';\n if (RegExpPrototypeGetSticky(regex)) flagString += 'y';\n\n const { RegExp: RegExpFromAnotherRealm } = getInternalGlobal();\n const crossRealmRegex = new RegExpFromAnotherRealm(RegExpPrototypeGetSource(regex), flagString);\n crossRealmRegexes.set(regex, crossRealmRegex);\n return crossRealmRegex;\n}\n\nfunction SideEffectFreeRegExpPrototypeSymbolReplace(regex, string, replacement) {\n return getCrossRealmRegex(regex)[SymbolReplace](string, replacement);\n}\n\nfunction SideEffectFreeRegExpPrototypeSymbolSplit(regex, string, limit = undefined) {\n return getCrossRealmRegex(regex)[SymbolSplit](string, limit);\n}\n\n\n\n\n\n\n\nfunction getLazy(initializer) {\n let value;\n let initialized = false;\n return function() {\n if (initialized === false) {\n value = initializer();\n initialized = true;\n }\n return value;\n };\n}\n\n\n\nfunction setupCoverageHooks(dir) {\n const cwd = require('internal/process/execution').tryGetCwd();\n const { resolve } = require('path');\n const coverageDirectory = resolve(cwd, dir);\n const { sourceMapCacheToObject } =\n require('internal/source_map/source_map_cache');\n\n if (process.features.inspector) {\n internalBinding('profiler').setCoverageDirectory(coverageDirectory);\n internalBinding('profiler').setSourceMapCacheGetter(sourceMapCacheToObject);\n } else {\n process.emitWarning('The inspector is disabled, ' +\n 'coverage could not be collected',\n 'Warning');\n return '';\n }\n return coverageDirectory;\n}\n\n\n\nfunction countBinaryOnes(n) {\n\n n = n - ((n >>> 1) & 0x55555555);\n n = (n & 0x33333333) + ((n >>> 2) & 0x33333333);\n return ((n + (n >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24;\n}\n\nfunction getCIDR(address, netmask, family) {\n let ones = 0;\n let split = '.';\n let range = 10;\n let groupLength = 8;\n let hasZeros = false;\n let lastPos = 0;\n\n if (family === 'IPv6') {\n split = ':';\n range = 16;\n groupLength = 16;\n }\n\n for (let i = 0; i < netmask.length; i++) {\n if (netmask[i] !== split) {\n if (i + 1 < netmask.length) {\n continue;\n }\n i++;\n }\n const part = StringPrototypeSlice(netmask, lastPos, i);\n lastPos = i + 1;\n if (part !== '') {\n if (hasZeros) {\n if (part !== '0') {\n return null;\n }\n } else {\n const binary = NumberParseInt(part, range);\n const binaryOnes = countBinaryOnes(binary);\n ones += binaryOnes;\n if (binaryOnes !== groupLength) {\n if (StringPrototypeIncludes(binary.toString(2), '01')) {\n return null;\n }\n hasZeros = true;\n }\n }\n }\n }\n\n return `${address}/${ones}`;\n}\n\nconst handleTypes = ['TCP', 'TTY', 'UDP', 'FILE', 'PIPE', 'UNKNOWN'];\nfunction guessHandleType(fd) {\n const type = _guessHandleType(fd);\n return handleTypes[type];\n}\n\nclass WeakReference {\n #weak = null;\n\n #strong = null;\n #refCount = 0;\n constructor(object) {\n this.#weak = new SafeWeakRef(object);\n }\n\n incRef() {\n this.#refCount++;\n if (this.#refCount === 1) {\n const derefed = this.#weak.deref();\n if (derefed !== undefined) {\n this.#strong = derefed;\n }\n }\n return this.#refCount;\n }\n\n decRef() {\n this.#refCount--;\n if (this.#refCount === 0) {\n this.#strong = null;\n }\n return this.#refCount;\n }\n\n get() {\n return this.#weak.deref();\n }\n}\n\nconst encodingsMap = { __proto__: null };\nfor (let i = 0; i < encodings.length; ++i)\n encodingsMap[encodings[i]] = i;\n\n\n\n\n\n\n\n\n\n\nfunction assignFunctionName(name, fn, descriptor = kEmptyObject) {\n if (typeof name !== 'string') {\n const symbolDescription = SymbolPrototypeGetDescription(name);\n assert(symbolDescription !== undefined, 'Attempted to name function after descriptionless Symbol');\n name = `[${symbolDescription}]`;\n }\n return ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n writable: false,\n enumerable: false,\n configurable: true,\n ...ObjectGetOwnPropertyDescriptor(fn, 'name'),\n ...descriptor,\n value: name,\n });\n}\n\nmodule.exports = {\n getLazy,\n assertCrypto,\n assertTypeScript,\n assignFunctionName,\n cachedResult,\n constructSharedArrayBuffer,\n convertProcessSignalToExitCode,\n convertToValidSignal,\n decorateErrorStack,\n defineOperation,\n defineLazyProperties,\n defineReplaceableLazyAttribute,\n deprecate,\n deprecateInstantiation,\n deprecateProperty,\n emitExperimentalWarning,\n encodingsMap,\n exposeInterface,\n exposeLazyInterfaces,\n exposeNamespace,\n filterDuplicateStrings,\n getConstructorOf,\n getCIDR,\n getCWDURL,\n getStructuredStack,\n getSystemErrorMap,\n getSystemErrorName,\n getSystemErrorMessage,\n guessHandleType,\n isError,\n isUnderNodeModules,\n isMacOS,\n isWindows,\n join,\n lazyDOMException,\n lazyDOMExceptionClass,\n normalizeEncoding,\n once,\n promisify,\n SideEffectFreeRegExpPrototypeExec,\n SideEffectFreeRegExpPrototypeSymbolReplace,\n SideEffectFreeRegExpPrototypeSymbolSplit,\n sleep,\n spliceOne,\n setupCoverageHooks,\n removeColors,\n\n\n customPromisifyArgs: kCustomPromisifyArgsSymbol,\n\n\n\n customInspectSymbol: SymbolFor('nodejs.util.inspect.custom'),\n\n\n\n kIsEncodingSymbol: Symbol('kIsEncodingSymbol'),\n kVmBreakFirstLineSymbol: Symbol('kVmBreakFirstLineSymbol'),\n\n kEmptyObject,\n kEnumerableProperty,\n setOwnProperty,\n pendingDeprecate,\n WeakReference,\n isPendingDeprecation,\n getDeprecationWarningEmitter,\n};\n","internal/util/colors.js":"'use strict';\n\nlet internalTTy;\nfunction lazyInternalTTY() {\n internalTTy ??= require('internal/tty');\n return internalTTy;\n}\n\nmodule.exports = {\n blue: '',\n green: '',\n white: '',\n red: '',\n gray: '',\n clear: '',\n reset: '',\n hasColors: false,\n shouldColorize(stream) {\n if (process.env.FORCE_COLOR !== undefined) {\n return lazyInternalTTY().getColorDepth() > 2;\n }\n return stream?.isTTY && (\n typeof stream.getColorDepth === 'function' ?\n stream.getColorDepth() > 2 : true);\n },\n refresh() {\n if (module.exports.shouldColorize(process.stderr)) {\n module.exports.blue = '\\u001b[34m';\n module.exports.green = '\\u001b[32m';\n module.exports.white = '\\u001b[39m';\n module.exports.yellow = '\\u001b[33m';\n module.exports.red = '\\u001b[31m';\n module.exports.gray = '\\u001b[90m';\n module.exports.clear = '\\u001bc';\n module.exports.reset = '\\u001b[0m';\n module.exports.hasColors = true;\n } else {\n module.exports.blue = '';\n module.exports.green = '';\n module.exports.white = '';\n module.exports.yellow = '';\n module.exports.red = '';\n module.exports.gray = '';\n module.exports.clear = '';\n module.exports.reset = '';\n module.exports.hasColors = false;\n }\n },\n};\n\nmodule.exports.refresh();\n","internal/util/debuglog.js":"'use strict';\n\nconst {\n MathFloor,\n Number,\n NumberPrototypeToFixed,\n ObjectDefineProperty,\n RegExp,\n RegExpPrototypeExec,\n SafeArrayIterator,\n SafeMap,\n StringPrototypePadStart,\n StringPrototypeSplit,\n StringPrototypeToLowerCase,\n StringPrototypeToUpperCase,\n} = primordials;\nconst { inspect, format, formatWithOptions } = require('internal/util/inspect');\nconst {\n getCategoryEnabledBuffer,\n trace,\n nodeTraceEventCategory,\n kAsyncBegin,\n kAsyncEnd,\n kTraceInstant,\n} = require('internal/trace_events');\n\n\n\nlet debugImpls;\nlet testEnabled;\n\n\n\nfunction initializeDebugEnv(debugEnv) {\n debugImpls = { __proto__: null };\n if (debugEnv) {\n\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replaceAll('*', '.*')\n .replaceAll(',', '$|^');\n const debugEnvRegex = new RegExp(`^${debugEnv}$`, 'i');\n testEnabled = (str) => RegExpPrototypeExec(debugEnvRegex, str) !== null;\n } else {\n testEnabled = () => false;\n }\n}\n\n\n\nfunction emitWarningIfNeeded(set) {\n if ('HTTP' === set || 'HTTP2' === set) {\n process.emitWarning('Setting the NODE_DEBUG environment variable ' +\n 'to \\'' + StringPrototypeToLowerCase(set) + '\\' can expose sensitive ' +\n 'data (such as passwords, tokens and authentication headers) ' +\n 'in the resulting log.');\n }\n}\n\nconst noop = () => {};\n\nlet utilColors;\nfunction lazyUtilColors() {\n utilColors ??= require('internal/util/colors');\n return utilColors;\n}\n\nfunction debuglogImpl(enabled, set) {\n if (debugImpls[set] === undefined) {\n if (enabled) {\n const pid = process.pid;\n emitWarningIfNeeded(set);\n debugImpls[set] = function debug(...args) {\n const colors = lazyUtilColors().shouldColorize(process.stderr);\n const msg = formatWithOptions({ colors }, ...args);\n const coloredPID = inspect(pid, { colors });\n process.stderr.write(format('%s %s: %s\\n', set, coloredPID, msg));\n };\n } else {\n debugImpls[set] = noop;\n }\n }\n return debugImpls[set];\n}\n\n\n\n\n\nfunction debuglog(set, cb) {\n function init() {\n set = StringPrototypeToUpperCase(set);\n enabled = testEnabled(set);\n }\n let debug = (...args) => {\n init();\n\n\n debug = debuglogImpl(enabled, set);\n if (typeof cb === 'function') {\n ObjectDefineProperty(debug, 'enabled', {\n __proto__: null,\n get() {\n return enabled;\n },\n configurable: true,\n enumerable: true,\n });\n cb(debug);\n }\n switch (args.length) {\n case 1: return debug(args[0]);\n case 2: return debug(args[0], args[1]);\n default: return debug(...new SafeArrayIterator(args));\n }\n };\n let enabled;\n let test = () => {\n init();\n test = () => enabled;\n return enabled;\n };\n const logger = (...args) => {\n\n if (enabled === false) return;\n switch (args.length) {\n case 1: return debug(args[0]);\n case 2: return debug(args[0], args[1]);\n default: return debug(...new SafeArrayIterator(args));\n }\n };\n ObjectDefineProperty(logger, 'enabled', {\n __proto__: null,\n get() {\n return test();\n },\n configurable: true,\n enumerable: true,\n });\n return logger;\n}\n\nfunction pad(value) {\n return StringPrototypePadStart(`${value}`, 2, '0');\n}\n\nconst kNone = 1 << 0;\nconst kSkipLog = 1 << 1;\nconst kSkipTrace = 1 << 2;\nconst kShouldSkipAll = kSkipLog | kSkipTrace;\n\nconst kSecond = 1000;\nconst kMinute = 60 * kSecond;\nconst kHour = 60 * kMinute;\n\nfunction formatTime(ms) {\n let hours = 0;\n let minutes = 0;\n let seconds = 0;\n\n if (ms >= kSecond) {\n if (ms >= kMinute) {\n if (ms >= kHour) {\n hours = MathFloor(ms / kHour);\n ms = ms % kHour;\n }\n minutes = MathFloor(ms / kMinute);\n ms = ms % kMinute;\n }\n seconds = ms / kSecond;\n }\n\n if (hours !== 0 || minutes !== 0) {\n ({ 0: seconds, 1: ms } = StringPrototypeSplit(\n NumberPrototypeToFixed(seconds, 3),\n '.',\n 2,\n ));\n const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes;\n return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`;\n }\n\n if (seconds !== 0) {\n return `${NumberPrototypeToFixed(seconds, 3)}s`;\n }\n\n return `${Number(NumberPrototypeToFixed(ms, 3))}ms`;\n}\n\nfunction safeTraceLabel(label) {\n return label.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"');\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction timeLogImpl(timesStore, implementation, logImp, label, args) {\n const time = timesStore.get(label);\n if (time === undefined) {\n process.emitWarning(`No such label '${label}' for ${implementation}`);\n return;\n }\n\n const duration = process.hrtime(time);\n const ms = duration[0] * 1000 + duration[1] / 1e6;\n\n const formatted = formatTime(ms);\n\n if (args === undefined) {\n logImp(label, formatted);\n } else {\n logImp(label, formatted, args);\n }\n}\n\n\n\n\n\n\n\n\n\n\nfunction time(timesStore, traceCategory, implementation, timerFlags, logLabel = 'default', traceLabel = undefined) {\n\n logLabel = `${logLabel}`;\n\n if (traceLabel !== undefined) {\n traceLabel = `${traceLabel}`;\n } else {\n traceLabel = logLabel;\n }\n\n if (timesStore.has(logLabel)) {\n process.emitWarning(`Label '${logLabel}' already exists for ${implementation}`);\n return;\n }\n\n if ((timerFlags & kSkipTrace) === 0) {\n traceLabel = safeTraceLabel(traceLabel);\n trace(kAsyncBegin, traceCategory, traceLabel, 0);\n }\n\n timesStore.set(logLabel, process.hrtime());\n}\n\n\n\n\n\n\n\n\n\n\n\nfunction timeEnd(\n timesStore,\n traceCategory,\n implementation,\n timerFlags,\n logImpl,\n logLabel = 'default',\n traceLabel = undefined,\n) {\n\n logLabel = `${logLabel}`;\n\n if (traceLabel !== undefined) {\n traceLabel = `${traceLabel}`;\n } else {\n traceLabel = logLabel;\n }\n\n if ((timerFlags & kSkipLog) === 0) {\n timeLogImpl(timesStore, implementation, logImpl, logLabel);\n }\n\n if ((timerFlags & kSkipTrace) === 0) {\n traceLabel = safeTraceLabel(traceLabel);\n trace(kAsyncEnd, traceCategory, traceLabel, 0);\n }\n\n timesStore.delete(logLabel);\n}\n\n\n\n\n\n\n\n\n\n\n\n\nfunction timeLog(\n timesStore,\n traceCategory,\n implementation,\n timerFlags,\n logImpl,\n logLabel = 'default',\n traceLabel = undefined,\n args,\n) {\n\n logLabel = `${logLabel}`;\n\n if (traceLabel !== undefined) {\n traceLabel = `${traceLabel}`;\n } else {\n traceLabel = logLabel;\n }\n\n if ((timerFlags & kSkipLog) === 0) {\n timeLogImpl(timesStore, implementation, logImpl, logLabel, args);\n }\n\n if ((timerFlags & kSkipTrace) === 0) {\n traceLabel = safeTraceLabel(traceLabel);\n trace(kTraceInstant, traceCategory, traceLabel, 0);\n }\n}\n\n\n\n\nlet tracesStores;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction debugWithTimer(set, cb) {\n set = StringPrototypeToUpperCase(set);\n\n if (tracesStores === undefined) {\n tracesStores = { __proto__: null };\n }\n\n\n\n\n function logImpl(label, timeFormatted, args) {\n const pid = process.pid;\n const colors = { colors: lazyUtilColors().shouldColorize(process.stderr) };\n const coloredPID = inspect(pid, colors);\n\n if (args === undefined)\n process.stderr.write(format('%s %s %s: %s\\n', set, coloredPID, label, timeFormatted));\n else\n process.stderr.write(\n format(\n '%s %s %s: %s\\n',\n set,\n coloredPID,\n label,\n timeFormatted,\n ...new SafeArrayIterator(args),\n ),\n );\n }\n\n const traceCategory = nodeTraceEventCategory(`node.${StringPrototypeToLowerCase(set)}`);\n let traceCategoryBuffer;\n let debugLogCategoryEnabled = false;\n let timerFlags = kNone;\n\n function ensureTimerFlagsAreUpdated() {\n timerFlags &= ~kSkipTrace;\n\n if (traceCategoryBuffer[0] === 0) {\n timerFlags |= kSkipTrace;\n }\n }\n\n\n\n\n function internalStartTimer(logLabel, traceLabel) {\n ensureTimerFlagsAreUpdated();\n\n if ((timerFlags & kShouldSkipAll) === kShouldSkipAll) {\n return;\n }\n\n time(\n tracesStores[set],\n traceCategory,\n 'debuglog.time',\n timerFlags,\n logLabel,\n traceLabel,\n );\n }\n\n\n\n\n function internalEndTimer(logLabel, traceLabel) {\n ensureTimerFlagsAreUpdated();\n\n if ((timerFlags & kShouldSkipAll) === kShouldSkipAll) {\n return;\n }\n\n timeEnd(\n tracesStores[set],\n traceCategory,\n 'debuglog.timeEnd',\n timerFlags,\n logImpl,\n logLabel,\n traceLabel,\n );\n }\n\n\n\n\n function internalLogTimer(logLabel, traceLabel, args) {\n ensureTimerFlagsAreUpdated();\n\n if ((timerFlags & kShouldSkipAll) === kShouldSkipAll) {\n return;\n }\n\n timeLog(\n tracesStores[set],\n traceCategory,\n 'debuglog.timeLog',\n timerFlags,\n logImpl,\n logLabel,\n traceLabel,\n args,\n );\n }\n\n function init() {\n if (tracesStores[set] === undefined) {\n tracesStores[set] = new SafeMap();\n }\n emitWarningIfNeeded(set);\n debugLogCategoryEnabled = testEnabled(set);\n traceCategoryBuffer = getCategoryEnabledBuffer(traceCategory);\n\n timerFlags = kNone;\n\n if (!debugLogCategoryEnabled) {\n timerFlags |= kSkipLog;\n }\n\n if (traceCategoryBuffer[0] === 0) {\n timerFlags |= kSkipTrace;\n }\n\n cb(internalStartTimer, internalEndTimer, internalLogTimer);\n }\n\n\n\n\n const startTimer = (logLabel, traceLabel) => {\n init();\n\n if ((timerFlags & kShouldSkipAll) !== kShouldSkipAll)\n internalStartTimer(logLabel, traceLabel);\n };\n\n\n\n\n const endTimer = (logLabel, traceLabel) => {\n init();\n\n if ((timerFlags & kShouldSkipAll) !== kShouldSkipAll)\n internalEndTimer(logLabel, traceLabel);\n };\n\n\n\n\n const logTimer = (logLabel, traceLabel, args) => {\n init();\n\n if ((timerFlags & kShouldSkipAll) !== kShouldSkipAll)\n internalLogTimer(logLabel, traceLabel, args);\n };\n\n return {\n startTimer,\n endTimer,\n logTimer,\n };\n}\n\nmodule.exports = {\n kNone,\n kSkipLog,\n kSkipTrace,\n formatTime,\n time,\n timeEnd,\n timeLog,\n debuglog,\n debugWithTimer,\n initializeDebugEnv,\n};\n","internal/util/inspect.js":"'use strict';\n\nconst {\n AggregateError,\n AggregateErrorPrototype,\n Array,\n ArrayBuffer,\n ArrayBufferPrototype,\n ArrayIsArray,\n ArrayPrototype,\n ArrayPrototypeFilter,\n ArrayPrototypeForEach,\n ArrayPrototypeIncludes,\n ArrayPrototypeIndexOf,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n ArrayPrototypePop,\n ArrayPrototypePush,\n ArrayPrototypePushApply,\n ArrayPrototypeSlice,\n ArrayPrototypeSort,\n ArrayPrototypeSplice,\n ArrayPrototypeUnshift,\n BigIntPrototypeValueOf,\n Boolean,\n BooleanPrototype,\n BooleanPrototypeValueOf,\n DataView,\n DataViewPrototype,\n Date,\n DatePrototype,\n DatePrototypeGetTime,\n DatePrototypeToISOString,\n DatePrototypeToString,\n Error,\n ErrorPrototype,\n ErrorPrototypeToString,\n Function,\n FunctionPrototype,\n FunctionPrototypeBind,\n FunctionPrototypeCall,\n FunctionPrototypeSymbolHasInstance,\n FunctionPrototypeToString,\n JSONStringify,\n Map,\n MapPrototype,\n MapPrototypeEntries,\n MapPrototypeGetSize,\n MathFloor,\n MathMax,\n MathMin,\n MathRound,\n MathSqrt,\n MathTrunc,\n Number,\n NumberIsFinite,\n NumberIsNaN,\n NumberParseFloat,\n NumberParseInt,\n NumberPrototype,\n NumberPrototypeToString,\n NumberPrototypeValueOf,\n Object,\n ObjectAssign,\n ObjectDefineProperty,\n ObjectGetOwnPropertyDescriptor,\n ObjectGetOwnPropertyNames,\n ObjectGetOwnPropertySymbols,\n ObjectGetPrototypeOf,\n ObjectIs,\n ObjectKeys,\n ObjectPrototype,\n ObjectPrototypeHasOwnProperty,\n ObjectPrototypePropertyIsEnumerable,\n ObjectPrototypeToString,\n ObjectSeal,\n ObjectSetPrototypeOf,\n Promise,\n PromisePrototype,\n RangeError,\n RangeErrorPrototype,\n ReflectApply,\n ReflectOwnKeys,\n RegExp,\n RegExpPrototype,\n RegExpPrototypeExec,\n RegExpPrototypeSymbolReplace,\n RegExpPrototypeSymbolSplit,\n RegExpPrototypeToString,\n SafeMap,\n SafeSet,\n SafeStringIterator,\n Set,\n SetPrototype,\n SetPrototypeGetSize,\n SetPrototypeValues,\n String,\n StringPrototype,\n StringPrototypeCharCodeAt,\n StringPrototypeCodePointAt,\n StringPrototypeEndsWith,\n StringPrototypeIncludes,\n StringPrototypeIndexOf,\n StringPrototypeLastIndexOf,\n StringPrototypeNormalize,\n StringPrototypePadEnd,\n StringPrototypePadStart,\n StringPrototypeRepeat,\n StringPrototypeReplace,\n StringPrototypeReplaceAll,\n StringPrototypeSlice,\n StringPrototypeSplit,\n StringPrototypeStartsWith,\n StringPrototypeToLowerCase,\n StringPrototypeValueOf,\n SymbolIterator,\n SymbolPrototypeToString,\n SymbolPrototypeValueOf,\n SymbolToPrimitive,\n SymbolToStringTag,\n TypeError,\n TypeErrorPrototype,\n TypedArray,\n TypedArrayPrototype,\n TypedArrayPrototypeGetLength,\n TypedArrayPrototypeGetSymbolToStringTag,\n Uint8Array,\n WeakMap,\n WeakMapPrototype,\n WeakSet,\n WeakSetPrototype,\n globalThis,\n uncurryThis,\n} = primordials;\n\nconst {\n constants: {\n ALL_PROPERTIES,\n ONLY_ENUMERABLE,\n kPending,\n kRejected,\n },\n getOwnNonIndexProperties,\n getPromiseDetails,\n getProxyDetails,\n previewEntries,\n getConstructorName: internalGetConstructorName,\n getExternalValue,\n} = internalBinding('util');\n\nconst {\n customInspectSymbol,\n isError,\n join,\n removeColors,\n} = require('internal/util');\n\nconst {\n isStackOverflowError,\n} = require('internal/errors');\n\nconst {\n isAsyncFunction,\n isGeneratorFunction,\n isAnyArrayBuffer,\n isArrayBuffer,\n isArgumentsObject,\n isBoxedPrimitive,\n isDataView,\n isExternal,\n isMap,\n isMapIterator,\n isModuleNamespaceObject,\n isNativeError,\n isPromise,\n isSet,\n isSetIterator,\n isWeakMap,\n isWeakSet,\n isRegExp,\n isDate,\n isTypedArray,\n isStringObject,\n isNumberObject,\n isBooleanObject,\n isBigIntObject,\n} = require('internal/util/types');\n\nconst assert = require('internal/assert');\n\nconst { BuiltinModule } = require('internal/bootstrap/realm');\nconst {\n validateObject,\n validateString,\n kValidateObjectAllowArray,\n} = require('internal/validators');\n\nlet hexSlice;\nlet internalUrl;\n\nfunction pathToFileUrlHref(filepath) {\n internalUrl ??= require('internal/url');\n return internalUrl.pathToFileURL(filepath).href;\n}\n\nfunction isURL(value) {\n internalUrl ??= require('internal/url');\n return typeof value.href === 'string' && value instanceof internalUrl.URL;\n}\n\nconst builtInObjects = new SafeSet(\n ArrayPrototypeFilter(\n ObjectGetOwnPropertyNames(globalThis),\n (e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null,\n ),\n);\n\n\nconst isUndetectableObject = (v) => typeof v === 'undefined' && v !== undefined;\n\n\n\nconst inspectDefaultOptions = ObjectSeal({\n showHidden: false,\n depth: 2,\n colors: false,\n customInspect: true,\n showProxy: false,\n maxArrayLength: 100,\n maxStringLength: 10000,\n breakLength: 80,\n compact: 3,\n sorted: false,\n getters: false,\n numericSeparator: false,\n});\n\nconst kObjectType = 0;\nconst kArrayType = 1;\nconst kArrayExtrasType = 2;\n\n\nconst strEscapeSequencesRegExp = /[\\x00-\\x1f\\x27\\x5c\\x7f-\\x9f]|[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<~]', 'g',\n);\n\nlet getStringWidth;\n\nfunction getUserOptions(ctx, isCrossContext) {\n const ret = {\n stylize: ctx.stylize,\n showHidden: ctx.showHidden,\n depth: ctx.depth,\n colors: ctx.colors,\n customInspect: ctx.customInspect,\n showProxy: ctx.showProxy,\n maxArrayLength: ctx.maxArrayLength,\n maxStringLength: ctx.maxStringLength,\n breakLength: ctx.breakLength,\n compact: ctx.compact,\n sorted: ctx.sorted,\n getters: ctx.getters,\n numericSeparator: ctx.numericSeparator,\n ...ctx.userOptions,\n };\n\n\n\n\n\n\n if (isCrossContext) {\n ObjectSetPrototypeOf(ret, null);\n for (const key of ObjectKeys(ret)) {\n if ((typeof ret[key] === 'object' || typeof ret[key] === 'function') &&\n ret[key] !== null) {\n delete ret[key];\n }\n }\n ret.stylize = ObjectSetPrototypeOf((value, flavour) => {\n let stylized;\n try {\n stylized = `${ctx.stylize(value, flavour)}`;\n } catch {\n\n }\n\n if (typeof stylized !== 'string') return value;\n\n return stylized;\n }, null);\n }\n\n return ret;\n}\n\n\n\n\n\n\n\n\nfunction inspect(value, opts) {\n\n const ctx = {\n budget: {},\n indentationLvl: 0,\n seen: [],\n currentDepth: 0,\n stylize: stylizeNoColor,\n showHidden: inspectDefaultOptions.showHidden,\n depth: inspectDefaultOptions.depth,\n colors: inspectDefaultOptions.colors,\n customInspect: inspectDefaultOptions.customInspect,\n showProxy: inspectDefaultOptions.showProxy,\n maxArrayLength: inspectDefaultOptions.maxArrayLength,\n maxStringLength: inspectDefaultOptions.maxStringLength,\n breakLength: inspectDefaultOptions.breakLength,\n compact: inspectDefaultOptions.compact,\n sorted: inspectDefaultOptions.sorted,\n getters: inspectDefaultOptions.getters,\n numericSeparator: inspectDefaultOptions.numericSeparator,\n };\n if (arguments.length > 1) {\n\n if (arguments.length > 2) {\n if (arguments[2] !== undefined) {\n ctx.depth = arguments[2];\n }\n if (arguments.length > 3 && arguments[3] !== undefined) {\n ctx.colors = arguments[3];\n }\n }\n\n if (typeof opts === 'boolean') {\n ctx.showHidden = opts;\n } else if (opts) {\n const optKeys = ObjectKeys(opts);\n for (let i = 0; i < optKeys.length; ++i) {\n const key = optKeys[i];\n\n\n\n if (\n ObjectPrototypeHasOwnProperty(inspectDefaultOptions, key) ||\n key === 'stylize') {\n ctx[key] = opts[key];\n } else if (ctx.userOptions === undefined) {\n\n ctx.userOptions = opts;\n }\n }\n }\n }\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n if (ctx.maxArrayLength === null) ctx.maxArrayLength = Infinity;\n if (ctx.maxStringLength === null) ctx.maxStringLength = Infinity;\n return formatValue(ctx, value, 0);\n}\ninspect.custom = customInspectSymbol;\n\nObjectDefineProperty(inspect, 'defaultOptions', {\n __proto__: null,\n get() {\n return inspectDefaultOptions;\n },\n set(options) {\n validateObject(options, 'options');\n return ObjectAssign(inspectDefaultOptions, options);\n },\n});\n\n\n\n\nconst defaultFG = 39;\nconst defaultBG = 49;\ninspect.colors = {\n __proto__: null,\n reset: [0, 0],\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n blink: [5, 25],\n\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n doubleunderline: [21, 24],\n black: [30, defaultFG],\n red: [31, defaultFG],\n green: [32, defaultFG],\n yellow: [33, defaultFG],\n blue: [34, defaultFG],\n magenta: [35, defaultFG],\n cyan: [36, defaultFG],\n white: [37, defaultFG],\n bgBlack: [40, defaultBG],\n bgRed: [41, defaultBG],\n bgGreen: [42, defaultBG],\n bgYellow: [43, defaultBG],\n bgBlue: [44, defaultBG],\n bgMagenta: [45, defaultBG],\n bgCyan: [46, defaultBG],\n bgWhite: [47, defaultBG],\n framed: [51, 54],\n overlined: [53, 55],\n gray: [90, defaultFG],\n redBright: [91, defaultFG],\n greenBright: [92, defaultFG],\n yellowBright: [93, defaultFG],\n blueBright: [94, defaultFG],\n magentaBright: [95, defaultFG],\n cyanBright: [96, defaultFG],\n whiteBright: [97, defaultFG],\n bgGray: [100, defaultBG],\n bgRedBright: [101, defaultBG],\n bgGreenBright: [102, defaultBG],\n bgYellowBright: [103, defaultBG],\n bgBlueBright: [104, defaultBG],\n bgMagentaBright: [105, defaultBG],\n bgCyanBright: [106, defaultBG],\n bgWhiteBright: [107, defaultBG],\n};\n\nfunction defineColorAlias(target, alias) {\n ObjectDefineProperty(inspect.colors, alias, {\n __proto__: null,\n get() {\n return this[target];\n },\n set(value) {\n this[target] = value;\n },\n configurable: true,\n enumerable: false,\n });\n}\n\ndefineColorAlias('gray', 'grey');\ndefineColorAlias('gray', 'blackBright');\ndefineColorAlias('bgGray', 'bgGrey');\ndefineColorAlias('bgGray', 'bgBlackBright');\ndefineColorAlias('dim', 'faint');\ndefineColorAlias('strikethrough', 'crossedout');\ndefineColorAlias('strikethrough', 'strikeThrough');\ndefineColorAlias('strikethrough', 'crossedOut');\ndefineColorAlias('hidden', 'conceal');\ndefineColorAlias('inverse', 'swapColors');\ndefineColorAlias('inverse', 'swapcolors');\ndefineColorAlias('doubleunderline', 'doubleUnderline');\n\n\ninspect.styles = ObjectAssign({ __proto__: null }, {\n special: 'cyan',\n number: 'yellow',\n bigint: 'yellow',\n boolean: 'yellow',\n undefined: 'grey',\n null: 'bold',\n string: 'green',\n symbol: 'green',\n date: 'magenta',\n\n regexp: highlightRegExp,\n module: 'underline',\n});\n\n\ninspect.styles.regexp.colors = ['green', 'red', 'yellow', 'cyan', 'magenta'];\n\nconst highlightRegExpColors = inspect.styles.regexp.colors.slice();\n\n\n\n\n\n\n\n\n\n\nfunction highlightRegExp(regexpString) {\n let out = '';\n let i = 0;\n let depth = 0;\n let inClass = false;\n\n\n\n\n\n\n const paletteNames = highlightRegExp.colors?.length > 0 ?\n highlightRegExp.colors :\n highlightRegExpColors;\n\n const palette = paletteNames.reduce((acc, name) => {\n const color = inspect.colors[name];\n if (color) acc.push([`\\u001b[${color[0]}m`, `\\u001b[${color[1]}m`]);\n return acc;\n }, []);\n\n function writeGroup(start, end, decreaseDepth = 1) {\n let seq = '';\n i++;\n\n\n\n while (i < regexpString.length && regexpString[i] !== end) {\n seq += regexpString[i++];\n }\n if (i < regexpString.length) {\n depth -= decreaseDepth;\n write(start);\n writeDepth(seq, 1, 1);\n write(end);\n depth += decreaseDepth;\n } else {\n\n\n writeDepth(start, 1, -seq.length);\n }\n }\n\n const write = (str) => {\n const idx = depth % palette.length;\n\n const color = palette[idx] ?? palette[0];\n out += color[0] + str + color[1];\n return idx;\n };\n\n function writeDepth(str, incDepth, incI) {\n depth += incDepth;\n write(str);\n depth -= incDepth;\n i += incI;\n }\n\n\n write('/');\n depth++;\n i = 1;\n\n\n while (i < regexpString.length) {\n const ch = regexpString[i];\n\n if (inClass) {\n if (ch === '\\\\') {\n let seq = '\\\\';\n i++;\n if (i < regexpString.length) {\n seq += regexpString[i++];\n const next = seq[1];\n if (next === 'u' && regexpString[i] === '{') {\n writeGroup(`${seq}{`, '}', 0);\n continue;\n } else if ((next === 'p' || next === 'P') && regexpString[i] === '{') {\n writeGroup(`${seq}{`, '}', 0);\n continue;\n } else if (seq[1] === 'x') {\n seq += regexpString.slice(i, i + 2);\n i += 2;\n }\n }\n write(seq);\n } else if (ch === ']') {\n depth--;\n write(']');\n i++;\n inClass = false;\n } else if (ch === '-' && regexpString[i - 1] !== '[' &&\n i + 1 < regexpString.length && regexpString[i + 1] !== ']') {\n writeDepth('-', 1, 1);\n } else {\n write(ch);\n i++;\n }\n } else if (ch === '[') {\n\n write('[');\n depth++;\n i++;\n inClass = true;\n } else if (ch === '(') {\n write('(');\n depth++;\n i++;\n if (i < regexpString.length && regexpString[i] === '?') {\n\n i++;\n const a = i < regexpString.length ? regexpString[i] : '';\n if (a === ':' || a === '=' || a === '!') {\n writeDepth(`?${a}`, -1, 1);\n } else {\n const b = i + 1 < regexpString.length ? regexpString[i + 1] : '';\n if (a === '<' && (b === '=' || b === '!')) {\n writeDepth(`?<${b}`, -1, 2);\n } else if (a === '<') {\n\n i++;\n const start = i;\n while (i < regexpString.length && regexpString[i] !== '>') {\n i++;\n }\n const name = regexpString.slice(start, i);\n if (i < regexpString.length && regexpString[i] === '>') {\n depth--;\n write('?<');\n writeDepth(name, 1, 0);\n write('>');\n depth++;\n i++;\n } else {\n writeDepth('?<', -1, 0);\n write(name);\n }\n } else {\n write('?');\n }\n }\n }\n } else if (ch === ')') {\n depth--;\n write(')');\n i++;\n } else if (ch === '\\\\') {\n let seq = '\\\\';\n i++;\n if (i < regexpString.length) {\n seq += regexpString[i++];\n const next = seq[1];\n if (i < regexpString.length) {\n if (next === 'u' && regexpString[i] === '{') {\n writeGroup(`${seq}{`, '}', 0);\n continue;\n } else if (next === 'x') {\n seq += regexpString.slice(i, i + 2);\n i += 2;\n } else if (next >= '0' && next <= '9') {\n while (i < regexpString.length && regexpString[i] >= '0' && regexpString[i] <= '9') {\n seq += regexpString[i++];\n }\n } else if (next === 'k' && regexpString[i] === '<') {\n writeGroup(`${seq}<`, '>');\n continue;\n } else if ((next === 'p' || next === 'P') && regexpString[i] === '{') {\n\n writeGroup(`${seq}{`, '}', 0);\n continue;\n }\n }\n }\n writeDepth(seq, 1, 0);\n } else if (ch === '|' || ch === '+' || ch === '*' || ch === '?' || ch === ',' || ch === '^' || ch === '$') {\n writeDepth(ch, 3, 1);\n } else if (ch === '{') {\n i++;\n let digits = '';\n while (i < regexpString.length && regexpString[i] >= '0' && regexpString[i] <= '9') {\n digits += regexpString[i++];\n }\n if (digits) {\n write('{');\n depth++;\n writeDepth(digits, 1, 0);\n }\n if (i < regexpString.length) {\n if (regexpString[i] === ',') {\n if (!digits) {\n write('{');\n depth++;\n }\n write(',');\n i++;\n } else if (!digits) {\n depth += 1;\n write('{');\n depth -= 1;\n continue;\n }\n }\n let digits2 = '';\n while (i < regexpString.length && regexpString[i] >= '0' && regexpString[i] <= '9') {\n digits2 += regexpString[i++];\n }\n if (digits2) {\n writeDepth(digits2, 1, 0);\n }\n if (i < regexpString.length && regexpString[i] === '}') {\n depth--;\n write('}');\n i++;\n }\n if (i < regexpString.length && regexpString[i] === '?') {\n writeDepth('?', 3, 1);\n }\n } else if (ch === '.') {\n writeDepth(ch, 2, 1);\n } else if (ch === '/') {\n\n break;\n } else {\n writeDepth(ch, 1, 1);\n }\n }\n\n\n writeDepth('/', -1, 1);\n if (i < regexpString.length) {\n write(regexpString.slice(i));\n }\n return out;\n}\n\nfunction addQuotes(str, quotes) {\n if (quotes === -1) {\n return `\"${str}\"`;\n }\n if (quotes === -2) {\n return `\\`${str}\\``;\n }\n return `'${str}'`;\n}\n\nfunction escapeFn(str) {\n const charCode = StringPrototypeCharCodeAt(str);\n return meta.length > charCode ? meta[charCode] : `\\\\u${NumberPrototypeToString(charCode, 16)}`;\n}\n\n\n\nfunction strEscape(str) {\n let escapeTest = strEscapeSequencesRegExp;\n let escapeReplace = strEscapeSequencesReplacer;\n let singleQuote = 39;\n\n\n\n\n\n if (StringPrototypeIncludes(str, \"'\")) {\n\n\n if (!StringPrototypeIncludes(str, '\"')) {\n singleQuote = -1;\n } else if (!StringPrototypeIncludes(str, '`') &&\n !StringPrototypeIncludes(str, '${')) {\n singleQuote = -2;\n }\n if (singleQuote !== 39) {\n escapeTest = strEscapeSequencesRegExpSingle;\n escapeReplace = strEscapeSequencesReplacerSingle;\n }\n }\n\n\n if (str.length < 5000 && RegExpPrototypeExec(escapeTest, str) === null)\n return addQuotes(str, singleQuote);\n if (str.length > 100) {\n str = RegExpPrototypeSymbolReplace(escapeReplace, str, escapeFn);\n return addQuotes(str, singleQuote);\n }\n\n let result = '';\n let last = 0;\n for (let i = 0; i < str.length; i++) {\n const point = StringPrototypeCharCodeAt(str, i);\n if (point === singleQuote ||\n point === 92 ||\n point < 32 ||\n (point > 126 && point < 160)) {\n if (last === i) {\n result += meta[point];\n } else {\n result += `${StringPrototypeSlice(str, last, i)}${meta[point]}`;\n }\n last = i + 1;\n } else if (point >= 0xd800 && point <= 0xdfff) {\n if (point <= 0xdbff && i + 1 < str.length) {\n const point = StringPrototypeCharCodeAt(str, i + 1);\n if (point >= 0xdc00 && point <= 0xdfff) {\n i++;\n continue;\n }\n }\n result += `${StringPrototypeSlice(str, last, i)}\\\\u${NumberPrototypeToString(point, 16)}`;\n last = i + 1;\n }\n }\n\n if (last !== str.length) {\n result += StringPrototypeSlice(str, last);\n }\n return addQuotes(result, singleQuote);\n}\n\nfunction stylizeWithColor(str, styleType) {\n const style = inspect.styles[styleType];\n if (style !== undefined) {\n const color = inspect.colors[style];\n if (color !== undefined) {\n return `\\u001b[${color[0]}m${str}\\u001b[${color[1]}m`;\n }\n if (typeof style === 'function') {\n return style(str);\n }\n }\n return str;\n}\n\nfunction stylizeNoColor(str) {\n return str;\n}\n\n\nfunction getEmptyFormatArray() {\n return [];\n}\n\nfunction isInstanceof(object, proto) {\n try {\n return object instanceof proto;\n } catch {\n return false;\n }\n}\n\n\nconst wellKnownPrototypes = new SafeMap()\n .set(ArrayPrototype, { name: 'Array', constructor: Array })\n .set(ArrayBufferPrototype, { name: 'ArrayBuffer', constructor: ArrayBuffer })\n .set(FunctionPrototype, { name: 'Function', constructor: Function })\n .set(MapPrototype, { name: 'Map', constructor: Map })\n .set(SetPrototype, { name: 'Set', constructor: Set })\n .set(ObjectPrototype, { name: 'Object', constructor: Object })\n .set(TypedArrayPrototype, { name: 'TypedArray', constructor: TypedArray })\n .set(RegExpPrototype, { name: 'RegExp', constructor: RegExp })\n .set(DatePrototype, { name: 'Date', constructor: Date })\n .set(DataViewPrototype, { name: 'DataView', constructor: DataView })\n\n .set(ErrorPrototype, { name: 'Error', constructor: Error })\n .set(AggregateErrorPrototype, { name: 'AggregateError', constructor: AggregateError })\n .set(RangeErrorPrototype, { name: 'RangeError', constructor: RangeError })\n .set(TypeErrorPrototype, { name: 'TypeError', constructor: TypeError })\n\n .set(BooleanPrototype, { name: 'Boolean', constructor: Boolean })\n .set(NumberPrototype, { name: 'Number', constructor: Number })\n .set(StringPrototype, { name: 'String', constructor: String })\n .set(PromisePrototype, { name: 'Promise', constructor: Promise })\n .set(WeakMapPrototype, { name: 'WeakMap', constructor: WeakMap })\n .set(WeakSetPrototype, { name: 'WeakSet', constructor: WeakSet });\n\nfunction getConstructorName(obj, ctx, recurseTimes, protoProps) {\n let firstProto;\n const tmp = obj;\n while (obj || isUndetectableObject(obj)) {\n const wellKnownPrototypeNameAndConstructor = wellKnownPrototypes.get(obj);\n if (wellKnownPrototypeNameAndConstructor !== undefined) {\n const { name, constructor } = wellKnownPrototypeNameAndConstructor;\n if (FunctionPrototypeSymbolHasInstance(constructor, tmp)) {\n if (protoProps !== undefined && firstProto !== obj) {\n addPrototypeProperties(\n ctx, tmp, firstProto || tmp, recurseTimes, protoProps);\n }\n return name;\n }\n }\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');\n if (descriptor !== undefined &&\n typeof descriptor.value === 'function' &&\n descriptor.value.name !== '' &&\n isInstanceof(tmp, descriptor.value)) {\n if (protoProps !== undefined &&\n (firstProto !== obj ||\n !builtInObjects.has(descriptor.value.name))) {\n addPrototypeProperties(\n ctx, tmp, firstProto || tmp, recurseTimes, protoProps);\n }\n return String(descriptor.value.name);\n }\n\n obj = ObjectGetPrototypeOf(obj);\n if (firstProto === undefined) {\n firstProto = obj;\n }\n }\n\n if (firstProto === null) {\n return null;\n }\n\n const res = internalGetConstructorName(tmp);\n\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n return `${res} `;\n }\n\n const protoConstr = getConstructorName(\n firstProto, ctx, recurseTimes + 1, protoProps);\n\n if (protoConstr === null) {\n return `${res} <${inspect(firstProto, {\n ...ctx,\n customInspect: false,\n depth: -1,\n })}>`;\n }\n\n return `${res} <${protoConstr}>`;\n}\n\n\n\n\nfunction addPrototypeProperties(ctx, main, obj, recurseTimes, output) {\n let depth = 0;\n let keys;\n let keySet;\n do {\n if (depth !== 0 || main === obj) {\n obj = ObjectGetPrototypeOf(obj);\n\n if (obj === null) {\n return;\n }\n\n const descriptor = ObjectGetOwnPropertyDescriptor(obj, 'constructor');\n if (descriptor !== undefined &&\n typeof descriptor.value === 'function' &&\n builtInObjects.has(descriptor.value.name)) {\n return;\n }\n }\n\n if (depth === 0) {\n keySet = new SafeSet();\n } else {\n ArrayPrototypeForEach(keys, (key) => keySet.add(key));\n }\n\n keys = ReflectOwnKeys(obj);\n ArrayPrototypePush(ctx.seen, main);\n for (const key of keys) {\n\n if (key === 'constructor' ||\n ObjectPrototypeHasOwnProperty(main, key) ||\n (depth !== 0 && keySet.has(key))) {\n continue;\n }\n const desc = ObjectGetOwnPropertyDescriptor(obj, key);\n if (typeof desc.value === 'function') {\n continue;\n }\n const value = formatProperty(\n ctx, obj, recurseTimes, key, kObjectType, desc, main);\n if (ctx.colors) {\n\n ArrayPrototypePush(output, `\\u001b[2m${value}\\u001b[22m`);\n } else {\n ArrayPrototypePush(output, value);\n }\n }\n ArrayPrototypePop(ctx.seen);\n\n\n\n } while (++depth !== 3);\n}\n\n\nfunction getPrefix(constructor, tag, fallback, size = '') {\n if (constructor === null) {\n if (tag !== '' && fallback !== tag) {\n return `[${fallback}${size}: null prototype] [${tag}] `;\n }\n return `[${fallback}${size}: null prototype] `;\n }\n\n if (tag !== '') {\n const dot = StringPrototypeLastIndexOf(tag, '.');\n if (constructor === (dot >= 1 ? StringPrototypeSlice(tag, dot + 1) : tag)) {\n return `${tag}${size} `;\n }\n return `${constructor}${size} [${tag}] `;\n }\n\n return `${constructor}${size} `;\n}\n\n\nfunction getKeys(value, showHidden) {\n let keys;\n const symbols = ObjectGetOwnPropertySymbols(value);\n if (showHidden) {\n keys = ObjectGetOwnPropertyNames(value);\n if (symbols.length !== 0)\n ArrayPrototypePushApply(keys, symbols);\n } else {\n\n\n\n\n\n try {\n keys = ObjectKeys(value);\n } catch (err) {\n assert(isNativeError(err) && err.name === 'ReferenceError' &&\n isModuleNamespaceObject(value));\n keys = ObjectGetOwnPropertyNames(value);\n }\n if (symbols.length !== 0) {\n const filter = (key) => ObjectPrototypePropertyIsEnumerable(value, key);\n ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, filter));\n }\n }\n return keys;\n}\n\nfunction getCtxStyle(value, constructor, tag) {\n let fallback = '';\n if (constructor === null) {\n fallback = internalGetConstructorName(value);\n if (fallback === tag) {\n fallback = 'Object';\n }\n }\n return getPrefix(constructor, tag, fallback);\n}\n\nfunction formatProxy(ctx, proxy, recurseTimes) {\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n return ctx.stylize('Proxy [Array]', 'special');\n }\n recurseTimes += 1;\n ctx.indentationLvl += 2;\n const res = [\n formatValue(ctx, proxy[0], recurseTimes),\n formatValue(ctx, proxy[1], recurseTimes),\n ];\n ctx.indentationLvl -= 2;\n return reduceToSingleString(\n ctx, res, '', ['Proxy [', ']'], kArrayExtrasType, recurseTimes);\n}\n\n\n\n\nfunction formatValue(ctx, value, recurseTimes, typedArray) {\n\n if (typeof value !== 'object' &&\n typeof value !== 'function' &&\n !isUndetectableObject(value)) {\n return formatPrimitive(ctx.stylize, value, ctx);\n }\n if (value === null) {\n return ctx.stylize('null', 'null');\n }\n\n\n const context = value;\n let proxies = 0;\n\n\n let proxy = getProxyDetails(value, !!ctx.showProxy);\n if (proxy !== undefined) {\n if (ctx.showProxy) {\n if (proxy[0] === null) {\n return ctx.stylize('', 'special');\n }\n return formatProxy(ctx, proxy, recurseTimes);\n }\n do {\n if (proxy === null) {\n let formatted = ctx.stylize('', 'special');\n for (let i = 0; i < proxies; i++) {\n formatted = `${ctx.stylize('Proxy(', 'special')}${formatted}${ctx.stylize(')', 'special')}`;\n }\n return formatted;\n }\n value = proxy;\n proxy = getProxyDetails(value, false);\n proxies += 1;\n } while (proxy !== undefined);\n }\n\n\n\n if (ctx.customInspect) {\n const maybeCustom = value[customInspectSymbol];\n if (typeof maybeCustom === 'function' &&\n\n maybeCustom !== inspect &&\n\n ObjectGetOwnPropertyDescriptor(value, 'constructor')?.value?.prototype !== value) {\n\n\n const depth = ctx.depth === null ? null : ctx.depth - recurseTimes;\n const isCrossContext =\n proxies !== 0 || !FunctionPrototypeSymbolHasInstance(Object, context);\n const ret = FunctionPrototypeCall(\n maybeCustom,\n context,\n depth,\n getUserOptions(ctx, isCrossContext),\n inspect,\n );\n\n\n if (ret !== context) {\n if (typeof ret !== 'string') {\n return formatValue(ctx, ret, recurseTimes);\n }\n return StringPrototypeReplaceAll(ret, '\\n', `\\n${StringPrototypeRepeat(' ', ctx.indentationLvl)}`);\n }\n }\n }\n\n\n\n if (ctx.seen.includes(value)) {\n let index = 1;\n if (ctx.circular === undefined) {\n ctx.circular = new SafeMap();\n ctx.circular.set(value, index);\n } else {\n index = ctx.circular.get(value);\n if (index === undefined) {\n index = ctx.circular.size + 1;\n ctx.circular.set(value, index);\n }\n }\n return ctx.stylize(`[Circular *${index}]`, 'special');\n }\n\n let formatted = formatRaw(ctx, value, recurseTimes, typedArray);\n\n if (proxies !== 0) {\n for (let i = 0; i < proxies; i++) {\n formatted = `${ctx.stylize('Proxy(', 'special')}${formatted}${ctx.stylize(')', 'special')}`;\n }\n }\n\n return formatted;\n}\n\nfunction formatRaw(ctx, value, recurseTimes, typedArray) {\n let keys;\n let protoProps;\n if (ctx.showHidden && (recurseTimes <= ctx.depth || ctx.depth === null)) {\n protoProps = [];\n }\n\n const constructor = getConstructorName(value, ctx, recurseTimes, protoProps);\n\n if (protoProps !== undefined && protoProps.length === 0) {\n protoProps = undefined;\n }\n\n let tag = '';\n\n try {\n tag = value[SymbolToStringTag];\n } catch {\n\n }\n\n\n\n if (typeof tag !== 'string' ||\n (tag !== '' &&\n (ctx.showHidden ?\n ObjectPrototypeHasOwnProperty :\n ObjectPrototypePropertyIsEnumerable)(\n value, SymbolToStringTag,\n ))) {\n tag = '';\n }\n let base = '';\n let formatter = getEmptyFormatArray;\n let braces;\n let noIterator = true;\n let i = 0;\n const filter = ctx.showHidden ? ALL_PROPERTIES : ONLY_ENUMERABLE;\n\n let extrasType = kObjectType;\n let extraKeys;\n\n\n\n\n if (SymbolIterator in value || constructor === null) {\n noIterator = false;\n if (ArrayIsArray(value)) {\n\n const prefix = (constructor !== 'Array' || tag !== '') ?\n getPrefix(constructor, tag, 'Array', `(${value.length})`) :\n '';\n keys = getOwnNonIndexProperties(value, filter);\n braces = [`${prefix}[`, ']'];\n if (value.length === 0 && keys.length === 0 && protoProps === undefined)\n return `${braces[0]}]`;\n extrasType = kArrayExtrasType;\n formatter = formatArray;\n } else if (isSet(value)) {\n const size = SetPrototypeGetSize(value);\n const prefix = getPrefix(constructor, tag, 'Set', `(${size})`);\n keys = getKeys(value, ctx.showHidden);\n formatter = constructor !== null ?\n FunctionPrototypeBind(formatSet, null, value) :\n FunctionPrototypeBind(formatSet, null, SetPrototypeValues(value));\n if (size === 0 && keys.length === 0 && protoProps === undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, '}'];\n } else if (isMap(value)) {\n const size = MapPrototypeGetSize(value);\n const prefix = getPrefix(constructor, tag, 'Map', `(${size})`);\n keys = getKeys(value, ctx.showHidden);\n formatter = constructor !== null ?\n FunctionPrototypeBind(formatMap, null, value) :\n FunctionPrototypeBind(formatMap, null, MapPrototypeEntries(value));\n if (size === 0 && keys.length === 0 && protoProps === undefined)\n return `${prefix}{}`;\n braces = [`${prefix}{`, '}'];\n } else if (isTypedArray(value)) {\n keys = getOwnNonIndexProperties(value, filter);\n let bound = value;\n let fallback = '';\n if (constructor === null) {\n fallback = TypedArrayPrototypeGetSymbolToStringTag(value);\n\n bound = new primordials[fallback](value);\n }\n const size = TypedArrayPrototypeGetLength(value);\n const prefix = getPrefix(constructor, tag, fallback, `(${size})`);\n braces = [`${prefix}[`, ']'];\n if (value.length === 0 && keys.length === 0 && !ctx.showHidden)\n return `${braces[0]}]`;\n\n\n formatter = FunctionPrototypeBind(formatTypedArray, null, bound, size);\n extrasType = kArrayExtrasType;\n\n if (ctx.showHidden) {\n extraKeys = ['BYTES_PER_ELEMENT', 'length', 'byteLength', 'byteOffset', 'buffer'];\n typedArray = true;\n }\n } else if (isMapIterator(value)) {\n keys = getKeys(value, ctx.showHidden);\n braces = getIteratorBraces('Map', tag);\n\n formatter = FunctionPrototypeBind(formatIterator, null, braces);\n } else if (isSetIterator(value)) {\n keys = getKeys(value, ctx.showHidden);\n braces = getIteratorBraces('Set', tag);\n\n formatter = FunctionPrototypeBind(formatIterator, null, braces);\n } else {\n noIterator = true;\n }\n }\n if (noIterator) {\n keys = getKeys(value, ctx.showHidden);\n braces = ['{', '}'];\n if (typeof value === 'function') {\n base = getFunctionBase(ctx, value, constructor, tag);\n if (keys.length === 0 && protoProps === undefined)\n return ctx.stylize(base, 'special');\n } else if (constructor === 'Object') {\n if (isArgumentsObject(value)) {\n braces[0] = '[Arguments] {';\n } else if (tag !== '') {\n braces[0] = `${getPrefix(constructor, tag, 'Object')}{`;\n }\n if (keys.length === 0 && protoProps === undefined) {\n return `${braces[0]}}`;\n }\n } else if (isRegExp(value)) {\n\n base = RegExpPrototypeToString(\n constructor !== null ? value : new RegExp(value),\n );\n const prefix = getPrefix(constructor, tag, 'RegExp');\n if (prefix !== 'RegExp ')\n base = `${prefix}${base}`;\n base = ctx.stylize(base, 'regexp');\n if ((keys.length === 0 && protoProps === undefined) ||\n (recurseTimes > ctx.depth && ctx.depth !== null)) {\n return base;\n }\n } else if (isDate(value)) {\n\n base = NumberIsNaN(DatePrototypeGetTime(value)) ?\n DatePrototypeToString(value) :\n DatePrototypeToISOString(value);\n const prefix = getPrefix(constructor, tag, 'Date');\n if (prefix !== 'Date ')\n base = `${prefix}${base}`;\n if (keys.length === 0 && protoProps === undefined) {\n return ctx.stylize(base, 'date');\n }\n } else if (isError(value)) {\n base = formatError(value, constructor, tag, ctx, keys);\n if (keys.length === 0 && protoProps === undefined)\n return base;\n } else if (isAnyArrayBuffer(value)) {\n\n\n\n const arrayType = isArrayBuffer(value) ? 'ArrayBuffer' :\n 'SharedArrayBuffer';\n const prefix = getPrefix(constructor, tag, arrayType);\n if (typedArray === undefined) {\n formatter = formatArrayBuffer;\n } else if (keys.length === 0 && protoProps === undefined) {\n return prefix +\n `{ [byteLength]: ${formatNumber(ctx.stylize, value.byteLength, false)} }`;\n }\n braces[0] = `${prefix}{`;\n extraKeys = ['byteLength'];\n } else if (isDataView(value)) {\n braces[0] = `${getPrefix(constructor, tag, 'DataView')}{`;\n\n extraKeys = ['byteLength', 'byteOffset', 'buffer'];\n } else if (isPromise(value)) {\n braces[0] = `${getPrefix(constructor, tag, 'Promise')}{`;\n formatter = formatPromise;\n } else if (isWeakSet(value)) {\n braces[0] = `${getPrefix(constructor, tag, 'WeakSet')}{`;\n formatter = ctx.showHidden ? formatWeakSet : formatWeakCollection;\n } else if (isWeakMap(value)) {\n braces[0] = `${getPrefix(constructor, tag, 'WeakMap')}{`;\n formatter = ctx.showHidden ? formatWeakMap : formatWeakCollection;\n } else if (isModuleNamespaceObject(value)) {\n braces[0] = `${getPrefix(constructor, tag, 'Module')}{`;\n\n formatter = formatNamespaceObject.bind(null, keys);\n } else if (isBoxedPrimitive(value)) {\n base = getBoxedBase(value, ctx, keys, constructor, tag);\n if (keys.length === 0 && protoProps === undefined) {\n return base;\n }\n } else if (isURL(value) && !(recurseTimes > ctx.depth && ctx.depth !== null)) {\n base = value.href;\n if (keys.length === 0 && protoProps === undefined) {\n return base;\n }\n } else {\n if (keys.length === 0 && protoProps === undefined) {\n if (isExternal(value)) {\n const address = getExternalValue(value).toString(16);\n return ctx.stylize(`[External: ${address}]`, 'special');\n }\n return `${getCtxStyle(value, constructor, tag)}{}`;\n }\n braces[0] = `${getCtxStyle(value, constructor, tag)}{`;\n }\n }\n\n if (recurseTimes > ctx.depth && ctx.depth !== null) {\n let constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n if (constructor !== null)\n constructorName = `[${constructorName}]`;\n return ctx.stylize(constructorName, 'special');\n }\n recurseTimes += 1;\n\n ctx.seen.push(value);\n ctx.currentDepth = recurseTimes;\n let output;\n const indentationLvl = ctx.indentationLvl;\n try {\n output = formatter(ctx, value, recurseTimes);\n if (extraKeys !== undefined) {\n for (i = 0; i < extraKeys.length; i++) {\n let formatted;\n try {\n formatted = formatExtraProperties(ctx, value, recurseTimes, extraKeys[i], typedArray);\n } catch {\n const tempValue = { [extraKeys[i]]: value.buffer[extraKeys[i]] };\n formatted = formatExtraProperties(ctx, tempValue, recurseTimes, extraKeys[i], typedArray);\n }\n ArrayPrototypePush(output, formatted);\n }\n }\n for (i = 0; i < keys.length; i++) {\n ArrayPrototypePush(\n output,\n formatProperty(ctx, value, recurseTimes, keys[i], extrasType),\n );\n }\n if (protoProps !== undefined) {\n ArrayPrototypePushApply(output, protoProps);\n }\n } catch (err) {\n if (!isStackOverflowError(err)) throw err;\n const constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);\n return handleMaxCallStackSize(ctx, err, constructorName, indentationLvl);\n }\n if (ctx.circular !== undefined) {\n const index = ctx.circular.get(value);\n if (index !== undefined) {\n const reference = ctx.stylize(``, 'special');\n\n if (ctx.compact !== true) {\n base = base === '' ? reference : `${reference} ${base}`;\n } else {\n braces[0] = `${reference} ${braces[0]}`;\n }\n }\n }\n ctx.seen.pop();\n\n if (ctx.sorted) {\n const comparator = ctx.sorted === true ? undefined : ctx.sorted;\n if (extrasType === kObjectType) {\n ArrayPrototypeSort(output, comparator);\n } else if (keys.length > 1) {\n const sorted = ArrayPrototypeSort(ArrayPrototypeSlice(output, output.length - keys.length), comparator);\n ArrayPrototypeUnshift(sorted, output, output.length - keys.length, keys.length);\n ReflectApply(ArrayPrototypeSplice, null, sorted);\n }\n }\n\n const res = reduceToSingleString(\n ctx, output, base, braces, extrasType, recurseTimes, value);\n const budget = ctx.budget[ctx.indentationLvl] || 0;\n const newLength = budget + res.length;\n ctx.budget[ctx.indentationLvl] = newLength;\n\n\n\n\n\n\n\n if (newLength > 2 ** 27) {\n ctx.depth = -1;\n }\n return res;\n}\n\nfunction getIteratorBraces(type, tag) {\n if (tag !== `${type} Iterator`) {\n if (tag !== '')\n tag += '] [';\n tag += `${type} Iterator`;\n }\n return [`[${tag}] {`, '}'];\n}\n\nfunction getBoxedBase(value, ctx, keys, constructor, tag) {\n let fn;\n let type;\n if (isNumberObject(value)) {\n fn = NumberPrototypeValueOf;\n type = 'Number';\n } else if (isStringObject(value)) {\n fn = StringPrototypeValueOf;\n type = 'String';\n\n\n\n keys.splice(0, value.length);\n } else if (isBooleanObject(value)) {\n fn = BooleanPrototypeValueOf;\n type = 'Boolean';\n } else if (isBigIntObject(value)) {\n fn = BigIntPrototypeValueOf;\n type = 'BigInt';\n } else {\n fn = SymbolPrototypeValueOf;\n type = 'Symbol';\n }\n let base = `[${type}`;\n if (type !== constructor) {\n if (constructor === null) {\n base += ' (null prototype)';\n } else {\n base += ` (${constructor})`;\n }\n }\n base += `: ${formatPrimitive(stylizeNoColor, fn(value), ctx)}]`;\n if (tag !== '' && tag !== constructor) {\n base += ` [${tag}]`;\n }\n if (keys.length !== 0 || ctx.stylize === stylizeNoColor)\n return base;\n return ctx.stylize(base, StringPrototypeToLowerCase(type));\n}\n\nfunction getClassBase(value, constructor, tag) {\n const hasName = ObjectPrototypeHasOwnProperty(value, 'name');\n const name = (hasName && value.name) || '(anonymous)';\n let base = `class ${name}`;\n if (constructor !== 'Function' && constructor !== null) {\n base += ` [${constructor}]`;\n }\n if (tag !== '' && constructor !== tag) {\n base += ` [${tag}]`;\n }\n if (constructor !== null) {\n const superName = ObjectGetPrototypeOf(value).name;\n if (superName) {\n base += ` extends ${superName}`;\n }\n } else {\n base += ' extends [null prototype]';\n }\n return `[${base}]`;\n}\n\nfunction getFunctionBase(ctx, value, constructor, tag) {\n const stringified = FunctionPrototypeToString(value);\n if (StringPrototypeStartsWith(stringified, 'class') && stringified[stringified.length - 1] === '}') {\n const slice = StringPrototypeSlice(stringified, 5, -1);\n const bracketIndex = StringPrototypeIndexOf(slice, '{');\n if (bracketIndex !== -1 &&\n (!StringPrototypeIncludes(StringPrototypeSlice(slice, 0, bracketIndex), '(') ||\n\n RegExpPrototypeExec(classRegExp, RegExpPrototypeSymbolReplace(stripCommentsRegExp, slice)) !== null)\n ) {\n return getClassBase(value, constructor, tag);\n }\n }\n let type = 'Function';\n if (isGeneratorFunction(value)) {\n type = `Generator${type}`;\n }\n if (isAsyncFunction(value)) {\n type = `Async${type}`;\n }\n let base = `[${type}`;\n if (constructor === null) {\n base += ' (null prototype)';\n }\n if (value.name === '') {\n base += ' (anonymous)';\n } else {\n base += `: ${typeof value.name === 'string' ? value.name : formatValue(ctx, value.name)}`;\n }\n base += ']';\n if (constructor !== type && constructor !== null) {\n base += ` ${constructor}`;\n }\n if (tag !== '' && constructor !== tag) {\n base += ` [${tag}]`;\n }\n return base;\n}\n\nfunction identicalSequenceRange(a, b) {\n for (let i = 0; i < a.length - 3; i++) {\n\n const pos = ArrayPrototypeIndexOf(b, a[i]);\n if (pos !== -1) {\n const rest = b.length - pos;\n if (rest > 3) {\n let len = 1;\n const maxLen = MathMin(a.length - i, rest);\n\n while (maxLen > len && a[i + len] === b[pos + len]) {\n len++;\n }\n if (len > 3) {\n return [len, i];\n }\n }\n }\n }\n\n return [0, 0];\n}\n\nfunction getDuplicateErrorFrameRanges(frames) {\n\n const result = [];\n const lineToPositions = new SafeMap();\n\n for (let i = 0; i < frames.length; i++) {\n const positions = lineToPositions.get(frames[i]);\n if (positions === undefined) {\n lineToPositions.set(frames[i], [i]);\n } else {\n positions[positions.length] = i;\n }\n }\n\n const minimumDuplicateRange = 3;\n\n if (frames.length - lineToPositions.size <= minimumDuplicateRange) {\n return result;\n }\n\n for (let i = 0; i < frames.length - minimumDuplicateRange; i++) {\n const positions = lineToPositions.get(frames[i]);\n\n if (positions.length === 1 || positions[positions.length - 1] === i) {\n continue;\n }\n\n const current = positions.indexOf(i) + 1;\n if (current === positions.length) {\n continue;\n }\n\n\n let range = positions[positions.length - 1] - i;\n if (range < minimumDuplicateRange) {\n continue;\n }\n let extraSteps;\n if (current + 1 < positions.length) {\n\n\n\n let gcdRange = 0;\n for (let j = current; j < positions.length; j++) {\n let distance = positions[j] - i;\n while (distance !== 0) {\n const remainder = gcdRange % distance;\n if (gcdRange !== 0) {\n\n extraSteps ??= new SafeSet();\n extraSteps.add(gcdRange);\n }\n gcdRange = distance;\n distance = remainder;\n }\n if (gcdRange === 1) break;\n }\n range = gcdRange;\n if (extraSteps) {\n extraSteps.delete(range);\n extraSteps = [...extraSteps];\n }\n }\n let maxRange = range;\n let maxDuplicates = 0;\n\n let duplicateRanges = 0;\n\n for (let nextStart = i + range; ; nextStart += range) {\n let equalFrames = 0;\n for (let j = 0; j < range; j++) {\n if (frames[i + j] !== frames[nextStart + j]) {\n break;\n }\n equalFrames++;\n }\n\n if (equalFrames !== range) {\n if (!extraSteps?.length) {\n break;\n }\n\n if (duplicateRanges !== 0 && maxRange * maxDuplicates < range * duplicateRanges) {\n maxRange = range;\n maxDuplicates = duplicateRanges;\n }\n range = extraSteps.pop();\n nextStart = i;\n duplicateRanges = 0;\n continue;\n }\n duplicateRanges++;\n }\n\n if (maxDuplicates !== 0 && maxRange * maxDuplicates >= range * duplicateRanges) {\n range = maxRange;\n duplicateRanges = maxDuplicates;\n }\n\n if (duplicateRanges * range >= 3) {\n result.push(i + range, range, duplicateRanges);\n\n i += range * (duplicateRanges + 1) - 1;\n }\n }\n\n return result;\n}\n\nfunction getStackString(ctx, error) {\n let stack;\n try {\n stack = error.stack;\n } catch {\n\n }\n if (stack) {\n if (typeof stack === 'string') {\n return stack;\n }\n ctx.seen.push(error);\n ctx.indentationLvl += 4;\n const result = formatValue(ctx, stack);\n ctx.indentationLvl -= 4;\n ctx.seen.pop();\n return `${ErrorPrototypeToString(error)}\\n ${result}`;\n }\n return ErrorPrototypeToString(error);\n}\n\nfunction getStackFrames(ctx, err, stack) {\n const frames = StringPrototypeSplit(stack, '\\n');\n\n let cause;\n try {\n ({ cause } = err);\n } catch {\n\n }\n\n\n if (cause != null && isError(cause)) {\n const causeStack = getStackString(ctx, cause);\n const causeStackStart = StringPrototypeIndexOf(causeStack, '\\n at');\n if (causeStackStart !== -1) {\n const causeFrames = StringPrototypeSplit(StringPrototypeSlice(causeStack, causeStackStart + 1), '\\n');\n const { 0: len, 1: offset } = identicalSequenceRange(frames, causeFrames);\n if (len > 0) {\n const skipped = len - 2;\n const msg = ` ... ${skipped} lines matching cause stack trace ...`;\n frames.splice(offset + 1, skipped, ctx.stylize(msg, 'undefined'));\n }\n }\n }\n\n\n if (frames.length > 10) {\n const ranges = getDuplicateErrorFrameRanges(frames);\n\n for (let i = ranges.length - 3; i >= 0; i -= 3) {\n const offset = ranges[i];\n const length = ranges[i + 1];\n const duplicateRanges = ranges[i + 2];\n\n const msg = ` ... collapsed ${length * duplicateRanges} duplicate lines ` +\n 'matching above ' +\n (duplicateRanges > 1 ?\n `${length} lines ${duplicateRanges} times...` :\n 'lines ...');\n frames.splice(offset, length * duplicateRanges, ctx.stylize(msg, 'undefined'));\n }\n }\n\n return frames;\n}\n\n\nfunction improveStack(stack, constructor, name, tag) {\n\n\n let len = name.length;\n\n if (typeof name !== 'string') {\n stack = StringPrototypeReplace(\n stack,\n `${name}`,\n `${name} [${StringPrototypeSlice(getPrefix(constructor, tag, 'Error'), 0, -1)}]`,\n );\n }\n\n if (constructor === null ||\n (StringPrototypeEndsWith(name, 'Error') &&\n StringPrototypeStartsWith(stack, name) &&\n (stack.length === len || stack[len] === ':' || stack[len] === '\\n'))) {\n let fallback = 'Error';\n if (constructor === null) {\n const start = RegExpPrototypeExec(/^([A-Z][a-z_ A-Z0-9[\\]()-]+)(?::|\\n {4}at)/, stack) ||\n RegExpPrototypeExec(/^([a-z_A-Z0-9-]*Error)$/, stack);\n fallback = (start?.[1]) || '';\n len = fallback.length;\n fallback ||= 'Error';\n }\n const prefix = StringPrototypeSlice(getPrefix(constructor, tag, fallback), 0, -1);\n if (name !== prefix) {\n if (StringPrototypeIncludes(prefix, name)) {\n if (len === 0) {\n stack = `${prefix}: ${stack}`;\n } else {\n stack = `${prefix}${StringPrototypeSlice(stack, len)}`;\n }\n } else {\n stack = `${prefix} [${name}]${StringPrototypeSlice(stack, len)}`;\n }\n }\n }\n return stack;\n}\n\nfunction markNodeModules(ctx, line) {\n let tempLine = '';\n let lastPos = 0;\n let searchFrom = 0;\n\n while (true) {\n const nodeModulePosition = StringPrototypeIndexOf(line, 'node_modules', searchFrom);\n if (nodeModulePosition === -1) {\n break;\n }\n\n\n const separator = line[nodeModulePosition - 1];\n const after = line[nodeModulePosition + 12];\n\n if ((after !== '/' && after !== '\\\\') || (separator !== '/' && separator !== '\\\\')) {\n\n searchFrom = nodeModulePosition + 1;\n continue;\n }\n\n const moduleStart = nodeModulePosition + 13;\n\n\n tempLine += StringPrototypeSlice(line, lastPos, moduleStart);\n\n let moduleEnd = StringPrototypeIndexOf(line, separator, moduleStart);\n if (moduleEnd === -1) {\n\n moduleEnd = line.length;\n } else if (line[moduleStart] === '@') {\n\n moduleEnd = StringPrototypeIndexOf(line, separator, moduleEnd + 1);\n if (moduleEnd === -1) {\n moduleEnd = line.length;\n }\n }\n\n const nodeModule = StringPrototypeSlice(line, moduleStart, moduleEnd);\n tempLine += ctx.stylize(nodeModule, 'module');\n\n lastPos = moduleEnd;\n searchFrom = moduleEnd;\n }\n\n if (lastPos !== 0) {\n line = tempLine + StringPrototypeSlice(line, lastPos);\n }\n return line;\n}\n\nfunction markCwd(ctx, line, workingDirectory) {\n let cwdStartPos = StringPrototypeIndexOf(line, workingDirectory);\n let tempLine = '';\n let cwdLength = workingDirectory.length;\n if (cwdStartPos !== -1) {\n if (StringPrototypeSlice(line, cwdStartPos - 7, cwdStartPos) === 'file://') {\n cwdLength += 7;\n cwdStartPos -= 7;\n }\n const start = line[cwdStartPos - 1] === '(' ? cwdStartPos - 1 : cwdStartPos;\n const end = start !== cwdStartPos && StringPrototypeEndsWith(line, ')') ? -1 : line.length;\n const workingDirectoryEndPos = cwdStartPos + cwdLength + 1;\n const cwdSlice = StringPrototypeSlice(line, start, workingDirectoryEndPos);\n\n tempLine += StringPrototypeSlice(line, 0, start);\n tempLine += ctx.stylize(cwdSlice, 'undefined');\n tempLine += StringPrototypeSlice(line, workingDirectoryEndPos, end);\n if (end === -1) {\n tempLine += ctx.stylize(')', 'undefined');\n }\n } else {\n tempLine += line;\n }\n return tempLine;\n}\n\nfunction safeGetCWD() {\n let workingDirectory;\n try {\n workingDirectory = process.cwd();\n } catch {\n return;\n }\n return workingDirectory;\n}\n\nfunction formatError(err, constructor, tag, ctx, keys) {\n let message, name, stack;\n try {\n stack = getStackString(ctx, err);\n } catch {\n return ObjectPrototypeToString(err);\n }\n\n let messageIsGetterThatThrows = false;\n try {\n message = err.message;\n } catch {\n messageIsGetterThatThrows = true;\n }\n let nameIsGetterThatThrows = false;\n try {\n name = err.name;\n } catch {\n nameIsGetterThatThrows = true;\n }\n\n if (!ctx.showHidden && keys.length !== 0) {\n const index = ArrayPrototypeIndexOf(keys, 'stack');\n if (index !== -1) {\n ArrayPrototypeSplice(keys, index, 1);\n }\n\n if (!messageIsGetterThatThrows) {\n const index = ArrayPrototypeIndexOf(keys, 'message');\n\n if (index !== -1 && (typeof message !== 'string' || StringPrototypeIncludes(stack, message))) {\n ArrayPrototypeSplice(keys, index, 1);\n }\n }\n\n if (!nameIsGetterThatThrows) {\n const index = ArrayPrototypeIndexOf(keys, 'name');\n\n if (index !== -1 && (typeof name !== 'string' || StringPrototypeIncludes(stack, name))) {\n ArrayPrototypeSplice(keys, index, 1);\n }\n }\n }\n name ??= 'Error';\n\n if (ObjectPrototypeHasOwnProperty(err, 'cause') &&\n (keys.length === 0 || !ArrayPrototypeIncludes(keys, 'cause'))) {\n ArrayPrototypePush(keys, 'cause');\n }\n\n\n try {\n const errors = err.errors;\n if (ArrayIsArray(errors) && ObjectPrototypeHasOwnProperty(err, 'errors') &&\n (keys.length === 0 || !ArrayPrototypeIncludes(keys, 'errors'))) {\n ArrayPrototypePush(keys, 'errors');\n }\n } catch {\n\n }\n\n stack = improveStack(stack, constructor, name, tag);\n\n\n let pos = (message && StringPrototypeIndexOf(stack, message)) || -1;\n if (pos !== -1)\n pos += message.length;\n\n const stackStart = StringPrototypeIndexOf(stack, '\\n at', pos);\n if (stackStart === -1) {\n stack = `[${stack}]`;\n } else {\n let newStack = StringPrototypeSlice(stack, 0, stackStart);\n const stackFramePart = StringPrototypeSlice(stack, stackStart + 1);\n const lines = getStackFrames(ctx, err, stackFramePart);\n if (ctx.colors) {\n\n const workingDirectory = safeGetCWD();\n let esmWorkingDirectory;\n for (let line of lines) {\n const core = RegExpPrototypeExec(coreModuleRegExp, line);\n if (core !== null && BuiltinModule.exists(core[1])) {\n newStack += `\\n${ctx.stylize(line, 'undefined')}`;\n } else {\n newStack += '\\n';\n\n line = markNodeModules(ctx, line);\n if (workingDirectory !== undefined) {\n let newLine = markCwd(ctx, line, workingDirectory);\n if (newLine === line) {\n esmWorkingDirectory ??= pathToFileUrlHref(workingDirectory);\n newLine = markCwd(ctx, line, esmWorkingDirectory);\n }\n line = newLine;\n }\n\n newStack += line;\n }\n }\n } else {\n newStack += `\\n${ArrayPrototypeJoin(lines, '\\n')}`;\n }\n stack = newStack;\n }\n\n if (ctx.indentationLvl !== 0) {\n const indentation = StringPrototypeRepeat(' ', ctx.indentationLvl);\n stack = StringPrototypeReplaceAll(stack, '\\n', `\\n${indentation}`);\n }\n return stack;\n}\n\nfunction groupArrayElements(ctx, output, value) {\n let totalLength = 0;\n let maxLength = 0;\n let i = 0;\n let outputLength = output.length;\n if (ctx.maxArrayLength < output.length) {\n\n outputLength--;\n }\n const separatorSpace = 2;\n const dataLen = new Array(outputLength);\n\n\n\n for (; i < outputLength; i++) {\n const len = getStringWidth(output[i], ctx.colors);\n dataLen[i] = len;\n totalLength += len + separatorSpace;\n if (maxLength < len)\n maxLength = len;\n }\n\n\n const actualMax = maxLength + separatorSpace;\n\n\n\n\n if (actualMax * 3 + ctx.indentationLvl < ctx.breakLength &&\n (totalLength / actualMax > 5 || maxLength <= 6)) {\n\n const approxCharHeights = 2.5;\n const averageBias = MathSqrt(actualMax - totalLength / output.length);\n const biasedMax = MathMax(actualMax - 3 - averageBias, 1);\n\n const columns = MathMin(\n\n\n\n\n\n MathRound(\n MathSqrt(\n approxCharHeights * biasedMax * outputLength,\n ) / biasedMax,\n ),\n\n MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax),\n\n\n ctx.compact * 4,\n\n 15,\n );\n\n if (columns <= 1) {\n return output;\n }\n const tmp = [];\n const maxLineLength = [];\n for (let i = 0; i < columns; i++) {\n let lineMaxLength = 0;\n for (let j = i; j < output.length; j += columns) {\n if (dataLen[j] > lineMaxLength)\n lineMaxLength = dataLen[j];\n }\n lineMaxLength += separatorSpace;\n maxLineLength[i] = lineMaxLength;\n }\n let order = StringPrototypePadStart;\n if (value !== undefined) {\n for (let i = 0; i < output.length; i++) {\n if (typeof value[i] !== 'number' && typeof value[i] !== 'bigint') {\n order = StringPrototypePadEnd;\n break;\n }\n }\n }\n\n for (let i = 0; i < outputLength; i += columns) {\n\n const max = MathMin(i + columns, outputLength);\n let str = '';\n let j = i;\n for (; j < max - 1; j++) {\n\n\n\n const padding = maxLineLength[j - i] + output[j].length - dataLen[j];\n str += order(`${output[j]}, `, padding, ' ');\n }\n if (order === StringPrototypePadStart) {\n const padding = maxLineLength[j - i] +\n output[j].length -\n dataLen[j] -\n separatorSpace;\n str += StringPrototypePadStart(output[j], padding, ' ');\n } else {\n str += output[j];\n }\n ArrayPrototypePush(tmp, str);\n }\n if (ctx.maxArrayLength < output.length) {\n ArrayPrototypePush(tmp, output[outputLength]);\n }\n output = tmp;\n }\n return output;\n}\n\nfunction handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {\n ctx.seen.pop();\n ctx.indentationLvl = indentationLvl;\n return ctx.stylize(\n `[${constructorName}: Inspection interrupted ` +\n 'prematurely. Maximum call stack size exceeded.]',\n 'special',\n );\n}\n\nfunction addNumericSeparator(integerString) {\n let result = '';\n let i = integerString.length;\n assert(i !== 0);\n const start = integerString[0] === '-' ? 1 : 0;\n for (; i >= start + 4; i -= 3) {\n result = `_${StringPrototypeSlice(integerString, i - 3, i)}${result}`;\n }\n return i === integerString.length ?\n integerString :\n `${StringPrototypeSlice(integerString, 0, i)}${result}`;\n}\n\nfunction addNumericSeparatorEnd(integerString) {\n let result = '';\n let i = 0;\n for (; i < integerString.length - 3; i += 3) {\n result += `${StringPrototypeSlice(integerString, i, i + 3)}_`;\n }\n return i === 0 ?\n integerString :\n `${result}${StringPrototypeSlice(integerString, i)}`;\n}\n\nconst remainingText = (remaining) => `... ${remaining} more item${remaining > 1 ? 's' : ''}`;\n\nfunction formatNumber(fn, number, numericSeparator) {\n\n\n if (ObjectIs(number, -0)) {\n return fn('-0', 'number');\n }\n if (!numericSeparator) {\n return fn(`${number}`, 'number');\n }\n\n const numberString = String(number);\n const integer = MathTrunc(number);\n\n if (integer === number) {\n if (!NumberIsFinite(number) || StringPrototypeIncludes(numberString, 'e')) {\n return fn(numberString, 'number');\n }\n return fn(addNumericSeparator(numberString), 'number');\n }\n if (NumberIsNaN(number) || StringPrototypeIncludes(numberString, 'e')) {\n return fn(numberString, 'number');\n }\n\n const decimalIndex = StringPrototypeIndexOf(numberString, '.');\n const integerPart = StringPrototypeSlice(numberString, 0, decimalIndex);\n const fractionalPart = StringPrototypeSlice(numberString, decimalIndex + 1);\n\n return fn(`${\n addNumericSeparator(integerPart)\n }.${\n addNumericSeparatorEnd(fractionalPart)\n }`, 'number');\n}\n\nfunction formatBigInt(fn, bigint, numericSeparator) {\n const string = String(bigint);\n if (!numericSeparator) {\n return fn(`${string}n`, 'bigint');\n }\n return fn(`${addNumericSeparator(string)}n`, 'bigint');\n}\n\nfunction formatPrimitive(fn, value, ctx) {\n if (typeof value === 'string') {\n let trailer = '';\n if (value.length > ctx.maxStringLength) {\n const remaining = value.length - ctx.maxStringLength;\n value = StringPrototypeSlice(value, 0, ctx.maxStringLength);\n trailer = `... ${remaining} more character${remaining > 1 ? 's' : ''}`;\n }\n if (ctx.compact !== true &&\n\n\n\n value.length > kMinLineLength &&\n value.length > ctx.breakLength - ctx.indentationLvl - 4) {\n return ArrayPrototypeJoin(\n ArrayPrototypeMap(\n RegExpPrototypeSymbolSplit(/(?<=\\n)/, value),\n (line) => fn(strEscape(line), 'string'),\n ),\n ` +\\n${StringPrototypeRepeat(' ', ctx.indentationLvl + 2)}`,\n ) + trailer;\n }\n return fn(strEscape(value), 'string') + trailer;\n }\n if (typeof value === 'number')\n return formatNumber(fn, value, ctx.numericSeparator);\n if (typeof value === 'bigint')\n return formatBigInt(fn, value, ctx.numericSeparator);\n if (typeof value === 'boolean')\n return fn(`${value}`, 'boolean');\n if (typeof value === 'undefined')\n return fn('undefined', 'undefined');\n\n return fn(SymbolPrototypeToString(value), 'symbol');\n}\n\nfunction formatNamespaceObject(keys, ctx, value, recurseTimes) {\n const output = new Array(keys.length);\n for (let i = 0; i < keys.length; i++) {\n try {\n output[i] = formatProperty(ctx, value, recurseTimes, keys[i],\n kObjectType);\n } catch (err) {\n assert(isNativeError(err) && err.name === 'ReferenceError');\n\n\n\n const tmp = { [keys[i]]: '' };\n output[i] = formatProperty(ctx, tmp, recurseTimes, keys[i], kObjectType);\n const pos = StringPrototypeLastIndexOf(output[i], ' ');\n\n\n output[i] = StringPrototypeSlice(output[i], 0, pos + 1) +\n ctx.stylize('', 'special');\n }\n }\n\n keys.length = 0;\n return output;\n}\n\n\nfunction formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {\n const keys = ObjectKeys(value);\n let index = i;\n for (; i < keys.length && output.length < maxLength; i++) {\n const key = keys[i];\n const tmp = +key;\n\n if (tmp > 2 ** 32 - 2) {\n break;\n }\n if (`${index}` !== key) {\n if (RegExpPrototypeExec(numberRegExp, key) === null) {\n break;\n }\n const emptyItems = tmp - index;\n const ending = emptyItems > 1 ? 's' : '';\n const message = `<${emptyItems} empty item${ending}>`;\n ArrayPrototypePush(output, ctx.stylize(message, 'undefined'));\n index = tmp;\n if (output.length === maxLength) {\n break;\n }\n }\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, key, kArrayType));\n index++;\n }\n const remaining = value.length - index;\n if (output.length !== maxLength) {\n if (remaining > 0) {\n const ending = remaining > 1 ? 's' : '';\n const message = `<${remaining} empty item${ending}>`;\n ArrayPrototypePush(output, ctx.stylize(message, 'undefined'));\n }\n } else if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n return output;\n}\n\nfunction formatArrayBuffer(ctx, value) {\n let buffer;\n try {\n buffer = new Uint8Array(value);\n } catch {\n return [ctx.stylize('(detached)', 'special')];\n }\n if (hexSlice === undefined)\n hexSlice = uncurryThis(require('buffer').Buffer.prototype.hexSlice);\n const rawString = hexSlice(buffer, 0, MathMin(ctx.maxArrayLength, buffer.length));\n let str = '';\n let i = 0;\n for (; i < rawString.length - 2; i += 2) {\n str += `${rawString[i]}${rawString[i + 1]} `;\n }\n if (rawString.length > 0) {\n str += `${rawString[i]}${rawString[i + 1]}`;\n }\n const remaining = buffer.length - ctx.maxArrayLength;\n if (remaining > 0)\n str += ` ... ${remaining} more byte${remaining > 1 ? 's' : ''}`;\n return [`${ctx.stylize('[Uint8Contents]', 'special')}: <${str}>`];\n}\n\nfunction formatArray(ctx, value, recurseTimes) {\n const valLen = value.length;\n const len = MathMin(MathMax(0, ctx.maxArrayLength), valLen);\n\n const remaining = valLen - len;\n const output = [];\n for (let i = 0; i < len; i++) {\n const desc = ObjectGetOwnPropertyDescriptor(value, i);\n if (desc === undefined) {\n\n return formatSpecialArray(ctx, value, recurseTimes, len, output, i);\n }\n ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, i, kArrayType, desc));\n }\n if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n return output;\n}\n\nfunction formatTypedArray(value, length, ctx) {\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);\n const remaining = value.length - maxLength;\n const output = new Array(maxLength);\n const elementFormatter = value.length > 0 && typeof value[0] === 'number' ?\n formatNumber :\n formatBigInt;\n for (let i = 0; i < maxLength; ++i) {\n output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);\n }\n if (remaining > 0) {\n output[maxLength] = remainingText(remaining);\n }\n return output;\n}\n\nfunction formatSet(value, ctx, ignored, recurseTimes) {\n const length = value.size;\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);\n const remaining = length - maxLength;\n const output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (const v of value) {\n if (i >= maxLength) break;\n ArrayPrototypePush(output, formatValue(ctx, v, recurseTimes));\n i++;\n }\n if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n ctx.indentationLvl -= 2;\n return output;\n}\n\nfunction formatMap(value, ctx, ignored, recurseTimes) {\n const length = value.size;\n const maxLength = MathMin(MathMax(0, ctx.maxArrayLength), length);\n const remaining = length - maxLength;\n const output = [];\n ctx.indentationLvl += 2;\n let i = 0;\n for (const { 0: k, 1: v } of value) {\n if (i >= maxLength) break;\n ArrayPrototypePush(\n output,\n `${formatValue(ctx, k, recurseTimes)} => ${formatValue(ctx, v, recurseTimes)}`,\n );\n i++;\n }\n if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n ctx.indentationLvl -= 2;\n return output;\n}\n\nfunction formatSetIterInner(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0);\n const maxLength = MathMin(maxArrayLength, entries.length);\n const output = new Array(maxLength);\n ctx.indentationLvl += 2;\n for (let i = 0; i < maxLength; i++) {\n output[i] = formatValue(ctx, entries[i], recurseTimes);\n }\n ctx.indentationLvl -= 2;\n if (state === kWeak && !ctx.sorted) {\n\n\n\n ArrayPrototypeSort(output);\n }\n const remaining = entries.length - maxLength;\n if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n return output;\n}\n\nfunction formatMapIterInner(ctx, recurseTimes, entries, state) {\n const maxArrayLength = MathMax(ctx.maxArrayLength, 0);\n\n const len = entries.length / 2;\n const remaining = len - maxArrayLength;\n const maxLength = MathMin(maxArrayLength, len);\n const output = new Array(maxLength);\n let i = 0;\n ctx.indentationLvl += 2;\n if (state === kWeak) {\n for (; i < maxLength; i++) {\n const pos = i * 2;\n output[i] =\n `${formatValue(ctx, entries[pos], recurseTimes)} => ${formatValue(ctx, entries[pos + 1], recurseTimes)}`;\n }\n\n\n\n if (!ctx.sorted)\n ArrayPrototypeSort(output);\n } else {\n for (; i < maxLength; i++) {\n const pos = i * 2;\n const res = [\n formatValue(ctx, entries[pos], recurseTimes),\n formatValue(ctx, entries[pos + 1], recurseTimes),\n ];\n output[i] = reduceToSingleString(\n ctx, res, '', ['[', ']'], kArrayExtrasType, recurseTimes);\n }\n }\n ctx.indentationLvl -= 2;\n if (remaining > 0) {\n ArrayPrototypePush(output, remainingText(remaining));\n }\n return output;\n}\n\nfunction formatWeakCollection(ctx) {\n return [ctx.stylize('', 'special')];\n}\n\nfunction formatWeakSet(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatSetIterInner(ctx, recurseTimes, entries, kWeak);\n}\n\nfunction formatWeakMap(ctx, value, recurseTimes) {\n const entries = previewEntries(value);\n return formatMapIterInner(ctx, recurseTimes, entries, kWeak);\n}\n\nfunction formatIterator(braces, ctx, value, recurseTimes) {\n const { 0: entries, 1: isKeyValue } = previewEntries(value, true);\n if (isKeyValue) {\n\n braces[0] = RegExpPrototypeSymbolReplace(/ Iterator] {$/, braces[0], ' Entries] {');\n return formatMapIterInner(ctx, recurseTimes, entries, kMapEntries);\n }\n\n return formatSetIterInner(ctx, recurseTimes, entries, kIterator);\n}\n\nfunction formatPromise(ctx, value, recurseTimes) {\n let output;\n const { 0: state, 1: result } = getPromiseDetails(value);\n if (state === kPending) {\n output = [ctx.stylize('', 'special')];\n } else {\n ctx.indentationLvl += 2;\n const str = formatValue(ctx, result, recurseTimes);\n ctx.indentationLvl -= 2;\n output = [\n state === kRejected ?\n `${ctx.stylize('', 'special')} ${str}` :\n str,\n ];\n }\n return output;\n}\n\nfunction formatExtraProperties(ctx, value, recurseTimes, key, typedArray) {\n ctx.indentationLvl += 2;\n const str = formatValue(ctx, value[key], recurseTimes, typedArray);\n ctx.indentationLvl -= 2;\n\n\n const name = ctx.stylize(`[${key}]`, 'string');\n return `${name}: ${str}`;\n}\n\nfunction formatProperty(ctx, value, recurseTimes, key, type, desc,\n original = value) {\n let name, str;\n let extra = ' ';\n desc ??= ObjectGetOwnPropertyDescriptor(value, key);\n if (desc.value !== undefined) {\n const diff = (ctx.compact !== true || type !== kObjectType) ? 2 : 3;\n ctx.indentationLvl += diff;\n str = formatValue(ctx, desc.value, recurseTimes);\n if (diff === 3 && ctx.breakLength < getStringWidth(str, ctx.colors)) {\n extra = `\\n${StringPrototypeRepeat(' ', ctx.indentationLvl)}`;\n }\n ctx.indentationLvl -= diff;\n } else if (desc.get !== undefined) {\n const label = desc.set !== undefined ? 'Getter/Setter' : 'Getter';\n const s = ctx.stylize;\n const sp = 'special';\n if (ctx.getters && (ctx.getters === true ||\n (ctx.getters === 'get' && desc.set === undefined) ||\n (ctx.getters === 'set' && desc.set !== undefined))) {\n ctx.indentationLvl += 2;\n try {\n const tmp = FunctionPrototypeCall(desc.get, original);\n if (tmp === null) {\n str = `${s(`[${label}:`, sp)} ${s('null', 'null')}${s(']', sp)}`;\n } else if (typeof tmp === 'object' || typeof tmp === 'function') {\n str = `${s(`[${label}]`, sp)} ${formatValue(ctx, tmp, recurseTimes)}`;\n } else {\n const primitive = formatPrimitive(s, tmp, ctx);\n str = `${s(`[${label}:`, sp)} ${primitive}${s(']', sp)}`;\n }\n } catch (err) {\n const message = ``;\n str = `${s(`[${label}:`, sp)} ${message}${s(']', sp)}`;\n }\n ctx.indentationLvl -= 2;\n } else {\n str = ctx.stylize(`[${label}]`, sp);\n }\n } else if (desc.set !== undefined) {\n str = ctx.stylize('[Setter]', 'special');\n } else {\n str = ctx.stylize('undefined', 'undefined');\n }\n if (type === kArrayType) {\n return str;\n }\n if (typeof key === 'symbol') {\n const tmp = RegExpPrototypeSymbolReplace(\n strEscapeSequencesReplacer,\n SymbolPrototypeToString(key),\n escapeFn,\n );\n name = ctx.stylize(tmp, 'symbol');\n } else if (RegExpPrototypeExec(keyStrRegExp, key) !== null) {\n name = key === '__proto__' ? \"['__proto__']\" : ctx.stylize(key, 'name');\n } else {\n name = ctx.stylize(strEscape(key), 'string');\n }\n\n if (desc.enumerable === false) {\n name = `[${name}]`;\n }\n return `${name}:${extra}${str}`;\n}\n\nfunction isBelowBreakLength(ctx, output, start, base) {\n\n\n\n\n\n\n\n if (ctx.breakLength === Infinity) {\n if (base !== '' && StringPrototypeIncludes(base, '\\n')) return false;\n for (let i = 0; i < output.length; i++) {\n if (typeof output[i] === 'string' && StringPrototypeIncludes(output[i], '\\n')) return false;\n }\n return true;\n }\n let totalLength = output.length + start;\n if (totalLength + output.length > ctx.breakLength)\n return false;\n for (let i = 0; i < output.length; i++) {\n if (ctx.colors) {\n totalLength += removeColors(output[i]).length;\n } else {\n totalLength += output[i].length;\n }\n if (totalLength > ctx.breakLength) {\n return false;\n }\n }\n\n return base === '' || !StringPrototypeIncludes(base, '\\n');\n}\n\nfunction reduceToSingleString(\n ctx, output, base, braces, extrasType, recurseTimes, value) {\n if (ctx.compact !== true) {\n if (typeof ctx.compact === 'number' && ctx.compact >= 1) {\n\n\n const entries = output.length;\n\n\n if (extrasType === kArrayExtrasType && entries > 6) {\n output = groupArrayElements(ctx, output, value);\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n if (ctx.currentDepth - recurseTimes < ctx.compact &&\n entries === output.length) {\n\n\n\n const start = output.length + ctx.indentationLvl +\n braces[0].length + base.length + 10;\n if (isBelowBreakLength(ctx, output, start, base)) {\n const joinedOutput = join(output, ', ');\n if (!StringPrototypeIncludes(joinedOutput, '\\n')) {\n return `${base ? `${base} ` : ''}${braces[0]} ${joinedOutput}` +\n ` ${braces[1]}`;\n }\n }\n }\n }\n\n const indentation = `\\n${StringPrototypeRepeat(' ', ctx.indentationLvl)}`;\n return `${base ? `${base} ` : ''}${braces[0]}${indentation} ` +\n `${join(output, `,${indentation} `)}${indentation}${braces[1]}`;\n }\n\n\n if (isBelowBreakLength(ctx, output, 0, base)) {\n return `${braces[0]}${base ? ` ${base}` : ''} ${join(output, ', ')} ` +\n braces[1];\n }\n const indentation = StringPrototypeRepeat(' ', ctx.indentationLvl);\n\n\n\n const ln = base === '' && braces[0].length === 1 ?\n ' ' : `${base ? ` ${base}` : ''}\\n${indentation} `;\n\n return `${braces[0]}${ln}${join(output, `,\\n${indentation} `)} ${braces[1]}`;\n}\n\nfunction hasBuiltInToString(value) {\n\n const getFullProxy = false;\n const proxyTarget = getProxyDetails(value, getFullProxy);\n if (proxyTarget !== undefined) {\n if (proxyTarget === null) {\n return true;\n }\n return hasBuiltInToString(proxyTarget);\n }\n\n let hasOwnToString = ObjectPrototypeHasOwnProperty;\n let hasOwnToPrimitive = ObjectPrototypeHasOwnProperty;\n\n\n if (typeof value.toString !== 'function') {\n if (typeof value[SymbolToPrimitive] !== 'function') {\n return true;\n } else if (ObjectPrototypeHasOwnProperty(value, SymbolToPrimitive)) {\n return false;\n }\n hasOwnToString = returnFalse;\n } else if (ObjectPrototypeHasOwnProperty(value, 'toString')) {\n return false;\n } else if (typeof value[SymbolToPrimitive] !== 'function') {\n hasOwnToPrimitive = returnFalse;\n } else if (ObjectPrototypeHasOwnProperty(value, SymbolToPrimitive)) {\n return false;\n }\n\n\n\n let pointer = value;\n do {\n pointer = ObjectGetPrototypeOf(pointer);\n } while (!hasOwnToString(pointer, 'toString') &&\n !hasOwnToPrimitive(pointer, SymbolToPrimitive));\n\n\n const descriptor = ObjectGetOwnPropertyDescriptor(pointer, 'constructor');\n return descriptor !== undefined &&\n typeof descriptor.value === 'function' &&\n builtInObjects.has(descriptor.value.name);\n}\n\nfunction returnFalse() {\n return false;\n}\n\nconst firstErrorLine = (error) => StringPrototypeSplit(error.message, '\\n', 1)[0];\nlet CIRCULAR_ERROR_MESSAGE;\nfunction tryStringify(arg) {\n try {\n return JSONStringify(arg);\n } catch (err) {\n\n if (!CIRCULAR_ERROR_MESSAGE) {\n try {\n const a = {};\n a.a = a;\n JSONStringify(a);\n } catch (circularError) {\n CIRCULAR_ERROR_MESSAGE = firstErrorLine(circularError);\n }\n }\n if (err.name === 'TypeError' &&\n firstErrorLine(err) === CIRCULAR_ERROR_MESSAGE) {\n return '[Circular]';\n }\n throw err;\n }\n}\n\nfunction format(...args) {\n return formatWithOptionsInternal(undefined, args);\n}\n\nfunction formatWithOptions(inspectOptions, ...args) {\n validateObject(inspectOptions, 'inspectOptions', kValidateObjectAllowArray);\n return formatWithOptionsInternal(inspectOptions, args);\n}\n\nfunction formatNumberNoColor(number, options) {\n return formatNumber(\n stylizeNoColor,\n number,\n options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,\n );\n}\n\nfunction formatBigIntNoColor(bigint, options) {\n return formatBigInt(\n stylizeNoColor,\n bigint,\n options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,\n );\n}\n\nfunction formatWithOptionsInternal(inspectOptions, args) {\n const first = args[0];\n let a = 0;\n let str = '';\n let join = '';\n\n if (typeof first === 'string') {\n if (args.length === 1) {\n return first;\n }\n let tempStr;\n let lastPos = 0;\n\n for (let i = 0; i < first.length - 1; i++) {\n if (StringPrototypeCharCodeAt(first, i) === 37) {\n const nextChar = StringPrototypeCharCodeAt(first, ++i);\n if (a + 1 !== args.length) {\n switch (nextChar) {\n case 115: {\n const tempArg = args[++a];\n if (typeof tempArg === 'number') {\n tempStr = formatNumberNoColor(tempArg, inspectOptions);\n } else if (typeof tempArg === 'bigint') {\n tempStr = formatBigIntNoColor(tempArg, inspectOptions);\n } else if (typeof tempArg !== 'object' ||\n tempArg === null ||\n !hasBuiltInToString(tempArg)) {\n tempStr = String(tempArg);\n } else {\n tempStr = inspect(tempArg, {\n ...inspectOptions,\n compact: 3,\n colors: false,\n depth: 0,\n });\n }\n break;\n }\n case 106:\n tempStr = tryStringify(args[++a]);\n break;\n case 100: {\n const tempNum = args[++a];\n if (typeof tempNum === 'bigint') {\n tempStr = formatBigIntNoColor(tempNum, inspectOptions);\n } else if (typeof tempNum === 'symbol') {\n tempStr = 'NaN';\n } else {\n tempStr = formatNumberNoColor(Number(tempNum), inspectOptions);\n }\n break;\n }\n case 79:\n tempStr = inspect(args[++a], inspectOptions);\n break;\n case 111:\n tempStr = inspect(args[++a], {\n ...inspectOptions,\n showHidden: true,\n showProxy: true,\n depth: 4,\n });\n break;\n case 105: {\n const tempInteger = args[++a];\n if (typeof tempInteger === 'bigint') {\n tempStr = formatBigIntNoColor(tempInteger, inspectOptions);\n } else if (typeof tempInteger === 'symbol') {\n tempStr = 'NaN';\n } else {\n tempStr = formatNumberNoColor(\n NumberParseInt(tempInteger), inspectOptions);\n }\n break;\n }\n case 102: {\n const tempFloat = args[++a];\n if (typeof tempFloat === 'symbol') {\n tempStr = 'NaN';\n } else {\n tempStr = formatNumberNoColor(\n NumberParseFloat(tempFloat), inspectOptions);\n }\n break;\n }\n case 99:\n a += 1;\n tempStr = '';\n break;\n case 37:\n str += StringPrototypeSlice(first, lastPos, i);\n lastPos = i + 1;\n continue;\n default:\n continue;\n }\n if (lastPos !== i - 1) {\n str += StringPrototypeSlice(first, lastPos, i - 1);\n }\n str += tempStr;\n lastPos = i + 1;\n } else if (nextChar === 37) {\n str += StringPrototypeSlice(first, lastPos, i);\n lastPos = i + 1;\n }\n }\n }\n if (lastPos !== 0) {\n a++;\n join = ' ';\n if (lastPos < first.length) {\n str += StringPrototypeSlice(first, lastPos);\n }\n }\n }\n\n while (a < args.length) {\n const value = args[a];\n str += join;\n str += typeof value !== 'string' ? inspect(value, inspectOptions) : value;\n join = ' ';\n a++;\n }\n return str;\n}\n\nfunction isZeroWidthCodePoint(code) {\n return code <= 0x1F ||\n (code >= 0x7F && code <= 0x9F) ||\n (code >= 0x300 && code <= 0x36F) ||\n (code >= 0x200B && code <= 0x200F) ||\n\n (code >= 0x20D0 && code <= 0x20FF) ||\n (code >= 0xFE00 && code <= 0xFE0F) ||\n (code >= 0xFE20 && code <= 0xFE2F) ||\n (code >= 0xE0100 && code <= 0xE01EF);\n}\n\nif (internalBinding('config').hasIntl) {\n const icu = internalBinding('icu');\n\n\n\n\n\n getStringWidth = function getStringWidth(str, removeControlChars = true) {\n let width = 0;\n\n if (removeControlChars) {\n str = stripVTControlCharacters(str);\n }\n for (let i = 0; i < str.length; i++) {\n\n\n const code = str.charCodeAt(i);\n if (code >= 127) {\n width += icu.getStringWidth(StringPrototypeNormalize(StringPrototypeSlice(str, i), 'NFC'));\n break;\n }\n width += code >= 32 ? 1 : 0;\n }\n return width;\n };\n} else {\n\n\n\n\n\n getStringWidth = function getStringWidth(str, removeControlChars = true) {\n let width = 0;\n\n if (removeControlChars)\n str = stripVTControlCharacters(str);\n str = StringPrototypeNormalize(str, 'NFC');\n for (const char of new SafeStringIterator(str)) {\n const code = StringPrototypeCodePointAt(char, 0);\n if (isFullWidthCodePoint(code)) {\n width += 2;\n } else if (!isZeroWidthCodePoint(code)) {\n width++;\n }\n }\n\n return width;\n };\n\n\n\n\n\n\n\n const isFullWidthCodePoint = (code) => {\n\n\n return code >= 0x1100 && (\n code <= 0x115f ||\n code === 0x2329 ||\n code === 0x232a ||\n\n (code >= 0x2e80 && code <= 0x3247 && code !== 0x303f) ||\n\n (code >= 0x3250 && code <= 0x4dbf) ||\n\n (code >= 0x4e00 && code <= 0xa4c6) ||\n\n (code >= 0xa960 && code <= 0xa97c) ||\n\n (code >= 0xac00 && code <= 0xd7a3) ||\n\n (code >= 0xf900 && code <= 0xfaff) ||\n\n (code >= 0xfe10 && code <= 0xfe19) ||\n\n (code >= 0xfe30 && code <= 0xfe6b) ||\n\n (code >= 0xff01 && code <= 0xff60) ||\n (code >= 0xffe0 && code <= 0xffe6) ||\n\n (code >= 0x1b000 && code <= 0x1b001) ||\n\n (code >= 0x1f200 && code <= 0x1f251) ||\n\n\n (code >= 0x1f300 && code <= 0x1f64f) ||\n\n (code >= 0x20000 && code <= 0x3fffd)\n );\n };\n\n}\n\n\n\n\n\n\nfunction stripVTControlCharacters(str) {\n validateString(str, 'str');\n\n\n\n\n if (StringPrototypeIndexOf(str, '\\u001B') === -1 &&\n StringPrototypeIndexOf(str, '\\u009B') === -1)\n return str;\n\n return RegExpPrototypeSymbolReplace(ansi, str, '');\n}\n\nmodule.exports = {\n identicalSequenceRange,\n inspect,\n inspectDefaultOptions,\n stylizeWithColor,\n format,\n formatWithOptions,\n getStringWidth,\n stripVTControlCharacters,\n isZeroWidthCodePoint,\n};\n","internal/util/types.js":"'use strict';\n\nconst {\n ArrayBufferIsView,\n ObjectDefineProperties,\n TypedArrayPrototypeGetSymbolToStringTag,\n} = primordials;\n\nfunction isDataView(value) {\n return ArrayBufferIsView(value) && TypedArrayPrototypeGetSymbolToStringTag(value) === undefined;\n}\n\nfunction isTypedArray(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) !== undefined;\n}\n\nfunction isUint8Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';\n}\n\nfunction isUint8ClampedArray(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8ClampedArray';\n}\n\nfunction isUint16Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint16Array';\n}\n\nfunction isUint32Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint32Array';\n}\n\nfunction isInt8Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Int8Array';\n}\n\nfunction isInt16Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Int16Array';\n}\n\nfunction isInt32Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Int32Array';\n}\n\nfunction isFloat16Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Float16Array';\n}\n\nfunction isFloat32Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Float32Array';\n}\n\nfunction isFloat64Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Float64Array';\n}\n\nfunction isBigInt64Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'BigInt64Array';\n}\n\nfunction isBigUint64Array(value) {\n return TypedArrayPrototypeGetSymbolToStringTag(value) === 'BigUint64Array';\n}\n\nmodule.exports = {\n ...internalBinding('types'),\n isArrayBufferView: ArrayBufferIsView,\n isDataView,\n isTypedArray,\n isUint8Array,\n isUint8ClampedArray,\n isUint16Array,\n isUint32Array,\n isInt8Array,\n isInt16Array,\n isInt32Array,\n isFloat16Array,\n isFloat32Array,\n isFloat64Array,\n isBigInt64Array,\n isBigUint64Array,\n};\n\nlet isCryptoKeyFn;\nlet isKeyObjectFn;\n\nObjectDefineProperties(module.exports, {\n isKeyObject: {\n __proto__: null,\n configurable: false,\n enumerable: true,\n value: function isKeyObject(obj) {\n if (!process.versions.openssl) {\n return false;\n }\n\n if (!isKeyObjectFn) {\n ({ isKeyObject: isKeyObjectFn } = require('internal/crypto/keys'));\n }\n\n return isKeyObjectFn(obj);\n },\n },\n isCryptoKey: {\n __proto__: null,\n configurable: false,\n enumerable: true,\n value: function isCryptoKey(obj) {\n if (!process.versions.openssl) {\n return false;\n }\n\n if (!isCryptoKeyFn) {\n ({ isCryptoKey: isCryptoKeyFn } = require('internal/crypto/keys'));\n }\n\n return isCryptoKeyFn(obj);\n },\n },\n});\n","internal/v8/startup_snapshot.js":"'use strict';\n\nconst {\n validateFunction,\n} = require('internal/validators');\nconst {\n codes: {\n ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION,\n ERR_NOT_BUILDING_SNAPSHOT,\n ERR_NOT_SUPPORTED_IN_SNAPSHOT,\n },\n} = require('internal/errors');\n\nconst {\n setSerializeCallback,\n setDeserializeCallback,\n setDeserializeMainFunction: _setDeserializeMainFunction,\n isBuildingSnapshotBuffer,\n} = internalBinding('mksnapshot');\n\nfunction isBuildingSnapshot() {\n return isBuildingSnapshotBuffer[0];\n}\n\nfunction throwIfNotBuildingSnapshot() {\n if (!isBuildingSnapshot()) {\n throw new ERR_NOT_BUILDING_SNAPSHOT();\n }\n}\n\nfunction throwIfBuildingSnapshot(reason) {\n if (isBuildingSnapshot()) {\n throw new ERR_NOT_SUPPORTED_IN_SNAPSHOT(reason);\n }\n}\n\nconst deserializeCallbacks = [];\nlet deserializeCallbackIsSet = false;\nfunction runDeserializeCallbacks() {\n for (let i = 0; i < deserializeCallbacks.length; i++) {\n const { 0: callback, 1: data } = deserializeCallbacks[i];\n callback(data);\n }\n deserializeCallbacks.length = 0;\n}\n\nfunction addDeserializeCallback(callback, data) {\n throwIfNotBuildingSnapshot();\n validateFunction(callback, 'callback');\n if (!deserializeCallbackIsSet) {\n\n\n\n\n setDeserializeCallback(runDeserializeCallbacks);\n deserializeCallbackIsSet = true;\n }\n deserializeCallbacks.push([callback, data]);\n}\n\nconst serializeCallbacks = [];\nconst afterUserSerializeCallbacks = [];\nfunction runSerializeCallbacks() {\n for (let i = 0; i < serializeCallbacks.length; i++) {\n const { 0: callback, 1: data } = serializeCallbacks[i];\n callback(data);\n }\n serializeCallbacks.length = 0;\n for (let i = 0; i < afterUserSerializeCallbacks.length; i++) {\n const { 0: callback, 1: data } = afterUserSerializeCallbacks[i];\n callback(data);\n }\n afterUserSerializeCallbacks.length = 0;\n}\n\nfunction addSerializeCallback(callback, data) {\n throwIfNotBuildingSnapshot();\n validateFunction(callback, 'callback');\n serializeCallbacks.push([callback, data]);\n}\n\nfunction addAfterUserSerializeCallback(callback, data) {\n afterUserSerializeCallbacks.push([callback, data]);\n}\n\nfunction initializeCallbacks() {\n\n\n if (isBuildingSnapshot()) {\n setSerializeCallback(runSerializeCallbacks);\n }\n}\n\nlet deserializeMainIsSet = false;\nfunction setDeserializeMainFunction(callback, data) {\n throwIfNotBuildingSnapshot();\n\n\n\n validateFunction(callback, 'callback');\n if (deserializeMainIsSet) {\n throw new ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION();\n }\n deserializeMainIsSet = true;\n\n _setDeserializeMainFunction(function deserializeMain() {\n const {\n prepareMainThreadExecution,\n markBootstrapComplete,\n } = require('internal/process/pre_execution');\n\n\n\n\n prepareMainThreadExecution(false);\n markBootstrapComplete();\n callback(data);\n });\n}\n\ninitializeCallbacks();\nmodule.exports = {\n runDeserializeCallbacks,\n throwIfBuildingSnapshot,\n\n namespace: {\n addDeserializeCallback,\n addSerializeCallback,\n setDeserializeMainFunction,\n isBuildingSnapshot,\n },\n addAfterUserSerializeCallback,\n};\n","internal/validators.js":"\n\n'use strict';\n\nconst {\n ArrayIsArray,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsFinite,\n NumberIsInteger,\n NumberIsNaN,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n ObjectPrototypeHasOwnProperty,\n RegExpPrototypeExec,\n String,\n StringPrototypeIncludes,\n StringPrototypeToUpperCase,\n StringPrototypeTrim,\n} = primordials;\n\nconst {\n codes: {\n ERR_INVALID_ARG_TYPE: { HideStackFramesError: ERR_INVALID_ARG_TYPE },\n ERR_INVALID_ARG_VALUE: { HideStackFramesError: ERR_INVALID_ARG_VALUE },\n ERR_INVALID_THIS: { HideStackFramesError: ERR_INVALID_THIS },\n ERR_OUT_OF_RANGE: { HideStackFramesError: ERR_OUT_OF_RANGE },\n ERR_SOCKET_BAD_PORT: { HideStackFramesError: ERR_SOCKET_BAD_PORT },\n ERR_UNKNOWN_SIGNAL: { HideStackFramesError: ERR_UNKNOWN_SIGNAL },\n },\n hideStackFrames,\n} = require('internal/errors');\nconst { normalizeEncoding } = require('internal/util');\nconst {\n isAsyncFunction,\n isArrayBufferView,\n isRegExp,\n} = require('internal/util/types');\nconst { signals } = internalBinding('constants').os;\n\n\n\n\n\nfunction isInt32(value) {\n return value === (value | 0);\n}\n\n\n\n\n\nfunction isUint32(value) {\n return value === (value >>> 0);\n}\n\nconst octalReg = /^[0-7]+$/;\nconst modeDesc = 'must be a 32-bit unsigned integer or an octal string';\n\n\n\n\n\n\n\n\n\n\n\n\nfunction parseFileMode(value, name, def) {\n value ??= def;\n if (typeof value === 'string') {\n if (RegExpPrototypeExec(octalReg, value) === null) {\n throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc);\n }\n value = NumberParseInt(value, 8);\n }\n\n validateUint32(value, name);\n\n return value + 0;\n}\n\n\n\n\n\n\n\n\n\n\n\nconst validateInteger = hideStackFrames(\n (value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== 'number')\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value);\n if (!NumberIsInteger(value))\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value);\n if (value < min || value > max)\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n },\n);\n\n\n\n\n\n\n\n\n\n\n\nconst validateInt32 = hideStackFrames(\n (value, name, min = -2147483648, max = 2147483647) => {\n\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value);\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value);\n }\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n },\n);\n\n\n\n\n\n\n\n\n\n\nconst validateUint32 = hideStackFrames((value, name, positive = false) => {\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value);\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value);\n }\n const min = positive ? 1 : 0;\n\n const max = 4_294_967_295;\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateString = hideStackFrames((value, name) => {\n if (typeof value !== 'string')\n throw new ERR_INVALID_ARG_TYPE(name, 'string', value);\n});\n\n\nconst validateStringWithoutNullBytes = hideStackFrames((value, name) => {\n validateString(value, name);\n if (StringPrototypeIncludes(value, '\\u0000')) {\n throw new ERR_INVALID_ARG_VALUE(name, value, 'must be a string without null bytes');\n }\n});\n\n\n\n\n\n\n\n\n\n\n\nconst validateNumber = hideStackFrames((value, name, min = undefined, max) => {\n if (typeof value !== 'number')\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value);\n\n if ((min != null && value < min) || (max != null && value > max) ||\n ((min != null || max != null) && NumberIsNaN(value))) {\n throw new ERR_OUT_OF_RANGE(\n name,\n `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`,\n value);\n }\n});\n\n\n\n\n\n\n\n\n\n\nconst validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const allowed = ArrayPrototypeJoin(\n ArrayPrototypeMap(oneOf, (v) =>\n (typeof v === 'string' ? `'${v}'` : String(v))),\n ', ');\n const reason = 'must be one of: ' + allowed;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateBoolean = hideStackFrames((value, name) => {\n if (typeof value !== 'boolean')\n throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value);\n});\n\nconst kValidateObjectNone = 0;\nconst kValidateObjectAllowNullable = 1 << 0;\nconst kValidateObjectAllowArray = 1 << 1;\nconst kValidateObjectAllowFunction = 1 << 2;\nconst kValidateObjectAllowObjects = kValidateObjectAllowArray |\n kValidateObjectAllowFunction;\nconst kValidateObjectAllowObjectsAndNull = kValidateObjectAllowNullable |\n kValidateObjectAllowArray |\n kValidateObjectAllowFunction;\n\n\n\n\n\n\n\n\n\nconst validateObject = hideStackFrames(\n (value, name, options = kValidateObjectNone) => {\n if (options === kValidateObjectNone) {\n if (value === null || ArrayIsArray(value)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);\n }\n\n if (typeof value !== 'object') {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);\n }\n } else {\n const throwOnNullable = (kValidateObjectAllowNullable & options) === 0;\n\n if (throwOnNullable && value === null) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);\n }\n\n const throwOnArray = (kValidateObjectAllowArray & options) === 0;\n\n if (throwOnArray && ArrayIsArray(value)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);\n }\n\n const throwOnFunction = (kValidateObjectAllowFunction & options) === 0;\n const typeofValue = typeof value;\n\n if (typeofValue !== 'object' && (throwOnFunction || typeofValue !== 'function')) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value);\n }\n }\n });\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst validateDictionary = hideStackFrames(\n (value, name) => {\n if (value != null && typeof value !== 'object' && typeof value !== 'function') {\n throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value);\n }\n });\n\n\n\n\n\n\n\n\n\n\nconst validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray(value)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Array', value);\n }\n if (value.length < minLength) {\n const reason = `must have a length of at least ${minLength}`;\n throw new ERR_INVALID_ARG_VALUE(name, value, reason);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateStringArray = hideStackFrames((value, name) => {\n validateArray(value, name);\n for (let i = 0; i < value.length; ++i) {\n\n\n if (typeof value[i] !== 'string') {\n throw new ERR_INVALID_ARG_TYPE(`${name}[${i}]`, 'string', value[i]);\n }\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateBooleanArray = hideStackFrames((value, name) => {\n validateArray(value, name);\n for (let i = 0; i < value.length; ++i) {\n\n\n if (value[i] !== true && value[i] !== false) {\n throw new ERR_INVALID_ARG_TYPE(`${name}[${i}]`, 'boolean', value[i]);\n }\n }\n});\n\n\n\n\n\n\n\n\n\nfunction validateAbortSignalArray(value, name) {\n validateArray(value, name);\n for (let i = 0; i < value.length; i++) {\n const signal = value[i];\n const indexedName = `${name}[${i}]`;\n if (signal == null) {\n throw new ERR_INVALID_ARG_TYPE(indexedName, 'AbortSignal', signal);\n }\n validateAbortSignal(signal, indexedName);\n }\n}\n\n\n\n\n\n\nconst validateSignalName = hideStackFrames((signal, name = 'signal') => {\n validateString(signal, name);\n\n if (signals[signal] === undefined) {\n if (signals[StringPrototypeToUpperCase(signal)] !== undefined) {\n throw new ERR_UNKNOWN_SIGNAL(signal +\n ' (signals must use all capital letters)');\n }\n\n throw new ERR_UNKNOWN_SIGNAL(signal);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateBuffer = hideStackFrames((buffer, name = 'buffer') => {\n if (!isArrayBufferView(buffer)) {\n throw new ERR_INVALID_ARG_TYPE(name,\n ['Buffer', 'TypedArray', 'DataView'],\n buffer);\n }\n});\n\n\n\n\n\nconst validateEncoding = hideStackFrames((data, encoding) => {\n const normalizedEncoding = normalizeEncoding(encoding);\n const length = data.length;\n\n if (normalizedEncoding === 'hex' && length % 2 !== 0) {\n throw new ERR_INVALID_ARG_VALUE('encoding', encoding,\n `is invalid for data of length ${length}`);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validatePort = hideStackFrames((port, name = 'Port', allowZero = true) => {\n if ((typeof port !== 'number' && typeof port !== 'string') ||\n (typeof port === 'string' && StringPrototypeTrim(port).length === 0) ||\n +port !== (+port >>> 0) ||\n port > 0xFFFF ||\n (+port === 0 && !allowZero)) {\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero);\n }\n return port | 0;\n});\n\n\n\n\n\n\n\n\nconst validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== undefined &&\n (signal === null ||\n typeof signal !== 'object' ||\n !('aborted' in signal))) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal);\n }\n});\n\n\n\n\n\n\n\n\n\nconst validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function')\n throw new ERR_INVALID_ARG_TYPE(name, 'Function', value);\n});\n\n\n\n\n\n\n\n\n\nconst validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function' || isAsyncFunction(value))\n throw new ERR_INVALID_ARG_TYPE(name, 'Function', value);\n});\n\n\n\n\n\n\n\n\n\nconst validateUndefined = hideStackFrames((value, name) => {\n if (value !== undefined)\n throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value);\n});\n\n\n\n\n\n\n\nfunction validateUnion(value, name, union) {\n if (!ArrayPrototypeIncludes(union, value)) {\n throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value);\n }\n}\n\n\n\n\n\n\n\n\n\nconst linkValueRegExp = /^(?:<[^>\\r\\n]*>)(?:\\s*;\\s*[^;\"\\s]+(?:=(\")?[^;\"\\s]*\\1)?)*$/;\n\n\n\n\n\nconst validateLinkHeaderFormat = hideStackFrames((value, name) => {\n if (\n typeof value === 'undefined' ||\n !RegExpPrototypeExec(linkValueRegExp, value)\n ) {\n throw new ERR_INVALID_ARG_VALUE(\n name,\n value,\n 'must be an array or string of format \"; rel=preload; as=style\"',\n );\n }\n});\n\n\n\n\n\n\n\nconst validateThisInternalField = hideStackFrames((object, fieldKey, className) => {\n if (typeof object !== 'object' || object === null || !ObjectPrototypeHasOwnProperty(object, fieldKey)) {\n throw new ERR_INVALID_THIS(className);\n }\n});\n\n\n\n\n\nconst validateLinkHeaderValue = hideStackFrames((hints) => {\n if (typeof hints === 'string') {\n validateLinkHeaderFormat.withoutStackTrace(hints, 'hints');\n return hints;\n } else if (ArrayIsArray(hints)) {\n const hintsLength = hints.length;\n let result = '';\n\n if (hintsLength === 0) {\n return result;\n }\n\n for (let i = 0; i < hintsLength; i++) {\n const link = hints[i];\n validateLinkHeaderFormat.withoutStackTrace(link, 'hints');\n result += link;\n\n if (i !== hintsLength - 1) {\n result += ', ';\n }\n }\n\n return result;\n }\n\n throw new ERR_INVALID_ARG_VALUE(\n 'hints',\n hints,\n 'must be an array or string of format \"; rel=preload; as=style\"',\n );\n});\n\n\n\n\n\n\nconst validateIgnoreOptionElement = hideStackFrames((value, name) => {\n if (typeof value === 'string') {\n if (value.length === 0)\n throw new ERR_INVALID_ARG_VALUE(name, value, 'must be a non-empty string');\n return;\n }\n if (isRegExp(value)) return;\n if (typeof value === 'function') return;\n throw new ERR_INVALID_ARG_TYPE(name, ['string', 'RegExp', 'Function'], value);\n});\n\n\n\n\n\n\nconst validateIgnoreOption = hideStackFrames((value, name) => {\n if (value == null) return;\n if (ArrayIsArray(value)) {\n for (let i = 0; i < value.length; i++) {\n validateIgnoreOptionElement(value[i], `${name}[${i}]`);\n }\n return;\n }\n validateIgnoreOptionElement(value, name);\n});\n\n\n\n\n\nconst validateFiniteNumber = hideStackFrames((number, name) => {\n\n if (number === undefined) {\n return false;\n }\n\n if (NumberIsFinite(number)) {\n return true;\n }\n\n if (NumberIsNaN(number)) {\n return false;\n }\n\n validateNumber(number, name);\n\n\n throw new ERR_OUT_OF_RANGE(name, 'a finite number', number);\n});\n\n\n\n\n\nconst checkRangesOrGetDefault = hideStackFrames(\n (number, name, lower, upper, def) => {\n if (!validateFiniteNumber(number, name)) {\n return def;\n }\n if (number < lower || number > upper) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${lower} and <= ${upper}`, number);\n }\n return number;\n },\n);\n\nmodule.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateStringArray,\n validateBooleanArray,\n validateAbortSignalArray,\n validateBoolean,\n validateBuffer,\n validateDictionary,\n validateEncoding,\n validateFunction,\n validateIgnoreOption,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n kValidateObjectNone,\n kValidateObjectAllowNullable,\n kValidateObjectAllowArray,\n kValidateObjectAllowFunction,\n kValidateObjectAllowObjects,\n kValidateObjectAllowObjectsAndNull,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateStringWithoutNullBytes,\n validateUint32,\n validateUndefined,\n validateUnion,\n validateAbortSignal,\n validateLinkHeaderValue,\n validateThisInternalField,\n validateFiniteNumber,\n checkRangesOrGetDefault,\n};\n","internal/webidl.js":"'use strict';\n\nconst {\n ArrayBufferIsView,\n ArrayBufferPrototypeGetResizable,\n ArrayIsArray,\n ArrayPrototypePush,\n ArrayPrototypeToSorted,\n BigInt,\n DataViewPrototypeGetBuffer,\n FunctionPrototypeCall,\n MathAbs,\n MathMax,\n MathMin,\n MathPow,\n MathSign,\n MathTrunc,\n Number,\n NumberIsFinite,\n NumberIsNaN,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n ObjectPrototypeHasOwnProperty,\n ObjectPrototypeIsPrototypeOf,\n SafeArrayIterator,\n SafeSet,\n String,\n StringPrototypeToWellFormed,\n SymbolIterator,\n TypeError,\n TypedArrayPrototypeGetBuffer,\n TypedArrayPrototypeGetSymbolToStringTag,\n} = primordials;\n\nconst { kEmptyObject, setOwnProperty } = require('internal/util');\nconst {\n isSharedArrayBuffer,\n isTypedArray,\n} = require('internal/util/types');\n\nconst BIGINT_2_63 = 1n << 63n;\nconst BIGINT_2_64 = 1n << 64n;\n\nconst converters = { __proto__: null };\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction codedTypeError(message, code) {\n\n const err = new TypeError(message);\n setOwnProperty(err, 'code', code);\n return err;\n}\n\n\n\n\n\n\n\nfunction makeException(message, options = kEmptyObject) {\n const prefix = options.prefix ? options.prefix + ': ' : '';\n const context = options.context?.length === 0 ?\n '' : (options.context ?? 'Value') + ' ';\n return codedTypeError(\n `${prefix}${context}${message}`,\n options.code || 'ERR_INVALID_ARG_TYPE',\n );\n}\n\n\n\n\n\n\n\n\n\n\n\nfunction makeOptions(options, context = options.context, code = options.code) {\n return {\n prefix: options.prefix,\n context,\n code,\n enforceRange: options.enforceRange,\n clamp: options.clamp,\n allowShared: options.allowShared,\n allowResizable: options.allowResizable,\n };\n}\n\n\n\n\n\n\n\nfunction type(V) {\n\n switch (typeof V) {\n case 'undefined':\n return 'Undefined';\n case 'boolean':\n return 'Boolean';\n case 'string':\n return 'String';\n case 'symbol':\n return 'Symbol';\n case 'number':\n return 'Number';\n case 'bigint':\n return 'BigInt';\n case 'object':\n case 'function':\n default:\n\n\n if (V === null) {\n return 'Null';\n }\n return 'Object';\n }\n}\n\n\n\n\n\n\n\nfunction integerPart(n) {\n\n\n const integer = MathTrunc(n);\n return integer === 0 ? 0 : integer;\n}\n\n\n\n\n\n\nfunction evenRound(x) {\n\n\n const i = integerPart(x);\n const remainder = MathAbs(x % 1);\n const sign = MathSign(x);\n if (remainder === 0.5) {\n return i % 2 === 0 ? i : i + sign;\n }\n const r = remainder < 0.5 ? i : i + sign;\n if (r === 0) {\n return 0;\n }\n return r;\n}\n\n\n\n\n\n\nfunction pow2(exponent) {\n if (exponent < 31) {\n return 1 << exponent;\n }\n if (exponent === 31) {\n return 0x8000_0000;\n }\n if (exponent === 32) {\n return 0x1_0000_0000;\n }\n return MathPow(2, exponent);\n}\n\n\n\n\n\n\n\n\n\n\n\n\nfunction modulo(x, y) {\n\n const r = x % y;\n if (r === 0) {\n return 0;\n }\n return r > 0 ? r : r + y;\n}\n\n\n\n\n\n\n\n\n\n\n\n\nfunction bigIntModulo(x, y) {\n\n const r = x % y;\n return r >= 0n ? r : r + y;\n}\n\n\n\n\n\n\n\n\nfunction toNumber(V, options = kEmptyObject) {\n if (typeof V === 'bigint') {\n\n throw makeException(\n 'is a BigInt and cannot be converted to a number.',\n options);\n }\n if (typeof V === 'symbol') {\n\n throw makeException(\n 'is a Symbol and cannot be converted to a number.',\n options);\n }\n\n\n\n\n\n\n\n\n return +V;\n}\n\n\n\n\n\n\n\n\nfunction toString(V, options = kEmptyObject) {\n if (typeof V === 'symbol') {\n\n throw makeException(\n 'is a Symbol and cannot be converted to a string.',\n options);\n }\n\n\n\n\n\n\n\n\n return String(V);\n}\n\n\n\n\n\n\n\n\n\n\nfunction convertToInt(\n V,\n bitLength,\n signedness = 'unsigned',\n options = kEmptyObject,\n) {\n const signed = signedness === 'signed';\n let upperBound;\n let lowerBound;\n\n\n if (bitLength === 64) {\n\n\n\n\n upperBound = NumberMAX_SAFE_INTEGER;\n lowerBound = signed ? NumberMIN_SAFE_INTEGER : 0;\n } else if (!signed) {\n\n\n lowerBound = 0;\n if (bitLength === 8) {\n upperBound = 0xff;\n } else if (bitLength === 16) {\n upperBound = 0xffff;\n } else if (bitLength === 32) {\n upperBound = 0xffff_ffff;\n } else {\n upperBound = pow2(bitLength) - 1;\n }\n } else if (bitLength === 8) {\n\n\n lowerBound = -0x80;\n upperBound = 0x7f;\n } else if (bitLength === 16) {\n lowerBound = -0x8000;\n upperBound = 0x7fff;\n } else if (bitLength === 32) {\n lowerBound = -0x8000_0000;\n upperBound = 0x7fff_ffff;\n } else {\n lowerBound = -pow2(bitLength - 1);\n upperBound = pow2(bitLength - 1) - 1;\n }\n\n\n\n\n\n\n let x;\n if (typeof V === 'number') {\n\n\n\n if (V >= lowerBound && V <= upperBound) {\n const integer = MathTrunc(V);\n if (integer === V) {\n return V === 0 ? 0 : V;\n }\n if (options !== kEmptyObject && options.clamp) {\n return evenRound(V);\n }\n return integer === 0 ? 0 : integer;\n }\n if (options !== kEmptyObject && options.enforceRange) {\n\n\n if (!NumberIsFinite(V)) {\n throw makeException(\n 'is not a finite number.',\n options);\n }\n\n const integer = integerPart(V);\n if (integer < lowerBound || integer > upperBound) {\n throw makeException(\n `is outside the expected range of ${lowerBound} to ${upperBound}.`,\n makeOptions(options, options.context, 'ERR_OUT_OF_RANGE'));\n }\n\n return integer;\n }\n if (options !== kEmptyObject && options.clamp && !NumberIsNaN(V)) {\n\n if (V <= lowerBound) {\n return lowerBound === 0 ? 0 : lowerBound;\n }\n if (V >= upperBound) {\n return upperBound === 0 ? 0 : upperBound;\n }\n }\n x = V;\n } else {\n\n x = toNumber(V, options);\n }\n\n if (x === 0) {\n x = 0;\n }\n\n\n if (options.enforceRange) {\n\n if (!NumberIsFinite(x)) {\n throw makeException(\n 'is not a finite number.',\n options);\n }\n\n\n x = integerPart(x);\n\n\n if (x < lowerBound || x > upperBound) {\n throw makeException(\n `is outside the expected range of ${lowerBound} to ${upperBound}.`,\n makeOptions(options, options.context, 'ERR_OUT_OF_RANGE'));\n }\n\n return x;\n }\n\n\n if (options.clamp && !NumberIsNaN(x)) {\n\n x = MathMin(MathMax(x, lowerBound), upperBound);\n\n return evenRound(x);\n }\n\n\n if (!NumberIsFinite(x) || x === 0) {\n return 0;\n }\n\n\n x = integerPart(x);\n\n\n\n\n\n if (x >= lowerBound && x <= upperBound) {\n return x;\n }\n\n if (bitLength === 64) {\n\n\n\n let xBigInt = BigInt(x);\n xBigInt = bigIntModulo(xBigInt, BIGINT_2_64);\n\n\n\n\n\n\n\n if (signed && xBigInt >= BIGINT_2_63) {\n return Number(xBigInt - BIGINT_2_64);\n }\n\n\n return Number(xBigInt);\n }\n\n\n\n\n if (bitLength === 8) {\n return signed ? (x << 24) >> 24 : x & 0xff;\n }\n if (bitLength === 16) {\n return signed ? (x << 16) >> 16 : x & 0xffff;\n }\n if (bitLength === 32) {\n return signed ? x | 0 : x >>> 0;\n }\n\n\n const twoToTheBitLength = pow2(bitLength);\n x = modulo(x, twoToTheBitLength);\n\n\n if (signed && x >= pow2(bitLength - 1)) {\n return x - twoToTheBitLength;\n }\n\n\n return x;\n}\n\n\n\n\n\n\n\nfunction createIntegerConverter(bitLength, signedness = 'unsigned') {\n return (V, options = kEmptyObject) => {\n\n\n return convertToInt(V, bitLength, signedness, options);\n };\n}\n\n\n\n\n\n\n\nconverters.boolean = (V) => {\n\n\n return !!V;\n};\n\n\n\n\n\n\n\n\nconverters.object = (V, options = kEmptyObject) => {\n\n if (type(V) !== 'Object') {\n throw makeException(\n 'is not an object.',\n options,\n );\n }\n\n return V;\n};\n\n\n\n\n\n\nconverters.octet = createIntegerConverter(8);\n\n\n\n\n\n\nconverters['unsigned short'] = createIntegerConverter(16);\n\n\n\n\n\n\nconverters['unsigned long'] = createIntegerConverter(32);\n\n\n\n\n\n\nconverters['long long'] = createIntegerConverter(64, 'signed');\n\n\n\n\n\n\n\n\nconverters.DOMString = function DOMString(V, options = kEmptyObject) {\n\n\n\n return toString(V, options);\n};\n\n\n\n\n\n\n\n\nconverters.USVString = function USVString(V, options = kEmptyObject) {\n return StringPrototypeToWellFormed(converters.DOMString(V, options));\n};\n\n\n\n\n\n\n\n\nfunction requiredArguments(length, required, options = kEmptyObject) {\n if (length < required) {\n throw makeException(\n `${required} argument${\n required === 1 ? '' : 's'\n } required, but only ${length} present.`,\n makeOptions(options, '', 'ERR_MISSING_ARGS'));\n }\n}\n\n\n\n\n\n\n\n\nfunction createEnumConverter(name, values) {\n const E = new SafeSet(new SafeArrayIterator(values));\n\n return function(V, options = kEmptyObject) {\n\n const S = toString(V, options);\n\n\n if (!E.has(S)) {\n throw makeException(\n `'${S}' is not a valid enum value of type ${name}.`,\n makeOptions(options, options.context, 'ERR_INVALID_ARG_VALUE'));\n }\n\n\n return S;\n };\n}\n\n\n\n\n\n\n\nfunction dictionaryMemberContext(key, options) {\n return options.context ? `${key} in ${options.context}` : key;\n}\n\n\n\n\n\n\n\nfunction sequenceElementContext(index, options) {\n return `${options.context ?? 'Value'}[${index}]`;\n}\n\n\n\n\n\n\n\nfunction missingDictionaryMemberMessage(dictionaryName, key) {\n return `cannot be converted to '${dictionaryName}' because ` +\n `'${key}' is required in '${dictionaryName}'.`;\n}\n\n\n\n\n\n\n\n\n\n\nfunction createDictionaryConverter(\n dictionaryName,\n members,\n) {\n const compareMembers = (a, b) => {\n if (a.key === b.key) {\n return 0;\n }\n return a.key < b.key ? -1 : 1;\n };\n\n const dictionaries = ArrayIsArray(members[0]) ? members : [members];\n const sortedDictionaries = [];\n\n function ownMember(member, key) {\n return ObjectPrototypeHasOwnProperty(member, key) ? member[key] : undefined;\n }\n\n\n\n let anyMissingMemberHandling = false;\n\n\n\n\n for (let i = 0; i < dictionaries.length; i++) {\n const sortedMembers = ArrayPrototypeToSorted(\n dictionaries[i],\n compareMembers,\n );\n\n\n\n\n\n for (let j = 0; j < sortedMembers.length; j++) {\n const member = sortedMembers[j];\n const defaultValue = ownMember(member, 'defaultValue');\n const required = ownMember(member, 'required');\n if (typeof defaultValue === 'function' || required) {\n anyMissingMemberHandling = true;\n }\n sortedMembers[j] = {\n key: ownMember(member, 'key'),\n converter: ownMember(member, 'converter'),\n defaultValue,\n required,\n validator: ownMember(member, 'validator'),\n };\n }\n ArrayPrototypePush(sortedDictionaries, sortedMembers);\n }\n\n const hasMissingMemberHandling = anyMissingMemberHandling;\n\n return function(jsDict, options = kEmptyObject) {\n\n if (jsDict != null && type(jsDict) !== 'Object') {\n throw makeException(\n 'cannot be converted to a dictionary',\n options,\n );\n }\n\n\n const idlDict = { __proto__: null };\n\n\n for (let i = 0; i < sortedDictionaries.length; i++) {\n const sortedMembers = sortedDictionaries[i];\n for (let j = 0; j < sortedMembers.length; j++) {\n const member = sortedMembers[j];\n\n const key = member.key;\n\n const jsMemberValue = jsDict == null ? undefined : jsDict[key];\n\n\n if (jsMemberValue !== undefined) {\n const converter = member.converter;\n\n const idlMemberValue = converter(\n jsMemberValue,\n makeOptions(options, dictionaryMemberContext(key, options)),\n );\n\n\n\n\n\n member.validator?.(idlMemberValue, jsDict);\n\n idlDict[key] = idlMemberValue;\n } else if (hasMissingMemberHandling) {\n if (typeof member.defaultValue === 'function') {\n\n idlDict[key] = member.defaultValue();\n } else if (member.required) {\n\n throw makeException(\n missingDictionaryMemberMessage(dictionaryName, key),\n makeOptions(options, options.context, 'ERR_MISSING_OPTION'));\n }\n }\n }\n }\n\n\n return idlDict;\n };\n}\n\n\n\n\n\n\n\nfunction createSequenceConverter(converter) {\n return function(V, options = kEmptyObject) {\n\n if (type(V) !== 'Object') {\n throw makeException(\n 'cannot be converted to sequence.',\n options);\n }\n\n\n const method = V[SymbolIterator];\n\n if (typeof method !== 'function') {\n throw makeException(\n 'cannot be converted to sequence.',\n options);\n }\n\n\n const iterator = FunctionPrototypeCall(method, V);\n const nextMethod = iterator?.next;\n if (typeof nextMethod !== 'function') {\n throw makeException(\n 'cannot be converted to sequence.',\n options);\n }\n\n\n const idlSequence = [];\n while (true) {\n\n const next = FunctionPrototypeCall(nextMethod, iterator);\n if (type(next) !== 'Object') {\n throw makeException(\n 'cannot be converted to sequence.',\n options);\n }\n\n if (next.done) {\n break;\n }\n\n const idlValue = converter(\n next.value,\n makeOptions(options, sequenceElementContext(idlSequence.length, options)),\n );\n\n ArrayPrototypePush(idlSequence, idlValue);\n }\n return idlSequence;\n };\n}\n\n\n\n\n\n\n\n\nfunction createInterfaceConverter(name, prototype) {\n return (V, options = kEmptyObject) => {\n\n if (ObjectPrototypeIsPrototypeOf(prototype, V)) {\n return V;\n }\n\n throw makeException(\n `is not of type ${name}.`,\n options);\n };\n}\n\n\n\n\n\n\n\nfunction getViewedArrayBuffer(V) {\n\n return isTypedArray(V) ?\n TypedArrayPrototypeGetBuffer(V) : DataViewPrototypeGetBuffer(V);\n}\n\n\n\n\n\n\n\nfunction validateBufferSourceBacking(buffer, options) {\n let resizable;\n try {\n\n\n\n\n\n resizable = ArrayBufferPrototypeGetResizable(buffer);\n } catch {\n\n\n if (!options.allowShared) {\n throw makeException(\n 'is a view on a SharedArrayBuffer, which is not allowed.',\n options);\n }\n\n\n validateAllowGrowableSharedArrayBuffer(buffer, options);\n return;\n }\n\n\n\n\n validateAllowResizableArrayBuffer(resizable, options);\n}\n\n\n\n\n\n\n\nfunction validateAllowGrowableSharedArrayBuffer(buffer, options) {\n\n\n\n\n\n\n\n if (!options.allowResizable && buffer.growable) {\n throw makeException(\n 'is backed by a growable SharedArrayBuffer, which is not allowed.',\n options);\n }\n}\n\n\n\n\n\n\n\nfunction validateAllowResizableArrayBuffer(resizable, options) {\n\n\n\n\n if (resizable && !options.allowResizable) {\n throw makeException(\n 'is backed by a resizable ArrayBuffer, which is not allowed.',\n options);\n }\n}\n\n\n\n\n\n\n\nconverters.Uint8Array = (V, options = kEmptyObject) => {\n\n\n if (!ArrayBufferIsView(V) ||\n TypedArrayPrototypeGetSymbolToStringTag(V) !== 'Uint8Array') {\n throw makeException(\n 'is not an Uint8Array object.',\n options);\n }\n\n validateBufferSourceBacking(TypedArrayPrototypeGetBuffer(V), options);\n\n\n return V;\n};\n\n\n\n\n\n\n\n\nconverters.BufferSource = (V, options = kEmptyObject) => {\n\n\n\n if (ArrayBufferIsView(V)) {\n const buffer = getViewedArrayBuffer(V);\n\n\n\n\n\n\n\n\n let resizable;\n try {\n\n\n\n resizable = ArrayBufferPrototypeGetResizable(buffer);\n } catch {\n throw makeException(\n 'is a view on a SharedArrayBuffer, which is not allowed.',\n options);\n }\n if (resizable && !options.allowResizable) {\n throw makeException(\n 'is backed by a resizable ArrayBuffer, which is not allowed.',\n options);\n }\n return V;\n }\n\n\n\n\n\n let resizable;\n try {\n resizable = ArrayBufferPrototypeGetResizable(V);\n } catch {\n throw makeException(\n 'is not instance of ArrayBuffer, Buffer, TypedArray, or DataView.',\n options);\n }\n\n\n\n\n if (resizable && !options.allowResizable) {\n throw makeException(\n 'is backed by a resizable ArrayBuffer, which is not allowed.',\n options);\n }\n\n\n return V;\n};\n\n\n\n\n\n\n\n\nconverters.AllowSharedBufferSource = (V, options = kEmptyObject) => {\n\n\n\n if (ArrayBufferIsView(V)) {\n const buffer = getViewedArrayBuffer(V);\n let resizable;\n try {\n resizable = ArrayBufferPrototypeGetResizable(buffer);\n } catch {\n validateAllowGrowableSharedArrayBuffer(buffer, options);\n return V;\n }\n validateAllowResizableArrayBuffer(resizable, options);\n return V;\n }\n\n let resizable;\n try {\n resizable = ArrayBufferPrototypeGetResizable(V);\n } catch {\n if (isSharedArrayBuffer(V)) {\n validateAllowGrowableSharedArrayBuffer(V, options);\n return V;\n }\n throw makeException(\n 'is not instance of ArrayBuffer, SharedArrayBuffer, Buffer, ' +\n 'TypedArray, or DataView.',\n options);\n }\n\n validateAllowResizableArrayBuffer(resizable, options);\n return V;\n};\n\n\n\n\n\n\nconverters['sequence'] =\n createSequenceConverter(converters.DOMString);\n\n\n\n\n\n\nconverters['sequence'] =\n createSequenceConverter(converters.object);\n\n\n\n\n\n\nconverters.StructuredSerializeOptions = createDictionaryConverter(\n 'StructuredSerializeOptions',\n [\n {\n key: 'transfer',\n converter: converters['sequence'],\n defaultValue: () => [],\n },\n ],\n);\n\nmodule.exports = {\n converters,\n convertToInt,\n createDictionaryConverter,\n createEnumConverter,\n createInterfaceConverter,\n createSequenceConverter,\n requiredArguments,\n type,\n};\n","internal/worker/js_transferable.js":"'use strict';\nconst {\n Error,\n StringPrototypeSplit,\n} = primordials;\nconst {\n codes: {\n ERR_MISSING_ARGS,\n },\n} = require('internal/errors');\nconst webidl = require('internal/webidl');\nconst {\n messaging_deserialize_symbol,\n messaging_transfer_symbol,\n messaging_clone_symbol,\n messaging_transfer_list_symbol,\n} = internalBinding('symbols');\nconst {\n setDeserializerCreateObjectFunction,\n structuredClone: nativeStructuredClone,\n} = internalBinding('messaging');\nconst {\n privateSymbols: {\n transfer_mode_private_symbol,\n },\n constants: {\n kDisallowCloneAndTransfer,\n kTransferable,\n kCloneable,\n },\n} = internalBinding('util');\n\nfunction setup() {\n\n\n\n setDeserializerCreateObjectFunction((deserializeInfo) => {\n const { 0: module, 1: ctor } = StringPrototypeSplit(deserializeInfo, ':', 2);\n const Ctor = require(module)[ctor];\n if (typeof Ctor !== 'function' ||\n typeof Ctor.prototype[messaging_deserialize_symbol] !== 'function') {\n\n\n\n throw new Error(`Unknown deserialize spec ${deserializeInfo}`);\n }\n\n return new Ctor();\n });\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction markTransferMode(obj, cloneable = false, transferable = false) {\n if ((typeof obj !== 'object' && typeof obj !== 'function') || obj === null)\n return;\n let mode = kDisallowCloneAndTransfer;\n if (cloneable) mode |= kCloneable;\n if (transferable) mode |= kTransferable;\n obj[transfer_mode_private_symbol] = mode;\n}\n\n\nfunction structuredClone(value, options) {\n if (arguments.length === 0) {\n throw new ERR_MISSING_ARGS('The value argument must be specified');\n }\n\n const idlOptions = webidl.converters.StructuredSerializeOptions(\n options,\n {\n __proto__: null,\n prefix: \"Failed to execute 'structuredClone'\",\n context: 'Options',\n },\n );\n\n const serializedData = nativeStructuredClone(value, idlOptions);\n return serializedData;\n}\n\nmodule.exports = {\n markTransferMode,\n setup,\n structuredClone,\n kClone: messaging_clone_symbol,\n kDeserialize: messaging_deserialize_symbol,\n kTransfer: messaging_transfer_symbol,\n kTransferList: messaging_transfer_list_symbol,\n};\n","stream.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n ObjectDefineProperty,\n ObjectKeys,\n ReflectApply,\n} = primordials;\n\nconst {\n promisify: { custom: customPromisify },\n} = require('internal/util');\n\nconst {\n streamReturningOperators,\n promiseReturningOperators,\n} = require('internal/streams/operators');\n\nconst {\n codes: {\n ERR_ILLEGAL_CONSTRUCTOR,\n },\n} = require('internal/errors');\nconst compose = require('internal/streams/compose');\nconst { setDefaultHighWaterMark, getDefaultHighWaterMark } = require('internal/streams/state');\nconst { pipeline } = require('internal/streams/pipeline');\nconst { destroyer } = require('internal/streams/destroy');\nconst { eos } = require('internal/streams/end-of-stream');\nconst internalBuffer = require('internal/buffer');\n\nconst promises = require('stream/promises');\nconst utils = require('internal/streams/utils');\nconst { isArrayBufferView, isUint8Array } = require('internal/util/types');\n\nconst Stream = module.exports = require('internal/streams/legacy').Stream;\n\nStream.isDestroyed = utils.isDestroyed;\nStream.isDisturbed = utils.isDisturbed;\nStream.isErrored = utils.isErrored;\nStream.isReadable = utils.isReadable;\nStream.isWritable = utils.isWritable;\n\nStream.Readable = require('internal/streams/readable');\nconst streamKeys = ObjectKeys(streamReturningOperators);\nfor (let i = 0; i < streamKeys.length; i++) {\n const key = streamKeys[i];\n const op = streamReturningOperators[key];\n function fn(...args) {\n if (new.target) {\n throw new ERR_ILLEGAL_CONSTRUCTOR();\n }\n return Stream.Readable.from(ReflectApply(op, this, args));\n }\n ObjectDefineProperty(fn, 'name', { __proto__: null, value: op.name });\n ObjectDefineProperty(fn, 'length', { __proto__: null, value: op.length });\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true,\n });\n}\nconst promiseKeys = ObjectKeys(promiseReturningOperators);\nfor (let i = 0; i < promiseKeys.length; i++) {\n const key = promiseKeys[i];\n const op = promiseReturningOperators[key];\n function fn(...args) {\n if (new.target) {\n throw new ERR_ILLEGAL_CONSTRUCTOR();\n }\n return ReflectApply(op, this, args);\n }\n ObjectDefineProperty(fn, 'name', { __proto__: null, value: op.name });\n ObjectDefineProperty(fn, 'length', { __proto__: null, value: op.length });\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true,\n });\n}\nStream.Writable = require('internal/streams/writable');\nStream.Duplex = require('internal/streams/duplex');\nStream.Transform = require('internal/streams/transform');\nStream.PassThrough = require('internal/streams/passthrough');\nStream.duplexPair = require('internal/streams/duplexpair');\nStream.pipeline = pipeline;\nconst { addAbortSignal } = require('internal/streams/add-abort-signal');\nStream.addAbortSignal = addAbortSignal;\nStream.finished = eos;\nStream.destroy = destroyer;\nStream.compose = compose;\nStream.setDefaultHighWaterMark = setDefaultHighWaterMark;\nStream.getDefaultHighWaterMark = getDefaultHighWaterMark;\n\nObjectDefineProperty(Stream, 'promises', {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return promises;\n },\n});\n\nObjectDefineProperty(pipeline, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.pipeline;\n },\n});\n\nObjectDefineProperty(eos, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.finished;\n },\n});\n\n\nStream.Stream = Stream;\n\nStream._isArrayBufferView = isArrayBufferView;\nStream._isUint8Array = isUint8Array;\nStream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return new internalBuffer.FastBuffer(chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength);\n};\n","stream/promises.js":"'use strict';\n\nconst {\n ArrayPrototypePop,\n Promise,\n} = primordials;\n\nconst {\n isIterable,\n isNodeStream,\n isWebStream,\n} = require('internal/streams/utils');\n\nconst { pipelineImpl: pl } = require('internal/streams/pipeline');\nconst { finished } = require('internal/streams/end-of-stream');\n\nrequire('stream');\n\nfunction pipeline(...streams) {\n return new Promise((resolve, reject) => {\n let signal;\n let end;\n const lastArg = streams[streams.length - 1];\n if (lastArg && typeof lastArg === 'object' &&\n !isNodeStream(lastArg) && !isIterable(lastArg) && !isWebStream(lastArg)) {\n const options = ArrayPrototypePop(streams);\n signal = options.signal;\n end = options.end;\n }\n\n pl(streams, (err, value) => {\n if (err) {\n reject(err);\n } else {\n resolve(value);\n }\n }, { signal, end });\n });\n}\n\nmodule.exports = {\n finished,\n pipeline,\n};\n","string_decoder.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n ArrayBufferIsView,\n ObjectDefineProperties,\n Symbol,\n TypedArrayPrototypeSubarray,\n} = primordials;\n\nconst { Buffer } = require('buffer');\nconst {\n kIncompleteCharactersStart,\n kIncompleteCharactersEnd,\n kMissingBytes,\n kBufferedBytes,\n kEncodingField,\n kSize,\n decode,\n flush,\n} = internalBinding('string_decoder');\nconst {\n encodingsMap,\n normalizeEncoding,\n} = require('internal/util');\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_THIS,\n ERR_UNKNOWN_ENCODING,\n} = require('internal/errors').codes;\n\nconst kNativeDecoder = Symbol('kNativeDecoder');\n\n\n\n\n\n\n\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n if (this.encoding === undefined) {\n throw new ERR_UNKNOWN_ENCODING(encoding);\n }\n this[kNativeDecoder] = Buffer.alloc(kSize);\n this[kNativeDecoder][kEncodingField] = encodingsMap[this.encoding];\n}\n\n\n\n\n\n\n\n\nStringDecoder.prototype.write = function write(buf) {\n if (typeof buf === 'string')\n return buf;\n if (!ArrayBufferIsView(buf))\n throw new ERR_INVALID_ARG_TYPE('buf',\n ['Buffer', 'TypedArray', 'DataView'],\n buf);\n if (!this[kNativeDecoder]) {\n throw new ERR_INVALID_THIS('StringDecoder');\n }\n return decode(this[kNativeDecoder], buf);\n};\n\n\n\n\n\n\n\n\nStringDecoder.prototype.end = function end(buf) {\n const ret = buf === undefined ? '' : this.write(buf);\n if (this[kNativeDecoder][kBufferedBytes] > 0)\n return ret + flush(this[kNativeDecoder]);\n return ret;\n};\n\n\n\n\n\n\n\n\nStringDecoder.prototype.text = function text(buf, offset) {\n this[kNativeDecoder][kMissingBytes] = 0;\n this[kNativeDecoder][kBufferedBytes] = 0;\n return this.write(buf.slice(offset));\n};\n\nObjectDefineProperties(StringDecoder.prototype, {\n lastChar: {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return TypedArrayPrototypeSubarray(this[kNativeDecoder],\n kIncompleteCharactersStart,\n kIncompleteCharactersEnd);\n },\n },\n lastNeed: {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return this[kNativeDecoder][kMissingBytes];\n },\n },\n lastTotal: {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return this[kNativeDecoder][kBufferedBytes] +\n this[kNativeDecoder][kMissingBytes];\n },\n },\n});\n\nexports.StringDecoder = StringDecoder;\n","timers.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n MathTrunc,\n ObjectDefineProperties,\n ObjectDefineProperty,\n SymbolDispose,\n SymbolToPrimitive,\n} = primordials;\n\nconst binding = internalBinding('timers');\nconst {\n immediateInfo,\n} = binding;\nconst L = require('internal/linkedlist');\nconst {\n async_id_symbol,\n Timeout,\n Immediate,\n cleanTimer,\n cleanImmediate,\n decRefCount,\n immediateInfoFields: {\n kCount,\n kRefCount,\n },\n kRefed,\n kHasPrimitive,\n timerListMap,\n timerListQueue,\n immediateQueue,\n insert,\n knownTimersById,\n} = require('internal/timers');\nconst {\n promisify: { custom: customPromisify },\n} = require('internal/util');\nlet debug = require('internal/util/debuglog').debuglog('timer', (fn) => {\n debug = fn;\n});\nconst { validateFunction } = require('internal/validators');\n\nlet timersPromises;\nlet timers;\n\nconst {\n\n emitDestroy,\n} = require('internal/async_hooks');\n\n\nfunction unenroll(item) {\n if (item._destroyed) {\n cleanTimer(item);\n return;\n }\n\n const wasEnrolled = item._idleNext !== null || item._idlePrev !== null;\n item._destroyed = true;\n\n if (item[kHasPrimitive])\n delete knownTimersById[item[async_id_symbol]];\n\n emitDestroy(item[async_id_symbol]);\n\n L.remove(item);\n\n\n\n\n\n\n if (item[kRefed]) {\n\n const msecs = MathTrunc(item._idleTimeout);\n const list = timerListMap[msecs];\n if (list !== undefined && L.isEmpty(list)) {\n debug('unenroll: list empty');\n timerListQueue.removeAt(list.priorityQueuePosition);\n delete timerListMap[list.msecs];\n }\n\n decRefCount();\n }\n\n if (wasEnrolled)\n cleanTimer(item);\n\n\n item._idleTimeout = -1;\n}\n\n\n\n\n\n\n\n\n\n\nfunction setTimeout(callback, after, ...args) {\n validateFunction(callback, 'callback');\n const timeout = new Timeout(callback, after, args.length ? args : undefined, false, true);\n insert(timeout, timeout._idleTimeout);\n return timeout;\n}\n\nObjectDefineProperty(setTimeout, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n timersPromises ??= require('timers/promises');\n return timersPromises.setTimeout;\n },\n});\n\n\n\n\n\n\nfunction clearTimeout(timer) {\n if (timer?._onTimeout) {\n timer._onTimeout = null;\n unenroll(timer);\n return;\n }\n if (typeof timer === 'number' || typeof timer === 'string') {\n const timerInstance = knownTimersById[timer];\n if (timerInstance !== undefined) {\n timerInstance._onTimeout = null;\n unenroll(timerInstance);\n }\n }\n}\n\n\n\n\n\n\n\n\n\nfunction setInterval(callback, repeat, ...args) {\n validateFunction(callback, 'callback');\n const timeout = new Timeout(callback, repeat, args.length ? args : undefined, true, true);\n insert(timeout, timeout._idleTimeout);\n return timeout;\n}\n\n\n\n\n\n\nfunction clearInterval(timer) {\n\n\n\n clearTimeout(timer);\n}\n\nTimeout.prototype.close = function() {\n clearTimeout(this);\n return this;\n};\n\nTimeout.prototype[SymbolDispose] = function() {\n clearTimeout(this);\n};\n\n\n\n\n\nTimeout.prototype[SymbolToPrimitive] = function() {\n const id = this[async_id_symbol];\n if (!this[kHasPrimitive]) {\n this[kHasPrimitive] = true;\n knownTimersById[id] = this;\n }\n return id;\n};\n\n\n\n\n\n\n\n\nfunction setImmediate(callback, ...args) {\n validateFunction(callback, 'callback');\n return new Immediate(callback, args.length ? args : undefined);\n}\n\nObjectDefineProperty(setImmediate, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n timersPromises ??= require('timers/promises');\n return timersPromises.setImmediate;\n },\n});\n\n\n\n\n\n\nfunction clearImmediate(immediate) {\n if (!immediate?._onImmediate || immediate._destroyed)\n return;\n\n immediateInfo[kCount]--;\n immediate._destroyed = true;\n\n if (immediate[kRefed] && --immediateInfo[kRefCount] === 0) {\n\n binding.toggleImmediateRef(false);\n }\n immediate[kRefed] = null;\n\n emitDestroy(immediate[async_id_symbol]);\n\n cleanImmediate(immediate);\n\n immediateQueue.remove(immediate);\n}\n\nImmediate.prototype[SymbolDispose] = function() {\n clearImmediate(this);\n};\n\nmodule.exports = timers = {\n setTimeout,\n clearTimeout,\n setImmediate,\n clearImmediate,\n setInterval,\n clearInterval,\n};\n\nObjectDefineProperties(timers, {\n promises: {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n timersPromises ??= require('timers/promises');\n return timersPromises;\n },\n },\n});\n","util.js":"// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nconst {\n ArrayIsArray,\n ArrayPrototypePop,\n ArrayPrototypePush,\n Error,\n ErrorCaptureStackTrace,\n FunctionPrototypeBind,\n NumberIsSafeInteger,\n ObjectDefineProperties,\n ObjectDefineProperty,\n ObjectGetOwnPropertyDescriptors,\n ObjectGetOwnPropertyNames,\n ObjectKeys,\n ObjectSetPrototypeOf,\n ObjectValues,\n ReflectApply,\n RegExpPrototypeExec,\n SafeMap,\n StringPrototypeSlice,\n StringPrototypeToWellFormed,\n} = primordials;\n\nconst {\n ErrnoException,\n ExceptionWithHostPort,\n codes: {\n ERR_FALSY_VALUE_REJECTION,\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_ARG_VALUE,\n ERR_OUT_OF_RANGE,\n },\n isErrorStackTraceLimitWritable,\n} = require('internal/errors');\nconst { Buffer } = require('buffer');\nconst {\n format,\n formatWithOptions,\n inspect,\n stripVTControlCharacters,\n} = require('internal/util/inspect');\nconst { debuglog } = require('internal/util/debuglog');\nconst {\n validateBoolean,\n validateFunction,\n validateNumber,\n validateString,\n validateOneOf,\n validateObject,\n validateInteger,\n} = require('internal/validators');\nconst {\n isReadableStream,\n isWritableStream,\n isNodeStream,\n} = require('internal/streams/utils');\nconst types = require('internal/util/types');\n\nlet utilColors;\nfunction lazyUtilColors() {\n utilColors ??= require('internal/util/colors');\n return utilColors;\n}\nconst { getOptionValue } = require('internal/options');\n\nconst binding = internalBinding('util');\n\nconst {\n convertProcessSignalToExitCode,\n deprecate: internalDeprecate,\n getLazy,\n getSystemErrorMap,\n getSystemErrorName: internalErrorName,\n getSystemErrorMessage: internalErrorMessage,\n promisify,\n defineLazyProperties,\n kEmptyObject,\n} = require('internal/util');\n\nlet abortController;\n\nfunction lazyAbortController() {\n abortController ??= require('internal/abort_controller');\n return abortController;\n}\n\nlet internalDeepEqual;\n\n\nconst kEscape = '\\u001b[';\nconst kEscapeEnd = 'm';\n\n\nconst kDimCode = 2;\nconst kBoldCode = 1;\n\n\nconst kHexCloseSeq = kEscape + '39' + kEscapeEnd;\n\nlet styleCache;\n\nconst kHexStyleCacheMax = 256;\n\nlet hexStyleCache;\n\nfunction getHexStyleCache() {\n hexStyleCache ??= new SafeMap();\n return hexStyleCache;\n}\n\nfunction codesToStyle(codes) {\n const openNum = codes[0];\n return {\n __proto__: null,\n openSeq: kEscape + openNum + kEscapeEnd,\n closeSeq: kEscape + codes[1] + kEscapeEnd,\n keepClose: openNum === kDimCode || openNum === kBoldCode,\n };\n}\n\nfunction getStyleCache() {\n if (styleCache === undefined) {\n styleCache = { __proto__: null };\n const colors = inspect.colors;\n for (const key of ObjectGetOwnPropertyNames(colors)) {\n const codes = colors[key];\n if (codes) {\n styleCache[key] = codesToStyle(codes);\n }\n }\n }\n return styleCache;\n}\n\n\n\n\n\n\n\nfunction getHexStyle(hex) {\n const cache = getHexStyleCache();\n const cached = cache.get(hex);\n if (cached !== undefined) return cached;\n const { 0: r, 1: g, 2: b } = hexToRgb(hex);\n const style = {\n __proto__: null,\n openSeq: kEscape + rgbToAnsi24Bit(r, g, b) + kEscapeEnd,\n closeSeq: kHexCloseSeq,\n };\n if (cache.size >= kHexStyleCacheMax)\n cache.delete(cache.keys().next().value);\n cache.set(hex, style);\n return style;\n}\n\nfunction replaceCloseCode(str, closeSeq, openSeq, keepClose) {\n const closeLen = closeSeq.length;\n let index = str.indexOf(closeSeq);\n if (index === -1) return str;\n\n let result = '';\n let lastIndex = 0;\n const replacement = keepClose ? closeSeq + openSeq : openSeq;\n\n do {\n const afterClose = index + closeLen;\n if (afterClose < str.length) {\n result += str.slice(lastIndex, index) + replacement;\n lastIndex = afterClose;\n } else {\n break;\n }\n index = str.indexOf(closeSeq, lastIndex);\n } while (index !== -1);\n\n return result + str.slice(lastIndex);\n}\n\n\nconst hexColorRegExp = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\n\n\n\n\n\n\n\nfunction hexToRgb(hex) {\n\n let hexStr;\n if (hex.length === 4) {\n\n hexStr = hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];\n } else if (hex.length === 7) {\n hexStr = StringPrototypeSlice(hex, 1);\n } else {\n throw new ERR_OUT_OF_RANGE('hex', '#RGB or #RRGGBB', hex);\n }\n\n\n return Buffer.from(hexStr, 'hex');\n}\n\n\n\n\n\n\n\n\nfunction rgbToAnsi24Bit(r, g, b) {\n return `38;2;${r};${g};${b}`;\n}\n\n\n\n\n\n\n\n\n\nfunction styleText(format, text, options) {\n const validateStream = options?.validateStream ?? true;\n\n\n if (!validateStream && typeof format === 'string' && typeof text === 'string') {\n const cache = getStyleCache();\n if (format === 'none') return text;\n const style = cache[format];\n if (style !== undefined) {\n const processed = replaceCloseCode(text, style.closeSeq, style.openSeq, style.keepClose);\n return style.openSeq + processed + style.closeSeq;\n }\n\n if (format[0] === '#') {\n let hexStyle = getHexStyleCache().get(format);\n if (hexStyle === undefined && RegExpPrototypeExec(hexColorRegExp, format) !== null) {\n hexStyle = getHexStyle(format);\n }\n if (hexStyle !== undefined) {\n const processed = replaceCloseCode(text, hexStyle.closeSeq, hexStyle.openSeq, false);\n return hexStyle.openSeq + processed + hexStyle.closeSeq;\n }\n }\n }\n\n validateString(text, 'text');\n if (options !== undefined) {\n validateObject(options, 'options');\n }\n validateBoolean(validateStream, 'options.validateStream');\n\n let skipColorize;\n if (validateStream) {\n const stream = options?.stream ?? process.stdout;\n if (\n !isReadableStream(stream) &&\n !isWritableStream(stream) &&\n !isNodeStream(stream)\n ) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream);\n }\n skipColorize = !lazyUtilColors().shouldColorize(stream);\n }\n\n const formatArray = ArrayIsArray(format) ? format : [format];\n const colors = inspect.colors;\n\n let openCodes = '';\n let closeCodes = '';\n let processedText = text;\n\n for (const key of formatArray) {\n if (key === 'none') continue;\n\n if (typeof key === 'string' && key[0] === '#') {\n if (RegExpPrototypeExec(hexColorRegExp, key) === null) {\n throw new ERR_INVALID_ARG_VALUE('format', key,\n 'must be a valid hex color (#RGB or #RRGGBB)');\n }\n if (skipColorize) continue;\n const { 0: r, 1: g, 2: b } = hexToRgb(key);\n const hexOpenSeq = kEscape + rgbToAnsi24Bit(r, g, b) + kEscapeEnd;\n openCodes += hexOpenSeq;\n closeCodes = kHexCloseSeq + closeCodes;\n processedText = replaceCloseCode(processedText, kHexCloseSeq, hexOpenSeq, false);\n continue;\n }\n\n const codes = colors[key];\n if (!codes) {\n validateOneOf(key, 'format', ObjectGetOwnPropertyNames(inspect.colors));\n }\n const { openSeq, closeSeq, keepClose } = codesToStyle(codes);\n openCodes += openSeq;\n closeCodes = closeSeq + closeCodes;\n processedText = replaceCloseCode(processedText, closeSeq, openSeq, keepClose);\n }\n\n if (skipColorize) return text;\n\n return `${openCodes}${processedText}${closeCodes}`;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction inherits(ctor, superCtor) {\n\n if (ctor === undefined || ctor === null)\n throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor);\n\n if (superCtor === undefined || superCtor === null)\n throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);\n\n if (superCtor.prototype === undefined) {\n throw new ERR_INVALID_ARG_TYPE('superCtor.prototype',\n 'Object', superCtor.prototype);\n }\n ObjectDefineProperty(ctor, 'super_', {\n __proto__: null,\n value: superCtor,\n writable: true,\n configurable: true,\n });\n ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);\n}\n\n\n\n\n\n\n\n\n\nfunction _extend(target, source) {\n\n if (source === null || typeof source !== 'object') return target;\n\n const keys = ObjectKeys(source);\n let i = keys.length;\n while (i--) {\n target[keys[i]] = source[keys[i]];\n }\n return target;\n}\n\nconst callbackifyOnRejected = (reason, cb) => {\n\n\n\n\n if (!reason) {\n reason = new ERR_FALSY_VALUE_REJECTION.HideStackFramesError(reason);\n ErrorCaptureStackTrace(reason, callbackifyOnRejected);\n }\n return cb(reason);\n};\n\n\n\n\n\n\nfunction callbackify(original) {\n validateFunction(original, 'original');\n\n\n\n\n function callbackified(...args) {\n const maybeCb = ArrayPrototypePop(args);\n validateFunction(maybeCb, 'last argument');\n const cb = FunctionPrototypeBind(maybeCb, this);\n\n\n ReflectApply(original, this, args)\n .then((ret) => process.nextTick(cb, null, ret),\n (rej) => process.nextTick(callbackifyOnRejected, rej, cb));\n }\n\n const descriptors = ObjectGetOwnPropertyDescriptors(original);\n\n\n if (typeof descriptors.length.value === 'number') {\n descriptors.length.value++;\n }\n if (typeof descriptors.name.value === 'string') {\n descriptors.name.value += 'Callbackified';\n }\n const propertiesValues = ObjectValues(descriptors);\n for (let i = 0; i < propertiesValues.length; i++) {\n\n\n ObjectSetPrototypeOf(propertiesValues[i], null);\n }\n ObjectDefineProperties(callbackified, descriptors);\n return callbackified;\n}\n\n\n\n\n\nfunction getSystemErrorMessage(err) {\n validateNumber(err, 'err');\n if (err >= 0 || !NumberIsSafeInteger(err)) {\n throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err);\n }\n return internalErrorMessage(err);\n}\n\n\n\n\n\nfunction getSystemErrorName(err) {\n validateNumber(err, 'err');\n if (err >= 0 || !NumberIsSafeInteger(err)) {\n throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err);\n }\n return internalErrorName(err);\n}\n\nfunction _errnoException(...args) {\n if (isErrorStackTraceLimitWritable()) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const e = new ErrnoException(...args);\n Error.stackTraceLimit = limit;\n ErrorCaptureStackTrace(e, _errnoException);\n return e;\n }\n return new ErrnoException(...args);\n}\n\nfunction _exceptionWithHostPort(...args) {\n if (isErrorStackTraceLimitWritable()) {\n const limit = Error.stackTraceLimit;\n Error.stackTraceLimit = 0;\n const e = new ExceptionWithHostPort(...args);\n Error.stackTraceLimit = limit;\n ErrorCaptureStackTrace(e, _exceptionWithHostPort);\n return e;\n }\n return new ExceptionWithHostPort(...args);\n}\n\n\n\n\n\n\nfunction parseEnv(content) {\n validateString(content, 'content');\n return binding.parseEnv(content);\n}\n\nconst lazySourceMap = getLazy(() => require('internal/source_map/source_map_cache'));\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction reconstructCallSite(callSite) {\n const { scriptName, lineNumber, columnNumber } = callSite;\n const sourceMap = lazySourceMap().findSourceMap(scriptName);\n if (!sourceMap) return;\n const entry = sourceMap.findEntry(lineNumber - 1, columnNumber - 1);\n if (!entry?.originalSource) return;\n return {\n __proto__: null,\n functionName: entry.name || callSite.functionName,\n scriptName: entry.originalSource,\n lineNumber: entry.originalLine + 1,\n column: entry.originalColumn + 1,\n columnNumber: entry.originalColumn + 1,\n };\n}\n\n\n\n\n\n\n\n\nfunction mapCallSite(callSites) {\n const result = [];\n for (let i = 0; i < callSites.length; ++i) {\n const callSite = callSites[i];\n const found = reconstructCallSite(callSite);\n ArrayPrototypePush(result, found ?? callSite);\n }\n return result;\n}\n\n\n\n\n\n\n\n\n\n\n\n\nfunction getCallSites(frameCount = 10, options) {\n\n if (options === undefined) {\n if (typeof frameCount === 'object') {\n\n options = frameCount;\n validateObject(options, 'options');\n if (options.sourceMap !== undefined) {\n validateBoolean(options.sourceMap, 'options.sourceMap');\n }\n frameCount = 10;\n } else {\n\n options = {};\n };\n } else {\n\n validateObject(options, 'options');\n if (options.sourceMap !== undefined) {\n validateBoolean(options.sourceMap, 'options.sourceMap');\n }\n }\n\n\n validateInteger(frameCount, 'frameCount', 1, 200);\n\n if (options.sourceMap === true || (getOptionValue('--enable-source-maps') && options.sourceMap !== false)) {\n return mapCallSite(binding.getCallSites(frameCount));\n }\n return binding.getCallSites(frameCount);\n};\n\n\nfunction deprecate(fn, msg, code, { modifyPrototype } = kEmptyObject) {\n return internalDeprecate(fn, msg, code, undefined, modifyPrototype);\n}\n\n\nmodule.exports = {\n _errnoException,\n _exceptionWithHostPort,\n _extend: internalDeprecate(_extend,\n 'The `util._extend` API is deprecated. Please use Object.assign() instead.',\n 'DEP0060'),\n callbackify,\n convertProcessSignalToExitCode,\n debug: debuglog,\n debuglog,\n deprecate,\n format,\n styleText,\n formatWithOptions,\n getCallSites,\n getSystemErrorMap,\n getSystemErrorName,\n getSystemErrorMessage,\n inherits,\n inspect,\n isArray: internalDeprecate(ArrayIsArray,\n 'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.',\n 'DEP0044'),\n isDeepStrictEqual(a, b, skipPrototype) {\n if (internalDeepEqual === undefined) {\n internalDeepEqual = require('internal/util/comparisons').isDeepStrictEqual;\n }\n return internalDeepEqual(a, b, skipPrototype);\n },\n promisify,\n stripVTControlCharacters,\n toUSVString(input) {\n return StringPrototypeToWellFormed(`${input}`);\n },\n get transferableAbortSignal() {\n return lazyAbortController().transferableAbortSignal;\n },\n get transferableAbortController() {\n return lazyAbortController().transferableAbortController;\n },\n get aborted() {\n return lazyAbortController().aborted;\n },\n types,\n parseEnv,\n};\n\ndefineLazyProperties(\n module.exports,\n 'internal/util/parse_args/parse_args',\n ['parseArgs'],\n);\n\ndefineLazyProperties(\n module.exports,\n 'internal/encoding',\n ['TextDecoder', 'TextEncoder'],\n);\n\ndefineLazyProperties(\n module.exports,\n 'internal/mime',\n ['MIMEType', 'MIMEParams'],\n);\n\ndefineLazyProperties(\n module.exports,\n 'internal/util/diff',\n ['diff'],\n);\n\ndefineLazyProperties(\n module.exports,\n 'internal/util/trace_sigint',\n ['setTraceSigInt'],\n);\n","util/types.js":"'use strict';\n\nmodule.exports = require('internal/util/types');\n"}