UNPKG

auth0-js

Version:

Auth0 headless browser sdk

1,593 lines (1,356 loc) 412 kB
/** * auth0-js v10.2.0 * Author: Auth0 * Date: 2026-06-25 * License: MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.auth0 = {})); })(this, (function (exports) { 'use strict'; var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function getAugmentedNamespace(n) { if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n; var f = n.default; if (typeof f == "function") { var a = function a () { var isInstance = false; try { isInstance = this instanceof a; } catch (e) {} if (isInstance) { return Reflect.construct(f, arguments, this.constructor); } return f.apply(this, arguments); }; a.prototype = f.prototype; } else a = {}; Object.defineProperty(a, '__esModule', {value: true}); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function () { return n[k]; } }); }); return a; } var urlJoin$1 = {exports: {}}; var urlJoin = urlJoin$1.exports; var hasRequiredUrlJoin; function requireUrlJoin () { if (hasRequiredUrlJoin) return urlJoin$1.exports; hasRequiredUrlJoin = 1; (function (module) { (function (name, context, definition) { if (module.exports) module.exports = definition(); else context[name] = definition(); })('urljoin', urlJoin, function () { function normalize (strArray) { var resultArray = []; if (strArray.length === 0) { return ''; } if (typeof strArray[0] !== 'string') { throw new TypeError('Url must be a string. Received ' + strArray[0]); } // If the first part is a plain protocol, we combine it with the next part. if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) { var first = strArray.shift(); strArray[0] = first + strArray[0]; } // There must be two or three slashes in the file protocol, two slashes in anything else. if (strArray[0].match(/^file:\/\/\//)) { strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1:///'); } else { strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, '$1://'); } for (var i = 0; i < strArray.length; i++) { var component = strArray[i]; if (typeof component !== 'string') { throw new TypeError('Url must be a string. Received ' + component); } if (component === '') { continue; } if (i > 0) { // Removing the starting slashes for each component but the first. component = component.replace(/^[\/]+/, ''); } if (i < strArray.length - 1) { // Removing the ending slashes for each component but the last. component = component.replace(/[\/]+$/, ''); } else { // For the last component we will combine multiple slashes to a single one. component = component.replace(/[\/]+$/, '/'); } resultArray.push(component); } var str = resultArray.join('/'); // Each input component is now separated by a single slash except the possible first plain protocol part. // remove trailing slash before parameters or hash str = str.replace(/\/(\?|&|#[^!])/g, '$1'); // replace ? in parameters with & var parts = str.split('?'); str = parts.shift() + (parts.length > 0 ? '?': '') + parts.join('&'); return str; } return function () { var input; if (typeof arguments[0] === 'object') { input = arguments[0]; } else { input = [].slice.call(arguments); } return normalize(input); }; }); } (urlJoin$1)); return urlJoin$1.exports; } var urlJoinExports = requireUrlJoin(); var urljoin = /*@__PURE__*/getDefaultExportFromCjs(urlJoinExports); var type; var hasRequiredType; function requireType () { if (hasRequiredType) return type; hasRequiredType = 1; /** @type {import('./type')} */ type = TypeError; return type; } var _nodeResolve_empty = {}; var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({ __proto__: null, default: _nodeResolve_empty }); var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1); var objectInspect; var hasRequiredObjectInspect; function requireObjectInspect () { if (hasRequiredObjectInspect) return objectInspect; hasRequiredObjectInspect = 1; var hasMap = typeof Map === 'function' && Map.prototype; var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; var mapForEach = hasMap && Map.prototype.forEach; var hasSet = typeof Set === 'function' && Set.prototype; var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; var setForEach = hasSet && Set.prototype.forEach; var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; var booleanValueOf = Boolean.prototype.valueOf; var objectToString = Object.prototype.toString; var functionToString = Function.prototype.toString; var $match = String.prototype.match; var $slice = String.prototype.slice; var $replace = String.prototype.replace; var $toUpperCase = String.prototype.toUpperCase; var $toLowerCase = String.prototype.toLowerCase; var $test = RegExp.prototype.test; var $concat = Array.prototype.concat; var $join = Array.prototype.join; var $arrSlice = Array.prototype.slice; var $floor = Math.floor; var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; var gOPS = Object.getOwnPropertySymbols; var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; // ie, `has-tostringtag/shams var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null; var isEnumerable = Object.prototype.propertyIsEnumerable; var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ( [].__proto__ === Array.prototype // eslint-disable-line no-proto ? function (O) { return O.__proto__; // eslint-disable-line no-proto } : null ); function addNumericSeparator(num, str) { if ( num === Infinity || num === -Infinity || num !== num || (num && num > -1e3 && num < 1000) || $test.call(/e/, str) ) { return str; } var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; if (typeof num === 'number') { var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) if (int !== num) { var intStr = String(int); var dec = $slice.call(str, intStr.length + 1); return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); } } return $replace.call(str, sepRegex, '$&_'); } var utilInspect = require$$0; var inspectCustom = utilInspect.custom; var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; var quotes = { __proto__: null, 'double': '"', single: "'" }; var quoteREs = { __proto__: null, 'double': /(["\\])/g, single: /(['\\])/g }; objectInspect = function inspect_(obj, options, depth, seen) { var opts = options || {}; if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) { throw new TypeError('option "quoteStyle" must be "single" or "double"'); } if ( has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null ) ) { throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); } var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); } if ( has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0) ) { throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); } if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); } var numericSeparator = opts.numericSeparator; if (typeof obj === 'undefined') { return 'undefined'; } if (obj === null) { return 'null'; } if (typeof obj === 'boolean') { return obj ? 'true' : 'false'; } if (typeof obj === 'string') { return inspectString(obj, opts); } if (typeof obj === 'number') { if (obj === 0) { return Infinity / obj > 0 ? '0' : '-0'; } var str = String(obj); return numericSeparator ? addNumericSeparator(obj, str) : str; } if (typeof obj === 'bigint') { var bigIntStr = String(obj) + 'n'; return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; } var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; if (typeof depth === 'undefined') { depth = 0; } if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { return isArray(obj) ? '[Array]' : '[Object]'; } var indent = getIndent(opts, depth); if (typeof seen === 'undefined') { seen = []; } else if (indexOf(seen, obj) >= 0) { return '[Circular]'; } function inspect(value, from, noIndent) { if (from) { seen = $arrSlice.call(seen); seen.push(from); } if (noIndent) { var newOpts = { depth: opts.depth }; if (has(opts, 'quoteStyle')) { newOpts.quoteStyle = opts.quoteStyle; } return inspect_(value, newOpts, depth + 1, seen); } return inspect_(value, opts, depth + 1, seen); } if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable var name = nameOf(obj); var keys = arrObjKeys(obj, inspect); return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); } if (isSymbol(obj)) { var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; } if (isElement(obj)) { var s = '<' + $toLowerCase.call(String(obj.nodeName)); var attrs = obj.attributes || []; for (var i = 0; i < attrs.length; i++) { s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); } s += '>'; if (obj.childNodes && obj.childNodes.length) { s += '...'; } s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>'; return s; } if (isArray(obj)) { if (obj.length === 0) { return '[]'; } var xs = arrObjKeys(obj, inspect); if (indent && !singleLineValues(xs)) { return '[' + indentedJoin(xs, indent) + ']'; } return '[ ' + $join.call(xs, ', ') + ' ]'; } if (isError(obj)) { var parts = arrObjKeys(obj, inspect); if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) { return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; } if (parts.length === 0) { return '[' + String(obj) + ']'; } return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; } if (typeof obj === 'object' && customInspect) { if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) { return utilInspect(obj, { depth: maxDepth - depth }); } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { return obj.inspect(); } } if (isMap(obj)) { var mapParts = []; if (mapForEach) { mapForEach.call(obj, function (value, key) { mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); }); } return collectionOf('Map', mapSize.call(obj), mapParts, indent); } if (isSet(obj)) { var setParts = []; if (setForEach) { setForEach.call(obj, function (value) { setParts.push(inspect(value, obj)); }); } return collectionOf('Set', setSize.call(obj), setParts, indent); } if (isWeakMap(obj)) { return weakCollectionOf('WeakMap'); } if (isWeakSet(obj)) { return weakCollectionOf('WeakSet'); } if (isWeakRef(obj)) { return weakCollectionOf('WeakRef'); } if (isNumber(obj)) { return markBoxed(inspect(Number(obj))); } if (isBigInt(obj)) { return markBoxed(inspect(bigIntValueOf.call(obj))); } if (isBoolean(obj)) { return markBoxed(booleanValueOf.call(obj)); } if (isString(obj)) { return markBoxed(inspect(String(obj))); } // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other /* eslint-env browser */ if (typeof window !== 'undefined' && obj === window) { return '{ [object Window] }'; } if ( (typeof globalThis !== 'undefined' && obj === globalThis) || (typeof commonjsGlobal !== 'undefined' && obj === commonjsGlobal) ) { return '{ [object globalThis] }'; } if (!isDate(obj) && !isRegExp(obj)) { var ys = arrObjKeys(obj, inspect); var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; var protoTag = obj instanceof Object ? '' : 'null prototype'; var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); if (ys.length === 0) { return tag + '{}'; } if (indent) { return tag + '{' + indentedJoin(ys, indent) + '}'; } return tag + '{ ' + $join.call(ys, ', ') + ' }'; } return String(obj); }; function wrapQuotes(s, defaultStyle, opts) { var style = opts.quoteStyle || defaultStyle; var quoteChar = quotes[style]; return quoteChar + s + quoteChar; } function quote(s) { return $replace.call(String(s), /"/g, '&quot;'); } function canTrustToString(obj) { return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined')); } function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); } function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); } function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); } function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); } function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); } function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); } function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); } // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives function isSymbol(obj) { if (hasShammedSymbols) { return obj && typeof obj === 'object' && obj instanceof Symbol; } if (typeof obj === 'symbol') { return true; } if (!obj || typeof obj !== 'object' || !symToString) { return false; } try { symToString.call(obj); return true; } catch (e) {} return false; } function isBigInt(obj) { if (!obj || typeof obj !== 'object' || !bigIntValueOf) { return false; } try { bigIntValueOf.call(obj); return true; } catch (e) {} return false; } var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; function has(obj, key) { return hasOwn.call(obj, key); } function toStr(obj) { return objectToString.call(obj); } function nameOf(f) { if (f.name) { return f.name; } var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); if (m) { return m[1]; } return null; } function indexOf(xs, x) { if (xs.indexOf) { return xs.indexOf(x); } for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) { return i; } } return -1; } function isMap(x) { if (!mapSize || !x || typeof x !== 'object') { return false; } try { mapSize.call(x); try { setSize.call(x); } catch (s) { return true; } return x instanceof Map; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakMap(x) { if (!weakMapHas || !x || typeof x !== 'object') { return false; } try { weakMapHas.call(x, weakMapHas); try { weakSetHas.call(x, weakSetHas); } catch (s) { return true; } return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakRef(x) { if (!weakRefDeref || !x || typeof x !== 'object') { return false; } try { weakRefDeref.call(x); return true; } catch (e) {} return false; } function isSet(x) { if (!setSize || !x || typeof x !== 'object') { return false; } try { setSize.call(x); try { mapSize.call(x); } catch (m) { return true; } return x instanceof Set; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isWeakSet(x) { if (!weakSetHas || !x || typeof x !== 'object') { return false; } try { weakSetHas.call(x, weakSetHas); try { weakMapHas.call(x, weakMapHas); } catch (s) { return true; } return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isElement(x) { if (!x || typeof x !== 'object') { return false; } if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { return true; } return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; } function inspectString(str, opts) { if (str.length > opts.maxStringLength) { var remaining = str.length - opts.maxStringLength; var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; } var quoteRE = quoteREs[opts.quoteStyle || 'single']; quoteRE.lastIndex = 0; // eslint-disable-next-line no-control-regex var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte); return wrapQuotes(s, 'single', opts); } function lowbyte(c) { var n = c.charCodeAt(0); var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; if (x) { return '\\' + x; } return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); } function markBoxed(str) { return 'Object(' + str + ')'; } function weakCollectionOf(type) { return type + ' { ? }'; } function collectionOf(type, size, entries, indent) { var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); return type + ' (' + size + ') {' + joinedEntries + '}'; } function singleLineValues(xs) { for (var i = 0; i < xs.length; i++) { if (indexOf(xs[i], '\n') >= 0) { return false; } } return true; } function getIndent(opts, depth) { var baseIndent; if (opts.indent === '\t') { baseIndent = '\t'; } else if (typeof opts.indent === 'number' && opts.indent > 0) { baseIndent = $join.call(Array(opts.indent + 1), ' '); } else { return null; } return { base: baseIndent, prev: $join.call(Array(depth + 1), baseIndent) }; } function indentedJoin(xs, indent) { if (xs.length === 0) { return ''; } var lineJoiner = '\n' + indent.prev + indent.base; return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; } function arrObjKeys(obj, inspect) { var isArr = isArray(obj); var xs = []; if (isArr) { xs.length = obj.length; for (var i = 0; i < obj.length; i++) { xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; } } var syms = typeof gOPS === 'function' ? gOPS(obj) : []; var symMap; if (hasShammedSymbols) { symMap = {}; for (var k = 0; k < syms.length; k++) { symMap['$' + syms[k]] = syms[k]; } } for (var key in obj) { // eslint-disable-line no-restricted-syntax if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section continue; // eslint-disable-line no-restricted-syntax, no-continue } else if ($test.call(/[^\w$]/, key)) { xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); } else { xs.push(key + ': ' + inspect(obj[key], obj)); } } if (typeof gOPS === 'function') { for (var j = 0; j < syms.length; j++) { if (isEnumerable.call(obj, syms[j])) { xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); } } } return xs; } return objectInspect; } var sideChannelList; var hasRequiredSideChannelList; function requireSideChannelList () { if (hasRequiredSideChannelList) return sideChannelList; hasRequiredSideChannelList = 1; var inspect = /*@__PURE__*/ requireObjectInspect(); var $TypeError = /*@__PURE__*/ requireType(); /* * This function traverses the list returning the node corresponding to the given key. * * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. * By doing so, all the recently used nodes can be accessed relatively quickly. */ /** @type {import('./list.d.ts').listGetNode} */ // eslint-disable-next-line consistent-return var listGetNode = function (list, key, isDelete) { /** @type {typeof list | NonNullable<(typeof list)['next']>} */ var prev = list; /** @type {(typeof list)['next']} */ var curr; // eslint-disable-next-line eqeqeq for (; (curr = prev.next) != null; prev = curr) { if (curr.key === key) { prev.next = curr.next; if (!isDelete) { // eslint-disable-next-line no-extra-parens curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next); list.next = curr; // eslint-disable-line no-param-reassign } return curr; } } }; /** @type {import('./list.d.ts').listGet} */ var listGet = function (objects, key) { if (!objects) { return void undefined; } var node = listGetNode(objects, key); return node && node.value; }; /** @type {import('./list.d.ts').listSet} */ var listSet = function (objects, key, value) { var node = listGetNode(objects, key); if (node) { node.value = value; } else { // Prepend the new node to the beginning of the list objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens key: key, next: objects.next, value: value }); } }; /** @type {import('./list.d.ts').listHas} */ var listHas = function (objects, key) { if (!objects) { return false; } return !!listGetNode(objects, key); }; /** @type {import('./list.d.ts').listDelete} */ // eslint-disable-next-line consistent-return var listDelete = function (objects, key) { if (objects) { return listGetNode(objects, key, true); } }; /** @type {import('.')} */ sideChannelList = function getSideChannelList() { /** @typedef {ReturnType<typeof getSideChannelList>} Channel */ /** @typedef {Parameters<Channel['get']>[0]} K */ /** @typedef {Parameters<Channel['set']>[1]} V */ /** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o; /** @type {Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { throw new $TypeError('Side channel does not contain ' + inspect(key)); } }, 'delete': function (key) { var root = $o && $o.next; var deletedNode = listDelete($o, key); if (deletedNode && root && root === deletedNode) { $o = void undefined; } return !!deletedNode; }, get: function (key) { return listGet($o, key); }, has: function (key) { return listHas($o, key); }, set: function (key, value) { if (!$o) { // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head $o = { next: void undefined }; } // eslint-disable-next-line no-extra-parens listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value); } }; // @ts-expect-error TODO: figure out why this is erroring return channel; }; return sideChannelList; } var esObjectAtoms; var hasRequiredEsObjectAtoms; function requireEsObjectAtoms () { if (hasRequiredEsObjectAtoms) return esObjectAtoms; hasRequiredEsObjectAtoms = 1; /** @type {import('.')} */ esObjectAtoms = Object; return esObjectAtoms; } var esErrors; var hasRequiredEsErrors; function requireEsErrors () { if (hasRequiredEsErrors) return esErrors; hasRequiredEsErrors = 1; /** @type {import('.')} */ esErrors = Error; return esErrors; } var _eval; var hasRequired_eval; function require_eval () { if (hasRequired_eval) return _eval; hasRequired_eval = 1; /** @type {import('./eval')} */ _eval = EvalError; return _eval; } var range; var hasRequiredRange; function requireRange () { if (hasRequiredRange) return range; hasRequiredRange = 1; /** @type {import('./range')} */ range = RangeError; return range; } var ref; var hasRequiredRef; function requireRef () { if (hasRequiredRef) return ref; hasRequiredRef = 1; /** @type {import('./ref')} */ ref = ReferenceError; return ref; } var syntax; var hasRequiredSyntax; function requireSyntax () { if (hasRequiredSyntax) return syntax; hasRequiredSyntax = 1; /** @type {import('./syntax')} */ syntax = SyntaxError; return syntax; } var uri; var hasRequiredUri; function requireUri () { if (hasRequiredUri) return uri; hasRequiredUri = 1; /** @type {import('./uri')} */ uri = URIError; return uri; } var abs; var hasRequiredAbs; function requireAbs () { if (hasRequiredAbs) return abs; hasRequiredAbs = 1; /** @type {import('./abs')} */ abs = Math.abs; return abs; } var floor; var hasRequiredFloor; function requireFloor () { if (hasRequiredFloor) return floor; hasRequiredFloor = 1; /** @type {import('./floor')} */ floor = Math.floor; return floor; } var max; var hasRequiredMax; function requireMax () { if (hasRequiredMax) return max; hasRequiredMax = 1; /** @type {import('./max')} */ max = Math.max; return max; } var min; var hasRequiredMin; function requireMin () { if (hasRequiredMin) return min; hasRequiredMin = 1; /** @type {import('./min')} */ min = Math.min; return min; } var pow; var hasRequiredPow; function requirePow () { if (hasRequiredPow) return pow; hasRequiredPow = 1; /** @type {import('./pow')} */ pow = Math.pow; return pow; } var round; var hasRequiredRound; function requireRound () { if (hasRequiredRound) return round; hasRequiredRound = 1; /** @type {import('./round')} */ round = Math.round; return round; } var _isNaN; var hasRequired_isNaN; function require_isNaN () { if (hasRequired_isNaN) return _isNaN; hasRequired_isNaN = 1; /** @type {import('./isNaN')} */ _isNaN = Number.isNaN || function isNaN(a) { return a !== a; }; return _isNaN; } var sign; var hasRequiredSign; function requireSign () { if (hasRequiredSign) return sign; hasRequiredSign = 1; var $isNaN = /*@__PURE__*/ require_isNaN(); /** @type {import('./sign')} */ sign = function sign(number) { if ($isNaN(number) || number === 0) { return number; } return number < 0 ? -1 : 1; }; return sign; } var gOPD; var hasRequiredGOPD; function requireGOPD () { if (hasRequiredGOPD) return gOPD; hasRequiredGOPD = 1; /** @type {import('./gOPD')} */ gOPD = Object.getOwnPropertyDescriptor; return gOPD; } var gopd; var hasRequiredGopd; function requireGopd () { if (hasRequiredGopd) return gopd; hasRequiredGopd = 1; /** @type {import('.')} */ var $gOPD = /*@__PURE__*/ requireGOPD(); if ($gOPD) { try { $gOPD([], 'length'); } catch (e) { // IE 8 has a broken gOPD $gOPD = null; } } gopd = $gOPD; return gopd; } var esDefineProperty; var hasRequiredEsDefineProperty; function requireEsDefineProperty () { if (hasRequiredEsDefineProperty) return esDefineProperty; hasRequiredEsDefineProperty = 1; /** @type {import('.')} */ var $defineProperty = Object.defineProperty || false; if ($defineProperty) { try { $defineProperty({}, 'a', { value: 1 }); } catch (e) { // IE 8 has a broken defineProperty $defineProperty = false; } } esDefineProperty = $defineProperty; return esDefineProperty; } var shams; var hasRequiredShams; function requireShams () { if (hasRequiredShams) return shams; hasRequiredShams = 1; /** @type {import('./shams')} */ /* eslint complexity: [2, 18], max-statements: [2, 33] */ shams = function hasSymbols() { if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } if (typeof Symbol.iterator === 'symbol') { return true; } /** @type {{ [k in symbol]?: unknown }} */ var obj = {}; var sym = Symbol('test'); var symObj = Object(sym); if (typeof sym === 'string') { return false; } if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } // temp disabled per https://github.com/ljharb/object.assign/issues/17 // if (sym instanceof Symbol) { return false; } // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 // if (!(symObj instanceof Symbol)) { return false; } // if (typeof Symbol.prototype.toString !== 'function') { return false; } // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } var symVal = 42; obj[sym] = symVal; for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } var syms = Object.getOwnPropertySymbols(obj); if (syms.length !== 1 || syms[0] !== sym) { return false; } if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } if (typeof Object.getOwnPropertyDescriptor === 'function') { // eslint-disable-next-line no-extra-parens var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } } return true; }; return shams; } var hasSymbols; var hasRequiredHasSymbols; function requireHasSymbols () { if (hasRequiredHasSymbols) return hasSymbols; hasRequiredHasSymbols = 1; var origSymbol = typeof Symbol !== 'undefined' && Symbol; var hasSymbolSham = requireShams(); /** @type {import('.')} */ hasSymbols = function hasNativeSymbols() { if (typeof origSymbol !== 'function') { return false; } if (typeof Symbol !== 'function') { return false; } if (typeof origSymbol('foo') !== 'symbol') { return false; } if (typeof Symbol('bar') !== 'symbol') { return false; } return hasSymbolSham(); }; return hasSymbols; } var Reflect_getPrototypeOf; var hasRequiredReflect_getPrototypeOf; function requireReflect_getPrototypeOf () { if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf; hasRequiredReflect_getPrototypeOf = 1; /** @type {import('./Reflect.getPrototypeOf')} */ Reflect_getPrototypeOf = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null; return Reflect_getPrototypeOf; } var Object_getPrototypeOf; var hasRequiredObject_getPrototypeOf; function requireObject_getPrototypeOf () { if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf; hasRequiredObject_getPrototypeOf = 1; var $Object = /*@__PURE__*/ requireEsObjectAtoms(); /** @type {import('./Object.getPrototypeOf')} */ Object_getPrototypeOf = $Object.getPrototypeOf || null; return Object_getPrototypeOf; } var implementation; var hasRequiredImplementation; function requireImplementation () { if (hasRequiredImplementation) return implementation; hasRequiredImplementation = 1; /* eslint no-invalid-this: 1 */ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; var toStr = Object.prototype.toString; var max = Math.max; var funcType = '[object Function]'; var concatty = function concatty(a, b) { var arr = []; for (var i = 0; i < a.length; i += 1) { arr[i] = a[i]; } for (var j = 0; j < b.length; j += 1) { arr[j + a.length] = b[j]; } return arr; }; var slicy = function slicy(arrLike, offset) { var arr = []; for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) { arr[j] = arrLike[i]; } return arr; }; var joiny = function (arr, joiner) { var str = ''; for (var i = 0; i < arr.length; i += 1) { str += arr[i]; if (i + 1 < arr.length) { str += joiner; } } return str; }; implementation = function bind(that) { var target = this; if (typeof target !== 'function' || toStr.apply(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } var args = slicy(arguments, 1); var bound; var binder = function () { if (this instanceof bound) { var result = target.apply( this, concatty(args, arguments) ); if (Object(result) === result) { return result; } return this; } return target.apply( that, concatty(args, arguments) ); }; var boundLength = max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs[i] = '$' + i; } bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); if (target.prototype) { var Empty = function Empty() {}; Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; return implementation; } var functionBind; var hasRequiredFunctionBind; function requireFunctionBind () { if (hasRequiredFunctionBind) return functionBind; hasRequiredFunctionBind = 1; var implementation = requireImplementation(); functionBind = Function.prototype.bind || implementation; return functionBind; } var functionCall; var hasRequiredFunctionCall; function requireFunctionCall () { if (hasRequiredFunctionCall) return functionCall; hasRequiredFunctionCall = 1; /** @type {import('./functionCall')} */ functionCall = Function.prototype.call; return functionCall; } var functionApply; var hasRequiredFunctionApply; function requireFunctionApply () { if (hasRequiredFunctionApply) return functionApply; hasRequiredFunctionApply = 1; /** @type {import('./functionApply')} */ functionApply = Function.prototype.apply; return functionApply; } var reflectApply; var hasRequiredReflectApply; function requireReflectApply () { if (hasRequiredReflectApply) return reflectApply; hasRequiredReflectApply = 1; /** @type {import('./reflectApply')} */ reflectApply = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; return reflectApply; } var actualApply; var hasRequiredActualApply; function requireActualApply () { if (hasRequiredActualApply) return actualApply; hasRequiredActualApply = 1; var bind = requireFunctionBind(); var $apply = requireFunctionApply(); var $call = requireFunctionCall(); var $reflectApply = requireReflectApply(); /** @type {import('./actualApply')} */ actualApply = $reflectApply || bind.call($call, $apply); return actualApply; } var callBindApplyHelpers; var hasRequiredCallBindApplyHelpers; function requireCallBindApplyHelpers () { if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers; hasRequiredCallBindApplyHelpers = 1; var bind = requireFunctionBind(); var $TypeError = /*@__PURE__*/ requireType(); var $call = requireFunctionCall(); var $actualApply = requireActualApply(); /** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ callBindApplyHelpers = function callBindBasic(args) { if (args.length < 1 || typeof args[0] !== 'function') { throw new $TypeError('a function is required'); } return $actualApply(bind, $call, args); }; return callBindApplyHelpers; } var get$1; var hasRequiredGet; function requireGet () { if (hasRequiredGet) return get$1; hasRequiredGet = 1; var callBind = requireCallBindApplyHelpers(); var gOPD = /*@__PURE__*/ requireGopd(); var hasProtoAccessor; try { // eslint-disable-next-line no-extra-parens, no-proto hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype; } catch (e) { if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') { throw e; } } // eslint-disable-next-line no-extra-parens var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__')); var $Object = Object; var $getPrototypeOf = $Object.getPrototypeOf; /** @type {import('./get')} */ get$1 = desc && typeof desc.get === 'function' ? callBind([desc.get]) : typeof $getPrototypeOf === 'function' ? /** @type {import('./get')} */ function getDunder(value) { // eslint-disable-next-line eqeqeq return $getPrototypeOf(value == null ? value : $Object(value)); } : false; return get$1; } var getProto; var hasRequiredGetProto; function requireGetProto () { if (hasRequiredGetProto) return getProto; hasRequiredGetProto = 1; var reflectGetProto = requireReflect_getPrototypeOf(); var originalGetProto = requireObject_getPrototypeOf(); var getDunderProto = /*@__PURE__*/ requireGet(); /** @type {import('.')} */ getProto = reflectGetProto ? function getProto(O) { // @ts-expect-error TS can't narrow inside a closure, for some reason return reflectGetProto(O); } : originalGetProto ? function getProto(O) { if (!O || (typeof O !== 'object' && typeof O !== 'function')) { throw new TypeError('getProto: not an object'); } // @ts-expect-error TS can't narrow inside a closure, for some reason return originalGetProto(O); } : getDunderProto ? function getProto(O) { // @ts-expect-error TS can't narrow inside a closure, for some reason return getDunderProto(O); } : null; return getProto; } var hasown; var hasRequiredHasown; function requireHasown () { if (hasRequiredHasown) return hasown; hasRequiredHasown = 1; var call = Function.prototype.call; var $hasOwn = Object.prototype.hasOwnProperty; var bind = requireFunctionBind(); /** @type {import('.')} */ hasown = bind.call(call, $hasOwn); return hasown; } var getIntrinsic; var hasRequiredGetIntrinsic; function requireGetIntrinsic () { if (hasRequiredGetIntrinsic) return getIntrinsic; hasRequiredGetIntrinsic = 1; var undefined$1; var $Object = /*@__PURE__*/ requireEsObjectAtoms(); var $Error = /*@__PURE__*/ requireEsErrors(); var $EvalError = /*@__PURE__*/ require_eval(); var $RangeError = /*@__PURE__*/ requireRange(); var $ReferenceError = /*@__PURE__*/ requireRef(); var $SyntaxError = /*@__PURE__*/ requireSyntax(); var $TypeError = /*@__PURE__*/ requireType(); var $URIError = /*@__PURE__*/ requireUri(); var abs = /*@__PURE__*/ requireAbs(); var floor = /*@__PURE__*/ requireFloor(); var max = /*@__PURE__*/ requireMax(); var min = /*@__PURE__*/ requireMin(); var pow = /*@__PURE__*/ requirePow(); var round = /*@__PURE__*/ requireRound(); var sign = /*@__PURE__*/ requireSign(); var $Function = Function; // eslint-disable-next-line consistent-return var getEvalledConstructor = function (expressionSyntax) { try { return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); } catch (e) {} }; var $gOPD = /*@__PURE__*/ requireGopd(); var $defineProperty = /*@__PURE__*/ requireEsDefineProperty(); var throwTypeError = function () { throw new $TypeError(); }; var ThrowTypeError = $gOPD ? (function () { try { // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties arguments.callee; // IE 8 does not throw here return throwTypeError; } catch (calleeThrows) { try { // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') return $gOPD(arguments, 'callee').get; } catch (gOPDthrows) { return throwTypeError; } } }()) : throwTypeError; var hasSymbols = requireHasSymbols()(); var getProto = requireGetProto(); var $ObjectGPO = requireObject_getPrototypeOf(); var $ReflectGPO = requireReflect_getPrototypeOf(); var $apply = requireFunctionApply(); var $call = requireFunctionCall(); var needsEval = {}; var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array); var INTRINSICS = { __proto__: null, '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer, '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1, '%AsyncFromSyncIteratorPrototype%': undefined$1, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, '%AsyncGeneratorFunction%': needsEval, '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt, '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array, '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView, '%Date%': Date, '%decodeURI%': decodeURI, '%decodeURIComponent%': decodeURIComponent, '%encodeURI%': encodeURI, '%encodeURIComponent%': encodeURIComponent, '%Error%': $Error, '%eval%': eval, // eslint-disable-line no-eval '%EvalError%': $EvalError, '%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array, '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array, '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array, '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry, '%Function%': $Function, '%GeneratorFunction%': needsEval, '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array, '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array, '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1, '%JSON%': typeof JSON === 'object' ? JSON : undefined$1, '%Map%': typeof Map === 'undefined' ? undefined$1 : Map, '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': $Object, '%Object.getOwnPropertyDescriptor%': $gOPD, '%parseFloat%': parseFloat, '%parseInt%': parseInt, '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise, '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy, '%RangeError%': $RangeError, '%ReferenceError%': $ReferenceError, '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined$1 : Set, '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer, '%String%': String, '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1, '%Symbol%': hasSymbols ? Symbol : undefined$1, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, '%TypedArray%': TypedArray, '%TypeError%': $TypeError, '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array, '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray, '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array, '%Uint32Array%': t