UNPKG

vitest

Version:

A blazing fast unit test framework powered by Vite

1,806 lines (1,551 loc) 185 kB
import { getCurrentSuite } from '@vitest/runner'; import { createChainable, getNames } from '@vitest/runner/utils'; import { getSafeTimers, noop, createSimpleStackTrace } from '@vitest/utils'; import { g as getWorkerState, i as isRunningInBenchmark, a as getCallLastIndex, b as getCurrentEnvironment, r as resetModules } from './chunk-utils-env.04ffbef7.js'; import * as chai$1 from 'chai'; import { expect } from 'chai'; import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js'; import { equals, iterableEquality, subsetEquality, JestExtend, JestChaiExpect, JestAsymmetricMatchers, GLOBAL_EXPECT, getState, setState } from '@vitest/expect'; import { r as rpc } from './chunk-runtime-rpc.1b5714dc.js'; import { join, dirname } from 'pathe'; import { g as getSnapshotEnvironment } from './chunk-snapshot-env.a347d647.js'; import { i as isObject } from './chunk-utils-base.81f83dbd.js'; import { p as positionToOffset, o as offsetToLineNumber, l as lineSplitRE, a as parseErrorStacktrace, g as getFullName, b as parseSingleStack } from './chunk-utils-tasks.b41c8284.js'; import require$$0 from 'util'; import { spyOn, fn, isMockFunction, spies } from '@vitest/spy'; function waitNextTick() { const { setTimeout } = getSafeTimers(); return new Promise((resolve) => setTimeout(resolve, 0)); } async function waitForImportsToResolve() { await waitNextTick(); const state = getWorkerState(); const promises = []; let resolvingCount = 0; for (const mod of state.moduleCache.values()) { if (mod.promise && !mod.evaluated) promises.push(mod.promise); if (mod.resolving) resolvingCount++; } if (!promises.length && !resolvingCount) return; await Promise.allSettled(promises); await waitForImportsToResolve(); } const benchFns = /* @__PURE__ */ new WeakMap(); const benchOptsMap = /* @__PURE__ */ new WeakMap(); function getBenchOptions(key) { return benchOptsMap.get(key); } function getBenchFn(key) { return benchFns.get(key); } const bench = createBenchmark( function(name, fn = noop, options = {}) { if (!isRunningInBenchmark()) throw new Error("`bench()` is only available in benchmark mode."); const task = getCurrentSuite().custom.call(this, name); task.meta = { benchmark: true }; benchFns.set(task, fn); benchOptsMap.set(task, options); } ); function createBenchmark(fn) { const benchmark = createChainable( ["skip", "only", "todo"], fn ); benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark; benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip; return benchmark; } function commonjsRequire(path) { throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var chaiSubset = {exports: {}}; (function (module, exports) { (function() { (function(chaiSubset) { if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') { return module.exports = chaiSubset; } else { return chai.use(chaiSubset); } })(function(chai, utils) { var Assertion = chai.Assertion; var assertionPrototype = Assertion.prototype; Assertion.addMethod('containSubset', function (expected) { var actual = utils.flag(this, 'object'); var showDiff = chai.config.showDiff; assertionPrototype.assert.call(this, compare(expected, actual), 'expected #{act} to contain subset #{exp}', 'expected #{act} to not contain subset #{exp}', expected, actual, showDiff ); }); chai.assert.containSubset = function(val, exp, msg) { new chai.Assertion(val, msg).to.be.containSubset(exp); }; function compare(expected, actual) { if (expected === actual) { return true; } if (typeof(actual) !== typeof(expected)) { return false; } if (typeof(expected) !== 'object' || expected === null) { return expected === actual; } if (!!expected && !actual) { return false; } if (Array.isArray(expected)) { if (typeof(actual.length) !== 'number') { return false; } var aa = Array.prototype.slice.call(actual); return expected.every(function (exp) { return aa.some(function (act) { return compare(exp, act); }); }); } if (expected instanceof Date) { if (actual instanceof Date) { return expected.getTime() === actual.getTime(); } else { return false; } } return Object.keys(expected).every(function (key) { var eo = expected[key]; var ao = actual[key]; if (typeof(eo) === 'object' && eo !== null && ao !== null) { return compare(eo, ao); } if (typeof(eo) === 'function') { return eo(ao); } return ao === eo; }); } }); }).call(commonjsGlobal); } (chaiSubset)); var Subset = chaiSubset.exports; var naturalCompare$1 = {exports: {}}; /* * @version 1.4.0 * @date 2015-10-26 * @stability 3 - Stable * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite) * @license MIT License */ var naturalCompare = function(a, b) { var i, codeA , codeB = 1 , posA = 0 , posB = 0 , alphabet = String.alphabet; function getCode(str, pos, code) { if (code) { for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i; return +str.slice(pos - 1, i) } code = alphabet && alphabet.indexOf(str.charAt(pos)); return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code : code < 46 ? 65 // - : code < 48 ? code - 1 : code < 58 ? code + 18 // 0-9 : code < 65 ? code - 11 : code < 91 ? code + 11 // A-Z : code < 97 ? code - 37 : code < 123 ? code + 5 // a-z : code - 63 } if ((a+="") != (b+="")) for (;codeB;) { codeA = getCode(a, posA++); codeB = getCode(b, posB++); if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) { codeA = getCode(a, posA, posA); codeB = getCode(b, posB, posA = i); posB = i; } if (codeA != codeB) return (codeA < codeB) ? -1 : 1 } return 0 }; try { naturalCompare$1.exports = naturalCompare; } catch (e) { String.naturalCompare = naturalCompare; } var build = {}; var ansiStyles = {exports: {}}; (function (module) { const ANSI_BACKGROUND_OFFSET = 10; const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; function assembleStyles() { const codes = new Map(); const styles = { modifier: { reset: [0, 0], // 21 isn't widely supported and 22 does the same thing bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], // Bright color blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], // Bright color bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } }; // Alias bright black as gray (and grey) styles.color.gray = styles.color.blackBright; styles.bgColor.bgGray = styles.bgColor.bgBlackBright; styles.color.grey = styles.color.blackBright; styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; for (const [groupName, group] of Object.entries(styles)) { for (const [styleName, style] of Object.entries(group)) { styles[styleName] = { open: `\u001B[${style[0]}m`, close: `\u001B[${style[1]}m` }; group[styleName] = styles[styleName]; codes.set(style[0], style[1]); } Object.defineProperty(styles, groupName, { value: group, enumerable: false }); } Object.defineProperty(styles, 'codes', { value: codes, enumerable: false }); styles.color.close = '\u001B[39m'; styles.bgColor.close = '\u001B[49m'; styles.color.ansi256 = wrapAnsi256(); styles.color.ansi16m = wrapAnsi16m(); styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js Object.defineProperties(styles, { rgbToAnsi256: { value: (red, green, blue) => { // We use the extended greyscale palette here, with the exception of // black and white. normal palette only has 4 greyscale shades. if (red === green && green === blue) { if (red < 8) { return 16; } if (red > 248) { return 231; } return Math.round(((red - 8) / 247) * 24) + 232; } return 16 + (36 * Math.round(red / 255 * 5)) + (6 * Math.round(green / 255 * 5)) + Math.round(blue / 255 * 5); }, enumerable: false }, hexToRgb: { value: hex => { const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); if (!matches) { return [0, 0, 0]; } let {colorString} = matches.groups; if (colorString.length === 3) { colorString = colorString.split('').map(character => character + character).join(''); } const integer = Number.parseInt(colorString, 16); return [ (integer >> 16) & 0xFF, (integer >> 8) & 0xFF, integer & 0xFF ]; }, enumerable: false }, hexToAnsi256: { value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), enumerable: false } }); return styles; } // Make the export immutable Object.defineProperty(module, 'exports', { enumerable: true, get: assembleStyles }); } (ansiStyles)); var collections = {}; Object.defineProperty(collections, '__esModule', { value: true }); collections.printIteratorEntries = printIteratorEntries; collections.printIteratorValues = printIteratorValues; collections.printListItems = printListItems; collections.printObjectProperties = printObjectProperties; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ const getKeysOfEnumerableProperties = (object, compareKeys) => { const keys = Object.keys(object).sort(compareKeys); if (Object.getOwnPropertySymbols) { Object.getOwnPropertySymbols(object).forEach(symbol => { if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) { keys.push(symbol); } }); } return keys; }; /** * Return entries (for example, of a map) * with spacing, indentation, and comma * without surrounding punctuation (for example, braces) */ function printIteratorEntries( iterator, config, indentation, depth, refs, printer, // Too bad, so sad that separator for ECMAScript Map has been ' => ' // What a distracting diff if you change a data structure to/from // ECMAScript Object or Immutable.Map/OrderedMap which use the default. separator = ': ' ) { let result = ''; let current = iterator.next(); if (!current.done) { result += config.spacingOuter; const indentationNext = indentation + config.indent; while (!current.done) { const name = printer( current.value[0], config, indentationNext, depth, refs ); const value = printer( current.value[1], config, indentationNext, depth, refs ); result += indentationNext + name + separator + value; current = iterator.next(); if (!current.done) { result += ',' + config.spacingInner; } else if (!config.min) { result += ','; } } result += config.spacingOuter + indentation; } return result; } /** * Return values (for example, of a set) * with spacing, indentation, and comma * without surrounding punctuation (braces or brackets) */ function printIteratorValues( iterator, config, indentation, depth, refs, printer ) { let result = ''; let current = iterator.next(); if (!current.done) { result += config.spacingOuter; const indentationNext = indentation + config.indent; while (!current.done) { result += indentationNext + printer(current.value, config, indentationNext, depth, refs); current = iterator.next(); if (!current.done) { result += ',' + config.spacingInner; } else if (!config.min) { result += ','; } } result += config.spacingOuter + indentation; } return result; } /** * Return items (for example, of an array) * with spacing, indentation, and comma * without surrounding punctuation (for example, brackets) **/ function printListItems(list, config, indentation, depth, refs, printer) { let result = ''; if (list.length) { result += config.spacingOuter; const indentationNext = indentation + config.indent; for (let i = 0; i < list.length; i++) { result += indentationNext; if (i in list) { result += printer(list[i], config, indentationNext, depth, refs); } if (i < list.length - 1) { result += ',' + config.spacingInner; } else if (!config.min) { result += ','; } } result += config.spacingOuter + indentation; } return result; } /** * Return properties of an object * with spacing, indentation, and comma * without surrounding punctuation (for example, braces) */ function printObjectProperties(val, config, indentation, depth, refs, printer) { let result = ''; const keys = getKeysOfEnumerableProperties(val, config.compareKeys); if (keys.length) { result += config.spacingOuter; const indentationNext = indentation + config.indent; for (let i = 0; i < keys.length; i++) { const key = keys[i]; const name = printer(key, config, indentationNext, depth, refs); const value = printer(val[key], config, indentationNext, depth, refs); result += indentationNext + name + ': ' + value; if (i < keys.length - 1) { result += ',' + config.spacingInner; } else if (!config.min) { result += ','; } } result += config.spacingOuter + indentation; } return result; } var AsymmetricMatcher$1 = {}; Object.defineProperty(AsymmetricMatcher$1, '__esModule', { value: true }); AsymmetricMatcher$1.test = AsymmetricMatcher$1.serialize = AsymmetricMatcher$1.default = void 0; var _collections$3 = collections; var global$2 = (function () { if (typeof globalThis !== 'undefined') { return globalThis; } else if (typeof global$2 !== 'undefined') { return global$2; } else if (typeof self !== 'undefined') { return self; } else if (typeof window !== 'undefined') { return window; } else { return Function('return this')(); } })(); var Symbol$2 = global$2['jest-symbol-do-not-touch'] || global$2.Symbol; const asymmetricMatcher = typeof Symbol$2 === 'function' && Symbol$2.for ? Symbol$2.for('jest.asymmetricMatcher') : 0x1357a5; const SPACE$2 = ' '; const serialize$8 = (val, config, indentation, depth, refs, printer) => { const stringedValue = val.toString(); if ( stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining' ) { if (++depth > config.maxDepth) { return '[' + stringedValue + ']'; } return ( stringedValue + SPACE$2 + '[' + (0, _collections$3.printListItems)( val.sample, config, indentation, depth, refs, printer ) + ']' ); } if ( stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining' ) { if (++depth > config.maxDepth) { return '[' + stringedValue + ']'; } return ( stringedValue + SPACE$2 + '{' + (0, _collections$3.printObjectProperties)( val.sample, config, indentation, depth, refs, printer ) + '}' ); } if ( stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching' ) { return ( stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs) ); } if ( stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining' ) { return ( stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs) ); } return val.toAsymmetricMatcher(); }; AsymmetricMatcher$1.serialize = serialize$8; const test$7 = val => val && val.$$typeof === asymmetricMatcher; AsymmetricMatcher$1.test = test$7; const plugin$7 = { serialize: serialize$8, test: test$7 }; var _default$7 = plugin$7; AsymmetricMatcher$1.default = _default$7; var ConvertAnsi = {}; var ansiRegex = ({onlyFirst = false} = {}) => { const pattern = [ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); return new RegExp(pattern, onlyFirst ? undefined : 'g'); }; Object.defineProperty(ConvertAnsi, '__esModule', { value: true }); ConvertAnsi.test = ConvertAnsi.serialize = ConvertAnsi.default = void 0; var _ansiRegex = _interopRequireDefault$2(ansiRegex); var _ansiStyles$1 = _interopRequireDefault$2(ansiStyles.exports); function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : {default: obj}; } /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const toHumanReadableAnsi = text => text.replace((0, _ansiRegex.default)(), match => { switch (match) { case _ansiStyles$1.default.red.close: case _ansiStyles$1.default.green.close: case _ansiStyles$1.default.cyan.close: case _ansiStyles$1.default.gray.close: case _ansiStyles$1.default.white.close: case _ansiStyles$1.default.yellow.close: case _ansiStyles$1.default.bgRed.close: case _ansiStyles$1.default.bgGreen.close: case _ansiStyles$1.default.bgYellow.close: case _ansiStyles$1.default.inverse.close: case _ansiStyles$1.default.dim.close: case _ansiStyles$1.default.bold.close: case _ansiStyles$1.default.reset.open: case _ansiStyles$1.default.reset.close: return '</>'; case _ansiStyles$1.default.red.open: return '<red>'; case _ansiStyles$1.default.green.open: return '<green>'; case _ansiStyles$1.default.cyan.open: return '<cyan>'; case _ansiStyles$1.default.gray.open: return '<gray>'; case _ansiStyles$1.default.white.open: return '<white>'; case _ansiStyles$1.default.yellow.open: return '<yellow>'; case _ansiStyles$1.default.bgRed.open: return '<bgRed>'; case _ansiStyles$1.default.bgGreen.open: return '<bgGreen>'; case _ansiStyles$1.default.bgYellow.open: return '<bgYellow>'; case _ansiStyles$1.default.inverse.open: return '<inverse>'; case _ansiStyles$1.default.dim.open: return '<dim>'; case _ansiStyles$1.default.bold.open: return '<bold>'; default: return ''; } }); const test$6 = val => typeof val === 'string' && !!val.match((0, _ansiRegex.default)()); ConvertAnsi.test = test$6; const serialize$7 = (val, config, indentation, depth, refs, printer) => printer(toHumanReadableAnsi(val), config, indentation, depth, refs); ConvertAnsi.serialize = serialize$7; const plugin$6 = { serialize: serialize$7, test: test$6 }; var _default$6 = plugin$6; ConvertAnsi.default = _default$6; var DOMCollection$1 = {}; Object.defineProperty(DOMCollection$1, '__esModule', { value: true }); DOMCollection$1.test = DOMCollection$1.serialize = DOMCollection$1.default = void 0; var _collections$2 = collections; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /* eslint-disable local/ban-types-eventually */ const SPACE$1 = ' '; const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap']; const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/; const testName = name => OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name); const test$5 = val => val && val.constructor && !!val.constructor.name && testName(val.constructor.name); DOMCollection$1.test = test$5; const isNamedNodeMap = collection => collection.constructor.name === 'NamedNodeMap'; const serialize$6 = (collection, config, indentation, depth, refs, printer) => { const name = collection.constructor.name; if (++depth > config.maxDepth) { return '[' + name + ']'; } return ( (config.min ? '' : name + SPACE$1) + (OBJECT_NAMES.indexOf(name) !== -1 ? '{' + (0, _collections$2.printObjectProperties)( isNamedNodeMap(collection) ? Array.from(collection).reduce((props, attribute) => { props[attribute.name] = attribute.value; return props; }, {}) : {...collection}, config, indentation, depth, refs, printer ) + '}' : '[' + (0, _collections$2.printListItems)( Array.from(collection), config, indentation, depth, refs, printer ) + ']') ); }; DOMCollection$1.serialize = serialize$6; const plugin$5 = { serialize: serialize$6, test: test$5 }; var _default$5 = plugin$5; DOMCollection$1.default = _default$5; var DOMElement$1 = {}; var markup = {}; var escapeHTML$1 = {}; Object.defineProperty(escapeHTML$1, '__esModule', { value: true }); escapeHTML$1.default = escapeHTML; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ function escapeHTML(str) { return str.replace(/</g, '&lt;').replace(/>/g, '&gt;'); } Object.defineProperty(markup, '__esModule', { value: true }); markup.printText = markup.printProps = markup.printElementAsLeaf = markup.printElement = markup.printComment = markup.printChildren = void 0; var _escapeHTML = _interopRequireDefault$1(escapeHTML$1); function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : {default: obj}; } /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // Return empty string if keys is empty. const printProps = (keys, props, config, indentation, depth, refs, printer) => { const indentationNext = indentation + config.indent; const colors = config.colors; return keys .map(key => { const value = props[key]; let printed = printer(value, config, indentationNext, depth, refs); if (typeof value !== 'string') { if (printed.indexOf('\n') !== -1) { printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation; } printed = '{' + printed + '}'; } return ( config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close ); }) .join(''); }; // Return empty string if children is empty. markup.printProps = printProps; const printChildren = (children, config, indentation, depth, refs, printer) => children .map( child => config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs)) ) .join(''); markup.printChildren = printChildren; const printText = (text, config) => { const contentColor = config.colors.content; return ( contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close ); }; markup.printText = printText; const printComment = (comment, config) => { const commentColor = config.colors.comment; return ( commentColor.open + '<!--' + (0, _escapeHTML.default)(comment) + '-->' + commentColor.close ); }; // Separate the functions to format props, children, and element, // so a plugin could override a particular function, if needed. // Too bad, so sad: the traditional (but unnecessary) space // in a self-closing tagColor requires a second test of printedProps. markup.printComment = printComment; const printElement = ( type, printedProps, printedChildren, config, indentation ) => { const tagColor = config.colors.tag; return ( tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close ); }; markup.printElement = printElement; const printElementAsLeaf = (type, config) => { const tagColor = config.colors.tag; return ( tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close ); }; markup.printElementAsLeaf = printElementAsLeaf; Object.defineProperty(DOMElement$1, '__esModule', { value: true }); DOMElement$1.test = DOMElement$1.serialize = DOMElement$1.default = void 0; var _markup$2 = markup; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const ELEMENT_NODE = 1; const TEXT_NODE = 3; const COMMENT_NODE = 8; const FRAGMENT_NODE = 11; const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/; const testHasAttribute = val => { try { return typeof val.hasAttribute === 'function' && val.hasAttribute('is'); } catch { return false; } }; const testNode = val => { const constructorName = val.constructor.name; const {nodeType, tagName} = val; const isCustomElement = (typeof tagName === 'string' && tagName.includes('-')) || testHasAttribute(val); return ( (nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) || (nodeType === TEXT_NODE && constructorName === 'Text') || (nodeType === COMMENT_NODE && constructorName === 'Comment') || (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment') ); }; const test$4 = val => { var _val$constructor; return ( (val === null || val === void 0 ? void 0 : (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val) ); }; DOMElement$1.test = test$4; function nodeIsText(node) { return node.nodeType === TEXT_NODE; } function nodeIsComment(node) { return node.nodeType === COMMENT_NODE; } function nodeIsFragment(node) { return node.nodeType === FRAGMENT_NODE; } const serialize$5 = (node, config, indentation, depth, refs, printer) => { if (nodeIsText(node)) { return (0, _markup$2.printText)(node.data, config); } if (nodeIsComment(node)) { return (0, _markup$2.printComment)(node.data, config); } const type = nodeIsFragment(node) ? 'DocumentFragment' : node.tagName.toLowerCase(); if (++depth > config.maxDepth) { return (0, _markup$2.printElementAsLeaf)(type, config); } return (0, _markup$2.printElement)( type, (0, _markup$2.printProps)( nodeIsFragment(node) ? [] : Array.from(node.attributes) .map(attr => attr.name) .sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => { props[attribute.name] = attribute.value; return props; }, {}), config, indentation + config.indent, depth, refs, printer ), (0, _markup$2.printChildren)( Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer ), config, indentation ); }; DOMElement$1.serialize = serialize$5; const plugin$4 = { serialize: serialize$5, test: test$4 }; var _default$4 = plugin$4; DOMElement$1.default = _default$4; var Immutable$1 = {}; Object.defineProperty(Immutable$1, '__esModule', { value: true }); Immutable$1.test = Immutable$1.serialize = Immutable$1.default = void 0; var _collections$1 = collections; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // SENTINEL constants are from https://github.com/facebook/immutable-js const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4 const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; const getImmutableName = name => 'Immutable.' + name; const printAsLeaf = name => '[' + name + ']'; const SPACE = ' '; const LAZY = '…'; // Seq is lazy if it calls a method like filter const printImmutableEntries = ( val, config, indentation, depth, refs, printer, type ) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '{' + (0, _collections$1.printIteratorEntries)( val.entries(), config, indentation, depth, refs, printer ) + '}'; // Record has an entries method because it is a collection in immutable v3. // Return an iterator for Immutable Record from version v3 or v4. function getRecordEntries(val) { let i = 0; return { next() { if (i < val._keys.length) { const key = val._keys[i++]; return { done: false, value: [key, val.get(key)] }; } return { done: true, value: undefined }; } }; } const printImmutableRecord = ( val, config, indentation, depth, refs, printer ) => { // _name property is defined only for an Immutable Record instance // which was constructed with a second optional descriptive name arg const name = getImmutableName(val._name || 'Record'); return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE + '{' + (0, _collections$1.printIteratorEntries)( getRecordEntries(val), config, indentation, depth, refs, printer ) + '}'; }; const printImmutableSeq = (val, config, indentation, depth, refs, printer) => { const name = getImmutableName('Seq'); if (++depth > config.maxDepth) { return printAsLeaf(name); } if (val[IS_KEYED_SENTINEL]) { return ( name + SPACE + '{' + // from Immutable collection of entries or from ECMAScript object (val._iter || val._object ? (0, _collections$1.printIteratorEntries)( val.entries(), config, indentation, depth, refs, printer ) : LAZY) + '}' ); } return ( name + SPACE + '[' + (val._iter || // from Immutable collection of values val._array || // from ECMAScript array val._collection || // from ECMAScript collection in immutable v4 val._iterable // from ECMAScript collection in immutable v3 ? (0, _collections$1.printIteratorValues)( val.values(), config, indentation, depth, refs, printer ) : LAZY) + ']' ); }; const printImmutableValues = ( val, config, indentation, depth, refs, printer, type ) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '[' + (0, _collections$1.printIteratorValues)( val.values(), config, indentation, depth, refs, printer ) + ']'; const serialize$4 = (val, config, indentation, depth, refs, printer) => { if (val[IS_MAP_SENTINEL]) { return printImmutableEntries( val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map' ); } if (val[IS_LIST_SENTINEL]) { return printImmutableValues( val, config, indentation, depth, refs, printer, 'List' ); } if (val[IS_SET_SENTINEL]) { return printImmutableValues( val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set' ); } if (val[IS_STACK_SENTINEL]) { return printImmutableValues( val, config, indentation, depth, refs, printer, 'Stack' ); } if (val[IS_SEQ_SENTINEL]) { return printImmutableSeq(val, config, indentation, depth, refs, printer); } // For compatibility with immutable v3 and v4, let record be the default. return printImmutableRecord(val, config, indentation, depth, refs, printer); }; // Explicitly comparing sentinel properties to true avoids false positive // when mock identity-obj-proxy returns the key as the value for any key. Immutable$1.serialize = serialize$4; const test$3 = val => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true); Immutable$1.test = test$3; const plugin$3 = { serialize: serialize$4, test: test$3 }; var _default$3 = plugin$3; Immutable$1.default = _default$3; var ReactElement$1 = {}; var reactIs = {exports: {}}; var reactIs_production_min = {}; /** @license React v17.0.2 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var hasRequiredReactIs_production_min; function requireReactIs_production_min () { if (hasRequiredReactIs_production_min) return reactIs_production_min; hasRequiredReactIs_production_min = 1; var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131; if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden");} function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=z;reactIs_production_min.Element=A;reactIs_production_min.ForwardRef=B;reactIs_production_min.Fragment=C;reactIs_production_min.Lazy=D;reactIs_production_min.Memo=E;reactIs_production_min.Portal=F;reactIs_production_min.Profiler=G;reactIs_production_min.StrictMode=H; reactIs_production_min.Suspense=I;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return y(a)===h};reactIs_production_min.isContextProvider=function(a){return y(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return y(a)===k};reactIs_production_min.isFragment=function(a){return y(a)===d};reactIs_production_min.isLazy=function(a){return y(a)===p};reactIs_production_min.isMemo=function(a){return y(a)===n}; reactIs_production_min.isPortal=function(a){return y(a)===c};reactIs_production_min.isProfiler=function(a){return y(a)===f};reactIs_production_min.isStrictMode=function(a){return y(a)===e};reactIs_production_min.isSuspense=function(a){return y(a)===l};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1}; reactIs_production_min.typeOf=y; return reactIs_production_min; } var reactIs_development = {}; /** @license React v17.0.2 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var hasRequiredReactIs_development; function requireReactIs_development () { if (hasRequiredReactIs_development) return reactIs_development; hasRequiredReactIs_development = 1; if (process.env.NODE_ENV !== "production") { (function() { // ATTENTION // When adding new symbols to this file, // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var REACT_ELEMENT_TYPE = 0xeac7; var REACT_PORTAL_TYPE = 0xeaca; var REACT_FRAGMENT_TYPE = 0xeacb; var REACT_STRICT_MODE_TYPE = 0xeacc; var REACT_PROFILER_TYPE = 0xead2; var REACT_PROVIDER_TYPE = 0xeacd; var REACT_CONTEXT_TYPE = 0xeace; var REACT_FORWARD_REF_TYPE = 0xead0; var REACT_SUSPENSE_TYPE = 0xead1; var REACT_SUSPENSE_LIST_TYPE = 0xead8; var REACT_MEMO_TYPE = 0xead3; var REACT_LAZY_TYPE = 0xead4; var REACT_BLOCK_TYPE = 0xead9; var REACT_SERVER_BLOCK_TYPE = 0xeada; var REACT_FUNDAMENTAL_TYPE = 0xead5; var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; var REACT_LEGACY_HIDDEN_TYPE = 0xeae3; if (typeof Symbol === 'function' && Symbol.for) { var symbolFor = Symbol.for; REACT_ELEMENT_TYPE = symbolFor('react.element'); REACT_PORTAL_TYPE = symbolFor('react.portal'); REACT_FRAGMENT_TYPE = symbolFor('react.fragment'); REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'); REACT_PROFILER_TYPE = symbolFor('react.profiler'); REACT_PROVIDER_TYPE = symbolFor('react.provider'); REACT_CONTEXT_TYPE = symbolFor('react.context'); REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); REACT_SUSPENSE_TYPE = symbolFor('react.suspense'); REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'); REACT_MEMO_TYPE = symbolFor('react.memo'); REACT_LAZY_TYPE = symbolFor('react.lazy'); REACT_BLOCK_TYPE = symbolFor('react.block'); REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block'); REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental'); symbolFor('react.scope'); symbolFor('react.opaque.id'); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); symbolFor('react.offscreen'); REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); } // Filter certain DOM attributes (e.g. src, href) if their values are empty strings. var enableScopeAPI = false; // Experimental Create Event Handle API. function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) { return true; } if (typeof type === 'object' && type !== null) { if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) { return true; } } return false; } function typeOf(object) { if (typeof object === 'object' && object !== null) { var $$typeof = object.$$typeof; switch ($$typeof) { case REACT_ELEMENT_TYPE: var type = object.type; switch (type) { case REACT_FRAGMENT_TYPE: case REACT_PROFILER_TYPE: case REACT_STRICT_MODE_TYPE: case REACT_SUSPENSE_TYPE: case REACT_SUSPENSE_LIST_TYPE: return type; default: var $$typeofType = type && type.$$typeof; switch ($$typeofType) { case REACT_CONTEXT_TYPE: case REACT_FORWARD_REF_TYPE: case REACT_LAZY_TYPE: case REACT_MEMO_TYPE: case REACT_PROVIDER_TYPE: return $$typeofType; default: return $$typeof; } } case REACT_PORTAL_TYPE: return $$typeof; } } return undefined; } var ContextConsumer = REACT_CONTEXT_TYPE; var ContextProvider = REACT_PROVIDER_TYPE; var Element = REACT_ELEMENT_TYPE; var ForwardRef = REACT_FORWARD_REF_TYPE; var Fragment = REACT_FRAGMENT_TYPE; var Lazy = REACT_LAZY_TYPE; var Memo = REACT_MEMO_TYPE; var Portal = REACT_PORTAL_TYPE; var Profiler = REACT_PROFILER_TYPE; var StrictMode = REACT_STRICT_MODE_TYPE; var Suspense = REACT_SUSPENSE_TYPE; var hasWarnedAboutDeprecatedIsAsyncMode = false; var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); } } return false; } function isConcurrentMode(object) { { if (!hasWarnedAboutDeprecatedIsConcurrentMode) { hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); } } return false; } function isContextConsumer(object) { return typeOf(object) === REACT_CONTEXT_TYPE; } function isContextProvider(object) { return typeOf(object) === REACT_PROVIDER_TYPE; } function isElement(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } function isForwardRef(object) { return typeOf(object) === REACT_FORWARD_REF_TYPE; } function isFragment(object) { return typeOf(object) === REACT_FRAGMENT_TYPE; } function isLazy(object) { return typeOf(object) === REACT_LAZY_TYPE; } function isMemo(object) { return typeOf(object) === REACT_MEMO_TYPE; } function isPortal(object) { return typeOf(object) === REACT_PORTAL_TYPE; } function isProfiler(object) { return typeOf(object) === REACT_PROFILER_TYPE; } function isStrictMode(object) { return typeOf(object) === REACT_STRICT_MODE_TYPE; } function isSuspense(object) { return typeOf(object) === REACT_SUSPENSE_TYPE; } reactIs_development.ContextConsumer = ContextConsumer; reactIs_development.ContextProvider = ContextProvider; reactIs_development.Element = Element; reactIs_development.ForwardRef = ForwardRef; reactIs_development.Fragment = Fragment; reactIs_development.Lazy = Lazy; reactIs_development.Memo = Memo; reactIs_development.Portal = Portal; reactIs_development.Profiler = Profiler; reactIs_development.StrictMode = StrictMode; reactIs_development.Suspense = Suspense; reactIs_development.isAsyncMode = isAsyncMode; reactIs_development.isConcurrentMode = isConcurrentMode; reactIs_development.isContextConsumer = isContextConsumer; reactIs_development.isContextProvider = isContextProvider; reactIs_development.isElement = isElement; reactIs_development.isForwardRef = isForwardRef; reactIs_development.isFragment = isFragment; reactIs_development.isLazy = isLazy; reactIs_development.isMemo = isMemo; reactIs_development.isPortal = isPortal; reactIs_development.isProfiler = isProfiler; reactIs_development.isStrictMode = isStrictMode; reactIs_development.isSuspense = isSuspense; reactIs_development.isValidElementType = isValidElementType; reactIs_development.typeOf = typeOf; })(); } return reactIs_development; } (function (module) { if (process.env.NODE_ENV === 'production') { module.exports = requireReactIs_production_min(); } else { module.exports = requireReactIs_development(); } } (reactIs)); Object.defineProperty(ReactElement$1, '__esModule', { value: true }); ReactElement$1.test = ReactElement$1.serialize = ReactElement$1.default = void 0; var ReactIs = _interopRequireWildcard(reactIs.exports); var _markup$1 = markup; function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== 'function') return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { return {default: obj}; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // Given element.props.children, or subtree during recursive traversal, // return flattened array of children. const getChildren = (arg, children = []) => { if (Array.isArray(arg)) { arg.forEach(item => { getChildren(item, children); }); } else if (arg != null && arg !== false) { children.push(arg); } return children; }; const getType = element => { const type = element.type; if (typeof type === 'string') { return type; } if (typeof type === 'function') { return type.displayName || type.name || 'Unknown'; } if (ReactIs.isFragment(element)) { return 'React.Fragment'; } if (ReactIs.isSuspense(element)) { return 'React.Suspense'; } if (typeof type === 'object' && type !== null) { if (ReactIs.isContextProvider(element)) { return 'Context.Provider'; } if (ReactIs.isContextConsumer(element)) { return 'Context.Consumer'; } if (ReactIs.isForwardRef(element)) { if (type.displayName) { return type.displayName; } const functionName = type.render.displayName || type.render.name || ''; return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef'; } if (ReactIs.isMemo(element)) { const functionName = type.displayName ||