/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @lightSyntaxTransform * @noflow * @nolint * @preventMunge * @preserve-invariant-messages */ "use no memo"; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var t$d = require("@babel/types"); var require$$0$3 = require("tty"); var require$$1$1 = require("util"); var require$$0$4 = require("os"); var require$$0$6 = require("path"); var require$$0$5 = require("fs"); var require$$0$7 = require("buffer"); var crypto$2 = require("crypto"); function _interopNamespaceDefault(e) { var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== "default") { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty( n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; }, }, ); } }); } n.default = e; return Object.freeze(n); } var t__namespace = _interopNamespaceDefault(t$d); 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 (n.__esModule) return n; var f = n.default; if (typeof f == "function") { var a = function a() { if (this instanceof a) { 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 lib$t = {}; var file = {}; var lib$s = {}; var lib$r = {}; var visitors$1 = {}; var virtualTypes$1 = {}; var hasRequiredVirtualTypes$1; function requireVirtualTypes$1() { if (hasRequiredVirtualTypes$1) return virtualTypes$1; hasRequiredVirtualTypes$1 = 1; Object.defineProperty(virtualTypes$1, "__esModule", { value: true }); virtualTypes$1.Var = virtualTypes$1.User = virtualTypes$1.Statement = virtualTypes$1.SpreadProperty = virtualTypes$1.Scope = virtualTypes$1.RestProperty = virtualTypes$1.ReferencedMemberExpression = virtualTypes$1.ReferencedIdentifier = virtualTypes$1.Referenced = virtualTypes$1.Pure = virtualTypes$1.NumericLiteralTypeAnnotation = virtualTypes$1.Generated = virtualTypes$1.ForAwaitStatement = virtualTypes$1.Flow = virtualTypes$1.Expression = virtualTypes$1.ExistentialTypeParam = virtualTypes$1.BlockScoped = virtualTypes$1.BindingIdentifier = void 0; virtualTypes$1.ReferencedIdentifier = ["Identifier", "JSXIdentifier"]; virtualTypes$1.ReferencedMemberExpression = ["MemberExpression"]; virtualTypes$1.BindingIdentifier = ["Identifier"]; virtualTypes$1.Statement = ["Statement"]; virtualTypes$1.Expression = ["Expression"]; virtualTypes$1.Scope = ["Scopable", "Pattern"]; virtualTypes$1.Referenced = null; virtualTypes$1.BlockScoped = null; virtualTypes$1.Var = ["VariableDeclaration"]; virtualTypes$1.User = null; virtualTypes$1.Generated = null; virtualTypes$1.Pure = null; virtualTypes$1.Flow = [ "Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier", ]; virtualTypes$1.RestProperty = ["RestElement"]; virtualTypes$1.SpreadProperty = ["RestElement"]; virtualTypes$1.ExistentialTypeParam = ["ExistsTypeAnnotation"]; virtualTypes$1.NumericLiteralTypeAnnotation = ["NumberLiteralTypeAnnotation"]; virtualTypes$1.ForAwaitStatement = ["ForOfStatement"]; return virtualTypes$1; } var virtualTypesValidator = {}; var hasRequiredVirtualTypesValidator; function requireVirtualTypesValidator() { if (hasRequiredVirtualTypesValidator) return virtualTypesValidator; hasRequiredVirtualTypesValidator = 1; Object.defineProperty(virtualTypesValidator, "__esModule", { value: true }); virtualTypesValidator.isBindingIdentifier = isBindingIdentifier; virtualTypesValidator.isBlockScoped = isBlockScoped; virtualTypesValidator.isExpression = isExpression; virtualTypesValidator.isFlow = isFlow; virtualTypesValidator.isForAwaitStatement = isForAwaitStatement; virtualTypesValidator.isGenerated = isGenerated; virtualTypesValidator.isPure = isPure; virtualTypesValidator.isReferenced = isReferenced; virtualTypesValidator.isReferencedIdentifier = isReferencedIdentifier; virtualTypesValidator.isReferencedMemberExpression = isReferencedMemberExpression; virtualTypesValidator.isRestProperty = isRestProperty; virtualTypesValidator.isScope = isScope; virtualTypesValidator.isSpreadProperty = isSpreadProperty; virtualTypesValidator.isStatement = isStatement; virtualTypesValidator.isUser = isUser; virtualTypesValidator.isVar = isVar; var _t = t$d; const { isBinding: isBinding, isBlockScoped: nodeIsBlockScoped, isExportDeclaration: isExportDeclaration, isExpression: nodeIsExpression, isFlow: nodeIsFlow, isForStatement: isForStatement, isForXStatement: isForXStatement, isIdentifier: isIdentifier, isImportDeclaration: isImportDeclaration, isImportSpecifier: isImportSpecifier, isJSXIdentifier: isJSXIdentifier, isJSXMemberExpression: isJSXMemberExpression, isMemberExpression: isMemberExpression, isRestElement: nodeIsRestElement, isReferenced: nodeIsReferenced, isScope: nodeIsScope, isStatement: nodeIsStatement, isVar: nodeIsVar, isVariableDeclaration: isVariableDeclaration, react: react, isForOfStatement: isForOfStatement, } = _t; const { isCompatTag: isCompatTag } = react; function isReferencedIdentifier(opts) { const { node: node, parent: parent } = this; if (!isIdentifier(node, opts) && !isJSXMemberExpression(parent, opts)) { if (isJSXIdentifier(node, opts)) { if (isCompatTag(node.name)) return false; } else { return false; } } return nodeIsReferenced(node, parent, this.parentPath.parent); } function isReferencedMemberExpression() { const { node: node, parent: parent } = this; return isMemberExpression(node) && nodeIsReferenced(node, parent); } function isBindingIdentifier() { const { node: node, parent: parent } = this; const grandparent = this.parentPath.parent; return isIdentifier(node) && isBinding(node, parent, grandparent); } function isStatement() { const { node: node, parent: parent } = this; if (nodeIsStatement(node)) { if (isVariableDeclaration(node)) { if (isForXStatement(parent, { left: node })) return false; if (isForStatement(parent, { init: node })) return false; } return true; } else { return false; } } function isExpression() { if (this.isIdentifier()) { return this.isReferencedIdentifier(); } else { return nodeIsExpression(this.node); } } function isScope() { return nodeIsScope(this.node, this.parent); } function isReferenced() { return nodeIsReferenced(this.node, this.parent); } function isBlockScoped() { return nodeIsBlockScoped(this.node); } function isVar() { return nodeIsVar(this.node); } function isUser() { return this.node && !!this.node.loc; } function isGenerated() { return !this.isUser(); } function isPure(constantsOnly) { return this.scope.isPure(this.node, constantsOnly); } function isFlow() { const { node: node } = this; if (nodeIsFlow(node)) { return true; } else if (isImportDeclaration(node)) { return node.importKind === "type" || node.importKind === "typeof"; } else if (isExportDeclaration(node)) { return node.exportKind === "type"; } else if (isImportSpecifier(node)) { return node.importKind === "type" || node.importKind === "typeof"; } else { return false; } } function isRestProperty() { return ( nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectPattern() ); } function isSpreadProperty() { return ( nodeIsRestElement(this.node) && this.parentPath && this.parentPath.isObjectExpression() ); } function isForAwaitStatement() { return isForOfStatement(this.node, { await: true }); } { virtualTypesValidator.isExistentialTypeParam = function isExistentialTypeParam() { throw new Error( "`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.", ); }; virtualTypesValidator.isNumericLiteralTypeAnnotation = function isNumericLiteralTypeAnnotation() { throw new Error( "`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.", ); }; } return virtualTypesValidator; } var hasRequiredVisitors$1; function requireVisitors$1() { if (hasRequiredVisitors$1) return visitors$1; hasRequiredVisitors$1 = 1; Object.defineProperty(visitors$1, "__esModule", { value: true }); visitors$1.explode = explode; visitors$1.isExplodedVisitor = isExplodedVisitor; visitors$1.merge = merge; visitors$1.verify = verify; var virtualTypes = requireVirtualTypes$1(); var virtualTypesValidators = requireVirtualTypesValidator(); var _t = t$d; const { DEPRECATED_KEYS: DEPRECATED_KEYS, DEPRECATED_ALIASES: DEPRECATED_ALIASES, FLIPPED_ALIAS_KEYS: FLIPPED_ALIAS_KEYS, TYPES: TYPES, __internal__deprecationWarning: deprecationWarning, } = _t; function isVirtualType(type) { return type in virtualTypes; } function isExplodedVisitor(visitor) { return visitor == null ? void 0 : visitor._exploded; } function explode(visitor) { if (isExplodedVisitor(visitor)) return visitor; visitor._exploded = true; for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; const parts = nodeType.split("|"); if (parts.length === 1) continue; const fns = visitor[nodeType]; delete visitor[nodeType]; for (const part of parts) { visitor[part] = fns; } } verify(visitor); delete visitor.__esModule; ensureEntranceObjects(visitor); ensureCallbackArrays(visitor); for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; if (!isVirtualType(nodeType)) continue; const fns = visitor[nodeType]; for (const type of Object.keys(fns)) { fns[type] = wrapCheck(nodeType, fns[type]); } delete visitor[nodeType]; const types = virtualTypes[nodeType]; if (types !== null) { for (const type of types) { if (visitor[type]) { mergePair(visitor[type], fns); } else { visitor[type] = fns; } } } else { mergePair(visitor, fns); } } for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; let aliases = FLIPPED_ALIAS_KEYS[nodeType]; if (nodeType in DEPRECATED_KEYS) { const deprecatedKey = DEPRECATED_KEYS[nodeType]; deprecationWarning(nodeType, deprecatedKey, "Visitor "); aliases = [deprecatedKey]; } else if (nodeType in DEPRECATED_ALIASES) { const deprecatedAlias = DEPRECATED_ALIASES[nodeType]; deprecationWarning(nodeType, deprecatedAlias, "Visitor "); aliases = FLIPPED_ALIAS_KEYS[deprecatedAlias]; } if (!aliases) continue; const fns = visitor[nodeType]; delete visitor[nodeType]; for (const alias of aliases) { const existing = visitor[alias]; if (existing) { mergePair(existing, fns); } else { visitor[alias] = Object.assign({}, fns); } } } for (const nodeType of Object.keys(visitor)) { if (shouldIgnoreKey(nodeType)) continue; ensureCallbackArrays(visitor[nodeType]); } return visitor; } function verify(visitor) { if (visitor._verified) return; if (typeof visitor === "function") { throw new Error( "You passed `traverse()` a function when it expected a visitor object, " + "are you sure you didn't mean `{ enter: Function }`?", ); } for (const nodeType of Object.keys(visitor)) { if (nodeType === "enter" || nodeType === "exit") { validateVisitorMethods(nodeType, visitor[nodeType]); } if (shouldIgnoreKey(nodeType)) continue; if (TYPES.indexOf(nodeType) < 0) { throw new Error( `You gave us a visitor for the node type ${nodeType} but it's not a valid type`, ); } const visitors = visitor[nodeType]; if (typeof visitors === "object") { for (const visitorKey of Object.keys(visitors)) { if (visitorKey === "enter" || visitorKey === "exit") { validateVisitorMethods( `${nodeType}.${visitorKey}`, visitors[visitorKey], ); } else { throw new Error( "You passed `traverse()` a visitor object with the property " + `${nodeType} that has the invalid property ${visitorKey}`, ); } } } } visitor._verified = true; } function validateVisitorMethods(path, val) { const fns = [].concat(val); for (const fn of fns) { if (typeof fn !== "function") { throw new TypeError( `Non-function found defined in ${path} with type ${typeof fn}`, ); } } } function merge(visitors, states = [], wrapper) { const mergedVisitor = {}; for (let i = 0; i < visitors.length; i++) { const visitor = explode(visitors[i]); const state = states[i]; let topVisitor = visitor; if (state || wrapper) { topVisitor = wrapWithStateOrWrapper(topVisitor, state, wrapper); } mergePair(mergedVisitor, topVisitor); for (const key of Object.keys(visitor)) { if (shouldIgnoreKey(key)) continue; let typeVisitor = visitor[key]; if (state || wrapper) { typeVisitor = wrapWithStateOrWrapper(typeVisitor, state, wrapper); } const nodeVisitor = mergedVisitor[key] || (mergedVisitor[key] = {}); mergePair(nodeVisitor, typeVisitor); } } return mergedVisitor; } function wrapWithStateOrWrapper(oldVisitor, state, wrapper) { const newVisitor = {}; for (const phase of ["enter", "exit"]) { let fns = oldVisitor[phase]; if (!Array.isArray(fns)) continue; fns = fns.map(function (fn) { let newFn = fn; if (state) { newFn = function (path) { fn.call(state, path, state); }; } if (wrapper) { newFn = wrapper(state == null ? void 0 : state.key, phase, newFn); } if (newFn !== fn) { newFn.toString = () => fn.toString(); } return newFn; }); newVisitor[phase] = fns; } return newVisitor; } function ensureEntranceObjects(obj) { for (const key of Object.keys(obj)) { if (shouldIgnoreKey(key)) continue; const fns = obj[key]; if (typeof fns === "function") { obj[key] = { enter: fns }; } } } function ensureCallbackArrays(obj) { if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; } function wrapCheck(nodeType, fn) { const fnKey = `is${nodeType}`; const validator = virtualTypesValidators[fnKey]; const newFn = function (path) { if (validator.call(path)) { return fn.apply(this, arguments); } }; newFn.toString = () => fn.toString(); return newFn; } function shouldIgnoreKey(key) { if (key[0] === "_") return true; if (key === "enter" || key === "exit" || key === "shouldSkip") return true; if (key === "denylist" || key === "noScope" || key === "skipKeys") { return true; } { if (key === "blacklist") { return true; } } return false; } function mergePair(dest, src) { for (const phase of ["enter", "exit"]) { if (!src[phase]) continue; dest[phase] = [].concat(dest[phase] || [], src[phase]); } } return visitors$1; } var cache$1 = {}; var hasRequiredCache$1; function requireCache$1() { if (hasRequiredCache$1) return cache$1; hasRequiredCache$1 = 1; Object.defineProperty(cache$1, "__esModule", { value: true }); cache$1.clear = clear; cache$1.clearPath = clearPath; cache$1.clearScope = clearScope; cache$1.getCachedPaths = getCachedPaths; cache$1.getOrCreateCachedPaths = getOrCreateCachedPaths; cache$1.scope = cache$1.path = void 0; let pathsCache = (cache$1.path = new WeakMap()); cache$1.scope = new WeakMap(); function clear() { clearPath(); clearScope(); } function clearPath() { cache$1.path = pathsCache = new WeakMap(); } function clearScope() { cache$1.scope = new WeakMap(); } const nullHub = Object.freeze({}); function getCachedPaths(hub, parent) { var _pathsCache$get, _hub; { hub = null; } return (_pathsCache$get = pathsCache.get( (_hub = hub) != null ? _hub : nullHub, )) == null ? void 0 : _pathsCache$get.get(parent); } function getOrCreateCachedPaths(hub, parent) { var _hub2, _hub3; { hub = null; } let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub); if (!parents) pathsCache.set( (_hub3 = hub) != null ? _hub3 : nullHub, (parents = new WeakMap()), ); let paths = parents.get(parent); if (!paths) parents.set(parent, (paths = new Map())); return paths; } return cache$1; } var traverseNode = {}; var context$3 = {}; var path$3 = {}; var src$1 = { exports: {} }; var browser$4 = { exports: {} }; var ms; var hasRequiredMs; function requireMs() { if (hasRequiredMs) return ms; hasRequiredMs = 1; var s = 1e3; var m = s * 60; var h = m * 60; var d = h * 24; var w = d * 7; var y = d * 365.25; ms = function (val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { return parse(val); } else if (type === "number" && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(val), ); }; function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( str, ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || "ms").toLowerCase(); switch (type) { case "years": case "year": case "yrs": case "yr": case "y": return n * y; case "weeks": case "week": case "w": return n * w; case "days": case "day": case "d": return n * d; case "hours": case "hour": case "hrs": case "hr": case "h": return n * h; case "minutes": case "minute": case "mins": case "min": case "m": return n * m; case "seconds": case "second": case "secs": case "sec": case "s": return n * s; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return n; default: return undefined; } } function fmtShort(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return Math.round(ms / d) + "d"; } if (msAbs >= h) { return Math.round(ms / h) + "h"; } if (msAbs >= m) { return Math.round(ms / m) + "m"; } if (msAbs >= s) { return Math.round(ms / s) + "s"; } return ms + "ms"; } function fmtLong(ms) { var msAbs = Math.abs(ms); if (msAbs >= d) { return plural(ms, msAbs, d, "day"); } if (msAbs >= h) { return plural(ms, msAbs, h, "hour"); } if (msAbs >= m) { return plural(ms, msAbs, m, "minute"); } if (msAbs >= s) { return plural(ms, msAbs, s, "second"); } return ms + " ms"; } function plural(ms, msAbs, n, name) { var isPlural = msAbs >= n * 1.5; return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); } return ms; } var common; var hasRequiredCommon; function requireCommon() { if (hasRequiredCommon) return common; hasRequiredCommon = 1; function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = requireMs(); createDebug.destroy = destroy; Object.keys(env).forEach((key) => { createDebug[key] = env[key]; }); createDebug.names = []; createDebug.skips = []; createDebug.formatters = {}; function selectColor(namespace) { let hash = 0; for (let i = 0; i < namespace.length; i++) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; } createDebug.selectColor = selectColor; function createDebug(namespace) { let prevTime; let enableOverride = null; let namespacesCache; let enabledCache; function debug(...args) { if (!debug.enabled) { return; } const self = debug; const curr = Number(new Date()); const ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== "string") { args.unshift("%O"); } let index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { if (match === "%%") { return "%"; } index++; const formatter = createDebug.formatters[format]; if (typeof formatter === "function") { const val = args[index]; match = formatter.call(self, val); args.splice(index, 1); index--; } return match; }); createDebug.formatArgs.call(self, args); const logFn = self.log || createDebug.log; logFn.apply(self, args); } debug.namespace = namespace; debug.useColors = createDebug.useColors(); debug.color = createDebug.selectColor(namespace); debug.extend = extend; debug.destroy = createDebug.destroy; Object.defineProperty(debug, "enabled", { enumerable: true, configurable: false, get: () => { if (enableOverride !== null) { return enableOverride; } if (namespacesCache !== createDebug.namespaces) { namespacesCache = createDebug.namespaces; enabledCache = createDebug.enabled(namespace); } return enabledCache; }, set: (v) => { enableOverride = v; }, }); if (typeof createDebug.init === "function") { createDebug.init(debug); } return debug; } function extend(namespace, delimiter) { const newDebug = createDebug( this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace, ); newDebug.log = this.log; return newDebug; } function enable(namespaces) { createDebug.save(namespaces); createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; let i; const split = (typeof namespaces === "string" ? namespaces : "").split( /[\s,]+/, ); const len = split.length; for (i = 0; i < len; i++) { if (!split[i]) { continue; } namespaces = split[i].replace(/\*/g, ".*?"); if (namespaces[0] === "-") { createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$")); } else { createDebug.names.push(new RegExp("^" + namespaces + "$")); } } } function disable() { const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips .map(toNamespace) .map((namespace) => "-" + namespace), ].join(","); createDebug.enable(""); return namespaces; } function enabled(name) { if (name[name.length - 1] === "*") { return true; } let i; let len; for (i = 0, len = createDebug.skips.length; i < len; i++) { if (createDebug.skips[i].test(name)) { return false; } } for (i = 0, len = createDebug.names.length; i < len; i++) { if (createDebug.names[i].test(name)) { return true; } } return false; } function toNamespace(regexp) { return regexp .toString() .substring(2, regexp.toString().length - 2) .replace(/\.\*\?$/, "*"); } function coerce(val) { if (val instanceof Error) { return val.stack || val.message; } return val; } function destroy() { console.warn( "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.", ); } createDebug.enable(createDebug.load()); return createDebug; } common = setup; return common; } var hasRequiredBrowser$1; function requireBrowser$1() { if (hasRequiredBrowser$1) return browser$4.exports; hasRequiredBrowser$1 = 1; (function (module, exports) { exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); exports.destroy = (() => { let warned = false; return () => { if (!warned) { warned = true; console.warn( "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.", ); } }; })(); exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33", ]; function useColors() { if ( typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs) ) { return true; } if ( typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/) ) { return false; } return ( (typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || (typeof window !== "undefined" && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)) ); } function formatArgs(args) { args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff); if (!this.useColors) { return; } const c = "color: " + this.color; args.splice(1, 0, c, "color: inherit"); let index = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, (match) => { if (match === "%%") { return; } index++; if (match === "%c") { lastC = index; } }); args.splice(lastC, 0, c); } exports.log = console.debug || console.log || (() => {}); function save(namespaces) { try { if (namespaces) { exports.storage.setItem("debug", namespaces); } else { exports.storage.removeItem("debug"); } } catch (error) {} } function load() { let r; try { r = exports.storage.getItem("debug"); } catch (error) {} if (!r && typeof process !== "undefined" && "env" in process) { r = process.env.DEBUG; } return r; } function localstorage() { try { return localStorage; } catch (error) {} } module.exports = requireCommon()(exports); const { formatters: formatters } = module.exports; formatters.j = function (v) { try { return JSON.stringify(v); } catch (error) { return "[UnexpectedJSONParseError]: " + error.message; } }; })(browser$4, browser$4.exports); return browser$4.exports; } var node$4 = { exports: {} }; var browser$3; var hasRequiredBrowser; function requireBrowser() { if (hasRequiredBrowser) return browser$3; hasRequiredBrowser = 1; function getChromeVersion() { const matches = /(Chrome|Chromium)\/(?\d+)\./.exec( navigator.userAgent, ); if (!matches) { return; } return Number.parseInt(matches.groups.chromeVersion, 10); } const colorSupport = getChromeVersion() >= 69 ? { level: 1, hasBasic: true, has256: false, has16m: false } : false; browser$3 = { stdout: colorSupport, stderr: colorSupport }; return browser$3; } var hasRequiredNode$1; function requireNode$1() { if (hasRequiredNode$1) return node$4.exports; hasRequiredNode$1 = 1; (function (module, exports) { const tty = require$$0$3; const util = require$$1$1; exports.init = init; exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.destroy = util.deprecate( () => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.", ); exports.colors = [6, 2, 3, 4, 5, 1]; try { const supportsColor = requireBrowser(); if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221, ]; } } catch (error) {} exports.inspectOpts = Object.keys(process.env) .filter((key) => /^debug_/i.test(key)) .reduce((obj, key) => { const prop = key .substring(6) .toLowerCase() .replace(/_([a-z])/g, (_, k) => k.toUpperCase()); let val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) { val = true; } else if (/^(no|off|false|disabled)$/i.test(val)) { val = false; } else if (val === "null") { val = null; } else { val = Number(val); } obj[prop] = val; return obj; }, {}); function useColors() { return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); } function formatArgs(args) { const { namespace: name, useColors: useColors } = this; if (useColors) { const c = this.color; const colorCode = "[3" + (c < 8 ? c : "8;5;" + c); const prefix = ` ${colorCode};1m${name} `; args[0] = prefix + args[0].split("\n").join("\n" + prefix); args.push( colorCode + "m+" + module.exports.humanize(this.diff) + "", ); } else { args[0] = getDate() + name + " " + args[0]; } } function getDate() { if (exports.inspectOpts.hideDate) { return ""; } return new Date().toISOString() + " "; } function log(...args) { return process.stderr.write(util.format(...args) + "\n"); } function save(namespaces) { if (namespaces) { process.env.DEBUG = namespaces; } else { delete process.env.DEBUG; } } function load() { return process.env.DEBUG; } function init(debug) { debug.inspectOpts = {}; const keys = Object.keys(exports.inspectOpts); for (let i = 0; i < keys.length; i++) { debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; } } module.exports = requireCommon()(exports); const { formatters: formatters } = module.exports; formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util .inspect(v, this.inspectOpts) .split("\n") .map((str) => str.trim()) .join(" "); }; formatters.O = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts); }; })(node$4, node$4.exports); return node$4.exports; } var hasRequiredSrc$1; function requireSrc$1() { if (hasRequiredSrc$1) return src$1.exports; hasRequiredSrc$1 = 1; if ( typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs ) { src$1.exports = requireBrowser$1(); } else { src$1.exports = requireNode$1(); } return src$1.exports; } var scope$1 = {}; var renamer$1 = {}; var lib$q = {}; var hasRequiredLib$q; function requireLib$q() { if (hasRequiredLib$q) return lib$q; hasRequiredLib$q = 1; Object.defineProperty(lib$q, "__esModule", { value: true }); lib$q.default = splitExportDeclaration; var _t = t$d; const { cloneNode: cloneNode, exportNamedDeclaration: exportNamedDeclaration, exportSpecifier: exportSpecifier, identifier: identifier, variableDeclaration: variableDeclaration, variableDeclarator: variableDeclarator, } = _t; function splitExportDeclaration(exportDeclaration) { if ( !exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration() ) { throw new Error( "Only default and named export declarations can be split.", ); } if (exportDeclaration.isExportDefaultDeclaration()) { const declaration = exportDeclaration.get("declaration"); const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration(); const exportExpr = declaration.isFunctionExpression() || declaration.isClassExpression(); const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope; let id = declaration.node.id; let needBindingRegistration = false; if (!id) { needBindingRegistration = true; id = scope.generateUidIdentifier("default"); if (standaloneDeclaration || exportExpr) { declaration.node.id = cloneNode(id); } } else if (exportExpr && scope.hasBinding(id.name)) { needBindingRegistration = true; id = scope.generateUidIdentifier(id.name); } const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [ variableDeclarator(cloneNode(id), declaration.node), ]); const updatedExportDeclaration = exportNamedDeclaration(null, [ exportSpecifier(cloneNode(id), identifier("default")), ]); exportDeclaration.insertAfter(updatedExportDeclaration); exportDeclaration.replaceWith(updatedDeclaration); if (needBindingRegistration) { scope.registerDeclaration(exportDeclaration); } return exportDeclaration; } else if (exportDeclaration.get("specifiers").length > 0) { throw new Error("It doesn't make sense to split exported specifiers."); } const declaration = exportDeclaration.get("declaration"); const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); const specifiers = Object.keys(bindingIdentifiers).map((name) => exportSpecifier(identifier(name), identifier(name)), ); const aliasDeclar = exportNamedDeclaration(null, specifiers); exportDeclaration.insertAfter(aliasDeclar); exportDeclaration.replaceWith(declaration.node); return exportDeclaration; } return lib$q; } var lib$p = {}; var hasRequiredLib$p; function requireLib$p() { if (hasRequiredLib$p) return lib$p; hasRequiredLib$p = 1; Object.defineProperty(lib$p, "__esModule", { value: true }); lib$p.default = void 0; lib$p.requeueComputedKeyAndDecorators = requeueComputedKeyAndDecorators; { lib$p.skipAllButComputedKey = function skipAllButComputedKey(path) { path.skip(); if (path.node.computed) { path.context.maybeQueue(path.get("key")); } }; } function requeueComputedKeyAndDecorators(path) { const { context: context, node: node } = path; if (node.computed) { context.maybeQueue(path.get("key")); } if (node.decorators) { for (const decorator of path.get("decorators")) { context.maybeQueue(decorator); } } } const visitor = { FunctionParent(path) { if (path.isArrowFunctionExpression()) { return; } else { path.skip(); if (path.isMethod()) { requeueComputedKeyAndDecorators(path); } } }, Property(path) { if (path.isObjectProperty()) { return; } path.skip(); requeueComputedKeyAndDecorators(path); }, }; var _default = visitor; lib$p.default = _default; return lib$p; } var hasRequiredRenamer$1; function requireRenamer$1() { if (hasRequiredRenamer$1) return renamer$1; hasRequiredRenamer$1 = 1; Object.defineProperty(renamer$1, "__esModule", { value: true }); renamer$1.default = void 0; var _helperSplitExportDeclaration = requireLib$q(); var t = t$d; var _helperEnvironmentVisitor = requireLib$p(); var _traverseNode = requireTraverseNode(); var _visitors = requireVisitors$1(); const renameVisitor = { ReferencedIdentifier({ node: node }, state) { if (node.name === state.oldName) { node.name = state.newName; } }, Scope(path, state) { if ( !path.scope.bindingIdentifierEquals( state.oldName, state.binding.identifier, ) ) { path.skip(); if (path.isMethod()) { (0, _helperEnvironmentVisitor.requeueComputedKeyAndDecorators)(path); } } }, ObjectProperty({ node: node, scope: scope }, state) { const { name: name } = node.key; if ( node.shorthand && (name === state.oldName || name === state.newName) && scope.getBindingIdentifier(name) === state.binding.identifier ) { var _node$extra; node.shorthand = false; if ((_node$extra = node.extra) != null && _node$extra.shorthand) node.extra.shorthand = false; } }, "AssignmentExpression|Declaration|VariableDeclarator"(path, state) { if (path.isVariableDeclaration()) return; const ids = path.getOuterBindingIdentifiers(); for (const name in ids) { if (name === state.oldName) ids[name].name = state.newName; } }, }; class Renamer { constructor(binding, oldName, newName) { this.newName = newName; this.oldName = oldName; this.binding = binding; } maybeConvertFromExportDeclaration(parentDeclar) { const maybeExportDeclar = parentDeclar.parentPath; if (!maybeExportDeclar.isExportDeclaration()) { return; } if (maybeExportDeclar.isExportDefaultDeclaration()) { const { declaration: declaration } = maybeExportDeclar.node; if (t.isDeclaration(declaration) && !declaration.id) { return; } } if (maybeExportDeclar.isExportAllDeclaration()) { return; } (0, _helperSplitExportDeclaration.default)(maybeExportDeclar); } maybeConvertFromClassFunctionDeclaration(path) { return path; } maybeConvertFromClassFunctionExpression(path) { return path; } rename() { const { binding: binding, oldName: oldName, newName: newName } = this; const { scope: scope, path: path } = binding; const parentDeclar = path.find( (path) => path.isDeclaration() || path.isFunctionExpression() || path.isClassExpression(), ); if (parentDeclar) { const bindingIds = parentDeclar.getOuterBindingIdentifiers(); if (bindingIds[oldName] === binding.identifier) { this.maybeConvertFromExportDeclaration(parentDeclar); } } const blockToTraverse = arguments[0] || scope.block; (0, _traverseNode.traverseNode)( blockToTraverse, (0, _visitors.explode)(renameVisitor), scope, this, scope.path, { discriminant: true }, ); if (!arguments[0]) { scope.removeOwnBinding(oldName); scope.bindings[newName] = binding; this.binding.identifier.name = newName; } if (parentDeclar) { this.maybeConvertFromClassFunctionDeclaration(path); this.maybeConvertFromClassFunctionExpression(path); } } } renamer$1.default = Renamer; return renamer$1; } var binding$1 = {}; var hasRequiredBinding$1; function requireBinding$1() { if (hasRequiredBinding$1) return binding$1; hasRequiredBinding$1 = 1; Object.defineProperty(binding$1, "__esModule", { value: true }); binding$1.default = void 0; class Binding { constructor({ identifier: identifier, scope: scope, path: path, kind: kind, }) { this.identifier = void 0; this.scope = void 0; this.path = void 0; this.kind = void 0; this.constantViolations = []; this.constant = true; this.referencePaths = []; this.referenced = false; this.references = 0; this.identifier = identifier; this.scope = scope; this.path = path; this.kind = kind; if ((kind === "var" || kind === "hoisted") && isDeclaredInLoop(path)) { this.reassign(path); } this.clearValue(); } deoptValue() { this.clearValue(); this.hasDeoptedValue = true; } setValue(value) { if (this.hasDeoptedValue) return; this.hasValue = true; this.value = value; } clearValue() { this.hasDeoptedValue = false; this.hasValue = false; this.value = null; } reassign(path) { this.constant = false; if (this.constantViolations.indexOf(path) !== -1) { return; } this.constantViolations.push(path); } reference(path) { if (this.referencePaths.indexOf(path) !== -1) { return; } this.referenced = true; this.references++; this.referencePaths.push(path); } dereference() { this.references--; this.referenced = !!this.references; } } binding$1.default = Binding; function isDeclaredInLoop(path) { for ( let { parentPath: parentPath, key: key } = path; parentPath; { parentPath: parentPath, key: key } = parentPath ) { if (parentPath.isFunctionParent()) return false; if ( parentPath.isWhile() || parentPath.isForXStatement() || (parentPath.isForStatement() && key === "body") ) { return true; } } return false; } return binding$1; } var builtin$1 = { Array: false, ArrayBuffer: false, Atomics: false, BigInt: false, BigInt64Array: false, BigUint64Array: false, Boolean: false, constructor: false, DataView: false, Date: false, decodeURI: false, decodeURIComponent: false, encodeURI: false, encodeURIComponent: false, Error: false, escape: false, eval: false, EvalError: false, Float32Array: false, Float64Array: false, Function: false, globalThis: false, hasOwnProperty: false, Infinity: false, Int16Array: false, Int32Array: false, Int8Array: false, isFinite: false, isNaN: false, isPrototypeOf: false, JSON: false, Map: false, Math: false, NaN: false, Number: false, Object: false, parseFloat: false, parseInt: false, Promise: false, propertyIsEnumerable: false, Proxy: false, RangeError: false, ReferenceError: false, Reflect: false, RegExp: false, Set: false, SharedArrayBuffer: false, String: false, Symbol: false, SyntaxError: false, toLocaleString: false, toString: false, TypeError: false, Uint16Array: false, Uint32Array: false, Uint8Array: false, Uint8ClampedArray: false, undefined: false, unescape: false, URIError: false, valueOf: false, WeakMap: false, WeakSet: false, }; var es5$1 = { Array: false, Boolean: false, constructor: false, Date: false, decodeURI: false, decodeURIComponent: false, encodeURI: false, encodeURIComponent: false, Error: false, escape: false, eval: false, EvalError: false, Function: false, hasOwnProperty: false, Infinity: false, isFinite: false, isNaN: false, isPrototypeOf: false, JSON: false, Math: false, NaN: false, Number: false, Object: false, parseFloat: false, parseInt: false, propertyIsEnumerable: false, RangeError: false, ReferenceError: false, RegExp: false, String: false, SyntaxError: false, toLocaleString: false, toString: false, TypeError: false, undefined: false, unescape: false, URIError: false, valueOf: false, }; var es2015$1 = { Array: false, ArrayBuffer: false, Boolean: false, constructor: false, DataView: false, Date: false, decodeURI: false, decodeURIComponent: false, encodeURI: false, encodeURIComponent: false, Error: false, escape: false, eval: false, EvalError: false, Float32Array: false, Float64Array: false, Function: false, hasOwnProperty: false, Infinity: false, Int16Array: false, Int32Array: false, Int8Array: false, isFinite: false, isNaN: false, isPrototypeOf: false, JSON: false, Map: false, Math: false, NaN: false, Number: false, Object: false, parseFloat: false, parseInt: false, Promise: false, propertyIsEnumerable: false, Proxy: false, RangeError: false, ReferenceError: false, Reflect: false, RegExp: false, Set: false, String: false, Symbol: false, SyntaxError: false, toLocaleString: false, toString: false, TypeError: false, Uint16Array: false, Uint32Array: false, Uint8Array: false, Uint8ClampedArray: false, undefined: false, unescape: false, URIError: false, valueOf: false, WeakMap: false, WeakSet: false, }; var es2017$1 = { Array: false, ArrayBuffer: false, Atomics: false, Boolean: false, constructor: false, DataView: false, Date: false, decodeURI: false, decodeURIComponent: false, encodeURI: false, encodeURIComponent: false, Error: false, escape: false, eval: false, EvalError: false, Float32Array: false, Float64Array: false, Function: false, hasOwnProperty: false, Infinity: false, Int16Array: false, Int32Array: false, Int8Array: false, isFinite: false, isNaN: false, isPrototypeOf: false, JSON: false, Map: false, Math: false, NaN: false, Number: false, Object: false, parseFloat: false, parseInt: false, Promise: false, propertyIsEnumerable: false, Proxy: false, RangeError: false, ReferenceError: false, Reflect: false, RegExp: false, Set: false, SharedArrayBuffer: false, String: false, Symbol: false, SyntaxError: false, toLocaleString: false, toString: false, TypeError: false, Uint16Array: false, Uint32Array: false, Uint8Array: false, Uint8ClampedArray: false, undefined: false, unescape: false, URIError: false, valueOf: false, WeakMap: false, WeakSet: false, }; var browser$2 = { AbortController: false, AbortSignal: false, addEventListener: false, alert: false, AnalyserNode: false, Animation: false, AnimationEffectReadOnly: false, AnimationEffectTiming: false, AnimationEffectTimingReadOnly: false, AnimationEvent: false, AnimationPlaybackEvent: false, AnimationTimeline: false, applicationCache: false, ApplicationCache: false, ApplicationCacheErrorEvent: false, atob: false, Attr: false, Audio: false, AudioBuffer: false, AudioBufferSourceNode: false, AudioContext: false, AudioDestinationNode: false, AudioListener: false, AudioNode: false, AudioParam: false, AudioProcessingEvent: false, AudioScheduledSourceNode: false, "AudioWorkletGlobalScope ": false, AudioWorkletNode: false, AudioWorkletProcessor: false, BarProp: false, BaseAudioContext: false, BatteryManager: false, BeforeUnloadEvent: false, BiquadFilterNode: false, Blob: false, BlobEvent: false, blur: false, BroadcastChannel: false, btoa: false, BudgetService: false, ByteLengthQueuingStrategy: false, Cache: false, caches: false, CacheStorage: false, cancelAnimationFrame: false, cancelIdleCallback: false, CanvasCaptureMediaStreamTrack: false, CanvasGradient: false, CanvasPattern: false, CanvasRenderingContext2D: false, ChannelMergerNode: false, ChannelSplitterNode: false, CharacterData: false, clearInterval: false, clearTimeout: false, clientInformation: false, ClipboardEvent: false, close: false, closed: false, CloseEvent: false, Comment: false, CompositionEvent: false, confirm: false, console: false, ConstantSourceNode: false, ConvolverNode: false, CountQueuingStrategy: false, createImageBitmap: false, Credential: false, CredentialsContainer: false, crypto: false, Crypto: false, CryptoKey: false, CSS: false, CSSConditionRule: false, CSSFontFaceRule: false, CSSGroupingRule: false, CSSImportRule: false, CSSKeyframeRule: false, CSSKeyframesRule: false, CSSMediaRule: false, CSSNamespaceRule: false, CSSPageRule: false, CSSRule: false, CSSRuleList: false, CSSStyleDeclaration: false, CSSStyleRule: false, CSSStyleSheet: false, CSSSupportsRule: false, CustomElementRegistry: false, customElements: false, CustomEvent: false, DataTransfer: false, DataTransferItem: false, DataTransferItemList: false, defaultstatus: false, defaultStatus: false, DelayNode: false, DeviceMotionEvent: false, DeviceOrientationEvent: false, devicePixelRatio: false, dispatchEvent: false, document: false, Document: false, DocumentFragment: false, DocumentType: false, DOMError: false, DOMException: false, DOMImplementation: false, DOMMatrix: false, DOMMatrixReadOnly: false, DOMParser: false, DOMPoint: false, DOMPointReadOnly: false, DOMQuad: false, DOMRect: false, DOMRectReadOnly: false, DOMStringList: false, DOMStringMap: false, DOMTokenList: false, DragEvent: false, DynamicsCompressorNode: false, Element: false, ErrorEvent: false, event: false, Event: false, EventSource: false, EventTarget: false, external: false, fetch: false, File: false, FileList: false, FileReader: false, find: false, focus: false, FocusEvent: false, FontFace: false, FontFaceSetLoadEvent: false, FormData: false, frameElement: false, frames: false, GainNode: false, Gamepad: false, GamepadButton: false, GamepadEvent: false, getComputedStyle: false, getSelection: false, HashChangeEvent: false, Headers: false, history: false, History: false, HTMLAllCollection: false, HTMLAnchorElement: false, HTMLAreaElement: false, HTMLAudioElement: false, HTMLBaseElement: false, HTMLBodyElement: false, HTMLBRElement: false, HTMLButtonElement: false, HTMLCanvasElement: false, HTMLCollection: false, HTMLContentElement: false, HTMLDataElement: false, HTMLDataListElement: false, HTMLDetailsElement: false, HTMLDialogElement: false, HTMLDirectoryElement: false, HTMLDivElement: false, HTMLDListElement: false, HTMLDocument: false, HTMLElement: false, HTMLEmbedElement: false, HTMLFieldSetElement: false, HTMLFontElement: false, HTMLFormControlsCollection: false, HTMLFormElement: false, HTMLFrameElement: false, HTMLFrameSetElement: false, HTMLHeadElement: false, HTMLHeadingElement: false, HTMLHRElement: false, HTMLHtmlElement: false, HTMLIFrameElement: false, HTMLImageElement: false, HTMLInputElement: false, HTMLLabelElement: false, HTMLLegendElement: false, HTMLLIElement: false, HTMLLinkElement: false, HTMLMapElement: false, HTMLMarqueeElement: false, HTMLMediaElement: false, HTMLMenuElement: false, HTMLMetaElement: false, HTMLMeterElement: false, HTMLModElement: false, HTMLObjectElement: false, HTMLOListElement: false, HTMLOptGroupElement: false, HTMLOptionElement: false, HTMLOptionsCollection: false, HTMLOutputElement: false, HTMLParagraphElement: false, HTMLParamElement: false, HTMLPictureElement: false, HTMLPreElement: false, HTMLProgressElement: false, HTMLQuoteElement: false, HTMLScriptElement: false, HTMLSelectElement: false, HTMLShadowElement: false, HTMLSlotElement: false, HTMLSourceElement: false, HTMLSpanElement: false, HTMLStyleElement: false, HTMLTableCaptionElement: false, HTMLTableCellElement: false, HTMLTableColElement: false, HTMLTableElement: false, HTMLTableRowElement: false, HTMLTableSectionElement: false, HTMLTemplateElement: false, HTMLTextAreaElement: false, HTMLTimeElement: false, HTMLTitleElement: false, HTMLTrackElement: false, HTMLUListElement: false, HTMLUnknownElement: false, HTMLVideoElement: false, IDBCursor: false, IDBCursorWithValue: false, IDBDatabase: false, IDBFactory: false, IDBIndex: false, IDBKeyRange: false, IDBObjectStore: false, IDBOpenDBRequest: false, IDBRequest: false, IDBTransaction: false, IDBVersionChangeEvent: false, IdleDeadline: false, IIRFilterNode: false, Image: false, ImageBitmap: false, ImageBitmapRenderingContext: false, ImageCapture: false, ImageData: false, indexedDB: false, innerHeight: false, innerWidth: false, InputEvent: false, IntersectionObserver: false, IntersectionObserverEntry: false, Intl: false, isSecureContext: false, KeyboardEvent: false, KeyframeEffect: false, KeyframeEffectReadOnly: false, length: false, localStorage: false, location: true, Location: false, locationbar: false, matchMedia: false, MediaDeviceInfo: false, MediaDevices: false, MediaElementAudioSourceNode: false, MediaEncryptedEvent: false, MediaError: false, MediaKeyMessageEvent: false, MediaKeySession: false, MediaKeyStatusMap: false, MediaKeySystemAccess: false, MediaList: false, MediaQueryList: false, MediaQueryListEvent: false, MediaRecorder: false, MediaSettingsRange: false, MediaSource: false, MediaStream: false, MediaStreamAudioDestinationNode: false, MediaStreamAudioSourceNode: false, MediaStreamEvent: false, MediaStreamTrack: false, MediaStreamTrackEvent: false, menubar: false, MessageChannel: false, MessageEvent: false, MessagePort: false, MIDIAccess: false, MIDIConnectionEvent: false, MIDIInput: false, MIDIInputMap: false, MIDIMessageEvent: false, MIDIOutput: false, MIDIOutputMap: false, MIDIPort: false, MimeType: false, MimeTypeArray: false, MouseEvent: false, moveBy: false, moveTo: false, MutationEvent: false, MutationObserver: false, MutationRecord: false, name: false, NamedNodeMap: false, NavigationPreloadManager: false, navigator: false, Navigator: false, NetworkInformation: false, Node: false, NodeFilter: false, NodeIterator: false, NodeList: false, Notification: false, OfflineAudioCompletionEvent: false, OfflineAudioContext: false, offscreenBuffering: false, OffscreenCanvas: true, onabort: true, onafterprint: true, onanimationend: true, onanimationiteration: true, onanimationstart: true, onappinstalled: true, onauxclick: true, onbeforeinstallprompt: true, onbeforeprint: true, onbeforeunload: true, onblur: true, oncancel: true, oncanplay: true, oncanplaythrough: true, onchange: true, onclick: true, onclose: true, oncontextmenu: true, oncuechange: true, ondblclick: true, ondevicemotion: true, ondeviceorientation: true, ondeviceorientationabsolute: true, ondrag: true, ondragend: true, ondragenter: true, ondragleave: true, ondragover: true, ondragstart: true, ondrop: true, ondurationchange: true, onemptied: true, onended: true, onerror: true, onfocus: true, ongotpointercapture: true, onhashchange: true, oninput: true, oninvalid: true, onkeydown: true, onkeypress: true, onkeyup: true, onlanguagechange: true, onload: true, onloadeddata: true, onloadedmetadata: true, onloadstart: true, onlostpointercapture: true, onmessage: true, onmessageerror: true, onmousedown: true, onmouseenter: true, onmouseleave: true, onmousemove: true, onmouseout: true, onmouseover: true, onmouseup: true, onmousewheel: true, onoffline: true, ononline: true, onpagehide: true, onpageshow: true, onpause: true, onplay: true, onplaying: true, onpointercancel: true, onpointerdown: true, onpointerenter: true, onpointerleave: true, onpointermove: true, onpointerout: true, onpointerover: true, onpointerup: true, onpopstate: true, onprogress: true, onratechange: true, onrejectionhandled: true, onreset: true, onresize: true, onscroll: true, onsearch: true, onseeked: true, onseeking: true, onselect: true, onstalled: true, onstorage: true, onsubmit: true, onsuspend: true, ontimeupdate: true, ontoggle: true, ontransitionend: true, onunhandledrejection: true, onunload: true, onvolumechange: true, onwaiting: true, onwheel: true, open: false, openDatabase: false, opener: false, Option: false, origin: false, OscillatorNode: false, outerHeight: false, outerWidth: false, PageTransitionEvent: false, pageXOffset: false, pageYOffset: false, PannerNode: false, parent: false, Path2D: false, PaymentAddress: false, PaymentRequest: false, PaymentRequestUpdateEvent: false, PaymentResponse: false, performance: false, Performance: false, PerformanceEntry: false, PerformanceLongTaskTiming: false, PerformanceMark: false, PerformanceMeasure: false, PerformanceNavigation: false, PerformanceNavigationTiming: false, PerformanceObserver: false, PerformanceObserverEntryList: false, PerformancePaintTiming: false, PerformanceResourceTiming: false, PerformanceTiming: false, PeriodicWave: false, Permissions: false, PermissionStatus: false, personalbar: false, PhotoCapabilities: false, Plugin: false, PluginArray: false, PointerEvent: false, PopStateEvent: false, postMessage: false, Presentation: false, PresentationAvailability: false, PresentationConnection: false, PresentationConnectionAvailableEvent: false, PresentationConnectionCloseEvent: false, PresentationConnectionList: false, PresentationReceiver: false, PresentationRequest: false, print: false, ProcessingInstruction: false, ProgressEvent: false, PromiseRejectionEvent: false, prompt: false, PushManager: false, PushSubscription: false, PushSubscriptionOptions: false, queueMicrotask: false, RadioNodeList: false, Range: false, ReadableStream: false, registerProcessor: false, RemotePlayback: false, removeEventListener: false, Request: false, requestAnimationFrame: false, requestIdleCallback: false, resizeBy: false, ResizeObserver: false, ResizeObserverEntry: false, resizeTo: false, Response: false, RTCCertificate: false, RTCDataChannel: false, RTCDataChannelEvent: false, RTCDtlsTransport: false, RTCIceCandidate: false, RTCIceGatherer: false, RTCIceTransport: false, RTCPeerConnection: false, RTCPeerConnectionIceEvent: false, RTCRtpContributingSource: false, RTCRtpReceiver: false, RTCRtpSender: false, RTCSctpTransport: false, RTCSessionDescription: false, RTCStatsReport: false, RTCTrackEvent: false, screen: false, Screen: false, screenLeft: false, ScreenOrientation: false, screenTop: false, screenX: false, screenY: false, ScriptProcessorNode: false, scroll: false, scrollbars: false, scrollBy: false, scrollTo: false, scrollX: false, scrollY: false, SecurityPolicyViolationEvent: false, Selection: false, self: false, ServiceWorker: false, ServiceWorkerContainer: false, ServiceWorkerRegistration: false, sessionStorage: false, setInterval: false, setTimeout: false, ShadowRoot: false, SharedWorker: false, SourceBuffer: false, SourceBufferList: false, speechSynthesis: false, SpeechSynthesisEvent: false, SpeechSynthesisUtterance: false, StaticRange: false, status: false, statusbar: false, StereoPannerNode: false, stop: false, Storage: false, StorageEvent: false, StorageManager: false, styleMedia: false, StyleSheet: false, StyleSheetList: false, SubtleCrypto: false, SVGAElement: false, SVGAngle: false, SVGAnimatedAngle: false, SVGAnimatedBoolean: false, SVGAnimatedEnumeration: false, SVGAnimatedInteger: false, SVGAnimatedLength: false, SVGAnimatedLengthList: false, SVGAnimatedNumber: false, SVGAnimatedNumberList: false, SVGAnimatedPreserveAspectRatio: false, SVGAnimatedRect: false, SVGAnimatedString: false, SVGAnimatedTransformList: false, SVGAnimateElement: false, SVGAnimateMotionElement: false, SVGAnimateTransformElement: false, SVGAnimationElement: false, SVGCircleElement: false, SVGClipPathElement: false, SVGComponentTransferFunctionElement: false, SVGDefsElement: false, SVGDescElement: false, SVGDiscardElement: false, SVGElement: false, SVGEllipseElement: false, SVGFEBlendElement: false, SVGFEColorMatrixElement: false, SVGFEComponentTransferElement: false, SVGFECompositeElement: false, SVGFEConvolveMatrixElement: false, SVGFEDiffuseLightingElement: false, SVGFEDisplacementMapElement: false, SVGFEDistantLightElement: false, SVGFEDropShadowElement: false, SVGFEFloodElement: false, SVGFEFuncAElement: false, SVGFEFuncBElement: false, SVGFEFuncGElement: false, SVGFEFuncRElement: false, SVGFEGaussianBlurElement: false, SVGFEImageElement: false, SVGFEMergeElement: false, SVGFEMergeNodeElement: false, SVGFEMorphologyElement: false, SVGFEOffsetElement: false, SVGFEPointLightElement: false, SVGFESpecularLightingElement: false, SVGFESpotLightElement: false, SVGFETileElement: false, SVGFETurbulenceElement: false, SVGFilterElement: false, SVGForeignObjectElement: false, SVGGElement: false, SVGGeometryElement: false, SVGGradientElement: false, SVGGraphicsElement: false, SVGImageElement: false, SVGLength: false, SVGLengthList: false, SVGLinearGradientElement: false, SVGLineElement: false, SVGMarkerElement: false, SVGMaskElement: false, SVGMatrix: false, SVGMetadataElement: false, SVGMPathElement: false, SVGNumber: false, SVGNumberList: false, SVGPathElement: false, SVGPatternElement: false, SVGPoint: false, SVGPointList: false, SVGPolygonElement: false, SVGPolylineElement: false, SVGPreserveAspectRatio: false, SVGRadialGradientElement: false, SVGRect: false, SVGRectElement: false, SVGScriptElement: false, SVGSetElement: false, SVGStopElement: false, SVGStringList: false, SVGStyleElement: false, SVGSVGElement: false, SVGSwitchElement: false, SVGSymbolElement: false, SVGTextContentElement: false, SVGTextElement: false, SVGTextPathElement: false, SVGTextPositioningElement: false, SVGTitleElement: false, SVGTransform: false, SVGTransformList: false, SVGTSpanElement: false, SVGUnitTypes: false, SVGUseElement: false, SVGViewElement: false, TaskAttributionTiming: false, Text: false, TextDecoder: false, TextEncoder: false, TextEvent: false, TextMetrics: false, TextTrack: false, TextTrackCue: false, TextTrackCueList: false, TextTrackList: false, TimeRanges: false, toolbar: false, top: false, Touch: false, TouchEvent: false, TouchList: false, TrackEvent: false, TransitionEvent: false, TreeWalker: false, UIEvent: false, URL: false, URLSearchParams: false, ValidityState: false, visualViewport: false, VisualViewport: false, VTTCue: false, WaveShaperNode: false, WebAssembly: false, WebGL2RenderingContext: false, WebGLActiveInfo: false, WebGLBuffer: false, WebGLContextEvent: false, WebGLFramebuffer: false, WebGLProgram: false, WebGLQuery: false, WebGLRenderbuffer: false, WebGLRenderingContext: false, WebGLSampler: false, WebGLShader: false, WebGLShaderPrecisionFormat: false, WebGLSync: false, WebGLTexture: false, WebGLTransformFeedback: false, WebGLUniformLocation: false, WebGLVertexArrayObject: false, WebSocket: false, WheelEvent: false, window: false, Window: false, Worker: false, WritableStream: false, XMLDocument: false, XMLHttpRequest: false, XMLHttpRequestEventTarget: false, XMLHttpRequestUpload: false, XMLSerializer: false, XPathEvaluator: false, XPathExpression: false, XPathResult: false, XSLTProcessor: false, }; var worker$1 = { addEventListener: false, applicationCache: false, atob: false, Blob: false, BroadcastChannel: false, btoa: false, Cache: false, caches: false, clearInterval: false, clearTimeout: false, close: true, console: false, fetch: false, FileReaderSync: false, FormData: false, Headers: false, IDBCursor: false, IDBCursorWithValue: false, IDBDatabase: false, IDBFactory: false, IDBIndex: false, IDBKeyRange: false, IDBObjectStore: false, IDBOpenDBRequest: false, IDBRequest: false, IDBTransaction: false, IDBVersionChangeEvent: false, ImageData: false, importScripts: true, indexedDB: false, location: false, MessageChannel: false, MessagePort: false, name: false, navigator: false, Notification: false, onclose: true, onconnect: true, onerror: true, onlanguagechange: true, onmessage: true, onoffline: true, ononline: true, onrejectionhandled: true, onunhandledrejection: true, performance: false, Performance: false, PerformanceEntry: false, PerformanceMark: false, PerformanceMeasure: false, PerformanceNavigation: false, PerformanceResourceTiming: false, PerformanceTiming: false, postMessage: true, Promise: false, queueMicrotask: false, removeEventListener: false, Request: false, Response: false, self: true, ServiceWorkerRegistration: false, setInterval: false, setTimeout: false, TextDecoder: false, TextEncoder: false, URL: false, URLSearchParams: false, WebSocket: false, Worker: false, WorkerGlobalScope: false, XMLHttpRequest: false, }; var node$3 = { __dirname: false, __filename: false, Buffer: false, clearImmediate: false, clearInterval: false, clearTimeout: false, console: false, exports: true, global: false, Intl: false, module: false, process: false, queueMicrotask: false, require: false, setImmediate: false, setInterval: false, setTimeout: false, TextDecoder: false, TextEncoder: false, URL: false, URLSearchParams: false, }; var commonjs$1 = { exports: true, global: false, module: false, require: false, }; var amd$1 = { define: false, require: false }; var mocha$1 = { after: false, afterEach: false, before: false, beforeEach: false, context: false, describe: false, it: false, mocha: false, run: false, setup: false, specify: false, suite: false, suiteSetup: false, suiteTeardown: false, teardown: false, test: false, xcontext: false, xdescribe: false, xit: false, xspecify: false, }; var jasmine$1 = { afterAll: false, afterEach: false, beforeAll: false, beforeEach: false, describe: false, expect: false, fail: false, fdescribe: false, fit: false, it: false, jasmine: false, pending: false, runs: false, spyOn: false, spyOnProperty: false, waits: false, waitsFor: false, xdescribe: false, xit: false, }; var jest$1 = { afterAll: false, afterEach: false, beforeAll: false, beforeEach: false, describe: false, expect: false, fdescribe: false, fit: false, it: false, jest: false, pit: false, require: false, test: false, xdescribe: false, xit: false, xtest: false, }; var qunit$1 = { asyncTest: false, deepEqual: false, equal: false, expect: false, module: false, notDeepEqual: false, notEqual: false, notOk: false, notPropEqual: false, notStrictEqual: false, ok: false, propEqual: false, QUnit: false, raises: false, start: false, stop: false, strictEqual: false, test: false, throws: false, }; var phantomjs$1 = { console: true, exports: true, phantom: true, require: true, WebPage: true, }; var couch$1 = { emit: false, exports: false, getRow: false, log: false, module: false, provides: false, require: false, respond: false, send: false, start: false, sum: false, }; var rhino$1 = { defineClass: false, deserialize: false, gc: false, help: false, importClass: false, importPackage: false, java: false, load: false, loadClass: false, Packages: false, print: false, quit: false, readFile: false, readUrl: false, runCommand: false, seal: false, serialize: false, spawn: false, sync: false, toint32: false, version: false, }; var nashorn$1 = { __DIR__: false, __FILE__: false, __LINE__: false, com: false, edu: false, exit: false, java: false, Java: false, javafx: false, JavaImporter: false, javax: false, JSAdapter: false, load: false, loadWithNewGlobal: false, org: false, Packages: false, print: false, quit: false, }; var wsh$1 = { ActiveXObject: true, Enumerator: true, GetObject: true, ScriptEngine: true, ScriptEngineBuildVersion: true, ScriptEngineMajorVersion: true, ScriptEngineMinorVersion: true, VBArray: true, WScript: true, WSH: true, XDomainRequest: true, }; var jquery$1 = { $: false, jQuery: false }; var yui$1 = { YAHOO: false, YAHOO_config: false, YUI: false, YUI_config: false, }; var shelljs$1 = { cat: false, cd: false, chmod: false, config: false, cp: false, dirs: false, echo: false, env: false, error: false, exec: false, exit: false, find: false, grep: false, ln: false, ls: false, mkdir: false, mv: false, popd: false, pushd: false, pwd: false, rm: false, sed: false, set: false, target: false, tempdir: false, test: false, touch: false, which: false, }; var prototypejs$1 = { $: false, $$: false, $A: false, $break: false, $continue: false, $F: false, $H: false, $R: false, $w: false, Abstract: false, Ajax: false, Autocompleter: false, Builder: false, Class: false, Control: false, Draggable: false, Draggables: false, Droppables: false, Effect: false, Element: false, Enumerable: false, Event: false, Field: false, Form: false, Hash: false, Insertion: false, ObjectRange: false, PeriodicalExecuter: false, Position: false, Prototype: false, Scriptaculous: false, Selector: false, Sortable: false, SortableObserver: false, Sound: false, Template: false, Toggle: false, Try: false, }; var meteor$1 = { _: false, $: false, Accounts: false, AccountsClient: false, AccountsCommon: false, AccountsServer: false, App: false, Assets: false, Blaze: false, check: false, Cordova: false, DDP: false, DDPRateLimiter: false, DDPServer: false, Deps: false, EJSON: false, Email: false, HTTP: false, Log: false, Match: false, Meteor: false, Mongo: false, MongoInternals: false, Npm: false, Package: false, Plugin: false, process: false, Random: false, ReactiveDict: false, ReactiveVar: false, Router: false, ServiceConfiguration: false, Session: false, share: false, Spacebars: false, Template: false, Tinytest: false, Tracker: false, UI: false, Utils: false, WebApp: false, WebAppInternals: false, }; var mongo$1 = { _isWindows: false, _rand: false, BulkWriteResult: false, cat: false, cd: false, connect: false, db: false, getHostName: false, getMemInfo: false, hostname: false, ISODate: false, listFiles: false, load: false, ls: false, md5sumFile: false, mkdir: false, Mongo: false, NumberInt: false, NumberLong: false, ObjectId: false, PlanCache: false, print: false, printjson: false, pwd: false, quit: false, removeFile: false, rs: false, sh: false, UUID: false, version: false, WriteResult: false, }; var applescript$1 = { $: false, Application: false, Automation: false, console: false, delay: false, Library: false, ObjC: false, ObjectSpecifier: false, Path: false, Progress: false, Ref: false, }; var serviceworker$1 = { addEventListener: false, applicationCache: false, atob: false, Blob: false, BroadcastChannel: false, btoa: false, Cache: false, caches: false, CacheStorage: false, clearInterval: false, clearTimeout: false, Client: false, clients: false, Clients: false, close: true, console: false, ExtendableEvent: false, ExtendableMessageEvent: false, fetch: false, FetchEvent: false, FileReaderSync: false, FormData: false, Headers: false, IDBCursor: false, IDBCursorWithValue: false, IDBDatabase: false, IDBFactory: false, IDBIndex: false, IDBKeyRange: false, IDBObjectStore: false, IDBOpenDBRequest: false, IDBRequest: false, IDBTransaction: false, IDBVersionChangeEvent: false, ImageData: false, importScripts: false, indexedDB: false, location: false, MessageChannel: false, MessagePort: false, name: false, navigator: false, Notification: false, onclose: true, onconnect: true, onerror: true, onfetch: true, oninstall: true, onlanguagechange: true, onmessage: true, onmessageerror: true, onnotificationclick: true, onnotificationclose: true, onoffline: true, ononline: true, onpush: true, onpushsubscriptionchange: true, onrejectionhandled: true, onsync: true, onunhandledrejection: true, performance: false, Performance: false, PerformanceEntry: false, PerformanceMark: false, PerformanceMeasure: false, PerformanceNavigation: false, PerformanceResourceTiming: false, PerformanceTiming: false, postMessage: true, Promise: false, queueMicrotask: false, registration: false, removeEventListener: false, Request: false, Response: false, self: false, ServiceWorker: false, ServiceWorkerContainer: false, ServiceWorkerGlobalScope: false, ServiceWorkerMessageEvent: false, ServiceWorkerRegistration: false, setInterval: false, setTimeout: false, skipWaiting: false, TextDecoder: false, TextEncoder: false, URL: false, URLSearchParams: false, WebSocket: false, WindowClient: false, Worker: false, WorkerGlobalScope: false, XMLHttpRequest: false, }; var atomtest$1 = { advanceClock: false, fakeClearInterval: false, fakeClearTimeout: false, fakeSetInterval: false, fakeSetTimeout: false, resetTimeouts: false, waitsForPromise: false, }; var embertest$1 = { andThen: false, click: false, currentPath: false, currentRouteName: false, currentURL: false, fillIn: false, find: false, findAll: false, findWithAssert: false, keyEvent: false, pauseTest: false, resumeTest: false, triggerEvent: false, visit: false, wait: false, }; var protractor$1 = { $: false, $$: false, browser: false, by: false, By: false, DartObject: false, element: false, protractor: false, }; var webextensions$1 = { browser: false, chrome: false, opr: false }; var greasemonkey$1 = { cloneInto: false, createObjectIn: false, exportFunction: false, GM: false, GM_addStyle: false, GM_deleteValue: false, GM_getResourceText: false, GM_getResourceURL: false, GM_getValue: false, GM_info: false, GM_listValues: false, GM_log: false, GM_openInTab: false, GM_registerMenuCommand: false, GM_setClipboard: false, GM_setValue: false, GM_xmlhttpRequest: false, unsafeWindow: false, }; var devtools$1 = { $: false, $_: false, $$: false, $0: false, $1: false, $2: false, $3: false, $4: false, $x: false, chrome: false, clear: false, copy: false, debug: false, dir: false, dirxml: false, getEventListeners: false, inspect: false, keys: false, monitor: false, monitorEvents: false, profile: false, profileEnd: false, queryObjects: false, table: false, undebug: false, unmonitor: false, unmonitorEvents: false, values: false, }; var require$$0$2 = { builtin: builtin$1, es5: es5$1, es2015: es2015$1, es2017: es2017$1, browser: browser$2, worker: worker$1, node: node$3, commonjs: commonjs$1, amd: amd$1, mocha: mocha$1, jasmine: jasmine$1, jest: jest$1, qunit: qunit$1, phantomjs: phantomjs$1, couch: couch$1, rhino: rhino$1, nashorn: nashorn$1, wsh: wsh$1, jquery: jquery$1, yui: yui$1, shelljs: shelljs$1, prototypejs: prototypejs$1, meteor: meteor$1, mongo: mongo$1, applescript: applescript$1, serviceworker: serviceworker$1, atomtest: atomtest$1, embertest: embertest$1, protractor: protractor$1, "shared-node-browser": { clearInterval: false, clearTimeout: false, console: false, setInterval: false, setTimeout: false, URL: false, URLSearchParams: false, }, webextensions: webextensions$1, greasemonkey: greasemonkey$1, devtools: devtools$1, }; var globals$1; var hasRequiredGlobals$1; function requireGlobals$1() { if (hasRequiredGlobals$1) return globals$1; hasRequiredGlobals$1 = 1; globals$1 = require$$0$2; return globals$1; } var hasRequiredScope$1; function requireScope$1() { if (hasRequiredScope$1) return scope$1; hasRequiredScope$1 = 1; Object.defineProperty(scope$1, "__esModule", { value: true }); scope$1.default = void 0; var _renamer = requireRenamer$1(); var _index = requireLib$f(); var _binding = requireBinding$1(); var _globals = requireGlobals$1(); var _t = t$d; var t = _t; var _cache = requireCache$1(); var _visitors = requireVisitors$1(); const { NOT_LOCAL_BINDING: NOT_LOCAL_BINDING, callExpression: callExpression, cloneNode: cloneNode, getBindingIdentifiers: getBindingIdentifiers, identifier: identifier, isArrayExpression: isArrayExpression, isBinary: isBinary, isCallExpression: isCallExpression, isClass: isClass, isClassBody: isClassBody, isClassDeclaration: isClassDeclaration, isExportAllDeclaration: isExportAllDeclaration, isExportDefaultDeclaration: isExportDefaultDeclaration, isExportNamedDeclaration: isExportNamedDeclaration, isFunctionDeclaration: isFunctionDeclaration, isIdentifier: isIdentifier, isImportDeclaration: isImportDeclaration, isLiteral: isLiteral, isMemberExpression: isMemberExpression, isMethod: isMethod, isModuleSpecifier: isModuleSpecifier, isNullLiteral: isNullLiteral, isObjectExpression: isObjectExpression, isProperty: isProperty, isPureish: isPureish, isRegExpLiteral: isRegExpLiteral, isSuper: isSuper, isTaggedTemplateExpression: isTaggedTemplateExpression, isTemplateLiteral: isTemplateLiteral, isThisExpression: isThisExpression, isUnaryExpression: isUnaryExpression, isVariableDeclaration: isVariableDeclaration, matchesPattern: matchesPattern, memberExpression: memberExpression, numericLiteral: numericLiteral, toIdentifier: toIdentifier, variableDeclaration: variableDeclaration, variableDeclarator: variableDeclarator, isRecordExpression: isRecordExpression, isTupleExpression: isTupleExpression, isObjectProperty: isObjectProperty, isTopicReference: isTopicReference, isMetaProperty: isMetaProperty, isPrivateName: isPrivateName, isExportDeclaration: isExportDeclaration, buildUndefinedNode: buildUndefinedNode, } = _t; function gatherNodeParts(node, parts) { switch (node == null ? void 0 : node.type) { default: if (isImportDeclaration(node) || isExportDeclaration(node)) { var _node$specifiers; if ( (isExportAllDeclaration(node) || isExportNamedDeclaration(node) || isImportDeclaration(node)) && node.source ) { gatherNodeParts(node.source, parts); } else if ( (isExportNamedDeclaration(node) || isImportDeclaration(node)) && (_node$specifiers = node.specifiers) != null && _node$specifiers.length ) { for (const e of node.specifiers) gatherNodeParts(e, parts); } else if ( (isExportDefaultDeclaration(node) || isExportNamedDeclaration(node)) && node.declaration ) { gatherNodeParts(node.declaration, parts); } } else if (isModuleSpecifier(node)) { gatherNodeParts(node.local, parts); } else if ( isLiteral(node) && !isNullLiteral(node) && !isRegExpLiteral(node) && !isTemplateLiteral(node) ) { parts.push(node.value); } break; case "MemberExpression": case "OptionalMemberExpression": case "JSXMemberExpression": gatherNodeParts(node.object, parts); gatherNodeParts(node.property, parts); break; case "Identifier": case "JSXIdentifier": parts.push(node.name); break; case "CallExpression": case "OptionalCallExpression": case "NewExpression": gatherNodeParts(node.callee, parts); break; case "ObjectExpression": case "ObjectPattern": for (const e of node.properties) { gatherNodeParts(e, parts); } break; case "SpreadElement": case "RestElement": gatherNodeParts(node.argument, parts); break; case "ObjectProperty": case "ObjectMethod": case "ClassProperty": case "ClassMethod": case "ClassPrivateProperty": case "ClassPrivateMethod": gatherNodeParts(node.key, parts); break; case "ThisExpression": parts.push("this"); break; case "Super": parts.push("super"); break; case "Import": parts.push("import"); break; case "DoExpression": parts.push("do"); break; case "YieldExpression": parts.push("yield"); gatherNodeParts(node.argument, parts); break; case "AwaitExpression": parts.push("await"); gatherNodeParts(node.argument, parts); break; case "AssignmentExpression": gatherNodeParts(node.left, parts); break; case "VariableDeclarator": gatherNodeParts(node.id, parts); break; case "FunctionExpression": case "FunctionDeclaration": case "ClassExpression": case "ClassDeclaration": gatherNodeParts(node.id, parts); break; case "PrivateName": gatherNodeParts(node.id, parts); break; case "ParenthesizedExpression": gatherNodeParts(node.expression, parts); break; case "UnaryExpression": case "UpdateExpression": gatherNodeParts(node.argument, parts); break; case "MetaProperty": gatherNodeParts(node.meta, parts); gatherNodeParts(node.property, parts); break; case "JSXElement": gatherNodeParts(node.openingElement, parts); break; case "JSXOpeningElement": gatherNodeParts(node.name, parts); break; case "JSXFragment": gatherNodeParts(node.openingFragment, parts); break; case "JSXOpeningFragment": parts.push("Fragment"); break; case "JSXNamespacedName": gatherNodeParts(node.namespace, parts); gatherNodeParts(node.name, parts); break; } } const collectorVisitor = { ForStatement(path) { const declar = path.get("init"); if (declar.isVar()) { const { scope: scope } = path; const parentScope = scope.getFunctionParent() || scope.getProgramParent(); parentScope.registerBinding("var", declar); } }, Declaration(path) { if (path.isBlockScoped()) return; if (path.isImportDeclaration()) return; if (path.isExportDeclaration()) return; const parent = path.scope.getFunctionParent() || path.scope.getProgramParent(); parent.registerDeclaration(path); }, ImportDeclaration(path) { const parent = path.scope.getBlockParent(); parent.registerDeclaration(path); }, ReferencedIdentifier(path, state) { state.references.push(path); }, ForXStatement(path, state) { const left = path.get("left"); if (left.isPattern() || left.isIdentifier()) { state.constantViolations.push(path); } else if (left.isVar()) { const { scope: scope } = path; const parentScope = scope.getFunctionParent() || scope.getProgramParent(); parentScope.registerBinding("var", left); } }, ExportDeclaration: { exit(path) { const { node: node, scope: scope } = path; if (isExportAllDeclaration(node)) return; const declar = node.declaration; if (isClassDeclaration(declar) || isFunctionDeclaration(declar)) { const id = declar.id; if (!id) return; const binding = scope.getBinding(id.name); binding == null || binding.reference(path); } else if (isVariableDeclaration(declar)) { for (const decl of declar.declarations) { for (const name of Object.keys(getBindingIdentifiers(decl))) { const binding = scope.getBinding(name); binding == null || binding.reference(path); } } } }, }, LabeledStatement(path) { path.scope.getBlockParent().registerDeclaration(path); }, AssignmentExpression(path, state) { state.assignments.push(path); }, UpdateExpression(path, state) { state.constantViolations.push(path); }, UnaryExpression(path, state) { if (path.node.operator === "delete") { state.constantViolations.push(path); } }, BlockScoped(path) { let scope = path.scope; if (scope.path === path) scope = scope.parent; const parent = scope.getBlockParent(); parent.registerDeclaration(path); if (path.isClassDeclaration() && path.node.id) { const id = path.node.id; const name = id.name; path.scope.bindings[name] = path.scope.parent.getBinding(name); } }, CatchClause(path) { path.scope.registerBinding("let", path); }, Function(path) { const params = path.get("params"); for (const param of params) { path.scope.registerBinding("param", param); } if ( path.isFunctionExpression() && path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING] ) { path.scope.registerBinding("local", path.get("id"), path); } }, ClassExpression(path) { if (path.has("id") && !path.get("id").node[NOT_LOCAL_BINDING]) { path.scope.registerBinding("local", path); } }, }; let uid = 0; class Scope { constructor(path) { this.uid = void 0; this.path = void 0; this.block = void 0; this.labels = void 0; this.inited = void 0; this.bindings = void 0; this.references = void 0; this.globals = void 0; this.uids = void 0; this.data = void 0; this.crawling = void 0; const { node: node } = path; const cached = _cache.scope.get(node); if ((cached == null ? void 0 : cached.path) === path) { return cached; } _cache.scope.set(node, this); this.uid = uid++; this.block = node; this.path = path; this.labels = new Map(); this.inited = false; } get parent() { var _parent; let parent, path = this.path; do { const shouldSkip = path.key === "key" || path.listKey === "decorators"; path = path.parentPath; if (shouldSkip && path.isMethod()) path = path.parentPath; if (path && path.isScope()) parent = path; } while (path && !parent); return (_parent = parent) == null ? void 0 : _parent.scope; } get parentBlock() { return this.path.parent; } get hub() { return this.path.hub; } traverse(node, opts, state) { (0, _index.default)(node, opts, this, state, this.path); } generateDeclaredUidIdentifier(name) { const id = this.generateUidIdentifier(name); this.push({ id: id }); return cloneNode(id); } generateUidIdentifier(name) { return identifier(this.generateUid(name)); } generateUid(name = "temp") { name = toIdentifier(name) .replace(/^_+/, "") .replace(/[0-9]+$/g, ""); let uid; let i = 1; do { uid = this._generateUid(name, i); i++; } while ( this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid) ); const program = this.getProgramParent(); program.references[uid] = true; program.uids[uid] = true; return uid; } _generateUid(name, i) { let id = name; if (i > 1) id += i; return `_${id}`; } generateUidBasedOnNode(node, defaultName) { const parts = []; gatherNodeParts(node, parts); let id = parts.join("$"); id = id.replace(/^_/, "") || defaultName || "ref"; return this.generateUid(id.slice(0, 20)); } generateUidIdentifierBasedOnNode(node, defaultName) { return identifier(this.generateUidBasedOnNode(node, defaultName)); } isStatic(node) { if (isThisExpression(node) || isSuper(node) || isTopicReference(node)) { return true; } if (isIdentifier(node)) { const binding = this.getBinding(node.name); if (binding) { return binding.constant; } else { return this.hasBinding(node.name); } } return false; } maybeGenerateMemoised(node, dontPush) { if (this.isStatic(node)) { return null; } else { const id = this.generateUidIdentifierBasedOnNode(node); if (!dontPush) { this.push({ id: id }); return cloneNode(id); } return id; } } checkBlockScopedCollisions(local, kind, name, id) { if (kind === "param") return; if (local.kind === "local") return; const duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || (local.kind === "param" && kind === "const"); if (duplicate) { throw this.hub.buildError( id, `Duplicate declaration "${name}"`, TypeError, ); } } rename(oldName, newName) { const binding = this.getBinding(oldName); if (binding) { newName || (newName = this.generateUidIdentifier(oldName).name); const renamer = new _renamer.default(binding, oldName, newName); { renamer.rename(arguments[2]); } } } _renameFromMap(map, oldName, newName, value) { if (map[oldName]) { map[newName] = value; map[oldName] = null; } } dump() { const sep = "-".repeat(60); console.log(sep); let scope = this; do { console.log("#", scope.block.type); for (const name of Object.keys(scope.bindings)) { const binding = scope.bindings[name]; console.log(" -", name, { constant: binding.constant, references: binding.references, violations: binding.constantViolations.length, kind: binding.kind, }); } } while ((scope = scope.parent)); console.log(sep); } toArray(node, i, arrayLikeIsIterable) { if (isIdentifier(node)) { const binding = this.getBinding(node.name); if ( binding != null && binding.constant && binding.path.isGenericType("Array") ) { return node; } } if (isArrayExpression(node)) { return node; } if (isIdentifier(node, { name: "arguments" })) { return callExpression( memberExpression( memberExpression( memberExpression(identifier("Array"), identifier("prototype")), identifier("slice"), ), identifier("call"), ), [node], ); } let helperName; const args = [node]; if (i === true) { helperName = "toConsumableArray"; } else if (typeof i === "number") { args.push(numericLiteral(i)); helperName = "slicedToArray"; } else { helperName = "toArray"; } if (arrayLikeIsIterable) { args.unshift(this.hub.addHelper(helperName)); helperName = "maybeArrayLike"; } return callExpression(this.hub.addHelper(helperName), args); } hasLabel(name) { return !!this.getLabel(name); } getLabel(name) { return this.labels.get(name); } registerLabel(path) { this.labels.set(path.node.label.name, path); } registerDeclaration(path) { if (path.isLabeledStatement()) { this.registerLabel(path); } else if (path.isFunctionDeclaration()) { this.registerBinding("hoisted", path.get("id"), path); } else if (path.isVariableDeclaration()) { const declarations = path.get("declarations"); const { kind: kind } = path.node; for (const declar of declarations) { this.registerBinding( kind === "using" || kind === "await using" ? "const" : kind, declar, ); } } else if (path.isClassDeclaration()) { if (path.node.declare) return; this.registerBinding("let", path); } else if (path.isImportDeclaration()) { const isTypeDeclaration = path.node.importKind === "type" || path.node.importKind === "typeof"; const specifiers = path.get("specifiers"); for (const specifier of specifiers) { const isTypeSpecifier = isTypeDeclaration || (specifier.isImportSpecifier() && (specifier.node.importKind === "type" || specifier.node.importKind === "typeof")); this.registerBinding( isTypeSpecifier ? "unknown" : "module", specifier, ); } } else if (path.isExportDeclaration()) { const declar = path.get("declaration"); if ( declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration() ) { this.registerDeclaration(declar); } } else { this.registerBinding("unknown", path); } } buildUndefinedNode() { return buildUndefinedNode(); } registerConstantViolation(path) { const ids = path.getBindingIdentifiers(); for (const name of Object.keys(ids)) { var _this$getBinding; (_this$getBinding = this.getBinding(name)) == null || _this$getBinding.reassign(path); } } registerBinding(kind, path, bindingPath = path) { if (!kind) throw new ReferenceError("no `kind`"); if (path.isVariableDeclaration()) { const declarators = path.get("declarations"); for (const declar of declarators) { this.registerBinding(kind, declar); } return; } const parent = this.getProgramParent(); const ids = path.getOuterBindingIdentifiers(true); for (const name of Object.keys(ids)) { parent.references[name] = true; for (const id of ids[name]) { const local = this.getOwnBinding(name); if (local) { if (local.identifier === id) continue; this.checkBlockScopedCollisions(local, kind, name, id); } if (local) { this.registerConstantViolation(bindingPath); } else { this.bindings[name] = new _binding.default({ identifier: id, scope: this, path: bindingPath, kind: kind, }); } } } } addGlobal(node) { this.globals[node.name] = node; } hasUid(name) { let scope = this; do { if (scope.uids[name]) return true; } while ((scope = scope.parent)); return false; } hasGlobal(name) { let scope = this; do { if (scope.globals[name]) return true; } while ((scope = scope.parent)); return false; } hasReference(name) { return !!this.getProgramParent().references[name]; } isPure(node, constantsOnly) { if (isIdentifier(node)) { const binding = this.getBinding(node.name); if (!binding) return false; if (constantsOnly) return binding.constant; return true; } else if ( isThisExpression(node) || isMetaProperty(node) || isTopicReference(node) || isPrivateName(node) ) { return true; } else if (isClass(node)) { var _node$decorators; if (node.superClass && !this.isPure(node.superClass, constantsOnly)) { return false; } if ( ((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length) > 0 ) { return false; } return this.isPure(node.body, constantsOnly); } else if (isClassBody(node)) { for (const method of node.body) { if (!this.isPure(method, constantsOnly)) return false; } return true; } else if (isBinary(node)) { return ( this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly) ); } else if (isArrayExpression(node) || isTupleExpression(node)) { for (const elem of node.elements) { if (elem !== null && !this.isPure(elem, constantsOnly)) return false; } return true; } else if (isObjectExpression(node) || isRecordExpression(node)) { for (const prop of node.properties) { if (!this.isPure(prop, constantsOnly)) return false; } return true; } else if (isMethod(node)) { var _node$decorators2; if (node.computed && !this.isPure(node.key, constantsOnly)) return false; if ( ((_node$decorators2 = node.decorators) == null ? void 0 : _node$decorators2.length) > 0 ) { return false; } return true; } else if (isProperty(node)) { var _node$decorators3; if (node.computed && !this.isPure(node.key, constantsOnly)) return false; if ( ((_node$decorators3 = node.decorators) == null ? void 0 : _node$decorators3.length) > 0 ) { return false; } if (isObjectProperty(node) || node.static) { if (node.value !== null && !this.isPure(node.value, constantsOnly)) { return false; } } return true; } else if (isUnaryExpression(node)) { return this.isPure(node.argument, constantsOnly); } else if (isTemplateLiteral(node)) { for (const expression of node.expressions) { if (!this.isPure(expression, constantsOnly)) return false; } return true; } else if (isTaggedTemplateExpression(node)) { return ( matchesPattern(node.tag, "String.raw") && !this.hasBinding("String", { noGlobals: true }) && this.isPure(node.quasi, constantsOnly) ); } else if (isMemberExpression(node)) { return ( !node.computed && isIdentifier(node.object) && node.object.name === "Symbol" && isIdentifier(node.property) && node.property.name !== "for" && !this.hasBinding("Symbol", { noGlobals: true }) ); } else if (isCallExpression(node)) { return ( matchesPattern(node.callee, "Symbol.for") && !this.hasBinding("Symbol", { noGlobals: true }) && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]) ); } else { return isPureish(node); } } setData(key, val) { return (this.data[key] = val); } getData(key) { let scope = this; do { const data = scope.data[key]; if (data != null) return data; } while ((scope = scope.parent)); } removeData(key) { let scope = this; do { const data = scope.data[key]; if (data != null) scope.data[key] = null; } while ((scope = scope.parent)); } init() { if (!this.inited) { this.inited = true; this.crawl(); } } crawl() { const path = this.path; this.references = Object.create(null); this.bindings = Object.create(null); this.globals = Object.create(null); this.uids = Object.create(null); this.data = Object.create(null); const programParent = this.getProgramParent(); if (programParent.crawling) return; const state = { references: [], constantViolations: [], assignments: [] }; this.crawling = true; if ( path.type !== "Program" && (0, _visitors.isExplodedVisitor)(collectorVisitor) ) { for (const visit of collectorVisitor.enter) { visit.call(state, path, state); } const typeVisitors = collectorVisitor[path.type]; if (typeVisitors) { for (const visit of typeVisitors.enter) { visit.call(state, path, state); } } } path.traverse(collectorVisitor, state); this.crawling = false; for (const path of state.assignments) { const ids = path.getBindingIdentifiers(); for (const name of Object.keys(ids)) { if (path.scope.getBinding(name)) continue; programParent.addGlobal(ids[name]); } path.scope.registerConstantViolation(path); } for (const ref of state.references) { const binding = ref.scope.getBinding(ref.node.name); if (binding) { binding.reference(ref); } else { programParent.addGlobal(ref.node); } } for (const path of state.constantViolations) { path.scope.registerConstantViolation(path); } } push(opts) { let path = this.path; if (path.isPattern()) { path = this.getPatternParent().path; } else if (!path.isBlockStatement() && !path.isProgram()) { path = this.getBlockParent().path; } if (path.isSwitchStatement()) { path = (this.getFunctionParent() || this.getProgramParent()).path; } const { init: init, unique: unique, kind: kind = "var", id: id } = opts; if ( !init && !unique && (kind === "var" || kind === "let") && path.isFunction() && !path.node.name && isCallExpression(path.parent, { callee: path.node }) && path.parent.arguments.length <= path.node.params.length && isIdentifier(id) ) { path.pushContainer("params", id); path.scope.registerBinding( "param", path.get("params")[path.node.params.length - 1], ); return; } if (path.isLoop() || path.isCatchClause() || path.isFunction()) { path.ensureBlock(); path = path.get("body"); } const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; const dataKey = `declaration:${kind}:${blockHoist}`; let declarPath = !unique && path.getData(dataKey); if (!declarPath) { const declar = variableDeclaration(kind, []); declar._blockHoist = blockHoist; [declarPath] = path.unshiftContainer("body", [declar]); if (!unique) path.setData(dataKey, declarPath); } const declarator = variableDeclarator(id, init); const len = declarPath.node.declarations.push(declarator); path.scope.registerBinding(kind, declarPath.get("declarations")[len - 1]); } getProgramParent() { let scope = this; do { if (scope.path.isProgram()) { return scope; } } while ((scope = scope.parent)); throw new Error("Couldn't find a Program"); } getFunctionParent() { let scope = this; do { if (scope.path.isFunctionParent()) { return scope; } } while ((scope = scope.parent)); return null; } getBlockParent() { let scope = this; do { if (scope.path.isBlockParent()) { return scope; } } while ((scope = scope.parent)); throw new Error( "We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...", ); } getPatternParent() { let scope = this; do { if (!scope.path.isPattern()) { return scope.getBlockParent(); } } while ((scope = scope.parent.parent)); throw new Error( "We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...", ); } getAllBindings() { const ids = Object.create(null); let scope = this; do { for (const key of Object.keys(scope.bindings)) { if (key in ids === false) { ids[key] = scope.bindings[key]; } } scope = scope.parent; } while (scope); return ids; } getAllBindingsOfKind(...kinds) { const ids = Object.create(null); for (const kind of kinds) { let scope = this; do { for (const name of Object.keys(scope.bindings)) { const binding = scope.bindings[name]; if (binding.kind === kind) ids[name] = binding; } scope = scope.parent; } while (scope); } return ids; } bindingIdentifierEquals(name, node) { return this.getBindingIdentifier(name) === node; } getBinding(name) { let scope = this; let previousPath; do { const binding = scope.getOwnBinding(name); if (binding) { var _previousPath; if ( (_previousPath = previousPath) != null && _previousPath.isPattern() && binding.kind !== "param" && binding.kind !== "local" ); else { return binding; } } else if ( !binding && name === "arguments" && scope.path.isFunction() && !scope.path.isArrowFunctionExpression() ) { break; } previousPath = scope.path; } while ((scope = scope.parent)); } getOwnBinding(name) { return this.bindings[name]; } getBindingIdentifier(name) { var _this$getBinding2; return (_this$getBinding2 = this.getBinding(name)) == null ? void 0 : _this$getBinding2.identifier; } getOwnBindingIdentifier(name) { const binding = this.bindings[name]; return binding == null ? void 0 : binding.identifier; } hasOwnBinding(name) { return !!this.getOwnBinding(name); } hasBinding(name, opts) { var _opts, _opts2, _opts3; if (!name) return false; if (this.hasOwnBinding(name)) return true; { if (typeof opts === "boolean") opts = { noGlobals: opts }; } if (this.parentHasBinding(name, opts)) return true; if (!((_opts = opts) != null && _opts.noUids) && this.hasUid(name)) return true; if ( !((_opts2 = opts) != null && _opts2.noGlobals) && Scope.globals.includes(name) ) return true; if ( !((_opts3 = opts) != null && _opts3.noGlobals) && Scope.contextVariables.includes(name) ) return true; return false; } parentHasBinding(name, opts) { var _this$parent; return (_this$parent = this.parent) == null ? void 0 : _this$parent.hasBinding(name, opts); } moveBindingTo(name, scope) { const info = this.getBinding(name); if (info) { info.scope.removeOwnBinding(name); info.scope = scope; scope.bindings[name] = info; } } removeOwnBinding(name) { delete this.bindings[name]; } removeBinding(name) { var _this$getBinding3; (_this$getBinding3 = this.getBinding(name)) == null || _this$getBinding3.scope.removeOwnBinding(name); let scope = this; do { if (scope.uids[name]) { scope.uids[name] = false; } } while ((scope = scope.parent)); } } scope$1.default = Scope; Scope.globals = Object.keys(_globals.builtin); Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"]; return scope$1; } var lib$o = {}; var sourceMap$3 = {}; var genMapping_umd = { exports: {} }; var setArray_umd = { exports: {} }; var hasRequiredSetArray_umd; function requireSetArray_umd() { if (hasRequiredSetArray_umd) return setArray_umd.exports; hasRequiredSetArray_umd = 1; (function (module, exports) { (function (global, factory) { factory(exports); })(commonjsGlobal, function (exports) { class SetArray { constructor() { this._indexes = { __proto__: null }; this.array = []; } } function cast(set) { return set; } function get(setarr, key) { return cast(setarr)._indexes[key]; } function put(setarr, key) { const index = get(setarr, key); if (index !== undefined) return index; const { array: array, _indexes: indexes } = cast(setarr); const length = array.push(key); return (indexes[key] = length - 1); } function pop(setarr) { const { array: array, _indexes: indexes } = cast(setarr); if (array.length === 0) return; const last = array.pop(); indexes[last] = undefined; } function remove(setarr, key) { const index = get(setarr, key); if (index === undefined) return; const { array: array, _indexes: indexes } = cast(setarr); for (let i = index + 1; i < array.length; i++) { const k = array[i]; array[i - 1] = k; indexes[k]--; } indexes[key] = undefined; array.pop(); } exports.SetArray = SetArray; exports.get = get; exports.pop = pop; exports.put = put; exports.remove = remove; Object.defineProperty(exports, "__esModule", { value: true }); }); })(setArray_umd, setArray_umd.exports); return setArray_umd.exports; } var sourcemapCodec_umd$2 = { exports: {} }; var hasRequiredSourcemapCodec_umd$2; function requireSourcemapCodec_umd$2() { if (hasRequiredSourcemapCodec_umd$2) return sourcemapCodec_umd$2.exports; hasRequiredSourcemapCodec_umd$2 = 1; (function (module, exports) { (function (global, factory) { factory(exports); })(commonjsGlobal, function (exports) { const comma = ",".charCodeAt(0); const semicolon = ";".charCodeAt(0); const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const intToChar = new Uint8Array(64); const charToInt = new Uint8Array(128); for (let i = 0; i < chars.length; i++) { const c = chars.charCodeAt(i); intToChar[i] = c; charToInt[c] = i; } const td = typeof TextDecoder !== "undefined" ? new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) { const out = Buffer.from( buf.buffer, buf.byteOffset, buf.byteLength, ); return out.toString(); }, } : { decode(buf) { let out = ""; for (let i = 0; i < buf.length; i++) { out += String.fromCharCode(buf[i]); } return out; }, }; function decode(mappings) { const state = new Int32Array(5); const decoded = []; let index = 0; do { const semi = indexOf(mappings, index); const line = []; let sorted = true; let lastCol = 0; state[0] = 0; for (let i = index; i < semi; i++) { let seg; i = decodeInteger(mappings, i, state, 0); const col = state[0]; if (col < lastCol) sorted = false; lastCol = col; if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 1); i = decodeInteger(mappings, i, state, 2); i = decodeInteger(mappings, i, state, 3); if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 4); seg = [col, state[1], state[2], state[3], state[4]]; } else { seg = [col, state[1], state[2], state[3]]; } } else { seg = [col]; } line.push(seg); } if (!sorted) sort(line); decoded.push(line); index = semi + 1; } while (index <= mappings.length); return decoded; } function indexOf(mappings, index) { const idx = mappings.indexOf(";", index); return idx === -1 ? mappings.length : idx; } function decodeInteger(mappings, pos, state, j) { let value = 0; let shift = 0; let integer = 0; do { const c = mappings.charCodeAt(pos++); integer = charToInt[c]; value |= (integer & 31) << shift; shift += 5; } while (integer & 32); const shouldNegate = value & 1; value >>>= 1; if (shouldNegate) { value = -2147483648 | -value; } state[j] += value; return pos; } function hasMoreVlq(mappings, i, length) { if (i >= length) return false; return mappings.charCodeAt(i) !== comma; } function sort(line) { line.sort(sortComparator); } function sortComparator(a, b) { return a[0] - b[0]; } function encode(decoded) { const state = new Int32Array(5); const bufLength = 1024 * 16; const subLength = bufLength - 36; const buf = new Uint8Array(bufLength); const sub = buf.subarray(0, subLength); let pos = 0; let out = ""; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; if (i > 0) { if (pos === bufLength) { out += td.decode(buf); pos = 0; } buf[pos++] = semicolon; } if (line.length === 0) continue; state[0] = 0; for (let j = 0; j < line.length; j++) { const segment = line[j]; if (pos > subLength) { out += td.decode(sub); buf.copyWithin(0, subLength, pos); pos -= subLength; } if (j > 0) buf[pos++] = comma; pos = encodeInteger(buf, pos, state, segment, 0); if (segment.length === 1) continue; pos = encodeInteger(buf, pos, state, segment, 1); pos = encodeInteger(buf, pos, state, segment, 2); pos = encodeInteger(buf, pos, state, segment, 3); if (segment.length === 4) continue; pos = encodeInteger(buf, pos, state, segment, 4); } } return out + td.decode(buf.subarray(0, pos)); } function encodeInteger(buf, pos, state, segment, j) { const next = segment[j]; let num = next - state[j]; state[j] = next; num = num < 0 ? (-num << 1) | 1 : num << 1; do { let clamped = num & 31; num >>>= 5; if (num > 0) clamped |= 32; buf[pos++] = intToChar[clamped]; } while (num > 0); return pos; } exports.decode = decode; exports.encode = encode; Object.defineProperty(exports, "__esModule", { value: true }); }); })(sourcemapCodec_umd$2, sourcemapCodec_umd$2.exports); return sourcemapCodec_umd$2.exports; } var traceMapping_umd$1 = { exports: {} }; var sourcemapCodec_umd$1 = { exports: {} }; var hasRequiredSourcemapCodec_umd$1; function requireSourcemapCodec_umd$1() { if (hasRequiredSourcemapCodec_umd$1) return sourcemapCodec_umd$1.exports; hasRequiredSourcemapCodec_umd$1 = 1; (function (module, exports) { (function (global, factory) { factory(exports); })(commonjsGlobal, function (exports) { const comma = ",".charCodeAt(0); const semicolon = ";".charCodeAt(0); const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const intToChar = new Uint8Array(64); const charToInt = new Uint8Array(128); for (let i = 0; i < chars.length; i++) { const c = chars.charCodeAt(i); intToChar[i] = c; charToInt[c] = i; } const td = typeof TextDecoder !== "undefined" ? new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) { const out = Buffer.from( buf.buffer, buf.byteOffset, buf.byteLength, ); return out.toString(); }, } : { decode(buf) { let out = ""; for (let i = 0; i < buf.length; i++) { out += String.fromCharCode(buf[i]); } return out; }, }; function decode(mappings) { const state = new Int32Array(5); const decoded = []; let index = 0; do { const semi = indexOf(mappings, index); const line = []; let sorted = true; let lastCol = 0; state[0] = 0; for (let i = index; i < semi; i++) { let seg; i = decodeInteger(mappings, i, state, 0); const col = state[0]; if (col < lastCol) sorted = false; lastCol = col; if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 1); i = decodeInteger(mappings, i, state, 2); i = decodeInteger(mappings, i, state, 3); if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 4); seg = [col, state[1], state[2], state[3], state[4]]; } else { seg = [col, state[1], state[2], state[3]]; } } else { seg = [col]; } line.push(seg); } if (!sorted) sort(line); decoded.push(line); index = semi + 1; } while (index <= mappings.length); return decoded; } function indexOf(mappings, index) { const idx = mappings.indexOf(";", index); return idx === -1 ? mappings.length : idx; } function decodeInteger(mappings, pos, state, j) { let value = 0; let shift = 0; let integer = 0; do { const c = mappings.charCodeAt(pos++); integer = charToInt[c]; value |= (integer & 31) << shift; shift += 5; } while (integer & 32); const shouldNegate = value & 1; value >>>= 1; if (shouldNegate) { value = -2147483648 | -value; } state[j] += value; return pos; } function hasMoreVlq(mappings, i, length) { if (i >= length) return false; return mappings.charCodeAt(i) !== comma; } function sort(line) { line.sort(sortComparator); } function sortComparator(a, b) { return a[0] - b[0]; } function encode(decoded) { const state = new Int32Array(5); const bufLength = 1024 * 16; const subLength = bufLength - 36; const buf = new Uint8Array(bufLength); const sub = buf.subarray(0, subLength); let pos = 0; let out = ""; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; if (i > 0) { if (pos === bufLength) { out += td.decode(buf); pos = 0; } buf[pos++] = semicolon; } if (line.length === 0) continue; state[0] = 0; for (let j = 0; j < line.length; j++) { const segment = line[j]; if (pos > subLength) { out += td.decode(sub); buf.copyWithin(0, subLength, pos); pos -= subLength; } if (j > 0) buf[pos++] = comma; pos = encodeInteger(buf, pos, state, segment, 0); if (segment.length === 1) continue; pos = encodeInteger(buf, pos, state, segment, 1); pos = encodeInteger(buf, pos, state, segment, 2); pos = encodeInteger(buf, pos, state, segment, 3); if (segment.length === 4) continue; pos = encodeInteger(buf, pos, state, segment, 4); } } return out + td.decode(buf.subarray(0, pos)); } function encodeInteger(buf, pos, state, segment, j) { const next = segment[j]; let num = next - state[j]; state[j] = next; num = num < 0 ? (-num << 1) | 1 : num << 1; do { let clamped = num & 31; num >>>= 5; if (num > 0) clamped |= 32; buf[pos++] = intToChar[clamped]; } while (num > 0); return pos; } exports.decode = decode; exports.encode = encode; Object.defineProperty(exports, "__esModule", { value: true }); }); })(sourcemapCodec_umd$1, sourcemapCodec_umd$1.exports); return sourcemapCodec_umd$1.exports; } var resolveUri_umd$1 = { exports: {} }; var hasRequiredResolveUri_umd$1; function requireResolveUri_umd$1() { if (hasRequiredResolveUri_umd$1) return resolveUri_umd$1.exports; hasRequiredResolveUri_umd$1 = 1; (function (module, exports) { (function (global, factory) { module.exports = factory(); })(commonjsGlobal, function () { const schemeRegex = /^[\w+.-]+:\/\//; const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; function isAbsoluteUrl(input) { return schemeRegex.test(input); } function isSchemeRelativeUrl(input) { return input.startsWith("//"); } function isAbsolutePath(input) { return input.startsWith("/"); } function isFileUrl(input) { return input.startsWith("file:"); } function isRelative(input) { return /^[.?#]/.test(input); } function parseAbsoluteUrl(input) { const match = urlRegex.exec(input); return makeUrl( match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "", ); } function parseFileUrl(input) { const match = fileRegex.exec(input); const path = match[2]; return makeUrl( "file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "", ); } function makeUrl(scheme, user, host, port, path, query, hash) { return { scheme: scheme, user: user, host: host, port: port, path: path, query: query, hash: hash, type: 7, }; } function parseUrl(input) { if (isSchemeRelativeUrl(input)) { const url = parseAbsoluteUrl("http:" + input); url.scheme = ""; url.type = 6; return url; } if (isAbsolutePath(input)) { const url = parseAbsoluteUrl("http://foo.com" + input); url.scheme = ""; url.host = ""; url.type = 5; return url; } if (isFileUrl(input)) return parseFileUrl(input); if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input); const url = parseAbsoluteUrl("http://foo.com/" + input); url.scheme = ""; url.host = ""; url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1; return url; } function stripPathFilename(path) { if (path.endsWith("/..")) return path; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } function mergePaths(url, base) { normalizePath(base, base.type); if (url.path === "/") { url.path = base.path; } else { url.path = stripPathFilename(base.path) + url.path; } } function normalizePath(url, type) { const rel = type <= 4; const pieces = url.path.split("/"); let pointer = 1; let positive = 0; let addTrailingSlash = false; for (let i = 1; i < pieces.length; i++) { const piece = pieces[i]; if (!piece) { addTrailingSlash = true; continue; } addTrailingSlash = false; if (piece === ".") continue; if (piece === "..") { if (positive) { addTrailingSlash = true; positive--; pointer--; } else if (rel) { pieces[pointer++] = piece; } continue; } pieces[pointer++] = piece; positive++; } let path = ""; for (let i = 1; i < pointer; i++) { path += "/" + pieces[i]; } if (!path || (addTrailingSlash && !path.endsWith("/.."))) { path += "/"; } url.path = path; } function resolve(input, base) { if (!input && !base) return ""; const url = parseUrl(input); let inputType = url.type; if (base && inputType !== 7) { const baseUrl = parseUrl(base); const baseType = baseUrl.type; switch (inputType) { case 1: url.hash = baseUrl.hash; case 2: url.query = baseUrl.query; case 3: case 4: mergePaths(url, baseUrl); case 5: url.user = baseUrl.user; url.host = baseUrl.host; url.port = baseUrl.port; case 6: url.scheme = baseUrl.scheme; } if (baseType > inputType) inputType = baseType; } normalizePath(url, inputType); const queryHash = url.query + url.hash; switch (inputType) { case 2: case 3: return queryHash; case 4: { const path = url.path.slice(1); if (!path) return queryHash || "."; if (isRelative(base || input) && !isRelative(path)) { return "./" + path + queryHash; } return path + queryHash; } case 5: return url.path + queryHash; default: return ( url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash ); } } return resolve; }); })(resolveUri_umd$1); return resolveUri_umd$1.exports; } var hasRequiredTraceMapping_umd$1; function requireTraceMapping_umd$1() { if (hasRequiredTraceMapping_umd$1) return traceMapping_umd$1.exports; hasRequiredTraceMapping_umd$1 = 1; (function (module, exports) { (function (global, factory) { factory( exports, requireSourcemapCodec_umd$1(), requireResolveUri_umd$1(), ); })(commonjsGlobal, function (exports, sourcemapCodec, resolveUri) { function resolve(input, base) { if (base && !base.endsWith("/")) base += "/"; return resolveUri(input, base); } function stripFilename(path) { if (!path) return ""; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } const COLUMN = 0; const SOURCES_INDEX = 1; const SOURCE_LINE = 2; const SOURCE_COLUMN = 3; const NAMES_INDEX = 4; const REV_GENERATED_LINE = 1; const REV_GENERATED_COLUMN = 2; function maybeSort(mappings, owned) { const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); if (unsortedIndex === mappings.length) return mappings; if (!owned) mappings = mappings.slice(); for ( let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1) ) { mappings[i] = sortSegments(mappings[i], owned); } return mappings; } function nextUnsortedSegmentLine(mappings, start) { for (let i = start; i < mappings.length; i++) { if (!isSorted(mappings[i])) return i; } return mappings.length; } function isSorted(line) { for (let j = 1; j < line.length; j++) { if (line[j][COLUMN] < line[j - 1][COLUMN]) { return false; } } return true; } function sortSegments(line, owned) { if (!owned) line = line.slice(); return line.sort(sortComparator); } function sortComparator(a, b) { return a[COLUMN] - b[COLUMN]; } let found = false; function binarySearch(haystack, needle, low, high) { while (low <= high) { const mid = low + ((high - low) >> 1); const cmp = haystack[mid][COLUMN] - needle; if (cmp === 0) { found = true; return mid; } if (cmp < 0) { low = mid + 1; } else { high = mid - 1; } } found = false; return low - 1; } function upperBound(haystack, needle, index) { for (let i = index + 1; i < haystack.length; index = i++) { if (haystack[i][COLUMN] !== needle) break; } return index; } function lowerBound(haystack, needle, index) { for (let i = index - 1; i >= 0; index = i--) { if (haystack[i][COLUMN] !== needle) break; } return index; } function memoizedState() { return { lastKey: -1, lastNeedle: -1, lastIndex: -1 }; } function memoizedBinarySearch(haystack, needle, state, key) { const { lastKey: lastKey, lastNeedle: lastNeedle, lastIndex: lastIndex, } = state; let low = 0; let high = haystack.length - 1; if (key === lastKey) { if (needle === lastNeedle) { found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; return lastIndex; } if (needle >= lastNeedle) { low = lastIndex === -1 ? 0 : lastIndex; } else { high = lastIndex; } } state.lastKey = key; state.lastNeedle = needle; return (state.lastIndex = binarySearch(haystack, needle, low, high)); } function buildBySources(decoded, memos) { const sources = memos.map(buildNullArray); for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; if (seg.length === 1) continue; const sourceIndex = seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; const originalSource = sources[sourceIndex]; const originalLine = originalSource[sourceLine] || (originalSource[sourceLine] = []); const memo = memos[sourceIndex]; let index = upperBound( originalLine, sourceColumn, memoizedBinarySearch( originalLine, sourceColumn, memo, sourceLine, ), ); memo.lastIndex = ++index; insert(originalLine, index, [sourceColumn, i, seg[COLUMN]]); } } return sources; } function insert(array, index, value) { for (let i = array.length; i > index; i--) { array[i] = array[i - 1]; } array[index] = value; } function buildNullArray() { return { __proto__: null }; } const AnyMap = function (map, mapUrl) { const parsed = parse(map); if (!("sections" in parsed)) { return new TraceMap(parsed, mapUrl); } const mappings = []; const sources = []; const sourcesContent = []; const names = []; const ignoreList = []; recurse( parsed, mapUrl, mappings, sources, sourcesContent, names, ignoreList, 0, 0, Infinity, Infinity, ); const joined = { version: 3, file: parsed.file, names: names, sources: sources, sourcesContent: sourcesContent, mappings: mappings, ignoreList: ignoreList, }; return presortedDecodedMap(joined); }; function parse(map) { return typeof map === "string" ? JSON.parse(map) : map; } function recurse( input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn, ) { const { sections: sections } = input; for (let i = 0; i < sections.length; i++) { const { map: map, offset: offset } = sections[i]; let sl = stopLine; let sc = stopColumn; if (i + 1 < sections.length) { const nextOffset = sections[i + 1].offset; sl = Math.min(stopLine, lineOffset + nextOffset.line); if (sl === stopLine) { sc = Math.min(stopColumn, columnOffset + nextOffset.column); } else if (sl < stopLine) { sc = columnOffset + nextOffset.column; } } addSection( map, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset + offset.line, columnOffset + offset.column, sl, sc, ); } } function addSection( input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn, ) { const parsed = parse(input); if ("sections" in parsed) return recurse(...arguments); const map = new TraceMap(parsed, mapUrl); const sourcesOffset = sources.length; const namesOffset = names.length; const decoded = decodedMappings(map); const { resolvedSources: resolvedSources, sourcesContent: contents, ignoreList: ignores, } = map; append(sources, resolvedSources); append(names, map.names); if (contents) append(sourcesContent, contents); else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset); for (let i = 0; i < decoded.length; i++) { const lineI = lineOffset + i; if (lineI > stopLine) return; const out = getLine(mappings, lineI); const cOffset = i === 0 ? columnOffset : 0; const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const column = cOffset + seg[COLUMN]; if (lineI === stopLine && column >= stopColumn) return; if (seg.length === 1) { out.push([column]); continue; } const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; out.push( seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [ column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX], ], ); } } } function append(arr, other) { for (let i = 0; i < other.length; i++) arr.push(other[i]); } function getLine(arr, index) { for (let i = arr.length; i <= index; i++) arr[i] = []; return arr[index]; } const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; const COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; const LEAST_UPPER_BOUND = -1; const GREATEST_LOWER_BOUND = 1; class TraceMap { constructor(map, mapUrl) { const isString = typeof map === "string"; if (!isString && map._decodedMemo) return map; const parsed = isString ? JSON.parse(map) : map; const { version: version, file: file, names: names, sourceRoot: sourceRoot, sources: sources, sourcesContent: sourcesContent, } = parsed; this.version = version; this.file = file; this.names = names || []; this.sourceRoot = sourceRoot; this.sources = sources; this.sourcesContent = sourcesContent; this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || undefined; const from = resolve(sourceRoot || "", stripFilename(mapUrl)); this.resolvedSources = sources.map((s) => resolve(s || "", from)); const { mappings: mappings } = parsed; if (typeof mappings === "string") { this._encoded = mappings; this._decoded = undefined; } else { this._encoded = undefined; this._decoded = maybeSort(mappings, isString); } this._decodedMemo = memoizedState(); this._bySources = undefined; this._bySourceMemos = undefined; } } function cast(map) { return map; } function encodedMappings(map) { var _a; var _b; return (_a = (_b = cast(map))._encoded) !== null && _a !== void 0 ? _a : (_b._encoded = sourcemapCodec.encode(cast(map)._decoded)); } function decodedMappings(map) { var _a; return ( (_a = cast(map))._decoded || (_a._decoded = sourcemapCodec.decode(cast(map)._encoded)) ); } function traceSegment(map, line, column) { const decoded = decodedMappings(map); if (line >= decoded.length) return null; const segments = decoded[line]; const index = traceSegmentInternal( segments, cast(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND, ); return index === -1 ? null : segments[index]; } function originalPositionFor(map, needle) { let { line: line, column: column, bias: bias } = needle; line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const decoded = decodedMappings(map); if (line >= decoded.length) return OMapping(null, null, null, null); const segments = decoded[line]; const index = traceSegmentInternal( segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND, ); if (index === -1) return OMapping(null, null, null, null); const segment = segments[index]; if (segment.length === 1) return OMapping(null, null, null, null); const { names: names, resolvedSources: resolvedSources } = map; return OMapping( resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null, ); } function generatedPositionFor(map, needle) { const { source: source, line: line, column: column, bias: bias, } = needle; return generatedPosition( map, source, line, column, bias || GREATEST_LOWER_BOUND, false, ); } function allGeneratedPositionsFor(map, needle) { const { source: source, line: line, column: column, bias: bias, } = needle; return generatedPosition( map, source, line, column, bias || LEAST_UPPER_BOUND, true, ); } function eachMapping(map, cb) { const decoded = decodedMappings(map); const { names: names, resolvedSources: resolvedSources } = map; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const generatedLine = i + 1; const generatedColumn = seg[0]; let source = null; let originalLine = null; let originalColumn = null; let name = null; if (seg.length !== 1) { source = resolvedSources[seg[1]]; originalLine = seg[2] + 1; originalColumn = seg[3]; } if (seg.length === 5) name = names[seg[4]]; cb({ generatedLine: generatedLine, generatedColumn: generatedColumn, source: source, originalLine: originalLine, originalColumn: originalColumn, name: name, }); } } } function sourceIndex(map, source) { const { sources: sources, resolvedSources: resolvedSources } = map; let index = sources.indexOf(source); if (index === -1) index = resolvedSources.indexOf(source); return index; } function sourceContentFor(map, source) { const { sourcesContent: sourcesContent } = map; if (sourcesContent == null) return null; const index = sourceIndex(map, source); return index === -1 ? null : sourcesContent[index]; } function isIgnored(map, source) { const { ignoreList: ignoreList } = map; if (ignoreList == null) return false; const index = sourceIndex(map, source); return index === -1 ? false : ignoreList.includes(index); } function presortedDecodedMap(map, mapUrl) { const tracer = new TraceMap(clone(map, []), mapUrl); cast(tracer)._decoded = map.mappings; return tracer; } function decodedMap(map) { return clone(map, decodedMappings(map)); } function encodedMap(map) { return clone(map, encodedMappings(map)); } function clone(map, mappings) { return { version: map.version, file: map.file, names: map.names, sourceRoot: map.sourceRoot, sources: map.sources, sourcesContent: map.sourcesContent, mappings: mappings, ignoreList: map.ignoreList || map.x_google_ignoreList, }; } function OMapping(source, line, column, name) { return { source: source, line: line, column: column, name: name }; } function GMapping(line, column) { return { line: line, column: column }; } function traceSegmentInternal(segments, memo, line, column, bias) { let index = memoizedBinarySearch(segments, column, memo, line); if (found) { index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)( segments, column, index, ); } else if (bias === LEAST_UPPER_BOUND) index++; if (index === -1 || index === segments.length) return -1; return index; } function sliceGeneratedPositions(segments, memo, line, column, bias) { let min = traceSegmentInternal( segments, memo, line, column, GREATEST_LOWER_BOUND, ); if (!found && bias === LEAST_UPPER_BOUND) min++; if (min === -1 || min === segments.length) return []; const matchedColumn = found ? column : segments[min][COLUMN]; if (!found) min = lowerBound(segments, matchedColumn, min); const max = upperBound(segments, matchedColumn, min); const result = []; for (; min <= max; min++) { const segment = segments[min]; result.push( GMapping( segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN], ), ); } return result; } function generatedPosition(map, source, line, column, bias, all) { var _a; line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const { sources: sources, resolvedSources: resolvedSources } = map; let sourceIndex = sources.indexOf(source); if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source); if (sourceIndex === -1) return all ? [] : GMapping(null, null); const generated = (_a = cast(map))._bySources || (_a._bySources = buildBySources( decodedMappings(map), (cast(map)._bySourceMemos = sources.map(memoizedState)), )); const segments = generated[sourceIndex][line]; if (segments == null) return all ? [] : GMapping(null, null); const memo = cast(map)._bySourceMemos[sourceIndex]; if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); const index = traceSegmentInternal(segments, memo, line, column, bias); if (index === -1) return GMapping(null, null); const segment = segments[index]; return GMapping( segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN], ); } exports.AnyMap = AnyMap; exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; exports.TraceMap = TraceMap; exports.allGeneratedPositionsFor = allGeneratedPositionsFor; exports.decodedMap = decodedMap; exports.decodedMappings = decodedMappings; exports.eachMapping = eachMapping; exports.encodedMap = encodedMap; exports.encodedMappings = encodedMappings; exports.generatedPositionFor = generatedPositionFor; exports.isIgnored = isIgnored; exports.originalPositionFor = originalPositionFor; exports.presortedDecodedMap = presortedDecodedMap; exports.sourceContentFor = sourceContentFor; exports.traceSegment = traceSegment; }); })(traceMapping_umd$1, traceMapping_umd$1.exports); return traceMapping_umd$1.exports; } var hasRequiredGenMapping_umd; function requireGenMapping_umd() { if (hasRequiredGenMapping_umd) return genMapping_umd.exports; hasRequiredGenMapping_umd = 1; (function (module, exports) { (function (global, factory) { factory( exports, requireSetArray_umd(), requireSourcemapCodec_umd$2(), requireTraceMapping_umd$1(), ); })( commonjsGlobal, function (exports, setArray, sourcemapCodec, traceMapping) { const COLUMN = 0; const SOURCES_INDEX = 1; const SOURCE_LINE = 2; const SOURCE_COLUMN = 3; const NAMES_INDEX = 4; const NO_NAME = -1; class GenMapping { constructor({ file: file, sourceRoot: sourceRoot } = {}) { this._names = new setArray.SetArray(); this._sources = new setArray.SetArray(); this._sourcesContent = []; this._mappings = []; this.file = file; this.sourceRoot = sourceRoot; this._ignoreList = new setArray.SetArray(); } } function cast(map) { return map; } function addSegment( map, genLine, genColumn, source, sourceLine, sourceColumn, name, content, ) { return addSegmentInternal( false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content, ); } function addMapping(map, mapping) { return addMappingInternal(false, map, mapping); } const maybeAddSegment = ( map, genLine, genColumn, source, sourceLine, sourceColumn, name, content, ) => addSegmentInternal( true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content, ); const maybeAddMapping = (map, mapping) => addMappingInternal(true, map, mapping); function setSourceContent(map, source, content) { const { _sources: sources, _sourcesContent: sourcesContent } = cast(map); const index = setArray.put(sources, source); sourcesContent[index] = content; } function setIgnore(map, source, ignore = true) { const { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList, } = cast(map); const index = setArray.put(sources, source); if (index === sourcesContent.length) sourcesContent[index] = null; if (ignore) setArray.put(ignoreList, index); else setArray.remove(ignoreList, index); } function toDecodedMap(map) { const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList, } = cast(map); removeEmptyFinalLines(mappings); return { version: 3, file: map.file || undefined, names: names.array, sourceRoot: map.sourceRoot || undefined, sources: sources.array, sourcesContent: sourcesContent, mappings: mappings, ignoreList: ignoreList.array, }; } function toEncodedMap(map) { const decoded = toDecodedMap(map); return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings), }); } function fromMap(input) { const map = new traceMapping.TraceMap(input); const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot, }); putAll(cast(gen)._names, map.names); putAll(cast(gen)._sources, map.sources); cast(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null); cast(gen)._mappings = traceMapping.decodedMappings(map); if (map.ignoreList) putAll(cast(gen)._ignoreList, map.ignoreList); return gen; } function allMappings(map) { const out = []; const { _mappings: mappings, _sources: sources, _names: names, } = cast(map); for (let i = 0; i < mappings.length; i++) { const line = mappings[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const generated = { line: i + 1, column: seg[COLUMN] }; let source = undefined; let original = undefined; let name = undefined; if (seg.length !== 1) { source = sources.array[seg[SOURCES_INDEX]]; original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN], }; if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; } out.push({ generated: generated, source: source, original: original, name: name, }); } } return out; } function addSegmentInternal( skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content, ) { const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, } = cast(map); const line = getLine(mappings, genLine); const index = getColumnIndex(line, genColumn); if (!source) { if (skipable && skipSourceless(line, index)) return; return insert(line, index, [genColumn]); } const sourcesIndex = setArray.put(sources, source); const namesIndex = name ? setArray.put(names, name) : NO_NAME; if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; if ( skipable && skipSource( line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex, ) ) { return; } return insert( line, index, name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn], ); } function getLine(mappings, index) { for (let i = mappings.length; i <= index; i++) { mappings[i] = []; } return mappings[index]; } function getColumnIndex(line, genColumn) { let index = line.length; for (let i = index - 1; i >= 0; index = i--) { const current = line[i]; if (genColumn >= current[COLUMN]) break; } return index; } function insert(array, index, value) { for (let i = array.length; i > index; i--) { array[i] = array[i - 1]; } array[index] = value; } function removeEmptyFinalLines(mappings) { const { length: length } = mappings; let len = length; for (let i = len - 1; i >= 0; len = i, i--) { if (mappings[i].length > 0) break; } if (len < length) mappings.length = len; } function putAll(setarr, array) { for (let i = 0; i < array.length; i++) setArray.put(setarr, array[i]); } function skipSourceless(line, index) { if (index === 0) return true; const prev = line[index - 1]; return prev.length === 1; } function skipSource( line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex, ) { if (index === 0) return false; const prev = line[index - 1]; if (prev.length === 1) return false; return ( sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME) ); } function addMappingInternal(skipable, map, mapping) { const { generated: generated, source: source, original: original, name: name, content: content, } = mapping; if (!source) { return addSegmentInternal( skipable, map, generated.line - 1, generated.column, null, null, null, null, null, ); } return addSegmentInternal( skipable, map, generated.line - 1, generated.column, source, original.line - 1, original.column, name, content, ); } exports.GenMapping = GenMapping; exports.addMapping = addMapping; exports.addSegment = addSegment; exports.allMappings = allMappings; exports.fromMap = fromMap; exports.maybeAddMapping = maybeAddMapping; exports.maybeAddSegment = maybeAddSegment; exports.setIgnore = setIgnore; exports.setSourceContent = setSourceContent; exports.toDecodedMap = toDecodedMap; exports.toEncodedMap = toEncodedMap; Object.defineProperty(exports, "__esModule", { value: true }); }, ); })(genMapping_umd, genMapping_umd.exports); return genMapping_umd.exports; } var traceMapping_umd = { exports: {} }; var sourcemapCodec_umd = { exports: {} }; var hasRequiredSourcemapCodec_umd; function requireSourcemapCodec_umd() { if (hasRequiredSourcemapCodec_umd) return sourcemapCodec_umd.exports; hasRequiredSourcemapCodec_umd = 1; (function (module, exports) { (function (global, factory) { factory(exports); })(commonjsGlobal, function (exports) { const comma = ",".charCodeAt(0); const semicolon = ";".charCodeAt(0); const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const intToChar = new Uint8Array(64); const charToInt = new Uint8Array(128); for (let i = 0; i < chars.length; i++) { const c = chars.charCodeAt(i); intToChar[i] = c; charToInt[c] = i; } const td = typeof TextDecoder !== "undefined" ? new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) { const out = Buffer.from( buf.buffer, buf.byteOffset, buf.byteLength, ); return out.toString(); }, } : { decode(buf) { let out = ""; for (let i = 0; i < buf.length; i++) { out += String.fromCharCode(buf[i]); } return out; }, }; function decode(mappings) { const state = new Int32Array(5); const decoded = []; let index = 0; do { const semi = indexOf(mappings, index); const line = []; let sorted = true; let lastCol = 0; state[0] = 0; for (let i = index; i < semi; i++) { let seg; i = decodeInteger(mappings, i, state, 0); const col = state[0]; if (col < lastCol) sorted = false; lastCol = col; if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 1); i = decodeInteger(mappings, i, state, 2); i = decodeInteger(mappings, i, state, 3); if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 4); seg = [col, state[1], state[2], state[3], state[4]]; } else { seg = [col, state[1], state[2], state[3]]; } } else { seg = [col]; } line.push(seg); } if (!sorted) sort(line); decoded.push(line); index = semi + 1; } while (index <= mappings.length); return decoded; } function indexOf(mappings, index) { const idx = mappings.indexOf(";", index); return idx === -1 ? mappings.length : idx; } function decodeInteger(mappings, pos, state, j) { let value = 0; let shift = 0; let integer = 0; do { const c = mappings.charCodeAt(pos++); integer = charToInt[c]; value |= (integer & 31) << shift; shift += 5; } while (integer & 32); const shouldNegate = value & 1; value >>>= 1; if (shouldNegate) { value = -2147483648 | -value; } state[j] += value; return pos; } function hasMoreVlq(mappings, i, length) { if (i >= length) return false; return mappings.charCodeAt(i) !== comma; } function sort(line) { line.sort(sortComparator); } function sortComparator(a, b) { return a[0] - b[0]; } function encode(decoded) { const state = new Int32Array(5); const bufLength = 1024 * 16; const subLength = bufLength - 36; const buf = new Uint8Array(bufLength); const sub = buf.subarray(0, subLength); let pos = 0; let out = ""; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; if (i > 0) { if (pos === bufLength) { out += td.decode(buf); pos = 0; } buf[pos++] = semicolon; } if (line.length === 0) continue; state[0] = 0; for (let j = 0; j < line.length; j++) { const segment = line[j]; if (pos > subLength) { out += td.decode(sub); buf.copyWithin(0, subLength, pos); pos -= subLength; } if (j > 0) buf[pos++] = comma; pos = encodeInteger(buf, pos, state, segment, 0); if (segment.length === 1) continue; pos = encodeInteger(buf, pos, state, segment, 1); pos = encodeInteger(buf, pos, state, segment, 2); pos = encodeInteger(buf, pos, state, segment, 3); if (segment.length === 4) continue; pos = encodeInteger(buf, pos, state, segment, 4); } } return out + td.decode(buf.subarray(0, pos)); } function encodeInteger(buf, pos, state, segment, j) { const next = segment[j]; let num = next - state[j]; state[j] = next; num = num < 0 ? (-num << 1) | 1 : num << 1; do { let clamped = num & 31; num >>>= 5; if (num > 0) clamped |= 32; buf[pos++] = intToChar[clamped]; } while (num > 0); return pos; } exports.decode = decode; exports.encode = encode; Object.defineProperty(exports, "__esModule", { value: true }); }); })(sourcemapCodec_umd, sourcemapCodec_umd.exports); return sourcemapCodec_umd.exports; } var resolveUri_umd = { exports: {} }; var hasRequiredResolveUri_umd; function requireResolveUri_umd() { if (hasRequiredResolveUri_umd) return resolveUri_umd.exports; hasRequiredResolveUri_umd = 1; (function (module, exports) { (function (global, factory) { module.exports = factory(); })(commonjsGlobal, function () { const schemeRegex = /^[\w+.-]+:\/\//; const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; function isAbsoluteUrl(input) { return schemeRegex.test(input); } function isSchemeRelativeUrl(input) { return input.startsWith("//"); } function isAbsolutePath(input) { return input.startsWith("/"); } function isFileUrl(input) { return input.startsWith("file:"); } function isRelative(input) { return /^[.?#]/.test(input); } function parseAbsoluteUrl(input) { const match = urlRegex.exec(input); return makeUrl( match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "", ); } function parseFileUrl(input) { const match = fileRegex.exec(input); const path = match[2]; return makeUrl( "file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "", ); } function makeUrl(scheme, user, host, port, path, query, hash) { return { scheme: scheme, user: user, host: host, port: port, path: path, query: query, hash: hash, type: 7, }; } function parseUrl(input) { if (isSchemeRelativeUrl(input)) { const url = parseAbsoluteUrl("http:" + input); url.scheme = ""; url.type = 6; return url; } if (isAbsolutePath(input)) { const url = parseAbsoluteUrl("http://foo.com" + input); url.scheme = ""; url.host = ""; url.type = 5; return url; } if (isFileUrl(input)) return parseFileUrl(input); if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input); const url = parseAbsoluteUrl("http://foo.com/" + input); url.scheme = ""; url.host = ""; url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1; return url; } function stripPathFilename(path) { if (path.endsWith("/..")) return path; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } function mergePaths(url, base) { normalizePath(base, base.type); if (url.path === "/") { url.path = base.path; } else { url.path = stripPathFilename(base.path) + url.path; } } function normalizePath(url, type) { const rel = type <= 4; const pieces = url.path.split("/"); let pointer = 1; let positive = 0; let addTrailingSlash = false; for (let i = 1; i < pieces.length; i++) { const piece = pieces[i]; if (!piece) { addTrailingSlash = true; continue; } addTrailingSlash = false; if (piece === ".") continue; if (piece === "..") { if (positive) { addTrailingSlash = true; positive--; pointer--; } else if (rel) { pieces[pointer++] = piece; } continue; } pieces[pointer++] = piece; positive++; } let path = ""; for (let i = 1; i < pointer; i++) { path += "/" + pieces[i]; } if (!path || (addTrailingSlash && !path.endsWith("/.."))) { path += "/"; } url.path = path; } function resolve(input, base) { if (!input && !base) return ""; const url = parseUrl(input); let inputType = url.type; if (base && inputType !== 7) { const baseUrl = parseUrl(base); const baseType = baseUrl.type; switch (inputType) { case 1: url.hash = baseUrl.hash; case 2: url.query = baseUrl.query; case 3: case 4: mergePaths(url, baseUrl); case 5: url.user = baseUrl.user; url.host = baseUrl.host; url.port = baseUrl.port; case 6: url.scheme = baseUrl.scheme; } if (baseType > inputType) inputType = baseType; } normalizePath(url, inputType); const queryHash = url.query + url.hash; switch (inputType) { case 2: case 3: return queryHash; case 4: { const path = url.path.slice(1); if (!path) return queryHash || "."; if (isRelative(base || input) && !isRelative(path)) { return "./" + path + queryHash; } return path + queryHash; } case 5: return url.path + queryHash; default: return ( url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash ); } } return resolve; }); })(resolveUri_umd); return resolveUri_umd.exports; } var hasRequiredTraceMapping_umd; function requireTraceMapping_umd() { if (hasRequiredTraceMapping_umd) return traceMapping_umd.exports; hasRequiredTraceMapping_umd = 1; (function (module, exports) { (function (global, factory) { factory(exports, requireSourcemapCodec_umd(), requireResolveUri_umd()); })(commonjsGlobal, function (exports, sourcemapCodec, resolveUri) { function resolve(input, base) { if (base && !base.endsWith("/")) base += "/"; return resolveUri(input, base); } function stripFilename(path) { if (!path) return ""; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } const COLUMN = 0; const SOURCES_INDEX = 1; const SOURCE_LINE = 2; const SOURCE_COLUMN = 3; const NAMES_INDEX = 4; const REV_GENERATED_LINE = 1; const REV_GENERATED_COLUMN = 2; function maybeSort(mappings, owned) { const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); if (unsortedIndex === mappings.length) return mappings; if (!owned) mappings = mappings.slice(); for ( let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1) ) { mappings[i] = sortSegments(mappings[i], owned); } return mappings; } function nextUnsortedSegmentLine(mappings, start) { for (let i = start; i < mappings.length; i++) { if (!isSorted(mappings[i])) return i; } return mappings.length; } function isSorted(line) { for (let j = 1; j < line.length; j++) { if (line[j][COLUMN] < line[j - 1][COLUMN]) { return false; } } return true; } function sortSegments(line, owned) { if (!owned) line = line.slice(); return line.sort(sortComparator); } function sortComparator(a, b) { return a[COLUMN] - b[COLUMN]; } let found = false; function binarySearch(haystack, needle, low, high) { while (low <= high) { const mid = low + ((high - low) >> 1); const cmp = haystack[mid][COLUMN] - needle; if (cmp === 0) { found = true; return mid; } if (cmp < 0) { low = mid + 1; } else { high = mid - 1; } } found = false; return low - 1; } function upperBound(haystack, needle, index) { for (let i = index + 1; i < haystack.length; index = i++) { if (haystack[i][COLUMN] !== needle) break; } return index; } function lowerBound(haystack, needle, index) { for (let i = index - 1; i >= 0; index = i--) { if (haystack[i][COLUMN] !== needle) break; } return index; } function memoizedState() { return { lastKey: -1, lastNeedle: -1, lastIndex: -1 }; } function memoizedBinarySearch(haystack, needle, state, key) { const { lastKey: lastKey, lastNeedle: lastNeedle, lastIndex: lastIndex, } = state; let low = 0; let high = haystack.length - 1; if (key === lastKey) { if (needle === lastNeedle) { found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; return lastIndex; } if (needle >= lastNeedle) { low = lastIndex === -1 ? 0 : lastIndex; } else { high = lastIndex; } } state.lastKey = key; state.lastNeedle = needle; return (state.lastIndex = binarySearch(haystack, needle, low, high)); } function buildBySources(decoded, memos) { const sources = memos.map(buildNullArray); for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; if (seg.length === 1) continue; const sourceIndex = seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; const originalSource = sources[sourceIndex]; const originalLine = originalSource[sourceLine] || (originalSource[sourceLine] = []); const memo = memos[sourceIndex]; let index = upperBound( originalLine, sourceColumn, memoizedBinarySearch( originalLine, sourceColumn, memo, sourceLine, ), ); memo.lastIndex = ++index; insert(originalLine, index, [sourceColumn, i, seg[COLUMN]]); } } return sources; } function insert(array, index, value) { for (let i = array.length; i > index; i--) { array[i] = array[i - 1]; } array[index] = value; } function buildNullArray() { return { __proto__: null }; } const AnyMap = function (map, mapUrl) { const parsed = parse(map); if (!("sections" in parsed)) { return new TraceMap(parsed, mapUrl); } const mappings = []; const sources = []; const sourcesContent = []; const names = []; const ignoreList = []; recurse( parsed, mapUrl, mappings, sources, sourcesContent, names, ignoreList, 0, 0, Infinity, Infinity, ); const joined = { version: 3, file: parsed.file, names: names, sources: sources, sourcesContent: sourcesContent, mappings: mappings, ignoreList: ignoreList, }; return presortedDecodedMap(joined); }; function parse(map) { return typeof map === "string" ? JSON.parse(map) : map; } function recurse( input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn, ) { const { sections: sections } = input; for (let i = 0; i < sections.length; i++) { const { map: map, offset: offset } = sections[i]; let sl = stopLine; let sc = stopColumn; if (i + 1 < sections.length) { const nextOffset = sections[i + 1].offset; sl = Math.min(stopLine, lineOffset + nextOffset.line); if (sl === stopLine) { sc = Math.min(stopColumn, columnOffset + nextOffset.column); } else if (sl < stopLine) { sc = columnOffset + nextOffset.column; } } addSection( map, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset + offset.line, columnOffset + offset.column, sl, sc, ); } } function addSection( input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn, ) { const parsed = parse(input); if ("sections" in parsed) return recurse(...arguments); const map = new TraceMap(parsed, mapUrl); const sourcesOffset = sources.length; const namesOffset = names.length; const decoded = decodedMappings(map); const { resolvedSources: resolvedSources, sourcesContent: contents, ignoreList: ignores, } = map; append(sources, resolvedSources); append(names, map.names); if (contents) append(sourcesContent, contents); else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset); for (let i = 0; i < decoded.length; i++) { const lineI = lineOffset + i; if (lineI > stopLine) return; const out = getLine(mappings, lineI); const cOffset = i === 0 ? columnOffset : 0; const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const column = cOffset + seg[COLUMN]; if (lineI === stopLine && column >= stopColumn) return; if (seg.length === 1) { out.push([column]); continue; } const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; out.push( seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [ column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX], ], ); } } } function append(arr, other) { for (let i = 0; i < other.length; i++) arr.push(other[i]); } function getLine(arr, index) { for (let i = arr.length; i <= index; i++) arr[i] = []; return arr[index]; } const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; const COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; const LEAST_UPPER_BOUND = -1; const GREATEST_LOWER_BOUND = 1; class TraceMap { constructor(map, mapUrl) { const isString = typeof map === "string"; if (!isString && map._decodedMemo) return map; const parsed = isString ? JSON.parse(map) : map; const { version: version, file: file, names: names, sourceRoot: sourceRoot, sources: sources, sourcesContent: sourcesContent, } = parsed; this.version = version; this.file = file; this.names = names || []; this.sourceRoot = sourceRoot; this.sources = sources; this.sourcesContent = sourcesContent; this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || undefined; const from = resolve(sourceRoot || "", stripFilename(mapUrl)); this.resolvedSources = sources.map((s) => resolve(s || "", from)); const { mappings: mappings } = parsed; if (typeof mappings === "string") { this._encoded = mappings; this._decoded = undefined; } else { this._encoded = undefined; this._decoded = maybeSort(mappings, isString); } this._decodedMemo = memoizedState(); this._bySources = undefined; this._bySourceMemos = undefined; } } function cast(map) { return map; } function encodedMappings(map) { var _a; var _b; return (_a = (_b = cast(map))._encoded) !== null && _a !== void 0 ? _a : (_b._encoded = sourcemapCodec.encode(cast(map)._decoded)); } function decodedMappings(map) { var _a; return ( (_a = cast(map))._decoded || (_a._decoded = sourcemapCodec.decode(cast(map)._encoded)) ); } function traceSegment(map, line, column) { const decoded = decodedMappings(map); if (line >= decoded.length) return null; const segments = decoded[line]; const index = traceSegmentInternal( segments, cast(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND, ); return index === -1 ? null : segments[index]; } function originalPositionFor(map, needle) { let { line: line, column: column, bias: bias } = needle; line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const decoded = decodedMappings(map); if (line >= decoded.length) return OMapping(null, null, null, null); const segments = decoded[line]; const index = traceSegmentInternal( segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND, ); if (index === -1) return OMapping(null, null, null, null); const segment = segments[index]; if (segment.length === 1) return OMapping(null, null, null, null); const { names: names, resolvedSources: resolvedSources } = map; return OMapping( resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null, ); } function generatedPositionFor(map, needle) { const { source: source, line: line, column: column, bias: bias, } = needle; return generatedPosition( map, source, line, column, bias || GREATEST_LOWER_BOUND, false, ); } function allGeneratedPositionsFor(map, needle) { const { source: source, line: line, column: column, bias: bias, } = needle; return generatedPosition( map, source, line, column, bias || LEAST_UPPER_BOUND, true, ); } function eachMapping(map, cb) { const decoded = decodedMappings(map); const { names: names, resolvedSources: resolvedSources } = map; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const generatedLine = i + 1; const generatedColumn = seg[0]; let source = null; let originalLine = null; let originalColumn = null; let name = null; if (seg.length !== 1) { source = resolvedSources[seg[1]]; originalLine = seg[2] + 1; originalColumn = seg[3]; } if (seg.length === 5) name = names[seg[4]]; cb({ generatedLine: generatedLine, generatedColumn: generatedColumn, source: source, originalLine: originalLine, originalColumn: originalColumn, name: name, }); } } } function sourceIndex(map, source) { const { sources: sources, resolvedSources: resolvedSources } = map; let index = sources.indexOf(source); if (index === -1) index = resolvedSources.indexOf(source); return index; } function sourceContentFor(map, source) { const { sourcesContent: sourcesContent } = map; if (sourcesContent == null) return null; const index = sourceIndex(map, source); return index === -1 ? null : sourcesContent[index]; } function isIgnored(map, source) { const { ignoreList: ignoreList } = map; if (ignoreList == null) return false; const index = sourceIndex(map, source); return index === -1 ? false : ignoreList.includes(index); } function presortedDecodedMap(map, mapUrl) { const tracer = new TraceMap(clone(map, []), mapUrl); cast(tracer)._decoded = map.mappings; return tracer; } function decodedMap(map) { return clone(map, decodedMappings(map)); } function encodedMap(map) { return clone(map, encodedMappings(map)); } function clone(map, mappings) { return { version: map.version, file: map.file, names: map.names, sourceRoot: map.sourceRoot, sources: map.sources, sourcesContent: map.sourcesContent, mappings: mappings, ignoreList: map.ignoreList || map.x_google_ignoreList, }; } function OMapping(source, line, column, name) { return { source: source, line: line, column: column, name: name }; } function GMapping(line, column) { return { line: line, column: column }; } function traceSegmentInternal(segments, memo, line, column, bias) { let index = memoizedBinarySearch(segments, column, memo, line); if (found) { index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)( segments, column, index, ); } else if (bias === LEAST_UPPER_BOUND) index++; if (index === -1 || index === segments.length) return -1; return index; } function sliceGeneratedPositions(segments, memo, line, column, bias) { let min = traceSegmentInternal( segments, memo, line, column, GREATEST_LOWER_BOUND, ); if (!found && bias === LEAST_UPPER_BOUND) min++; if (min === -1 || min === segments.length) return []; const matchedColumn = found ? column : segments[min][COLUMN]; if (!found) min = lowerBound(segments, matchedColumn, min); const max = upperBound(segments, matchedColumn, min); const result = []; for (; min <= max; min++) { const segment = segments[min]; result.push( GMapping( segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN], ), ); } return result; } function generatedPosition(map, source, line, column, bias, all) { var _a; line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const { sources: sources, resolvedSources: resolvedSources } = map; let sourceIndex = sources.indexOf(source); if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source); if (sourceIndex === -1) return all ? [] : GMapping(null, null); const generated = (_a = cast(map))._bySources || (_a._bySources = buildBySources( decodedMappings(map), (cast(map)._bySourceMemos = sources.map(memoizedState)), )); const segments = generated[sourceIndex][line]; if (segments == null) return all ? [] : GMapping(null, null); const memo = cast(map)._bySourceMemos[sourceIndex]; if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); const index = traceSegmentInternal(segments, memo, line, column, bias); if (index === -1) return GMapping(null, null); const segment = segments[index]; return GMapping( segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN], ); } exports.AnyMap = AnyMap; exports.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; exports.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; exports.TraceMap = TraceMap; exports.allGeneratedPositionsFor = allGeneratedPositionsFor; exports.decodedMap = decodedMap; exports.decodedMappings = decodedMappings; exports.eachMapping = eachMapping; exports.encodedMap = encodedMap; exports.encodedMappings = encodedMappings; exports.generatedPositionFor = generatedPositionFor; exports.isIgnored = isIgnored; exports.originalPositionFor = originalPositionFor; exports.presortedDecodedMap = presortedDecodedMap; exports.sourceContentFor = sourceContentFor; exports.traceSegment = traceSegment; }); })(traceMapping_umd, traceMapping_umd.exports); return traceMapping_umd.exports; } var hasRequiredSourceMap$2; function requireSourceMap$2() { if (hasRequiredSourceMap$2) return sourceMap$3; hasRequiredSourceMap$2 = 1; Object.defineProperty(sourceMap$3, "__esModule", { value: true }); sourceMap$3.default = void 0; var _genMapping = requireGenMapping_umd(); var _traceMapping = requireTraceMapping_umd(); class SourceMap { constructor(opts, code) { var _opts$sourceFileName; this._map = void 0; this._rawMappings = void 0; this._sourceFileName = void 0; this._lastGenLine = 0; this._lastSourceLine = 0; this._lastSourceColumn = 0; this._inputMap = void 0; const map = (this._map = new _genMapping.GenMapping({ sourceRoot: opts.sourceRoot, })); this._sourceFileName = (_opts$sourceFileName = opts.sourceFileName) == null ? void 0 : _opts$sourceFileName.replace(/\\/g, "/"); this._rawMappings = undefined; if (opts.inputSourceMap) { this._inputMap = new _traceMapping.TraceMap(opts.inputSourceMap); const resolvedSources = this._inputMap.resolvedSources; if (resolvedSources.length) { for (let i = 0; i < resolvedSources.length; i++) { var _this$_inputMap$sourc; (0, _genMapping.setSourceContent)( map, resolvedSources[i], (_this$_inputMap$sourc = this._inputMap.sourcesContent) == null ? void 0 : _this$_inputMap$sourc[i], ); } } } if (typeof code === "string" && !opts.inputSourceMap) { (0, _genMapping.setSourceContent)(map, this._sourceFileName, code); } else if (typeof code === "object") { for (const sourceFileName of Object.keys(code)) { (0, _genMapping.setSourceContent)( map, sourceFileName.replace(/\\/g, "/"), code[sourceFileName], ); } } } get() { return (0, _genMapping.toEncodedMap)(this._map); } getDecoded() { return (0, _genMapping.toDecodedMap)(this._map); } getRawMappings() { return ( this._rawMappings || (this._rawMappings = (0, _genMapping.allMappings)(this._map)) ); } mark(generated, line, column, identifierName, identifierNamePos, filename) { var _originalMapping; this._rawMappings = undefined; let originalMapping; if (line != null) { if (this._inputMap) { originalMapping = (0, _traceMapping.originalPositionFor)( this._inputMap, { line: line, column: column }, ); if (!originalMapping.name && identifierNamePos) { const originalIdentifierMapping = (0, _traceMapping.originalPositionFor)( this._inputMap, identifierNamePos, ); if (originalIdentifierMapping.name) { identifierName = originalIdentifierMapping.name; } } } else { originalMapping = { source: (filename == null ? void 0 : filename.replace(/\\/g, "/")) || this._sourceFileName, line: line, column: column, }; } } (0, _genMapping.maybeAddMapping)(this._map, { name: identifierName, generated: generated, source: (_originalMapping = originalMapping) == null ? void 0 : _originalMapping.source, original: originalMapping, }); } } sourceMap$3.default = SourceMap; return sourceMap$3; } var printer$2 = {}; var buffer$4 = {}; var hasRequiredBuffer; function requireBuffer() { if (hasRequiredBuffer) return buffer$4; hasRequiredBuffer = 1; Object.defineProperty(buffer$4, "__esModule", { value: true }); buffer$4.default = void 0; class Buffer { constructor(map, indentChar) { this._map = null; this._buf = ""; this._str = ""; this._appendCount = 0; this._last = 0; this._queue = []; this._queueCursor = 0; this._canMarkIdName = true; this._indentChar = ""; this._fastIndentations = []; this._position = { line: 1, column: 0 }; this._sourcePosition = { identifierName: undefined, identifierNamePos: undefined, line: undefined, column: undefined, filename: undefined, }; this._map = map; this._indentChar = indentChar; for (let i = 0; i < 64; i++) { this._fastIndentations.push(indentChar.repeat(i)); } this._allocQueue(); } _allocQueue() { const queue = this._queue; for (let i = 0; i < 16; i++) { queue.push({ char: 0, repeat: 1, line: undefined, column: undefined, identifierName: undefined, identifierNamePos: undefined, filename: "", }); } } _pushQueue(char, repeat, line, column, filename) { const cursor = this._queueCursor; if (cursor === this._queue.length) { this._allocQueue(); } const item = this._queue[cursor]; item.char = char; item.repeat = repeat; item.line = line; item.column = column; item.filename = filename; this._queueCursor++; } _popQueue() { if (this._queueCursor === 0) { throw new Error("Cannot pop from empty queue"); } return this._queue[--this._queueCursor]; } get() { this._flush(); const map = this._map; const result = { code: (this._buf + this._str).trimRight(), decodedMap: map == null ? void 0 : map.getDecoded(), get __mergedMap() { return this.map; }, get map() { const resultMap = map ? map.get() : null; result.map = resultMap; return resultMap; }, set map(value) { Object.defineProperty(result, "map", { value: value, writable: true, }); }, get rawMappings() { const mappings = map == null ? void 0 : map.getRawMappings(); result.rawMappings = mappings; return mappings; }, set rawMappings(value) { Object.defineProperty(result, "rawMappings", { value: value, writable: true, }); }, }; return result; } append(str, maybeNewline) { this._flush(); this._append(str, this._sourcePosition, maybeNewline); } appendChar(char) { this._flush(); this._appendChar(char, 1, this._sourcePosition); } queue(char) { if (char === 10) { while (this._queueCursor !== 0) { const char = this._queue[this._queueCursor - 1].char; if (char !== 32 && char !== 9) { break; } this._queueCursor--; } } const sourcePosition = this._sourcePosition; this._pushQueue( char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.filename, ); } queueIndentation(repeat) { if (repeat === 0) return; this._pushQueue(-1, repeat, undefined, undefined, undefined); } _flush() { const queueCursor = this._queueCursor; const queue = this._queue; for (let i = 0; i < queueCursor; i++) { const item = queue[i]; this._appendChar(item.char, item.repeat, item); } this._queueCursor = 0; } _appendChar(char, repeat, sourcePos) { this._last = char; if (char === -1) { const fastIndentation = this._fastIndentations[repeat]; if (fastIndentation !== undefined) { this._str += fastIndentation; } else { this._str += repeat > 1 ? this._indentChar.repeat(repeat) : this._indentChar; } } else { this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); } if (char !== 10) { this._mark( sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename, ); this._position.column += repeat; } else { this._position.line++; this._position.column = 0; } if (this._canMarkIdName) { sourcePos.identifierName = undefined; sourcePos.identifierNamePos = undefined; } } _append(str, sourcePos, maybeNewline) { const len = str.length; const position = this._position; this._last = str.charCodeAt(len - 1); if (++this._appendCount > 4096) { +this._str; this._buf += this._str; this._str = str; this._appendCount = 0; } else { this._str += str; } if (!maybeNewline && !this._map) { position.column += len; return; } const { column: column, identifierName: identifierName, identifierNamePos: identifierNamePos, filename: filename, } = sourcePos; let line = sourcePos.line; if ( (identifierName != null || identifierNamePos != null) && this._canMarkIdName ) { sourcePos.identifierName = undefined; sourcePos.identifierNamePos = undefined; } let i = str.indexOf("\n"); let last = 0; if (i !== 0) { this._mark(line, column, identifierName, identifierNamePos, filename); } while (i !== -1) { position.line++; position.column = 0; last = i + 1; if (last < len && line !== undefined) { this._mark(++line, 0, null, null, filename); } i = str.indexOf("\n", last); } position.column += len - last; } _mark(line, column, identifierName, identifierNamePos, filename) { var _this$_map; (_this$_map = this._map) == null || _this$_map.mark( this._position, line, column, identifierName, identifierNamePos, filename, ); } removeTrailingNewline() { const queueCursor = this._queueCursor; if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) { this._queueCursor--; } } removeLastSemicolon() { const queueCursor = this._queueCursor; if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { this._queueCursor--; } } getLastChar() { const queueCursor = this._queueCursor; return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; } getNewlineCount() { const queueCursor = this._queueCursor; let count = 0; if (queueCursor === 0) return this._last === 10 ? 1 : 0; for (let i = queueCursor - 1; i >= 0; i--) { if (this._queue[i].char !== 10) { break; } count++; } return count === queueCursor && this._last === 10 ? count + 1 : count; } endsWithCharAndNewline() { const queue = this._queue; const queueCursor = this._queueCursor; if (queueCursor !== 0) { const lastCp = queue[queueCursor - 1].char; if (lastCp !== 10) return; if (queueCursor > 1) { return queue[queueCursor - 2].char; } else { return this._last; } } } hasContent() { return this._queueCursor !== 0 || !!this._last; } exactSource(loc, cb) { if (!this._map) { cb(); return; } this.source("start", loc); const identifierName = loc.identifierName; const sourcePos = this._sourcePosition; if (identifierName) { this._canMarkIdName = false; sourcePos.identifierName = identifierName; } cb(); if (identifierName) { this._canMarkIdName = true; sourcePos.identifierName = undefined; sourcePos.identifierNamePos = undefined; } this.source("end", loc); } source(prop, loc) { if (!this._map) return; this._normalizePosition(prop, loc, 0); } sourceWithOffset(prop, loc, columnOffset) { if (!this._map) return; this._normalizePosition(prop, loc, columnOffset); } withSource(prop, loc, cb) { if (this._map) { this.source(prop, loc); } cb(); } _normalizePosition(prop, loc, columnOffset) { const pos = loc[prop]; const target = this._sourcePosition; if (pos) { target.line = pos.line; target.column = Math.max(pos.column + columnOffset, 0); target.filename = loc.filename; } } getCurrentColumn() { const queue = this._queue; const queueCursor = this._queueCursor; let lastIndex = -1; let len = 0; for (let i = 0; i < queueCursor; i++) { const item = queue[i]; if (item.char === 10) { lastIndex = len; } len += item.repeat; } return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex; } getCurrentLine() { let count = 0; const queue = this._queue; for (let i = 0; i < this._queueCursor; i++) { if (queue[i].char === 10) { count++; } } return this._position.line + count; } } buffer$4.default = Buffer; return buffer$4; } var node$2 = {}; var whitespace$2 = {}; var hasRequiredWhitespace; function requireWhitespace() { if (hasRequiredWhitespace) return whitespace$2; hasRequiredWhitespace = 1; Object.defineProperty(whitespace$2, "__esModule", { value: true }); whitespace$2.nodes = void 0; var _t = t$d; const { FLIPPED_ALIAS_KEYS: FLIPPED_ALIAS_KEYS, isArrayExpression: isArrayExpression, isAssignmentExpression: isAssignmentExpression, isBinary: isBinary, isBlockStatement: isBlockStatement, isCallExpression: isCallExpression, isFunction: isFunction, isIdentifier: isIdentifier, isLiteral: isLiteral, isMemberExpression: isMemberExpression, isObjectExpression: isObjectExpression, isOptionalCallExpression: isOptionalCallExpression, isOptionalMemberExpression: isOptionalMemberExpression, isStringLiteral: isStringLiteral, } = _t; function crawlInternal(node, state) { if (!node) return state; if (isMemberExpression(node) || isOptionalMemberExpression(node)) { crawlInternal(node.object, state); if (node.computed) crawlInternal(node.property, state); } else if (isBinary(node) || isAssignmentExpression(node)) { crawlInternal(node.left, state); crawlInternal(node.right, state); } else if (isCallExpression(node) || isOptionalCallExpression(node)) { state.hasCall = true; crawlInternal(node.callee, state); } else if (isFunction(node)) { state.hasFunction = true; } else if (isIdentifier(node)) { state.hasHelper = state.hasHelper || (node.callee && isHelper(node.callee)); } return state; } function crawl(node) { return crawlInternal(node, { hasCall: false, hasFunction: false, hasHelper: false, }); } function isHelper(node) { if (!node) return false; if (isMemberExpression(node)) { return isHelper(node.object) || isHelper(node.property); } else if (isIdentifier(node)) { return node.name === "require" || node.name.charCodeAt(0) === 95; } else if (isCallExpression(node)) { return isHelper(node.callee); } else if (isBinary(node) || isAssignmentExpression(node)) { return ( (isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right) ); } else { return false; } } function isType(node) { return ( isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node) ); } const nodes = (whitespace$2.nodes = { AssignmentExpression(node) { const state = crawl(node.right); if ((state.hasCall && state.hasHelper) || state.hasFunction) { return state.hasFunction ? 1 | 2 : 2; } }, SwitchCase(node, parent) { return ( (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0) ); }, LogicalExpression(node) { if (isFunction(node.left) || isFunction(node.right)) { return 2; } }, Literal(node) { if (isStringLiteral(node) && node.value === "use strict") { return 2; } }, CallExpression(node) { if (isFunction(node.callee) || isHelper(node)) { return 1 | 2; } }, OptionalCallExpression(node) { if (isFunction(node.callee)) { return 1 | 2; } }, VariableDeclaration(node) { for (let i = 0; i < node.declarations.length; i++) { const declar = node.declarations[i]; let enabled = isHelper(declar.id) && !isType(declar.init); if (!enabled && declar.init) { const state = crawl(declar.init); enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction; } if (enabled) { return 1 | 2; } } }, IfStatement(node) { if (isBlockStatement(node.consequent)) { return 1 | 2; } }, }); nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { if (parent.properties[0] === node) { return 1; } }; nodes.ObjectTypeCallProperty = function (node, parent) { var _parent$properties; if ( parent.callProperties[0] === node && !( (_parent$properties = parent.properties) != null && _parent$properties.length ) ) { return 1; } }; nodes.ObjectTypeIndexer = function (node, parent) { var _parent$properties2, _parent$callPropertie; if ( parent.indexers[0] === node && !( (_parent$properties2 = parent.properties) != null && _parent$properties2.length ) && !( (_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length ) ) { return 1; } }; nodes.ObjectTypeInternalSlot = function (node, parent) { var _parent$properties3, _parent$callPropertie2, _parent$indexers; if ( parent.internalSlots[0] === node && !( (_parent$properties3 = parent.properties) != null && _parent$properties3.length ) && !( (_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length ) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length) ) { return 1; } }; [ ["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true], ].forEach(function ([type, amounts]) { [type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { const ret = amounts ? 1 | 2 : 0; nodes[type] = () => ret; }); }); return whitespace$2; } var parentheses$1 = {}; var hasRequiredParentheses; function requireParentheses() { if (hasRequiredParentheses) return parentheses$1; hasRequiredParentheses = 1; Object.defineProperty(parentheses$1, "__esModule", { value: true }); parentheses$1.ArrowFunctionExpression = ArrowFunctionExpression; parentheses$1.AssignmentExpression = AssignmentExpression; parentheses$1.Binary = Binary; parentheses$1.BinaryExpression = BinaryExpression; parentheses$1.ClassExpression = ClassExpression; parentheses$1.ConditionalExpression = ConditionalExpression; parentheses$1.DoExpression = DoExpression; parentheses$1.FunctionExpression = FunctionExpression; parentheses$1.FunctionTypeAnnotation = FunctionTypeAnnotation; parentheses$1.Identifier = Identifier; parentheses$1.LogicalExpression = LogicalExpression; parentheses$1.NullableTypeAnnotation = NullableTypeAnnotation; parentheses$1.ObjectExpression = ObjectExpression; parentheses$1.OptionalIndexedAccessType = OptionalIndexedAccessType; parentheses$1.OptionalCallExpression = parentheses$1.OptionalMemberExpression = OptionalMemberExpression; parentheses$1.SequenceExpression = SequenceExpression; parentheses$1.TSTypeAssertion = parentheses$1.TSSatisfiesExpression = parentheses$1.TSAsExpression = TSAsExpression; parentheses$1.TSInferType = TSInferType; parentheses$1.TSInstantiationExpression = TSInstantiationExpression; parentheses$1.TSIntersectionType = parentheses$1.TSUnionType = TSUnionType; parentheses$1.UnaryLike = UnaryLike; parentheses$1.IntersectionTypeAnnotation = parentheses$1.UnionTypeAnnotation = UnionTypeAnnotation; parentheses$1.UpdateExpression = UpdateExpression; parentheses$1.AwaitExpression = parentheses$1.YieldExpression = YieldExpression; var _t = t$d; const { isArrayTypeAnnotation: isArrayTypeAnnotation, isArrowFunctionExpression: isArrowFunctionExpression, isBinaryExpression: isBinaryExpression, isCallExpression: isCallExpression, isExportDeclaration: isExportDeclaration, isForOfStatement: isForOfStatement, isIndexedAccessType: isIndexedAccessType, isMemberExpression: isMemberExpression, isObjectPattern: isObjectPattern, isOptionalMemberExpression: isOptionalMemberExpression, isYieldExpression: isYieldExpression, } = _t; const PRECEDENCE = new Map([ ["||", 0], ["??", 0], ["|>", 0], ["&&", 1], ["|", 2], ["^", 3], ["&", 4], ["==", 5], ["===", 5], ["!=", 5], ["!==", 5], ["<", 6], [">", 6], ["<=", 6], [">=", 6], ["in", 6], ["instanceof", 6], [">>", 7], ["<<", 7], [">>>", 7], ["+", 8], ["-", 8], ["*", 9], ["/", 9], ["%", 9], ["**", 10], ]); function isTSTypeExpression(nodeType) { return ( nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression" || nodeType === "TSTypeAssertion" ); } const isClassExtendsClause = (node, parent) => { const parentType = parent.type; return ( (parentType === "ClassDeclaration" || parentType === "ClassExpression") && parent.superClass === node ); }; const hasPostfixPart = (node, parent) => { const parentType = parent.type; return ( ((parentType === "MemberExpression" || parentType === "OptionalMemberExpression") && parent.object === node) || ((parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression") && parent.callee === node) || (parentType === "TaggedTemplateExpression" && parent.tag === node) || parentType === "TSNonNullExpression" ); }; function NullableTypeAnnotation(node, parent) { return isArrayTypeAnnotation(parent); } function FunctionTypeAnnotation(node, parent, printStack) { if (printStack.length < 3) return; const parentType = parent.type; return ( parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || (parentType === "TypeAnnotation" && isArrowFunctionExpression(printStack[printStack.length - 3])) ); } function UpdateExpression(node, parent) { return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); } function ObjectExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 2); } function DoExpression(node, parent, printStack) { return !node.async && isFirstInContext(printStack, 1); } function Binary(node, parent) { const parentType = parent.type; if ( node.operator === "**" && parentType === "BinaryExpression" && parent.operator === "**" ) { return parent.left === node; } if (isClassExtendsClause(node, parent)) { return true; } if ( hasPostfixPart(node, parent) || parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "AwaitExpression" ) { return true; } if ( parentType === "BinaryExpression" || parentType === "LogicalExpression" ) { const parentPos = PRECEDENCE.get(parent.operator); const nodePos = PRECEDENCE.get(node.operator); if ( (parentPos === nodePos && parent.right === node && parentType !== "LogicalExpression") || parentPos > nodePos ) { return true; } } return undefined; } function UnionTypeAnnotation(node, parent) { const parentType = parent.type; return ( parentType === "ArrayTypeAnnotation" || parentType === "NullableTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "UnionTypeAnnotation" ); } function OptionalIndexedAccessType(node, parent) { return isIndexedAccessType(parent) && parent.objectType === node; } function TSAsExpression() { return true; } function TSUnionType(node, parent) { const parentType = parent.type; return ( parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSRestType" ); } function TSInferType(node, parent) { const parentType = parent.type; return parentType === "TSArrayType" || parentType === "TSOptionalType"; } function TSInstantiationExpression(node, parent) { const parentType = parent.type; return ( (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters ); } function BinaryExpression(node, parent) { if (node.operator === "in") { const parentType = parent.type; return ( parentType === "VariableDeclarator" || parentType === "ForStatement" || parentType === "ForInStatement" || parentType === "ForOfStatement" ); } return false; } function SequenceExpression(node, parent) { const parentType = parent.type; if ( parentType === "ForStatement" || parentType === "ThrowStatement" || parentType === "ReturnStatement" || (parentType === "IfStatement" && parent.test === node) || (parentType === "WhileStatement" && parent.test === node) || (parentType === "ForInStatement" && parent.right === node) || (parentType === "SwitchStatement" && parent.discriminant === node) || (parentType === "ExpressionStatement" && parent.expression === node) ) { return false; } return true; } function YieldExpression(node, parent) { const parentType = parent.type; return ( parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "UnaryExpression" || parentType === "SpreadElement" || hasPostfixPart(node, parent) || (parentType === "AwaitExpression" && isYieldExpression(node)) || (parentType === "ConditionalExpression" && node === parent.test) || isClassExtendsClause(node, parent) ); } function ClassExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 4); } function UnaryLike(node, parent) { return ( hasPostfixPart(node, parent) || (isBinaryExpression(parent) && parent.operator === "**" && parent.left === node) || isClassExtendsClause(node, parent) ); } function FunctionExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 4); } function ArrowFunctionExpression(node, parent) { return isExportDeclaration(parent) || ConditionalExpression(node, parent); } function ConditionalExpression(node, parent) { const parentType = parent.type; if ( parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "BinaryExpression" || parentType === "LogicalExpression" || (parentType === "ConditionalExpression" && parent.test === node) || parentType === "AwaitExpression" || isTSTypeExpression(parentType) ) { return true; } return UnaryLike(node, parent); } function OptionalMemberExpression(node, parent) { return ( (isCallExpression(parent) && parent.callee === node) || (isMemberExpression(parent) && parent.object === node) ); } function AssignmentExpression(node, parent) { if (isObjectPattern(node.left)) { return true; } else { return ConditionalExpression(node, parent); } } function LogicalExpression(node, parent) { const parentType = parent.type; if (isTSTypeExpression(parentType)) return true; if (parentType !== "LogicalExpression") return false; switch (node.operator) { case "||": return parent.operator === "??" || parent.operator === "&&"; case "&&": return parent.operator === "??"; case "??": return parent.operator !== "??"; } } function Identifier(node, parent, printStack) { var _node$extra; const parentType = parent.type; if ( (_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node ) { const rightType = parent.right.type; if ( (rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null ) { return true; } } if (node.name === "let") { const isFollowedByBracket = isMemberExpression(parent, { object: node, computed: true }) || isOptionalMemberExpression(parent, { object: node, computed: true, optional: false, }); return isFirstInContext( printStack, isFollowedByBracket ? 1 | 8 | 16 | 32 : 32, ); } return ( node.name === "async" && isForOfStatement(parent) && node === parent.left ); } function isFirstInContext(printStack, checkParam) { const expressionStatement = checkParam & 1; const arrowBody = checkParam & 2; const exportDefault = checkParam & 4; const forHead = checkParam & 8; const forInHead = checkParam & 16; const forOfHead = checkParam & 32; let i = printStack.length - 1; if (i <= 0) return; let node = printStack[i]; i--; let parent = printStack[i]; while (i >= 0) { const parentType = parent.type; if ( (expressionStatement && parentType === "ExpressionStatement" && parent.expression === node) || (exportDefault && parentType === "ExportDefaultDeclaration" && node === parent.declaration) || (arrowBody && parentType === "ArrowFunctionExpression" && parent.body === node) || (forHead && parentType === "ForStatement" && parent.init === node) || (forInHead && parentType === "ForInStatement" && parent.left === node) || (forOfHead && parentType === "ForOfStatement" && parent.left === node) ) { return true; } if ( i > 0 && ((hasPostfixPart(node, parent) && parentType !== "NewExpression") || (parentType === "SequenceExpression" && parent.expressions[0] === node) || (parentType === "UpdateExpression" && !parent.prefix) || (parentType === "ConditionalExpression" && parent.test === node) || ((parentType === "BinaryExpression" || parentType === "LogicalExpression") && parent.left === node) || (parentType === "AssignmentExpression" && parent.left === node)) ) { node = parent; i--; parent = printStack[i]; } else { return false; } } return false; } return parentheses$1; } var hasRequiredNode; function requireNode() { if (hasRequiredNode) return node$2; hasRequiredNode = 1; Object.defineProperty(node$2, "__esModule", { value: true }); node$2.needsParens = needsParens; node$2.needsWhitespace = needsWhitespace; node$2.needsWhitespaceAfter = needsWhitespaceAfter; node$2.needsWhitespaceBefore = needsWhitespaceBefore; var whitespace = requireWhitespace(); var parens = requireParentheses(); var _t = t$d; const { FLIPPED_ALIAS_KEYS: FLIPPED_ALIAS_KEYS, isCallExpression: isCallExpression, isExpressionStatement: isExpressionStatement, isMemberExpression: isMemberExpression, isNewExpression: isNewExpression, } = _t; function expandAliases(obj) { const map = new Map(); function add(type, func) { const fn = map.get(type); map.set( type, fn ? function (node, parent, stack) { var _fn; return (_fn = fn(node, parent, stack)) != null ? _fn : func(node, parent, stack); } : func, ); } for (const type of Object.keys(obj)) { const aliases = FLIPPED_ALIAS_KEYS[type]; if (aliases) { for (const alias of aliases) { add(alias, obj[type]); } } else { add(type, obj[type]); } } return map; } const expandedParens = expandAliases(parens); const expandedWhitespaceNodes = expandAliases(whitespace.nodes); function isOrHasCallExpression(node) { if (isCallExpression(node)) { return true; } return isMemberExpression(node) && isOrHasCallExpression(node.object); } function needsWhitespace(node, parent, type) { var _expandedWhitespaceNo; if (!node) return false; if (isExpressionStatement(node)) { node = node.expression; } const flag = (_expandedWhitespaceNo = expandedWhitespaceNodes.get(node.type)) == null ? void 0 : _expandedWhitespaceNo(node, parent); if (typeof flag === "number") { return (flag & type) !== 0; } return false; } function needsWhitespaceBefore(node, parent) { return needsWhitespace(node, parent, 1); } function needsWhitespaceAfter(node, parent) { return needsWhitespace(node, parent, 2); } function needsParens(node, parent, printStack) { var _expandedParens$get; if (!parent) return false; if (isNewExpression(parent) && parent.callee === node) { if (isOrHasCallExpression(node)) return true; } return (_expandedParens$get = expandedParens.get(node.type)) == null ? void 0 : _expandedParens$get(node, parent, printStack); } return node$2; } var generators$1 = {}; var templateLiterals$1 = {}; var hasRequiredTemplateLiterals; function requireTemplateLiterals() { if (hasRequiredTemplateLiterals) return templateLiterals$1; hasRequiredTemplateLiterals = 1; Object.defineProperty(templateLiterals$1, "__esModule", { value: true }); templateLiterals$1.TaggedTemplateExpression = TaggedTemplateExpression; templateLiterals$1.TemplateElement = TemplateElement; templateLiterals$1.TemplateLiteral = TemplateLiteral; function TaggedTemplateExpression(node) { this.print(node.tag, node); this.print(node.typeParameters, node); this.print(node.quasi, node); } function TemplateElement(node, parent) { const isFirst = parent.quasis[0] === node; const isLast = parent.quasis[parent.quasis.length - 1] === node; const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); this.token(value, true); } function TemplateLiteral(node) { const quasis = node.quasis; for (let i = 0; i < quasis.length; i++) { this.print(quasis[i], node); if (i + 1 < quasis.length) { this.print(node.expressions[i], node); } } } return templateLiterals$1; } var expressions$1 = {}; var hasRequiredExpressions; function requireExpressions() { if (hasRequiredExpressions) return expressions$1; hasRequiredExpressions = 1; Object.defineProperty(expressions$1, "__esModule", { value: true }); expressions$1.LogicalExpression = expressions$1.BinaryExpression = expressions$1.AssignmentExpression = AssignmentExpression; expressions$1.AssignmentPattern = AssignmentPattern; expressions$1.AwaitExpression = AwaitExpression; expressions$1.BindExpression = BindExpression; expressions$1.CallExpression = CallExpression; expressions$1.ConditionalExpression = ConditionalExpression; expressions$1.Decorator = Decorator; expressions$1.DoExpression = DoExpression; expressions$1.EmptyStatement = EmptyStatement; expressions$1.ExpressionStatement = ExpressionStatement; expressions$1.Import = Import; expressions$1.MemberExpression = MemberExpression; expressions$1.MetaProperty = MetaProperty; expressions$1.ModuleExpression = ModuleExpression; expressions$1.NewExpression = NewExpression; expressions$1.OptionalCallExpression = OptionalCallExpression; expressions$1.OptionalMemberExpression = OptionalMemberExpression; expressions$1.ParenthesizedExpression = ParenthesizedExpression; expressions$1.PrivateName = PrivateName; expressions$1.SequenceExpression = SequenceExpression; expressions$1.Super = Super; expressions$1.ThisExpression = ThisExpression; expressions$1.UnaryExpression = UnaryExpression; expressions$1.UpdateExpression = UpdateExpression; expressions$1.V8IntrinsicIdentifier = V8IntrinsicIdentifier; expressions$1.YieldExpression = YieldExpression; expressions$1._shouldPrintDecoratorsBeforeExport = _shouldPrintDecoratorsBeforeExport; var _t = t$d; var n = requireNode(); const { isCallExpression: isCallExpression, isLiteral: isLiteral, isMemberExpression: isMemberExpression, isNewExpression: isNewExpression, } = _t; function UnaryExpression(node) { const { operator: operator } = node; if ( operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw" ) { this.word(operator); this.space(); } else { this.token(operator); } this.print(node.argument, node); } function DoExpression(node) { if (node.async) { this.word("async", true); this.space(); } this.word("do"); this.space(); this.print(node.body, node); } function ParenthesizedExpression(node) { this.tokenChar(40); this.print(node.expression, node); this.rightParens(node); } function UpdateExpression(node) { if (node.prefix) { this.token(node.operator); this.print(node.argument, node); } else { this.printTerminatorless(node.argument, node, true); this.token(node.operator); } } function ConditionalExpression(node) { this.print(node.test, node); this.space(); this.tokenChar(63); this.space(); this.print(node.consequent, node); this.space(); this.tokenChar(58); this.space(); this.print(node.alternate, node); } function NewExpression(node, parent) { this.word("new"); this.space(); this.print(node.callee, node); if ( this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { callee: node }) && !isMemberExpression(parent) && !isNewExpression(parent) ) { return; } this.print(node.typeArguments, node); this.print(node.typeParameters, node); if (node.optional) { this.token("?."); } this.tokenChar(40); this.printList(node.arguments, node); this.rightParens(node); } function SequenceExpression(node) { this.printList(node.expressions, node); } function ThisExpression() { this.word("this"); } function Super() { this.word("super"); } function isDecoratorMemberExpression(node) { switch (node.type) { case "Identifier": return true; case "MemberExpression": return ( !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object) ); default: return false; } } function shouldParenthesizeDecoratorExpression(node) { if (node.type === "ParenthesizedExpression") { return false; } return !isDecoratorMemberExpression( node.type === "CallExpression" ? node.callee : node, ); } function _shouldPrintDecoratorsBeforeExport(node) { if (typeof this.format.decoratorsBeforeExport === "boolean") { return this.format.decoratorsBeforeExport; } return ( typeof node.start === "number" && node.start === node.declaration.start ); } function Decorator(node) { this.tokenChar(64); const { expression: expression } = node; if (shouldParenthesizeDecoratorExpression(expression)) { this.tokenChar(40); this.print(expression, node); this.tokenChar(41); } else { this.print(expression, node); } this.newline(); } function OptionalMemberExpression(node) { let { computed: computed } = node; const { optional: optional, property: property } = node; this.print(node.object, node); if (!computed && isMemberExpression(property)) { throw new TypeError( "Got a MemberExpression for MemberExpression property", ); } if (isLiteral(property) && typeof property.value === "number") { computed = true; } if (optional) { this.token("?."); } if (computed) { this.tokenChar(91); this.print(property, node); this.tokenChar(93); } else { if (!optional) { this.tokenChar(46); } this.print(property, node); } } function OptionalCallExpression(node) { this.print(node.callee, node); this.print(node.typeParameters, node); if (node.optional) { this.token("?."); } this.print(node.typeArguments, node); this.tokenChar(40); this.printList(node.arguments, node); this.rightParens(node); } function CallExpression(node) { this.print(node.callee, node); this.print(node.typeArguments, node); this.print(node.typeParameters, node); this.tokenChar(40); this.printList(node.arguments, node); this.rightParens(node); } function Import() { this.word("import"); } function AwaitExpression(node) { this.word("await"); if (node.argument) { this.space(); this.printTerminatorless(node.argument, node, false); } } function YieldExpression(node) { this.word("yield", true); if (node.delegate) { this.tokenChar(42); if (node.argument) { this.space(); this.print(node.argument, node); } } else { if (node.argument) { this.space(); this.printTerminatorless(node.argument, node, false); } } } function EmptyStatement() { this.semicolon(true); } function ExpressionStatement(node) { this.print(node.expression, node); this.semicolon(); } function AssignmentPattern(node) { this.print(node.left, node); if (node.left.optional) this.tokenChar(63); this.print(node.left.typeAnnotation, node); this.space(); this.tokenChar(61); this.space(); this.print(node.right, node); } function AssignmentExpression(node, parent) { const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); if (parens) { this.tokenChar(40); } this.print(node.left, node); this.space(); if (node.operator === "in" || node.operator === "instanceof") { this.word(node.operator); } else { this.token(node.operator); } this.space(); this.print(node.right, node); if (parens) { this.tokenChar(41); } } function BindExpression(node) { this.print(node.object, node); this.token("::"); this.print(node.callee, node); } function MemberExpression(node) { this.print(node.object, node); if (!node.computed && isMemberExpression(node.property)) { throw new TypeError( "Got a MemberExpression for MemberExpression property", ); } let computed = node.computed; if (isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } if (computed) { this.tokenChar(91); this.print(node.property, node); this.tokenChar(93); } else { this.tokenChar(46); this.print(node.property, node); } } function MetaProperty(node) { this.print(node.meta, node); this.tokenChar(46); this.print(node.property, node); } function PrivateName(node) { this.tokenChar(35); this.print(node.id, node); } function V8IntrinsicIdentifier(node) { this.tokenChar(37); this.word(node.name); } function ModuleExpression(node) { this.word("module", true); this.space(); this.tokenChar(123); this.indent(); const { body: body } = node; if (body.body.length || body.directives.length) { this.newline(); } this.print(body, node); this.dedent(); this.rightBrace(node); } return expressions$1; } var statements$1 = {}; var hasRequiredStatements; function requireStatements() { if (hasRequiredStatements) return statements$1; hasRequiredStatements = 1; Object.defineProperty(statements$1, "__esModule", { value: true }); statements$1.BreakStatement = BreakStatement; statements$1.CatchClause = CatchClause; statements$1.ContinueStatement = ContinueStatement; statements$1.DebuggerStatement = DebuggerStatement; statements$1.DoWhileStatement = DoWhileStatement; statements$1.ForOfStatement = statements$1.ForInStatement = void 0; statements$1.ForStatement = ForStatement; statements$1.IfStatement = IfStatement; statements$1.LabeledStatement = LabeledStatement; statements$1.ReturnStatement = ReturnStatement; statements$1.SwitchCase = SwitchCase; statements$1.SwitchStatement = SwitchStatement; statements$1.ThrowStatement = ThrowStatement; statements$1.TryStatement = TryStatement; statements$1.VariableDeclaration = VariableDeclaration; statements$1.VariableDeclarator = VariableDeclarator; statements$1.WhileStatement = WhileStatement; statements$1.WithStatement = WithStatement; var _t = t$d; const { isFor: isFor, isForStatement: isForStatement, isIfStatement: isIfStatement, isStatement: isStatement, } = _t; function WithStatement(node) { this.word("with"); this.space(); this.tokenChar(40); this.print(node.object, node); this.tokenChar(41); this.printBlock(node); } function IfStatement(node) { this.word("if"); this.space(); this.tokenChar(40); this.print(node.test, node); this.tokenChar(41); this.space(); const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); if (needsBlock) { this.tokenChar(123); this.newline(); this.indent(); } this.printAndIndentOnComments(node.consequent, node); if (needsBlock) { this.dedent(); this.newline(); this.tokenChar(125); } if (node.alternate) { if (this.endsWith(125)) this.space(); this.word("else"); this.space(); this.printAndIndentOnComments(node.alternate, node); } } function getLastStatement(statement) { const { body: body } = statement; if (isStatement(body) === false) { return statement; } return getLastStatement(body); } function ForStatement(node) { this.word("for"); this.space(); this.tokenChar(40); this.inForStatementInitCounter++; this.print(node.init, node); this.inForStatementInitCounter--; this.tokenChar(59); if (node.test) { this.space(); this.print(node.test, node); } this.tokenChar(59); if (node.update) { this.space(); this.print(node.update, node); } this.tokenChar(41); this.printBlock(node); } function WhileStatement(node) { this.word("while"); this.space(); this.tokenChar(40); this.print(node.test, node); this.tokenChar(41); this.printBlock(node); } function ForXStatement(node) { this.word("for"); this.space(); const isForOf = node.type === "ForOfStatement"; if (isForOf && node.await) { this.word("await"); this.space(); } this.noIndentInnerCommentsHere(); this.tokenChar(40); this.print(node.left, node); this.space(); this.word(isForOf ? "of" : "in"); this.space(); this.print(node.right, node); this.tokenChar(41); this.printBlock(node); } statements$1.ForInStatement = ForXStatement; statements$1.ForOfStatement = ForXStatement; function DoWhileStatement(node) { this.word("do"); this.space(); this.print(node.body, node); this.space(); this.word("while"); this.space(); this.tokenChar(40); this.print(node.test, node); this.tokenChar(41); this.semicolon(); } function printStatementAfterKeyword(printer, node, parent, isLabel) { if (node) { printer.space(); printer.printTerminatorless(node, parent, isLabel); } printer.semicolon(); } function BreakStatement(node) { this.word("break"); printStatementAfterKeyword(this, node.label, node, true); } function ContinueStatement(node) { this.word("continue"); printStatementAfterKeyword(this, node.label, node, true); } function ReturnStatement(node) { this.word("return"); printStatementAfterKeyword(this, node.argument, node, false); } function ThrowStatement(node) { this.word("throw"); printStatementAfterKeyword(this, node.argument, node, false); } function LabeledStatement(node) { this.print(node.label, node); this.tokenChar(58); this.space(); this.print(node.body, node); } function TryStatement(node) { this.word("try"); this.space(); this.print(node.block, node); this.space(); if (node.handlers) { this.print(node.handlers[0], node); } else { this.print(node.handler, node); } if (node.finalizer) { this.space(); this.word("finally"); this.space(); this.print(node.finalizer, node); } } function CatchClause(node) { this.word("catch"); this.space(); if (node.param) { this.tokenChar(40); this.print(node.param, node); this.print(node.param.typeAnnotation, node); this.tokenChar(41); this.space(); } this.print(node.body, node); } function SwitchStatement(node) { this.word("switch"); this.space(); this.tokenChar(40); this.print(node.discriminant, node); this.tokenChar(41); this.space(); this.tokenChar(123); this.printSequence(node.cases, node, { indent: true, addNewlines(leading, cas) { if (!leading && node.cases[node.cases.length - 1] === cas) return -1; }, }); this.rightBrace(node); } function SwitchCase(node) { if (node.test) { this.word("case"); this.space(); this.print(node.test, node); this.tokenChar(58); } else { this.word("default"); this.tokenChar(58); } if (node.consequent.length) { this.newline(); this.printSequence(node.consequent, node, { indent: true }); } } function DebuggerStatement() { this.word("debugger"); this.semicolon(); } function VariableDeclaration(node, parent) { if (node.declare) { this.word("declare"); this.space(); } const { kind: kind } = node; this.word(kind, kind === "using" || kind === "await using"); this.space(); let hasInits = false; if (!isFor(parent)) { for (const declar of node.declarations) { if (declar.init) { hasInits = true; } } } this.printList(node.declarations, node, { separator: hasInits ? function () { this.tokenChar(44); this.newline(); } : undefined, indent: node.declarations.length > 1 ? true : false, }); if (isFor(parent)) { if (isForStatement(parent)) { if (parent.init === node) return; } else { if (parent.left === node) return; } } this.semicolon(); } function VariableDeclarator(node) { this.print(node.id, node); if (node.definite) this.tokenChar(33); this.print(node.id.typeAnnotation, node); if (node.init) { this.space(); this.tokenChar(61); this.space(); this.print(node.init, node); } } return statements$1; } var classes$1 = {}; var hasRequiredClasses; function requireClasses() { if (hasRequiredClasses) return classes$1; hasRequiredClasses = 1; Object.defineProperty(classes$1, "__esModule", { value: true }); classes$1.ClassAccessorProperty = ClassAccessorProperty; classes$1.ClassBody = ClassBody; classes$1.ClassExpression = classes$1.ClassDeclaration = ClassDeclaration; classes$1.ClassMethod = ClassMethod; classes$1.ClassPrivateMethod = ClassPrivateMethod; classes$1.ClassPrivateProperty = ClassPrivateProperty; classes$1.ClassProperty = ClassProperty; classes$1.StaticBlock = StaticBlock; classes$1._classMethodHead = _classMethodHead; var _t = t$d; const { isExportDefaultDeclaration: isExportDefaultDeclaration, isExportNamedDeclaration: isExportNamedDeclaration, } = _t; function ClassDeclaration(node, parent) { const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { this.printJoin(node.decorators, node); } if (node.declare) { this.word("declare"); this.space(); } if (node.abstract) { this.word("abstract"); this.space(); } this.word("class"); if (node.id) { this.space(); this.print(node.id, node); } this.print(node.typeParameters, node); if (node.superClass) { this.space(); this.word("extends"); this.space(); this.print(node.superClass, node); this.print(node.superTypeParameters, node); } if (node.implements) { this.space(); this.word("implements"); this.space(); this.printList(node.implements, node); } this.space(); this.print(node.body, node); } function ClassBody(node) { this.tokenChar(123); if (node.body.length === 0) { this.tokenChar(125); } else { this.newline(); this.printSequence(node.body, node, { indent: true }); if (!this.endsWith(10)) this.newline(); this.rightBrace(node); } } function ClassProperty(node) { var _node$key$loc; this.printJoin(node.decorators, node); const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line; if (endLine) this.catchUp(endLine); this.tsPrintClassMemberModifiers(node); if (node.computed) { this.tokenChar(91); this.print(node.key, node); this.tokenChar(93); } else { this._variance(node); this.print(node.key, node); } if (node.optional) { this.tokenChar(63); } if (node.definite) { this.tokenChar(33); } this.print(node.typeAnnotation, node); if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } this.semicolon(); } function ClassAccessorProperty(node) { var _node$key$loc2; this.printJoin(node.decorators, node); const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line; if (endLine) this.catchUp(endLine); this.tsPrintClassMemberModifiers(node); this.word("accessor", true); this.space(); if (node.computed) { this.tokenChar(91); this.print(node.key, node); this.tokenChar(93); } else { this._variance(node); this.print(node.key, node); } if (node.optional) { this.tokenChar(63); } if (node.definite) { this.tokenChar(33); } this.print(node.typeAnnotation, node); if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } this.semicolon(); } function ClassPrivateProperty(node) { this.printJoin(node.decorators, node); if (node.static) { this.word("static"); this.space(); } this.print(node.key, node); this.print(node.typeAnnotation, node); if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } this.semicolon(); } function ClassMethod(node) { this._classMethodHead(node); this.space(); this.print(node.body, node); } function ClassPrivateMethod(node) { this._classMethodHead(node); this.space(); this.print(node.body, node); } function _classMethodHead(node) { var _node$key$loc3; this.printJoin(node.decorators, node); const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line; if (endLine) this.catchUp(endLine); this.tsPrintClassMemberModifiers(node); this._methodHead(node); } function StaticBlock(node) { this.word("static"); this.space(); this.tokenChar(123); if (node.body.length === 0) { this.tokenChar(125); } else { this.newline(); this.printSequence(node.body, node, { indent: true }); this.rightBrace(node); } } return classes$1; } var methods$1 = {}; var hasRequiredMethods; function requireMethods() { if (hasRequiredMethods) return methods$1; hasRequiredMethods = 1; Object.defineProperty(methods$1, "__esModule", { value: true }); methods$1.ArrowFunctionExpression = ArrowFunctionExpression; methods$1.FunctionDeclaration = methods$1.FunctionExpression = FunctionExpression; methods$1._functionHead = _functionHead; methods$1._methodHead = _methodHead; methods$1._param = _param; methods$1._parameters = _parameters; methods$1._params = _params; methods$1._predicate = _predicate; var _t = t$d; const { isIdentifier: isIdentifier } = _t; function _params(node, idNode, parentNode) { this.print(node.typeParameters, node); const nameInfo = _getFuncIdName.call(this, idNode, parentNode); if (nameInfo) { this.sourceIdentifierName(nameInfo.name, nameInfo.pos); } this.tokenChar(40); this._parameters(node.params, node); this.tokenChar(41); const noLineTerminator = node.type === "ArrowFunctionExpression"; this.print(node.returnType, node, noLineTerminator); this._noLineTerminator = noLineTerminator; } function _parameters(parameters, parent) { const paramLength = parameters.length; for (let i = 0; i < paramLength; i++) { this._param(parameters[i], parent); if (i < parameters.length - 1) { this.tokenChar(44); this.space(); } } } function _param(parameter, parent) { this.printJoin(parameter.decorators, parameter); this.print(parameter, parent); if (parameter.optional) { this.tokenChar(63); } this.print(parameter.typeAnnotation, parameter); } function _methodHead(node) { const kind = node.kind; const key = node.key; if (kind === "get" || kind === "set") { this.word(kind); this.space(); } if (node.async) { this.word("async", true); this.space(); } if (kind === "method" || kind === "init") { if (node.generator) { this.tokenChar(42); } } if (node.computed) { this.tokenChar(91); this.print(key, node); this.tokenChar(93); } else { this.print(key, node); } if (node.optional) { this.tokenChar(63); } this._params( node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key, undefined, ); } function _predicate(node, noLineTerminatorAfter) { if (node.predicate) { if (!node.returnType) { this.tokenChar(58); } this.space(); this.print(node.predicate, node, noLineTerminatorAfter); } } function _functionHead(node, parent) { if (node.async) { this.word("async"); this._endsWithInnerRaw = false; this.space(); } this.word("function"); if (node.generator) { this._endsWithInnerRaw = false; this.tokenChar(42); } this.space(); if (node.id) { this.print(node.id, node); } this._params(node, node.id, parent); if (node.type !== "TSDeclareFunction") { this._predicate(node); } } function FunctionExpression(node, parent) { this._functionHead(node, parent); this.space(); this.print(node.body, node); } function ArrowFunctionExpression(node, parent) { if (node.async) { this.word("async", true); this.space(); } let firstParam; if ( !this.format.retainLines && node.params.length === 1 && isIdentifier((firstParam = node.params[0])) && !hasTypesOrComments(node, firstParam) ) { this.print(firstParam, node, true); } else { this._params(node, undefined, parent); } this._predicate(node, true); this.space(); this.printInnerComments(); this.token("=>"); this.space(); this.print(node.body, node); } function hasTypesOrComments(node, param) { var _param$leadingComment, _param$trailingCommen; return !!( node.typeParameters || node.returnType || node.predicate || param.typeAnnotation || param.optional || ((_param$leadingComment = param.leadingComments) != null && _param$leadingComment.length) || ((_param$trailingCommen = param.trailingComments) != null && _param$trailingCommen.length) ); } function _getFuncIdName(idNode, parent) { let id = idNode; if (!id && parent) { const parentType = parent.type; if (parentType === "VariableDeclarator") { id = parent.id; } else if ( parentType === "AssignmentExpression" || parentType === "AssignmentPattern" ) { id = parent.left; } else if ( parentType === "ObjectProperty" || parentType === "ClassProperty" ) { if (!parent.computed || parent.key.type === "StringLiteral") { id = parent.key; } } else if ( parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty" ) { id = parent.key; } } if (!id) return; let nameInfo; if (id.type === "Identifier") { var _id$loc, _id$loc2; nameInfo = { pos: (_id$loc = id.loc) == null ? void 0 : _id$loc.start, name: ((_id$loc2 = id.loc) == null ? void 0 : _id$loc2.identifierName) || id.name, }; } else if (id.type === "PrivateName") { var _id$loc3; nameInfo = { pos: (_id$loc3 = id.loc) == null ? void 0 : _id$loc3.start, name: "#" + id.id.name, }; } else if (id.type === "StringLiteral") { var _id$loc4; nameInfo = { pos: (_id$loc4 = id.loc) == null ? void 0 : _id$loc4.start, name: id.value, }; } return nameInfo; } return methods$1; } var modules$1 = {}; var hasRequiredModules; function requireModules() { if (hasRequiredModules) return modules$1; hasRequiredModules = 1; Object.defineProperty(modules$1, "__esModule", { value: true }); modules$1.ExportAllDeclaration = ExportAllDeclaration; modules$1.ExportDefaultDeclaration = ExportDefaultDeclaration; modules$1.ExportDefaultSpecifier = ExportDefaultSpecifier; modules$1.ExportNamedDeclaration = ExportNamedDeclaration; modules$1.ExportNamespaceSpecifier = ExportNamespaceSpecifier; modules$1.ExportSpecifier = ExportSpecifier; modules$1.ImportAttribute = ImportAttribute; modules$1.ImportDeclaration = ImportDeclaration; modules$1.ImportDefaultSpecifier = ImportDefaultSpecifier; modules$1.ImportExpression = ImportExpression; modules$1.ImportNamespaceSpecifier = ImportNamespaceSpecifier; modules$1.ImportSpecifier = ImportSpecifier; modules$1._printAttributes = _printAttributes; var _t = t$d; const { isClassDeclaration: isClassDeclaration, isExportDefaultSpecifier: isExportDefaultSpecifier, isExportNamespaceSpecifier: isExportNamespaceSpecifier, isImportDefaultSpecifier: isImportDefaultSpecifier, isImportNamespaceSpecifier: isImportNamespaceSpecifier, isStatement: isStatement, } = _t; function ImportSpecifier(node) { if (node.importKind === "type" || node.importKind === "typeof") { this.word(node.importKind); this.space(); } this.print(node.imported, node); if (node.local && node.local.name !== node.imported.name) { this.space(); this.word("as"); this.space(); this.print(node.local, node); } } function ImportDefaultSpecifier(node) { this.print(node.local, node); } function ExportDefaultSpecifier(node) { this.print(node.exported, node); } function ExportSpecifier(node) { if (node.exportKind === "type") { this.word("type"); this.space(); } this.print(node.local, node); if (node.exported && node.local.name !== node.exported.name) { this.space(); this.word("as"); this.space(); this.print(node.exported, node); } } function ExportNamespaceSpecifier(node) { this.tokenChar(42); this.space(); this.word("as"); this.space(); this.print(node.exported, node); } let warningShown = false; function _printAttributes(node) { const { importAttributesKeyword: importAttributesKeyword } = this.format; const { attributes: attributes, assertions: assertions } = node; if (attributes && !importAttributesKeyword && !warningShown) { warningShown = true; console.warn( `You are using import attributes, without specifying the desired output syntax.\nPlease specify the "importAttributesKeyword" generator option, whose value can be one of:\n - "with" : \`import { a } from "b" with { type: "json" };\`\n - "assert" : \`import { a } from "b" assert { type: "json" };\`\n - "with-legacy" : \`import { a } from "b" with type: "json";\`\n`, ); } const useAssertKeyword = importAttributesKeyword === "assert" || (!importAttributesKeyword && assertions); this.word(useAssertKeyword ? "assert" : "with"); this.space(); if (!useAssertKeyword && importAttributesKeyword !== "with") { this.printList(attributes || assertions, node); return; } this.tokenChar(123); this.space(); this.printList(attributes || assertions, node); this.space(); this.tokenChar(125); } function ExportAllDeclaration(node) { var _node$attributes, _node$assertions; this.word("export"); this.space(); if (node.exportKind === "type") { this.word("type"); this.space(); } this.tokenChar(42); this.space(); this.word("from"); this.space(); if ( ((_node$attributes = node.attributes) != null && _node$attributes.length) || ((_node$assertions = node.assertions) != null && _node$assertions.length) ) { this.print(node.source, node, true); this.space(); this._printAttributes(node); } else { this.print(node.source, node); } this.semicolon(); } function maybePrintDecoratorsBeforeExport(printer, node) { if ( isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node) ) { printer.printJoin(node.declaration.decorators, node); } } function ExportNamedDeclaration(node) { maybePrintDecoratorsBeforeExport(this, node); this.word("export"); this.space(); if (node.declaration) { const declar = node.declaration; this.print(declar, node); if (!isStatement(declar)) this.semicolon(); } else { if (node.exportKind === "type") { this.word("type"); this.space(); } const specifiers = node.specifiers.slice(0); let hasSpecial = false; for (;;) { const first = specifiers[0]; if ( isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first) ) { hasSpecial = true; this.print(specifiers.shift(), node); if (specifiers.length) { this.tokenChar(44); this.space(); } } else { break; } } if (specifiers.length || (!specifiers.length && !hasSpecial)) { this.tokenChar(123); if (specifiers.length) { this.space(); this.printList(specifiers, node); this.space(); } this.tokenChar(125); } if (node.source) { var _node$attributes2, _node$assertions2; this.space(); this.word("from"); this.space(); if ( ((_node$attributes2 = node.attributes) != null && _node$attributes2.length) || ((_node$assertions2 = node.assertions) != null && _node$assertions2.length) ) { this.print(node.source, node, true); this.space(); this._printAttributes(node); } else { this.print(node.source, node); } } this.semicolon(); } } function ExportDefaultDeclaration(node) { maybePrintDecoratorsBeforeExport(this, node); this.word("export"); this.noIndentInnerCommentsHere(); this.space(); this.word("default"); this.space(); const declar = node.declaration; this.print(declar, node); if (!isStatement(declar)) this.semicolon(); } function ImportDeclaration(node) { var _node$attributes3, _node$assertions3; this.word("import"); this.space(); const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; if (isTypeKind) { this.noIndentInnerCommentsHere(); this.word(node.importKind); this.space(); } else if (node.module) { this.noIndentInnerCommentsHere(); this.word("module"); this.space(); } else if (node.phase) { this.noIndentInnerCommentsHere(); this.word(node.phase); this.space(); } const specifiers = node.specifiers.slice(0); const hasSpecifiers = !!specifiers.length; while (hasSpecifiers) { const first = specifiers[0]; if ( isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first) ) { this.print(specifiers.shift(), node); if (specifiers.length) { this.tokenChar(44); this.space(); } } else { break; } } if (specifiers.length) { this.tokenChar(123); this.space(); this.printList(specifiers, node); this.space(); this.tokenChar(125); } else if (isTypeKind && !hasSpecifiers) { this.tokenChar(123); this.tokenChar(125); } if (hasSpecifiers || isTypeKind) { this.space(); this.word("from"); this.space(); } if ( ((_node$attributes3 = node.attributes) != null && _node$attributes3.length) || ((_node$assertions3 = node.assertions) != null && _node$assertions3.length) ) { this.print(node.source, node, true); this.space(); this._printAttributes(node); } else { this.print(node.source, node); } this.semicolon(); } function ImportAttribute(node) { this.print(node.key); this.tokenChar(58); this.space(); this.print(node.value); } function ImportNamespaceSpecifier(node) { this.tokenChar(42); this.space(); this.word("as"); this.space(); this.print(node.local, node); } function ImportExpression(node) { this.word("import"); if (node.phase) { this.tokenChar(46); this.word(node.phase); } this.tokenChar(40); this.print(node.source, node); if (node.options != null) { this.tokenChar(44); this.space(); this.print(node.options, node); } this.tokenChar(41); } return modules$1; } var types$2 = {}; var jsesc_1; var hasRequiredJsesc; function requireJsesc() { if (hasRequiredJsesc) return jsesc_1; hasRequiredJsesc = 1; const object = {}; const hasOwnProperty = object.hasOwnProperty; const forOwn = (object, callback) => { for (const key in object) { if (hasOwnProperty.call(object, key)) { callback(key, object[key]); } } }; const extend = (destination, source) => { if (!source) { return destination; } forOwn(source, (key, value) => { destination[key] = value; }); return destination; }; const forEach = (array, callback) => { const length = array.length; let index = -1; while (++index < length) { callback(array[index]); } }; const toString = object.toString; const isArray = Array.isArray; const isBuffer = Buffer.isBuffer; const isObject = (value) => toString.call(value) == "[object Object]"; const isString = (value) => typeof value == "string" || toString.call(value) == "[object String]"; const isNumber = (value) => typeof value == "number" || toString.call(value) == "[object Number]"; const isFunction = (value) => typeof value == "function"; const isMap = (value) => toString.call(value) == "[object Map]"; const isSet = (value) => toString.call(value) == "[object Set]"; const singleEscapes = { '"': '\\"', "'": "\\'", "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t", }; const regexSingleEscape = /["'\\\b\f\n\r\t]/; const regexDigit = /[0-9]/; const regexWhitelist = /[ !#-&\(-\[\]-_a-~]/; const jsesc = (argument, options) => { const increaseIndentation = () => { oldIndent = indent; ++options.indentLevel; indent = options.indent.repeat(options.indentLevel); }; const defaults = { escapeEverything: false, minimal: false, isScriptContext: false, quotes: "single", wrap: false, es6: false, json: false, compact: true, lowercaseHex: false, numbers: "decimal", indent: "\t", indentLevel: 0, __inline1__: false, __inline2__: false, }; const json = options && options.json; if (json) { defaults.quotes = "double"; defaults.wrap = true; } options = extend(defaults, options); if ( options.quotes != "single" && options.quotes != "double" && options.quotes != "backtick" ) { options.quotes = "single"; } const quote = options.quotes == "double" ? '"' : options.quotes == "backtick" ? "`" : "'"; const compact = options.compact; const lowercaseHex = options.lowercaseHex; let indent = options.indent.repeat(options.indentLevel); let oldIndent = ""; const inline1 = options.__inline1__; const inline2 = options.__inline2__; const newLine = compact ? "" : "\n"; let result; let isEmpty = true; const useBinNumbers = options.numbers == "binary"; const useOctNumbers = options.numbers == "octal"; const useDecNumbers = options.numbers == "decimal"; const useHexNumbers = options.numbers == "hexadecimal"; if (json && argument && isFunction(argument.toJSON)) { argument = argument.toJSON(); } if (!isString(argument)) { if (isMap(argument)) { if (argument.size == 0) { return "new Map()"; } if (!compact) { options.__inline1__ = true; options.__inline2__ = false; } return "new Map(" + jsesc(Array.from(argument), options) + ")"; } if (isSet(argument)) { if (argument.size == 0) { return "new Set()"; } return "new Set(" + jsesc(Array.from(argument), options) + ")"; } if (isBuffer(argument)) { if (argument.length == 0) { return "Buffer.from([])"; } return "Buffer.from(" + jsesc(Array.from(argument), options) + ")"; } if (isArray(argument)) { result = []; options.wrap = true; if (inline1) { options.__inline1__ = false; options.__inline2__ = true; } if (!inline2) { increaseIndentation(); } forEach(argument, (value) => { isEmpty = false; if (inline2) { options.__inline2__ = false; } result.push( (compact || inline2 ? "" : indent) + jsesc(value, options), ); }); if (isEmpty) { return "[]"; } if (inline2) { return "[" + result.join(", ") + "]"; } return ( "[" + newLine + result.join("," + newLine) + newLine + (compact ? "" : oldIndent) + "]" ); } else if (isNumber(argument)) { if (json) { return JSON.stringify(argument); } if (useDecNumbers) { return String(argument); } if (useHexNumbers) { let hexadecimal = argument.toString(16); if (!lowercaseHex) { hexadecimal = hexadecimal.toUpperCase(); } return "0x" + hexadecimal; } if (useBinNumbers) { return "0b" + argument.toString(2); } if (useOctNumbers) { return "0o" + argument.toString(8); } } else if (!isObject(argument)) { if (json) { return JSON.stringify(argument) || "null"; } return String(argument); } else { result = []; options.wrap = true; increaseIndentation(); forOwn(argument, (key, value) => { isEmpty = false; result.push( (compact ? "" : indent) + jsesc(key, options) + ":" + (compact ? "" : " ") + jsesc(value, options), ); }); if (isEmpty) { return "{}"; } return ( "{" + newLine + result.join("," + newLine) + newLine + (compact ? "" : oldIndent) + "}" ); } } const string = argument; let index = -1; const length = string.length; result = ""; while (++index < length) { const character = string.charAt(index); if (options.es6) { const first = string.charCodeAt(index); if (first >= 55296 && first <= 56319 && length > index + 1) { const second = string.charCodeAt(index + 1); if (second >= 56320 && second <= 57343) { const codePoint = (first - 55296) * 1024 + second - 56320 + 65536; let hexadecimal = codePoint.toString(16); if (!lowercaseHex) { hexadecimal = hexadecimal.toUpperCase(); } result += "\\u{" + hexadecimal + "}"; ++index; continue; } } } if (!options.escapeEverything) { if (regexWhitelist.test(character)) { result += character; continue; } if (character == '"') { result += quote == character ? '\\"' : character; continue; } if (character == "`") { result += quote == character ? "\\`" : character; continue; } if (character == "'") { result += quote == character ? "\\'" : character; continue; } } if ( character == "\0" && !json && !regexDigit.test(string.charAt(index + 1)) ) { result += "\\0"; continue; } if (regexSingleEscape.test(character)) { result += singleEscapes[character]; continue; } const charCode = character.charCodeAt(0); if (options.minimal && charCode != 8232 && charCode != 8233) { result += character; continue; } let hexadecimal = charCode.toString(16); if (!lowercaseHex) { hexadecimal = hexadecimal.toUpperCase(); } const longhand = hexadecimal.length > 2 || json; const escaped = "\\" + (longhand ? "u" : "x") + ("0000" + hexadecimal).slice(longhand ? -4 : -2); result += escaped; continue; } if (options.wrap) { result = quote + result + quote; } if (quote == "`") { result = result.replace(/\$\{/g, "\\${"); } if (options.isScriptContext) { return result .replace(/<\/(script|style)/gi, "<\\/$1") .replace(/