diff --git a/node_modules/@babel/plugin-proposal-optional-chaining/LICENSE b/node_modules/@babel/plugin-proposal-optional-chaining/LICENSE deleted file mode 100644 index f31575ec773bb..0000000000000 --- a/node_modules/@babel/plugin-proposal-optional-chaining/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-proposal-optional-chaining/README.md b/node_modules/@babel/plugin-proposal-optional-chaining/README.md deleted file mode 100644 index 4fd0219f939d4..0000000000000 --- a/node_modules/@babel/plugin-proposal-optional-chaining/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-proposal-optional-chaining - -> Transform optional chaining operators into a series of nil checks - -See our website [@babel/plugin-proposal-optional-chaining](https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-proposal-optional-chaining -``` - -or using yarn: - -```sh -yarn add @babel/plugin-proposal-optional-chaining --dev -``` diff --git a/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js b/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js deleted file mode 100644 index 1a926186e46da..0000000000000 --- a/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js +++ /dev/null @@ -1,254 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var helperPluginUtils = require('@babel/helper-plugin-utils'); -var syntaxOptionalChaining = require('@babel/plugin-syntax-optional-chaining'); -var core = require('@babel/core'); -var helperSkipTransparentExpressionWrappers = require('@babel/helper-skip-transparent-expression-wrappers'); - -function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } - -var syntaxOptionalChaining__default = /*#__PURE__*/_interopDefaultLegacy(syntaxOptionalChaining); - -function willPathCastToBoolean(path) { - const maybeWrapped = findOutermostTransparentParent(path); - const { - node, - parentPath - } = maybeWrapped; - - if (parentPath.isLogicalExpression()) { - const { - operator, - right - } = parentPath.node; - - if (operator === "&&" || operator === "||" || operator === "??" && node === right) { - return willPathCastToBoolean(parentPath); - } - } - - if (parentPath.isSequenceExpression()) { - const { - expressions - } = parentPath.node; - - if (expressions[expressions.length - 1] === node) { - return willPathCastToBoolean(parentPath); - } else { - return true; - } - } - - return parentPath.isConditional({ - test: node - }) || parentPath.isUnaryExpression({ - operator: "!" - }) || parentPath.isLoop({ - test: node - }); -} -function findOutermostTransparentParent(path) { - let maybeWrapped = path; - path.findParent(p => { - if (!helperSkipTransparentExpressionWrappers.isTransparentExprWrapper(p.node)) return true; - maybeWrapped = p; - }); - return maybeWrapped; -} - -const { - ast -} = core.template.expression; - -function isSimpleMemberExpression(expression) { - expression = helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes(expression); - return core.types.isIdentifier(expression) || core.types.isSuper(expression) || core.types.isMemberExpression(expression) && !expression.computed && isSimpleMemberExpression(expression.object); -} - -function needsMemoize(path) { - let optionalPath = path; - const { - scope - } = path; - - while (optionalPath.isOptionalMemberExpression() || optionalPath.isOptionalCallExpression()) { - const { - node - } = optionalPath; - const childPath = helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers(optionalPath.isOptionalMemberExpression() ? optionalPath.get("object") : optionalPath.get("callee")); - - if (node.optional) { - return !scope.isStatic(childPath.node); - } - - optionalPath = childPath; - } -} - -function transform(path, { - pureGetters, - noDocumentAll -}) { - const { - scope - } = path; - const maybeWrapped = findOutermostTransparentParent(path); - const { - parentPath - } = maybeWrapped; - const willReplacementCastToBoolean = willPathCastToBoolean(maybeWrapped); - let isDeleteOperation = false; - const parentIsCall = parentPath.isCallExpression({ - callee: maybeWrapped.node - }) && path.isOptionalMemberExpression(); - const optionals = []; - let optionalPath = path; - - if (scope.path.isPattern() && needsMemoize(optionalPath)) { - path.replaceWith(core.template.ast`(() => ${path.node})()`); - return; - } - - while (optionalPath.isOptionalMemberExpression() || optionalPath.isOptionalCallExpression()) { - const { - node - } = optionalPath; - - if (node.optional) { - optionals.push(node); - } - - if (optionalPath.isOptionalMemberExpression()) { - optionalPath.node.type = "MemberExpression"; - optionalPath = helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers(optionalPath.get("object")); - } else if (optionalPath.isOptionalCallExpression()) { - optionalPath.node.type = "CallExpression"; - optionalPath = helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers(optionalPath.get("callee")); - } - } - - let replacementPath = path; - - if (parentPath.isUnaryExpression({ - operator: "delete" - })) { - replacementPath = parentPath; - isDeleteOperation = true; - } - - for (let i = optionals.length - 1; i >= 0; i--) { - const node = optionals[i]; - const isCall = core.types.isCallExpression(node); - const chainWithTypes = isCall ? node.callee : node.object; - const chain = helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes(chainWithTypes); - let ref; - let check; - - if (isCall && core.types.isIdentifier(chain, { - name: "eval" - })) { - check = ref = chain; - node.callee = core.types.sequenceExpression([core.types.numericLiteral(0), ref]); - } else if (pureGetters && isCall && isSimpleMemberExpression(chain)) { - check = ref = node.callee; - } else { - ref = scope.maybeGenerateMemoised(chain); - - if (ref) { - check = core.types.assignmentExpression("=", core.types.cloneNode(ref), chainWithTypes); - isCall ? node.callee = ref : node.object = ref; - } else { - check = ref = chainWithTypes; - } - } - - if (isCall && core.types.isMemberExpression(chain)) { - if (pureGetters && isSimpleMemberExpression(chain)) { - node.callee = chainWithTypes; - } else { - const { - object - } = chain; - let context; - - if (core.types.isSuper(object)) { - context = core.types.thisExpression(); - } else { - const memoized = scope.maybeGenerateMemoised(object); - - if (memoized) { - context = memoized; - chain.object = core.types.assignmentExpression("=", memoized, object); - } else { - context = object; - } - } - - node.arguments.unshift(core.types.cloneNode(context)); - node.callee = core.types.memberExpression(node.callee, core.types.identifier("call")); - } - } - - let replacement = replacementPath.node; - - if (i === 0 && parentIsCall) { - var _baseRef; - - const object = helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes(replacement.object); - let baseRef; - - if (!pureGetters || !isSimpleMemberExpression(object)) { - baseRef = scope.maybeGenerateMemoised(object); - - if (baseRef) { - replacement.object = core.types.assignmentExpression("=", baseRef, object); - } - } - - replacement = core.types.callExpression(core.types.memberExpression(replacement, core.types.identifier("bind")), [core.types.cloneNode((_baseRef = baseRef) != null ? _baseRef : object)]); - } - - if (willReplacementCastToBoolean) { - const nonNullishCheck = noDocumentAll ? ast`${core.types.cloneNode(check)} != null` : ast` - ${core.types.cloneNode(check)} !== null && ${core.types.cloneNode(ref)} !== void 0`; - replacementPath.replaceWith(core.types.logicalExpression("&&", nonNullishCheck, replacement)); - replacementPath = helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers(replacementPath.get("right")); - } else { - const nullishCheck = noDocumentAll ? ast`${core.types.cloneNode(check)} == null` : ast` - ${core.types.cloneNode(check)} === null || ${core.types.cloneNode(ref)} === void 0`; - const returnValue = isDeleteOperation ? ast`true` : ast`void 0`; - replacementPath.replaceWith(core.types.conditionalExpression(nullishCheck, returnValue, replacement)); - replacementPath = helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers(replacementPath.get("alternate")); - } - } -} - -var index = helperPluginUtils.declare((api, options) => { - var _api$assumption, _api$assumption2; - - api.assertVersion(7); - const { - loose = false - } = options; - const noDocumentAll = (_api$assumption = api.assumption("noDocumentAll")) != null ? _api$assumption : loose; - const pureGetters = (_api$assumption2 = api.assumption("pureGetters")) != null ? _api$assumption2 : loose; - return { - name: "proposal-optional-chaining", - inherits: syntaxOptionalChaining__default["default"].default, - visitor: { - "OptionalCallExpression|OptionalMemberExpression"(path) { - transform(path, { - noDocumentAll, - pureGetters - }); - } - - } - }; -}); - -exports["default"] = index; -exports.transform = transform; -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js.map b/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js.map deleted file mode 100644 index 2db2dd51c86f1..0000000000000 --- a/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["../src/util.ts","../src/transform.ts","../src/index.ts"],"sourcesContent":["import type { NodePath } from \"@babel/traverse\";\nimport { isTransparentExprWrapper } from \"@babel/helper-skip-transparent-expression-wrappers\";\n/**\n * Test if a NodePath will be cast to boolean when evaluated.\n * It respects transparent expression wrappers defined in\n * \"@babel/helper-skip-transparent-expression-wrappers\"\n *\n * @example\n * // returns true\n * const nodePathADotB = NodePath(\"if (a.b) {}\").get(\"test\"); // a.b\n * willPathCastToBoolean(nodePathADotB)\n * @example\n * // returns false\n * willPathCastToBoolean(NodePath(\"a.b\"))\n * @param {NodePath} path\n * @returns {boolean}\n */\nexport function willPathCastToBoolean(path: NodePath): boolean {\n const maybeWrapped = findOutermostTransparentParent(path);\n const { node, parentPath } = maybeWrapped;\n if (parentPath.isLogicalExpression()) {\n const { operator, right } = parentPath.node;\n if (\n operator === \"&&\" ||\n operator === \"||\" ||\n (operator === \"??\" && node === right)\n ) {\n return willPathCastToBoolean(parentPath);\n }\n }\n if (parentPath.isSequenceExpression()) {\n const { expressions } = parentPath.node;\n if (expressions[expressions.length - 1] === node) {\n return willPathCastToBoolean(parentPath);\n } else {\n // if it is in the middle of a sequence expression, we don't\n // care the return value so just cast to boolean for smaller\n // output\n return true;\n }\n }\n return (\n parentPath.isConditional({ test: node }) ||\n parentPath.isUnaryExpression({ operator: \"!\" }) ||\n parentPath.isLoop({ test: node })\n );\n}\n\n/**\n * Return the outermost transparent expression wrapper of a given path,\n * otherwise returns path itself.\n * @example\n * const nodePathADotB = NodePath(\"(a.b as any)\").get(\"expression\"); // a.b\n * // returns NodePath(\"(a.b as any)\")\n * findOutermostTransparentParent(nodePathADotB);\n * @param {NodePath} path\n * @returns {NodePath}\n */\nexport function findOutermostTransparentParent(path: NodePath): NodePath {\n let maybeWrapped = path;\n path.findParent(p => {\n if (!isTransparentExprWrapper(p.node)) return true;\n maybeWrapped = p;\n });\n return maybeWrapped;\n}\n","import { types as t, template } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport {\n skipTransparentExprWrapperNodes,\n skipTransparentExprWrappers,\n} from \"@babel/helper-skip-transparent-expression-wrappers\";\nimport { willPathCastToBoolean, findOutermostTransparentParent } from \"./util\";\n\nconst { ast } = template.expression;\n\nfunction isSimpleMemberExpression(\n expression: t.Expression | t.Super,\n): expression is t.Identifier | t.Super | t.MemberExpression {\n expression = skipTransparentExprWrapperNodes(expression);\n return (\n t.isIdentifier(expression) ||\n t.isSuper(expression) ||\n (t.isMemberExpression(expression) &&\n !expression.computed &&\n isSimpleMemberExpression(expression.object))\n );\n}\n\n/**\n * Test if a given optional chain `path` needs to be memoized\n * @param {NodePath} path\n * @returns {boolean}\n */\nfunction needsMemoize(\n path: NodePath,\n) {\n let optionalPath: NodePath = path;\n const { scope } = path;\n while (\n optionalPath.isOptionalMemberExpression() ||\n optionalPath.isOptionalCallExpression()\n ) {\n const { node } = optionalPath;\n const childPath = skipTransparentExprWrappers(\n // @ts-expect-error isOptionalMemberExpression does not work with NodePath union\n optionalPath.isOptionalMemberExpression()\n ? optionalPath.get(\"object\")\n : optionalPath.get(\"callee\"),\n );\n if (node.optional) {\n return !scope.isStatic(childPath.node);\n }\n\n optionalPath = childPath;\n }\n}\n\nexport function transform(\n path: NodePath,\n {\n pureGetters,\n noDocumentAll,\n }: { pureGetters: boolean; noDocumentAll: boolean },\n) {\n const { scope } = path;\n // maybeWrapped points to the outermost transparent expression wrapper\n // or the path itself\n const maybeWrapped = findOutermostTransparentParent(path);\n const { parentPath } = maybeWrapped;\n const willReplacementCastToBoolean = willPathCastToBoolean(maybeWrapped);\n let isDeleteOperation = false;\n const parentIsCall =\n parentPath.isCallExpression({ callee: maybeWrapped.node }) &&\n // note that the first condition must implies that `path.optional` is `true`,\n // otherwise the parentPath should be an OptionalCallExpression\n path.isOptionalMemberExpression();\n\n const optionals = [];\n\n let optionalPath = path;\n // Replace `function (a, x = a.b?.c) {}` to `function (a, x = (() => a.b?.c)() ){}`\n // so the temporary variable can be injected in correct scope\n if (scope.path.isPattern() && needsMemoize(optionalPath)) {\n path.replaceWith(template.ast`(() => ${path.node})()` as t.Statement);\n // The injected optional chain will be queued and eventually transformed when visited\n return;\n }\n while (\n optionalPath.isOptionalMemberExpression() ||\n optionalPath.isOptionalCallExpression()\n ) {\n const { node } = optionalPath;\n if (node.optional) {\n optionals.push(node);\n }\n // @ts-expect-error isOptionalMemberExpression does not work with NodePath union\n if (optionalPath.isOptionalMemberExpression()) {\n // @ts-expect-error todo(flow->ts) avoid changing more type\n optionalPath.node.type = \"MemberExpression\";\n // @ts-expect-error todo(flow->ts)\n optionalPath = skipTransparentExprWrappers(optionalPath.get(\"object\"));\n } else if (optionalPath.isOptionalCallExpression()) {\n // @ts-expect-error todo(flow->ts) avoid changing more type\n optionalPath.node.type = \"CallExpression\";\n // @ts-expect-error todo(flow->ts)\n optionalPath = skipTransparentExprWrappers(optionalPath.get(\"callee\"));\n }\n }\n\n // todo: Improve replacementPath typings\n let replacementPath: NodePath = path;\n if (parentPath.isUnaryExpression({ operator: \"delete\" })) {\n replacementPath = parentPath;\n isDeleteOperation = true;\n }\n for (let i = optionals.length - 1; i >= 0; i--) {\n const node = optionals[i] as unknown as\n | t.MemberExpression\n | t.CallExpression;\n\n const isCall = t.isCallExpression(node);\n\n const chainWithTypes = isCall\n ? // V8 intrinsics must not be an optional call\n (node.callee as t.Expression)\n : node.object;\n const chain = skipTransparentExprWrapperNodes(chainWithTypes);\n\n let ref;\n let check;\n if (isCall && t.isIdentifier(chain, { name: \"eval\" })) {\n check = ref = chain;\n // `eval?.()` is an indirect eval call transformed to `(0,eval)()`\n node.callee = t.sequenceExpression([t.numericLiteral(0), ref]);\n } else if (pureGetters && isCall && isSimpleMemberExpression(chain)) {\n // If we assume getters are pure (avoiding a Function#call) and we are at the call,\n // we can avoid a needless memoize. We only do this if the callee is a simple member\n // expression, to avoid multiple calls to nested call expressions.\n check = ref = node.callee;\n } else {\n ref = scope.maybeGenerateMemoised(chain);\n if (ref) {\n check = t.assignmentExpression(\n \"=\",\n t.cloneNode(ref),\n // Here `chainWithTypes` MUST NOT be cloned because it could be\n // updated when generating the memoised context of a call\n // expression. It must be an Expression when `ref` is an identifier\n chainWithTypes as t.Expression,\n );\n\n isCall ? (node.callee = ref) : (node.object = ref);\n } else {\n check = ref = chainWithTypes;\n }\n }\n\n // Ensure call expressions have the proper `this`\n // `foo.bar()` has context `foo`.\n if (isCall && t.isMemberExpression(chain)) {\n if (pureGetters && isSimpleMemberExpression(chain)) {\n // To avoid a Function#call, we can instead re-grab the property from the context object.\n // `a.?b.?()` translates roughly to `_a.b != null && _a.b()`\n node.callee = chainWithTypes;\n } else {\n // Otherwise, we need to memoize the context object, and change the call into a Function#call.\n // `a.?b.?()` translates roughly to `(_b = _a.b) != null && _b.call(_a)`\n const { object } = chain;\n let context: t.Expression;\n if (t.isSuper(object)) {\n context = t.thisExpression();\n } else {\n const memoized = scope.maybeGenerateMemoised(object);\n if (memoized) {\n context = memoized;\n chain.object = t.assignmentExpression(\"=\", memoized, object);\n } else {\n context = object;\n }\n }\n\n node.arguments.unshift(t.cloneNode(context));\n // @ts-expect-error node.callee can not be an V8IntrinsicIdentifier: V8 intrinsic is disallowed in optional chain\n node.callee = t.memberExpression(node.callee, t.identifier(\"call\"));\n }\n }\n let replacement = replacementPath.node;\n // Ensure (a?.b)() has proper `this`\n // The `parentIsCall` is constant within loop, we should check i === 0\n // to ensure that it is only applied to the first optional chain element\n // i.e. `?.b` in `(a?.b.c)()`\n if (i === 0 && parentIsCall) {\n // `(a?.b)()` to `(a == null ? undefined : a.b.bind(a))()`\n // object must not be Super as super?.foo is invalid\n const object = skipTransparentExprWrapperNodes(\n replacement.object,\n ) as t.Expression;\n let baseRef;\n if (!pureGetters || !isSimpleMemberExpression(object)) {\n // memoize the context object when getters are not always pure\n // or the object is not a simple member expression\n // `(a?.b.c)()` to `(a == null ? undefined : (_a$b = a.b).c.bind(_a$b))()`\n baseRef = scope.maybeGenerateMemoised(object);\n if (baseRef) {\n replacement.object = t.assignmentExpression(\"=\", baseRef, object);\n }\n }\n replacement = t.callExpression(\n t.memberExpression(replacement, t.identifier(\"bind\")),\n [t.cloneNode(baseRef ?? object)],\n );\n }\n\n if (willReplacementCastToBoolean) {\n // `if (a?.b) {}` transformed to `if (a != null && a.b) {}`\n // we don't need to return `void 0` because the returned value will\n // eveutally cast to boolean.\n const nonNullishCheck = noDocumentAll\n ? ast`${t.cloneNode(check)} != null`\n : ast`\n ${t.cloneNode(check)} !== null && ${t.cloneNode(ref)} !== void 0`;\n replacementPath.replaceWith(\n t.logicalExpression(\"&&\", nonNullishCheck, replacement),\n );\n replacementPath = skipTransparentExprWrappers(\n // @ts-expect-error todo(flow->ts)\n replacementPath.get(\"right\"),\n );\n } else {\n const nullishCheck = noDocumentAll\n ? ast`${t.cloneNode(check)} == null`\n : ast`\n ${t.cloneNode(check)} === null || ${t.cloneNode(ref)} === void 0`;\n\n const returnValue = isDeleteOperation ? ast`true` : ast`void 0`;\n replacementPath.replaceWith(\n t.conditionalExpression(nullishCheck, returnValue, replacement),\n );\n replacementPath = skipTransparentExprWrappers(\n // @ts-expect-error todo(flow->ts)\n replacementPath.get(\"alternate\"),\n );\n }\n }\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxOptionalChaining from \"@babel/plugin-syntax-optional-chaining\";\nimport { transform } from \"./transform\";\nimport type { NodePath } from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\n\nexport interface Options {\n loose?: boolean;\n}\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const { loose = false } = options;\n const noDocumentAll = (api.assumption(\"noDocumentAll\") ?? loose) as boolean;\n const pureGetters = (api.assumption(\"pureGetters\") ?? loose) as boolean;\n\n return {\n name: \"proposal-optional-chaining\",\n inherits: syntaxOptionalChaining.default,\n\n visitor: {\n \"OptionalCallExpression|OptionalMemberExpression\"(\n path: NodePath,\n ) {\n transform(path, { noDocumentAll, pureGetters });\n },\n },\n };\n});\n\nexport { transform };\n"],"names":["willPathCastToBoolean","path","maybeWrapped","findOutermostTransparentParent","node","parentPath","isLogicalExpression","operator","right","isSequenceExpression","expressions","length","isConditional","test","isUnaryExpression","isLoop","findParent","p","isTransparentExprWrapper","ast","template","expression","isSimpleMemberExpression","skipTransparentExprWrapperNodes","t","isIdentifier","isSuper","isMemberExpression","computed","object","needsMemoize","optionalPath","scope","isOptionalMemberExpression","isOptionalCallExpression","childPath","skipTransparentExprWrappers","get","optional","isStatic","transform","pureGetters","noDocumentAll","willReplacementCastToBoolean","isDeleteOperation","parentIsCall","isCallExpression","callee","optionals","isPattern","replaceWith","push","type","replacementPath","i","isCall","chainWithTypes","chain","ref","check","name","sequenceExpression","numericLiteral","maybeGenerateMemoised","assignmentExpression","cloneNode","context","thisExpression","memoized","arguments","unshift","memberExpression","identifier","replacement","baseRef","callExpression","nonNullishCheck","logicalExpression","nullishCheck","returnValue","conditionalExpression","declare","api","options","assertVersion","loose","assumption","inherits","syntaxOptionalChaining","default","visitor"],"mappings":";;;;;;;;;;;;;AAiBO,SAASA,qBAAT,CAA+BC,IAA/B,EAAwD;AAC7D,EAAA,MAAMC,YAAY,GAAGC,8BAA8B,CAACF,IAAD,CAAnD,CAAA;EACA,MAAM;IAAEG,IAAF;AAAQC,IAAAA,UAAAA;AAAR,GAAA,GAAuBH,YAA7B,CAAA;;AACA,EAAA,IAAIG,UAAU,CAACC,mBAAX,EAAJ,EAAsC;IACpC,MAAM;MAAEC,QAAF;AAAYC,MAAAA,KAAAA;KAAUH,GAAAA,UAAU,CAACD,IAAvC,CAAA;;AACA,IAAA,IACEG,QAAQ,KAAK,IAAb,IACAA,QAAQ,KAAK,IADb,IAECA,QAAQ,KAAK,IAAb,IAAqBH,IAAI,KAAKI,KAHjC,EAIE;MACA,OAAOR,qBAAqB,CAACK,UAAD,CAA5B,CAAA;AACD,KAAA;AACF,GAAA;;AACD,EAAA,IAAIA,UAAU,CAACI,oBAAX,EAAJ,EAAuC;IACrC,MAAM;AAAEC,MAAAA,WAAAA;KAAgBL,GAAAA,UAAU,CAACD,IAAnC,CAAA;;IACA,IAAIM,WAAW,CAACA,WAAW,CAACC,MAAZ,GAAqB,CAAtB,CAAX,KAAwCP,IAA5C,EAAkD;MAChD,OAAOJ,qBAAqB,CAACK,UAAD,CAA5B,CAAA;AACD,KAFD,MAEO;AAIL,MAAA,OAAO,IAAP,CAAA;AACD,KAAA;AACF,GAAA;;EACD,OACEA,UAAU,CAACO,aAAX,CAAyB;AAAEC,IAAAA,IAAI,EAAET,IAAAA;AAAR,GAAzB,CACAC,IAAAA,UAAU,CAACS,iBAAX,CAA6B;AAAEP,IAAAA,QAAQ,EAAE,GAAA;AAAZ,GAA7B,CADA,IAEAF,UAAU,CAACU,MAAX,CAAkB;AAAEF,IAAAA,IAAI,EAAET,IAAAA;AAAR,GAAlB,CAHF,CAAA;AAKD,CAAA;AAYM,SAASD,8BAAT,CAAwCF,IAAxC,EAAkE;EACvE,IAAIC,YAAY,GAAGD,IAAnB,CAAA;AACAA,EAAAA,IAAI,CAACe,UAAL,CAAgBC,CAAC,IAAI;IACnB,IAAI,CAACC,gEAAwB,CAACD,CAAC,CAACb,IAAH,CAA7B,EAAuC,OAAO,IAAP,CAAA;AACvCF,IAAAA,YAAY,GAAGe,CAAf,CAAA;GAFF,CAAA,CAAA;AAIA,EAAA,OAAOf,YAAP,CAAA;AACD;;ACzDD,MAAM;AAAEiB,EAAAA,GAAAA;AAAF,CAAUC,GAAAA,aAAQ,CAACC,UAAzB,CAAA;;AAEA,SAASC,wBAAT,CACED,UADF,EAE6D;AAC3DA,EAAAA,UAAU,GAAGE,uEAA+B,CAACF,UAAD,CAA5C,CAAA;AACA,EAAA,OACEG,UAAC,CAACC,YAAF,CAAeJ,UAAf,CAAA,IACAG,UAAC,CAACE,OAAF,CAAUL,UAAV,CADA,IAECG,UAAC,CAACG,kBAAF,CAAqBN,UAArB,CACC,IAAA,CAACA,UAAU,CAACO,QADb,IAECN,wBAAwB,CAACD,UAAU,CAACQ,MAAZ,CAL5B,CAAA;AAOD,CAAA;;AAOD,SAASC,YAAT,CACE7B,IADF,EAEE;EACA,IAAI8B,YAAsB,GAAG9B,IAA7B,CAAA;EACA,MAAM;AAAE+B,IAAAA,KAAAA;AAAF,GAAA,GAAY/B,IAAlB,CAAA;;EACA,OACE8B,YAAY,CAACE,0BAAb,EAAA,IACAF,YAAY,CAACG,wBAAb,EAFF,EAGE;IACA,MAAM;AAAE9B,MAAAA,IAAAA;AAAF,KAAA,GAAW2B,YAAjB,CAAA;IACA,MAAMI,SAAS,GAAGC,mEAA2B,CAE3CL,YAAY,CAACE,0BAAb,KACIF,YAAY,CAACM,GAAb,CAAiB,QAAjB,CADJ,GAEIN,YAAY,CAACM,GAAb,CAAiB,QAAjB,CAJuC,CAA7C,CAAA;;IAMA,IAAIjC,IAAI,CAACkC,QAAT,EAAmB;MACjB,OAAO,CAACN,KAAK,CAACO,QAAN,CAAeJ,SAAS,CAAC/B,IAAzB,CAAR,CAAA;AACD,KAAA;;AAED2B,IAAAA,YAAY,GAAGI,SAAf,CAAA;AACD,GAAA;AACF,CAAA;;AAEM,SAASK,SAAT,CACLvC,IADK,EAEL;EACEwC,WADF;AAEEC,EAAAA,aAAAA;AAFF,CAFK,EAML;EACA,MAAM;AAAEV,IAAAA,KAAAA;AAAF,GAAA,GAAY/B,IAAlB,CAAA;AAGA,EAAA,MAAMC,YAAY,GAAGC,8BAA8B,CAACF,IAAD,CAAnD,CAAA;EACA,MAAM;AAAEI,IAAAA,UAAAA;AAAF,GAAA,GAAiBH,YAAvB,CAAA;AACA,EAAA,MAAMyC,4BAA4B,GAAG3C,qBAAqB,CAACE,YAAD,CAA1D,CAAA;EACA,IAAI0C,iBAAiB,GAAG,KAAxB,CAAA;AACA,EAAA,MAAMC,YAAY,GAChBxC,UAAU,CAACyC,gBAAX,CAA4B;IAAEC,MAAM,EAAE7C,YAAY,CAACE,IAAAA;AAAvB,GAA5B,CAGAH,IAAAA,IAAI,CAACgC,0BAAL,EAJF,CAAA;EAMA,MAAMe,SAAS,GAAG,EAAlB,CAAA;EAEA,IAAIjB,YAAY,GAAG9B,IAAnB,CAAA;;EAGA,IAAI+B,KAAK,CAAC/B,IAAN,CAAWgD,SAAX,MAA0BnB,YAAY,CAACC,YAAD,CAA1C,EAA0D;IACxD9B,IAAI,CAACiD,WAAL,CAAiB9B,aAAQ,CAACD,GAAI,CAASlB,OAAAA,EAAAA,IAAI,CAACG,IAAK,CAAjD,GAAA,CAAA,CAAA,CAAA;AAEA,IAAA,OAAA;AACD,GAAA;;EACD,OACE2B,YAAY,CAACE,0BAAb,EAAA,IACAF,YAAY,CAACG,wBAAb,EAFF,EAGE;IACA,MAAM;AAAE9B,MAAAA,IAAAA;AAAF,KAAA,GAAW2B,YAAjB,CAAA;;IACA,IAAI3B,IAAI,CAACkC,QAAT,EAAmB;MACjBU,SAAS,CAACG,IAAV,CAAe/C,IAAf,CAAA,CAAA;AACD,KAAA;;AAED,IAAA,IAAI2B,YAAY,CAACE,0BAAb,EAAJ,EAA+C;AAE7CF,MAAAA,YAAY,CAAC3B,IAAb,CAAkBgD,IAAlB,GAAyB,kBAAzB,CAAA;MAEArB,YAAY,GAAGK,mEAA2B,CAACL,YAAY,CAACM,GAAb,CAAiB,QAAjB,CAAD,CAA1C,CAAA;AACD,KALD,MAKO,IAAIN,YAAY,CAACG,wBAAb,EAAJ,EAA6C;AAElDH,MAAAA,YAAY,CAAC3B,IAAb,CAAkBgD,IAAlB,GAAyB,gBAAzB,CAAA;MAEArB,YAAY,GAAGK,mEAA2B,CAACL,YAAY,CAACM,GAAb,CAAiB,QAAjB,CAAD,CAA1C,CAAA;AACD,KAAA;AACF,GAAA;;EAGD,IAAIgB,eAA8B,GAAGpD,IAArC,CAAA;;EACA,IAAII,UAAU,CAACS,iBAAX,CAA6B;AAAEP,IAAAA,QAAQ,EAAE,QAAA;AAAZ,GAA7B,CAAJ,EAA0D;AACxD8C,IAAAA,eAAe,GAAGhD,UAAlB,CAAA;AACAuC,IAAAA,iBAAiB,GAAG,IAApB,CAAA;AACD,GAAA;;AACD,EAAA,KAAK,IAAIU,CAAC,GAAGN,SAAS,CAACrC,MAAV,GAAmB,CAAhC,EAAmC2C,CAAC,IAAI,CAAxC,EAA2CA,CAAC,EAA5C,EAAgD;AAC9C,IAAA,MAAMlD,IAAI,GAAG4C,SAAS,CAACM,CAAD,CAAtB,CAAA;AAIA,IAAA,MAAMC,MAAM,GAAG/B,UAAC,CAACsB,gBAAF,CAAmB1C,IAAnB,CAAf,CAAA;IAEA,MAAMoD,cAAc,GAAGD,MAAM,GAExBnD,IAAI,CAAC2C,MAFmB,GAGzB3C,IAAI,CAACyB,MAHT,CAAA;AAIA,IAAA,MAAM4B,KAAK,GAAGlC,uEAA+B,CAACiC,cAAD,CAA7C,CAAA;AAEA,IAAA,IAAIE,GAAJ,CAAA;AACA,IAAA,IAAIC,KAAJ,CAAA;;AACA,IAAA,IAAIJ,MAAM,IAAI/B,UAAC,CAACC,YAAF,CAAegC,KAAf,EAAsB;AAAEG,MAAAA,IAAI,EAAE,MAAA;AAAR,KAAtB,CAAd,EAAuD;MACrDD,KAAK,GAAGD,GAAG,GAAGD,KAAd,CAAA;AAEArD,MAAAA,IAAI,CAAC2C,MAAL,GAAcvB,UAAC,CAACqC,kBAAF,CAAqB,CAACrC,UAAC,CAACsC,cAAF,CAAiB,CAAjB,CAAD,EAAsBJ,GAAtB,CAArB,CAAd,CAAA;KAHF,MAIO,IAAIjB,WAAW,IAAIc,MAAf,IAAyBjC,wBAAwB,CAACmC,KAAD,CAArD,EAA8D;AAInEE,MAAAA,KAAK,GAAGD,GAAG,GAAGtD,IAAI,CAAC2C,MAAnB,CAAA;AACD,KALM,MAKA;AACLW,MAAAA,GAAG,GAAG1B,KAAK,CAAC+B,qBAAN,CAA4BN,KAA5B,CAAN,CAAA;;AACA,MAAA,IAAIC,GAAJ,EAAS;AACPC,QAAAA,KAAK,GAAGnC,UAAC,CAACwC,oBAAF,CACN,GADM,EAENxC,UAAC,CAACyC,SAAF,CAAYP,GAAZ,CAFM,EAMNF,cANM,CAAR,CAAA;QASAD,MAAM,GAAInD,IAAI,CAAC2C,MAAL,GAAcW,GAAlB,GAA0BtD,IAAI,CAACyB,MAAL,GAAc6B,GAA9C,CAAA;AACD,OAXD,MAWO;QACLC,KAAK,GAAGD,GAAG,GAAGF,cAAd,CAAA;AACD,OAAA;AACF,KAAA;;IAID,IAAID,MAAM,IAAI/B,UAAC,CAACG,kBAAF,CAAqB8B,KAArB,CAAd,EAA2C;AACzC,MAAA,IAAIhB,WAAW,IAAInB,wBAAwB,CAACmC,KAAD,CAA3C,EAAoD;QAGlDrD,IAAI,CAAC2C,MAAL,GAAcS,cAAd,CAAA;AACD,OAJD,MAIO;QAGL,MAAM;AAAE3B,UAAAA,MAAAA;AAAF,SAAA,GAAa4B,KAAnB,CAAA;AACA,QAAA,IAAIS,OAAJ,CAAA;;AACA,QAAA,IAAI1C,UAAC,CAACE,OAAF,CAAUG,MAAV,CAAJ,EAAuB;AACrBqC,UAAAA,OAAO,GAAG1C,UAAC,CAAC2C,cAAF,EAAV,CAAA;AACD,SAFD,MAEO;AACL,UAAA,MAAMC,QAAQ,GAAGpC,KAAK,CAAC+B,qBAAN,CAA4BlC,MAA5B,CAAjB,CAAA;;AACA,UAAA,IAAIuC,QAAJ,EAAc;AACZF,YAAAA,OAAO,GAAGE,QAAV,CAAA;AACAX,YAAAA,KAAK,CAAC5B,MAAN,GAAeL,UAAC,CAACwC,oBAAF,CAAuB,GAAvB,EAA4BI,QAA5B,EAAsCvC,MAAtC,CAAf,CAAA;AACD,WAHD,MAGO;AACLqC,YAAAA,OAAO,GAAGrC,MAAV,CAAA;AACD,WAAA;AACF,SAAA;;QAEDzB,IAAI,CAACiE,SAAL,CAAeC,OAAf,CAAuB9C,UAAC,CAACyC,SAAF,CAAYC,OAAZ,CAAvB,CAAA,CAAA;AAEA9D,QAAAA,IAAI,CAAC2C,MAAL,GAAcvB,UAAC,CAAC+C,gBAAF,CAAmBnE,IAAI,CAAC2C,MAAxB,EAAgCvB,UAAC,CAACgD,UAAF,CAAa,MAAb,CAAhC,CAAd,CAAA;AACD,OAAA;AACF,KAAA;;AACD,IAAA,IAAIC,WAAW,GAAGpB,eAAe,CAACjD,IAAlC,CAAA;;AAKA,IAAA,IAAIkD,CAAC,KAAK,CAAN,IAAWT,YAAf,EAA6B;AAAA,MAAA,IAAA,QAAA,CAAA;;AAG3B,MAAA,MAAMhB,MAAM,GAAGN,uEAA+B,CAC5CkD,WAAW,CAAC5C,MADgC,CAA9C,CAAA;AAGA,MAAA,IAAI6C,OAAJ,CAAA;;MACA,IAAI,CAACjC,WAAD,IAAgB,CAACnB,wBAAwB,CAACO,MAAD,CAA7C,EAAuD;AAIrD6C,QAAAA,OAAO,GAAG1C,KAAK,CAAC+B,qBAAN,CAA4BlC,MAA5B,CAAV,CAAA;;AACA,QAAA,IAAI6C,OAAJ,EAAa;AACXD,UAAAA,WAAW,CAAC5C,MAAZ,GAAqBL,UAAC,CAACwC,oBAAF,CAAuB,GAAvB,EAA4BU,OAA5B,EAAqC7C,MAArC,CAArB,CAAA;AACD,SAAA;AACF,OAAA;;AACD4C,MAAAA,WAAW,GAAGjD,UAAC,CAACmD,cAAF,CACZnD,UAAC,CAAC+C,gBAAF,CAAmBE,WAAnB,EAAgCjD,UAAC,CAACgD,UAAF,CAAa,MAAb,CAAhC,CADY,EAEZ,CAAChD,UAAC,CAACyC,SAAF,CAAA,CAAA,QAAA,GAAYS,OAAZ,KAAA,IAAA,GAAA,QAAA,GAAuB7C,MAAvB,CAAD,CAFY,CAAd,CAAA;AAID,KAAA;;AAED,IAAA,IAAIc,4BAAJ,EAAkC;AAIhC,MAAA,MAAMiC,eAAe,GAAGlC,aAAa,GACjCvB,GAAI,CAAEK,EAAAA,UAAC,CAACyC,SAAF,CAAYN,KAAZ,CAAmB,CAAA,QAAA,CADQ,GAEjCxC,GAAI,CAAA;AACd,YAAA,EAAcK,UAAC,CAACyC,SAAF,CAAYN,KAAZ,CAAmB,CAAenC,aAAAA,EAAAA,UAAC,CAACyC,SAAF,CAAYP,GAAZ,CAAiB,CAH3D,WAAA,CAAA,CAAA;AAIAL,MAAAA,eAAe,CAACH,WAAhB,CACE1B,UAAC,CAACqD,iBAAF,CAAoB,IAApB,EAA0BD,eAA1B,EAA2CH,WAA3C,CADF,CAAA,CAAA;MAGApB,eAAe,GAAGjB,mEAA2B,CAE3CiB,eAAe,CAAChB,GAAhB,CAAoB,OAApB,CAF2C,CAA7C,CAAA;AAID,KAfD,MAeO;AACL,MAAA,MAAMyC,YAAY,GAAGpC,aAAa,GAC9BvB,GAAI,CAAEK,EAAAA,UAAC,CAACyC,SAAF,CAAYN,KAAZ,CAAmB,CAAA,QAAA,CADK,GAE9BxC,GAAI,CAAA;AACd,YAAA,EAAcK,UAAC,CAACyC,SAAF,CAAYN,KAAZ,CAAmB,CAAenC,aAAAA,EAAAA,UAAC,CAACyC,SAAF,CAAYP,GAAZ,CAAiB,CAH3D,WAAA,CAAA,CAAA;MAKA,MAAMqB,WAAW,GAAGnC,iBAAiB,GAAGzB,GAAI,CAAP,IAAA,CAAA,GAAeA,GAAI,CAAxD,MAAA,CAAA,CAAA;AACAkC,MAAAA,eAAe,CAACH,WAAhB,CACE1B,UAAC,CAACwD,qBAAF,CAAwBF,YAAxB,EAAsCC,WAAtC,EAAmDN,WAAnD,CADF,CAAA,CAAA;MAGApB,eAAe,GAAGjB,mEAA2B,CAE3CiB,eAAe,CAAChB,GAAhB,CAAoB,WAApB,CAF2C,CAA7C,CAAA;AAID,KAAA;AACF,GAAA;AACF;;ACtOD,YAAe4C,yBAAO,CAAC,CAACC,GAAD,EAAMC,OAAN,KAA2B;AAAA,EAAA,IAAA,eAAA,EAAA,gBAAA,CAAA;;EAChDD,GAAG,CAACE,aAAJ,CAAkB,CAAlB,CAAA,CAAA;EAEA,MAAM;AAAEC,IAAAA,KAAK,GAAG,KAAA;AAAV,GAAA,GAAoBF,OAA1B,CAAA;EACA,MAAMzC,aAAa,sBAAIwC,GAAG,CAACI,UAAJ,CAAe,eAAf,CAAJ,KAAA,IAAA,GAAA,eAAA,GAAuCD,KAA1D,CAAA;EACA,MAAM5C,WAAW,uBAAIyC,GAAG,CAACI,UAAJ,CAAe,aAAf,CAAJ,KAAA,IAAA,GAAA,gBAAA,GAAqCD,KAAtD,CAAA;EAEA,OAAO;AACLzB,IAAAA,IAAI,EAAE,4BADD;IAEL2B,QAAQ,EAAEC,0CAAsB,CAACC,OAF5B;AAILC,IAAAA,OAAO,EAAE;AACP,MAAA,iDAAA,CACEzF,IADF,EAEE;QACAuC,SAAS,CAACvC,IAAD,EAAO;UAAEyC,aAAF;AAAiBD,UAAAA,WAAAA;AAAjB,SAAP,CAAT,CAAA;AACD,OAAA;;AALM,KAAA;GAJX,CAAA;AAYD,CAnBqB,CAAtB;;;;;"} \ No newline at end of file diff --git a/node_modules/@babel/plugin-proposal-optional-chaining/package.json b/node_modules/@babel/plugin-proposal-optional-chaining/package.json deleted file mode 100644 index 492b1bb74b472..0000000000000 --- a/node_modules/@babel/plugin-proposal-optional-chaining/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@babel/plugin-proposal-optional-chaining", - "version": "7.18.9", - "description": "Transform optional chaining operators into a series of nil checks", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-plugin-proposal-optional-chaining" - }, - "homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-optional-chaining", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "./lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.18.9", - "@babel/helper-plugin-test-runner": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/traverse": "^7.18.9" - }, - "engines": { - "node": ">=6.9.0" - }, - "author": "The Babel Team (https://babel.dev/team)", - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-async-to-generator/LICENSE b/node_modules/@babel/plugin-transform-async-to-generator/LICENSE deleted file mode 100644 index f31575ec773bb..0000000000000 --- a/node_modules/@babel/plugin-transform-async-to-generator/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-transform-async-to-generator/README.md b/node_modules/@babel/plugin-transform-async-to-generator/README.md deleted file mode 100644 index d5d31e95c63f4..0000000000000 --- a/node_modules/@babel/plugin-transform-async-to-generator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-transform-async-to-generator - -> Turn async functions into ES2015 generators - -See our website [@babel/plugin-transform-async-to-generator](https://babeljs.io/docs/en/babel-plugin-transform-async-to-generator) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-transform-async-to-generator -``` - -or using yarn: - -```sh -yarn add @babel/plugin-transform-async-to-generator --dev -``` diff --git a/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js b/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js deleted file mode 100644 index e4230d8c92ca3..0000000000000 --- a/node_modules/@babel/plugin-transform-async-to-generator/lib/index.js +++ /dev/null @@ -1,64 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _helperPluginUtils = require("@babel/helper-plugin-utils"); - -var _helperRemapAsyncToGenerator = require("@babel/helper-remap-async-to-generator"); - -var _helperModuleImports = require("@babel/helper-module-imports"); - -var _core = require("@babel/core"); - -var _default = (0, _helperPluginUtils.declare)((api, options) => { - var _api$assumption, _api$assumption2; - - api.assertVersion(7); - const { - method, - module - } = options; - const noNewArrows = (_api$assumption = api.assumption("noNewArrows")) != null ? _api$assumption : true; - const ignoreFunctionLength = (_api$assumption2 = api.assumption("ignoreFunctionLength")) != null ? _api$assumption2 : false; - - if (method && module) { - return { - name: "transform-async-to-generator", - visitor: { - Function(path, state) { - if (!path.node.async || path.node.generator) return; - let wrapAsync = state.methodWrapper; - - if (wrapAsync) { - wrapAsync = _core.types.cloneNode(wrapAsync); - } else { - wrapAsync = state.methodWrapper = (0, _helperModuleImports.addNamed)(path, method, module); - } - - (0, _helperRemapAsyncToGenerator.default)(path, { - wrapAsync - }, noNewArrows, ignoreFunctionLength); - } - - } - }; - } - - return { - name: "transform-async-to-generator", - visitor: { - Function(path, state) { - if (!path.node.async || path.node.generator) return; - (0, _helperRemapAsyncToGenerator.default)(path, { - wrapAsync: state.addHelper("asyncToGenerator") - }, noNewArrows, ignoreFunctionLength); - } - - } - }; -}); - -exports.default = _default; \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-async-to-generator/package.json b/node_modules/@babel/plugin-transform-async-to-generator/package.json deleted file mode 100644 index 06d4de35f4073..0000000000000 --- a/node_modules/@babel/plugin-transform-async-to-generator/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@babel/plugin-transform-async-to-generator", - "version": "7.18.6", - "description": "Turn async functions into ES2015 generators", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-plugin-transform-async-to-generator" - }, - "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-async-to-generator", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "./lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-remap-async-to-generator": "^7.18.6" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.18.6", - "@babel/helper-plugin-test-runner": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "author": "The Babel Team (https://babel.dev/team)", - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-flow-strip-types/LICENSE b/node_modules/@babel/plugin-transform-flow-strip-types/LICENSE deleted file mode 100644 index f31575ec773bb..0000000000000 --- a/node_modules/@babel/plugin-transform-flow-strip-types/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-transform-flow-strip-types/README.md b/node_modules/@babel/plugin-transform-flow-strip-types/README.md deleted file mode 100644 index 736091f9a79a9..0000000000000 --- a/node_modules/@babel/plugin-transform-flow-strip-types/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-transform-flow-strip-types - -> Strip flow type annotations from your output code. - -See our website [@babel/plugin-transform-flow-strip-types](https://babeljs.io/docs/en/babel-plugin-transform-flow-strip-types) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-transform-flow-strip-types -``` - -or using yarn: - -```sh -yarn add @babel/plugin-transform-flow-strip-types --dev -``` diff --git a/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js b/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js deleted file mode 100644 index 1d559d917dd7e..0000000000000 --- a/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js +++ /dev/null @@ -1,194 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _helperPluginUtils = require("@babel/helper-plugin-utils"); - -var _pluginSyntaxFlow = require("@babel/plugin-syntax-flow"); - -var _core = require("@babel/core"); - -var _default = (0, _helperPluginUtils.declare)((api, opts) => { - api.assertVersion(7); - const FLOW_DIRECTIVE = /(@flow(\s+(strict(-local)?|weak))?|@noflow)/; - let skipStrip = false; - const { - requireDirective = false - } = opts; - { - var { - allowDeclareFields = false - } = opts; - } - return { - name: "transform-flow-strip-types", - inherits: _pluginSyntaxFlow.default, - visitor: { - Program(path, { - file: { - ast: { - comments - } - } - }) { - skipStrip = false; - let directiveFound = false; - - if (comments) { - for (const comment of comments) { - if (FLOW_DIRECTIVE.test(comment.value)) { - directiveFound = true; - comment.value = comment.value.replace(FLOW_DIRECTIVE, ""); - - if (!comment.value.replace(/\*/g, "").trim()) { - comment.ignore = true; - } - } - } - } - - if (!directiveFound && requireDirective) { - skipStrip = true; - } - }, - - ImportDeclaration(path) { - if (skipStrip) return; - if (!path.node.specifiers.length) return; - let typeCount = 0; - path.node.specifiers.forEach(({ - importKind - }) => { - if (importKind === "type" || importKind === "typeof") { - typeCount++; - } - }); - - if (typeCount === path.node.specifiers.length) { - path.remove(); - } - }, - - Flow(path) { - if (skipStrip) { - throw path.buildCodeFrameError("A @flow directive is required when using Flow annotations with " + "the `requireDirective` option."); - } - - path.remove(); - }, - - ClassPrivateProperty(path) { - if (skipStrip) return; - path.node.typeAnnotation = null; - }, - - Class(path) { - if (skipStrip) return; - path.node.implements = null; - path.get("body.body").forEach(child => { - if (child.isClassProperty()) { - const { - node - } = child; - { - if (!allowDeclareFields && node.declare) { - throw child.buildCodeFrameError(`The 'declare' modifier is only allowed when the ` + `'allowDeclareFields' option of ` + `@babel/plugin-transform-flow-strip-types or ` + `@babel/preset-flow is enabled.`); - } - } - - if (node.declare) { - child.remove(); - } else { - { - if (!allowDeclareFields && !node.value && !node.decorators) { - child.remove(); - return; - } - } - node.variance = null; - node.typeAnnotation = null; - } - } - }); - }, - - AssignmentPattern({ - node - }) { - if (skipStrip) return; - - if (node.left.optional) { - node.left.optional = false; - } - }, - - Function({ - node - }) { - if (skipStrip) return; - - if (node.params.length > 0 && node.params[0].type === "Identifier" && node.params[0].name === "this") { - node.params.shift(); - } - - for (let i = 0; i < node.params.length; i++) { - let param = node.params[i]; - - if (param.type === "AssignmentPattern") { - param = param.left; - } - - if (param.optional) { - param.optional = false; - } - } - - if (!_core.types.isMethod(node)) { - node.predicate = null; - } - }, - - TypeCastExpression(path) { - if (skipStrip) return; - let { - node - } = path; - - do { - node = node.expression; - } while (_core.types.isTypeCastExpression(node)); - - path.replaceWith(node); - }, - - CallExpression({ - node - }) { - if (skipStrip) return; - node.typeArguments = null; - }, - - OptionalCallExpression({ - node - }) { - if (skipStrip) return; - node.typeArguments = null; - }, - - NewExpression({ - node - }) { - if (skipStrip) return; - node.typeArguments = null; - } - - } - }; -}); - -exports.default = _default; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js.map b/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js.map deleted file mode 100644 index ed3f02dda3f92..0000000000000 --- a/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["declare","api","opts","assertVersion","FLOW_DIRECTIVE","skipStrip","requireDirective","allowDeclareFields","name","inherits","syntaxFlow","visitor","Program","path","file","ast","comments","directiveFound","comment","test","value","replace","trim","ignore","ImportDeclaration","node","specifiers","length","typeCount","forEach","importKind","remove","Flow","buildCodeFrameError","ClassPrivateProperty","typeAnnotation","Class","implements","get","child","isClassProperty","decorators","variance","AssignmentPattern","left","optional","Function","params","type","shift","i","param","t","isMethod","predicate","TypeCastExpression","expression","isTypeCastExpression","replaceWith","CallExpression","typeArguments","OptionalCallExpression","NewExpression"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxFlow from \"@babel/plugin-syntax-flow\";\nimport { types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\n\nexport interface Options {\n requireDirective?: boolean;\n allowDeclareFields?: boolean;\n}\n\nexport default declare((api, opts: Options) => {\n api.assertVersion(7);\n\n const FLOW_DIRECTIVE = /(@flow(\\s+(strict(-local)?|weak))?|@noflow)/;\n\n let skipStrip = false;\n\n const { requireDirective = false } = opts;\n\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { allowDeclareFields = false } = opts;\n }\n\n return {\n name: \"transform-flow-strip-types\",\n inherits: syntaxFlow,\n\n visitor: {\n Program(\n path,\n {\n file: {\n ast: { comments },\n },\n },\n ) {\n skipStrip = false;\n let directiveFound = false;\n\n if (comments) {\n for (const comment of comments) {\n if (FLOW_DIRECTIVE.test(comment.value)) {\n directiveFound = true;\n\n // remove flow directive\n comment.value = comment.value.replace(FLOW_DIRECTIVE, \"\");\n\n // remove the comment completely if it only consists of whitespace and/or stars\n if (!comment.value.replace(/\\*/g, \"\").trim()) {\n comment.ignore = true;\n }\n }\n }\n }\n\n if (!directiveFound && requireDirective) {\n skipStrip = true;\n }\n },\n ImportDeclaration(path) {\n if (skipStrip) return;\n if (!path.node.specifiers.length) return;\n\n let typeCount = 0;\n\n // @ts-expect-error importKind is only in importSpecifier\n path.node.specifiers.forEach(({ importKind }) => {\n if (importKind === \"type\" || importKind === \"typeof\") {\n typeCount++;\n }\n });\n\n if (typeCount === path.node.specifiers.length) {\n path.remove();\n }\n },\n\n Flow(\n path: NodePath<\n t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier\n >,\n ) {\n if (skipStrip) {\n throw path.buildCodeFrameError(\n \"A @flow directive is required when using Flow annotations with \" +\n \"the `requireDirective` option.\",\n );\n }\n\n path.remove();\n },\n\n ClassPrivateProperty(path) {\n if (skipStrip) return;\n path.node.typeAnnotation = null;\n },\n\n Class(path) {\n if (skipStrip) return;\n path.node.implements = null;\n\n // We do this here instead of in a `ClassProperty` visitor because the class transform\n // would transform the class before we reached the class property.\n path.get(\"body.body\").forEach(child => {\n if (child.isClassProperty()) {\n const { node } = child;\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!allowDeclareFields && node.declare) {\n throw child.buildCodeFrameError(\n `The 'declare' modifier is only allowed when the ` +\n `'allowDeclareFields' option of ` +\n `@babel/plugin-transform-flow-strip-types or ` +\n `@babel/preset-flow is enabled.`,\n );\n }\n }\n\n if (node.declare) {\n child.remove();\n } else {\n if (!process.env.BABEL_8_BREAKING) {\n if (!allowDeclareFields && !node.value && !node.decorators) {\n child.remove();\n return;\n }\n }\n\n node.variance = null;\n node.typeAnnotation = null;\n }\n }\n });\n },\n\n AssignmentPattern({ node }) {\n if (skipStrip) return;\n // @ts-expect-error optional is not in ObjectPattern\n if (node.left.optional) {\n // @ts-expect-error optional is not in ObjectPattern\n node.left.optional = false;\n }\n },\n\n Function({ node }) {\n if (skipStrip) return;\n if (\n node.params.length > 0 &&\n node.params[0].type === \"Identifier\" &&\n node.params[0].name === \"this\"\n ) {\n node.params.shift();\n }\n for (let i = 0; i < node.params.length; i++) {\n let param = node.params[i];\n if (param.type === \"AssignmentPattern\") {\n // @ts-expect-error: refine AST types, the left of an assignment pattern as a binding\n // must not be a MemberExpression\n param = param.left;\n }\n // @ts-expect-error optional is not in ObjectPattern\n if (param.optional) {\n // @ts-expect-error optional is not in ObjectPattern\n param.optional = false;\n }\n }\n\n if (!t.isMethod(node)) {\n node.predicate = null;\n }\n },\n\n TypeCastExpression(path) {\n if (skipStrip) return;\n let { node } = path;\n do {\n // @ts-expect-error node is a search pointer\n node = node.expression;\n } while (t.isTypeCastExpression(node));\n path.replaceWith(node);\n },\n\n CallExpression({ node }) {\n if (skipStrip) return;\n node.typeArguments = null;\n },\n\n OptionalCallExpression({ node }) {\n if (skipStrip) return;\n node.typeArguments = null;\n },\n\n NewExpression({ node }) {\n if (skipStrip) return;\n node.typeArguments = null;\n },\n },\n };\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;eAQe,IAAAA,0BAAA,EAAQ,CAACC,GAAD,EAAMC,IAAN,KAAwB;EAC7CD,GAAG,CAACE,aAAJ,CAAkB,CAAlB;EAEA,MAAMC,cAAc,GAAG,6CAAvB;EAEA,IAAIC,SAAS,GAAG,KAAhB;EAEA,MAAM;IAAEC,gBAAgB,GAAG;EAArB,IAA+BJ,IAArC;EAEmC;IAEjC,IAAI;MAAEK,kBAAkB,GAAG;IAAvB,IAAiCL,IAArC;EACD;EAED,OAAO;IACLM,IAAI,EAAE,4BADD;IAELC,QAAQ,EAAEC,yBAFL;IAILC,OAAO,EAAE;MACPC,OAAO,CACLC,IADK,EAEL;QACEC,IAAI,EAAE;UACJC,GAAG,EAAE;YAAEC;UAAF;QADD;MADR,CAFK,EAOL;QACAX,SAAS,GAAG,KAAZ;QACA,IAAIY,cAAc,GAAG,KAArB;;QAEA,IAAID,QAAJ,EAAc;UACZ,KAAK,MAAME,OAAX,IAAsBF,QAAtB,EAAgC;YAC9B,IAAIZ,cAAc,CAACe,IAAf,CAAoBD,OAAO,CAACE,KAA5B,CAAJ,EAAwC;cACtCH,cAAc,GAAG,IAAjB;cAGAC,OAAO,CAACE,KAAR,GAAgBF,OAAO,CAACE,KAAR,CAAcC,OAAd,CAAsBjB,cAAtB,EAAsC,EAAtC,CAAhB;;cAGA,IAAI,CAACc,OAAO,CAACE,KAAR,CAAcC,OAAd,CAAsB,KAAtB,EAA6B,EAA7B,EAAiCC,IAAjC,EAAL,EAA8C;gBAC5CJ,OAAO,CAACK,MAAR,GAAiB,IAAjB;cACD;YACF;UACF;QACF;;QAED,IAAI,CAACN,cAAD,IAAmBX,gBAAvB,EAAyC;UACvCD,SAAS,GAAG,IAAZ;QACD;MACF,CA/BM;;MAgCPmB,iBAAiB,CAACX,IAAD,EAAO;QACtB,IAAIR,SAAJ,EAAe;QACf,IAAI,CAACQ,IAAI,CAACY,IAAL,CAAUC,UAAV,CAAqBC,MAA1B,EAAkC;QAElC,IAAIC,SAAS,GAAG,CAAhB;QAGAf,IAAI,CAACY,IAAL,CAAUC,UAAV,CAAqBG,OAArB,CAA6B,CAAC;UAAEC;QAAF,CAAD,KAAoB;UAC/C,IAAIA,UAAU,KAAK,MAAf,IAAyBA,UAAU,KAAK,QAA5C,EAAsD;YACpDF,SAAS;UACV;QACF,CAJD;;QAMA,IAAIA,SAAS,KAAKf,IAAI,CAACY,IAAL,CAAUC,UAAV,CAAqBC,MAAvC,EAA+C;UAC7Cd,IAAI,CAACkB,MAAL;QACD;MACF,CAhDM;;MAkDPC,IAAI,CACFnB,IADE,EAIF;QACA,IAAIR,SAAJ,EAAe;UACb,MAAMQ,IAAI,CAACoB,mBAAL,CACJ,oEACE,gCAFE,CAAN;QAID;;QAEDpB,IAAI,CAACkB,MAAL;MACD,CA/DM;;MAiEPG,oBAAoB,CAACrB,IAAD,EAAO;QACzB,IAAIR,SAAJ,EAAe;QACfQ,IAAI,CAACY,IAAL,CAAUU,cAAV,GAA2B,IAA3B;MACD,CApEM;;MAsEPC,KAAK,CAACvB,IAAD,EAAO;QACV,IAAIR,SAAJ,EAAe;QACfQ,IAAI,CAACY,IAAL,CAAUY,UAAV,GAAuB,IAAvB;QAIAxB,IAAI,CAACyB,GAAL,CAAS,WAAT,EAAsBT,OAAtB,CAA8BU,KAAK,IAAI;UACrC,IAAIA,KAAK,CAACC,eAAN,EAAJ,EAA6B;YAC3B,MAAM;cAAEf;YAAF,IAAWc,KAAjB;YAEmC;cACjC,IAAI,CAAChC,kBAAD,IAAuBkB,IAAI,CAACzB,OAAhC,EAAyC;gBACvC,MAAMuC,KAAK,CAACN,mBAAN,CACH,kDAAD,GACG,iCADH,GAEG,8CAFH,GAGG,gCAJC,CAAN;cAMD;YACF;;YAED,IAAIR,IAAI,CAACzB,OAAT,EAAkB;cAChBuC,KAAK,CAACR,MAAN;YACD,CAFD,MAEO;cAC8B;gBACjC,IAAI,CAACxB,kBAAD,IAAuB,CAACkB,IAAI,CAACL,KAA7B,IAAsC,CAACK,IAAI,CAACgB,UAAhD,EAA4D;kBAC1DF,KAAK,CAACR,MAAN;kBACA;gBACD;cACF;cAEDN,IAAI,CAACiB,QAAL,GAAgB,IAAhB;cACAjB,IAAI,CAACU,cAAL,GAAsB,IAAtB;YACD;UACF;QACF,CA7BD;MA8BD,CA1GM;;MA4GPQ,iBAAiB,CAAC;QAAElB;MAAF,CAAD,EAAW;QAC1B,IAAIpB,SAAJ,EAAe;;QAEf,IAAIoB,IAAI,CAACmB,IAAL,CAAUC,QAAd,EAAwB;UAEtBpB,IAAI,CAACmB,IAAL,CAAUC,QAAV,GAAqB,KAArB;QACD;MACF,CAnHM;;MAqHPC,QAAQ,CAAC;QAAErB;MAAF,CAAD,EAAW;QACjB,IAAIpB,SAAJ,EAAe;;QACf,IACEoB,IAAI,CAACsB,MAAL,CAAYpB,MAAZ,GAAqB,CAArB,IACAF,IAAI,CAACsB,MAAL,CAAY,CAAZ,EAAeC,IAAf,KAAwB,YADxB,IAEAvB,IAAI,CAACsB,MAAL,CAAY,CAAZ,EAAevC,IAAf,KAAwB,MAH1B,EAIE;UACAiB,IAAI,CAACsB,MAAL,CAAYE,KAAZ;QACD;;QACD,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGzB,IAAI,CAACsB,MAAL,CAAYpB,MAAhC,EAAwCuB,CAAC,EAAzC,EAA6C;UAC3C,IAAIC,KAAK,GAAG1B,IAAI,CAACsB,MAAL,CAAYG,CAAZ,CAAZ;;UACA,IAAIC,KAAK,CAACH,IAAN,KAAe,mBAAnB,EAAwC;YAGtCG,KAAK,GAAGA,KAAK,CAACP,IAAd;UACD;;UAED,IAAIO,KAAK,CAACN,QAAV,EAAoB;YAElBM,KAAK,CAACN,QAAN,GAAiB,KAAjB;UACD;QACF;;QAED,IAAI,CAACO,WAAA,CAAEC,QAAF,CAAW5B,IAAX,CAAL,EAAuB;UACrBA,IAAI,CAAC6B,SAAL,GAAiB,IAAjB;QACD;MACF,CA/IM;;MAiJPC,kBAAkB,CAAC1C,IAAD,EAAO;QACvB,IAAIR,SAAJ,EAAe;QACf,IAAI;UAAEoB;QAAF,IAAWZ,IAAf;;QACA,GAAG;UAEDY,IAAI,GAAGA,IAAI,CAAC+B,UAAZ;QACD,CAHD,QAGSJ,WAAA,CAAEK,oBAAF,CAAuBhC,IAAvB,CAHT;;QAIAZ,IAAI,CAAC6C,WAAL,CAAiBjC,IAAjB;MACD,CAzJM;;MA2JPkC,cAAc,CAAC;QAAElC;MAAF,CAAD,EAAW;QACvB,IAAIpB,SAAJ,EAAe;QACfoB,IAAI,CAACmC,aAAL,GAAqB,IAArB;MACD,CA9JM;;MAgKPC,sBAAsB,CAAC;QAAEpC;MAAF,CAAD,EAAW;QAC/B,IAAIpB,SAAJ,EAAe;QACfoB,IAAI,CAACmC,aAAL,GAAqB,IAArB;MACD,CAnKM;;MAqKPE,aAAa,CAAC;QAAErC;MAAF,CAAD,EAAW;QACtB,IAAIpB,SAAJ,EAAe;QACfoB,IAAI,CAACmC,aAAL,GAAqB,IAArB;MACD;;IAxKM;EAJJ,CAAP;AA+KD,CA7Lc,C"} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-flow-strip-types/package.json b/node_modules/@babel/plugin-transform-flow-strip-types/package.json deleted file mode 100644 index 825646f000e6b..0000000000000 --- a/node_modules/@babel/plugin-transform-flow-strip-types/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@babel/plugin-transform-flow-strip-types", - "version": "7.19.0", - "description": "Strip flow type annotations from your output code.", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-plugin-transform-flow-strip-types" - }, - "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-flow-strip-types", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "./lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/plugin-syntax-flow": "^7.18.6" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.19.0", - "@babel/helper-plugin-test-runner": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "author": "The Babel Team (https://babel.dev/team)", - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-regenerator/LICENSE b/node_modules/@babel/plugin-transform-regenerator/LICENSE deleted file mode 100644 index f31575ec773bb..0000000000000 --- a/node_modules/@babel/plugin-transform-regenerator/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/plugin-transform-regenerator/README.md b/node_modules/@babel/plugin-transform-regenerator/README.md deleted file mode 100644 index 6834d60183c4f..0000000000000 --- a/node_modules/@babel/plugin-transform-regenerator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-transform-regenerator - -> Explode async and generator functions into a state machine. - -See our website [@babel/plugin-transform-regenerator](https://babeljs.io/docs/en/babel-plugin-transform-regenerator) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-transform-regenerator -``` - -or using yarn: - -```sh -yarn add @babel/plugin-transform-regenerator --dev -``` diff --git a/node_modules/@babel/plugin-transform-regenerator/lib/index.js b/node_modules/@babel/plugin-transform-regenerator/lib/index.js deleted file mode 100644 index 24b97f03e1a7d..0000000000000 --- a/node_modules/@babel/plugin-transform-regenerator/lib/index.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _helperPluginUtils = require("@babel/helper-plugin-utils"); -var _regeneratorTransform = require("regenerator-transform"); -var _default = (0, _helperPluginUtils.declare)(({ - types: t, - assertVersion -}) => { - assertVersion(7); - return { - name: "transform-regenerator", - inherits: _regeneratorTransform.default, - visitor: { - MemberExpression(path) { - var _this$availableHelper; - if (!((_this$availableHelper = this.availableHelper) != null && _this$availableHelper.call(this, "regeneratorRuntime"))) { - return; - } - const obj = path.get("object"); - if (obj.isIdentifier({ - name: "regeneratorRuntime" - })) { - const helper = this.addHelper("regeneratorRuntime"); - if ( - t.isArrowFunctionExpression(helper)) { - obj.replaceWith(helper.body); - return; - } - obj.replaceWith(t.callExpression(helper, [])); - } - } - } - }; -}); -exports.default = _default; - -//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/plugin-transform-regenerator/lib/index.js.map b/node_modules/@babel/plugin-transform-regenerator/lib/index.js.map deleted file mode 100644 index e76ebbbe90093..0000000000000 --- a/node_modules/@babel/plugin-transform-regenerator/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["declare","types","t","assertVersion","name","inherits","regeneratorTransform","default","visitor","MemberExpression","path","availableHelper","obj","get","isIdentifier","helper","addHelper","isArrowFunctionExpression","replaceWith","body","callExpression"],"sources":["../src/index.ts"],"sourcesContent":["import { declare } from \"@babel/helper-plugin-utils\";\nimport type { types as t } from \"@babel/core\";\nimport regeneratorTransform from \"regenerator-transform\";\n\nexport default declare(({ types: t, assertVersion }) => {\n assertVersion(7);\n\n return {\n name: \"transform-regenerator\",\n\n inherits: regeneratorTransform.default,\n\n visitor: {\n // We visit MemberExpression so that we always transform\n // regeneratorRuntime before babel-plugin-polyfill-regenerator.\n MemberExpression(path) {\n if (!this.availableHelper?.(\"regeneratorRuntime\")) {\n // When using an older @babel/helpers version, fallback\n // to the old behavior.\n // TODO: Remove this in Babel 8.\n return;\n }\n\n const obj = path.get(\"object\");\n if (obj.isIdentifier({ name: \"regeneratorRuntime\" })) {\n const helper = this.addHelper(\"regeneratorRuntime\") as\n | t.Identifier\n | t.ArrowFunctionExpression;\n\n if (\n // TODO: Remove this in Babel 8, it's necessary to\n // avoid the IIFE when using older Babel versions.\n t.isArrowFunctionExpression(helper)\n ) {\n obj.replaceWith(helper.body);\n return;\n }\n\n obj.replaceWith(t.callExpression(helper, []));\n }\n },\n },\n };\n});\n"],"mappings":";;;;;;AAAA;AAEA;AAAyD,eAE1C,IAAAA,0BAAO,EAAC,CAAC;EAAEC,KAAK,EAAEC,CAAC;EAAEC;AAAc,CAAC,KAAK;EACtDA,aAAa,CAAC,CAAC,CAAC;EAEhB,OAAO;IACLC,IAAI,EAAE,uBAAuB;IAE7BC,QAAQ,EAAEC,qBAAoB,CAACC,OAAO;IAEtCC,OAAO,EAAE;MAGPC,gBAAgB,CAACC,IAAI,EAAE;QAAA;QACrB,IAAI,2BAAC,IAAI,CAACC,eAAe,aAApB,+BAAI,EAAmB,oBAAoB,CAAC,GAAE;UAIjD;QACF;QAEA,MAAMC,GAAG,GAAGF,IAAI,CAACG,GAAG,CAAC,QAAQ,CAAC;QAC9B,IAAID,GAAG,CAACE,YAAY,CAAC;UAAEV,IAAI,EAAE;QAAqB,CAAC,CAAC,EAAE;UACpD,MAAMW,MAAM,GAAG,IAAI,CAACC,SAAS,CAAC,oBAAoB,CAErB;UAE7B;UAGEd,CAAC,CAACe,yBAAyB,CAACF,MAAM,CAAC,EACnC;YACAH,GAAG,CAACM,WAAW,CAACH,MAAM,CAACI,IAAI,CAAC;YAC5B;UACF;UAEAP,GAAG,CAACM,WAAW,CAAChB,CAAC,CAACkB,cAAc,CAACL,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/C;MACF;IACF;EACF,CAAC;AACH,CAAC,CAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/plugin-transform-regenerator/package.json b/node_modules/@babel/plugin-transform-regenerator/package.json deleted file mode 100644 index a21b6934ee776..0000000000000 --- a/node_modules/@babel/plugin-transform-regenerator/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@babel/plugin-transform-regenerator", - "author": "The Babel Team (https://babel.dev/team)", - "description": "Explode async and generator functions into a state machine.", - "version": "7.20.5", - "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-regenerator", - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-plugin-transform-regenerator" - }, - "main": "./lib/index.js", - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "regenerator-transform": "^0.15.1" - }, - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.20.5", - "@babel/helper-plugin-test-runner": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/node_modules/@jest/create-cache-key-function/LICENSE b/node_modules/@jest/create-cache-key-function/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/create-cache-key-function/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/create-cache-key-function/build/index.d.ts b/node_modules/@jest/create-cache-key-function/build/index.d.ts deleted file mode 100644 index 168cba2207299..0000000000000 --- a/node_modules/@jest/create-cache-key-function/build/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * 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. - * - */ -import type { Config } from '@jest/types'; -declare type CacheKeyOptions = { - config: Config.ProjectConfig; - instrument: boolean; -}; -declare type GetCacheKeyFunction = (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string; -declare const _default: (files?: Array, values?: Array) => GetCacheKeyFunction; -export default _default; diff --git a/node_modules/@jest/create-cache-key-function/build/index.js b/node_modules/@jest/create-cache-key-function/build/index.js deleted file mode 100644 index 0db0f522a2cae..0000000000000 --- a/node_modules/@jest/create-cache-key-function/build/index.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; - -function _crypto() { - const data = require('crypto'); - - _crypto = function () { - return data; - }; - - return data; -} - -function _fs() { - const data = require('fs'); - - _fs = function () { - return data; - }; - - return data; -} - -function _path() { - const data = require('path'); - - _path = function () { - return data; - }; - - return data; -} - -/** - * 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-next-line no-restricted-imports -function getGlobalCacheKey(files, values) { - return [ - process.env.NODE_ENV, - process.env.BABEL_ENV, - ...values, - ...files.map(file => (0, _fs().readFileSync)(file)) - ] - .reduce( - (hash, chunk) => hash.update('\0', 'utf8').update(chunk || ''), - (0, _crypto().createHash)('md5') - ) - .digest('hex'); -} - -function getCacheKeyFunction(globalCacheKey) { - return (src, file, _configString, options) => { - const {config, instrument} = options; - return (0, _crypto().createHash)('md5') - .update(globalCacheKey) - .update('\0', 'utf8') - .update(src) - .update('\0', 'utf8') - .update(config.rootDir ? (0, _path().relative)(config.rootDir, file) : '') - .update('\0', 'utf8') - .update(instrument ? 'instrument' : '') - .digest('hex'); - }; -} - -var _default = (files = [], values = []) => - getCacheKeyFunction(getGlobalCacheKey(files, values)); - -exports.default = _default; diff --git a/node_modules/@jest/create-cache-key-function/package.json b/node_modules/@jest/create-cache-key-function/package.json deleted file mode 100644 index a15743711a385..0000000000000 --- a/node_modules/@jest/create-cache-key-function/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@jest/create-cache-key-function", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-create-cache-key-function" - }, - "dependencies": { - "@jest/types": "^26.6.2" - }, - "devDependencies": { - "@types/node": "*" - }, - "engines": { - "node": ">= 10.14.2" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/@jest/environment/LICENSE b/node_modules/@jest/environment/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/environment/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/environment/build/index.d.ts b/node_modules/@jest/environment/build/index.d.ts deleted file mode 100644 index 79d6d882de2e3..0000000000000 --- a/node_modules/@jest/environment/build/index.d.ts +++ /dev/null @@ -1,284 +0,0 @@ -/** - * 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. - */ -/// -import type { Context, Script } from 'vm'; -import type { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers'; -import type { Circus, Config, Global } from '@jest/types'; -import jestMock = require('jest-mock'); -declare type JestMockFn = typeof jestMock.fn; -declare type JestMockSpyOn = typeof jestMock.spyOn; -export declare type EnvironmentContext = Partial<{ - console: Console; - docblockPragmas: Record>; - testPath: Config.Path; -}>; -export declare type ModuleWrapper = (this: Module['exports'], module: Module, exports: Module['exports'], require: Module['require'], __dirname: string, __filename: Module['filename'], global: Global.Global, jest?: Jest, ...extraGlobals: Array) => unknown; -export declare class JestEnvironment { - constructor(config: Config.ProjectConfig, context?: EnvironmentContext); - global: Global.Global; - fakeTimers: LegacyFakeTimers | null; - fakeTimersModern: ModernFakeTimers | null; - moduleMocker: jestMock.ModuleMocker | null; - /** - * @deprecated implement getVmContext instead - */ - runScript(script: Script): T | null; - getVmContext?(): Context | null; - setup(): Promise; - teardown(): Promise; - handleTestEvent?(event: Circus.Event, state: Circus.State): void | Promise; -} -export declare type Module = NodeModule; -export interface Jest { - /** - * Provides a way to add Jasmine-compatible matchers into your Jest context. - * - * @deprecated Use `expect.extend` instead - */ - addMatchers(matchers: Record): void; - /** - * Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run. - * Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals. - */ - advanceTimersToNextTimer(steps?: number): void; - /** - * Disables automatic mocking in the module loader. - */ - autoMockOff(): Jest; - /** - * Enables automatic mocking in the module loader. - */ - autoMockOn(): Jest; - /** - * Clears the mock.calls and mock.instances properties of all mocks. - * Equivalent to calling .mockClear() on every mocked function. - */ - clearAllMocks(): Jest; - /** - * Removes any pending timers from the timer system. If any timers have been - * scheduled, they will be cleared and will never have the opportunity to - * execute in the future. - */ - clearAllTimers(): void; - /** - * Indicates that the module system should never return a mocked version - * of the specified module, including all of the specified module's - * dependencies. - */ - deepUnmock(moduleName: string): Jest; - /** - * Disables automatic mocking in the module loader. - * - * After this method is called, all `require()`s will return the real - * versions of each module (rather than a mocked version). - */ - disableAutomock(): Jest; - /** - * When using `babel-jest`, calls to mock will automatically be hoisted to - * the top of the code block. Use this method if you want to explicitly avoid - * this behavior. - */ - doMock(moduleName: string, moduleFactory?: () => unknown): Jest; - /** - * Indicates that the module system should never return a mocked version - * of the specified module from require() (e.g. that it should always return - * the real module). - */ - dontMock(moduleName: string): Jest; - /** - * Enables automatic mocking in the module loader. - */ - enableAutomock(): Jest; - /** - * Creates a mock function. Optionally takes a mock implementation. - */ - fn: JestMockFn; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - * - * @deprecated Use `jest.createMockFromModule()` instead - */ - genMockFromModule(moduleName: string): unknown; - /** - * Given the name of a module, use the automatic mocking system to generate a - * mocked version of the module for you. - * - * This is useful when you want to create a manual mock that extends the - * automatic mock's behavior. - */ - createMockFromModule(moduleName: string): unknown; - /** - * Determines if the given function is a mocked function. - */ - isMockFunction(fn: (...args: Array) => unknown): fn is ReturnType; - /** - * Mocks a module with an auto-mocked version when it is being required. - */ - mock(moduleName: string, moduleFactory?: () => unknown, options?: { - virtual?: boolean; - }): Jest; - /** - * Returns the actual module instead of a mock, bypassing all checks on - * whether the module should receive a mock implementation or not. - * - * @example - ``` - jest.mock('../myModule', () => { - // Require the original module to not be mocked... - const originalModule = jest.requireActual(moduleName); - return { - __esModule: true, // Use it when dealing with esModules - ...originalModule, - getRandom: jest.fn().mockReturnValue(10), - }; - }); - - const getRandom = require('../myModule').getRandom; - - getRandom(); // Always returns 10 - ``` - */ - requireActual: (moduleName: string) => unknown; - /** - * Returns a mock module instead of the actual module, bypassing all checks - * on whether the module should be required normally or not. - */ - requireMock: (moduleName: string) => unknown; - /** - * Resets the state of all mocks. - * Equivalent to calling .mockReset() on every mocked function. - */ - resetAllMocks(): Jest; - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - * - * @deprecated Use `jest.resetModules()` - */ - resetModuleRegistry(): Jest; - /** - * Resets the module registry - the cache of all required modules. This is - * useful to isolate modules where local state might conflict between tests. - */ - resetModules(): Jest; - /** - * Restores all mocks back to their original value. Equivalent to calling - * `.mockRestore` on every mocked function. - * - * Beware that jest.restoreAllMocks() only works when the mock was created with - * jest.spyOn; other mocks will require you to manually restore them. - */ - restoreAllMocks(): Jest; - /** - * Runs failed tests n-times until they pass or until the max number of - * retries is exhausted. This only works with `jest-circus`! - */ - retryTimes(numRetries: number): Jest; - /** - * Exhausts tasks queued by setImmediate(). - * - * > Note: This function is not available when using Lolex as fake timers implementation - */ - runAllImmediates(): void; - /** - * Exhausts the micro-task queue (usually interfaced in node via - * process.nextTick). - */ - runAllTicks(): void; - /** - * Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() - * and setInterval()). - */ - runAllTimers(): void; - /** - * Executes only the macro-tasks that are currently pending (i.e., only the - * tasks that have been queued by setTimeout() or setInterval() up to this - * point). If any of the currently pending macro-tasks schedule new - * macro-tasks, those new tasks will not be executed by this call. - */ - runOnlyPendingTimers(): void; - /** - * Advances all timers by msToRun milliseconds. All pending "macro-tasks" - * that have been queued via setTimeout() or setInterval(), and would be - * executed within this timeframe will be executed. - */ - advanceTimersByTime(msToRun: number): void; - /** - * Executes only the macro task queue (i.e. all tasks queued by setTimeout() - * or setInterval() and setImmediate()). - * - * @deprecated Use `jest.advanceTimersByTime()` - */ - runTimersToTime(msToRun: number): void; - /** - * Returns the number of fake timers still left to run. - */ - getTimerCount(): number; - /** - * Explicitly supplies the mock object that the module system should return - * for the specified module. - * - * Note It is recommended to use `jest.mock()` instead. The `jest.mock` - * API's second argument is a module factory instead of the expected - * exported module object. - */ - setMock(moduleName: string, moduleExports: unknown): Jest; - /** - * Set the default timeout interval for tests and before/after hooks in - * milliseconds. - * - * Note: The default timeout interval is 5 seconds if this method is not - * called. - */ - setTimeout(timeout: number): Jest; - /** - * Creates a mock function similar to `jest.fn` but also tracks calls to - * `object[methodName]`. - * - * Note: By default, jest.spyOn also calls the spied method. This is - * different behavior from most other test libraries. - */ - spyOn: JestMockSpyOn; - /** - * Indicates that the module system should never return a mocked version of - * the specified module from require() (e.g. that it should always return the - * real module). - */ - unmock(moduleName: string): Jest; - /** - * Instructs Jest to use fake versions of the standard timer functions. - */ - useFakeTimers(implementation?: 'modern' | 'legacy'): Jest; - /** - * Instructs Jest to use the real versions of the standard timer functions. - */ - useRealTimers(): Jest; - /** - * `jest.isolateModules(fn)` goes a step further than `jest.resetModules()` - * and creates a sandbox registry for the modules that are loaded inside - * the callback function. This is useful to isolate specific modules for - * every test so that local module state doesn't conflict between tests. - */ - isolateModules(fn: () => void): Jest; - /** - * When mocking time, `Date.now()` will also be mocked. If you for some reason need access to the real current time, you can invoke this function. - * - * > Note: This function is only available when using Lolex as fake timers implementation - */ - getRealSystemTime(): number; - /** - * Set the current system time used by fake timers. Simulates a user changing the system clock while your program is running. It affects the current time but it does not in itself cause e.g. timers to fire; they will fire exactly as they would have done without the call to `jest.setSystemTime()`. - * - * > Note: This function is only available when using Lolex as fake timers implementation - */ - setSystemTime(now?: number | Date): void; -} -export {}; diff --git a/node_modules/@jest/environment/build/index.js b/node_modules/@jest/environment/build/index.js deleted file mode 100644 index 563dbd12702a2..0000000000000 --- a/node_modules/@jest/environment/build/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -function _jestMock() { - const data = _interopRequireDefault(require('jest-mock')); - - _jestMock = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/environment/package.json b/node_modules/@jest/environment/package.json deleted file mode 100644 index d8ff8e25a8b15..0000000000000 --- a/node_modules/@jest/environment/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@jest/environment", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-environment" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/@jest/globals/LICENSE b/node_modules/@jest/globals/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/globals/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/globals/build/index.d.ts b/node_modules/@jest/globals/build/index.d.ts deleted file mode 100644 index 1cc83b8a4391f..0000000000000 --- a/node_modules/@jest/globals/build/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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. - */ -import type { Jest } from '@jest/environment'; -import type { Global } from '@jest/types'; -import importedExpect = require('expect'); -export declare const jest: Jest; -export declare const expect: typeof importedExpect; -export declare const it: Global.GlobalAdditions['it']; -export declare const test: Global.GlobalAdditions['test']; -export declare const fit: Global.GlobalAdditions['fit']; -export declare const xit: Global.GlobalAdditions['xit']; -export declare const xtest: Global.GlobalAdditions['xtest']; -export declare const describe: Global.GlobalAdditions['describe']; -export declare const xdescribe: Global.GlobalAdditions['xdescribe']; -export declare const fdescribe: Global.GlobalAdditions['fdescribe']; -export declare const beforeAll: Global.GlobalAdditions['beforeAll']; -export declare const beforeEach: Global.GlobalAdditions['beforeEach']; -export declare const afterEach: Global.GlobalAdditions['afterEach']; -export declare const afterAll: Global.GlobalAdditions['afterAll']; diff --git a/node_modules/@jest/globals/build/index.js b/node_modules/@jest/globals/build/index.js deleted file mode 100644 index 06f90c10cdcfa..0000000000000 --- a/node_modules/@jest/globals/build/index.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -function _expect() { - const data = _interopRequireDefault(require('expect')); - - _expect = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(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. - */ -throw new Error( - 'Do not import `@jest/globals` outside of the Jest test environment' -); diff --git a/node_modules/@jest/globals/package.json b/node_modules/@jest/globals/package.json deleted file mode 100644 index e008a011e28ae..0000000000000 --- a/node_modules/@jest/globals/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "@jest/globals", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-globals" - }, - "engines": { - "node": ">= 10.14.2" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@jest/environment": "^26.6.2", - "@jest/types": "^26.6.2", - "expect": "^26.6.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/@jest/test-result/LICENSE b/node_modules/@jest/test-result/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/test-result/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/test-result/build/formatTestResults.d.ts b/node_modules/@jest/test-result/build/formatTestResults.d.ts deleted file mode 100644 index 6a3bf03a4aa3c..0000000000000 --- a/node_modules/@jest/test-result/build/formatTestResults.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * 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. - */ -import type { AggregatedResult, CodeCoverageFormatter, CodeCoverageReporter, FormattedTestResults } from './types'; -export default function formatTestResults(results: AggregatedResult, codeCoverageFormatter?: CodeCoverageFormatter, reporter?: CodeCoverageReporter): FormattedTestResults; diff --git a/node_modules/@jest/test-result/build/formatTestResults.js b/node_modules/@jest/test-result/build/formatTestResults.js deleted file mode 100644 index 3de0cdfa3e639..0000000000000 --- a/node_modules/@jest/test-result/build/formatTestResults.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = formatTestResults; - -/** - * 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 formatTestResult = (testResult, codeCoverageFormatter, reporter) => { - const assertionResults = testResult.testResults.map(formatTestAssertion); - - if (testResult.testExecError) { - const now = Date.now(); - return { - assertionResults, - coverage: {}, - endTime: now, - message: testResult.failureMessage - ? testResult.failureMessage - : testResult.testExecError.message, - name: testResult.testFilePath, - startTime: now, - status: 'failed', - summary: '' - }; - } else { - const allTestsPassed = testResult.numFailingTests === 0; - return { - assertionResults, - coverage: codeCoverageFormatter - ? codeCoverageFormatter(testResult.coverage, reporter) - : testResult.coverage, - endTime: testResult.perfStats.end, - message: testResult.failureMessage || '', - name: testResult.testFilePath, - startTime: testResult.perfStats.start, - status: allTestsPassed ? 'passed' : 'failed', - summary: '' - }; - } -}; - -function formatTestAssertion(assertion) { - const result = { - ancestorTitles: assertion.ancestorTitles, - failureMessages: null, - fullName: assertion.fullName, - location: assertion.location, - status: assertion.status, - title: assertion.title - }; - - if (assertion.failureMessages) { - result.failureMessages = assertion.failureMessages; - } - - return result; -} - -function formatTestResults(results, codeCoverageFormatter, reporter) { - const testResults = results.testResults.map(testResult => - formatTestResult(testResult, codeCoverageFormatter, reporter) - ); - return {...results, testResults}; -} diff --git a/node_modules/@jest/test-result/build/helpers.d.ts b/node_modules/@jest/test-result/build/helpers.d.ts deleted file mode 100644 index 480c7ab3e5212..0000000000000 --- a/node_modules/@jest/test-result/build/helpers.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * 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. - */ -import type { Config } from '@jest/types'; -import type { AggregatedResult, SerializableError, TestResult } from './types'; -export declare const makeEmptyAggregatedTestResult: () => AggregatedResult; -export declare const buildFailureTestResult: (testPath: Config.Path, err: SerializableError) => TestResult; -export declare const addResult: (aggregatedResults: AggregatedResult, testResult: TestResult) => void; -export declare const createEmptyTestResult: () => TestResult; diff --git a/node_modules/@jest/test-result/build/helpers.js b/node_modules/@jest/test-result/build/helpers.js deleted file mode 100644 index 2b7e162c25351..0000000000000 --- a/node_modules/@jest/test-result/build/helpers.js +++ /dev/null @@ -1,185 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.createEmptyTestResult = exports.addResult = exports.buildFailureTestResult = exports.makeEmptyAggregatedTestResult = void 0; - -/** - * 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 makeEmptyAggregatedTestResult = () => ({ - numFailedTestSuites: 0, - numFailedTests: 0, - numPassedTestSuites: 0, - numPassedTests: 0, - numPendingTestSuites: 0, - numPendingTests: 0, - numRuntimeErrorTestSuites: 0, - numTodoTests: 0, - numTotalTestSuites: 0, - numTotalTests: 0, - openHandles: [], - snapshot: { - added: 0, - didUpdate: false, - // is set only after the full run - failure: false, - filesAdded: 0, - // combines individual test results + removed files after the full run - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0 - }, - startTime: 0, - success: true, - testResults: [], - wasInterrupted: false -}); - -exports.makeEmptyAggregatedTestResult = makeEmptyAggregatedTestResult; - -const buildFailureTestResult = (testPath, err) => ({ - console: undefined, - displayName: undefined, - failureMessage: null, - leaks: false, - numFailingTests: 0, - numPassingTests: 0, - numPendingTests: 0, - numTodoTests: 0, - openHandles: [], - perfStats: { - end: 0, - runtime: 0, - slow: false, - start: 0 - }, - skipped: false, - snapshot: { - added: 0, - fileDeleted: false, - matched: 0, - unchecked: 0, - uncheckedKeys: [], - unmatched: 0, - updated: 0 - }, - sourceMaps: {}, - testExecError: err, - testFilePath: testPath, - testResults: [] -}); // Add individual test result to an aggregated test result - -exports.buildFailureTestResult = buildFailureTestResult; - -const addResult = (aggregatedResults, testResult) => { - // `todos` are new as of Jest 24, and not all runners return it. - // Set it to `0` to avoid `NaN` - if (!testResult.numTodoTests) { - testResult.numTodoTests = 0; - } - - aggregatedResults.testResults.push(testResult); - aggregatedResults.numTotalTests += - testResult.numPassingTests + - testResult.numFailingTests + - testResult.numPendingTests + - testResult.numTodoTests; - aggregatedResults.numFailedTests += testResult.numFailingTests; - aggregatedResults.numPassedTests += testResult.numPassingTests; - aggregatedResults.numPendingTests += testResult.numPendingTests; - aggregatedResults.numTodoTests += testResult.numTodoTests; - - if (testResult.testExecError) { - aggregatedResults.numRuntimeErrorTestSuites++; - } - - if (testResult.skipped) { - aggregatedResults.numPendingTestSuites++; - } else if (testResult.numFailingTests > 0 || testResult.testExecError) { - aggregatedResults.numFailedTestSuites++; - } else { - aggregatedResults.numPassedTestSuites++; - } // Snapshot data - - if (testResult.snapshot.added) { - aggregatedResults.snapshot.filesAdded++; - } - - if (testResult.snapshot.fileDeleted) { - aggregatedResults.snapshot.filesRemoved++; - } - - if (testResult.snapshot.unmatched) { - aggregatedResults.snapshot.filesUnmatched++; - } - - if (testResult.snapshot.updated) { - aggregatedResults.snapshot.filesUpdated++; - } - - aggregatedResults.snapshot.added += testResult.snapshot.added; - aggregatedResults.snapshot.matched += testResult.snapshot.matched; - aggregatedResults.snapshot.unchecked += testResult.snapshot.unchecked; - - if ( - testResult.snapshot.uncheckedKeys && - testResult.snapshot.uncheckedKeys.length > 0 - ) { - aggregatedResults.snapshot.uncheckedKeysByFile.push({ - filePath: testResult.testFilePath, - keys: testResult.snapshot.uncheckedKeys - }); - } - - aggregatedResults.snapshot.unmatched += testResult.snapshot.unmatched; - aggregatedResults.snapshot.updated += testResult.snapshot.updated; - aggregatedResults.snapshot.total += - testResult.snapshot.added + - testResult.snapshot.matched + - testResult.snapshot.unmatched + - testResult.snapshot.updated; -}; - -exports.addResult = addResult; - -const createEmptyTestResult = () => ({ - leaks: false, - // That's legacy code, just adding it as needed for typing - numFailingTests: 0, - numPassingTests: 0, - numPendingTests: 0, - numTodoTests: 0, - openHandles: [], - perfStats: { - end: 0, - runtime: 0, - slow: false, - start: 0 - }, - skipped: false, - snapshot: { - added: 0, - fileDeleted: false, - matched: 0, - unchecked: 0, - uncheckedKeys: [], - unmatched: 0, - updated: 0 - }, - testFilePath: '', - testResults: [] -}); - -exports.createEmptyTestResult = createEmptyTestResult; diff --git a/node_modules/@jest/test-result/build/index.d.ts b/node_modules/@jest/test-result/build/index.d.ts deleted file mode 100644 index 1d83f7b9b80ea..0000000000000 --- a/node_modules/@jest/test-result/build/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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. - */ -export { default as formatTestResults } from './formatTestResults'; -export { addResult, buildFailureTestResult, createEmptyTestResult, makeEmptyAggregatedTestResult, } from './helpers'; -export type { AggregatedResult, AssertionLocation, AssertionResult, FailedAssertion, FormattedTestResults, Milliseconds, RuntimeTransformResult, SerializableError, SnapshotSummary, Status, Suite, TestResult, TestCaseResult, V8CoverageResult, } from './types'; diff --git a/node_modules/@jest/test-result/build/index.js b/node_modules/@jest/test-result/build/index.js deleted file mode 100644 index 243e6682fc7ca..0000000000000 --- a/node_modules/@jest/test-result/build/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'formatTestResults', { - enumerable: true, - get: function () { - return _formatTestResults.default; - } -}); -Object.defineProperty(exports, 'addResult', { - enumerable: true, - get: function () { - return _helpers.addResult; - } -}); -Object.defineProperty(exports, 'buildFailureTestResult', { - enumerable: true, - get: function () { - return _helpers.buildFailureTestResult; - } -}); -Object.defineProperty(exports, 'createEmptyTestResult', { - enumerable: true, - get: function () { - return _helpers.createEmptyTestResult; - } -}); -Object.defineProperty(exports, 'makeEmptyAggregatedTestResult', { - enumerable: true, - get: function () { - return _helpers.makeEmptyAggregatedTestResult; - } -}); - -var _formatTestResults = _interopRequireDefault(require('./formatTestResults')); - -var _helpers = require('./helpers'); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} diff --git a/node_modules/@jest/test-result/build/types.d.ts b/node_modules/@jest/test-result/build/types.d.ts deleted file mode 100644 index fe593018aa77e..0000000000000 --- a/node_modules/@jest/test-result/build/types.d.ts +++ /dev/null @@ -1,152 +0,0 @@ -/** - * 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. - */ -import type { V8Coverage } from 'collect-v8-coverage'; -import type { CoverageMap, CoverageMapData } from 'istanbul-lib-coverage'; -import type { ConsoleBuffer } from '@jest/console'; -import type { Config, TestResult, TransformTypes } from '@jest/types'; -export interface RuntimeTransformResult extends TransformTypes.TransformResult { - wrapperLength?: number; -} -export declare type V8CoverageResult = Array<{ - codeTransformResult: RuntimeTransformResult | undefined; - result: V8Coverage[number]; -}>; -export declare type SerializableError = TestResult.SerializableError; -export declare type FailedAssertion = { - matcherName?: string; - message?: string; - actual?: unknown; - pass?: boolean; - passed?: boolean; - expected?: unknown; - isNot?: boolean; - stack?: string; - error?: unknown; -}; -export declare type AssertionLocation = { - fullName: string; - path: string; -}; -export declare type Status = AssertionResult['status']; -export declare type Bytes = number; -export declare type Milliseconds = TestResult.Milliseconds; -export declare type AssertionResult = TestResult.AssertionResult; -export declare type FormattedAssertionResult = Pick & { - failureMessages: AssertionResult['failureMessages'] | null; -}; -export declare type AggregatedResultWithoutCoverage = { - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numTodoTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - openHandles: Array; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; -}; -export declare type AggregatedResult = AggregatedResultWithoutCoverage & { - coverageMap?: CoverageMap | null; -}; -export declare type Suite = { - title: string; - suites: Array; - tests: Array; -}; -export declare type TestCaseResult = AssertionResult; -export declare type TestResult = { - console?: ConsoleBuffer; - coverage?: CoverageMapData; - displayName?: Config.DisplayName; - failureMessage?: string | null; - leaks: boolean; - memoryUsage?: Bytes; - numFailingTests: number; - numPassingTests: number; - numPendingTests: number; - numTodoTests: number; - openHandles: Array; - perfStats: { - end: Milliseconds; - runtime: Milliseconds; - slow: boolean; - start: Milliseconds; - }; - skipped: boolean; - snapshot: { - added: number; - fileDeleted: boolean; - matched: number; - unchecked: number; - uncheckedKeys: Array; - unmatched: number; - updated: number; - }; - sourceMaps?: { - [sourcePath: string]: string; - }; - testExecError?: SerializableError; - testFilePath: Config.Path; - testResults: Array; - v8Coverage?: V8CoverageResult; -}; -export declare type FormattedTestResult = { - message: string; - name: string; - summary: string; - status: 'failed' | 'passed'; - startTime: number; - endTime: number; - coverage: unknown; - assertionResults: Array; -}; -export declare type FormattedTestResults = { - coverageMap?: CoverageMap | null | undefined; - numFailedTests: number; - numFailedTestSuites: number; - numPassedTests: number; - numPassedTestSuites: number; - numPendingTests: number; - numPendingTestSuites: number; - numRuntimeErrorTestSuites: number; - numTotalTests: number; - numTotalTestSuites: number; - snapshot: SnapshotSummary; - startTime: number; - success: boolean; - testResults: Array; - wasInterrupted: boolean; -}; -export declare type CodeCoverageReporter = unknown; -export declare type CodeCoverageFormatter = (coverage: CoverageMapData | null | undefined, reporter: CodeCoverageReporter) => Record | null | undefined; -export declare type UncheckedSnapshot = { - filePath: string; - keys: Array; -}; -export declare type SnapshotSummary = { - added: number; - didUpdate: boolean; - failure: boolean; - filesAdded: number; - filesRemoved: number; - filesRemovedList: Array; - filesUnmatched: number; - filesUpdated: number; - matched: number; - total: number; - unchecked: number; - uncheckedKeysByFile: Array; - unmatched: number; - updated: number; -}; diff --git a/node_modules/@jest/test-result/build/types.js b/node_modules/@jest/test-result/build/types.js deleted file mode 100644 index ad9a93a7c160f..0000000000000 --- a/node_modules/@jest/test-result/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/test-result/package.json b/node_modules/@jest/test-result/package.json deleted file mode 100644 index 7eb821198ec95..0000000000000 --- a/node_modules/@jest/test-result/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@jest/test-result", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-test-result" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@jest/console": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/@jest/test-sequencer/LICENSE b/node_modules/@jest/test-sequencer/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/test-sequencer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/test-sequencer/build/index.d.ts b/node_modules/@jest/test-sequencer/build/index.d.ts deleted file mode 100644 index d3a6c44b384fe..0000000000000 --- a/node_modules/@jest/test-sequencer/build/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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. - */ -import type { AggregatedResult } from '@jest/test-result'; -import type { Test } from 'jest-runner'; -import type { Context } from 'jest-runtime'; -declare type Cache = { - [key: string]: [0 | 1, number]; -}; -/** - * The TestSequencer will ultimately decide which tests should run first. - * It is responsible for storing and reading from a local cache - * map that stores context information for a given test, such as how long it - * took to run during the last run and if it has failed or not. - * Such information is used on: - * TestSequencer.sort(tests: Array) - * to sort the order of the provided tests. - * - * After the results are collected, - * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) - * is called to store/update this information on the cache map. - */ -export default class TestSequencer { - private _cache; - _getCachePath(context: Context): string; - _getCache(test: Test): Cache; - /** - * Sorting tests is very important because it has a great impact on the - * user-perceived responsiveness and speed of the test run. - * - * If such information is on cache, tests are sorted based on: - * -> Has it failed during the last run ? - * Since it's important to provide the most expected feedback as quickly - * as possible. - * -> How long it took to run ? - * Because running long tests first is an effort to minimize worker idle - * time at the end of a long test run. - * And if that information is not available they are sorted based on file size - * since big test files usually take longer to complete. - * - * Note that a possible improvement would be to analyse other information - * from the file other than its size. - * - */ - sort(tests: Array): Array; - allFailedTests(tests: Array): Array; - cacheResults(tests: Array, results: AggregatedResult): void; -} -export {}; diff --git a/node_modules/@jest/test-sequencer/build/index.js b/node_modules/@jest/test-sequencer/build/index.js deleted file mode 100644 index 8f16cf4656af6..0000000000000 --- a/node_modules/@jest/test-sequencer/build/index.js +++ /dev/null @@ -1,230 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; - -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - - fs = function () { - return data; - }; - - return data; -} - -function _jestHasteMap() { - const data = require('jest-haste-map'); - - _jestHasteMap = function () { - return data; - }; - - return data; -} - -function _getRequireWildcardCache() { - if (typeof WeakMap !== 'function') return null; - var cache = new WeakMap(); - _getRequireWildcardCache = function () { - return cache; - }; - return cache; -} - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (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; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - -const FAIL = 0; -const SUCCESS = 1; - -/** - * The TestSequencer will ultimately decide which tests should run first. - * It is responsible for storing and reading from a local cache - * map that stores context information for a given test, such as how long it - * took to run during the last run and if it has failed or not. - * Such information is used on: - * TestSequencer.sort(tests: Array) - * to sort the order of the provided tests. - * - * After the results are collected, - * TestSequencer.cacheResults(tests: Array, results: AggregatedResult) - * is called to store/update this information on the cache map. - */ -class TestSequencer { - constructor() { - _defineProperty(this, '_cache', new Map()); - } - - _getCachePath(context) { - const {config} = context; - return (0, _jestHasteMap().getCacheFilePath)( - config.cacheDirectory, - 'perf-cache-' + config.name - ); - } - - _getCache(test) { - const {context} = test; - - if (!this._cache.has(context) && context.config.cache) { - const cachePath = this._getCachePath(context); - - if (fs().existsSync(cachePath)) { - try { - this._cache.set( - context, - JSON.parse(fs().readFileSync(cachePath, 'utf8')) - ); - } catch {} - } - } - - let cache = this._cache.get(context); - - if (!cache) { - cache = {}; - - this._cache.set(context, cache); - } - - return cache; - } - /** - * Sorting tests is very important because it has a great impact on the - * user-perceived responsiveness and speed of the test run. - * - * If such information is on cache, tests are sorted based on: - * -> Has it failed during the last run ? - * Since it's important to provide the most expected feedback as quickly - * as possible. - * -> How long it took to run ? - * Because running long tests first is an effort to minimize worker idle - * time at the end of a long test run. - * And if that information is not available they are sorted based on file size - * since big test files usually take longer to complete. - * - * Note that a possible improvement would be to analyse other information - * from the file other than its size. - * - */ - - sort(tests) { - const stats = {}; - - const fileSize = ({path, context: {hasteFS}}) => - stats[path] || (stats[path] = hasteFS.getSize(path) || 0); - - const hasFailed = (cache, test) => - cache[test.path] && cache[test.path][0] === FAIL; - - const time = (cache, test) => cache[test.path] && cache[test.path][1]; - - tests.forEach(test => (test.duration = time(this._getCache(test), test))); - return tests.sort((testA, testB) => { - const cacheA = this._getCache(testA); - - const cacheB = this._getCache(testB); - - const failedA = hasFailed(cacheA, testA); - const failedB = hasFailed(cacheB, testB); - const hasTimeA = testA.duration != null; - - if (failedA !== failedB) { - return failedA ? -1 : 1; - } else if (hasTimeA != (testB.duration != null)) { - // If only one of two tests has timing information, run it last - return hasTimeA ? 1 : -1; - } else if (testA.duration != null && testB.duration != null) { - return testA.duration < testB.duration ? 1 : -1; - } else { - return fileSize(testA) < fileSize(testB) ? 1 : -1; - } - }); - } - - allFailedTests(tests) { - const hasFailed = (cache, test) => { - var _cache$test$path; - - return ( - ((_cache$test$path = cache[test.path]) === null || - _cache$test$path === void 0 - ? void 0 - : _cache$test$path[0]) === FAIL - ); - }; - - return this.sort( - tests.filter(test => hasFailed(this._getCache(test), test)) - ); - } - - cacheResults(tests, results) { - const map = Object.create(null); - tests.forEach(test => (map[test.path] = test)); - results.testResults.forEach(testResult => { - if (testResult && map[testResult.testFilePath] && !testResult.skipped) { - const cache = this._getCache(map[testResult.testFilePath]); - - const perf = testResult.perfStats; - cache[testResult.testFilePath] = [ - testResult.numFailingTests ? FAIL : SUCCESS, - perf.runtime || 0 - ]; - } - }); - - this._cache.forEach((cache, context) => - fs().writeFileSync(this._getCachePath(context), JSON.stringify(cache)) - ); - } -} - -exports.default = TestSequencer; diff --git a/node_modules/@jest/test-sequencer/node_modules/.bin/jest-runtime b/node_modules/@jest/test-sequencer/node_modules/.bin/jest-runtime deleted file mode 120000 index 7196e48130e6d..0000000000000 --- a/node_modules/@jest/test-sequencer/node_modules/.bin/jest-runtime +++ /dev/null @@ -1 +0,0 @@ -../../../../jest-runtime/bin/jest-runtime.js \ No newline at end of file diff --git a/node_modules/@jest/test-sequencer/package.json b/node_modules/@jest/test-sequencer/package.json deleted file mode 100644 index 9a95584e327c2..0000000000000 --- a/node_modules/@jest/test-sequencer/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@jest/test-sequencer", - "version": "26.6.3", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-test-sequencer" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@jest/test-result": "^26.6.2", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-runner": "^26.6.3", - "jest-runtime": "^26.6.3" - }, - "devDependencies": { - "@types/graceful-fs": "^4.1.3" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "2f6931e91d5ab126de70caf150c68709752e7f6c" -} diff --git a/node_modules/@jest/transform/LICENSE b/node_modules/@jest/transform/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/@jest/transform/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jest/transform/build/ScriptTransformer.d.ts b/node_modules/@jest/transform/build/ScriptTransformer.d.ts deleted file mode 100644 index b10fe78950391..0000000000000 --- a/node_modules/@jest/transform/build/ScriptTransformer.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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. - */ -import type { Config } from '@jest/types'; -import type { Options, TransformResult } from './types'; -export default class ScriptTransformer { - private _cache; - private _config; - private _transformCache; - private _transformConfigCache; - constructor(config: Config.ProjectConfig); - private _getCacheKey; - private _getFileCachePath; - private _getTransformPath; - private _getTransformer; - private _instrumentFile; - preloadTransformer(filepath: Config.Path): void; - transformSource(filepath: Config.Path, content: string, instrument: boolean, supportsDynamicImport?: boolean, supportsStaticESM?: boolean): TransformResult; - private _transformAndBuildScript; - transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult; - transformJson(filename: Config.Path, options: Options, fileSource: string): string; - requireAndTranspileModule(moduleName: string, callback?: (module: ModuleType) => void): ModuleType; - requireAndTranspileModule(moduleName: string, callback?: (module: ModuleType) => Promise): Promise; - /** - * @deprecated use `this.shouldTransform` instead - */ - private _shouldTransform; - shouldTransform(filename: Config.Path): boolean; -} -export declare function createTranspilingRequire(config: Config.ProjectConfig): (resolverPath: string, applyInteropRequireDefault?: boolean) => TModuleType; diff --git a/node_modules/@jest/transform/build/ScriptTransformer.js b/node_modules/@jest/transform/build/ScriptTransformer.js deleted file mode 100644 index 7d04b4e64eff6..0000000000000 --- a/node_modules/@jest/transform/build/ScriptTransformer.js +++ /dev/null @@ -1,882 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.createTranspilingRequire = createTranspilingRequire; -exports.default = void 0; - -function _crypto() { - const data = require('crypto'); - - _crypto = function () { - return data; - }; - - return data; -} - -function path() { - const data = _interopRequireWildcard(require('path')); - - path = function () { - return data; - }; - - return data; -} - -function _core() { - const data = require('@babel/core'); - - _core = function () { - return data; - }; - - return data; -} - -function _babelPluginIstanbul() { - const data = _interopRequireDefault(require('babel-plugin-istanbul')); - - _babelPluginIstanbul = function () { - return data; - }; - - return data; -} - -function _convertSourceMap() { - const data = require('convert-source-map'); - - _convertSourceMap = function () { - return data; - }; - - return data; -} - -function _fastJsonStableStringify() { - const data = _interopRequireDefault(require('fast-json-stable-stringify')); - - _fastJsonStableStringify = function () { - return data; - }; - - return data; -} - -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - - fs = function () { - return data; - }; - - return data; -} - -function _pirates() { - const data = require('pirates'); - - _pirates = function () { - return data; - }; - - return data; -} - -function _slash() { - const data = _interopRequireDefault(require('slash')); - - _slash = function () { - return data; - }; - - return data; -} - -function _writeFileAtomic() { - const data = require('write-file-atomic'); - - _writeFileAtomic = function () { - return data; - }; - - return data; -} - -function _jestHasteMap() { - const data = _interopRequireDefault(require('jest-haste-map')); - - _jestHasteMap = function () { - return data; - }; - - return data; -} - -function _jestUtil() { - const data = require('jest-util'); - - _jestUtil = function () { - return data; - }; - - return data; -} - -var _enhanceUnexpectedTokenMessage = _interopRequireDefault( - require('./enhanceUnexpectedTokenMessage') -); - -var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -function _getRequireWildcardCache() { - if (typeof WeakMap !== 'function') return null; - var cache = new WeakMap(); - _getRequireWildcardCache = function () { - return cache; - }; - return cache; -} - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (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; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} - -// Use `require` to avoid TS rootDir -const {version: VERSION} = require('../package.json'); - -// This data structure is used to avoid recalculating some data every time that -// we need to transform a file. Since ScriptTransformer is instantiated for each -// file we need to keep this object in the local scope of this module. -const projectCaches = new Map(); // To reset the cache for specific changesets (rather than package version). - -const CACHE_VERSION = '1'; - -async function waitForPromiseWithCleanup(promise, cleanup) { - try { - await promise; - } finally { - cleanup(); - } -} - -class ScriptTransformer { - constructor(config) { - _defineProperty(this, '_cache', void 0); - - _defineProperty(this, '_config', void 0); - - _defineProperty(this, '_transformCache', void 0); - - _defineProperty(this, '_transformConfigCache', void 0); - - this._config = config; - this._transformCache = new Map(); - this._transformConfigCache = new Map(); - const configString = (0, _fastJsonStableStringify().default)(this._config); - let projectCache = projectCaches.get(configString); - - if (!projectCache) { - projectCache = { - configString, - ignorePatternsRegExp: calcIgnorePatternRegExp(this._config), - transformRegExp: calcTransformRegExp(this._config), - transformedFiles: new Map() - }; - projectCaches.set(configString, projectCache); - } - - this._cache = projectCache; - } - - _getCacheKey( - fileData, - filename, - instrument, - supportsDynamicImport, - supportsStaticESM - ) { - const configString = this._cache.configString; - - const transformer = this._getTransformer(filename); - - if (transformer && typeof transformer.getCacheKey === 'function') { - return (0, _crypto().createHash)('md5') - .update( - transformer.getCacheKey(fileData, filename, configString, { - config: this._config, - instrument, - rootDir: this._config.rootDir, - supportsDynamicImport, - supportsStaticESM - }) - ) - .update(CACHE_VERSION) - .digest('hex'); - } else { - return (0, _crypto().createHash)('md5') - .update(fileData) - .update(configString) - .update(instrument ? 'instrument' : '') - .update(filename) - .update(CACHE_VERSION) - .digest('hex'); - } - } - - _getFileCachePath( - filename, - content, - instrument, - supportsDynamicImport, - supportsStaticESM - ) { - const baseCacheDir = _jestHasteMap().default.getCacheFilePath( - this._config.cacheDirectory, - 'jest-transform-cache-' + this._config.name, - VERSION - ); - - const cacheKey = this._getCacheKey( - content, - filename, - instrument, - supportsDynamicImport, - supportsStaticESM - ); // Create sub folders based on the cacheKey to avoid creating one - // directory with many files. - - const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]); - const cacheFilenamePrefix = path() - .basename(filename, path().extname(filename)) - .replace(/\W/g, ''); - const cachePath = (0, _slash().default)( - path().join(cacheDir, cacheFilenamePrefix + '_' + cacheKey) - ); - (0, _jestUtil().createDirectory)(cacheDir); - return cachePath; - } - - _getTransformPath(filename) { - const transformRegExp = this._cache.transformRegExp; - - if (!transformRegExp) { - return undefined; - } - - for (let i = 0; i < transformRegExp.length; i++) { - if (transformRegExp[i][0].test(filename)) { - const transformPath = transformRegExp[i][1]; - - this._transformConfigCache.set(transformPath, transformRegExp[i][2]); - - return transformPath; - } - } - - return undefined; - } - - _getTransformer(filename) { - if (!this._config.transform || !this._config.transform.length) { - return null; - } - - const transformPath = this._getTransformPath(filename); - - if (!transformPath) { - return null; - } - - const transformer = this._transformCache.get(transformPath); - - if (transformer) { - return transformer; - } - - let transform = require(transformPath); - - if (!transform) { - throw new TypeError('Jest: a transform must export something.'); - } - - const transformerConfig = this._transformConfigCache.get(transformPath); - - if (typeof transform.createTransformer === 'function') { - transform = transform.createTransformer(transformerConfig); - } - - if (typeof transform.process !== 'function') { - throw new TypeError( - 'Jest: a transform must export a `process` function.' - ); - } - - this._transformCache.set(transformPath, transform); - - return transform; - } - - _instrumentFile( - filename, - input, - supportsDynamicImport, - supportsStaticESM, - canMapToInput - ) { - const inputCode = typeof input === 'string' ? input : input.code; - const inputMap = typeof input === 'string' ? null : input.map; - const result = (0, _core().transformSync)(inputCode, { - auxiliaryCommentBefore: ' istanbul ignore next ', - babelrc: false, - caller: { - name: '@jest/transform', - supportsDynamicImport, - supportsStaticESM - }, - configFile: false, - filename, - plugins: [ - [ - _babelPluginIstanbul().default, - { - compact: false, - // files outside `cwd` will not be instrumented - cwd: this._config.rootDir, - exclude: [], - extension: false, - inputSourceMap: inputMap, - useInlineSourceMaps: false - } - ] - ], - sourceMaps: canMapToInput ? 'both' : false - }); - - if (result && result.code) { - return result; - } - - return input; - } // We don't want to expose transformers to the outside - this function is just - // to warm up `this._transformCache` - - preloadTransformer(filepath) { - this._getTransformer(filepath); - } // TODO: replace third argument with TransformOptions in Jest 26 - - transformSource( - filepath, - content, - instrument, - supportsDynamicImport = false, - supportsStaticESM = false - ) { - const filename = (0, _jestUtil().tryRealpath)(filepath); - - const transform = this._getTransformer(filename); - - const cacheFilePath = this._getFileCachePath( - filename, - content, - instrument, - supportsDynamicImport, - supportsStaticESM - ); - - let sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache) - - let code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; - const shouldCallTransform = transform && this.shouldTransform(filename); // That means that the transform has a custom instrumentation - // logic and will handle it based on `config.collectCoverage` option - - const transformWillInstrument = - shouldCallTransform && transform && transform.canInstrument; - - if (code) { - // This is broken: we return the code, and a path for the source map - // directly from the cache. But, nothing ensures the source map actually - // matches that source code. They could have gotten out-of-sync in case - // two separate processes write concurrently to the same cache files. - return { - code, - originalCode: content, - sourceMapPath - }; - } - - let transformed = { - code: content, - map: null - }; - - if (transform && shouldCallTransform) { - const processed = transform.process(content, filename, this._config, { - instrument, - supportsDynamicImport, - supportsStaticESM - }); - - if (typeof processed === 'string') { - transformed.code = processed; - } else if (processed != null && typeof processed.code === 'string') { - transformed = processed; - } else { - throw new TypeError( - "Jest: a transform's `process` function must return a string, " + - 'or an object with `code` key containing this string.' - ); - } - } - - if (!transformed.map) { - try { - //Could be a potential freeze here. - //See: https://github.com/facebook/jest/pull/5177#discussion_r158883570 - const inlineSourceMap = (0, _convertSourceMap().fromSource)( - transformed.code - ); - - if (inlineSourceMap) { - transformed.map = inlineSourceMap.toObject(); - } - } catch { - const transformPath = this._getTransformPath(filename); - - console.warn( - `jest-transform: The source map produced for the file ${filename} ` + - `by ${transformPath} was invalid. Proceeding without source ` + - 'mapping for that file.' - ); - } - } // Apply instrumentation to the code if necessary, keeping the instrumented code and new map - - let map = transformed.map; - - if (!transformWillInstrument && instrument) { - /** - * We can map the original source code to the instrumented code ONLY if - * - the process of transforming the code produced a source map e.g. ts-jest - * - we did not transform the source code - * - * Otherwise we cannot make any statements about how the instrumented code corresponds to the original code, - * and we should NOT emit any source maps - * - */ - const shouldEmitSourceMaps = - (transform != null && map != null) || transform == null; - - const instrumented = this._instrumentFile( - filename, - transformed, - supportsDynamicImport, - supportsStaticESM, - shouldEmitSourceMaps - ); - - code = - typeof instrumented === 'string' ? instrumented : instrumented.code; - map = typeof instrumented === 'string' ? null : instrumented.map; - } else { - code = transformed.code; - } - - if (map) { - const sourceMapContent = - typeof map === 'string' ? map : JSON.stringify(map); - writeCacheFile(sourceMapPath, sourceMapContent); - } else { - sourceMapPath = null; - } - - writeCodeCacheFile(cacheFilePath, code); - return { - code, - originalCode: content, - sourceMapPath - }; - } - - _transformAndBuildScript(filename, options, instrument, fileSource) { - const { - isCoreModule, - isInternalModule, - supportsDynamicImport, - supportsStaticESM - } = options; - const content = stripShebang( - fileSource || fs().readFileSync(filename, 'utf8') - ); - let code = content; - let sourceMapPath = null; - const willTransform = - !isInternalModule && - !isCoreModule && - (this.shouldTransform(filename) || instrument); - - try { - if (willTransform) { - const transformedSource = this.transformSource( - filename, - content, - instrument, - supportsDynamicImport, - supportsStaticESM - ); - code = transformedSource.code; - sourceMapPath = transformedSource.sourceMapPath; - } - - return { - code, - originalCode: content, - sourceMapPath - }; - } catch (e) { - throw (0, _enhanceUnexpectedTokenMessage.default)(e); - } - } - - transform(filename, options, fileSource) { - let scriptCacheKey = undefined; - let instrument = false; - - if (!options.isCoreModule) { - instrument = - options.coverageProvider === 'babel' && - (0, _shouldInstrument.default)(filename, options, this._config); - scriptCacheKey = getScriptCacheKey(filename, instrument); - - const result = this._cache.transformedFiles.get(scriptCacheKey); - - if (result) { - return result; - } - } - - const result = this._transformAndBuildScript( - filename, - options, - instrument, - fileSource - ); - - if (scriptCacheKey) { - this._cache.transformedFiles.set(scriptCacheKey, result); - } - - return result; - } - - transformJson(filename, options, fileSource) { - const { - isCoreModule, - isInternalModule, - supportsDynamicImport, - supportsStaticESM - } = options; - const willTransform = - !isInternalModule && !isCoreModule && this.shouldTransform(filename); - - if (willTransform) { - const {code: transformedJsonSource} = this.transformSource( - filename, - fileSource, - false, - supportsDynamicImport, - supportsStaticESM - ); - return transformedJsonSource; - } - - return fileSource; - } - - requireAndTranspileModule(moduleName, callback) { - // Load the transformer to avoid a cycle where we need to load a - // transformer in order to transform it in the require hooks - this.preloadTransformer(moduleName); - let transforming = false; - const revertHook = (0, _pirates().addHook)( - (code, filename) => { - try { - transforming = true; - return ( - // we might wanna do `supportsDynamicImport` at some point - this.transformSource(filename, code, false, false, false).code || - code - ); - } finally { - transforming = false; - } - }, - { - exts: this._config.moduleFileExtensions.map(ext => `.${ext}`), - ignoreNodeModules: false, - matcher: filename => { - if (transforming) { - // Don't transform any dependency required by the transformer itself - return false; - } - - return this.shouldTransform(filename); - } - } - ); - - const module = require(moduleName); - - if (!callback) { - revertHook(); - return module; - } - - try { - const cbResult = callback(module); - - if ((0, _jestUtil().isPromise)(cbResult)) { - return waitForPromiseWithCleanup(cbResult, revertHook).then( - () => module - ); - } - } finally { - revertHook(); - } - - return module; - } - /** - * @deprecated use `this.shouldTransform` instead - */ - // @ts-expect-error: Unused and private - remove in Jest 25 - - _shouldTransform(filename) { - return this.shouldTransform(filename); - } - - shouldTransform(filename) { - const ignoreRegexp = this._cache.ignorePatternsRegExp; - const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false; - return ( - !!this._config.transform && !!this._config.transform.length && !isIgnored - ); - } -} // TODO: do we need to define the generics twice? - -exports.default = ScriptTransformer; - -function createTranspilingRequire(config) { - const transformer = new ScriptTransformer(config); - return function requireAndTranspileModule( - resolverPath, - applyInteropRequireDefault = false - ) { - const transpiledModule = transformer.requireAndTranspileModule( - resolverPath - ); - return applyInteropRequireDefault - ? (0, _jestUtil().interopRequireDefault)(transpiledModule).default - : transpiledModule; - }; -} - -const removeFile = path => { - try { - fs().unlinkSync(path); - } catch {} -}; - -const stripShebang = content => { - // If the file data starts with a shebang remove it. Leaves the empty line - // to keep stack trace line numbers correct. - if (content.startsWith('#!')) { - return content.replace(/^#!.*/, ''); - } else { - return content; - } -}; -/** - * This is like `writeCacheFile` but with an additional sanity checksum. We - * cannot use the same technique for source maps because we expose source map - * cache file paths directly to callsites, with the expectation they can read - * it right away. This is not a great system, because source map cache file - * could get corrupted, out-of-sync, etc. - */ - -function writeCodeCacheFile(cachePath, code) { - const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); - writeCacheFile(cachePath, checksum + '\n' + code); -} -/** - * Read counterpart of `writeCodeCacheFile`. We verify that the content of the - * file matches the checksum, in case some kind of corruption happened. This - * could happen if an older version of `jest-runtime` writes non-atomically to - * the same cache, for example. - */ - -function readCodeCacheFile(cachePath) { - const content = readCacheFile(cachePath); - - if (content == null) { - return null; - } - - const code = content.substr(33); - const checksum = (0, _crypto().createHash)('md5').update(code).digest('hex'); - - if (checksum === content.substr(0, 32)) { - return code; - } - - return null; -} -/** - * Writing to the cache atomically relies on 'rename' being atomic on most - * file systems. Doing atomic write reduces the risk of corruption by avoiding - * two processes to write to the same file at the same time. It also reduces - * the risk of reading a file that's being overwritten at the same time. - */ - -const writeCacheFile = (cachePath, fileData) => { - try { - (0, _writeFileAtomic().sync)(cachePath, fileData, { - encoding: 'utf8', - fsync: false - }); - } catch (e) { - if (cacheWriteErrorSafeToIgnore(e, cachePath)) { - return; - } - - e.message = - 'jest: failed to cache transform results in: ' + - cachePath + - '\nFailure message: ' + - e.message; - removeFile(cachePath); - throw e; - } -}; -/** - * On Windows, renames are not atomic, leading to EPERM exceptions when two - * processes attempt to rename to the same target file at the same time. - * If the target file exists we can be reasonably sure another process has - * legitimately won a cache write race and ignore the error. - */ - -const cacheWriteErrorSafeToIgnore = (e, cachePath) => - process.platform === 'win32' && - e.code === 'EPERM' && - fs().existsSync(cachePath); - -const readCacheFile = cachePath => { - if (!fs().existsSync(cachePath)) { - return null; - } - - let fileData; - - try { - fileData = fs().readFileSync(cachePath, 'utf8'); - } catch (e) { - e.message = - 'jest: failed to read cache file: ' + - cachePath + - '\nFailure message: ' + - e.message; - removeFile(cachePath); - throw e; - } - - if (fileData == null) { - // We must have somehow created the file but failed to write to it, - // let's delete it and retry. - removeFile(cachePath); - } - - return fileData; -}; - -const getScriptCacheKey = (filename, instrument) => { - const mtime = fs().statSync(filename).mtime; - return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : ''); -}; - -const calcIgnorePatternRegExp = config => { - if ( - !config.transformIgnorePatterns || - config.transformIgnorePatterns.length === 0 - ) { - return undefined; - } - - return new RegExp(config.transformIgnorePatterns.join('|')); -}; - -const calcTransformRegExp = config => { - if (!config.transform.length) { - return undefined; - } - - const transformRegexp = []; - - for (let i = 0; i < config.transform.length; i++) { - transformRegexp.push([ - new RegExp(config.transform[i][0]), - config.transform[i][1], - config.transform[i][2] - ]); - } - - return transformRegexp; -}; diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts deleted file mode 100644 index 7847dc7e92220..0000000000000 --- a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * 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. - */ -interface ErrorWithCodeFrame extends Error { - codeFrame?: string; -} -export default function handlePotentialSyntaxError(e: ErrorWithCodeFrame): ErrorWithCodeFrame; -export declare function enhanceUnexpectedTokenMessage(e: Error): Error; -export {}; diff --git a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js b/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js deleted file mode 100644 index de5714b16e931..0000000000000 --- a/node_modules/@jest/transform/build/enhanceUnexpectedTokenMessage.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = handlePotentialSyntaxError; -exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage; - -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - - _chalk = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(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 DOT = ' \u2022 '; - -function handlePotentialSyntaxError(e) { - if (e.codeFrame) { - e.stack = e.message + '\n' + e.codeFrame; - } - - if ( - // `instanceof` might come from the wrong context - e.name === 'SyntaxError' && - (e.message.includes('Unexpected token') || - e.message.includes('Cannot use import')) && - !e.message.includes(' expected') - ) { - throw enhanceUnexpectedTokenMessage(e); - } - - return e; -} - -function enhanceUnexpectedTokenMessage(e) { - e.stack = - `${_chalk().default.bold.red('Jest encountered an unexpected token')} - -This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. - -By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". - -Here's what you can do: -${DOT}If you are trying to use ECMAScript Modules, see ${_chalk().default.underline( - 'https://jestjs.io/docs/en/ecmascript-modules' - )} for how to enable it. -${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold( - '"transformIgnorePatterns"' - )} in your config. -${DOT}If you need a custom transformation specify a ${_chalk().default.bold( - '"transform"' - )} option in your config. -${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold( - '"moduleNameMapper"' - )} config option. - -You'll find more details and examples of these config options in the docs: -${_chalk().default.cyan('https://jestjs.io/docs/en/configuration.html')} - -${_chalk().default.bold.red('Details:')} - -` + e.stack; - return e; -} diff --git a/node_modules/@jest/transform/build/index.d.ts b/node_modules/@jest/transform/build/index.d.ts deleted file mode 100644 index f5dbb8ac1934c..0000000000000 --- a/node_modules/@jest/transform/build/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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. - */ -export { default as ScriptTransformer, createTranspilingRequire, } from './ScriptTransformer'; -export { default as shouldInstrument } from './shouldInstrument'; -export type { CacheKeyOptions, CallerTransformOptions, Transformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformOptions, TransformResult, TransformedSource, } from './types'; -export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage'; diff --git a/node_modules/@jest/transform/build/index.js b/node_modules/@jest/transform/build/index.js deleted file mode 100644 index b470f3a4544a5..0000000000000 --- a/node_modules/@jest/transform/build/index.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'ScriptTransformer', { - enumerable: true, - get: function () { - return _ScriptTransformer.default; - } -}); -Object.defineProperty(exports, 'createTranspilingRequire', { - enumerable: true, - get: function () { - return _ScriptTransformer.createTranspilingRequire; - } -}); -Object.defineProperty(exports, 'shouldInstrument', { - enumerable: true, - get: function () { - return _shouldInstrument.default; - } -}); -Object.defineProperty(exports, 'handlePotentialSyntaxError', { - enumerable: true, - get: function () { - return _enhanceUnexpectedTokenMessage.default; - } -}); - -var _ScriptTransformer = _interopRequireWildcard( - require('./ScriptTransformer') -); - -var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument')); - -var _enhanceUnexpectedTokenMessage = _interopRequireDefault( - require('./enhanceUnexpectedTokenMessage') -); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -function _getRequireWildcardCache() { - if (typeof WeakMap !== 'function') return null; - var cache = new WeakMap(); - _getRequireWildcardCache = function () { - return cache; - }; - return cache; -} - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (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; -} diff --git a/node_modules/@jest/transform/build/shouldInstrument.d.ts b/node_modules/@jest/transform/build/shouldInstrument.d.ts deleted file mode 100644 index 2b7b617bccb8e..0000000000000 --- a/node_modules/@jest/transform/build/shouldInstrument.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * 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. - */ -import type { Config } from '@jest/types'; -import type { ShouldInstrumentOptions } from './types'; -export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean; diff --git a/node_modules/@jest/transform/build/shouldInstrument.js b/node_modules/@jest/transform/build/shouldInstrument.js deleted file mode 100644 index 88d4eec998d79..0000000000000 --- a/node_modules/@jest/transform/build/shouldInstrument.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = shouldInstrument; - -function path() { - const data = _interopRequireWildcard(require('path')); - - path = function () { - return data; - }; - - return data; -} - -function _micromatch() { - const data = _interopRequireDefault(require('micromatch')); - - _micromatch = function () { - return data; - }; - - return data; -} - -function _jestRegexUtil() { - const data = require('jest-regex-util'); - - _jestRegexUtil = function () { - return data; - }; - - return data; -} - -function _jestUtil() { - const data = require('jest-util'); - - _jestUtil = function () { - return data; - }; - - return data; -} - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -function _getRequireWildcardCache() { - if (typeof WeakMap !== 'function') return null; - var cache = new WeakMap(); - _getRequireWildcardCache = function () { - return cache; - }; - return cache; -} - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (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. - */ -const MOCKS_PATTERN = new RegExp( - (0, _jestRegexUtil().escapePathForRegex)( - path().sep + '__mocks__' + path().sep - ) -); -const cachedRegexes = new Map(); - -const getRegex = regexStr => { - if (!cachedRegexes.has(regexStr)) { - cachedRegexes.set(regexStr, new RegExp(regexStr)); - } - - const regex = cachedRegexes.get(regexStr); // prevent stateful regexes from breaking, just in case - - regex.lastIndex = 0; - return regex; -}; - -function shouldInstrument(filename, options, config) { - if (!options.collectCoverage) { - return false; - } - - if ( - config.forceCoverageMatch.length && - _micromatch().default.any(filename, config.forceCoverageMatch) - ) { - return true; - } - - if ( - !config.testPathIgnorePatterns.some(pattern => - getRegex(pattern).test(filename) - ) - ) { - if (config.testRegex.some(regex => new RegExp(regex).test(filename))) { - return false; - } - - if ( - (0, _jestUtil().globsToMatcher)(config.testMatch)( - (0, _jestUtil().replacePathSepForGlob)(filename) - ) - ) { - return false; - } - } - - if ( - // This configuration field contains an object in the form of: - // {'path/to/file.js': true} - options.collectCoverageOnlyFrom && - !options.collectCoverageOnlyFrom[filename] - ) { - return false; - } - - if ( - // still cover if `only` is specified - !options.collectCoverageOnlyFrom && - options.collectCoverageFrom.length && - !(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)( - (0, _jestUtil().replacePathSepForGlob)( - path().relative(config.rootDir, filename) - ) - ) - ) { - return false; - } - - if ( - config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern)) - ) { - return false; - } - - if (config.globalSetup === filename) { - return false; - } - - if (config.globalTeardown === filename) { - return false; - } - - if (config.setupFiles.includes(filename)) { - return false; - } - - if (config.setupFilesAfterEnv.includes(filename)) { - return false; - } - - if (MOCKS_PATTERN.test(filename)) { - return false; - } - - if (options.changedFiles && !options.changedFiles.has(filename)) { - if (!options.sourcesRelatedToTestsInChangedFiles) { - return false; - } - - if (!options.sourcesRelatedToTestsInChangedFiles.has(filename)) { - return false; - } - } - - return true; -} diff --git a/node_modules/@jest/transform/build/types.d.ts b/node_modules/@jest/transform/build/types.d.ts deleted file mode 100644 index c35e16ac9ec05..0000000000000 --- a/node_modules/@jest/transform/build/types.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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. - */ -import type { RawSourceMap } from 'source-map'; -import type { Config, TransformTypes } from '@jest/types'; -export declare type ShouldInstrumentOptions = Pick & { - changedFiles?: Set; - sourcesRelatedToTestsInChangedFiles?: Set; -}; -export declare type Options = ShouldInstrumentOptions & Partial<{ - isCoreModule: boolean; - isInternalModule: boolean; -}> & CallerTransformOptions; -interface FixedRawSourceMap extends Omit { - version: number; -} -export declare type TransformedSource = { - code: string; - map?: FixedRawSourceMap | string | null; -} | string; -export declare type TransformResult = TransformTypes.TransformResult; -export interface CallerTransformOptions { - supportsDynamicImport?: boolean; - supportsExportNamespaceFrom?: boolean; - supportsStaticESM?: boolean; - supportsTopLevelAwait?: boolean; -} -export interface TransformOptions extends CallerTransformOptions { - instrument: boolean; -} -export interface CacheKeyOptions extends TransformOptions { - config: Config.ProjectConfig; - rootDir: string; -} -export interface Transformer { - canInstrument?: boolean; - createTransformer?: (options?: any) => Transformer; - getCacheKey?: (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string; - process: (sourceText: string, sourcePath: Config.Path, config: Config.ProjectConfig, options?: TransformOptions) => TransformedSource; -} -export {}; diff --git a/node_modules/@jest/transform/build/types.js b/node_modules/@jest/transform/build/types.js deleted file mode 100644 index ad9a93a7c160f..0000000000000 --- a/node_modules/@jest/transform/build/types.js +++ /dev/null @@ -1 +0,0 @@ -'use strict'; diff --git a/node_modules/@jest/transform/package.json b/node_modules/@jest/transform/package.json deleted file mode 100644 index cb3ce7a04f764..0000000000000 --- a/node_modules/@jest/transform/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@jest/transform", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/jest-transform" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^26.6.2", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-util": "^26.6.2", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - }, - "devDependencies": { - "@jest/test-utils": "^26.6.2", - "@types/babel__core": "^7.1.0", - "@types/convert-source-map": "^1.5.1", - "@types/fast-json-stable-stringify": "^2.0.0", - "@types/graceful-fs": "^4.1.2", - "@types/micromatch": "^4.0.0", - "@types/write-file-atomic": "^3.0.0", - "dedent": "^0.7.0", - "jest-snapshot-serializer-raw": "^1.1.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/babel-jest/LICENSE b/node_modules/babel-jest/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/babel-jest/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/babel-jest/README.md b/node_modules/babel-jest/README.md deleted file mode 100644 index 95050196b2a0d..0000000000000 --- a/node_modules/babel-jest/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# babel-jest - -[Babel](https://github.com/babel/babel) [jest](https://github.com/facebook/jest) plugin - -## Usage - -If you are already using `jest-cli`, add `babel-jest` and it will automatically compile JavaScript code using Babel. - -```bash -yarn add --dev babel-jest @babel/core -``` - -If you would like to write your own preprocessor, uninstall and delete babel-jest and set the [config.transform](https://jestjs.io/docs/configuration#transform-object-string-string) option to your preprocessor. - -## Setup - -_Note: this step is only required if you are using `babel-jest` with additional code preprocessors._ - -To explicitly define `babel-jest` as a transformer for your JavaScript code, map _.js_ files to the `babel-jest` module. Typescript files are also supported. - -```json -"transform": { - "\\.[jt]sx?$": "babel-jest" -}, -``` diff --git a/node_modules/babel-jest/build/index.d.ts b/node_modules/babel-jest/build/index.d.ts deleted file mode 100644 index fdf7a44df455d..0000000000000 --- a/node_modules/babel-jest/build/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * 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. - */ -import { TransformOptions } from '@babel/core'; -import type { Transformer } from '@jest/transform'; -interface BabelJestTransformer extends Transformer { - canInstrument: true; -} -declare const transformer: BabelJestTransformer & { - createTransformer: (options?: TransformOptions) => BabelJestTransformer; -}; -export = transformer; diff --git a/node_modules/babel-jest/build/index.js b/node_modules/babel-jest/build/index.js deleted file mode 100644 index e5128de5da34d..0000000000000 --- a/node_modules/babel-jest/build/index.js +++ /dev/null @@ -1,296 +0,0 @@ -'use strict'; - -function _crypto() { - const data = require('crypto'); - - _crypto = function () { - return data; - }; - - return data; -} - -function path() { - const data = _interopRequireWildcard(require('path')); - - path = function () { - return data; - }; - - return data; -} - -function _core() { - const data = require('@babel/core'); - - _core = function () { - return data; - }; - - return data; -} - -function _chalk() { - const data = _interopRequireDefault(require('chalk')); - - _chalk = function () { - return data; - }; - - return data; -} - -function fs() { - const data = _interopRequireWildcard(require('graceful-fs')); - - fs = function () { - return data; - }; - - return data; -} - -function _slash() { - const data = _interopRequireDefault(require('slash')); - - _slash = function () { - return data; - }; - - return data; -} - -var _loadBabelConfig = require('./loadBabelConfig'); - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : {default: obj}; -} - -function _getRequireWildcardCache() { - if (typeof WeakMap !== 'function') return null; - var cache = new WeakMap(); - _getRequireWildcardCache = function () { - return cache; - }; - return cache; -} - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } - if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { - return {default: obj}; - } - var cache = _getRequireWildcardCache(); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = - Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (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. - */ -const THIS_FILE = fs().readFileSync(__filename); - -const jestPresetPath = require.resolve('babel-preset-jest'); - -const babelIstanbulPlugin = require.resolve('babel-plugin-istanbul'); // Narrow down the types - -const createTransformer = userOptions => { - var _inputOptions$plugins, _inputOptions$presets; - - const inputOptions = - userOptions !== null && userOptions !== void 0 ? userOptions : {}; - const options = { - ...inputOptions, - caller: { - name: 'babel-jest', - supportsDynamicImport: false, - supportsExportNamespaceFrom: false, - supportsStaticESM: false, - supportsTopLevelAwait: false, - ...inputOptions.caller - }, - compact: false, - plugins: - (_inputOptions$plugins = inputOptions.plugins) !== null && - _inputOptions$plugins !== void 0 - ? _inputOptions$plugins - : [], - presets: ((_inputOptions$presets = inputOptions.presets) !== null && - _inputOptions$presets !== void 0 - ? _inputOptions$presets - : [] - ).concat(jestPresetPath), - sourceMaps: 'both' - }; - - function loadBabelConfig(cwd, filename, transformOptions) { - var _transformOptions$sup, - _transformOptions$sup2, - _transformOptions$sup3, - _transformOptions$sup4; - - // `cwd` first to allow incoming options to override it - const babelConfig = (0, _loadBabelConfig.loadPartialConfig)({ - cwd, - ...options, - caller: { - ...options.caller, - supportsDynamicImport: - (_transformOptions$sup = - transformOptions === null || transformOptions === void 0 - ? void 0 - : transformOptions.supportsDynamicImport) !== null && - _transformOptions$sup !== void 0 - ? _transformOptions$sup - : options.caller.supportsDynamicImport, - supportsExportNamespaceFrom: - (_transformOptions$sup2 = - transformOptions === null || transformOptions === void 0 - ? void 0 - : transformOptions.supportsExportNamespaceFrom) !== null && - _transformOptions$sup2 !== void 0 - ? _transformOptions$sup2 - : options.caller.supportsExportNamespaceFrom, - supportsStaticESM: - (_transformOptions$sup3 = - transformOptions === null || transformOptions === void 0 - ? void 0 - : transformOptions.supportsStaticESM) !== null && - _transformOptions$sup3 !== void 0 - ? _transformOptions$sup3 - : options.caller.supportsStaticESM, - supportsTopLevelAwait: - (_transformOptions$sup4 = - transformOptions === null || transformOptions === void 0 - ? void 0 - : transformOptions.supportsTopLevelAwait) !== null && - _transformOptions$sup4 !== void 0 - ? _transformOptions$sup4 - : options.caller.supportsTopLevelAwait - }, - filename - }); - - if (!babelConfig) { - throw new Error( - `babel-jest: Babel ignores ${_chalk().default.bold( - (0, _slash().default)(path().relative(cwd, filename)) - )} - make sure to include the file in Jest's ${_chalk().default.bold( - 'transformIgnorePatterns' - )} as well.` - ); - } - - return babelConfig; - } - - return { - canInstrument: true, - - getCacheKey(fileData, filename, configString, cacheKeyOptions) { - const {config, instrument, rootDir} = cacheKeyOptions; - const babelOptions = loadBabelConfig( - config.cwd, - filename, - cacheKeyOptions - ); - const configPath = [ - babelOptions.config || '', - babelOptions.babelrc || '' - ]; - return (0, _crypto().createHash)('md5') - .update(THIS_FILE) - .update('\0', 'utf8') - .update(JSON.stringify(babelOptions.options)) - .update('\0', 'utf8') - .update(fileData) - .update('\0', 'utf8') - .update(path().relative(rootDir, filename)) - .update('\0', 'utf8') - .update(configString) - .update('\0', 'utf8') - .update(configPath.join('')) - .update('\0', 'utf8') - .update(instrument ? 'instrument' : '') - .update('\0', 'utf8') - .update(process.env.NODE_ENV || '') - .update('\0', 'utf8') - .update(process.env.BABEL_ENV || '') - .digest('hex'); - }, - - process(src, filename, config, transformOptions) { - const babelOptions = { - ...loadBabelConfig(config.cwd, filename, transformOptions).options - }; - - if ( - transformOptions === null || transformOptions === void 0 - ? void 0 - : transformOptions.instrument - ) { - babelOptions.auxiliaryCommentBefore = ' istanbul ignore next '; // Copied from jest-runtime transform.js - - babelOptions.plugins = (babelOptions.plugins || []).concat([ - [ - babelIstanbulPlugin, - { - // files outside `cwd` will not be instrumented - cwd: config.rootDir, - exclude: [] - } - ] - ]); - } - - const transformResult = (0, _core().transformSync)(src, babelOptions); - - if (transformResult) { - const {code, map} = transformResult; - - if (typeof code === 'string') { - return { - code, - map - }; - } - } - - return src; - } - }; -}; - -const transformer = { - ...createTransformer(), - // Assigned here so only the exported transformer has `createTransformer`, - // instead of all created transformers by the function - createTransformer -}; -module.exports = transformer; diff --git a/node_modules/babel-jest/build/loadBabelConfig.d.ts b/node_modules/babel-jest/build/loadBabelConfig.d.ts deleted file mode 100644 index 7e667b29ded65..0000000000000 --- a/node_modules/babel-jest/build/loadBabelConfig.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * 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. - */ -export { loadPartialConfig } from '@babel/core'; diff --git a/node_modules/babel-jest/build/loadBabelConfig.js b/node_modules/babel-jest/build/loadBabelConfig.js deleted file mode 100644 index f91dea5dbbd04..0000000000000 --- a/node_modules/babel-jest/build/loadBabelConfig.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -Object.defineProperty(exports, 'loadPartialConfig', { - enumerable: true, - get: function () { - return _core().loadPartialConfig; - } -}); - -function _core() { - const data = require('@babel/core'); - - _core = function () { - return data; - }; - - return data; -} diff --git a/node_modules/babel-jest/package.json b/node_modules/babel-jest/package.json deleted file mode 100644 index 3d4be11ee628d..0000000000000 --- a/node_modules/babel-jest/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "babel-jest", - "description": "Jest plugin to use babel for transformation.", - "version": "26.6.3", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/babel-jest" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/babel__core": "^7.1.7", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^26.6.2", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "slash": "^3.0.0" - }, - "devDependencies": { - "@babel/core": "^7.1.0", - "@jest/test-utils": "^26.6.2", - "@types/graceful-fs": "^4.1.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "2f6931e91d5ab126de70caf150c68709752e7f6c" -} diff --git a/node_modules/babel-plugin-jest-hoist/LICENSE b/node_modules/babel-plugin-jest-hoist/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/babel-plugin-jest-hoist/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/babel-plugin-jest-hoist/README.md b/node_modules/babel-plugin-jest-hoist/README.md deleted file mode 100644 index 15c1b181d7d6f..0000000000000 --- a/node_modules/babel-plugin-jest-hoist/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# babel-plugin-jest-hoist - -Babel plugin to hoist `jest.disableAutomock`, `jest.enableAutomock`, `jest.unmock`, `jest.mock`, calls above `import` statements. This plugin is automatically included when using [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest). - -## Installation - -```sh -$ yarn add --dev babel-plugin-jest-hoist -``` - -## Usage - -### Via `babel.config.js` (Recommended) - -```js -module.exports = { - plugins: ['jest-hoist'], -}; -``` - -### Via CLI - -```sh -$ babel --plugins jest-hoist script.js -``` - -### Via Node API - -```javascript -require('@babel/core').transform('code', { - plugins: ['jest-hoist'], -}); -``` diff --git a/node_modules/babel-plugin-jest-hoist/build/index.d.ts b/node_modules/babel-plugin-jest-hoist/build/index.d.ts deleted file mode 100644 index 00614182c3b20..0000000000000 --- a/node_modules/babel-plugin-jest-hoist/build/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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. - * - */ -import type { PluginObj } from '@babel/core'; -import { Identifier } from '@babel/types'; -declare const _default: () => PluginObj<{ - declareJestObjGetterIdentifier: () => Identifier; - jestObjGetterIdentifier?: Identifier; -}>; -export default _default; diff --git a/node_modules/babel-plugin-jest-hoist/build/index.js b/node_modules/babel-plugin-jest-hoist/build/index.js deleted file mode 100644 index 927c20eae76cd..0000000000000 --- a/node_modules/babel-plugin-jest-hoist/build/index.js +++ /dev/null @@ -1,387 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { - value: true -}); -exports.default = void 0; - -function _template() { - const data = require('@babel/template'); - - _template = function () { - return data; - }; - - return data; -} - -function _types() { - const data = require('@babel/types'); - - _types = function () { - return data; - }; - - return data; -} - -/** - * 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 JEST_GLOBAL_NAME = 'jest'; -const JEST_GLOBALS_MODULE_NAME = '@jest/globals'; -const JEST_GLOBALS_MODULE_JEST_EXPORT_NAME = 'jest'; -const hoistedVariables = new WeakSet(); // We allow `jest`, `expect`, `require`, all default Node.js globals and all -// ES2015 built-ins to be used inside of a `jest.mock` factory. -// We also allow variables prefixed with `mock` as an escape-hatch. - -const ALLOWED_IDENTIFIERS = new Set( - [ - 'Array', - 'ArrayBuffer', - 'Boolean', - 'BigInt', - 'DataView', - 'Date', - 'Error', - 'EvalError', - 'Float32Array', - 'Float64Array', - 'Function', - 'Generator', - 'GeneratorFunction', - 'Infinity', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'InternalError', - 'Intl', - 'JSON', - 'Map', - 'Math', - 'NaN', - 'Number', - 'Object', - 'Promise', - 'Proxy', - 'RangeError', - 'ReferenceError', - 'Reflect', - 'RegExp', - 'Set', - 'String', - 'Symbol', - 'SyntaxError', - 'TypeError', - 'URIError', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'WeakMap', - 'WeakSet', - 'arguments', - 'console', - 'expect', - 'isNaN', - 'jest', - 'parseFloat', - 'parseInt', - 'require', - 'undefined', - ...Object.getOwnPropertyNames(global) - ].sort() -); -const IDVisitor = { - ReferencedIdentifier(path, {ids}) { - ids.add(path); - }, - - blacklist: ['TypeAnnotation', 'TSTypeAnnotation', 'TSTypeReference'] -}; -const FUNCTIONS = Object.create(null); - -FUNCTIONS.mock = args => { - if (args.length === 1) { - return args[0].isStringLiteral() || args[0].isLiteral(); - } else if (args.length === 2 || args.length === 3) { - const moduleFactory = args[1]; - - if (!moduleFactory.isFunction()) { - throw moduleFactory.buildCodeFrameError( - 'The second argument of `jest.mock` must be an inline function.\n', - TypeError - ); - } - - const ids = new Set(); - const parentScope = moduleFactory.parentPath.scope; // @ts-expect-error: ReferencedIdentifier and blacklist are not known on visitors - - moduleFactory.traverse(IDVisitor, { - ids - }); - - for (const id of ids) { - const {name} = id.node; - let found = false; - let scope = id.scope; - - while (scope !== parentScope) { - if (scope.bindings[name]) { - found = true; - break; - } - - scope = scope.parent; - } - - if (!found) { - let isAllowedIdentifier = - (scope.hasGlobal(name) && ALLOWED_IDENTIFIERS.has(name)) || - /^mock/i.test(name) || // Allow istanbul's coverage variable to pass. - /^(?:__)?cov/.test(name); - - if (!isAllowedIdentifier) { - const binding = scope.bindings[name]; - - if ( - binding === null || binding === void 0 - ? void 0 - : binding.path.isVariableDeclarator() - ) { - const {node} = binding.path; - const initNode = node.init; - - if (initNode && binding.constant && scope.isPure(initNode, true)) { - hoistedVariables.add(node); - isAllowedIdentifier = true; - } - } - } - - if (!isAllowedIdentifier) { - throw id.buildCodeFrameError( - 'The module factory of `jest.mock()` is not allowed to ' + - 'reference any out-of-scope variables.\n' + - 'Invalid variable access: ' + - name + - '\n' + - 'Allowed objects: ' + - Array.from(ALLOWED_IDENTIFIERS).join(', ') + - '.\n' + - 'Note: This is a precaution to guard against uninitialized mock ' + - 'variables. If it is ensured that the mock is required lazily, ' + - 'variable names prefixed with `mock` (case insensitive) are permitted.\n', - ReferenceError - ); - } - } - } - - return true; - } - - return false; -}; - -FUNCTIONS.unmock = args => args.length === 1 && args[0].isStringLiteral(); - -FUNCTIONS.deepUnmock = args => args.length === 1 && args[0].isStringLiteral(); - -FUNCTIONS.disableAutomock = FUNCTIONS.enableAutomock = args => - args.length === 0; - -const createJestObjectGetter = (0, _template().statement)` -function GETTER_NAME() { - const { JEST_GLOBALS_MODULE_JEST_EXPORT_NAME } = require("JEST_GLOBALS_MODULE_NAME"); - GETTER_NAME = () => JEST_GLOBALS_MODULE_JEST_EXPORT_NAME; - return JEST_GLOBALS_MODULE_JEST_EXPORT_NAME; -} -`; - -const isJestObject = expression => { - // global - if ( - expression.isIdentifier() && - expression.node.name === JEST_GLOBAL_NAME && - !expression.scope.hasBinding(JEST_GLOBAL_NAME) - ) { - return true; - } // import { jest } from '@jest/globals' - - if ( - expression.referencesImport( - JEST_GLOBALS_MODULE_NAME, - JEST_GLOBALS_MODULE_JEST_EXPORT_NAME - ) - ) { - return true; - } // import * as JestGlobals from '@jest/globals' - - if ( - expression.isMemberExpression() && - !expression.node.computed && - expression.get('object').referencesImport(JEST_GLOBALS_MODULE_NAME, '*') && - expression.node.property.type === 'Identifier' && - expression.node.property.name === JEST_GLOBALS_MODULE_JEST_EXPORT_NAME - ) { - return true; - } - - return false; -}; - -const extractJestObjExprIfHoistable = expr => { - var _FUNCTIONS$propertyNa; - - if (!expr.isCallExpression()) { - return null; - } - - const callee = expr.get('callee'); - const args = expr.get('arguments'); - - if (!callee.isMemberExpression() || callee.node.computed) { - return null; - } - - const object = callee.get('object'); - const property = callee.get('property'); - const propertyName = property.node.name; - const jestObjExpr = isJestObject(object) - ? object // The Jest object could be returned from another call since the functions are all chainable. - : extractJestObjExprIfHoistable(object); - - if (!jestObjExpr) { - return null; - } // Important: Call the function check last - // It might throw an error to display to the user, - // which should only happen if we're already sure it's a call on the Jest object. - - const functionLooksHoistable = - (_FUNCTIONS$propertyNa = FUNCTIONS[propertyName]) === null || - _FUNCTIONS$propertyNa === void 0 - ? void 0 - : _FUNCTIONS$propertyNa.call(FUNCTIONS, args); - return functionLooksHoistable ? jestObjExpr : null; -}; -/* eslint-disable sort-keys */ - -var _default = () => ({ - pre({path: program}) { - this.declareJestObjGetterIdentifier = () => { - if (this.jestObjGetterIdentifier) { - return this.jestObjGetterIdentifier; - } - - this.jestObjGetterIdentifier = program.scope.generateUidIdentifier( - 'getJestObj' - ); - program.unshiftContainer('body', [ - createJestObjectGetter({ - GETTER_NAME: this.jestObjGetterIdentifier.name, - JEST_GLOBALS_MODULE_JEST_EXPORT_NAME, - JEST_GLOBALS_MODULE_NAME - }) - ]); - return this.jestObjGetterIdentifier; - }; - }, - - visitor: { - ExpressionStatement(exprStmt) { - const jestObjExpr = extractJestObjExprIfHoistable( - exprStmt.get('expression') - ); - - if (jestObjExpr) { - jestObjExpr.replaceWith( - (0, _types().callExpression)( - this.declareJestObjGetterIdentifier(), - [] - ) - ); - } - } - }, - - // in `post` to make sure we come after an import transform and can unshift above the `require`s - post({path: program}) { - const self = this; - visitBlock(program); - program.traverse({ - BlockStatement: visitBlock - }); - - function visitBlock(block) { - // use a temporary empty statement instead of the real first statement, which may itself be hoisted - const [varsHoistPoint, callsHoistPoint] = block.unshiftContainer('body', [ - (0, _types().emptyStatement)(), - (0, _types().emptyStatement)() - ]); - block.traverse({ - CallExpression: visitCallExpr, - VariableDeclarator: visitVariableDeclarator, - // do not traverse into nested blocks, or we'll hoist calls in there out to this block - // @ts-expect-error blacklist is not known - blacklist: ['BlockStatement'] - }); - callsHoistPoint.remove(); - varsHoistPoint.remove(); - - function visitCallExpr(callExpr) { - var _self$jestObjGetterId; - - const { - node: {callee} - } = callExpr; - - if ( - (0, _types().isIdentifier)(callee) && - callee.name === - ((_self$jestObjGetterId = self.jestObjGetterIdentifier) === null || - _self$jestObjGetterId === void 0 - ? void 0 - : _self$jestObjGetterId.name) - ) { - const mockStmt = callExpr.getStatementParent(); - - if (mockStmt) { - const mockStmtParent = mockStmt.parentPath; - - if (mockStmtParent.isBlock()) { - const mockStmtNode = mockStmt.node; - mockStmt.remove(); - callsHoistPoint.insertBefore(mockStmtNode); - } - } - } - } - - function visitVariableDeclarator(varDecl) { - if (hoistedVariables.has(varDecl.node)) { - // should be assert function, but it's not. So let's cast below - varDecl.parentPath.assertVariableDeclaration(); - const {kind, declarations} = varDecl.parent; - - if (declarations.length === 1) { - varDecl.parentPath.remove(); - } else { - varDecl.remove(); - } - - varsHoistPoint.insertBefore( - (0, _types().variableDeclaration)(kind, [varDecl.node]) - ); - } - } - } - } -}); -/* eslint-enable */ - -exports.default = _default; diff --git a/node_modules/babel-plugin-jest-hoist/package.json b/node_modules/babel-plugin-jest-hoist/package.json deleted file mode 100644 index e4e6cc81c6f95..0000000000000 --- a/node_modules/babel-plugin-jest-hoist/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "babel-plugin-jest-hoist", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/babel-plugin-jest-hoist" - }, - "engines": { - "node": ">= 10.14.2" - }, - "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.0.0", - "@types/babel__traverse": "^7.0.6" - }, - "devDependencies": { - "@babel/core": "^7.11.6", - "@babel/preset-react": "^7.12.1", - "@types/babel__template": "^7.0.2", - "@types/node": "*", - "@types/prettier": "^2.0.0", - "babel-plugin-tester": "^10.0.0", - "prettier": "^2.1.1" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/babel-preset-jest/LICENSE b/node_modules/babel-preset-jest/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/babel-preset-jest/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/babel-preset-jest/README.md b/node_modules/babel-preset-jest/README.md deleted file mode 100644 index b0f085f6abde8..0000000000000 --- a/node_modules/babel-preset-jest/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# babel-preset-jest - -> Babel preset for all Jest plugins. This preset is automatically included when using [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest). - -## Install - -```sh -$ npm install --save-dev babel-preset-jest -``` - -## Usage - -### Via `babel.config.js` (Recommended) - -```js -module.exports = { - presets: ['jest'], -}; -``` - -### Via CLI - -```sh -$ babel script.js --presets jest -``` - -### Via Node API - -```javascript -require('@babel/core').transform('code', { - presets: ['jest'], -}); -``` diff --git a/node_modules/babel-preset-jest/index.js b/node_modules/babel-preset-jest/index.js deleted file mode 100644 index 911bbf8d9930b..0000000000000 --- a/node_modules/babel-preset-jest/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 jestPreset = { - plugins: [require.resolve('babel-plugin-jest-hoist')], - presets: [require.resolve('babel-preset-current-node-syntax')], -}; - -// @babel/core requires us to export a function -module.exports = () => jestPreset; diff --git a/node_modules/babel-preset-jest/package.json b/node_modules/babel-preset-jest/package.json deleted file mode 100644 index bc9288770ba06..0000000000000 --- a/node_modules/babel-preset-jest/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "babel-preset-jest", - "version": "26.6.2", - "repository": { - "type": "git", - "url": "https://github.com/facebook/jest.git", - "directory": "packages/babel-preset-jest" - }, - "license": "MIT", - "main": "index.js", - "dependencies": { - "babel-plugin-jest-hoist": "^26.6.2", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4c46930615602cbf983fb7e8e82884c282a624d5" -} diff --git a/node_modules/camelcase/index.d.ts b/node_modules/camelcase/index.d.ts deleted file mode 100644 index 51d2ba2d857bf..0000000000000 --- a/node_modules/camelcase/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -declare namespace camelcase { - interface Options { - /** - Uppercase the first character: `foo-bar` → `FooBar`. - - @default false - */ - readonly pascalCase?: boolean; - } -} - -/** -Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. - -Correctly handles Unicode strings. - -@param input - String to convert to camel case. - -@example -``` -import camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('розовый_пушистый_единороги'); -//=> 'розовыйПушистыйЕдинороги' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` -*/ -declare function camelcase( - input: string | readonly string[], - options?: camelcase.Options -): string; - -export = camelcase; diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js deleted file mode 100644 index dd2c490e920a8..0000000000000 --- a/node_modules/camelcase/index.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[\p{Lu}]/u.test(character)) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; - } - } - - return string; -}; - -const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = { - ...{pascalCase: false}, - ...options - }; - - const postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; - - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } - - if (input.length === 0) { - return ''; - } - - if (input.length === 1) { - return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); - } - - const hasUpperCase = input !== input.toLocaleLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } - - input = input - .replace(/^[_.\- ]+/, '') - .toLocaleLowerCase() - .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase()) - .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase()); - - return postProcess(input); -}; - -module.exports = camelCase; -// TODO: Remove this for the next major release -module.exports.default = camelCase; diff --git a/node_modules/camelcase/license b/node_modules/camelcase/license deleted file mode 100644 index fa7ceba3eb4a9..0000000000000 --- a/node_modules/camelcase/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json deleted file mode 100644 index 4243d38decc46..0000000000000 --- a/node_modules/camelcase/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "camelcase", - "version": "6.0.0", - "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", - "license": "MIT", - "repository": "sindresorhus/camelcase", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "camelcase", - "camel-case", - "camel", - "case", - "dash", - "hyphen", - "dot", - "underscore", - "separator", - "string", - "text", - "convert", - "pascalcase", - "pascal-case" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.11.0", - "xo": "^0.28.3" - } -} diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md deleted file mode 100644 index 72529052c8e04..0000000000000 --- a/node_modules/camelcase/readme.md +++ /dev/null @@ -1,83 +0,0 @@ -# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - -Correctly handles Unicode strings. - -## Install - -``` -$ npm install camelcase -``` - -## Usage - -```js -const camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('розовый_пушистый_единороги'); -//=> 'розовыйПушистыйЕдинороги' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` - -## API - -### camelCase(input, options?) - -#### input - -Type: `string | string[]` - -String to convert to camel case. - -#### options - -Type: `object` - -##### pascalCase - -Type: `boolean`\ -Default: `false` - -Uppercase the first character: `foo-bar` → `FooBar` - -## camelcase for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of camelcase and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - -## Related - -- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module -- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase -- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string -- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one diff --git a/node_modules/cjs-module-lexer/CHANGELOG.md b/node_modules/cjs-module-lexer/CHANGELOG.md deleted file mode 100644 index 218514040825d..0000000000000 --- a/node_modules/cjs-module-lexer/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -0.6.0 -- API-only breaking change: Unify JS and Wasm interfaces (https://github.com/guybedford/cjs-module-lexer/pull/27) -- Add type definitions (https://github.com/guybedford/cjs-module-lexer/pull/28) - -0.5.2 -- Support named getter functions (https://github.com/guybedford/cjs-module-lexer/pull/26) - -0.5.1: -- Feature: Implement specific reexport getter forms (https://github.com/guybedford/cjs-module-lexer/pull/25) - -0.5.0 -- Breaking Change: No longer emit Object.defineProperty exports (https://github.com/guybedford/cjs-module-lexer/pull/24) -- Doc: Update link to WASI SDK (https://github.com/guybedford/cjs-module-lexer/pull/19) - -0.4.3 -- Support for Babel 7.12 reexports (https://github.com/guybedford/cjs-module-lexer/pull/16) -- Support module.exports = { ...require('x') } reexports (https://github.com/guybedford/cjs-module-lexer/pull/18) -- "if" keyword space parsing in exports matching (https://github.com/guybedford/cjs-module-lexer/pull/17) diff --git a/node_modules/cjs-module-lexer/LICENSE b/node_modules/cjs-module-lexer/LICENSE deleted file mode 100755 index 935b357962d08..0000000000000 --- a/node_modules/cjs-module-lexer/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -MIT License ------------ - -Copyright (C) 2018-2020 Guy Bedford - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cjs-module-lexer/README.md b/node_modules/cjs-module-lexer/README.md deleted file mode 100755 index ce754fcc235d8..0000000000000 --- a/node_modules/cjs-module-lexer/README.md +++ /dev/null @@ -1,418 +0,0 @@ -# CJS Module Lexer - -[![Build Status][travis-image]][travis-url] - -A [very fast](#benchmarks) JS CommonJS module syntax lexer used to detect the most likely list of named exports of a CommonJS module. - -Outputs the list of named exports (`exports.name = ...`) and possible module reexports (`module.exports = require('...')`), including the common transpiler variations of these cases. - -Forked from https://github.com/guybedford/es-module-lexer. - -_Comprehensively handles the JS language grammar while remaining small and fast. - ~90ms per MB of JS cold and ~15ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._ - -### Usage - -``` -npm install cjs-module-lexer -``` - -For use in CommonJS: - -```js -const { parse } = require('cjs-module-lexer'); - -// `init` return a promise for parity with the ESM API, but you do not have to call it - -const { exports, reexports } = parse(` - // named exports detection - module.exports.a = 'a'; - (function () { - exports.b = 'b'; - })(); - Object.defineProperty(exports, 'c', { value: 'c' }); - /* exports.d = 'not detected'; */ - - // reexports detection - if (maybe) module.exports = require('./dep1.js'); - if (another) module.exports = require('./dep2.js'); - - // literal exports assignments - module.exports = { a, b: c, d, 'e': f } - - // __esModule detection - Object.defineProperty(module.exports, '__esModule', { value: true }) -`); - -// exports === ['a', 'b', 'c', '__esModule'] -// reexports === ['./dep1.js', './dep2.js'] -``` - -When using the ESM version, Wasm is supported instead: - -```js -import { parse, init } from 'cjs-module-lexer'; -// init needs to be called and waited upon -await init(); -const { exports, reexports } = parse(source); -``` - -The Wasm build is around 1.5x faster and without a cold start. - -### Grammar - -CommonJS exports matches are run against the source token stream. - -The token grammar is: - -``` -IDENTIFIER: As defined by ECMA-262, without support for identifier `\` escapes, filtered to remove strict reserved words: - "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "enum" - -STRING_LITERAL: A `"` or `'` bounded ECMA-262 string literal. - -IDENTIFIER_STRING: ( `"` IDENTIFIER `"` | `'` IDENTIFIER `'` ) - -MODULE_EXPORTS: `module` `.` `exports` - -EXPORTS_IDENTIFIER: MODULE_EXPORTS_IDENTIFIER | `exports` - -EXPORTS_DOT_ASSIGN: EXPORTS_IDENTIFIER `.` IDENTIFIER `=` - -EXPORTS_LITERAL_COMPUTED_ASSIGN: EXPORTS_IDENTIFIER `[` IDENTIFIER_STRING `]` `=` - -EXPORTS_LITERAL_PROP: (IDENTIFIER `:` IDENTIFIER)?) | (IDENTIFIER_STRING `:` IDENTIFIER) - -EXPORTS_SPREAD: `...` (IDENTIFIER | REQUIRE) - -EXPORTS_MEMBER: EXPORTS_DOT_ASSIGN | EXPORTS_LITERAL_COMPUTED_ASSIGN - -EXPORTS_DEFINE: `Object` `.` `defineProperty `(` IDENTIFIER_STRING `, {` - (`enumerable: true,`)? - ( - `value:` | - `get` (`: function` IDENTIFIER? )? `()` {` return IDENTIFIER (`.` IDENTIFIER | `[` IDENTIFIER_STRING `]`)? `;`? `}` - ) - `})` - -EXPORTS_LITERAL: MODULE_EXPORTS `=` `{` (EXPORTS_LITERAL_PROP | EXPORTS_SPREAD) `,`)+ `}` - -REQUIRE: `require` `(` STRING_LITERAL `)` - -EXPORTS_ASSIGN: (`var` | `const` | `let`) IDENTIFIER `=` REQUIRE - -MODULE_EXPORTS_ASSIGN: MODULE_EXPORTS `=` REQUIRE - -EXPORT_STAR: (`__export` | `__exportStar`) `(` REQUIRE - -EXPORT_STAR_LIB: `Object.keys(` IDENTIFIER$1 `).forEach(function (` IDENTIFIER$2 `) {` - ( - `if (` IDENTIFIER$2 `===` ( `'default'` | `"default"` ) `||` IDENTIFIER$2 `===` ( '__esModule' | `"__esModule"` ) `) return` `;`? | - `if (` IDENTIFIER$2 `!==` ( `'default'` | `"default"` ) `)` - ) - ( - `if (` IDENTIFIER$2 `in` EXPORTS_IDENTIFIER `&&` EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] ===` IDENTIFIER$1 `[` IDENTIFIER$2 `]) return` `;`? - )? - ( - EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] =` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? | - `Object.defineProperty(` EXPORTS_IDENTIFIER `, ` IDENTIFIER$2 `, { enumerable: true, get: function () { return ` IDENTIFIER$1 `[` IDENTIFIER$2 `]` `;`? } })` `;`? - ) - `})` -``` - -Spacing between tokens is taken to be any ECMA-262 whitespace, ECMA-262 block comment or ECMA-262 line comment. - -* The returned export names are taken to be the combination of the `IDENTIFIER` and `IDENTIFIER_STRING` slots for all `EXPORTS_MEMBER`, `EXPORTS_LITERAL` and `EXPORTS_DEFINE` matches. -* The reexport specifiers are taken to be the the combination of: - 1. The `REQUIRE` matches of the last matched of either `MODULE_EXPORTS_ASSIGN` or `EXPORTS_LITERAL`. - 2. All _top-level_ `EXPORT_STAR` `REQUIRE` matches and `EXPORTS_ASSIGN` matches whose `IDENTIFIER` also matches the first `IDENTIFIER` in `EXPORT_STAR_LIB`. - -### Parsing Examples - -#### Named Exports Parsing - -The basic matching rules for named exports are `exports.name`, `exports['name']` or `Object.defineProperty(exports, 'name', ...)`. This matching is done without scope analysis and regardless of the expression position: - -```js -// DETECTS EXPORTS: a, b -(function (exports) { - exports.a = 'a'; - exports['b'] = 'b'; -})(exports); -``` - -Because there is no scope analysis, the above detection may overclassify: - -```js -// DETECTS EXPORTS: a, b, c -(function (exports, Object) { - exports.a = 'a'; - exports['b'] = 'b'; - if (false) - exports.c = 'c'; -})(NOT_EXPORTS, NOT_OBJECT); -``` - -It will in turn underclassify in cases where the identifiers are renamed: - -```js -// DETECTS: NO EXPORTS -(function (e) { - e.a = 'a'; - e['b'] = 'b'; -})(exports); -``` - -`Object.defineProperty` is detected for specifically value and getter forms returning an identifier or member expression: - -```js -// DETECTS: a, b, c, d, __esModule -Object.defineProperty(exports, 'a', { - enumerable: true, - get: function () { - return q.p; - } -}); -Object.defineProperty(exports, 'b', { - enumerable: true, - get: function () { - return q['p']; - } -}); -Object.defineProperty(exports, 'c', { - enumerable: true, - get () { - return b; - } -}); -Object.defineProperty(exports, 'd', { value: 'd' }); -Object.defineProperty(exports, '__esModule', { value: true }); -``` - -Alternative object definition structures or getter function bodies are not detected: - -```js -// DETECTS: NO EXPORTS -Object.defineProperty(exports, 'a', { - enumerable: false, - get () { - return p; - } -}); -Object.defineProperty(exports, 'b', { - configurable: true, - get () { - return p; - } -}); -Object.defineProperty(exports, 'c', { - get: () => p -}); -Object.defineProperty(exports, 'd', { - enumerable: true, - get: function () { - return dynamic(); - } -}); -Object.defineProperty(exports, 'e', { - enumerable: true, - get () { - return 'str'; - } -}); -``` - -`Object.defineProperties` is also not supported. - -#### Exports Object Assignment - -A best-effort is made to detect `module.exports` object assignments, but because this is not a full parser, arbitrary expressions are not handled in the -object parsing process. - -Simple object definitions are supported: - -```js -// DETECTS EXPORTS: a, b, c -module.exports = { - a, - 'b': b, - c: c, - ...d -}; -``` - -Object properties that are not identifiers or string expressions will bail out of the object detection, while spreads are ignored: - -```js -// DETECTS EXPORTS: a, b -module.exports = { - a, - ...d, - b: require('c'), - c: "not detected since require('c') above bails the object detection" -} -``` - -`Object.defineProperties` is not currently supported either. - -#### module.exports reexport assignment - -Any `module.exports = require('mod')` assignment is detected as a reexport, but only the last one is returned: - -```js -// DETECTS REEXPORTS: c -module.exports = require('a'); -(module => module.exports = require('b'))(NOT_MODULE); -if (false) module.exports = require('c'); -``` - -This is to avoid over-classification in Webpack bundles with externals which include `module.exports = require('external')` in their source for every external dependency. - -In exports object assignment, any spread of `require()` are detected as multiple separate reexports: - -```js -// DETECTS REEXPORTS: a, b -module.exports = require('ignored'); -module.exports = { - ...require('a'), - ...require('b') -}; -``` - -#### Transpiler Re-exports - -For named exports, transpiler output works well with the rules described above. - -But for star re-exports, special care is taken to support common patterns of transpiler outputs from Babel and TypeScript as well as bundlers like RollupJS. -These reexport and star reexport patterns are restricted to only be detected at the top-level as provided by the direct output of these tools. - -For example, `export * from 'external'` is output by Babel as: - -```js -"use strict"; - -exports.__esModule = true; - -var _external = require("external"); - -Object.keys(_external).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - exports[key] = _external[key]; -}); -``` - -Where the `var _external = require("external")` is specifically detected as well as the `Object.keys(_external)` statement, down to the exact -for of that entire expression including minor variations of the output. The `_external` and `key` identifiers are carefully matched in this -detection. - -Similarly for TypeScript, `export * from 'external'` is output as: - -```js -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("external")); -``` - -Where the `__export(require("external"))` statement is explicitly detected as a reexport, including variations `tslib.__export` and `__exportStar`. - -### Environment Support - -Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm). - -### JS Grammar Support - -* Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators. -* Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking. -* Always correctly parses valid JS source, but may parse invalid JS source without errors. - -### Benchmarks - -Benchmarks can be run with `npm run bench`. - -Current results: - -JS Build: - -``` -Module load time -> 5ms -Cold Run, All Samples -test/samples/*.js (3635 KiB) -> 323ms - -Warm Runs (average of 25 runs) -test/samples/angular.js (1410 KiB) -> 14.84ms -test/samples/angular.min.js (303 KiB) -> 4.8ms -test/samples/d3.js (553 KiB) -> 7.84ms -test/samples/d3.min.js (250 KiB) -> 4ms -test/samples/magic-string.js (34 KiB) -> 0.72ms -test/samples/magic-string.min.js (20 KiB) -> 0.4ms -test/samples/rollup.js (698 KiB) -> 9.32ms -test/samples/rollup.min.js (367 KiB) -> 6.52ms - -Warm Runs, All Samples (average of 25 runs) -test/samples/*.js (3635 KiB) -> 44ms -``` - -Wasm Build: -``` -Module load time -> 11ms -Cold Run, All Samples -test/samples/*.js (3635 KiB) -> 42ms - -Warm Runs (average of 25 runs) -test/samples/angular.js (1410 KiB) -> 9.92ms -test/samples/angular.min.js (303 KiB) -> 3.2ms -test/samples/d3.js (553 KiB) -> 5.2ms -test/samples/d3.min.js (250 KiB) -> 2.52ms -test/samples/magic-string.js (34 KiB) -> 0.16ms -test/samples/magic-string.min.js (20 KiB) -> 0.04ms -test/samples/rollup.js (698 KiB) -> 6.44ms -test/samples/rollup.min.js (367 KiB) -> 3.96ms - -Warm Runs, All Samples (average of 25 runs) -test/samples/*.js (3635 KiB) -> 30.48ms -``` - -### Wasm Build Steps - -To build download the WASI SDK from https://github.com/WebAssembly/wasi-sdk/releases. - -The Makefile assumes the existence of "wasi-sdk-11.0" and "wabt" (optional) as sibling folders to this project. - -The build through the Makefile is then run via `make lib/lexer.wasm`, which can also be triggered via `npm run build-wasm` to create `dist/lexer.js`. - -On Windows it may be preferable to use the Linux subsystem. - -After the Web Assembly build, the CJS build can be triggered via `npm run build`. - -Optimization passes are run with [Binaryen](https://github.com/WebAssembly/binaryen) prior to publish to reduce the Web Assembly footprint. - -### License - -MIT - -[travis-url]: https://travis-ci.org/guybedford/es-module-lexer -[travis-image]: https://travis-ci.org/guybedford/es-module-lexer.svg?branch=master diff --git a/node_modules/cjs-module-lexer/dist/lexer.js b/node_modules/cjs-module-lexer/dist/lexer.js deleted file mode 100644 index 54bb1a7ac0d2e..0000000000000 --- a/node_modules/cjs-module-lexer/dist/lexer.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";exports.parse=parse;exports.init=init;const A=new Set(["implements","interface","let","package","private","protected","public","static","yield","enum"]);let Q;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(g,I="@"){if(!Q)throw new Error("Not initialized");const D=g.length+1,N=(Q.__heap_base.value||Q.__heap_base)+4*D-Q.memory.buffer.byteLength;N>0&&Q.memory.grow(Math.ceil(N/65536));const k=Q.sa(D);if((B?C:E)(g,new Uint16Array(Q.memory.buffer,k,D)),!Q.parseCJS(k,g.length,0,0))throw Object.assign(new Error(`Parse error ${I}${Q.e()}:${g.slice(0,Q.e()).split("\n").length}:${Q.e()-g.lastIndexOf("\n",Q.e()-1)}`),{idx:Q.e()});let w=new Set,o=new Set;for(;Q.rre();)o.add(g.slice(Q.res(),Q.ree()));for(;Q.re();){let B=g.slice(Q.es(),Q.ee());A.has(B)||w.add(B)}return{exports:[...w],reexports:[...o]}}function E(A,Q){const B=A.length;let E=0;for(;E>>8}}function C(A,Q){const B=A.length;let E=0;for(;E{const A=await WebAssembly.compile((B="AGFzbQEAAAABhAEPYAJ/fwBgAABgAX8Bf2AAAX9gBX9/f39/AX9gAX8AYAZ/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAR/f39/AX9gAn9/AX8DPTwCAwMDAwMDAwAAAQQCAgUGBQEBAQICAgIBAQEBBQEBBwECCAMCAgIJBAIBCgILDAYNCA4HAgICAgICAwkEBQFwAQQEBQMBAAEGDwJ/AUGwmAILfwBBsJgCCwdNCwZtZW1vcnkCAAJzYQAAAWUAAQJlcwACAmVlAAMDcmVzAAQDcmVlAAUCcmUABgNycmUABwhwYXJzZUNKUwALC19faGVhcF9iYXNlAwEJCQEAQQELAwgJCgqElgE8YAEBf0EAKAKYHyIBIABBAXRqIgBBADsBAEEAIABBAmoiADYCyB9BACAANgLMH0EAQQA2ArAfQQBBADYCuB9BAEEANgK0H0EAQQA2ArwfQQBBADYCxB9BAEEANgLAHyABCwgAQQAoAtAfCxUAQQAoArQfKAIAQQAoApgfa0EBdQsVAEEAKAK0HygCBEEAKAKYH2tBAXULFQBBACgCwB8oAgBBACgCmB9rQQF1CxUAQQAoAsAfKAIEQQAoApgfa0EBdQslAQF/QQBBACgCtB8iAEEIakGwHyAAGygCACIANgK0HyAAQQBHCyUBAX9BAEEAKALAHyIAQQhqQbwfIAAbKAIAIgA2AsAfIABBAEcLSAEBf0EAKAK4HyICQQhqQbAfIAIbQQAoAswfIgI2AgBBACACNgK4H0EAIAJBDGo2AswfIAJBADYCCCACIAE2AgQgAiAANgIAC0gBAX9BACgCxB8iAkEIakG8HyACG0EAKALMHyICNgIAQQAgAjYCxB9BACACQQxqNgLMHyACQQA2AgggAiABNgIEIAIgADYCAAsSAEEAQQA2ArwfQQBBADYCxB8L5A0BAX9BACABNgLgP0EAIAA2ApgfAkAgAkUNAEEAIAI2ApwfCwJAIANFDQBBACADNgKgHwtBAEH//wM7Aeg/QQBBgMAANgKAYEEAQZDgADYCkKABQQBB4B82ApSgAUEAQQAoAqgfNgLsP0EAIABBfmoiAjYCnKABQQAgAiABQQF0aiIDNgKgoAFBAEEAOwHmP0EAQQA7AeQ/QQBBADoA8D9BAEEANgLQH0EAQQA6ANQfQQBBADoAmKABAkACQCAALwEAQSNHDQAgAC8BAkEhRw0AQQEhAiABQQJGDQFBACAAQQJqNgKcoAEgAEEEaiEAAkADQCAAIgJBfmogA08NASACQQJqIQAgAi8BAEF2aiIBQQNLDQAgAQ4EAQAAAQELC0EAIAI2ApygAQsDQEEAIAJBAmoiADYCnKABAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAiADTw0AAkAgAC8BACIBQXdqIgNBF0sNAEEBIAN0QZ+AgARxDRkLAkACQAJAQQAvAeY/IgMNACABQaF/aiIFQQ5NDQQgAUFZaiIFQQhNDQUgAUGFf2oiBUECTQ0GIAFBIkYNAiABQc8ARg0BIAFB8gBHDRYCQEEAEAxFDQAgABANRQ0AIAIQDgtBAEEAKAKcoAE2Auw/DBsLIAFBWWoiBUEITQ0GIAFBoH9qIgVBBU0NByABQYV/aiIFQQJNDQggAUEiRg0BIAFBzwBGDQAgAUHtAEcNFQwUCyACQQRqQeIAQeoAQeUAQeMAQfQAEA9FDRQgABANRQ0UIANFEBAMFAsQEQwTC0EALwHoP0H//wNGQQAvAeY/RXFBAC0A1B9FcQ8LIAUODxIFEREOEQ8RERETEREREBILIAUOCQYMCBAQEBAQBQYLIAUOAwkPBwkLIAUOCQQKCQ4ODg4OAwQLIAUOBgENDQoNCwELIAUOAwYMAwYLQQAvAeg/Qf7/A0YNAwwECwJAAkAgAi8BBCICQSpGDQAgAkEvRw0BEBIMEQsQEwwQCwJAAkACQAJAQQAoAuw/IgAvAQAiAhAURQ0AIAJBVWoiA0EDSw0CAkACQAJAIAMOBAEFAgABCyAAQX5qLwEAQVBqQf//A3FBCkkNAwwECyAAQX5qLwEAQStGDQIMAwsgAEF+ai8BAEEtRg0BDAILAkACQCACQf0ARg0AIAJBL0YNASACQSlHDQJBACgCkKABIANBAnRqKAIAEBVFDQIMAwtBACgCkKABIANBAnRqKAIAEBYNAiADQbCgAWotAABFDQEMAgtBAC0A8D8NAQsgABAXIQMgAkUNAEEBIQIgA0UNAQsQGEEAIQILQQAgAjoA8D8MCgsQGQwJC0EAIANBf2oiADsB5j8CQCADQQAvAeg/IgJHDQBBAEEALwHkP0F/aiICOwHkP0EAQQAoAoBgIAJB//8DcUEBdGovAQA7Aeg/DAILIAJB//8DRg0IIABB//8DcSACTw0ICxAaQQAhAgwOCxAbDAYLIANBsKABakEALQCYoAE6AABBACADQQFqOwHmP0EAKAKQoAEgA0ECdGpBACgC7D82AgBBAEEAOgCYoAEMBQtBACADQX9qOwHmPwwEC0EAIANBAWo7AeY/QQAoApCgASADQQJ0akEAKALsPzYCAAwDCyAAEA1FDQIgAi8BBEHsAEcNAiACLwEGQeEARw0CIAIvAQhB8wBHDQIgAi8BCkHzAEcNAgJAAkAgAi8BDCIDQXdqIgJBF0sNAEEBIAJ0QZ+AgARxDQELIANBoAFHDQMLQQBBAToAmKABDAILIAJBBGpB+ABB8ABB7wBB8gBB9AAQD0UNASAAEA1FDQECQCACLwEOQfMARw0AQQAQHAwCCyADDQEQHQwBCyACQQRqQe8AQeQAQfUAQewAQeUAEA9FDQAgABANRQ0AEB4LQQBBACgCnKABNgLsPwwECyACQQRqQd8AQeUAQfgAQfAAQe8AQfIAQfQAEB9FDQICQCAAEA0NACACLwEAQS5HDQMLQQAgAkESaiIANgKcoAECQCACLwESIgNB0wBHDQAgAi8BFEH0AEcNAyACLwEWQeEARw0DIAIvARhB8gBHDQNBACACQRpqIgA2ApygASACLwEaIQMLIANB//8DcUEoRw0CQQAoApCgAUEAKALsPzYCAEEAQQE7AeY/QQBBACgCnKABIgJBAmoiADYCnKABIAIvAQJB8gBHDQJBAhAMGgwBCyACQQRqQe0AQfAAQe8AQfIAQfQAEA9FDQEgABANRQ0BECALQQAoApygASEAC0EAIAA2Auw/C0EAKAKgoAEhA0EAKAKcoAEhAgwACwsgAgvrAgEEf0EAIQECQEEAKAKcoAEiAkECakHlAEHxAEH1AEHpAEHyAEHlABAiRQ0AQQAhAUEAIAJBDmo2ApygAQJAECNBKEcNAEEAQQAoApygAUECajYCnKABECMhA0EAKAKcoAFBAmohBAJAIANBIkYNACADQSdHDQEQGUEAQQAoApygASIDQQJqNgKcoAEQI0EpRw0BAkAgAEF/aiIBQQFLDQACQAJAIAEOAgEAAQsgBCADQQAoAqAfEQAAQQEPCyAEIANBACgCoB8RAABBAQ8LQQAoApSgASAENgIAQQAoApSgASADNgIEQQEPCxARQQBBACgCnKABIgNBAmo2ApygARAjQSlHDQACQCAAQX9qIgFBAUsNAAJAAkAgAQ4CAQABCyAEIANBACgCoB8RAABBAQ8LIAQgA0EAKAKgHxEAAEEBDwtBACgClKABIAQ2AgBBACgClKABIAM2AgRBAQ8LQQAgAjYCnKABCyABCx0AAkBBACgCmB8gAEcNAEEBDwsgAEF+ai8BABAhC/4CAQR/QQAoApgfIQECQANAIABBfmohAiAALwEAIgNBIEcNASAAIAFLIQQgAiEAIAQNAAsLAkAgA0E9Rw0AAkADQCACQX5qIQAgAi8BAEEgRw0BIAIgAUshBCAAIQIgBA0ACwsgAEECaiECIABBBGohA0EAIQQCQANAIAIQJCEAIAIgAU0NASAARQ0BIABB3ABGDQIgABAlRQ0BIAJBfkF8IABBgIAESRtqIQIgABAmIQQMAAsLIARBAXFFDQAgAi8BAEEgRw0AQQAoApSgASIEQQAoAqwfRg0AIAQgAzYCDCAEIAJBAmo2AgggAkF+aiEAQSAhAgJAA0AgAEECaiABTQ0BIAJB//8DcUEgRw0BIAAvAQAhAiAAQX5qIQAMAAsLIAJB//8DcUGOf2oiAkECSw0AAkACQAJAIAIOAwADAQALIABB9gBB4QAQJw0BDAILIABB7ABB5QAQJw0AIABB4wBB7wBB7gBB8wAQKEUNAQtBACAEQRBqNgKUoAELCz8BAX9BACEGAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUYhBgsgBgvSIQEIf0EAQQAoApygASIBQQxqNgKcoAEgAUEKaiEBAkAQI0EuRw0AQQBBACgCnKABQQJqNgKcoAECQBAjIgJB5ABHDQBBACgCnKABIgBBAmpB5QBB5gBB6QBB7gBB5QBB0ABB8gBB7wBB8ABB5QBB8gBB9ABB+QAQK0UNAUEAIABBHGo2ApygASAAQRpqIQEQI0EoRw0BQQBBACgCnKABQQJqNgKcoAEQIxAsRQ0BECNBLEcNAUEAQQAoApygAUECajYCnKABAkAQIyIAQSdGDQAgAEEiRw0CC0EAQQAoApygASICQQJqIgM2ApygASACLwECEClFDQFBACgCnKABIgIvAQAgAEcNAUEAIAJBAmo2ApygARAjQSxHDQFBAEEAKAKcoAFBAmo2ApygARAjQfsARw0BQQBBACgCnKABQQJqNgKcoAECQBAjIgBB5QBHDQBBACgCnKABIgBBAmpB7gBB9QBB7QBB5QBB8gBB4QBB4gBB7ABB5QAQLUUNAkEAIABBFGo2ApygARAjQTpHDQJBAEEAKAKcoAFBAmo2ApygARAjQfQARw0CQQAoApygASIALwECQfIARw0CIAAvAQRB9QBHDQIgAC8BBkHlAEcNAkEAIABBCGo2ApygARAjQSxHDQJBAEEAKAKcoAFBAmo2ApygARAjIQALAkAgAEHnAEYNACAAQfYARw0CQQAoApygASIALwECQeEARw0CIAAvAQRB7ABHDQIgAC8BBkH1AEcNAiAALwEIQeUARw0CQQAgAEEKajYCnKABECNBOkcNAkEAQQAoApygAUECajYCnKABIAMgAkEAKAKcHxEAAAwCC0EAKAKcoAEiAC8BAkHlAEcNASAALwEEQfQARw0BQQAgAEEGajYCnKABAkAQIyIAQTpHDQBBAEEAKAKcoAFBAmo2ApygARAjQeYARw0CQQAoApygASIAQQJqQfUAQe4AQeMAQfQAQekAQe8AQe4AEB9FDQJBACAAQRBqIgA2ApygAQJAECMiBEEoRg0AIABBACgCnKABRg0DIAQQKUUNAwsQIyEACyAAQShHDQFBAEEAKAKcoAFBAmo2ApygARAjQSlHDQFBAEEAKAKcoAFBAmo2ApygARAjQfsARw0BQQBBACgCnKABQQJqNgKcoAEQI0HyAEcNAUEAKAKcoAEiAEECakHlAEH0AEH1AEHyAEHuABAPRQ0BQQAgAEEMajYCnKABECMQKUUNAQJAAkACQBAjIgBB2wBGDQAgAEEuRw0CQQBBACgCnKABQQJqNgKcoAEQIxApDQEMBAtBAEEAKAKcoAFBAmo2ApygAQJAAkAQIyIAQSJGDQAgAEEnRw0FEBkMAQsQEQtBAEEAKAKcoAFBAmo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAELECMhAAsCQCAAQTtHDQBBAEEAKAKcoAFBAmo2ApygARAjIQALIABB/QBHDQFBAEEAKAKcoAFBAmo2ApygARAjQf0ARw0BQQBBACgCnKABQQJqNgKcoAEQI0EpRw0BIAMgAkEAKAKcHxEAAA8LIAJB6wBHDQAgAEUNAEEAKAKcoAEiAC8BAkHlAEcNACAALwEEQfkARw0AIAAvAQZB8wBHDQAgAEEGaiEBQQAgAEEIajYCnKABECNBKEcNAEEAQQAoApygAUECajYCnKABECMhAEEAKAKcoAEhAiAAEClFDQBBACgCnKABIQAQI0EpRw0AQQBBACgCnKABIgFBAmo2ApygARAjQS5HDQBBAEEAKAKcoAFBAmo2ApygARAjQeYARw0AQQAoApygASIDQQJqQe8AQfIAQcUAQeEAQeMAQegAECJFDQBBACADQQ5qNgKcoAEQIyEDQQAoApygASIEQX5qIQEgA0EoRw0AQQAgBEECajYCnKABECNB5gBHDQBBACgCnKABIgNBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQH0UNAEEAIANBEGo2ApygARAjQShHDQBBAEEAKAKcoAFBAmo2ApygARAjIQNBACgCnKABIQQgAxApRQ0AQQAoApygASEDECNBKUcNAEEAQQAoApygAUECajYCnKABECNB+wBHDQBBAEEAKAKcoAFBAmo2ApygARAjQekARw0AQQAoApygASIFLwECQeYARw0AQQAgBUEEajYCnKABECNBKEcNAEEAQQAoApygAUECajYCnKABECMaQQAoApygASIFIAQgAyAEayIDEDsNAEEAIAUgA0EBdSIGQQF0ajYCnKABAkACQAJAECMiBUEhRg0AIAVBPUcNA0EAKAKcoAEiBS8BAkE9Rw0DIAUvAQRBPUcNA0EAIAVBBmo2ApygAQJAECMiBUEnRg0AIAVBIkcNBAtBACgCnKABIgdBAmpB5ABB5QBB5gBB4QBB9QBB7ABB9AAQH0UNA0EAIAdBEGo2ApygARAjIAVHDQNBAEEAKAKcoAFBAmo2ApygARAjQfwARw0DQQAoApygASIFLwECQfwARw0DQQAgBUEEajYCnKABECMaQQAoApygASIFIAQgAxA7DQNBACAFIAZBAXRqNgKcoAEQI0E9Rw0DQQAoApygASIFLwECQT1HDQMgBS8BBEE9Rw0DQQAgBUEGajYCnKABAkAQIyIFQSdGDQAgBUEiRw0EC0EAKAKcoAEiB0ECakHfAEHfAEHlAEHzAEHNAEHvAEHkAEH1AEHsAEHlABAuRQ0DQQAgB0EWajYCnKABECMgBUcNA0EAQQAoApygAUECajYCnKABECNBKUcNA0EAQQAoApygAUECajYCnKABECNB8gBHDQNBACgCnKABIgVBAmpB5QBB9ABB9QBB8gBB7gAQD0UNA0EAIAVBDGo2ApygARAjQTtGDQEMAgtBACgCnKABIgUvAQJBPUcNAiAFLwEEQT1HDQJBACAFQQZqNgKcoAECQBAjIgVBJ0YNACAFQSJHDQMLQQAoApygASIHQQJqQeQAQeUAQeYAQeEAQfUAQewAQfQAEB9FDQJBACAHQRBqNgKcoAEQIyAFRw0CQQBBACgCnKABQQJqNgKcoAEQI0EpRw0CC0EAQQAoApygAUECajYCnKABCyAAIAJrIgVBAXUhBwJAECMiAEHpAEcNAEHpACEAQQAoApygASIILwECQeYARw0AQQAgCEEEajYCnKABECNBKEcNAUEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQFBACAAIAZBAXRqNgKcoAEQI0HpAEcNAUEAKAKcoAEiAC8BAkHuAEcNASAALwEEQSBHDQFBACAAQQZqNgKcoAEQIxAsRQ0BECNBJkcNAUEAKAKcoAEiAC8BAkEmRw0BQQAgAEEEajYCnKABECMQLEUNARAjQdsARw0BQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNAUEAIAAgBkEBdGo2ApygARAjQd0ARw0BQQBBACgCnKABQQJqNgKcoAEQI0E9Rw0BQQAoApygASIALwECQT1HDQEgAC8BBEE9Rw0BQQAgAEEGajYCnKABECMaQQAoApygASIAIAIgBRA7DQFBACAAIAdBAXRqNgKcoAEQI0HbAEcNAUEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQFBACAAIAZBAXRqNgKcoAEQI0HdAEcNAUEAQQAoApygAUECajYCnKABECNBKUcNAUEAQQAoApygAUECajYCnKABECNB8gBHDQFBACgCnKABIgBBAmpB5QBB9ABB9QBB8gBB7gAQD0UNAUEAIABBDGo2ApygAQJAECNBO0cNAEEAQQAoApygAUECajYCnKABCxAjIQALAkACQAJAIAAQLEUNABAjQdsARw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNA0EAIAAgBkEBdGo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAEQI0E9Rw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgAiAFEDsNA0EAIAAgB0EBdGo2ApygARAjQdsARw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNA0EAIAAgBkEBdGo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAEQIyIAQTtHDQJBAEEAKAKcoAFBAmo2ApygAQwBCyAAQc8ARw0CQQAoApygASIAQQJqQeIAQeoAQeUAQeMAQfQAEA9FDQJBACAAQQxqNgKcoAEQI0EuRw0CQQBBACgCnKABQQJqNgKcoAEQI0HkAEcNAkEAKAKcoAEiAEECakHlAEHmAEHpAEHuAEHlAEHQAEHyAEHvAEHwAEHlAEHyAEH0AEH5ABArRQ0CQQAgAEEcajYCnKABECNBKEcNAkEAQQAoApygAUECajYCnKABECMQLEUNAhAjQSxHDQJBAEEAKAKcoAFBAmo2ApygARAjGkEAKAKcoAEiACAEIAMQOw0CQQAgACAGQQF0ajYCnKABECNBLEcNAkEAQQAoApygAUECajYCnKABECNB+wBHDQJBAEEAKAKcoAFBAmo2ApygARAjQeUARw0CQQAoApygASIAQQJqQe4AQfUAQe0AQeUAQfIAQeEAQeIAQewAQeUAEC1FDQJBACAAQRRqNgKcoAEQI0E6Rw0CQQBBACgCnKABQQJqNgKcoAEQIyEIQQAoApygASEAAkAgCEH0AEYNACAALwECQfIARw0DIAAvAQRB9QBHDQMgAC8BBkHlAEcNAwtBACAAQQhqNgKcoAEQI0EsRw0CQQBBACgCnKABQQJqNgKcoAEQI0HnAEcNAkEAKAKcoAEiAC8BAkHlAEcNAiAALwEEQfQARw0CQQAgAEEGajYCnKABECNBOkcNAkEAQQAoApygAUECajYCnKABECNB5gBHDQJBACgCnKABIgBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQH0UNAkEAIABBEGo2ApygARAjQShHDQJBAEEAKAKcoAFBAmo2ApygARAjQSlHDQJBAEEAKAKcoAFBAmo2ApygARAjQfsARw0CQQBBACgCnKABQQJqNgKcoAEQI0HyAEcNAkEAKAKcoAEiAEECakHlAEH0AEH1AEHyAEHuABAPRQ0CQQAgAEEMajYCnKABECMaQQAoApygASIAIAIgBRA7DQJBACAAIAdBAXRqNgKcoAEQI0HbAEcNAkEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQJBACAAIAZBAXRqNgKcoAEQI0HdAEcNAkEAQQAoApygAUECajYCnKABAkAQIyIAQTtHDQBBAEEAKAKcoAFBAmo2ApygARAjIQALIABB/QBHDQJBAEEAKAKcoAFBAmo2ApygARAjQf0ARw0CQQBBACgCnKABQQJqNgKcoAEQI0EpRw0CQQBBACgCnKABQQJqNgKcoAEQIyIAQTtHDQFBAEEAKAKcoAFBAmo2ApygAQsQIyEACyAAQf0ARw0AQQBBACgCnKABQQJqNgKcoAEQI0EpRw0AQQAoApSgASEEQeAfIQADQAJAAkAgBCAARg0AIAcgAEEMaigCACAAQQhqKAIAIgNrQQF1Rw0BIAIgAyAFEDsNASAAKAIAIABBBGooAgBBACgCoB8RAABBACABNgKcoAELDwsgAEEQaiEADAALC0EAIAE2ApygAQuVAQEEf0EAKAKcoAEhAEEAKAKgoAEhAQJAA0AgACICQQJqIQAgAiABTw0BAkAgAC8BACIDQdwARg0AAkAgA0F2aiICQQNNDQAgA0EiRw0CQQAgADYCnKABDwsgAg4EAgEBAgILIAJBBGohACACLwEEQQ1HDQAgAkEGaiAAIAIvAQZBCkYbIQAMAAsLQQAgADYCnKABEBoLUwEEf0EAKAKcoAFBAmohAEEAKAKgoAEhAQJAA0AgACICQX5qIAFPDQEgAkECaiEAIAIvAQBBdmoiA0EDSw0AIAMOBAEAAAEBCwtBACACNgKcoAELfAECf0EAQQAoApygASIAQQJqNgKcoAEgAEEGaiEAQQAoAqCgASEBA0ACQAJAAkAgAEF8aiABTw0AIABBfmovAQBBKkcNAiAALwEAQS9HDQJBACAAQX5qNgKcoAEMAQsgAEF+aiEAC0EAIAA2ApygAQ8LIABBAmohAAwACwt1AQF/AkACQCAAQV9qIgFBBUsNAEEBIAF0QTFxDQELIABBRmpB//8DcUEGSQ0AIABBWGpB//8DcUEHSSAAQSlHcQ0AAkAgAEGlf2oiAUEDSw0AIAEOBAEAAAEBCyAAQf0ARyAAQYV/akH//wNxQQRJcQ8LQQELPQEBf0EBIQECQCAAQfcAQegAQekAQewAQeUAEC8NACAAQeYAQe8AQfIAEDANACAAQekAQeYAECchAQsgAQutAQEDf0EBIQECQAJAAkACQAJAAkACQCAALwEAIgJBRWoiA0EDTQ0AIAJBm39qIgNBA00NASACQSlGDQMgAkH5AEcNAiAAQX5qQeYAQekAQe4AQeEAQewAQewAEDEPCyADDgQCAQEFAgsgAw4EAgAAAwILQQAhAQsgAQ8LIABBfmpB5QBB7ABB8wAQMA8LIABBfmpB4wBB4QBB9ABB4wAQKA8LIABBfmovAQBBPUYL7QMBAn9BACEBAkAgAC8BAEGcf2oiAkETSw0AAkACQAJAAkACQAJAAkACQCACDhQAAQIICAgICAgIAwQICAUIBggIBwALIABBfmovAQBBl39qIgJBA0sNBwJAAkAgAg4EAAkJAQALIABBfGpB9gBB7wAQJw8LIABBfGpB+QBB6QBB5QAQMA8LIABBfmovAQBBjX9qIgJBAUsNBgJAAkAgAg4CAAEACwJAIABBfGovAQAiAkHhAEYNACACQewARw0IIABBempB5QAQMg8LIABBempB4wAQMg8LIABBfGpB5ABB5QBB7ABB5QAQKA8LIABBfmovAQBB7wBHDQUgAEF8ai8BAEHlAEcNBQJAIABBemovAQAiAkHwAEYNACACQeMARw0GIABBeGpB6QBB7gBB8wBB9ABB4QBB7gAQMQ8LIABBeGpB9ABB+QAQJw8LQQEhASAAQX5qIgBB6QAQMg0EIABB8gBB5QBB9ABB9QBB8gAQLw8LIABBfmpB5AAQMg8LIABBfmpB5ABB5QBB4gBB9QBB5wBB5wBB5QAQMw8LIABBfmpB4QBB9wBB4QBB6QAQKA8LAkAgAEF+ai8BACICQe8ARg0AIAJB5QBHDQEgAEF8akHuABAyDwsgAEF8akH0AEHoAEHyABAwIQELIAELhwEBA38DQEEAQQAoApygASIAQQJqIgE2ApygAQJAAkACQCAAQQAoAqCgAU8NACABLwEAIgFBpX9qIgJBAU0NAgJAIAFBdmoiAEEDTQ0AIAFBL0cNBAwCCyAADgQAAwMAAAsQGgsPCwJAAkAgAg4CAQABC0EAIABBBGo2ApygAQwBCxA6GgwACwuVAQEEf0EAKAKcoAEhAEEAKAKgoAEhAQJAA0AgACICQQJqIQAgAiABTw0BAkAgAC8BACIDQdwARg0AAkAgA0F2aiICQQNNDQAgA0EnRw0CQQAgADYCnKABDwsgAg4EAgEBAgILIAJBBGohACACLwEEQQ1HDQAgAkEGaiAAIAIvAQZBCkYbIQAMAAsLQQAgADYCnKABEBoLOAEBf0EAQQE6ANQfQQAoApygASEAQQBBACgCoKABQQJqNgKcoAFBACAAQQAoApgfa0EBdTYC0B8LzgEBBX9BACgCnKABIQBBACgCoKABIQEDQCAAIgJBAmohAAJAAkAgAiABTw0AIAAvAQAiA0Gkf2oiBEEETQ0BIANBJEcNAiACLwEEQfsARw0CQQBBAC8B5D8iAEEBajsB5D9BACgCgGAgAEEBdGpBAC8B6D87AQBBACACQQRqNgKcoAFBAEEALwHmP0EBaiIAOwHoP0EAIAA7AeY/DwtBACAANgKcoAEQGg8LAkACQCAEDgUBAgICAAELQQAgADYCnKABDwsgAkEEaiEADAALC9ICAQN/QQBBACgCnKABIgFBDmo2ApygAQJAAkACQBAjIgJB2wBGDQAgAkE9Rg0BIAJBLkcNAkEAQQAoApygAUECajYCnKABECMhAkEAKAKcoAEhACACEClFDQJBACgCnKABIQIQI0E9Rw0CIAAgAkEAKAKcHxEAAA8LQQBBACgCnKABQQJqNgKcoAECQBAjIgJBJ0YNACACQSJHDQILQQBBACgCnKABIgBBAmoiAzYCnKABIAAvAQIQKUUNAUEAKAKcoAEiAC8BACACRw0BQQAgAEECajYCnKABECNB3QBHDQFBAEEAKAKcoAFBAmo2ApygARAjQT1HDQEgAyAAQQAoApwfEQAADAELIABFDQBBACgCpB8RAQBBAEEAKAKcoAFBAmo2ApygAQJAECMiAkHyAEYNACACQfsARw0BECoPC0EBEAwaC0EAIAFBDGo2ApygAQs2AQJ/QQBBACgCnKABQQxqIgA2ApygARAjIQECQAJAQQAoApygASAARw0AIAEQOUUNAQsQGgsLbAEBf0EAQQAoApygASIAQQxqNgKcoAECQBAjQS5HDQBBAEEAKAKcoAFBAmo2ApygARAjQeUARw0AQQAoApygAUECakH4AEHwAEHvAEHyAEH0AEHzABAiRQ0AQQEQHA8LQQAgAEEKajYCnKABC1MBAX9BACEIAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRiEICyAIC6QBAQR/QQBBACgCnKABIgBBDGoiATYCnKABAkACQAJAAkACQBAjIgJBWWoiA0EHTQ0AIAJBIkYNAiACQfsARg0CDAELAkAgAw4IAgABAgEBAQMCC0EAQQAvAeY/IgNBAWo7AeY/QQAoApCgASADQQJ0aiAANgIADwtBACgCnKABIAFGDQILQQAvAeY/RQ0AQQBBACgCnKABQX5qNgKcoAEPCxAaCws0AQF/QQEhAQJAIABBd2pB//8DcUEFSQ0AIABBgAFyQaABRg0AIABBLkcgABA5cSEBCyABC0kBAX9BACEHAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZGIQcLIAcLegEDf0EAKAKcoAEhAAJAA0ACQCAALwEAIgFBd2pBBUkNACABQSBGDQAgAUGgAUYNACABQS9HDQICQCAALwECIgBBKkYNACAAQS9HDQMQEgwBCxATC0EAQQAoApygASICQQJqIgA2ApygASACQQAoAqCgAUkNAAsLIAELOQEBfwJAIAAvAQAiAUGA+ANxQYC4A0cNACAAQX5qLwEAQf8HcUEKdCABQf8HcXJBgIAEaiEBCyABC30BAX8CQCAAQS9LDQAgAEEkRg8LAkAgAEE6SQ0AQQAhAQJAIABBwQBJDQAgAEHbAEkNAQJAIABB4ABLDQAgAEHfAEYPCyAAQfsASQ0BAkAgAEH//wNLDQAgAEGqAUkNASAAEDQPC0EBIQEgABA1DQAgABA2IQELIAEPC0EBC2MBAX8CQCAAQcAASw0AIABBJEYPC0EBIQECQCAAQdsASQ0AAkAgAEHgAEsNACAAQd8ARg8LIABB+wBJDQACQCAAQf//A0sNAEEAIQEgAEGqAUkNASAAEDcPCyAAEDUhAQsgAQtMAQN/QQAhAwJAIABBfmoiBEEAKAKYHyIFSQ0AIAQvAQAgAUcNACAALwEAIAJHDQACQCAEIAVHDQBBAQ8LIABBfGovAQAQISEDCyADC2YBA39BACEFAkAgAEF6aiIGQQAoApgfIgdJDQAgBi8BACABRw0AIABBfGovAQAgAkcNACAAQX5qLwEAIANHDQAgAC8BACAERw0AAkAgBiAHRw0AQQEPCyAAQXhqLwEAECEhBQsgBQuFAQECfyAAEDgiABAmIQECQAJAIABB3ABGDQBBACECIAFFDQELQQAoApygAUECQQQgAEGAgARJG2ohAAJAA0BBACAANgKcoAEgAC8BABA4IgFFDQECQCABECVFDQAgAEECQQQgAUGAgARJG2ohAAwBCwtBACECIAFB3ABGDQELQQEhAgsgAgv2AwEEf0EAKAKcoAEiAEF+aiEBA0BBACAAQQJqNgKcoAECQAJAAkAgAEEAKAKgoAFPDQAQIyEAQQAoApygASECAkACQCAAEClFDQBBACgCnKABIQMCQAJAECMiAEE6Rw0AQQBBACgCnKABQQJqNgKcoAEQIxApRQ0BQQAoApygAS8BACEACyACIANBACgCnB8RAAAMAgtBACABNgKcoAEPCwJAAkAgAEEiRg0AIABBLkYNASAAQSdHDQQLQQBBACgCnKABIgJBAmoiAzYCnKABIAIvAQIQKUUNAUEAKAKcoAEiAi8BACAARw0BQQAgAkECajYCnKABECMiAEE6Rw0BQQBBACgCnKABQQJqNgKcoAECQBAjEClFDQBBACgCnKABLwEAIQAgAyACQQAoApwfEQAADAILQQAgATYCnKABDwtBACgCnKABIgAvAQJBLkcNAiAALwEEQS5HDQJBACAAQQZqNgKcoAECQAJAAkAgAC8BBiIAQfIARw0AQQEQDCEAQQAoApygASECIAANASACLwEAIQALIABB//8DcRApDQFBACABNgKcoAEPC0EAIAJBAmo2ApygAQsQIyEACyAAQf//A3EiAEEsRg0CIABB/QBGDQBBACABNgKcoAELDwtBACABNgKcoAEPC0EAKAKcoAEhAAwACwuPAQEBf0EAIQ4CQCAALwEAIAFHDQAgAC8BAiACRw0AIAAvAQQgA0cNACAALwEGIARHDQAgAC8BCCAFRw0AIAAvAQogBkcNACAALwEMIAdHDQAgAC8BDiAIRw0AIAAvARAgCUcNACAALwESIApHDQAgAC8BFCALRw0AIAAvARYgDEcNACAALwEYIA1GIQ4LIA4LqAEBAn9BACEBQQAoApygASECAkACQCAAQe0ARw0AIAJBAmpB7wBB5ABB9QBB7ABB5QAQD0UNAUEAIAJBDGo2ApygAQJAECNBLkYNAEEAIQEMAgtBAEEAKAKcoAFBAmo2ApygARAjIQALIABB5QBHDQBBACgCnKABIgBBDmogAiAAQQJqQfgAQfAAQe8AQfIAQfQAQfMAECIiARshAgtBACACNgKcoAEgAQtnAQF/QQAhCgJAIAAvAQAgAUcNACAALwECIAJHDQAgAC8BBCADRw0AIAAvAQYgBEcNACAALwEIIAVHDQAgAC8BCiAGRw0AIAAvAQwgB0cNACAALwEOIAhHDQAgAC8BECAJRiEKCyAKC3EBAX9BACELAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRw0AIAAvAQ4gCEcNACAALwEQIAlHDQAgAC8BEiAKRiELCyALC0kBA39BACEGAkAgAEF4aiIHQQAoApgfIghJDQAgByABIAIgAyAEIAUQD0UNAAJAIAcgCEcNAEEBDwsgAEF2ai8BABAhIQYLIAYLWQEDf0EAIQQCQCAAQXxqIgVBACgCmB8iBkkNACAFLwEAIAFHDQAgAEF+ai8BACACRw0AIAAvAQAgA0cNAAJAIAUgBkcNAEEBDwsgAEF6ai8BABAhIQQLIAQLSwEDf0EAIQcCQCAAQXZqIghBACgCmB8iCUkNACAIIAEgAiADIAQgBSAGECJFDQACQCAIIAlHDQBBAQ8LIABBdGovAQAQISEHCyAHCz0BAn9BACECAkBBACgCmB8iAyAASw0AIAAvAQAgAUcNAAJAIAMgAEcNAEEBDwsgAEF+ai8BABAhIQILIAILTQEDf0EAIQgCQCAAQXRqIglBACgCmB8iCkkNACAJIAEgAiADIAQgBSAGIAcQH0UNAAJAIAkgCkcNAEEBDwsgAEFyai8BABAhIQgLIAgL+RIBA38CQCAAEDcNACAAQfS/f2pBAkkNACAAQbcBRg0AIABBgHpqQfAASQ0AIABB/XZqQQVJDQAgAEGHB0YNACAAQe90akEtSQ0AAkAgAEHBdGoiAUEISw0AQQEgAXRB7QJxDQELIABB8HNqQQtJDQAgAEG1c2pBH0kNAAJAIABBqnJqIgFBEksNAEEBIAF0Qf/8GXENAQsgAEHwDEYNACAAQZZyakEESQ0AIABBwHBqQQpJDQAgAEHacGpBC0kNACAAQdBxakEbSQ0AIABBkQ5GDQAgAEGQcmpBCkkNACAAQcJtakESSQ0AIABBxm1qQQNJDQAgAEGdbmpBIUkNACAAQa1uakEPSQ0AIABBp29qQQNJDQAgAEHXb2pBBUkNACAAQdtvakEDSQ0AIABB5W9qQQlJDQAgAEHqb2pBBEkNACAAQf0PRg0AIABBlXBqQQlJDQACQCAAQa9taiIBQRJLDQBBASABdEH/gBhxDQELIABBmm1qQQpJDQACQAJAIABBxGxqIgFBJ00NACAAQf9sakEDSQ0CDAELIAEOKAEAAQEBAQEBAQAAAQEAAAEBAQAAAAAAAAAAAAEAAAAAAAAAAAAAAQEBCyAAQf4TRg0AIABBmmxqQQpJDQACQCAAQcRraiIBQRVLDQBBASABdEH9sI4BcQ0BCyAAQf9rakEDSQ0AIABB9RRGDQAgAEGaa2pBDEkNAAJAAkAgAEHEamoiAUEnTQ0AIABB/2pqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAQABAQEAAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAABAQELIABBmmpqQQpJDQAgAEGGampBBkkNAAJAAkAgAEHEaWoiAUEnTQ0AIABB/2lqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAAABAQAAAQEBAAAAAAAAAAABAQAAAAAAAAAAAAABAQELIABBmmlqQQpJDQACQCAAQcJoaiIBQRlLDQBBASABdEGf7oMQcQ0BCyAAQYIXRg0AIABBmmhqQQpJDQACQAJAIABBwmdqIgFBJU0NACAAQYBoakEFSQ0CDAELIAEOJgEBAQEBAQEAAQEBAAEBAQEAAAAAAAAAAQEAAAAAAAAAAAAAAAEBAQsgAEGaZ2pBCkkNAAJAAkAgAEHEZmoiAUEnTQ0AIABB/2ZqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAAEBAQABAQEBAAAAAAAAAAEBAAAAAAAAAAAAAAABAQELIABBmmZqQQpJDQAgAEF8cSICQYAaRg0AAkAgAEHFZWoiAUEoSw0AIAEOKQEBAAEBAQEBAQEAAQEBAAEBAQEAAAAAAAAAAAABAAAAAAAAAAAAAAEBAQsgAEGaZWpBCkkNAAJAIABBtmRqIgFBDEsNAEEBIAF0QeEvcQ0BCyAAQf5kakECSQ0AIABBeHFB2BtGDQAgAEGaZGpBCkkNAAJAIABBz2NqIgFBHUsNAEEBIAF0QfmHgP4DcQ0BCyAAQY5kakECSQ0AIABBsR1GDQAgAEGwY2pBCkkNAAJAIABBzGJqIgFBCEsNACABQQZHDQELIABBuGJqQQZJDQAgAEHgYWpBCkkNACAAQQFyIgFBmR5GDQAgAEGwYmpBCkkNAAJAIABBy2FqIgNBCksNAEEBIAN0QZUMcQ0BCyAAQfNgakELSQ0AIAFBhx9GDQAgAEGPYWpBFEkNACAAQe5RakEDSQ0AIABBl1lqQQlJDQAgAEGjWWpBA0kNACAAQfFeakEPSQ0AIABB/l5qQQxJDQAgAEGPX2pBBEkNACAAQZlfakEHSQ0AIABBnl9qQQNJDQAgAEGiX2pBA0kNACAAQapfakEESQ0AIABBwF9qQQpJDQAgAEHVX2pBFEkNACAAQcYfRg0AIABB52BqQSRJDQAgAEHOUWpBA0kNACAAQa5RakECSQ0AIABBjlFqQQJJDQAgAEH1T2pBA0kNACAAQaBQakEKSQ0AIABB3S9GDQAgAEHMUGpBIEkNACAAQbBGakEDSQ0AIABBsEdqQQpJDQAgAEHAR2pBCkkNACAAQdxHakEUSQ0AIABBmkhqQQ5JDQAgAEHQSGpBCkkNACAAQd9IakENSQ0AIABBgElqQQNJDQAgAEGVSWpBCUkNACAAQbBJakEKSQ0AIABBzElqQRFJDQAgAEGASmpBBUkNACAAQdBKakEOSQ0AIABB8EpqQQpJDQAgAEGBS2pBC0kNACAAQaBLakEdSQ0AIABBq0tqQQpJDQAgAEHpS2pBBUkNACAAQbBMakELSQ0AIABBuk1qQQpJDQAgAEHQTWpBDEkNACAAQeBNakEMSQ0AIABBqTFGDQAgAEHwT2pBCkkNACAAQcBEakE6SQ0AIABBiUZqQQNJDQAgAEGORmpBA0kNACAAQe05Rg0AIABBrEZqQRVJDQAgAEGFRGpBBUkNAAJAIABBwb9/aiIBQRVLDQBBASABdEGDgIABcQ0BCyAAQZu+f2pBDEkNACAAQeHBAEYNACAAQbC+f2pBDUkNACAAQZGmf2pBA0kNACAAQf/aAEYNACAAQWBxQeDbAEYNACAAQdaff2pBBkkNACAAQeeef2pBAkkNACAAQYyzfWpBCkkNACAAQe/MAkYNACAAQeCzfWpBCkkNAAJAIABB9a99aiIBQRxLDQBBASABdEGBgID4AXENAQsgAEHisn1qQQJJDQAgAEGQsn1qQQJJDQACQAJAIABB/q99aiIBQQRNDQAgAEGAr31qQQJJDQIMAQsgAQ4FAQAAAAEBCyAAQc2sfWpBDkkNACACQYDTAkYNACAAQbmtfWpBDUkNACAAQdqtfWpBCEkNACAAQYGufWpBC0kNACAAQaCufWpBEkkNACAAQcyufWpBEkkNACAAQbCufWpBCkkNACAAQderfWpBDkkNACAAQeXTAkYNACAAQV9xQbCsfWpBCkkNAAJAIABBvat9aiIBQQpLDQBBASABdEGBDHENAQsgAEGwq31qQQpJDQACQCAAQZ2ofWoiAUEKSw0AIAFBCEcNAQsCQCAAQdCqfWoiAUERSw0AQQEgAXRBnYMLcQ0BCwJAIABBlap9aiIBQQtLDQBBASABdEGfGHENAQsgAEGFq31qQQNJDQAgAEFwcSIBQYD8A0YNACAAQZ72A0YNACAAQZCofWpBCkkNACAAQb/+A0YgAEHwgXxqQQpJIABBs4N8akEDSSAAQc2DfGpBAkkgAUGg/ANGcnJycg8LQQELXAEEf0GAgAQhAUGQCCECQX4hAwJAA0BBACEEIANBAmoiA0HnA0sNASACKAIAIAFqIgEgAEsNASACQQRqIQQgAkEIaiECIAQoAgAgAWoiASAASQ0AC0EBIQQLIAQLXAEEf0GAgAQhAUGwFyECQX4hAwJAA0BBACEEIANBAmoiA0H5AUsNASACKAIAIAFqIgEgAEsNASACQQRqIQQgAkEIaiECIAQoAgAgAWoiASAASQ0AC0EBIQQLIAQL7R8BBn9BASEBAkACQAJAIABB1n5qIgJBEEsNAEEBIAJ0QYGQBHENAQsgAEG6empBDEkNACAAQYh+akHKA0kNACAAQcB+akEXSQ0AIABBqH5qQR9JDQACQCAAQZB5aiICQRxLDQBBASACdEHf+YK6AXENAQsCQCAAQaB6aiICQQ5LDQBBASACdEGfoAFxDQELIABB9nZqQaYBSQ0AIABBiXhqQYsBSQ0AIABB8nhqQRRJDQAgAEHdeGpB0wBJDQAgAEGRdGpBBEkNACAAQbB0akEbSQ0AIABBoHVqQSlJDQAgAEHZCkYNACAAQc91akEmSQ0AAkACQAJAIABBj3NqQeMASQ0AIABBAXIiAkHvDEYNACAAQeBzakErSQ0AAkAgAEGrcmoiAUE8Tw0AQoGAjLCAnIGACCABrYhCAYNQRQ0BCyAAQe5xakEeSQ0AIABBtnBqQSFJDQAgAEGxD0YNACAAQbNxakHZAEkNAAJAIABBjHBqIgFBBksNAEEBIAF0QcMAcQ0BCyAAQYBwakEWSQ0AAkACQCAAQdxvaiIDQQRNDQAgAEGaEEYNAgwBC0EBIQEgAw4FBAAAAAQECyAAQfxtakE2SQ0AIABBym5qQQhJDQAgAEHgbmpBFUkNACAAQcBvakEZSQ0AIABBoG9qQQtJDQAgAEG9EkYNACAAQdASRg0AIABBqG1qQQpJDQAgAEGPbWpBEEkNAAJAIABB+2xqIgNBDE8NAEEBIQFB/xkgA0H//wNxdkEBcQ0ECyAAQe1sakEWSQ0AAkAgAEGEbGoiAUEUSw0AQQEgAXRBgfzhAHENAQsgAEHWbGpBB0kNAAJAIABBzmxqIgFBHEsNAEEBIAF0QfGRgIABcQ0BCwJAIABBpGxqIgFBFUsNAEEBIAF0QbuAwAFxDQELIABB7WtqQRZJDQACQCAAQdZraiIBQTVPDQBC/7aDgICA4AsgAa2IQgGDUEUNAQsgAEHtampBFkkNACAAQfFqakEDSQ0AIABBjmtqQQNJDQAgAEH7ampBCUkNAAJAAkACQCAAQdZqaiIDQSZNDQAgAEGHamoiAUEXSw0BQQEgAXRBgeC/BnFFDQEMAwtBASEBIAMOJwUFBQUFBQUBBQUBBQUFBQUBAQEFAQEBAQEBAQEBAQEBAQEBAQEBBQULIABBoGpqQQJJDQELIABB7WlqQRZJDQACQAJAAkAgAEGPaWoiA0EzTQ0AIABB1mlqIgFBE0sNAUEBIAF0Qf/2I3FFDQEMAwtBASEBIAMONAUBAQEBAQEBAQEBAQEBAQEBAQUBBQUFBQUFAQEBBQUFAQUFBQUBAQEFBQEFAQUFAQEBBQUFCyAAQaRpaiIBQQVLDQAgAUECRw0BCyAAQdhoakEDSQ0AIABB7mdqQRdJDQAgAEHyZ2pBA0kNACAAQftnakEISQ0AIABB0BdGDQAgAEHSaGpBDEkNACAAQb0YRg0AIABB1mdqQRBJDQACQCAAQahnaiIBQSlPDQBCh4aAgIAgIAGtiEIBg1BFDQELIABB1mZqQQpJDQAgAEHuZmpBF0kNACAAQftmakEISQ0AIABB8mZqQQNJDQACQCAAQftlaiIBQQtLDQAgAUEIRw0BCwJAIABBy2ZqIgFBCEsNAEEBIAF0QZ8CcQ0BCwJAIABBomZqIgFBFEsNAEEBIAF0QY2A4ABxDQELIABB7mVqQSlJDQAgAEG9GkYNACAAQc4aRg0AIABBzWRqQQlJDQAgAEHmZGpBGEkNACAAQftkakESSQ0AIABBhmVqQQZJDQAgAEGsZWpBA0kNACAAQaFlakEDSQ0AAkAgAEHDZGoiA0EKTw0AQQEhAUH5ByADQf//A3F2QQFxDQQLIAJBsxxGDQAgAEH/Y2pBMEkNACAAQcBjakEHSQ0AAkAgAEH/YmoiAUEMSw0AQQEgAXRByyVxDQELIABBfHEiA0GUHUYNACAAQediakEHSQ0AAkAgAEHfYmoiAUEmTw0AQtfsm4D5BSABrYhCAYNQRQ0BCyAAQYBgakErSQ0AIABB+GBqQQVJDQAgAEG3YWpBJEkNACAAQXhxIgRBwB5GDQAgAEGAHkYNACADQdwdRg0AAkAgAEHBX2oiAUEoTw0AQoGA+MPHGCABrYhCAYNQRQ0BCyAAQZJfakEDSQ0AIABB4F5qQSZJDQAgAEGOIUYNACAAQYtfakENSQ0AIABBxyFGDQAgAEHNIUYNACAAQbZbakEESQ0AIABBsF5qQStJDQAgAEGEXmpBzQJJDQACQCAAQbBbaiIFQQlPDQBBASEBQf8CIAVB//8DcXZBAXENBAsgAEHOWmpBBEkNACAAQfBaakEhSQ0AIABB9lpqQQRJDQAgAEGmW2pBBEkNACAAQaBbakEpSQ0AAkAgAEHIWmoiBUEJTw0AQQEhAUH/AiAFQf//A3F2QQFxDQQLIABBgFFqQTRJDQAgAEGSUWpBA0kNACAAQaBRakENSQ0AIABBwFFqQRJJDQAgAEHgUWpBEkkNACAAQfJRakEESQ0AIABBgFJqQQ1JDQAgAEGSUmpBC0kNACAAQeBSakHLAEkNACAAQf9SakEaSQ0AIABBkVNqQRFJDQAgAEH/V2pB7ARJDQAgAEGIWGpBBkkNACAAQeBYakHWAEkNACAAQXBxIgVBgCdGDQAgAEHoWWpBwwBJDQAgAEHuWWpBBEkNACAAQahaakE5SQ0AIABBvlpqQQRJDQAgAEG4WmpBD0kNACAAQdcvRg0AIABB3C9GDQAgAEHgT2pB2QBJDQAgAEGATGpBF0kNACAAQdBMakEaSQ0AIABBgE1qQSxJDQAgAEGQTWpBBUkNACAAQbBNakEeSQ0AIABBgE5qQR9JDQAgAEHQTmpBxgBJDQAgAEGqMUYNBCAAQYBPakEpSQ0EIABBu0lqQQdJDQQgAEH7SWpBL0kNBCAAQac1Rg0EIABB4EtqQTVJDQQgAEGXRmpBBEkNBCAAQcNGakEDSQ0EIABB8EZqQStJDQQgAEGAR2pBCUkNBCAAQaZHakEkSQ0EIABBs0dqQQNJDQQgAEGASGpBJEkNBCAAQcZIakEsSQ0EIAJBrzdGDQQgAEH9SGpBHkkNBCAAQZJGaiIGQQlJDQEMAgtBASEBDAILQQEhAUGPAyAGQf//A3F2QQFxDQELIARB0D5GDQEgAEG4QWpBBkkNASAAQeBBakEmSQ0BIABB6EFqQQZJDQEgAEGARmpBwAFJDQEgAEGARGpBlgJJDQECQCAAQadBaiIBQQRLDQBBASABdEEVcQ0CCyAAQaFBakEfSQ0BIABBgEFqQTVJDQECQCAAQcpAaiIEQQlPDQBBASEBQf8CIARB//8DcXZBAXENAQsgAEGOQGpBA0kNASAAQaBAakENSQ0BIABBqkBqQQZJDQEgA0HQP0YNASAAQb5AakEDSQ0BIABBukBqQQdJDQEgAEGKQGpBB0kNASAAQfHAAEYNASAAQf/AAEYNASAAQfC+f2pBDUkNASAAQYLCAEYNASAAQYfCAEYNASAAQZXCAEYNASAAQfa9f2pBCkkNAQJAIABB6L1/aiIEQRFPDQBBASEBQb+gBSAEdkEBcQ0BCyAAQda9f2pBEEkNASADQbzCAEYNAQJAIABBu71/aiIEQQpPDQBBASEBQZ8EIARB//8DcXZBAXENAQsgAEGgp39qQYUBSQ0BIABB0Kd/akEvSQ0BIABBoL1/akEpSQ0BIABBgKh/akEvSQ0BAkAgAEGVpn9qIgRBCU8NAEEBIQFBjwMgBEH//wNxdkEBcQ0BCyAAQYCmf2pBJkkNASAAQafaAEYNASAAQa3aAEYNASAAQYC2fWpBjQJJDQEgAEGwtn1qQS5JDQEgAEGAwH1qQY0JSQ0BIABBgOR+akHwowFJDQEgAEGAmH9qQbYzSQ0BIAVB8OMARg0BIABB4Jx/akEbSQ0BIABBz51/akHeAEkNASAAQfudf2pBK0kNASADQfzhAEYNASAAQd+ef2pB2gBJDQEgAEHlnn9qQQVJDQEgAEG/n39qQdYASQ0BIABByJ9/akEFSQ0BIABBz59/akEFSQ0BIABB359/akEJSQ0BIABB+59/akEDSQ0BIABBqKR/akEHSQ0BIABBsKR/akEHSQ0BIABBuKR/akEHSQ0BIABBwKR/akEHSQ0BIABByKR/akEHSQ0BIABB0KR/akEHSQ0BIABB2KR/akEHSQ0BIABB4KR/akEHSQ0BIABBgKV/akEXSQ0BIABB79oARg0BIABB0KV/akE4SQ0BIABB/q59akEySQ0BIABBwK99akE0SQ0BIABB9K99akEXSQ0BIABB+a99akEESQ0BIABB/a99akEDSQ0BIABBibB9akELSQ0BIABB9bB9akEvSQ0BIABB3rF9akHnAEkNASAAQemxfWpBCUkNASAAQeCyfWpB0ABJDQEgAEGBs31qQR9JDQEgAEHAs31qQS9JDQEgAkGrzAJGDQEgBUGQzAJGDQECQCAAQY6ufWoiAkENTw0AQQEhAUG/NCACQf//A3F2QQFxDQELIABBoK19akEdSQ0BIABB9q19akEcSQ0BIABB0K19akEXSQ0BIABBvKt9akEISQ0BIABBwKt9akEDSQ0BIABBgKx9akEpSQ0BIABBhqx9akEFSQ0BIABBmqx9akEKSQ0BIABBoKx9akEFSQ0BIABBz9MCRg0BIABB/Kx9akEvSQ0BIABBgqt9akEySQ0BIABB+tQCRg0BIABBoKt9akEXSQ0BAkAgAEHPqn1qIgJBEk8NAEEBIQFBsb4KIAJ2QQFxDQELIABBgIp8akEHSQ0BIABBkIt8akHqAEkNASAAQYCOfGpB7gJJDQEgAEG10HxqQTFJDQEgAEHQ0HxqQRdJDQEgAEGAqH1qQaTXAEkNASAAQZCpfWpB8wBJDQEgAEGkqX1qQQpJDQEgAEHQqX1qQStJDQEgAEHYqX1qQQdJDQEgAEHgqX1qQQdJDQEgAEHvqX1qQQZJDQEgAEF3cUH/qX1qQQZJDQEgAEGOqn1qQQNJDQEgAEGlqn1qQQNJDQEgAEGgqn1qQQtJDQECQCAAQe2JfGoiAkELTw0AQQEhAUGfCCACQf//A3F2QQFxDQELIABB4Yl8akEKSQ0BIABB1ol8akENSQ0BAkAgAEHIiXxqIgJBDU8NAEEBIQFB3zYgAkH//wNxdkEBcQ0BCyAAQa6AfGpBBkkNASAAQbaAfGpBBkkNASAAQb6AfGpBBkkNASAAQZqBfGpB2QBJDQEgAEG/gXxqQRpJDQEgAEHfgXxqQRpJDQEgAEGKg3xqQYcBSQ0BIABBkIN8akEFSQ0BIABBkIR8akEMSQ0BIABB7oR8akE2SQ0BIABBsIV8akHAAEkNASAAQbqJfGpB7ABJDQFBASEBIABBrYh8akHrAkkNACAAQaaAfGpBA0kPCyABDwtBAQs1AAJAIABBgPgDcUGAsANHDQAgAEEKdEGA+D9xQQAoApygAS8BAkH/B3FyQYCABGohAAsgAAtoAQJ/QQEhAQJAAkAgAEFfaiICQQVLDQBBASACdEExcQ0BCyAAQfj/A3FBKEYNACAAQUZqQf//A3FBBkkNAAJAIABBpX9qIgJBA0sNACACQQFHDQELIABBhX9qQf//A3FBBEkhAQsgAQuNAQEFf0EAKAKcoAEhAEEAKAKgoAEhAQN/IABBAmohAgJAAkAgACABTw0AIAIvAQAiA0Gkf2oiBEEBTQ0BIAIhACADQXZqIgNBA0sNAiACIQAgAw4EAAICAAALQQAgAjYCnKABEBpBAA8LAkACQCAEDgIBAAELQQAgAjYCnKABQd0ADwsgAEEEaiEADAALC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC74XAgBBgAgLmBcAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAGQAAAAIAAAASAAAAAgAAAAEAAAACAAAADgAAAAMAAAANAAAAIwAAAHoAAABGAAAANAAAAAwBAAAcAAAABAAAADAAAAAwAAAAHwAAAA4AAAAdAAAABgAAACUAAAALAAAAHQAAAAMAAAAjAAAABQAAAAcAAAACAAAABAAAACsAAACdAAAAEwAAACMAAAAFAAAAIwAAAAUAAAAnAAAACQAAADMAAACdAAAANgEAAAoAAAAVAAAACwAAAAcAAACZAAAABQAAAAMAAAAAAAAAAgAAACsAAAACAAAAAQAAAAQAAAAAAAAAAwAAABYAAAALAAAAFgAAAAoAAAAeAAAAQgAAABIAAAACAAAAAQAAAAsAAAAVAAAACwAAABkAAABHAAAANwAAAAcAAAABAAAAQQAAAAAAAAAQAAAAAwAAAAIAAAACAAAAAgAAABwAAAArAAAAHAAAAAQAAAAcAAAAJAAAAAcAAAACAAAAGwAAABwAAAA1AAAACwAAABUAAAALAAAAEgAAAA4AAAARAAAAbwAAAEgAAAA4AAAAMgAAAA4AAAAyAAAADgAAACMAAABdAQAAKQAAAAcAAAABAAAATwAAABwAAAALAAAAAAAAAAkAAAAVAAAAawAAABQAAAAcAAAAFgAAAA0AAAA0AAAATAAAACwAAAAhAAAAGAAAABsAAAAjAAAAHgAAAAAAAAADAAAAAAAAAAkAAAAiAAAABAAAAAAAAAANAAAALwAAAA8AAAADAAAAFgAAAAAAAAACAAAAAAAAACQAAAARAAAAAgAAABgAAABVAAAABgAAAAIAAAAAAAAAAgAAAAMAAAACAAAADgAAAAIAAAAJAAAACAAAAC4AAAAnAAAABwAAAAMAAAABAAAAAwAAABUAAAACAAAABgAAAAIAAAABAAAAAgAAAAQAAAAEAAAAAAAAABMAAAAAAAAADQAAAAQAAACfAAAANAAAABMAAAADAAAAFQAAAAIAAAAfAAAALwAAABUAAAABAAAAAgAAAAAAAAC5AAAALgAAACoAAAADAAAAJQAAAC8AAAAVAAAAAAAAADwAAAAqAAAADgAAAAAAAABIAAAAGgAAAOYAAAArAAAAdQAAAD8AAAAgAAAABwAAAAMAAAAAAAAAAwAAAAcAAAACAAAAAQAAAAIAAAAXAAAAEAAAAAAAAAACAAAAAAAAAF8AAAAHAAAAAwAAACYAAAARAAAAAAAAAAIAAAAAAAAAHQAAAAAAAAALAAAAJwAAAAgAAAAAAAAAFgAAAAAAAAAMAAAALQAAABQAAAAAAAAAIwAAADgAAAAIAQAACAAAAAIAAAAkAAAAEgAAAAAAAAAyAAAAHQAAAHEAAAAGAAAAAgAAAAEAAAACAAAAJQAAABYAAAAAAAAAGgAAAAUAAAACAAAAAQAAAAIAAAAfAAAADwAAAAAAAABIAQAAEgAAAL4AAAAAAAAAUAAAAJkDAABnAAAAbgAAABIAAADDAAAAvQoAAC4EAADSDwAARgIAALohAAA4AgAACAAAAB4AAAByAAAAHQAAABMAAAAvAAAAEQAAAAMAAAAgAAAAFAAAAAYAAAASAAAAsQIAAD8AAACBAAAASgAAAAYAAAAAAAAAQwAAAAwAAABBAAAAAQAAAAIAAAAAAAAAHQAAAPcXAAAJAAAA1QQAACsAAAAIAAAA+CIAAB4BAAAyAAAAAgAAABIAAAADAAAACQAAAIsBAAAFCQAAagAAAAYAAAAMAAAABAAAAAgAAAAIAAAACQAAAGcXAABUAAAAAgAAAEYAAAACAAAAAQAAAAMAAAAAAAAAAwAAAAEAAAADAAAAAwAAAAIAAAALAAAAAgAAAAAAAAACAAAABgAAAAIAAABAAAAAAgAAAAMAAAADAAAABwAAAAIAAAAGAAAAAgAAABsAAAACAAAAAwAAAAIAAAAEAAAAAgAAAAAAAAAEAAAABgAAAAIAAABTAQAAAwAAABgAAAACAAAAGAAAAAIAAAAeAAAAAgAAABgAAAACAAAAHgAAAAIAAAAYAAAAAgAAAB4AAAACAAAAGAAAAAIAAAAeAAAAAgAAABgAAAACAAAABwAAADUJAAAsAAAACwAAAAYAAAARAAAAAAAAAHIBAAArAAAAFQUAAMQAAAA8AAAAQwAAAAgAAAAAAAAAtQQAAAMAAAACAAAAGgAAAAIAAAABAAAAAgAAAAAAAAADAAAAAAAAAAIAAAAJAAAAAgAAAAMAAAACAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAFAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAgAAAAIAAAABAAAAAgAAAAAAAAADAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAAAAAAMAAAADAAAAAgAAAAYAAAACAAAAAwAAAAIAAAADAAAAAgAAAAAAAAACAAAACQAAAAIAAAAQAAAABgAAAAIAAAACAAAABAAAAAIAAAAQAAAARREAAN2mAAAjAAAANBAAAAwAAADdAAAAAwAAAIEWAAAPAAAAMB0AACAMAAAdAgAA4wUAAEoTAAD9AQAAAAAAAOMAAAAAAAAAlgAAAAQAAAAmAQAACQAAAFgFAAACAAAAAgAAAAEAAAAGAAAAAwAAACkAAAACAAAABQAAAAAAAACmAAAAAQAAAD4CAAADAAAACQAAAAkAAAByAQAAAQAAAJoAAAAKAAAAsAAAAAIAAAA2AAAADgAAACAAAAAJAAAAEAAAAAMAAAAuAAAACgAAADYAAAAJAAAABwAAAAIAAAAlAAAADQAAAAIAAAAJAAAABgAAAAEAAAAtAAAAAAAAAA0AAAACAAAAMQAAAA0AAAAJAAAAAwAAAAIAAAALAAAAUwAAAAsAAAAHAAAAAAAAAKEAAAALAAAABgAAAAkAAAAHAAAAAwAAADgAAAABAAAAAgAAAAYAAAADAAAAAQAAAAMAAAACAAAACgAAAAAAAAALAAAAAQAAAAMAAAAGAAAABAAAAAQAAADBAAAAEQAAAAoAAAAJAAAABQAAAAAAAABSAAAAEwAAAA0AAAAJAAAA1gAAAAYAAAADAAAACAAAABwAAAABAAAAUwAAABAAAAAQAAAACQAAAFIAAAAMAAAACQAAAAkAAABUAAAADgAAAAUAAAAJAAAA8wAAAA4AAACmAAAACQAAAEcAAAAFAAAAAgAAAAEAAAADAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAANAAAACQAAAHgAAAAGAAAAAwAAAAYAAAAEAAAAAAAAAB0AAAAJAAAAKQAAAAYAAAACAAAAAwAAAAkAAAAAAAAACgAAAAoAAAAvAAAADwAAAJYBAAAHAAAAAgAAAAcAAAARAAAACQAAADkAAAAVAAAAAgAAAA0AAAB7AAAABQAAAAQAAAAAAAAAAgAAAAEAAAACAAAABgAAAAIAAAAAAAAACQAAAAkAAAAxAAAABAAAAAIAAAABAAAAAgAAAAQAAAAJAAAACQAAAEoBAAADAAAAaksAAAkAAACHAAAABAAAADwAAAAGAAAAGgAAAAkAAAD2AwAAAAAAAAIAAAA2AAAACAAAAAMAAABSAAAAAAAAAAwAAAABAAAArEwAAAEAAADHFAAABAAAAAQAAAAFAAAACQAAAAcAAAADAAAABgAAAB8AAAADAAAAlQAAAAIAAACKBQAAMQAAAAECAAA2AAAABQAAADEAAAAJAAAAAAAAAA8AAAAAAAAAFwAAAAQAAAACAAAADgAAAFEFAAAGAAAAAgAAABAAAAADAAAABgAAAAIAAAABAAAAAgAAAAQAAAAGAQAABgAAAAoAAAAJAAAAowEAAA0AAADXBQAABgAAAG4AAAAGAAAABgAAAAkAAACXEgAACQAAAAcFDADvAAAAAEGYHwsYMIwAAAEAAAACAAAAAwAAAAAEAADQHwAA","function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(A);Q=E})())} \ No newline at end of file diff --git a/node_modules/cjs-module-lexer/dist/lexer.mjs b/node_modules/cjs-module-lexer/dist/lexer.mjs deleted file mode 100644 index 73a06312115e0..0000000000000 --- a/node_modules/cjs-module-lexer/dist/lexer.mjs +++ /dev/null @@ -1,2 +0,0 @@ -/* cjs-module-lexer 0.6.0 */ -const A=new Set(["implements","interface","let","package","private","protected","public","static","yield","enum"]);let Q;const B=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(g,I="@"){if(!Q)throw new Error("Not initialized");const D=g.length+1,N=(Q.__heap_base.value||Q.__heap_base)+4*D-Q.memory.buffer.byteLength;N>0&&Q.memory.grow(Math.ceil(N/65536));const k=Q.sa(D);if((B?C:E)(g,new Uint16Array(Q.memory.buffer,k,D)),!Q.parseCJS(k,g.length,0,0))throw Object.assign(new Error(`Parse error ${I}${Q.e()}:${g.slice(0,Q.e()).split("\n").length}:${Q.e()-g.lastIndexOf("\n",Q.e()-1)}`),{idx:Q.e()});let w=new Set,o=new Set;for(;Q.rre();)o.add(g.slice(Q.res(),Q.ree()));for(;Q.re();){let B=g.slice(Q.es(),Q.ee());A.has(B)||w.add(B)}return{exports:[...w],reexports:[...o]}}function E(A,Q){const B=A.length;let E=0;for(;E>>8}}function C(A,Q){const B=A.length;let E=0;for(;E{const A=await WebAssembly.compile((B="AGFzbQEAAAABhAEPYAJ/fwBgAABgAX8Bf2AAAX9gBX9/f39/AX9gAX8AYAZ/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAR/f39/AX9gAn9/AX8DPTwCAwMDAwMDAwAAAQQCAgUGBQEBAQICAgIBAQEBBQEBBwECCAMCAgIJBAIBCgILDAYNCA4HAgICAgICAwkEBQFwAQQEBQMBAAEGDwJ/AUGwmAILfwBBsJgCCwdNCwZtZW1vcnkCAAJzYQAAAWUAAQJlcwACAmVlAAMDcmVzAAQDcmVlAAUCcmUABgNycmUABwhwYXJzZUNKUwALC19faGVhcF9iYXNlAwEJCQEAQQELAwgJCgqElgE8YAEBf0EAKAKYHyIBIABBAXRqIgBBADsBAEEAIABBAmoiADYCyB9BACAANgLMH0EAQQA2ArAfQQBBADYCuB9BAEEANgK0H0EAQQA2ArwfQQBBADYCxB9BAEEANgLAHyABCwgAQQAoAtAfCxUAQQAoArQfKAIAQQAoApgfa0EBdQsVAEEAKAK0HygCBEEAKAKYH2tBAXULFQBBACgCwB8oAgBBACgCmB9rQQF1CxUAQQAoAsAfKAIEQQAoApgfa0EBdQslAQF/QQBBACgCtB8iAEEIakGwHyAAGygCACIANgK0HyAAQQBHCyUBAX9BAEEAKALAHyIAQQhqQbwfIAAbKAIAIgA2AsAfIABBAEcLSAEBf0EAKAK4HyICQQhqQbAfIAIbQQAoAswfIgI2AgBBACACNgK4H0EAIAJBDGo2AswfIAJBADYCCCACIAE2AgQgAiAANgIAC0gBAX9BACgCxB8iAkEIakG8HyACG0EAKALMHyICNgIAQQAgAjYCxB9BACACQQxqNgLMHyACQQA2AgggAiABNgIEIAIgADYCAAsSAEEAQQA2ArwfQQBBADYCxB8L5A0BAX9BACABNgLgP0EAIAA2ApgfAkAgAkUNAEEAIAI2ApwfCwJAIANFDQBBACADNgKgHwtBAEH//wM7Aeg/QQBBgMAANgKAYEEAQZDgADYCkKABQQBB4B82ApSgAUEAQQAoAqgfNgLsP0EAIABBfmoiAjYCnKABQQAgAiABQQF0aiIDNgKgoAFBAEEAOwHmP0EAQQA7AeQ/QQBBADoA8D9BAEEANgLQH0EAQQA6ANQfQQBBADoAmKABAkACQCAALwEAQSNHDQAgAC8BAkEhRw0AQQEhAiABQQJGDQFBACAAQQJqNgKcoAEgAEEEaiEAAkADQCAAIgJBfmogA08NASACQQJqIQAgAi8BAEF2aiIBQQNLDQAgAQ4EAQAAAQELC0EAIAI2ApygAQsDQEEAIAJBAmoiADYCnKABAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAiADTw0AAkAgAC8BACIBQXdqIgNBF0sNAEEBIAN0QZ+AgARxDRkLAkACQAJAQQAvAeY/IgMNACABQaF/aiIFQQ5NDQQgAUFZaiIFQQhNDQUgAUGFf2oiBUECTQ0GIAFBIkYNAiABQc8ARg0BIAFB8gBHDRYCQEEAEAxFDQAgABANRQ0AIAIQDgtBAEEAKAKcoAE2Auw/DBsLIAFBWWoiBUEITQ0GIAFBoH9qIgVBBU0NByABQYV/aiIFQQJNDQggAUEiRg0BIAFBzwBGDQAgAUHtAEcNFQwUCyACQQRqQeIAQeoAQeUAQeMAQfQAEA9FDRQgABANRQ0UIANFEBAMFAsQEQwTC0EALwHoP0H//wNGQQAvAeY/RXFBAC0A1B9FcQ8LIAUODxIFEREOEQ8RERETEREREBILIAUOCQYMCBAQEBAQBQYLIAUOAwkPBwkLIAUOCQQKCQ4ODg4OAwQLIAUOBgENDQoNCwELIAUOAwYMAwYLQQAvAeg/Qf7/A0YNAwwECwJAAkAgAi8BBCICQSpGDQAgAkEvRw0BEBIMEQsQEwwQCwJAAkACQAJAQQAoAuw/IgAvAQAiAhAURQ0AIAJBVWoiA0EDSw0CAkACQAJAIAMOBAEFAgABCyAAQX5qLwEAQVBqQf//A3FBCkkNAwwECyAAQX5qLwEAQStGDQIMAwsgAEF+ai8BAEEtRg0BDAILAkACQCACQf0ARg0AIAJBL0YNASACQSlHDQJBACgCkKABIANBAnRqKAIAEBVFDQIMAwtBACgCkKABIANBAnRqKAIAEBYNAiADQbCgAWotAABFDQEMAgtBAC0A8D8NAQsgABAXIQMgAkUNAEEBIQIgA0UNAQsQGEEAIQILQQAgAjoA8D8MCgsQGQwJC0EAIANBf2oiADsB5j8CQCADQQAvAeg/IgJHDQBBAEEALwHkP0F/aiICOwHkP0EAQQAoAoBgIAJB//8DcUEBdGovAQA7Aeg/DAILIAJB//8DRg0IIABB//8DcSACTw0ICxAaQQAhAgwOCxAbDAYLIANBsKABakEALQCYoAE6AABBACADQQFqOwHmP0EAKAKQoAEgA0ECdGpBACgC7D82AgBBAEEAOgCYoAEMBQtBACADQX9qOwHmPwwEC0EAIANBAWo7AeY/QQAoApCgASADQQJ0akEAKALsPzYCAAwDCyAAEA1FDQIgAi8BBEHsAEcNAiACLwEGQeEARw0CIAIvAQhB8wBHDQIgAi8BCkHzAEcNAgJAAkAgAi8BDCIDQXdqIgJBF0sNAEEBIAJ0QZ+AgARxDQELIANBoAFHDQMLQQBBAToAmKABDAILIAJBBGpB+ABB8ABB7wBB8gBB9AAQD0UNASAAEA1FDQECQCACLwEOQfMARw0AQQAQHAwCCyADDQEQHQwBCyACQQRqQe8AQeQAQfUAQewAQeUAEA9FDQAgABANRQ0AEB4LQQBBACgCnKABNgLsPwwECyACQQRqQd8AQeUAQfgAQfAAQe8AQfIAQfQAEB9FDQICQCAAEA0NACACLwEAQS5HDQMLQQAgAkESaiIANgKcoAECQCACLwESIgNB0wBHDQAgAi8BFEH0AEcNAyACLwEWQeEARw0DIAIvARhB8gBHDQNBACACQRpqIgA2ApygASACLwEaIQMLIANB//8DcUEoRw0CQQAoApCgAUEAKALsPzYCAEEAQQE7AeY/QQBBACgCnKABIgJBAmoiADYCnKABIAIvAQJB8gBHDQJBAhAMGgwBCyACQQRqQe0AQfAAQe8AQfIAQfQAEA9FDQEgABANRQ0BECALQQAoApygASEAC0EAIAA2Auw/C0EAKAKgoAEhA0EAKAKcoAEhAgwACwsgAgvrAgEEf0EAIQECQEEAKAKcoAEiAkECakHlAEHxAEH1AEHpAEHyAEHlABAiRQ0AQQAhAUEAIAJBDmo2ApygAQJAECNBKEcNAEEAQQAoApygAUECajYCnKABECMhA0EAKAKcoAFBAmohBAJAIANBIkYNACADQSdHDQEQGUEAQQAoApygASIDQQJqNgKcoAEQI0EpRw0BAkAgAEF/aiIBQQFLDQACQAJAIAEOAgEAAQsgBCADQQAoAqAfEQAAQQEPCyAEIANBACgCoB8RAABBAQ8LQQAoApSgASAENgIAQQAoApSgASADNgIEQQEPCxARQQBBACgCnKABIgNBAmo2ApygARAjQSlHDQACQCAAQX9qIgFBAUsNAAJAAkAgAQ4CAQABCyAEIANBACgCoB8RAABBAQ8LIAQgA0EAKAKgHxEAAEEBDwtBACgClKABIAQ2AgBBACgClKABIAM2AgRBAQ8LQQAgAjYCnKABCyABCx0AAkBBACgCmB8gAEcNAEEBDwsgAEF+ai8BABAhC/4CAQR/QQAoApgfIQECQANAIABBfmohAiAALwEAIgNBIEcNASAAIAFLIQQgAiEAIAQNAAsLAkAgA0E9Rw0AAkADQCACQX5qIQAgAi8BAEEgRw0BIAIgAUshBCAAIQIgBA0ACwsgAEECaiECIABBBGohA0EAIQQCQANAIAIQJCEAIAIgAU0NASAARQ0BIABB3ABGDQIgABAlRQ0BIAJBfkF8IABBgIAESRtqIQIgABAmIQQMAAsLIARBAXFFDQAgAi8BAEEgRw0AQQAoApSgASIEQQAoAqwfRg0AIAQgAzYCDCAEIAJBAmo2AgggAkF+aiEAQSAhAgJAA0AgAEECaiABTQ0BIAJB//8DcUEgRw0BIAAvAQAhAiAAQX5qIQAMAAsLIAJB//8DcUGOf2oiAkECSw0AAkACQAJAIAIOAwADAQALIABB9gBB4QAQJw0BDAILIABB7ABB5QAQJw0AIABB4wBB7wBB7gBB8wAQKEUNAQtBACAEQRBqNgKUoAELCz8BAX9BACEGAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUYhBgsgBgvSIQEIf0EAQQAoApygASIBQQxqNgKcoAEgAUEKaiEBAkAQI0EuRw0AQQBBACgCnKABQQJqNgKcoAECQBAjIgJB5ABHDQBBACgCnKABIgBBAmpB5QBB5gBB6QBB7gBB5QBB0ABB8gBB7wBB8ABB5QBB8gBB9ABB+QAQK0UNAUEAIABBHGo2ApygASAAQRpqIQEQI0EoRw0BQQBBACgCnKABQQJqNgKcoAEQIxAsRQ0BECNBLEcNAUEAQQAoApygAUECajYCnKABAkAQIyIAQSdGDQAgAEEiRw0CC0EAQQAoApygASICQQJqIgM2ApygASACLwECEClFDQFBACgCnKABIgIvAQAgAEcNAUEAIAJBAmo2ApygARAjQSxHDQFBAEEAKAKcoAFBAmo2ApygARAjQfsARw0BQQBBACgCnKABQQJqNgKcoAECQBAjIgBB5QBHDQBBACgCnKABIgBBAmpB7gBB9QBB7QBB5QBB8gBB4QBB4gBB7ABB5QAQLUUNAkEAIABBFGo2ApygARAjQTpHDQJBAEEAKAKcoAFBAmo2ApygARAjQfQARw0CQQAoApygASIALwECQfIARw0CIAAvAQRB9QBHDQIgAC8BBkHlAEcNAkEAIABBCGo2ApygARAjQSxHDQJBAEEAKAKcoAFBAmo2ApygARAjIQALAkAgAEHnAEYNACAAQfYARw0CQQAoApygASIALwECQeEARw0CIAAvAQRB7ABHDQIgAC8BBkH1AEcNAiAALwEIQeUARw0CQQAgAEEKajYCnKABECNBOkcNAkEAQQAoApygAUECajYCnKABIAMgAkEAKAKcHxEAAAwCC0EAKAKcoAEiAC8BAkHlAEcNASAALwEEQfQARw0BQQAgAEEGajYCnKABAkAQIyIAQTpHDQBBAEEAKAKcoAFBAmo2ApygARAjQeYARw0CQQAoApygASIAQQJqQfUAQe4AQeMAQfQAQekAQe8AQe4AEB9FDQJBACAAQRBqIgA2ApygAQJAECMiBEEoRg0AIABBACgCnKABRg0DIAQQKUUNAwsQIyEACyAAQShHDQFBAEEAKAKcoAFBAmo2ApygARAjQSlHDQFBAEEAKAKcoAFBAmo2ApygARAjQfsARw0BQQBBACgCnKABQQJqNgKcoAEQI0HyAEcNAUEAKAKcoAEiAEECakHlAEH0AEH1AEHyAEHuABAPRQ0BQQAgAEEMajYCnKABECMQKUUNAQJAAkACQBAjIgBB2wBGDQAgAEEuRw0CQQBBACgCnKABQQJqNgKcoAEQIxApDQEMBAtBAEEAKAKcoAFBAmo2ApygAQJAAkAQIyIAQSJGDQAgAEEnRw0FEBkMAQsQEQtBAEEAKAKcoAFBAmo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAELECMhAAsCQCAAQTtHDQBBAEEAKAKcoAFBAmo2ApygARAjIQALIABB/QBHDQFBAEEAKAKcoAFBAmo2ApygARAjQf0ARw0BQQBBACgCnKABQQJqNgKcoAEQI0EpRw0BIAMgAkEAKAKcHxEAAA8LIAJB6wBHDQAgAEUNAEEAKAKcoAEiAC8BAkHlAEcNACAALwEEQfkARw0AIAAvAQZB8wBHDQAgAEEGaiEBQQAgAEEIajYCnKABECNBKEcNAEEAQQAoApygAUECajYCnKABECMhAEEAKAKcoAEhAiAAEClFDQBBACgCnKABIQAQI0EpRw0AQQBBACgCnKABIgFBAmo2ApygARAjQS5HDQBBAEEAKAKcoAFBAmo2ApygARAjQeYARw0AQQAoApygASIDQQJqQe8AQfIAQcUAQeEAQeMAQegAECJFDQBBACADQQ5qNgKcoAEQIyEDQQAoApygASIEQX5qIQEgA0EoRw0AQQAgBEECajYCnKABECNB5gBHDQBBACgCnKABIgNBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQH0UNAEEAIANBEGo2ApygARAjQShHDQBBAEEAKAKcoAFBAmo2ApygARAjIQNBACgCnKABIQQgAxApRQ0AQQAoApygASEDECNBKUcNAEEAQQAoApygAUECajYCnKABECNB+wBHDQBBAEEAKAKcoAFBAmo2ApygARAjQekARw0AQQAoApygASIFLwECQeYARw0AQQAgBUEEajYCnKABECNBKEcNAEEAQQAoApygAUECajYCnKABECMaQQAoApygASIFIAQgAyAEayIDEDsNAEEAIAUgA0EBdSIGQQF0ajYCnKABAkACQAJAECMiBUEhRg0AIAVBPUcNA0EAKAKcoAEiBS8BAkE9Rw0DIAUvAQRBPUcNA0EAIAVBBmo2ApygAQJAECMiBUEnRg0AIAVBIkcNBAtBACgCnKABIgdBAmpB5ABB5QBB5gBB4QBB9QBB7ABB9AAQH0UNA0EAIAdBEGo2ApygARAjIAVHDQNBAEEAKAKcoAFBAmo2ApygARAjQfwARw0DQQAoApygASIFLwECQfwARw0DQQAgBUEEajYCnKABECMaQQAoApygASIFIAQgAxA7DQNBACAFIAZBAXRqNgKcoAEQI0E9Rw0DQQAoApygASIFLwECQT1HDQMgBS8BBEE9Rw0DQQAgBUEGajYCnKABAkAQIyIFQSdGDQAgBUEiRw0EC0EAKAKcoAEiB0ECakHfAEHfAEHlAEHzAEHNAEHvAEHkAEH1AEHsAEHlABAuRQ0DQQAgB0EWajYCnKABECMgBUcNA0EAQQAoApygAUECajYCnKABECNBKUcNA0EAQQAoApygAUECajYCnKABECNB8gBHDQNBACgCnKABIgVBAmpB5QBB9ABB9QBB8gBB7gAQD0UNA0EAIAVBDGo2ApygARAjQTtGDQEMAgtBACgCnKABIgUvAQJBPUcNAiAFLwEEQT1HDQJBACAFQQZqNgKcoAECQBAjIgVBJ0YNACAFQSJHDQMLQQAoApygASIHQQJqQeQAQeUAQeYAQeEAQfUAQewAQfQAEB9FDQJBACAHQRBqNgKcoAEQIyAFRw0CQQBBACgCnKABQQJqNgKcoAEQI0EpRw0CC0EAQQAoApygAUECajYCnKABCyAAIAJrIgVBAXUhBwJAECMiAEHpAEcNAEHpACEAQQAoApygASIILwECQeYARw0AQQAgCEEEajYCnKABECNBKEcNAUEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQFBACAAIAZBAXRqNgKcoAEQI0HpAEcNAUEAKAKcoAEiAC8BAkHuAEcNASAALwEEQSBHDQFBACAAQQZqNgKcoAEQIxAsRQ0BECNBJkcNAUEAKAKcoAEiAC8BAkEmRw0BQQAgAEEEajYCnKABECMQLEUNARAjQdsARw0BQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNAUEAIAAgBkEBdGo2ApygARAjQd0ARw0BQQBBACgCnKABQQJqNgKcoAEQI0E9Rw0BQQAoApygASIALwECQT1HDQEgAC8BBEE9Rw0BQQAgAEEGajYCnKABECMaQQAoApygASIAIAIgBRA7DQFBACAAIAdBAXRqNgKcoAEQI0HbAEcNAUEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQFBACAAIAZBAXRqNgKcoAEQI0HdAEcNAUEAQQAoApygAUECajYCnKABECNBKUcNAUEAQQAoApygAUECajYCnKABECNB8gBHDQFBACgCnKABIgBBAmpB5QBB9ABB9QBB8gBB7gAQD0UNAUEAIABBDGo2ApygAQJAECNBO0cNAEEAQQAoApygAUECajYCnKABCxAjIQALAkACQAJAIAAQLEUNABAjQdsARw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNA0EAIAAgBkEBdGo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAEQI0E9Rw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgAiAFEDsNA0EAIAAgB0EBdGo2ApygARAjQdsARw0DQQBBACgCnKABQQJqNgKcoAEQIxpBACgCnKABIgAgBCADEDsNA0EAIAAgBkEBdGo2ApygARAjQd0ARw0DQQBBACgCnKABQQJqNgKcoAEQIyIAQTtHDQJBAEEAKAKcoAFBAmo2ApygAQwBCyAAQc8ARw0CQQAoApygASIAQQJqQeIAQeoAQeUAQeMAQfQAEA9FDQJBACAAQQxqNgKcoAEQI0EuRw0CQQBBACgCnKABQQJqNgKcoAEQI0HkAEcNAkEAKAKcoAEiAEECakHlAEHmAEHpAEHuAEHlAEHQAEHyAEHvAEHwAEHlAEHyAEH0AEH5ABArRQ0CQQAgAEEcajYCnKABECNBKEcNAkEAQQAoApygAUECajYCnKABECMQLEUNAhAjQSxHDQJBAEEAKAKcoAFBAmo2ApygARAjGkEAKAKcoAEiACAEIAMQOw0CQQAgACAGQQF0ajYCnKABECNBLEcNAkEAQQAoApygAUECajYCnKABECNB+wBHDQJBAEEAKAKcoAFBAmo2ApygARAjQeUARw0CQQAoApygASIAQQJqQe4AQfUAQe0AQeUAQfIAQeEAQeIAQewAQeUAEC1FDQJBACAAQRRqNgKcoAEQI0E6Rw0CQQBBACgCnKABQQJqNgKcoAEQIyEIQQAoApygASEAAkAgCEH0AEYNACAALwECQfIARw0DIAAvAQRB9QBHDQMgAC8BBkHlAEcNAwtBACAAQQhqNgKcoAEQI0EsRw0CQQBBACgCnKABQQJqNgKcoAEQI0HnAEcNAkEAKAKcoAEiAC8BAkHlAEcNAiAALwEEQfQARw0CQQAgAEEGajYCnKABECNBOkcNAkEAQQAoApygAUECajYCnKABECNB5gBHDQJBACgCnKABIgBBAmpB9QBB7gBB4wBB9ABB6QBB7wBB7gAQH0UNAkEAIABBEGo2ApygARAjQShHDQJBAEEAKAKcoAFBAmo2ApygARAjQSlHDQJBAEEAKAKcoAFBAmo2ApygARAjQfsARw0CQQBBACgCnKABQQJqNgKcoAEQI0HyAEcNAkEAKAKcoAEiAEECakHlAEH0AEH1AEHyAEHuABAPRQ0CQQAgAEEMajYCnKABECMaQQAoApygASIAIAIgBRA7DQJBACAAIAdBAXRqNgKcoAEQI0HbAEcNAkEAQQAoApygAUECajYCnKABECMaQQAoApygASIAIAQgAxA7DQJBACAAIAZBAXRqNgKcoAEQI0HdAEcNAkEAQQAoApygAUECajYCnKABAkAQIyIAQTtHDQBBAEEAKAKcoAFBAmo2ApygARAjIQALIABB/QBHDQJBAEEAKAKcoAFBAmo2ApygARAjQf0ARw0CQQBBACgCnKABQQJqNgKcoAEQI0EpRw0CQQBBACgCnKABQQJqNgKcoAEQIyIAQTtHDQFBAEEAKAKcoAFBAmo2ApygAQsQIyEACyAAQf0ARw0AQQBBACgCnKABQQJqNgKcoAEQI0EpRw0AQQAoApSgASEEQeAfIQADQAJAAkAgBCAARg0AIAcgAEEMaigCACAAQQhqKAIAIgNrQQF1Rw0BIAIgAyAFEDsNASAAKAIAIABBBGooAgBBACgCoB8RAABBACABNgKcoAELDwsgAEEQaiEADAALC0EAIAE2ApygAQuVAQEEf0EAKAKcoAEhAEEAKAKgoAEhAQJAA0AgACICQQJqIQAgAiABTw0BAkAgAC8BACIDQdwARg0AAkAgA0F2aiICQQNNDQAgA0EiRw0CQQAgADYCnKABDwsgAg4EAgEBAgILIAJBBGohACACLwEEQQ1HDQAgAkEGaiAAIAIvAQZBCkYbIQAMAAsLQQAgADYCnKABEBoLUwEEf0EAKAKcoAFBAmohAEEAKAKgoAEhAQJAA0AgACICQX5qIAFPDQEgAkECaiEAIAIvAQBBdmoiA0EDSw0AIAMOBAEAAAEBCwtBACACNgKcoAELfAECf0EAQQAoApygASIAQQJqNgKcoAEgAEEGaiEAQQAoAqCgASEBA0ACQAJAAkAgAEF8aiABTw0AIABBfmovAQBBKkcNAiAALwEAQS9HDQJBACAAQX5qNgKcoAEMAQsgAEF+aiEAC0EAIAA2ApygAQ8LIABBAmohAAwACwt1AQF/AkACQCAAQV9qIgFBBUsNAEEBIAF0QTFxDQELIABBRmpB//8DcUEGSQ0AIABBWGpB//8DcUEHSSAAQSlHcQ0AAkAgAEGlf2oiAUEDSw0AIAEOBAEAAAEBCyAAQf0ARyAAQYV/akH//wNxQQRJcQ8LQQELPQEBf0EBIQECQCAAQfcAQegAQekAQewAQeUAEC8NACAAQeYAQe8AQfIAEDANACAAQekAQeYAECchAQsgAQutAQEDf0EBIQECQAJAAkACQAJAAkACQCAALwEAIgJBRWoiA0EDTQ0AIAJBm39qIgNBA00NASACQSlGDQMgAkH5AEcNAiAAQX5qQeYAQekAQe4AQeEAQewAQewAEDEPCyADDgQCAQEFAgsgAw4EAgAAAwILQQAhAQsgAQ8LIABBfmpB5QBB7ABB8wAQMA8LIABBfmpB4wBB4QBB9ABB4wAQKA8LIABBfmovAQBBPUYL7QMBAn9BACEBAkAgAC8BAEGcf2oiAkETSw0AAkACQAJAAkACQAJAAkACQCACDhQAAQIICAgICAgIAwQICAUIBggIBwALIABBfmovAQBBl39qIgJBA0sNBwJAAkAgAg4EAAkJAQALIABBfGpB9gBB7wAQJw8LIABBfGpB+QBB6QBB5QAQMA8LIABBfmovAQBBjX9qIgJBAUsNBgJAAkAgAg4CAAEACwJAIABBfGovAQAiAkHhAEYNACACQewARw0IIABBempB5QAQMg8LIABBempB4wAQMg8LIABBfGpB5ABB5QBB7ABB5QAQKA8LIABBfmovAQBB7wBHDQUgAEF8ai8BAEHlAEcNBQJAIABBemovAQAiAkHwAEYNACACQeMARw0GIABBeGpB6QBB7gBB8wBB9ABB4QBB7gAQMQ8LIABBeGpB9ABB+QAQJw8LQQEhASAAQX5qIgBB6QAQMg0EIABB8gBB5QBB9ABB9QBB8gAQLw8LIABBfmpB5AAQMg8LIABBfmpB5ABB5QBB4gBB9QBB5wBB5wBB5QAQMw8LIABBfmpB4QBB9wBB4QBB6QAQKA8LAkAgAEF+ai8BACICQe8ARg0AIAJB5QBHDQEgAEF8akHuABAyDwsgAEF8akH0AEHoAEHyABAwIQELIAELhwEBA38DQEEAQQAoApygASIAQQJqIgE2ApygAQJAAkACQCAAQQAoAqCgAU8NACABLwEAIgFBpX9qIgJBAU0NAgJAIAFBdmoiAEEDTQ0AIAFBL0cNBAwCCyAADgQAAwMAAAsQGgsPCwJAAkAgAg4CAQABC0EAIABBBGo2ApygAQwBCxA6GgwACwuVAQEEf0EAKAKcoAEhAEEAKAKgoAEhAQJAA0AgACICQQJqIQAgAiABTw0BAkAgAC8BACIDQdwARg0AAkAgA0F2aiICQQNNDQAgA0EnRw0CQQAgADYCnKABDwsgAg4EAgEBAgILIAJBBGohACACLwEEQQ1HDQAgAkEGaiAAIAIvAQZBCkYbIQAMAAsLQQAgADYCnKABEBoLOAEBf0EAQQE6ANQfQQAoApygASEAQQBBACgCoKABQQJqNgKcoAFBACAAQQAoApgfa0EBdTYC0B8LzgEBBX9BACgCnKABIQBBACgCoKABIQEDQCAAIgJBAmohAAJAAkAgAiABTw0AIAAvAQAiA0Gkf2oiBEEETQ0BIANBJEcNAiACLwEEQfsARw0CQQBBAC8B5D8iAEEBajsB5D9BACgCgGAgAEEBdGpBAC8B6D87AQBBACACQQRqNgKcoAFBAEEALwHmP0EBaiIAOwHoP0EAIAA7AeY/DwtBACAANgKcoAEQGg8LAkACQCAEDgUBAgICAAELQQAgADYCnKABDwsgAkEEaiEADAALC9ICAQN/QQBBACgCnKABIgFBDmo2ApygAQJAAkACQBAjIgJB2wBGDQAgAkE9Rg0BIAJBLkcNAkEAQQAoApygAUECajYCnKABECMhAkEAKAKcoAEhACACEClFDQJBACgCnKABIQIQI0E9Rw0CIAAgAkEAKAKcHxEAAA8LQQBBACgCnKABQQJqNgKcoAECQBAjIgJBJ0YNACACQSJHDQILQQBBACgCnKABIgBBAmoiAzYCnKABIAAvAQIQKUUNAUEAKAKcoAEiAC8BACACRw0BQQAgAEECajYCnKABECNB3QBHDQFBAEEAKAKcoAFBAmo2ApygARAjQT1HDQEgAyAAQQAoApwfEQAADAELIABFDQBBACgCpB8RAQBBAEEAKAKcoAFBAmo2ApygAQJAECMiAkHyAEYNACACQfsARw0BECoPC0EBEAwaC0EAIAFBDGo2ApygAQs2AQJ/QQBBACgCnKABQQxqIgA2ApygARAjIQECQAJAQQAoApygASAARw0AIAEQOUUNAQsQGgsLbAEBf0EAQQAoApygASIAQQxqNgKcoAECQBAjQS5HDQBBAEEAKAKcoAFBAmo2ApygARAjQeUARw0AQQAoApygAUECakH4AEHwAEHvAEHyAEH0AEHzABAiRQ0AQQEQHA8LQQAgAEEKajYCnKABC1MBAX9BACEIAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRiEICyAIC6QBAQR/QQBBACgCnKABIgBBDGoiATYCnKABAkACQAJAAkACQBAjIgJBWWoiA0EHTQ0AIAJBIkYNAiACQfsARg0CDAELAkAgAw4IAgABAgEBAQMCC0EAQQAvAeY/IgNBAWo7AeY/QQAoApCgASADQQJ0aiAANgIADwtBACgCnKABIAFGDQILQQAvAeY/RQ0AQQBBACgCnKABQX5qNgKcoAEPCxAaCws0AQF/QQEhAQJAIABBd2pB//8DcUEFSQ0AIABBgAFyQaABRg0AIABBLkcgABA5cSEBCyABC0kBAX9BACEHAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZGIQcLIAcLegEDf0EAKAKcoAEhAAJAA0ACQCAALwEAIgFBd2pBBUkNACABQSBGDQAgAUGgAUYNACABQS9HDQICQCAALwECIgBBKkYNACAAQS9HDQMQEgwBCxATC0EAQQAoApygASICQQJqIgA2ApygASACQQAoAqCgAUkNAAsLIAELOQEBfwJAIAAvAQAiAUGA+ANxQYC4A0cNACAAQX5qLwEAQf8HcUEKdCABQf8HcXJBgIAEaiEBCyABC30BAX8CQCAAQS9LDQAgAEEkRg8LAkAgAEE6SQ0AQQAhAQJAIABBwQBJDQAgAEHbAEkNAQJAIABB4ABLDQAgAEHfAEYPCyAAQfsASQ0BAkAgAEH//wNLDQAgAEGqAUkNASAAEDQPC0EBIQEgABA1DQAgABA2IQELIAEPC0EBC2MBAX8CQCAAQcAASw0AIABBJEYPC0EBIQECQCAAQdsASQ0AAkAgAEHgAEsNACAAQd8ARg8LIABB+wBJDQACQCAAQf//A0sNAEEAIQEgAEGqAUkNASAAEDcPCyAAEDUhAQsgAQtMAQN/QQAhAwJAIABBfmoiBEEAKAKYHyIFSQ0AIAQvAQAgAUcNACAALwEAIAJHDQACQCAEIAVHDQBBAQ8LIABBfGovAQAQISEDCyADC2YBA39BACEFAkAgAEF6aiIGQQAoApgfIgdJDQAgBi8BACABRw0AIABBfGovAQAgAkcNACAAQX5qLwEAIANHDQAgAC8BACAERw0AAkAgBiAHRw0AQQEPCyAAQXhqLwEAECEhBQsgBQuFAQECfyAAEDgiABAmIQECQAJAIABB3ABGDQBBACECIAFFDQELQQAoApygAUECQQQgAEGAgARJG2ohAAJAA0BBACAANgKcoAEgAC8BABA4IgFFDQECQCABECVFDQAgAEECQQQgAUGAgARJG2ohAAwBCwtBACECIAFB3ABGDQELQQEhAgsgAgv2AwEEf0EAKAKcoAEiAEF+aiEBA0BBACAAQQJqNgKcoAECQAJAAkAgAEEAKAKgoAFPDQAQIyEAQQAoApygASECAkACQCAAEClFDQBBACgCnKABIQMCQAJAECMiAEE6Rw0AQQBBACgCnKABQQJqNgKcoAEQIxApRQ0BQQAoApygAS8BACEACyACIANBACgCnB8RAAAMAgtBACABNgKcoAEPCwJAAkAgAEEiRg0AIABBLkYNASAAQSdHDQQLQQBBACgCnKABIgJBAmoiAzYCnKABIAIvAQIQKUUNAUEAKAKcoAEiAi8BACAARw0BQQAgAkECajYCnKABECMiAEE6Rw0BQQBBACgCnKABQQJqNgKcoAECQBAjEClFDQBBACgCnKABLwEAIQAgAyACQQAoApwfEQAADAILQQAgATYCnKABDwtBACgCnKABIgAvAQJBLkcNAiAALwEEQS5HDQJBACAAQQZqNgKcoAECQAJAAkAgAC8BBiIAQfIARw0AQQEQDCEAQQAoApygASECIAANASACLwEAIQALIABB//8DcRApDQFBACABNgKcoAEPC0EAIAJBAmo2ApygAQsQIyEACyAAQf//A3EiAEEsRg0CIABB/QBGDQBBACABNgKcoAELDwtBACABNgKcoAEPC0EAKAKcoAEhAAwACwuPAQEBf0EAIQ4CQCAALwEAIAFHDQAgAC8BAiACRw0AIAAvAQQgA0cNACAALwEGIARHDQAgAC8BCCAFRw0AIAAvAQogBkcNACAALwEMIAdHDQAgAC8BDiAIRw0AIAAvARAgCUcNACAALwESIApHDQAgAC8BFCALRw0AIAAvARYgDEcNACAALwEYIA1GIQ4LIA4LqAEBAn9BACEBQQAoApygASECAkACQCAAQe0ARw0AIAJBAmpB7wBB5ABB9QBB7ABB5QAQD0UNAUEAIAJBDGo2ApygAQJAECNBLkYNAEEAIQEMAgtBAEEAKAKcoAFBAmo2ApygARAjIQALIABB5QBHDQBBACgCnKABIgBBDmogAiAAQQJqQfgAQfAAQe8AQfIAQfQAQfMAECIiARshAgtBACACNgKcoAEgAQtnAQF/QQAhCgJAIAAvAQAgAUcNACAALwECIAJHDQAgAC8BBCADRw0AIAAvAQYgBEcNACAALwEIIAVHDQAgAC8BCiAGRw0AIAAvAQwgB0cNACAALwEOIAhHDQAgAC8BECAJRiEKCyAKC3EBAX9BACELAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRw0AIAAvAQ4gCEcNACAALwEQIAlHDQAgAC8BEiAKRiELCyALC0kBA39BACEGAkAgAEF4aiIHQQAoApgfIghJDQAgByABIAIgAyAEIAUQD0UNAAJAIAcgCEcNAEEBDwsgAEF2ai8BABAhIQYLIAYLWQEDf0EAIQQCQCAAQXxqIgVBACgCmB8iBkkNACAFLwEAIAFHDQAgAEF+ai8BACACRw0AIAAvAQAgA0cNAAJAIAUgBkcNAEEBDwsgAEF6ai8BABAhIQQLIAQLSwEDf0EAIQcCQCAAQXZqIghBACgCmB8iCUkNACAIIAEgAiADIAQgBSAGECJFDQACQCAIIAlHDQBBAQ8LIABBdGovAQAQISEHCyAHCz0BAn9BACECAkBBACgCmB8iAyAASw0AIAAvAQAgAUcNAAJAIAMgAEcNAEEBDwsgAEF+ai8BABAhIQILIAILTQEDf0EAIQgCQCAAQXRqIglBACgCmB8iCkkNACAJIAEgAiADIAQgBSAGIAcQH0UNAAJAIAkgCkcNAEEBDwsgAEFyai8BABAhIQgLIAgL+RIBA38CQCAAEDcNACAAQfS/f2pBAkkNACAAQbcBRg0AIABBgHpqQfAASQ0AIABB/XZqQQVJDQAgAEGHB0YNACAAQe90akEtSQ0AAkAgAEHBdGoiAUEISw0AQQEgAXRB7QJxDQELIABB8HNqQQtJDQAgAEG1c2pBH0kNAAJAIABBqnJqIgFBEksNAEEBIAF0Qf/8GXENAQsgAEHwDEYNACAAQZZyakEESQ0AIABBwHBqQQpJDQAgAEHacGpBC0kNACAAQdBxakEbSQ0AIABBkQ5GDQAgAEGQcmpBCkkNACAAQcJtakESSQ0AIABBxm1qQQNJDQAgAEGdbmpBIUkNACAAQa1uakEPSQ0AIABBp29qQQNJDQAgAEHXb2pBBUkNACAAQdtvakEDSQ0AIABB5W9qQQlJDQAgAEHqb2pBBEkNACAAQf0PRg0AIABBlXBqQQlJDQACQCAAQa9taiIBQRJLDQBBASABdEH/gBhxDQELIABBmm1qQQpJDQACQAJAIABBxGxqIgFBJ00NACAAQf9sakEDSQ0CDAELIAEOKAEAAQEBAQEBAQAAAQEAAAEBAQAAAAAAAAAAAAEAAAAAAAAAAAAAAQEBCyAAQf4TRg0AIABBmmxqQQpJDQACQCAAQcRraiIBQRVLDQBBASABdEH9sI4BcQ0BCyAAQf9rakEDSQ0AIABB9RRGDQAgAEGaa2pBDEkNAAJAAkAgAEHEamoiAUEnTQ0AIABB/2pqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAQABAQEAAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAABAQELIABBmmpqQQpJDQAgAEGGampBBkkNAAJAAkAgAEHEaWoiAUEnTQ0AIABB/2lqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAAABAQAAAQEBAAAAAAAAAAABAQAAAAAAAAAAAAABAQELIABBmmlqQQpJDQACQCAAQcJoaiIBQRlLDQBBASABdEGf7oMQcQ0BCyAAQYIXRg0AIABBmmhqQQpJDQACQAJAIABBwmdqIgFBJU0NACAAQYBoakEFSQ0CDAELIAEOJgEBAQEBAQEAAQEBAAEBAQEAAAAAAAAAAQEAAAAAAAAAAAAAAAEBAQsgAEGaZ2pBCkkNAAJAAkAgAEHEZmoiAUEnTQ0AIABB/2ZqQQNJDQIMAQsgAQ4oAQABAQEBAQEBAAEBAQABAQEBAAAAAAAAAAEBAAAAAAAAAAAAAAABAQELIABBmmZqQQpJDQAgAEF8cSICQYAaRg0AAkAgAEHFZWoiAUEoSw0AIAEOKQEBAAEBAQEBAQEAAQEBAAEBAQEAAAAAAAAAAAABAAAAAAAAAAAAAAEBAQsgAEGaZWpBCkkNAAJAIABBtmRqIgFBDEsNAEEBIAF0QeEvcQ0BCyAAQf5kakECSQ0AIABBeHFB2BtGDQAgAEGaZGpBCkkNAAJAIABBz2NqIgFBHUsNAEEBIAF0QfmHgP4DcQ0BCyAAQY5kakECSQ0AIABBsR1GDQAgAEGwY2pBCkkNAAJAIABBzGJqIgFBCEsNACABQQZHDQELIABBuGJqQQZJDQAgAEHgYWpBCkkNACAAQQFyIgFBmR5GDQAgAEGwYmpBCkkNAAJAIABBy2FqIgNBCksNAEEBIAN0QZUMcQ0BCyAAQfNgakELSQ0AIAFBhx9GDQAgAEGPYWpBFEkNACAAQe5RakEDSQ0AIABBl1lqQQlJDQAgAEGjWWpBA0kNACAAQfFeakEPSQ0AIABB/l5qQQxJDQAgAEGPX2pBBEkNACAAQZlfakEHSQ0AIABBnl9qQQNJDQAgAEGiX2pBA0kNACAAQapfakEESQ0AIABBwF9qQQpJDQAgAEHVX2pBFEkNACAAQcYfRg0AIABB52BqQSRJDQAgAEHOUWpBA0kNACAAQa5RakECSQ0AIABBjlFqQQJJDQAgAEH1T2pBA0kNACAAQaBQakEKSQ0AIABB3S9GDQAgAEHMUGpBIEkNACAAQbBGakEDSQ0AIABBsEdqQQpJDQAgAEHAR2pBCkkNACAAQdxHakEUSQ0AIABBmkhqQQ5JDQAgAEHQSGpBCkkNACAAQd9IakENSQ0AIABBgElqQQNJDQAgAEGVSWpBCUkNACAAQbBJakEKSQ0AIABBzElqQRFJDQAgAEGASmpBBUkNACAAQdBKakEOSQ0AIABB8EpqQQpJDQAgAEGBS2pBC0kNACAAQaBLakEdSQ0AIABBq0tqQQpJDQAgAEHpS2pBBUkNACAAQbBMakELSQ0AIABBuk1qQQpJDQAgAEHQTWpBDEkNACAAQeBNakEMSQ0AIABBqTFGDQAgAEHwT2pBCkkNACAAQcBEakE6SQ0AIABBiUZqQQNJDQAgAEGORmpBA0kNACAAQe05Rg0AIABBrEZqQRVJDQAgAEGFRGpBBUkNAAJAIABBwb9/aiIBQRVLDQBBASABdEGDgIABcQ0BCyAAQZu+f2pBDEkNACAAQeHBAEYNACAAQbC+f2pBDUkNACAAQZGmf2pBA0kNACAAQf/aAEYNACAAQWBxQeDbAEYNACAAQdaff2pBBkkNACAAQeeef2pBAkkNACAAQYyzfWpBCkkNACAAQe/MAkYNACAAQeCzfWpBCkkNAAJAIABB9a99aiIBQRxLDQBBASABdEGBgID4AXENAQsgAEHisn1qQQJJDQAgAEGQsn1qQQJJDQACQAJAIABB/q99aiIBQQRNDQAgAEGAr31qQQJJDQIMAQsgAQ4FAQAAAAEBCyAAQc2sfWpBDkkNACACQYDTAkYNACAAQbmtfWpBDUkNACAAQdqtfWpBCEkNACAAQYGufWpBC0kNACAAQaCufWpBEkkNACAAQcyufWpBEkkNACAAQbCufWpBCkkNACAAQderfWpBDkkNACAAQeXTAkYNACAAQV9xQbCsfWpBCkkNAAJAIABBvat9aiIBQQpLDQBBASABdEGBDHENAQsgAEGwq31qQQpJDQACQCAAQZ2ofWoiAUEKSw0AIAFBCEcNAQsCQCAAQdCqfWoiAUERSw0AQQEgAXRBnYMLcQ0BCwJAIABBlap9aiIBQQtLDQBBASABdEGfGHENAQsgAEGFq31qQQNJDQAgAEFwcSIBQYD8A0YNACAAQZ72A0YNACAAQZCofWpBCkkNACAAQb/+A0YgAEHwgXxqQQpJIABBs4N8akEDSSAAQc2DfGpBAkkgAUGg/ANGcnJycg8LQQELXAEEf0GAgAQhAUGQCCECQX4hAwJAA0BBACEEIANBAmoiA0HnA0sNASACKAIAIAFqIgEgAEsNASACQQRqIQQgAkEIaiECIAQoAgAgAWoiASAASQ0AC0EBIQQLIAQLXAEEf0GAgAQhAUGwFyECQX4hAwJAA0BBACEEIANBAmoiA0H5AUsNASACKAIAIAFqIgEgAEsNASACQQRqIQQgAkEIaiECIAQoAgAgAWoiASAASQ0AC0EBIQQLIAQL7R8BBn9BASEBAkACQAJAIABB1n5qIgJBEEsNAEEBIAJ0QYGQBHENAQsgAEG6empBDEkNACAAQYh+akHKA0kNACAAQcB+akEXSQ0AIABBqH5qQR9JDQACQCAAQZB5aiICQRxLDQBBASACdEHf+YK6AXENAQsCQCAAQaB6aiICQQ5LDQBBASACdEGfoAFxDQELIABB9nZqQaYBSQ0AIABBiXhqQYsBSQ0AIABB8nhqQRRJDQAgAEHdeGpB0wBJDQAgAEGRdGpBBEkNACAAQbB0akEbSQ0AIABBoHVqQSlJDQAgAEHZCkYNACAAQc91akEmSQ0AAkACQAJAIABBj3NqQeMASQ0AIABBAXIiAkHvDEYNACAAQeBzakErSQ0AAkAgAEGrcmoiAUE8Tw0AQoGAjLCAnIGACCABrYhCAYNQRQ0BCyAAQe5xakEeSQ0AIABBtnBqQSFJDQAgAEGxD0YNACAAQbNxakHZAEkNAAJAIABBjHBqIgFBBksNAEEBIAF0QcMAcQ0BCyAAQYBwakEWSQ0AAkACQCAAQdxvaiIDQQRNDQAgAEGaEEYNAgwBC0EBIQEgAw4FBAAAAAQECyAAQfxtakE2SQ0AIABBym5qQQhJDQAgAEHgbmpBFUkNACAAQcBvakEZSQ0AIABBoG9qQQtJDQAgAEG9EkYNACAAQdASRg0AIABBqG1qQQpJDQAgAEGPbWpBEEkNAAJAIABB+2xqIgNBDE8NAEEBIQFB/xkgA0H//wNxdkEBcQ0ECyAAQe1sakEWSQ0AAkAgAEGEbGoiAUEUSw0AQQEgAXRBgfzhAHENAQsgAEHWbGpBB0kNAAJAIABBzmxqIgFBHEsNAEEBIAF0QfGRgIABcQ0BCwJAIABBpGxqIgFBFUsNAEEBIAF0QbuAwAFxDQELIABB7WtqQRZJDQACQCAAQdZraiIBQTVPDQBC/7aDgICA4AsgAa2IQgGDUEUNAQsgAEHtampBFkkNACAAQfFqakEDSQ0AIABBjmtqQQNJDQAgAEH7ampBCUkNAAJAAkACQCAAQdZqaiIDQSZNDQAgAEGHamoiAUEXSw0BQQEgAXRBgeC/BnFFDQEMAwtBASEBIAMOJwUFBQUFBQUBBQUBBQUFBQUBAQEFAQEBAQEBAQEBAQEBAQEBAQEBBQULIABBoGpqQQJJDQELIABB7WlqQRZJDQACQAJAAkAgAEGPaWoiA0EzTQ0AIABB1mlqIgFBE0sNAUEBIAF0Qf/2I3FFDQEMAwtBASEBIAMONAUBAQEBAQEBAQEBAQEBAQEBAQUBBQUFBQUFAQEBBQUFAQUFBQUBAQEFBQEFAQUFAQEBBQUFCyAAQaRpaiIBQQVLDQAgAUECRw0BCyAAQdhoakEDSQ0AIABB7mdqQRdJDQAgAEHyZ2pBA0kNACAAQftnakEISQ0AIABB0BdGDQAgAEHSaGpBDEkNACAAQb0YRg0AIABB1mdqQRBJDQACQCAAQahnaiIBQSlPDQBCh4aAgIAgIAGtiEIBg1BFDQELIABB1mZqQQpJDQAgAEHuZmpBF0kNACAAQftmakEISQ0AIABB8mZqQQNJDQACQCAAQftlaiIBQQtLDQAgAUEIRw0BCwJAIABBy2ZqIgFBCEsNAEEBIAF0QZ8CcQ0BCwJAIABBomZqIgFBFEsNAEEBIAF0QY2A4ABxDQELIABB7mVqQSlJDQAgAEG9GkYNACAAQc4aRg0AIABBzWRqQQlJDQAgAEHmZGpBGEkNACAAQftkakESSQ0AIABBhmVqQQZJDQAgAEGsZWpBA0kNACAAQaFlakEDSQ0AAkAgAEHDZGoiA0EKTw0AQQEhAUH5ByADQf//A3F2QQFxDQQLIAJBsxxGDQAgAEH/Y2pBMEkNACAAQcBjakEHSQ0AAkAgAEH/YmoiAUEMSw0AQQEgAXRByyVxDQELIABBfHEiA0GUHUYNACAAQediakEHSQ0AAkAgAEHfYmoiAUEmTw0AQtfsm4D5BSABrYhCAYNQRQ0BCyAAQYBgakErSQ0AIABB+GBqQQVJDQAgAEG3YWpBJEkNACAAQXhxIgRBwB5GDQAgAEGAHkYNACADQdwdRg0AAkAgAEHBX2oiAUEoTw0AQoGA+MPHGCABrYhCAYNQRQ0BCyAAQZJfakEDSQ0AIABB4F5qQSZJDQAgAEGOIUYNACAAQYtfakENSQ0AIABBxyFGDQAgAEHNIUYNACAAQbZbakEESQ0AIABBsF5qQStJDQAgAEGEXmpBzQJJDQACQCAAQbBbaiIFQQlPDQBBASEBQf8CIAVB//8DcXZBAXENBAsgAEHOWmpBBEkNACAAQfBaakEhSQ0AIABB9lpqQQRJDQAgAEGmW2pBBEkNACAAQaBbakEpSQ0AAkAgAEHIWmoiBUEJTw0AQQEhAUH/AiAFQf//A3F2QQFxDQQLIABBgFFqQTRJDQAgAEGSUWpBA0kNACAAQaBRakENSQ0AIABBwFFqQRJJDQAgAEHgUWpBEkkNACAAQfJRakEESQ0AIABBgFJqQQ1JDQAgAEGSUmpBC0kNACAAQeBSakHLAEkNACAAQf9SakEaSQ0AIABBkVNqQRFJDQAgAEH/V2pB7ARJDQAgAEGIWGpBBkkNACAAQeBYakHWAEkNACAAQXBxIgVBgCdGDQAgAEHoWWpBwwBJDQAgAEHuWWpBBEkNACAAQahaakE5SQ0AIABBvlpqQQRJDQAgAEG4WmpBD0kNACAAQdcvRg0AIABB3C9GDQAgAEHgT2pB2QBJDQAgAEGATGpBF0kNACAAQdBMakEaSQ0AIABBgE1qQSxJDQAgAEGQTWpBBUkNACAAQbBNakEeSQ0AIABBgE5qQR9JDQAgAEHQTmpBxgBJDQAgAEGqMUYNBCAAQYBPakEpSQ0EIABBu0lqQQdJDQQgAEH7SWpBL0kNBCAAQac1Rg0EIABB4EtqQTVJDQQgAEGXRmpBBEkNBCAAQcNGakEDSQ0EIABB8EZqQStJDQQgAEGAR2pBCUkNBCAAQaZHakEkSQ0EIABBs0dqQQNJDQQgAEGASGpBJEkNBCAAQcZIakEsSQ0EIAJBrzdGDQQgAEH9SGpBHkkNBCAAQZJGaiIGQQlJDQEMAgtBASEBDAILQQEhAUGPAyAGQf//A3F2QQFxDQELIARB0D5GDQEgAEG4QWpBBkkNASAAQeBBakEmSQ0BIABB6EFqQQZJDQEgAEGARmpBwAFJDQEgAEGARGpBlgJJDQECQCAAQadBaiIBQQRLDQBBASABdEEVcQ0CCyAAQaFBakEfSQ0BIABBgEFqQTVJDQECQCAAQcpAaiIEQQlPDQBBASEBQf8CIARB//8DcXZBAXENAQsgAEGOQGpBA0kNASAAQaBAakENSQ0BIABBqkBqQQZJDQEgA0HQP0YNASAAQb5AakEDSQ0BIABBukBqQQdJDQEgAEGKQGpBB0kNASAAQfHAAEYNASAAQf/AAEYNASAAQfC+f2pBDUkNASAAQYLCAEYNASAAQYfCAEYNASAAQZXCAEYNASAAQfa9f2pBCkkNAQJAIABB6L1/aiIEQRFPDQBBASEBQb+gBSAEdkEBcQ0BCyAAQda9f2pBEEkNASADQbzCAEYNAQJAIABBu71/aiIEQQpPDQBBASEBQZ8EIARB//8DcXZBAXENAQsgAEGgp39qQYUBSQ0BIABB0Kd/akEvSQ0BIABBoL1/akEpSQ0BIABBgKh/akEvSQ0BAkAgAEGVpn9qIgRBCU8NAEEBIQFBjwMgBEH//wNxdkEBcQ0BCyAAQYCmf2pBJkkNASAAQafaAEYNASAAQa3aAEYNASAAQYC2fWpBjQJJDQEgAEGwtn1qQS5JDQEgAEGAwH1qQY0JSQ0BIABBgOR+akHwowFJDQEgAEGAmH9qQbYzSQ0BIAVB8OMARg0BIABB4Jx/akEbSQ0BIABBz51/akHeAEkNASAAQfudf2pBK0kNASADQfzhAEYNASAAQd+ef2pB2gBJDQEgAEHlnn9qQQVJDQEgAEG/n39qQdYASQ0BIABByJ9/akEFSQ0BIABBz59/akEFSQ0BIABB359/akEJSQ0BIABB+59/akEDSQ0BIABBqKR/akEHSQ0BIABBsKR/akEHSQ0BIABBuKR/akEHSQ0BIABBwKR/akEHSQ0BIABByKR/akEHSQ0BIABB0KR/akEHSQ0BIABB2KR/akEHSQ0BIABB4KR/akEHSQ0BIABBgKV/akEXSQ0BIABB79oARg0BIABB0KV/akE4SQ0BIABB/q59akEySQ0BIABBwK99akE0SQ0BIABB9K99akEXSQ0BIABB+a99akEESQ0BIABB/a99akEDSQ0BIABBibB9akELSQ0BIABB9bB9akEvSQ0BIABB3rF9akHnAEkNASAAQemxfWpBCUkNASAAQeCyfWpB0ABJDQEgAEGBs31qQR9JDQEgAEHAs31qQS9JDQEgAkGrzAJGDQEgBUGQzAJGDQECQCAAQY6ufWoiAkENTw0AQQEhAUG/NCACQf//A3F2QQFxDQELIABBoK19akEdSQ0BIABB9q19akEcSQ0BIABB0K19akEXSQ0BIABBvKt9akEISQ0BIABBwKt9akEDSQ0BIABBgKx9akEpSQ0BIABBhqx9akEFSQ0BIABBmqx9akEKSQ0BIABBoKx9akEFSQ0BIABBz9MCRg0BIABB/Kx9akEvSQ0BIABBgqt9akEySQ0BIABB+tQCRg0BIABBoKt9akEXSQ0BAkAgAEHPqn1qIgJBEk8NAEEBIQFBsb4KIAJ2QQFxDQELIABBgIp8akEHSQ0BIABBkIt8akHqAEkNASAAQYCOfGpB7gJJDQEgAEG10HxqQTFJDQEgAEHQ0HxqQRdJDQEgAEGAqH1qQaTXAEkNASAAQZCpfWpB8wBJDQEgAEGkqX1qQQpJDQEgAEHQqX1qQStJDQEgAEHYqX1qQQdJDQEgAEHgqX1qQQdJDQEgAEHvqX1qQQZJDQEgAEF3cUH/qX1qQQZJDQEgAEGOqn1qQQNJDQEgAEGlqn1qQQNJDQEgAEGgqn1qQQtJDQECQCAAQe2JfGoiAkELTw0AQQEhAUGfCCACQf//A3F2QQFxDQELIABB4Yl8akEKSQ0BIABB1ol8akENSQ0BAkAgAEHIiXxqIgJBDU8NAEEBIQFB3zYgAkH//wNxdkEBcQ0BCyAAQa6AfGpBBkkNASAAQbaAfGpBBkkNASAAQb6AfGpBBkkNASAAQZqBfGpB2QBJDQEgAEG/gXxqQRpJDQEgAEHfgXxqQRpJDQEgAEGKg3xqQYcBSQ0BIABBkIN8akEFSQ0BIABBkIR8akEMSQ0BIABB7oR8akE2SQ0BIABBsIV8akHAAEkNASAAQbqJfGpB7ABJDQFBASEBIABBrYh8akHrAkkNACAAQaaAfGpBA0kPCyABDwtBAQs1AAJAIABBgPgDcUGAsANHDQAgAEEKdEGA+D9xQQAoApygAS8BAkH/B3FyQYCABGohAAsgAAtoAQJ/QQEhAQJAAkAgAEFfaiICQQVLDQBBASACdEExcQ0BCyAAQfj/A3FBKEYNACAAQUZqQf//A3FBBkkNAAJAIABBpX9qIgJBA0sNACACQQFHDQELIABBhX9qQf//A3FBBEkhAQsgAQuNAQEFf0EAKAKcoAEhAEEAKAKgoAEhAQN/IABBAmohAgJAAkAgACABTw0AIAIvAQAiA0Gkf2oiBEEBTQ0BIAIhACADQXZqIgNBA0sNAiACIQAgAw4EAAICAAALQQAgAjYCnKABEBpBAA8LAkACQCAEDgIBAAELQQAgAjYCnKABQd0ADwsgAEEEaiEADAALC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC74XAgBBgAgLmBcAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAGQAAAAIAAAASAAAAAgAAAAEAAAACAAAADgAAAAMAAAANAAAAIwAAAHoAAABGAAAANAAAAAwBAAAcAAAABAAAADAAAAAwAAAAHwAAAA4AAAAdAAAABgAAACUAAAALAAAAHQAAAAMAAAAjAAAABQAAAAcAAAACAAAABAAAACsAAACdAAAAEwAAACMAAAAFAAAAIwAAAAUAAAAnAAAACQAAADMAAACdAAAANgEAAAoAAAAVAAAACwAAAAcAAACZAAAABQAAAAMAAAAAAAAAAgAAACsAAAACAAAAAQAAAAQAAAAAAAAAAwAAABYAAAALAAAAFgAAAAoAAAAeAAAAQgAAABIAAAACAAAAAQAAAAsAAAAVAAAACwAAABkAAABHAAAANwAAAAcAAAABAAAAQQAAAAAAAAAQAAAAAwAAAAIAAAACAAAAAgAAABwAAAArAAAAHAAAAAQAAAAcAAAAJAAAAAcAAAACAAAAGwAAABwAAAA1AAAACwAAABUAAAALAAAAEgAAAA4AAAARAAAAbwAAAEgAAAA4AAAAMgAAAA4AAAAyAAAADgAAACMAAABdAQAAKQAAAAcAAAABAAAATwAAABwAAAALAAAAAAAAAAkAAAAVAAAAawAAABQAAAAcAAAAFgAAAA0AAAA0AAAATAAAACwAAAAhAAAAGAAAABsAAAAjAAAAHgAAAAAAAAADAAAAAAAAAAkAAAAiAAAABAAAAAAAAAANAAAALwAAAA8AAAADAAAAFgAAAAAAAAACAAAAAAAAACQAAAARAAAAAgAAABgAAABVAAAABgAAAAIAAAAAAAAAAgAAAAMAAAACAAAADgAAAAIAAAAJAAAACAAAAC4AAAAnAAAABwAAAAMAAAABAAAAAwAAABUAAAACAAAABgAAAAIAAAABAAAAAgAAAAQAAAAEAAAAAAAAABMAAAAAAAAADQAAAAQAAACfAAAANAAAABMAAAADAAAAFQAAAAIAAAAfAAAALwAAABUAAAABAAAAAgAAAAAAAAC5AAAALgAAACoAAAADAAAAJQAAAC8AAAAVAAAAAAAAADwAAAAqAAAADgAAAAAAAABIAAAAGgAAAOYAAAArAAAAdQAAAD8AAAAgAAAABwAAAAMAAAAAAAAAAwAAAAcAAAACAAAAAQAAAAIAAAAXAAAAEAAAAAAAAAACAAAAAAAAAF8AAAAHAAAAAwAAACYAAAARAAAAAAAAAAIAAAAAAAAAHQAAAAAAAAALAAAAJwAAAAgAAAAAAAAAFgAAAAAAAAAMAAAALQAAABQAAAAAAAAAIwAAADgAAAAIAQAACAAAAAIAAAAkAAAAEgAAAAAAAAAyAAAAHQAAAHEAAAAGAAAAAgAAAAEAAAACAAAAJQAAABYAAAAAAAAAGgAAAAUAAAACAAAAAQAAAAIAAAAfAAAADwAAAAAAAABIAQAAEgAAAL4AAAAAAAAAUAAAAJkDAABnAAAAbgAAABIAAADDAAAAvQoAAC4EAADSDwAARgIAALohAAA4AgAACAAAAB4AAAByAAAAHQAAABMAAAAvAAAAEQAAAAMAAAAgAAAAFAAAAAYAAAASAAAAsQIAAD8AAACBAAAASgAAAAYAAAAAAAAAQwAAAAwAAABBAAAAAQAAAAIAAAAAAAAAHQAAAPcXAAAJAAAA1QQAACsAAAAIAAAA+CIAAB4BAAAyAAAAAgAAABIAAAADAAAACQAAAIsBAAAFCQAAagAAAAYAAAAMAAAABAAAAAgAAAAIAAAACQAAAGcXAABUAAAAAgAAAEYAAAACAAAAAQAAAAMAAAAAAAAAAwAAAAEAAAADAAAAAwAAAAIAAAALAAAAAgAAAAAAAAACAAAABgAAAAIAAABAAAAAAgAAAAMAAAADAAAABwAAAAIAAAAGAAAAAgAAABsAAAACAAAAAwAAAAIAAAAEAAAAAgAAAAAAAAAEAAAABgAAAAIAAABTAQAAAwAAABgAAAACAAAAGAAAAAIAAAAeAAAAAgAAABgAAAACAAAAHgAAAAIAAAAYAAAAAgAAAB4AAAACAAAAGAAAAAIAAAAeAAAAAgAAABgAAAACAAAABwAAADUJAAAsAAAACwAAAAYAAAARAAAAAAAAAHIBAAArAAAAFQUAAMQAAAA8AAAAQwAAAAgAAAAAAAAAtQQAAAMAAAACAAAAGgAAAAIAAAABAAAAAgAAAAAAAAADAAAAAAAAAAIAAAAJAAAAAgAAAAMAAAACAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAFAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAgAAAAIAAAABAAAAAgAAAAAAAAADAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAAAAAAMAAAADAAAAAgAAAAYAAAACAAAAAwAAAAIAAAADAAAAAgAAAAAAAAACAAAACQAAAAIAAAAQAAAABgAAAAIAAAACAAAABAAAAAIAAAAQAAAARREAAN2mAAAjAAAANBAAAAwAAADdAAAAAwAAAIEWAAAPAAAAMB0AACAMAAAdAgAA4wUAAEoTAAD9AQAAAAAAAOMAAAAAAAAAlgAAAAQAAAAmAQAACQAAAFgFAAACAAAAAgAAAAEAAAAGAAAAAwAAACkAAAACAAAABQAAAAAAAACmAAAAAQAAAD4CAAADAAAACQAAAAkAAAByAQAAAQAAAJoAAAAKAAAAsAAAAAIAAAA2AAAADgAAACAAAAAJAAAAEAAAAAMAAAAuAAAACgAAADYAAAAJAAAABwAAAAIAAAAlAAAADQAAAAIAAAAJAAAABgAAAAEAAAAtAAAAAAAAAA0AAAACAAAAMQAAAA0AAAAJAAAAAwAAAAIAAAALAAAAUwAAAAsAAAAHAAAAAAAAAKEAAAALAAAABgAAAAkAAAAHAAAAAwAAADgAAAABAAAAAgAAAAYAAAADAAAAAQAAAAMAAAACAAAACgAAAAAAAAALAAAAAQAAAAMAAAAGAAAABAAAAAQAAADBAAAAEQAAAAoAAAAJAAAABQAAAAAAAABSAAAAEwAAAA0AAAAJAAAA1gAAAAYAAAADAAAACAAAABwAAAABAAAAUwAAABAAAAAQAAAACQAAAFIAAAAMAAAACQAAAAkAAABUAAAADgAAAAUAAAAJAAAA8wAAAA4AAACmAAAACQAAAEcAAAAFAAAAAgAAAAEAAAADAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAANAAAACQAAAHgAAAAGAAAAAwAAAAYAAAAEAAAAAAAAAB0AAAAJAAAAKQAAAAYAAAACAAAAAwAAAAkAAAAAAAAACgAAAAoAAAAvAAAADwAAAJYBAAAHAAAAAgAAAAcAAAARAAAACQAAADkAAAAVAAAAAgAAAA0AAAB7AAAABQAAAAQAAAAAAAAAAgAAAAEAAAACAAAABgAAAAIAAAAAAAAACQAAAAkAAAAxAAAABAAAAAIAAAABAAAAAgAAAAQAAAAJAAAACQAAAEoBAAADAAAAaksAAAkAAACHAAAABAAAADwAAAAGAAAAGgAAAAkAAAD2AwAAAAAAAAIAAAA2AAAACAAAAAMAAABSAAAAAAAAAAwAAAABAAAArEwAAAEAAADHFAAABAAAAAQAAAAFAAAACQAAAAcAAAADAAAABgAAAB8AAAADAAAAlQAAAAIAAACKBQAAMQAAAAECAAA2AAAABQAAADEAAAAJAAAAAAAAAA8AAAAAAAAAFwAAAAQAAAACAAAADgAAAFEFAAAGAAAAAgAAABAAAAADAAAABgAAAAIAAAABAAAAAgAAAAQAAAAGAQAABgAAAAoAAAAJAAAAowEAAA0AAADXBQAABgAAAG4AAAAGAAAABgAAAAkAAACXEgAACQAAAAcFDADvAAAAAEGYHwsYMIwAAAEAAAACAAAAAwAAAAAEAADQHwAA","function"==typeof atob?Uint8Array.from(atob(B),A=>A.charCodeAt(0)):Buffer.from(B,"base64")));var B;const{exports:E}=await WebAssembly.instantiate(A);Q=E})())} \ No newline at end of file diff --git a/node_modules/cjs-module-lexer/lexer.d.ts b/node_modules/cjs-module-lexer/lexer.d.ts deleted file mode 100755 index 3257e750d52f6..0000000000000 --- a/node_modules/cjs-module-lexer/lexer.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -interface Exports { - exports: string[]; - reexports: string[]; -} - -export declare function parse(source: string, name?: string): Exports; -export declare function init(): Promise; - -export {}; diff --git a/node_modules/cjs-module-lexer/lexer.js b/node_modules/cjs-module-lexer/lexer.js deleted file mode 100755 index 4836ebf4d0434..0000000000000 --- a/node_modules/cjs-module-lexer/lexer.js +++ /dev/null @@ -1,1327 +0,0 @@ -let source, pos, end; -let openTokenDepth, - templateDepth, - lastTokenPos, - lastSlashWasDivision, - templateStack, - templateStackDepth, - openTokenPosStack, - openClassPosStack, - nextBraceIsClass, - starExportMap, - lastStarExportSpecifier, - _exports, - reexports; - -function resetState () { - openTokenDepth = 0; - templateDepth = -1; - lastTokenPos = -1; - lastSlashWasDivision = false; - templateStack = new Array(1024); - templateStackDepth = 0; - openTokenPosStack = new Array(1024); - openClassPosStack = new Array(1024); - nextBraceIsClass = false; - starExportMap = Object.create(null); - lastStarExportSpecifier = null; - - _exports = new Set(); - reexports = new Set(); -} - -// RequireType -const Import = 0; -const ExportAssign = 1; -const ExportStar = 2; - -const strictReserved = new Set(['implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'enum']); - -function parseCJS (source, name = '@') { - resetState(); - try { - parseSource(source); - } - catch (e) { - e.message += `\n at ${name}:${source.slice(0, pos).split('\n').length}:${pos - source.lastIndexOf('\n', pos - 1)}`; - e.loc = pos; - throw e; - } - const result = { exports: [..._exports], reexports: [...reexports] }; - resetState(); - return result; -} - -function addExport (name) { - if (!strictReserved.has(name)) - _exports.add(name); -} - -function parseSource (cjsSource) { - source = cjsSource; - pos = -1; - end = source.length - 1; - let ch = 0; - - // Handle #! - if (source.charCodeAt(0) === 35/*#*/ && source.charCodeAt(1) === 33/*!*/) { - if (source.length === 2) - return true; - pos += 2; - while (pos++ < end) { - ch = source.charCodeAt(pos); - if (ch === 10/*\n*/ || ch === 13/*\r*/) - break; - } - } - - while (pos++ < end) { - ch = source.charCodeAt(pos); - - if (ch === 32 || ch < 14 && ch > 8) - continue; - - if (openTokenDepth === 0) { - switch (ch) { - case 105/*i*/: - if (source.startsWith('mport', pos + 1) && keywordStart(pos)) - throwIfImportStatement(); - lastTokenPos = pos; - continue; - case 114/*r*/: - const startPos = pos; - if (tryParseRequire(Import) && keywordStart(startPos)) - tryBacktrackAddStarExportBinding(startPos - 1); - lastTokenPos = pos; - continue; - case 95/*_*/: - if (source.startsWith('_export', pos + 1) && (keywordStart(pos) || source.charCodeAt(pos - 1) === 46/*.*/)) { - pos += 8; - if (source.startsWith('Star', pos)) - pos += 4; - if (source.charCodeAt(pos) === 40/*(*/) { - openTokenPosStack[openTokenDepth++] = lastTokenPos; - if (source.charCodeAt(++pos) === 114/*r*/) - tryParseRequire(ExportStar); - } - } - lastTokenPos = pos; - continue; - } - } - - switch (ch) { - case 101/*e*/: - if (source.startsWith('xport', pos + 1) && keywordStart(pos)) { - if (source.charCodeAt(pos + 6) === 115/*s*/) - tryParseExportsDotAssign(false); - else if (openTokenDepth === 0) - throwIfExportStatement(); - } - break; - case 99/*c*/: - if (keywordStart(pos) && source.startsWith('lass', pos + 1) && isBrOrWs(source.charCodeAt(pos + 5))) - nextBraceIsClass = true; - break; - case 109/*m*/: - if (source.startsWith('odule', pos + 1) && keywordStart(pos)) - tryParseModuleExportsDotAssign(); - break; - case 79/*O*/: - if (source.startsWith('bject', pos + 1) && keywordStart(pos)) - tryParseObjectDefineOrKeys(openTokenDepth === 0); - break; - case 40/*(*/: - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 41/*)*/: - if (openTokenDepth === 0) - throw new Error('Unexpected closing bracket.'); - openTokenDepth--; - break; - case 123/*{*/: - openClassPosStack[openTokenDepth] = nextBraceIsClass; - nextBraceIsClass = false; - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 125/*}*/: - if (openTokenDepth === 0) - throw new Error('Unexpected closing brace.'); - if (openTokenDepth-- === templateDepth) { - templateDepth = templateStack[--templateStackDepth]; - templateString(); - } - else { - if (templateDepth !== -1 && openTokenDepth < templateDepth) - throw new Error('Unexpected closing brace.'); - } - break; - case 60/*>*/: - // TODO: -

- -

- Lightweight, beautiful and user-friendly interactive prompts
- >_ Easy to use CLI prompts to enquire users for information▌ -

- -
- -* **Simple**: prompts has [no big dependencies](http://npm.anvaka.com/#/view/2d/prompts) nor is it broken into a [dozen](http://npm.anvaka.com/#/view/2d/inquirer) tiny modules that only work well together. -* **User friendly**: prompt uses layout and colors to create beautiful cli interfaces. -* **Promised**: uses promises and `async`/`await`. No callback hell. -* **Flexible**: all prompts are independent and can be used on their own. -* **Testable**: provides a way to submit answers programmatically. -* **Unified**: consistent experience across all prompts. - - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ Install - -``` -$ npm install --save prompts -``` - -> This package supports Node 6 and above - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - -## ❯ Usage - -example prompt - -```js -const prompts = require('prompts'); - -const response = await prompts({ - type: 'number', - name: 'value', - message: 'How old are you?', - validate: value => value < 18 ? `Nightclub is 18+ only` : true -}); - -console.log(response); // => { value: 24 } -``` - -> Examples are meant to be illustrative. `await` calls need to be run within an async function. See [`example.js`](https://github.com/terkelg/prompts/blob/master/example.js). - - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ Examples - -### Single Prompt - -Prompt with a single prompt object. Returns object with the response. - -```js -const prompts = require('prompts'); - -let response = await prompts({ - type: 'text', - name: 'meaning', - message: 'What is the meaning of life?' -}); - -console.log(response.meaning); -``` - -### Prompt Chain - -Prompt with a list of prompt objects. Returns object with response. -Make sure to give each prompt a unique `name` property to prevent overwriting values. - -```js -const prompts = require('prompts'); - -let questions = [ - { - type: 'text', - name: 'username', - message: 'What is your GitHub username?' - }, - { - type: 'number', - name: 'age', - message: 'How old are you?' - }, - { - type: 'text', - name: 'about', - message: 'Tell something about yourself', - initial: 'Why should I?' - } -]; - -let response = await prompts(questions); - -// => response => { username, age, about } -``` - -### Dynamic Prompts - -Prompt properties can be functions too. -Prompt Objects with `type` set to `falsy` values are skipped. - -```js -const prompts = require('prompts'); - -let questions = [ - { - type: 'text', - name: 'dish', - message: 'Do you like pizza?' - }, - { - type: prev => prev == 'pizza' ? 'text' : null, - name: 'topping', - message: 'Name a topping' - } -]; - -let response = await prompts(questions); -``` - - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ API - -### prompts(prompts, options) - -Type: `Function`
-Returns: `Object` - -Prompter function which takes your [prompt objects](#-prompt-objects) and returns an object with responses. - - -#### prompts - -Type: `Array|Object`
- -Array of [prompt objects](#-prompt-objects). - These are the questions the user will be prompted. You can see the list of supported [prompt types here](#-types). - -Prompts can be submitted (return, enter) or canceled (esc, abort, ctrl+c, ctrl+d). No property is being defined on the returned response object when a prompt is canceled. - -#### options.onSubmit - -Type: `Function`
-Default: `() => {}` - -Callback that's invoked after each prompt submission. -Its signature is `(prompt, answer, answers)` where `prompt` is the current prompt object, `answer` the user answer to the current question and `answers` the user answers so far. Async functions are supported. - -Return `true` to quit the prompt chain and return all collected responses so far, otherwise continue to iterate prompt objects. - -**Example:** -```js -let questions = [{ ... }]; -let onSubmit = (prompt, response) => console.log(`Thanks I got ${response} from ${prompt.name}`); -let response = await prompts(questions, { onSubmit }); -``` - -#### options.onCancel - -Type: `Function`
-Default: `() => {}` - -Callback that's invoked when the user cancels/exits the prompt. -Its signature is `(prompt, answers)` where `prompt` is the current prompt object and `answers` the user answers so far. Async functions are supported. - -Return `true` to continue and prevent the prompt loop from aborting. -On cancel responses collected so far are returned. - -**Example:** -```js -let questions = [{ ... }]; -let onCancel = prompt => { - console.log('Never stop prompting!'); - return true; -} -let response = await prompts(questions, { onCancel }); -``` - - -### inject(values) - -Type: `Function`
- -Programmatically inject responses. This enables you to prepare the responses ahead of time. -If any injected value is found the prompt is immediately resolved with the injected value. -This feature is intended for testing only. - -#### values - -Type: `Array` - -Array with values to inject. Resolved values are removed from the internal inject array. -Each value can be an array of values in order to provide answers for a question asked multiple times. -If a value is an instance of `Error` it will simulate the user cancelling/exiting the prompt. - -**Example:** -```js -const prompts = require('prompts'); - -prompts.inject([ '@terkelg', ['#ff0000', '#0000ff'] ]); - -let response = await prompts([ - { - type: 'text', - name: 'twitter', - message: `What's your twitter handle?` - }, - { - type: 'multiselect', - name: 'color', - message: 'Pick colors', - choices: [ - { title: 'Red', value: '#ff0000' }, - { title: 'Green', value: '#00ff00' }, - { title: 'Blue', value: '#0000ff' } - ], - } -]); - -// => { twitter: 'terkelg', color: [ '#ff0000', '#0000ff' ] } - -``` - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ Prompt Objects - -Prompts Objects are JavaScript objects that define the "questions" and the [type of prompt](#-types). -Almost all prompt objects have the following properties: - -```js -{ - type: String | Function, - name: String | Function, - message: String | Function, - initial: String | Function | Async Function - format: Function | Async Function, - onRender: Function - onState: Function -} -``` - -Each property be of type `function` and will be invoked right before prompting the user. - -The function signature is `(prev, values, prompt)`, where `prev` is the value from the previous prompt, -`values` is the response object with all values collected so far and `prompt` is the previous prompt object. - -**Function example:** -```js -{ - type: prev => prev > 3 ? 'confirm' : null, - name: 'confirm', - message: (prev, values) => `Please confirm that you eat ${values.dish} times ${prev} a day?` -} -``` - -The above prompt will be skipped if the value of the previous prompt is less than 3. - -### type - -Type: `String|Function` - -Defines the type of prompt to display. See the list of [prompt types](#-types) for valid values. - -If `type` is a falsy value the prompter will skip that question. -```js -{ - type: null, - name: 'forgetme', - message: `I'll never be shown anyway`, -} -``` - -### name - -Type: `String|Function` - -The response will be saved under this key/property in the returned response object. -In case you have multiple prompts with the same name only the latest response will be stored. - -> Make sure to give prompts unique names if you don't want to overwrite previous values. - -### message - -Type: `String|Function` - -The message to be displayed to the user. - -### initial - -Type: `String|Function` - -Optional default prompt value. Async functions are supported too. - -### format - -Type: `Function` - -Receive the user input and return the formatted value to be used inside the program. -The value returned will be added to the response object. - -The function signature is `(val, values)`, where `val` is the value from the current prompt and -`values` is the current response object in case you need to format based on previous responses. - -**Example:** -```js -{ - type: 'number', - name: 'price', - message: 'Enter price', - format: val => Intl.NumberFormat(undefined, { style: 'currency', currency: 'USD' }).format(val); -} -``` - -### onRender - -Type: `Function` - -Callback for when the prompt is rendered. -The function receives [kleur](https://github.com/lukeed/kleur) as its first argument and `this` refers to the current prompt. - -**Example:** -```js -{ - type: 'number', - message: 'This message will be overridden', - onRender(kleur) { - this.msg = kleur.cyan('Enter a number'); - } -} -``` - -### onState - -Type: `Function` - -Callback for when the state of the current prompt changes. -The function signature is `(state)` where `state` is an object with a snapshot of the current state. -The state object have two properties `value` and `aborted`. E.g `{ value: 'This is ', aborted: false }` - - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ Types - -### text(message, [initial], [style]) -> Text prompt for free text input. - -Hit tab to autocomplete to `initial` value when provided. - -#### Example -text prompt - -```js -{ - type: 'text', - name: 'value', - message: `What's your twitter handle?` -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `string` | Default string value | -| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `default` | -| format | `function` | Receive user input. The returned value will be added to the response object | -| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - - -### password(message, [initial]) -> Password prompt with masked input. - -This prompt is a similar to a prompt of type `'text'` with `style` set to `'password'`. - -#### Example -password prompt - -```js -{ - type: 'password', - name: 'value', - message: 'Tell me a secret' -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `string` | Default string value | -| format | `function` | Receive user input. The returned value will be added to the response object | -| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - - -### invisible(message, [initial]) -> Prompts user for invisible text input. - -This prompt is working like `sudo` where the input is invisible. -This prompt is a similar to a prompt of type `'text'` with style set to `'invisible'`. - -#### Example -invisible prompt - -```js -{ - type: 'invisible', - name: 'value', - message: 'Enter password' -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `string` | Default string value | -| format | `function` | Receive user input. The returned value will be added to the response object | -| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - - -### number(message, initial, [max], [min], [style]) -> Prompts user for number input. - -You can type in numbers and use up/down to increase/decrease the value. Only numbers are allowed as input. Hit tab to autocomplete to `initial` value when provided. - -#### Example -number prompt - -```js -{ - type: 'number', - name: 'value', - message: 'How old are you?', - initial: 0, - style: 'default', - min: 2, - max: 10 -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `number` | Default number value | -| format | `function` | Receive user input. The returned value will be added to the response object | -| validate | `function` | Receive user input. Should return `true` if the value is valid, and an error message `String` otherwise. If `false` is returned, a default error message is shown | -| max | `number` | Max value. Defaults to `Infinity` | -| min | `number` | Min value. Defaults to `-infinity` | -| float | `boolean` | Allow floating point inputs. Defaults to `false` | -| round | `number` | Round `float` values to x decimals. Defaults to `2` | -| increment | `number` | Increment step when using arrow keys. Defaults to `1` | -| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `default` | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - -### confirm(message, [initial]) -> Classic yes/no prompt. - -Hit y or n to confirm/reject. - -#### Example -confirm prompt - -```js -{ - type: 'confirm', - name: 'value', - message: 'Can you confirm?', - initial: true -} -``` - - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `boolean` | Default value. Default is `false` | -| format | `function` | Receive user input. The returned value will be added to the response object | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - -### list(message, [initial]) -> List prompt that return an array. - -Similar to the `text` prompt, but the output is an `Array` containing the -string separated by `separator`. - -```js -{ - type: 'list', - name: 'value', - message: 'Enter keywords', - initial: '', - separator: ',' -} -``` - -list prompt - - -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `boolean` | Default value | -| format | `function` | Receive user input. The returned value will be added to the response object | -| separator | `string` | String separator. Will trim all white-spaces from start and end of string. Defaults to `','` | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - - -### toggle(message, [initial], [active], [inactive]) -> Interactive toggle/switch prompt. - -Use tab or arrow keys/tab/space to switch between options. - -#### Example -toggle prompt - -```js -{ - type: 'toggle', - name: 'value', - message: 'Can you confirm?', - initial: true, - active: 'yes', - inactive: 'no' -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `boolean` | Default value. Defaults to `false` | -| format | `function` | Receive user input. The returned value will be added to the response object | -| active | `string` | Text for `active` state. Defaults to `'on'` | -| inactive | `string` | Text for `inactive` state. Defaults to `'off'` | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - -### select(message, choices, [initial], [hint], [warn]) -> Interactive select prompt. - -Use up/down to navigate. Use tab to cycle the list. - -#### Example -select prompt - -```js -{ - type: 'select', - name: 'value', - message: 'Pick a color', - choices: [ - { title: 'Red', value: '#ff0000' }, - { title: 'Green', value: '#00ff00', disabled: true }, - { title: 'Blue', value: '#0000ff' } - ], - initial: 1 -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| initial | `number` | Index of default value | -| format | `function` | Receive user input. The returned value will be added to the response object | -| hint | `string` | Hint to display to the user | -| warn | `string` | Message to display when selecting a disabled option | -| choices | `Array` | Array of choices objects `[{ title, value, disabled }, ...]` | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - - -### multiselect(message, choices, [initial], [max], [hint], [warn]) -> Interactive multi-select prompt. - -Use space to toggle select/unselect and up/down to navigate. Use tab to cycle the list. You can also use right to select and left to deselect. -By default this prompt returns an `array` containing the **values** of the selected items - not their display title. - -#### Example -multiselect prompt - -```js -{ - type: 'multiselect', - name: 'value', - message: 'Pick colors', - choices: [ - { title: 'Red', value: '#ff0000' }, - { title: 'Green', value: '#00ff00', disabled: true }, - { title: 'Blue', value: '#0000ff', selected: true } - ], - max: 2, - hint: '- Space to select. Return to submit' -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| format | `function` | Receive user input. The returned value will be added to the response object | -| choices | `Array` | Array of choices objects `[{ title, value, disabled, [selected] }, ...]` | -| max | `number` | Max select | -| hint | `string` | Hint to display to the user | -| warn | `string` | Message to display when selecting a disabled option | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - -This is one of the few prompts that don't take a initial value. -If you want to predefine selected values, give the choice object an `selected` property of `true`. - - -### autocomplete(message, choices, [initial], [suggest], [limit], [style]) -> Interactive auto complete prompt. - -The prompt will list options based on user input. Type to filter the list. -Use up/down to navigate. Use tab to cycle the result. Hit enter to select the highlighted item below the prompt. - -The default suggests function is sorting based on the `title` property of the choices. -You can overwrite how choices are being filtered by passing your own suggest function. - -#### Example -auto complete prompt - -```js -{ - type: 'autocomplete', - name: 'value', - message: 'Pick your favorite actor', - choices: [ - { title: 'Cage' }, - { title: 'Clooney', value: 'silver-fox' }, - { title: 'Gyllenhaal' }, - { title: 'Gibson' }, - { title: 'Grant' }, - ] -} -``` - -#### Options -| Param | Type | Description | -| ----- | :--: | ----------- | -| message | `string` | Prompt message to display | -| format | `function` | Receive user input. The returned value will be added to the response object | -| choices | `Array` | Array of auto-complete choices objects `[{ title, value }, ...]` | -| suggest | `function` | Filter function. Defaults to sort by `title` property. `suggest` should always return a promise. Filters using `title` by default | -| limit | `number` | Max number of results to show. Defaults to `10` | -| style | `string` | Render style (`default`, `password`, `invisible`, `emoji`). Defaults to `'default'` | -| initial | Default initial value | -| fallback | Fallback message when no match is found. Defaults to `initial` value if provided | -| onRender | `function` | On render callback. Keyword `this` refers to the current prompt | -| onState | `function` | On state change callback. Function signature is an `object` with two propetires: `value` and `aborted` | - -Example on what a `suggest` function might look like: -```js -const suggestByTitle = (input, choices) => - Promise.resolve(choices.filter(i => i.title.slice(0, input.length) === input)) -``` - - -![split](https://github.com/terkelg/prompts/raw/master/media/split.png) - - -## ❯ Credit -Many of the prompts are based on the work of [derhuerst](https://github.com/derhuerst). - - -## ❯ License - -MIT © [Terkel Gjervig](https://terkel.com) diff --git a/node_modules/react-is/LICENSE b/node_modules/react-is/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/react-is/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/react-is/README.md b/node_modules/react-is/README.md deleted file mode 100644 index d255977618178..0000000000000 --- a/node_modules/react-is/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# `react-is` - -This package allows you to test arbitrary values and see if they're a particular React element type. - -## Installation - -```sh -# Yarn -yarn add react-is - -# NPM -npm install react-is -``` - -## Usage - -### Determining if a Component is Valid - -```js -import React from "react"; -import * as ReactIs from "react-is"; - -class ClassComponent extends React.Component { - render() { - return React.createElement("div"); - } -} - -const FunctionComponent = () => React.createElement("div"); - -const ForwardRefComponent = React.forwardRef((props, ref) => - React.createElement(Component, { forwardedRef: ref, ...props }) -); - -const Context = React.createContext(false); - -ReactIs.isValidElementType("div"); // true -ReactIs.isValidElementType(ClassComponent); // true -ReactIs.isValidElementType(FunctionComponent); // true -ReactIs.isValidElementType(ForwardRefComponent); // true -ReactIs.isValidElementType(Context.Provider); // true -ReactIs.isValidElementType(Context.Consumer); // true -ReactIs.isValidElementType(React.createFactory("div")); // true -``` - -### Determining an Element's Type - -#### Context - -```js -import React from "react"; -import * as ReactIs from 'react-is'; - -const ThemeContext = React.createContext("blue"); - -ReactIs.isContextConsumer(); // true -ReactIs.isContextProvider(); // true -ReactIs.typeOf() === ReactIs.ContextProvider; // true -ReactIs.typeOf() === ReactIs.ContextConsumer; // true -``` - -#### Element - -```js -import React from "react"; -import * as ReactIs from 'react-is'; - -ReactIs.isElement(
); // true -ReactIs.typeOf(
) === ReactIs.Element; // true -``` - -#### Fragment - -```js -import React from "react"; -import * as ReactIs from 'react-is'; - -ReactIs.isFragment(<>); // true -ReactIs.typeOf(<>) === ReactIs.Fragment; // true -``` - -#### Portal - -```js -import React from "react"; -import ReactDOM from "react-dom"; -import * as ReactIs from 'react-is'; - -const div = document.createElement("div"); -const portal = ReactDOM.createPortal(
, div); - -ReactIs.isPortal(portal); // true -ReactIs.typeOf(portal) === ReactIs.Portal; // true -``` - -#### StrictMode - -```js -import React from "react"; -import * as ReactIs from 'react-is'; - -ReactIs.isStrictMode(); // true -ReactIs.typeOf() === ReactIs.StrictMode; // true -``` diff --git a/node_modules/react-is/build-info.json b/node_modules/react-is/build-info.json deleted file mode 100644 index db5dbe5e2edc4..0000000000000 --- a/node_modules/react-is/build-info.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "branch": "pull/21051", - "buildNumber": "287151", - "checksum": "94f5c65", - "commit": "12adaffef", - "environment": "ci", - "reactVersion": "17.0.0-12adaffef" -} diff --git a/node_modules/react-is/cjs/react-is.development.js b/node_modules/react-is/cjs/react-is.development.js deleted file mode 100644 index b2e388eb12403..0000000000000 --- a/node_modules/react-is/cjs/react-is.development.js +++ /dev/null @@ -1,226 +0,0 @@ -/** @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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -// 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_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; -var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; -var REACT_OFFSCREEN_TYPE = 0xeae2; -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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = 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; -} - -exports.ContextConsumer = ContextConsumer; -exports.ContextProvider = ContextProvider; -exports.Element = Element; -exports.ForwardRef = ForwardRef; -exports.Fragment = Fragment; -exports.Lazy = Lazy; -exports.Memo = Memo; -exports.Portal = Portal; -exports.Profiler = Profiler; -exports.StrictMode = StrictMode; -exports.Suspense = Suspense; -exports.isAsyncMode = isAsyncMode; -exports.isConcurrentMode = isConcurrentMode; -exports.isContextConsumer = isContextConsumer; -exports.isContextProvider = isContextProvider; -exports.isElement = isElement; -exports.isForwardRef = isForwardRef; -exports.isFragment = isFragment; -exports.isLazy = isLazy; -exports.isMemo = isMemo; -exports.isPortal = isPortal; -exports.isProfiler = isProfiler; -exports.isStrictMode = isStrictMode; -exports.isSuspense = isSuspense; -exports.isValidElementType = isValidElementType; -exports.typeOf = typeOf; - })(); -} diff --git a/node_modules/react-is/cjs/react-is.production.min.js b/node_modules/react-is/cjs/react-is.production.min.js deleted file mode 100644 index b416090425d66..0000000000000 --- a/node_modules/react-is/cjs/react-is.production.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @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. - */ -'use strict';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;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H; -exports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n}; -exports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.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}; -exports.typeOf=y; diff --git a/node_modules/react-is/index.js b/node_modules/react-is/index.js deleted file mode 100644 index 3ae098d078776..0000000000000 --- a/node_modules/react-is/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/react-is.production.min.js'); -} else { - module.exports = require('./cjs/react-is.development.js'); -} diff --git a/node_modules/react-is/package.json b/node_modules/react-is/package.json deleted file mode 100644 index 1a6567dcff5e9..0000000000000 --- a/node_modules/react-is/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "react-is", - "version": "17.0.2", - "description": "Brand checking of React Elements.", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/facebook/react.git", - "directory": "packages/react-is" - }, - "keywords": [ - "react" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/facebook/react/issues" - }, - "homepage": "https://reactjs.org/", - "files": [ - "LICENSE", - "README.md", - "build-info.json", - "index.js", - "cjs/", - "umd/" - ] -} diff --git a/node_modules/react-is/umd/react-is.development.js b/node_modules/react-is/umd/react-is.development.js deleted file mode 100644 index cc44c5bf49c3b..0000000000000 --- a/node_modules/react-is/umd/react-is.development.js +++ /dev/null @@ -1,225 +0,0 @@ -/** @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. - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.ReactIs = {})); -}(this, (function (exports) { 'use strict'; - - // 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_SCOPE_TYPE = 0xead7; - var REACT_OPAQUE_ID_TYPE = 0xeae0; - var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; - var REACT_OFFSCREEN_TYPE = 0xeae2; - 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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = 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; - } - - exports.ContextConsumer = ContextConsumer; - exports.ContextProvider = ContextProvider; - exports.Element = Element; - exports.ForwardRef = ForwardRef; - exports.Fragment = Fragment; - exports.Lazy = Lazy; - exports.Memo = Memo; - exports.Portal = Portal; - exports.Profiler = Profiler; - exports.StrictMode = StrictMode; - exports.Suspense = Suspense; - exports.isAsyncMode = isAsyncMode; - exports.isConcurrentMode = isConcurrentMode; - exports.isContextConsumer = isContextConsumer; - exports.isContextProvider = isContextProvider; - exports.isElement = isElement; - exports.isForwardRef = isForwardRef; - exports.isFragment = isFragment; - exports.isLazy = isLazy; - exports.isMemo = isMemo; - exports.isPortal = isPortal; - exports.isProfiler = isProfiler; - exports.isStrictMode = isStrictMode; - exports.isSuspense = isSuspense; - exports.isValidElementType = isValidElementType; - exports.typeOf = typeOf; - -}))); diff --git a/node_modules/react-is/umd/react-is.production.min.js b/node_modules/react-is/umd/react-is.production.min.js deleted file mode 100644 index 126d595e09069..0000000000000 --- a/node_modules/react-is/umd/react-is.production.min.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @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. - */ -(function(){'use strict';(function(b,d){"object"===typeof exports&&"undefined"!==typeof module?d(exports):"function"===typeof define&&define.amd?define(["exports"],d):(b=b||self,d(b.ReactIs={}))})(this,function(b){function d(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case q:switch(a=a.type,a){case e:case f:case g:case h:case t:return a;default:switch(a=a&&a.$$typeof,a){case k:case l:case m:case n:case p:return a;default:return b}}case r:return b}}}var q=60103,r=60106,e=60107,g=60108,f=60114, -p=60109,k=60110,l=60112,h=60113,t=60120,n=60115,m=60116,u=60121,v=60122,w=60117,x=60129,y=60131;if("function"===typeof Symbol&&Symbol.for){var c=Symbol.for;q=c("react.element");r=c("react.portal");e=c("react.fragment");g=c("react.strict_mode");f=c("react.profiler");p=c("react.provider");k=c("react.context");l=c("react.forward_ref");h=c("react.suspense");t=c("react.suspense_list");n=c("react.memo");m=c("react.lazy");u=c("react.block");v=c("react.server.block");w=c("react.fundamental");x=c("react.debug_trace_mode"); -y=c("react.legacy_hidden")}b.ContextConsumer=k;b.ContextProvider=p;b.Element=q;b.ForwardRef=l;b.Fragment=e;b.Lazy=m;b.Memo=n;b.Portal=r;b.Profiler=f;b.StrictMode=g;b.Suspense=h;b.isAsyncMode=function(a){return!1};b.isConcurrentMode=function(a){return!1};b.isContextConsumer=function(a){return d(a)===k};b.isContextProvider=function(a){return d(a)===p};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===q};b.isForwardRef=function(a){return d(a)===l};b.isFragment=function(a){return d(a)=== -e};b.isLazy=function(a){return d(a)===m};b.isMemo=function(a){return d(a)===n};b.isPortal=function(a){return d(a)===r};b.isProfiler=function(a){return d(a)===f};b.isStrictMode=function(a){return d(a)===g};b.isSuspense=function(a){return d(a)===h};b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===f||a===x||a===g||a===h||a===t||a===y||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===n||a.$$typeof===p||a.$$typeof===k||a.$$typeof===l||a.$$typeof=== -w||a.$$typeof===u||a[0]===v)?!0:!1};b.typeOf=d}); -})(); diff --git a/node_modules/react-refresh/LICENSE b/node_modules/react-refresh/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/react-refresh/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/react-refresh/README.md b/node_modules/react-refresh/README.md deleted file mode 100644 index f6983ef52ae9e..0000000000000 --- a/node_modules/react-refresh/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# react-refresh - -This package implements the wiring necessary to integrate Fast Refresh into bundlers. Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to an old feature known as "hot reloading", but Fast Refresh is more reliable and officially supported by React. - -This package is primarily aimed at developers of bundler plugins. If you’re working on one, here is a [rough guide](https://github.com/facebook/react/issues/16604#issuecomment-528663101) for Fast Refresh integration using this package. diff --git a/node_modules/react-refresh/babel.js b/node_modules/react-refresh/babel.js deleted file mode 100644 index d222a0d3fd1da..0000000000000 --- a/node_modules/react-refresh/babel.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/react-refresh-babel.production.min.js'); -} else { - module.exports = require('./cjs/react-refresh-babel.development.js'); -} diff --git a/node_modules/react-refresh/build-info.json b/node_modules/react-refresh/build-info.json deleted file mode 100644 index 61dca928a9c65..0000000000000 --- a/node_modules/react-refresh/build-info.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "branch": "master", - "buildNumber": "216201", - "checksum": "6a2f7e9", - "commit": "4ead6b530", - "environment": "ci", - "reactVersion": "17.0.0-alpha.0-4ead6b530" -} diff --git a/node_modules/react-refresh/cjs/react-refresh-babel.development.js b/node_modules/react-refresh/cjs/react-refresh-babel.development.js deleted file mode 100644 index 63468fc0d9731..0000000000000 --- a/node_modules/react-refresh/cjs/react-refresh-babel.development.js +++ /dev/null @@ -1,758 +0,0 @@ -/** @license React v0.9.0 - * react-refresh-babel.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -function ReactFreshBabelPlugin (babel) { - var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - if (typeof babel.env === 'function') { - // Only available in Babel 7. - var env = babel.env(); - - if (env !== 'development' && !opts.skipEnvCheck) { - throw new Error('React Refresh Babel transform should only be enabled in development environment. ' + 'Instead, the environment is: "' + env + '". If you want to override this check, pass {skipEnvCheck: true} as plugin options.'); - } - } - - var t = babel.types; - var refreshReg = t.identifier(opts.refreshReg || '$RefreshReg$'); - var refreshSig = t.identifier(opts.refreshSig || '$RefreshSig$'); - var registrationsByProgramPath = new Map(); - - function createRegistration(programPath, persistentID) { - var handle = programPath.scope.generateUidIdentifier('c'); - - if (!registrationsByProgramPath.has(programPath)) { - registrationsByProgramPath.set(programPath, []); - } - - var registrations = registrationsByProgramPath.get(programPath); - registrations.push({ - handle: handle, - persistentID: persistentID - }); - return handle; - } - - function isComponentishName(name) { - return typeof name === 'string' && name[0] >= 'A' && name[0] <= 'Z'; - } - - function findInnerComponents(inferredName, path, callback) { - var node = path.node; - - switch (node.type) { - case 'Identifier': - { - if (!isComponentishName(node.name)) { - return false; - } // export default hoc(Foo) - // const X = hoc(Foo) - - - callback(inferredName, node, null); - return true; - } - - case 'FunctionDeclaration': - { - // function Foo() {} - // export function Foo() {} - // export default function Foo() {} - callback(inferredName, node.id, null); - return true; - } - - case 'ArrowFunctionExpression': - { - if (node.body.type === 'ArrowFunctionExpression') { - return false; - } // let Foo = () => {} - // export default hoc1(hoc2(() => {})) - - - callback(inferredName, node, path); - return true; - } - - case 'FunctionExpression': - { - // let Foo = function() {} - // const Foo = hoc1(forwardRef(function renderFoo() {})) - // export default memo(function() {}) - callback(inferredName, node, path); - return true; - } - - case 'CallExpression': - { - var argsPath = path.get('arguments'); - - if (argsPath === undefined || argsPath.length === 0) { - return false; - } - - var calleePath = path.get('callee'); - - switch (calleePath.node.type) { - case 'MemberExpression': - case 'Identifier': - { - var calleeSource = calleePath.getSource(); - var firstArgPath = argsPath[0]; - var innerName = inferredName + '$' + calleeSource; - var foundInside = findInnerComponents(innerName, firstArgPath, callback); - - if (!foundInside) { - return false; - } // const Foo = hoc1(hoc2(() => {})) - // export default memo(React.forwardRef(function() {})) - - - callback(inferredName, node, path); - return true; - } - - default: - { - return false; - } - } - } - - case 'VariableDeclarator': - { - var init = node.init; - - if (init === null) { - return false; - } - - var name = node.id.name; - - if (!isComponentishName(name)) { - return false; - } - - switch (init.type) { - case 'ArrowFunctionExpression': - case 'FunctionExpression': - // Likely component definitions. - break; - - case 'CallExpression': - { - // Maybe a HOC. - // Try to determine if this is some form of import. - var callee = init.callee; - var calleeType = callee.type; - - if (calleeType === 'Import') { - return false; - } else if (calleeType === 'Identifier') { - if (callee.name.indexOf('require') === 0) { - return false; - } else if (callee.name.indexOf('import') === 0) { - return false; - } // Neither require nor import. Might be a HOC. - // Pass through. - - } - - break; - } - - case 'TaggedTemplateExpression': - // Maybe something like styled.div`...` - break; - - default: - return false; - } - - var initPath = path.get('init'); - - var _foundInside = findInnerComponents(inferredName, initPath, callback); - - if (_foundInside) { - return true; - } // See if this identifier is used in JSX. Then it's a component. - - - var binding = path.scope.getBinding(name); - - if (binding === undefined) { - return; - } - - var isLikelyUsedAsType = false; - var referencePaths = binding.referencePaths; - - for (var i = 0; i < referencePaths.length; i++) { - var ref = referencePaths[i]; - - if (ref.node && ref.node.type !== 'JSXIdentifier' && ref.node.type !== 'Identifier') { - continue; - } - - var refParent = ref.parent; - - if (refParent.type === 'JSXOpeningElement') { - isLikelyUsedAsType = true; - } else if (refParent.type === 'CallExpression') { - var _callee = refParent.callee; - var fnName = void 0; - - switch (_callee.type) { - case 'Identifier': - fnName = _callee.name; - break; - - case 'MemberExpression': - fnName = _callee.property.name; - break; - } - - switch (fnName) { - case 'createElement': - case 'jsx': - case 'jsxDEV': - case 'jsxs': - isLikelyUsedAsType = true; - break; - } - } - - if (isLikelyUsedAsType) { - // const X = ... + later - callback(inferredName, init, initPath); - return true; - } - } - } - } - - return false; - } - - function isBuiltinHook(hookName) { - switch (hookName) { - case 'useState': - case 'React.useState': - case 'useReducer': - case 'React.useReducer': - case 'useEffect': - case 'React.useEffect': - case 'useLayoutEffect': - case 'React.useLayoutEffect': - case 'useMemo': - case 'React.useMemo': - case 'useCallback': - case 'React.useCallback': - case 'useRef': - case 'React.useRef': - case 'useContext': - case 'React.useContext': - case 'useImperativeMethods': - case 'React.useImperativeMethods': - case 'useDebugValue': - case 'React.useDebugValue': - return true; - - default: - return false; - } - } - - function getHookCallsSignature(functionNode) { - var fnHookCalls = hookCalls.get(functionNode); - - if (fnHookCalls === undefined) { - return null; - } - - return { - key: fnHookCalls.map(function (call) { - return call.name + '{' + call.key + '}'; - }).join('\n'), - customHooks: fnHookCalls.filter(function (call) { - return !isBuiltinHook(call.name); - }).map(function (call) { - return t.cloneDeep(call.callee); - }) - }; - } - - var hasForceResetCommentByFile = new WeakMap(); // We let user do /* @refresh reset */ to reset state in the whole file. - - function hasForceResetComment(path) { - var file = path.hub.file; - var hasForceReset = hasForceResetCommentByFile.get(file); - - if (hasForceReset !== undefined) { - return hasForceReset; - } - - hasForceReset = false; - var comments = file.ast.comments; - - for (var i = 0; i < comments.length; i++) { - var cmt = comments[i]; - - if (cmt.value.indexOf('@refresh reset') !== -1) { - hasForceReset = true; - break; - } - } - - hasForceResetCommentByFile.set(file, hasForceReset); - return hasForceReset; - } - - function createArgumentsForSignature(node, signature, scope) { - var key = signature.key, - customHooks = signature.customHooks; - var forceReset = hasForceResetComment(scope.path); - var customHooksInScope = []; - customHooks.forEach(function (callee) { - // Check if a corresponding binding exists where we emit the signature. - var bindingName; - - switch (callee.type) { - case 'MemberExpression': - if (callee.object.type === 'Identifier') { - bindingName = callee.object.name; - } - - break; - - case 'Identifier': - bindingName = callee.name; - break; - } - - if (scope.hasBinding(bindingName)) { - customHooksInScope.push(callee); - } else { - // We don't have anything to put in the array because Hook is out of scope. - // Since it could potentially have been edited, remount the component. - forceReset = true; - } - }); - var finalKey = key; - - if (typeof require === 'function' && !opts.emitFullSignatures) { - // Prefer to hash when we can (e.g. outside of ASTExplorer). - // This makes it deterministically compact, even if there's - // e.g. a useState initializer with some code inside. - // We also need it for www that has transforms like cx() - // that don't understand if something is part of a string. - finalKey = require('crypto').createHash('sha1').update(key).digest('base64'); - } - - var args = [node, t.stringLiteral(finalKey)]; - - if (forceReset || customHooksInScope.length > 0) { - args.push(t.booleanLiteral(forceReset)); - } - - if (customHooksInScope.length > 0) { - args.push( // TODO: We could use an arrow here to be more compact. - // However, don't do it until AMA can run them natively. - t.functionExpression(null, [], t.blockStatement([t.returnStatement(t.arrayExpression(customHooksInScope))]))); - } - - return args; - } - - var seenForRegistration = new WeakSet(); - var seenForSignature = new WeakSet(); - var seenForOutro = new WeakSet(); - var hookCalls = new WeakMap(); - var HookCallsVisitor = { - CallExpression: function (path) { - var node = path.node; - var callee = node.callee; // Note: this visitor MUST NOT mutate the tree in any way. - // It runs early in a separate traversal and should be very fast. - - var name = null; - - switch (callee.type) { - case 'Identifier': - name = callee.name; - break; - - case 'MemberExpression': - name = callee.property.name; - break; - } - - if (name === null || !/^use[A-Z]/.test(name)) { - return; - } - - var fnScope = path.scope.getFunctionParent(); - - if (fnScope === null) { - return; - } // This is a Hook call. Record it. - - - var fnNode = fnScope.block; - - if (!hookCalls.has(fnNode)) { - hookCalls.set(fnNode, []); - } - - var hookCallsForFn = hookCalls.get(fnNode); - var key = ''; - - if (path.parent.type === 'VariableDeclarator') { - // TODO: if there is no LHS, consider some other heuristic. - key = path.parentPath.get('id').getSource(); - } // Some built-in Hooks reset on edits to arguments. - - - var args = path.get('arguments'); - - if (name === 'useState' && args.length > 0) { - // useState second argument is initial state. - key += '(' + args[0].getSource() + ')'; - } else if (name === 'useReducer' && args.length > 1) { - // useReducer second argument is initial state. - key += '(' + args[1].getSource() + ')'; - } - - hookCallsForFn.push({ - callee: path.node.callee, - name: name, - key: key - }); - } - }; - return { - visitor: { - ExportDefaultDeclaration: function (path) { - var node = path.node; - var decl = node.declaration; - var declPath = path.get('declaration'); - - if (decl.type !== 'CallExpression') { - // For now, we only support possible HOC calls here. - // Named function declarations are handled in FunctionDeclaration. - // Anonymous direct exports like export default function() {} - // are currently ignored. - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - if (seenForRegistration.has(node)) { - return; - } - - seenForRegistration.add(node); // Don't mutate the tree above this point. - // This code path handles nested cases like: - // export default memo(() => {}) - // In those cases it is more plausible people will omit names - // so they're worth handling despite possible false positives. - // More importantly, it handles the named case: - // export default memo(function Named() {}) - - var inferredName = '%default%'; - var programPath = path.parentPath; - findInnerComponents(inferredName, declPath, function (persistentID, targetExpr, targetPath) { - if (targetPath === null) { - // For case like: - // export default hoc(Foo) - // we don't want to wrap Foo inside the call. - // Instead we assume it's registered at definition. - return; - } - - var handle = createRegistration(programPath, persistentID); - targetPath.replaceWith(t.assignmentExpression('=', handle, targetExpr)); - }); - }, - FunctionDeclaration: { - enter: function (path) { - var node = path.node; - var programPath; - var insertAfterPath; - - switch (path.parent.type) { - case 'Program': - insertAfterPath = path; - programPath = path.parentPath; - break; - - case 'ExportNamedDeclaration': - insertAfterPath = path.parentPath; - programPath = insertAfterPath.parentPath; - break; - - case 'ExportDefaultDeclaration': - insertAfterPath = path.parentPath; - programPath = insertAfterPath.parentPath; - break; - - default: - return; - } - - var id = node.id; - - if (id === null) { - // We don't currently handle anonymous default exports. - return; - } - - var inferredName = id.name; - - if (!isComponentishName(inferredName)) { - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - if (seenForRegistration.has(node)) { - return; - } - - seenForRegistration.add(node); // Don't mutate the tree above this point. - // export function Named() {} - // function Named() {} - - findInnerComponents(inferredName, path, function (persistentID, targetExpr) { - var handle = createRegistration(programPath, persistentID); - insertAfterPath.insertAfter(t.expressionStatement(t.assignmentExpression('=', handle, targetExpr))); - }); - }, - exit: function (path) { - var node = path.node; - var id = node.id; - - if (id === null) { - return; - } - - var signature = getHookCallsSignature(node); - - if (signature === null) { - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - if (seenForSignature.has(node)) { - return; - } - - seenForSignature.add(node); // Don't mutate the tree above this point. - - var sigCallID = path.scope.generateUidIdentifier('_s'); - path.scope.parent.push({ - id: sigCallID, - init: t.callExpression(refreshSig, []) - }); // The signature call is split in two parts. One part is called inside the function. - // This is used to signal when first render happens. - - path.get('body').unshiftContainer('body', t.expressionStatement(t.callExpression(sigCallID, []))); // The second call is around the function itself. - // This is used to associate a type with a signature. - // Unlike with $RefreshReg$, this needs to work for nested - // declarations too. So we need to search for a path where - // we can insert a statement rather than hard coding it. - - var insertAfterPath = null; - path.find(function (p) { - if (p.parentPath.isBlock()) { - insertAfterPath = p; - return true; - } - }); - - if (insertAfterPath === null) { - return; - } - - insertAfterPath.insertAfter(t.expressionStatement(t.callExpression(sigCallID, createArgumentsForSignature(id, signature, insertAfterPath.scope)))); - } - }, - 'ArrowFunctionExpression|FunctionExpression': { - exit: function (path) { - var node = path.node; - var signature = getHookCallsSignature(node); - - if (signature === null) { - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - if (seenForSignature.has(node)) { - return; - } - - seenForSignature.add(node); // Don't mutate the tree above this point. - - var sigCallID = path.scope.generateUidIdentifier('_s'); - path.scope.parent.push({ - id: sigCallID, - init: t.callExpression(refreshSig, []) - }); // The signature call is split in two parts. One part is called inside the function. - // This is used to signal when first render happens. - - if (path.node.body.type !== 'BlockStatement') { - path.node.body = t.blockStatement([t.returnStatement(path.node.body)]); - } - - path.get('body').unshiftContainer('body', t.expressionStatement(t.callExpression(sigCallID, []))); // The second call is around the function itself. - // This is used to associate a type with a signature. - - if (path.parent.type === 'VariableDeclarator') { - var insertAfterPath = null; - path.find(function (p) { - if (p.parentPath.isBlock()) { - insertAfterPath = p; - return true; - } - }); - - if (insertAfterPath === null) { - return; - } // Special case when a function would get an inferred name: - // let Foo = () => {} - // let Foo = function() {} - // We'll add signature it on next line so that - // we don't mess up the inferred 'Foo' function name. - - - insertAfterPath.insertAfter(t.expressionStatement(t.callExpression(sigCallID, createArgumentsForSignature(path.parent.id, signature, insertAfterPath.scope)))); // Result: let Foo = () => {}; __signature(Foo, ...); - } else { - // let Foo = hoc(() => {}) - path.replaceWith(t.callExpression(sigCallID, createArgumentsForSignature(node, signature, path.scope))); // Result: let Foo = hoc(__signature(() => {}, ...)) - } - } - }, - VariableDeclaration: function (path) { - var node = path.node; - var programPath; - var insertAfterPath; - - switch (path.parent.type) { - case 'Program': - insertAfterPath = path; - programPath = path.parentPath; - break; - - case 'ExportNamedDeclaration': - insertAfterPath = path.parentPath; - programPath = insertAfterPath.parentPath; - break; - - case 'ExportDefaultDeclaration': - insertAfterPath = path.parentPath; - programPath = insertAfterPath.parentPath; - break; - - default: - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - if (seenForRegistration.has(node)) { - return; - } - - seenForRegistration.add(node); // Don't mutate the tree above this point. - - var declPaths = path.get('declarations'); - - if (declPaths.length !== 1) { - return; - } - - var declPath = declPaths[0]; - var inferredName = declPath.node.id.name; - findInnerComponents(inferredName, declPath, function (persistentID, targetExpr, targetPath) { - if (targetPath === null) { - // For case like: - // export const Something = hoc(Foo) - // we don't want to wrap Foo inside the call. - // Instead we assume it's registered at definition. - return; - } - - var handle = createRegistration(programPath, persistentID); - - if (targetPath.parent.type === 'VariableDeclarator') { - // Special case when a variable would get an inferred name: - // let Foo = () => {} - // let Foo = function() {} - // let Foo = styled.div``; - // We'll register it on next line so that - // we don't mess up the inferred 'Foo' function name. - // (eg: with @babel/plugin-transform-react-display-name or - // babel-plugin-styled-components) - insertAfterPath.insertAfter(t.expressionStatement(t.assignmentExpression('=', handle, declPath.node.id))); // Result: let Foo = () => {}; _c1 = Foo; - } else { - // let Foo = hoc(() => {}) - targetPath.replaceWith(t.assignmentExpression('=', handle, targetExpr)); // Result: let Foo = hoc(_c1 = () => {}) - } - }); - }, - Program: { - enter: function (path) { - // This is a separate early visitor because we need to collect Hook calls - // and "const [foo, setFoo] = ..." signatures before the destructuring - // transform mangles them. This extra traversal is not ideal for perf, - // but it's the best we can do until we stop transpiling destructuring. - path.traverse(HookCallsVisitor); - }, - exit: function (path) { - var registrations = registrationsByProgramPath.get(path); - - if (registrations === undefined) { - return; - } // Make sure we're not mutating the same tree twice. - // This can happen if another Babel plugin replaces parents. - - - var node = path.node; - - if (seenForOutro.has(node)) { - return; - } - - seenForOutro.add(node); // Don't mutate the tree above this point. - - registrationsByProgramPath.delete(path); - var declarators = []; - path.pushContainer('body', t.variableDeclaration('var', declarators)); - registrations.forEach(function (_ref) { - var handle = _ref.handle, - persistentID = _ref.persistentID; - path.pushContainer('body', t.expressionStatement(t.callExpression(refreshReg, [handle, t.stringLiteral(persistentID)]))); - declarators.push(t.variableDeclarator(handle)); - }); - } - } - } - }; -} - -module.exports = ReactFreshBabelPlugin; - })(); -} diff --git a/node_modules/react-refresh/cjs/react-refresh-babel.production.min.js b/node_modules/react-refresh/cjs/react-refresh-babel.production.min.js deleted file mode 100644 index 2f94c8a8928e9..0000000000000 --- a/node_modules/react-refresh/cjs/react-refresh-babel.production.min.js +++ /dev/null @@ -1,21 +0,0 @@ -/** @license React v0.9.0 - * react-refresh-babel.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. - */ -'use strict';module.exports=function(r){function t(a,b){var d=a.scope.generateUidIdentifier("c");l.has(a)||l.set(a,[]);l.get(a).push({handle:d,persistentID:b});return d}function u(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function m(a,b,d){var c=b.node;switch(c.type){case "Identifier":if(!u(c.name))break;d(a,c,null);return!0;case "FunctionDeclaration":return d(a,c.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===c.body.type)break;d(a,c,b);return!0;case "FunctionExpression":return d(a, -c,b),!0;case "CallExpression":var f=b.get("arguments");if(void 0===f||0===f.length)break;var g=b.get("callee");switch(g.node.type){case "MemberExpression":case "Identifier":g=g.getSource();if(!m(a+"$"+g,f[0],d))return!1;d(a,c,b);return!0;default:return!1}case "VariableDeclarator":if(f=c.init,null!==f&&(g=c.id.name,u(g))){switch(f.type){case "ArrowFunctionExpression":case "FunctionExpression":break;case "CallExpression":c=f.callee;var e=c.type;if("Import"===e||"Identifier"===e&&(0===c.name.indexOf("require")|| -0===c.name.indexOf("import")))return!1;break;case "TaggedTemplateExpression":break;default:return!1}c=b.get("init");if(m(a,c,d))return!0;g=b.scope.getBinding(g);if(void 0===g)return;b=!1;g=g.referencePaths;for(e=0;e 2 && arguments[2] !== undefined ? arguments[2] : false; - var getCustomHooks = arguments.length > 3 ? arguments[3] : undefined; - - { - allSignaturesByType.set(type, { - forceReset: forceReset, - ownKey: key, - fullKey: null, - getCustomHooks: getCustomHooks || function () { - return []; - } - }); - } -} // This is lazily called during first render for a type. -// It captures Hook list at that time so inline requires don't break comparisons. - -function collectCustomHooksForSignature(type) { - { - var signature = allSignaturesByType.get(type); - - if (signature !== undefined) { - computeFullKey(signature); - } - } -} -function getFamilyByID(id) { - { - return allFamiliesByID.get(id); - } -} -function getFamilyByType(type) { - { - return allFamiliesByType.get(type); - } -} -function findAffectedHostInstances(families) { - { - var affectedInstances = new Set(); - mountedRoots.forEach(function (root) { - var helpers = helpersByRoot.get(root); - - if (helpers === undefined) { - throw new Error('Could not find helpers for a root. This is a bug in React Refresh.'); - } - - var instancesForRoot = helpers.findHostInstancesForRefresh(root, families); - instancesForRoot.forEach(function (inst) { - affectedInstances.add(inst); - }); - }); - return affectedInstances; - } -} -function injectIntoGlobalHook(globalObject) { - { - // For React Native, the global hook will be set up by require('react-devtools-core'). - // That code will run before us. So we need to monkeypatch functions on existing hook. - // For React Web, the global hook will be set up by the extension. - // This will also run before us. - var hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__; - - if (hook === undefined) { - // However, if there is no DevTools extension, we'll need to set up the global hook ourselves. - // Note that in this case it's important that renderer code runs *after* this method call. - // Otherwise, the renderer will think that there is no global hook, and won't do the injection. - var nextID = 0; - globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = { - renderers: new Map(), - supportsFiber: true, - inject: function (injected) { - return nextID++; - }, - onScheduleFiberRoot: function (id, root, children) {}, - onCommitFiberRoot: function (id, root, maybePriorityLevel, didError) {}, - onCommitFiberUnmount: function () {} - }; - } // Here, we just want to get a reference to scheduleRefresh. - - - var oldInject = hook.inject; - - hook.inject = function (injected) { - var id = oldInject.apply(this, arguments); - - if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') { - // This version supports React Refresh. - helpersByRendererID.set(id, injected); - } - - return id; - }; // Do the same for any already injected roots. - // This is useful if ReactDOM has already been initialized. - // https://github.com/facebook/react/issues/17626 - - - hook.renderers.forEach(function (injected, id) { - if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') { - // This version supports React Refresh. - helpersByRendererID.set(id, injected); - } - }); // We also want to track currently mounted roots. - - var oldOnCommitFiberRoot = hook.onCommitFiberRoot; - - var oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || function () {}; - - hook.onScheduleFiberRoot = function (id, root, children) { - if (!isPerformingRefresh) { - // If it was intentionally scheduled, don't attempt to restore. - // This includes intentionally scheduled unmounts. - failedRoots.delete(root); - - if (rootElements !== null) { - rootElements.set(root, children); - } - } - - return oldOnScheduleFiberRoot.apply(this, arguments); - }; - - hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) { - var helpers = helpersByRendererID.get(id); - - if (helpers === undefined) { - return; - } - - helpersByRoot.set(root, helpers); - var current = root.current; - var alternate = current.alternate; // We need to determine whether this root has just (un)mounted. - // This logic is copy-pasted from similar logic in the DevTools backend. - // If this breaks with some refactoring, you'll want to update DevTools too. - - if (alternate !== null) { - var wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null; - var isMounted = current.memoizedState != null && current.memoizedState.element != null; - - if (!wasMounted && isMounted) { - // Mount a new root. - mountedRoots.add(root); - failedRoots.delete(root); - } else if (wasMounted && isMounted) ; else if (wasMounted && !isMounted) { - // Unmount an existing root. - mountedRoots.delete(root); - - if (didError) { - // We'll remount it on future edits. - failedRoots.add(root); - } else { - helpersByRoot.delete(root); - } - } else if (!wasMounted && !isMounted) { - if (didError) { - // We'll remount it on future edits. - failedRoots.add(root); - } - } - } else { - // Mount a new root. - mountedRoots.add(root); - } - - return oldOnCommitFiberRoot.apply(this, arguments); - }; - } -} -function hasUnrecoverableErrors() { - // TODO: delete this after removing dependency in RN. - return false; -} // Exposed for testing. - -function _getMountedRootCount() { - { - return mountedRoots.size; - } -} // This is a wrapper over more primitive functions for setting signature. -// Signatures let us decide whether the Hook order has changed on refresh. -// -// This function is intended to be used as a transform target, e.g.: -// var _s = createSignatureFunctionForTransform() -// -// function Hello() { -// const [foo, setFoo] = useState(0); -// const value = useCustomHook(); -// _s(); /* Second call triggers collecting the custom Hook list. -// * This doesn't happen during the module evaluation because we -// * don't want to change the module order with inline requires. -// * Next calls are noops. */ -// return

Hi

; -// } -// -// /* First call specifies the signature: */ -// _s( -// Hello, -// 'useState{[foo, setFoo]}(0)', -// () => [useCustomHook], /* Lazy to avoid triggering inline requires */ -// ); - -function createSignatureFunctionForTransform() { - { - // We'll fill in the signature in two steps. - // First, we'll know the signature itself. This happens outside the component. - // Then, we'll know the references to custom Hooks. This happens inside the component. - // After that, the returned function will be a fast path no-op. - var status = 'needsSignature'; - var savedType; - var hasCustomHooks; - return function (type, key, forceReset, getCustomHooks) { - switch (status) { - case 'needsSignature': - if (type !== undefined) { - // If we received an argument, this is the initial registration call. - savedType = type; - hasCustomHooks = typeof getCustomHooks === 'function'; - setSignature(type, key, forceReset, getCustomHooks); // The next call we expect is from inside a function, to fill in the custom Hooks. - - status = 'needsCustomHooks'; - } - - break; - - case 'needsCustomHooks': - if (hasCustomHooks) { - collectCustomHooksForSignature(savedType); - } - - status = 'resolved'; - break; - } - - return type; - }; - } -} -function isLikelyComponentType(type) { - { - switch (typeof type) { - case 'function': - { - // First, deal with classes. - if (type.prototype != null) { - if (type.prototype.isReactComponent) { - // React class. - return true; - } - - var ownNames = Object.getOwnPropertyNames(type.prototype); - - if (ownNames.length > 1 || ownNames[0] !== 'constructor') { - // This looks like a class. - return false; - } // eslint-disable-next-line no-proto - - - if (type.prototype.__proto__ !== Object.prototype) { - // It has a superclass. - return false; - } // Pass through. - // This looks like a regular function with empty prototype. - - } // For plain functions and arrows, use name as a heuristic. - - - var name = type.name || type.displayName; - return typeof name === 'string' && /^[A-Z]/.test(name); - } - - case 'object': - { - if (type != null) { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - case REACT_MEMO_TYPE: - // Definitely React components. - return true; - - default: - return false; - } - } - - return false; - } - - default: - { - return false; - } - } - } -} - -exports._getMountedRootCount = _getMountedRootCount; -exports.collectCustomHooksForSignature = collectCustomHooksForSignature; -exports.createSignatureFunctionForTransform = createSignatureFunctionForTransform; -exports.findAffectedHostInstances = findAffectedHostInstances; -exports.getFamilyByID = getFamilyByID; -exports.getFamilyByType = getFamilyByType; -exports.hasUnrecoverableErrors = hasUnrecoverableErrors; -exports.injectIntoGlobalHook = injectIntoGlobalHook; -exports.isLikelyComponentType = isLikelyComponentType; -exports.performReactRefresh = performReactRefresh; -exports.register = register; -exports.setSignature = setSignature; - })(); -} diff --git a/node_modules/react-refresh/cjs/react-refresh-runtime.production.min.js b/node_modules/react-refresh/cjs/react-refresh-runtime.production.min.js deleted file mode 100644 index 31223f8aab7ca..0000000000000 --- a/node_modules/react-refresh/cjs/react-refresh-runtime.production.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @license React v0.9.0 - * react-refresh-runtime.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. - */ -'use strict';throw Error("React Refresh runtime should not be included in the production bundle."); diff --git a/node_modules/react-refresh/package.json b/node_modules/react-refresh/package.json deleted file mode 100644 index 36b5102dc1e3e..0000000000000 --- a/node_modules/react-refresh/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "react-refresh", - "description": "React is a JavaScript library for building user interfaces.", - "keywords": [ - "react" - ], - "version": "0.9.0", - "homepage": "https://reactjs.org/", - "bugs": "https://github.com/facebook/react/issues", - "license": "MIT", - "files": [ - "LICENSE", - "README.md", - "babel.js", - "runtime.js", - "build-info.json", - "cjs/", - "umd/" - ], - "main": "runtime.js", - "repository": { - "type": "git", - "url": "https://github.com/facebook/react.git", - "directory": "packages/react" - }, - "engines": { - "node": ">=0.10.0" - } -} diff --git a/node_modules/react-refresh/runtime.js b/node_modules/react-refresh/runtime.js deleted file mode 100644 index 28e3b0ceeca91..0000000000000 --- a/node_modules/react-refresh/runtime.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/react-refresh-runtime.production.min.js'); -} else { - module.exports = require('./cjs/react-refresh-runtime.development.js'); -} diff --git a/node_modules/react-test-renderer/LICENSE b/node_modules/react-test-renderer/LICENSE deleted file mode 100644 index b96dcb0480a0b..0000000000000 --- a/node_modules/react-test-renderer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Facebook, Inc. and its affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/react-test-renderer/README.md b/node_modules/react-test-renderer/README.md deleted file mode 100644 index 5ce816cbc740c..0000000000000 --- a/node_modules/react-test-renderer/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# `react-test-renderer` - -This package provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment. - -Essentially, this package makes it easy to grab a snapshot of the "DOM tree" rendered by a React DOM or React Native component without using a browser or jsdom. - -Documentation: - -[https://reactjs.org/docs/test-renderer.html](https://reactjs.org/docs/test-renderer.html) - -Usage: - -```jsx -const ReactTestRenderer = require('react-test-renderer'); - -const renderer = ReactTestRenderer.create( - Facebook -); - -console.log(renderer.toJSON()); -// { type: 'a', -// props: { href: 'https://www.facebook.com/' }, -// children: [ 'Facebook' ] } -``` - -You can also use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: https://facebook.github.io/jest/blog/2016/07/27/jest-14.html. diff --git a/node_modules/react-test-renderer/build-info.json b/node_modules/react-test-renderer/build-info.json deleted file mode 100644 index db5dbe5e2edc4..0000000000000 --- a/node_modules/react-test-renderer/build-info.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "branch": "pull/21051", - "buildNumber": "287151", - "checksum": "94f5c65", - "commit": "12adaffef", - "environment": "ci", - "reactVersion": "17.0.0-12adaffef" -} diff --git a/node_modules/react-test-renderer/cjs/react-test-renderer.development.js b/node_modules/react-test-renderer/cjs/react-test-renderer.development.js deleted file mode 100644 index f401dd291c468..0000000000000 --- a/node_modules/react-test-renderer/cjs/react-test-renderer.development.js +++ /dev/null @@ -1,17383 +0,0 @@ -/** @license React v17.0.2 - * react-test-renderer.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -var React = require('react'); -var _assign = require('object-assign'); -var Scheduler = require('scheduler/unstable_mock'); -var Scheduler$1 = require('scheduler'); -var tracing = require('scheduler/tracing'); - -var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -// by calls to these methods by a Babel plugin. -// -// In PROD (or in packages without access to React internals), -// they are left as they are instead. - -function warn(format) { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } -} -function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } -} - -function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } -} - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; -} - -var FunctionComponent = 0; -var ClassComponent = 1; -var IndeterminateComponent = 2; // Before we know whether it is function or class - -var HostRoot = 3; // Root of a host tree. Could be nested inside another node. - -var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. - -var HostComponent = 5; -var HostText = 6; -var Fragment = 7; -var Mode = 8; -var ContextConsumer = 9; -var ContextProvider = 10; -var ForwardRef = 11; -var Profiler = 12; -var SuspenseComponent = 13; -var MemoComponent = 14; -var SimpleMemoComponent = 15; -var LazyComponent = 16; -var IncompleteClassComponent = 17; -var DehydratedFragment = 18; -var SuspenseListComponent = 19; -var FundamentalComponent = 20; -var ScopeComponent = 21; -var Block = 22; -var OffscreenComponent = 23; -var LegacyHiddenComponent = 24; - -/** - * `ReactInstanceMap` maintains a mapping from a public facing stateful - * instance (key) and the internal representation (value). This allows public - * methods to accept the user facing instance as an argument and map them back - * to internal methods. - * - * Note that this module is currently shared and assumed to be stateless. - * If this becomes an actual Map, that will break. - */ -function get(key) { - return key._reactInternals; -} -function set(key, value) { - key._reactInternals = value; -} - -// 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_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; -var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; -var REACT_OFFSCREEN_TYPE = 0xeae2; -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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); -} - -var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; -} - -function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); -} - -function getContextName(type) { - return type.displayName || 'Context'; -} - -function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; -} - -// Don't change these two values. They're used by React Dev Tools. -var NoFlags = -/* */ -0; -var PerformedWork = -/* */ -1; // You can change the rest (and add more). - -var Placement = -/* */ -2; -var Update = -/* */ -4; -var PlacementAndUpdate = -/* */ -6; -var Deletion = -/* */ -8; -var ContentReset = -/* */ -16; -var Callback = -/* */ -32; -var DidCapture = -/* */ -64; -var Ref = -/* */ -128; -var Snapshot = -/* */ -256; -var Passive = -/* */ -512; // TODO (effects) Remove this bit once the new reconciler is synced to the old. - -var PassiveUnmountPendingDev = -/* */ -8192; -var Hydrating = -/* */ -1024; -var HydratingAndUpdate = -/* */ -1028; // Passive & Update & Callback & Ref & Snapshot - -var LifecycleEffectMask = -/* */ -932; // Union of all host effects - -var HostEffectMask = -/* */ -2047; // These are not really side effects, but we still reuse this field. - -var Incomplete = -/* */ -2048; -var ShouldCapture = -/* */ -4096; -var ForceUpdateForLegacySuspense = -/* */ -16384; // Static tags describe aspects of a fiber that are not specific to a render, - -var enableProfilerTimer = true; -var enableFundamentalAPI = false; -var warnAboutStringRefs = false; -var enableNewReconciler = false; - -var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; - - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; - - do { - node = nextNode; - - if ((node.flags & (Placement | Hydrating)) !== NoFlags) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } - - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; - } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - - return null; -} -function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; -} -function isMounted(component) { - { - var owner = ReactCurrentOwner.current; - - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; - - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component'); - } - - instance._warnedAboutRefsInRender = true; - } - } - - var fiber = get(component); - - if (!fiber) { - return false; - } - - return getNearestMountedFiber(fiber) === fiber; -} - -function assertIsMounted(fiber) { - if (!(getNearestMountedFiber(fiber) === fiber)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } -} - -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); - - if (!(nearestMounted !== null)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - - if (nearestMounted !== fiber) { - return null; - } - - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - - - var a = fiber; - var b = alternate; - - while (true) { - var parentA = a.return; - - if (parentA === null) { - // We're at the root. - break; - } - - var parentB = parentA.alternate; - - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; - - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. - - - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. - - - if (parentA.child === parentB.child) { - var child = parentA.child; - - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } - - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } - - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. - - - { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - } - - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; - - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } - - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } - - _child = _child.sibling; - } - - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; - - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } - - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - - _child = _child.sibling; - } - - if (!didFindChild) { - { - throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." ); - } - } - } - } - - if (!(a.alternate === b)) { - { - throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. - - - if (!(a.tag === HostRoot)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. - - - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - - if (!currentParent) { - return null; - } // Next we'll drill down this component to find the first HostComponent/Text. - - - var node = currentParent; - - while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - return node; - } else if (node.child) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === currentParent) { - return null; - } - - while (!node.sibling) { - if (!node.return || node.return === currentParent) { - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } // Flow needs the return null here, but ESLint complains about it. - // eslint-disable-next-line no-unreachable - - - return null; -} -function doesFiberContain(parentFiber, childFiber) { - var node = childFiber; - var parentFiberAlternate = parentFiber.alternate; - - while (node !== null) { - if (node === parentFiber || node === parentFiberAlternate) { - return true; - } - - node = node.return; - } - - return false; -} - -// can re-export everything from this module. - -function shim() { - { - { - throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." ); - } - } -} // Hydration (when unsupported) -var isSuspenseInstancePending = shim; -var isSuspenseInstanceFallback = shim; -var hydrateTextInstance = shim; - -var NO_CONTEXT = {}; -var UPDATE_SIGNAL = {}; -var nodeToInstanceMap = new WeakMap(); - -{ - Object.freeze(NO_CONTEXT); - Object.freeze(UPDATE_SIGNAL); -} - -function getPublicInstance(inst) { - switch (inst.tag) { - case 'INSTANCE': - var createNodeMock = inst.rootContainerInstance.createNodeMock; - var mockNode = createNodeMock({ - type: inst.type, - props: inst.props - }); - - if (typeof mockNode === 'object' && mockNode !== null) { - nodeToInstanceMap.set(mockNode, inst); - } - - return mockNode; - - default: - return inst; - } -} -function appendChild(parentInstance, child) { - { - if (!Array.isArray(parentInstance.children)) { - error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); - } - } - - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - parentInstance.children.push(child); -} -function insertBefore(parentInstance, child, beforeChild) { - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - var beforeIndex = parentInstance.children.indexOf(beforeChild); - parentInstance.children.splice(beforeIndex, 0, child); -} -function removeChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - parentInstance.children.splice(index, 1); -} -function clearContainer(container) { - container.children.splice(0); -} -function getRootHostContext(rootContainerInstance) { - return NO_CONTEXT; -} -function getChildHostContext(parentHostContext, type, rootContainerInstance) { - return NO_CONTEXT; -} -function prepareForCommit(containerInfo) { - // noop - return null; -} -function resetAfterCommit(containerInfo) {// noop -} -function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - type: type, - props: props, - isHidden: false, - children: [], - internalInstanceHandle: internalInstanceHandle, - rootContainerInstance: rootContainerInstance, - tag: 'INSTANCE' - }; -} -function appendInitialChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - parentInstance.children.push(child); -} -function prepareUpdate(testElement, type, oldProps, newProps, rootContainerInstance, hostContext) { - return UPDATE_SIGNAL; -} -function shouldSetTextContent(type, props) { - return false; -} -function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - text: text, - isHidden: false, - tag: 'TEXT' - }; -} -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; // ------------------- -function commitUpdate(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle) { - instance.type = type; - instance.props = newProps; -} -function commitTextUpdate(textInstance, oldText, newText) { - textInstance.text = newText; -} -function resetTextContent(testElement) {// noop -} -var appendChildToContainer = appendChild; -var insertInContainerBefore = insertBefore; -var removeChildFromContainer = removeChild; -function hideInstance(instance) { - instance.isHidden = true; -} -function hideTextInstance(textInstance) { - textInstance.isHidden = true; -} -function unhideInstance(instance, props) { - instance.isHidden = false; -} -function unhideTextInstance(textInstance, text) { - textInstance.isHidden = false; -} -var clientId = 0; -function makeClientIdInDEV(warnOnAccessInDEV) { - var id = 'c_' + (clientId++).toString(36); - return { - toString: function () { - warnOnAccessInDEV(); - return id; - }, - valueOf: function () { - warnOnAccessInDEV(); - return id; - } - }; -} -function preparePortalMount(portalInstance) {// noop -} - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: _assign({}, props, { - value: prevLog - }), - info: _assign({}, props, { - value: prevInfo - }), - warn: _assign({}, props, { - value: prevWarn - }), - error: _assign({}, props, { - value: prevError - }), - group: _assign({}, props, { - value: prevGroup - }), - groupCollapsed: _assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: _assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - -var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; -var prefix; -function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); -} - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor, source, ownerFn) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} - -function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; -} - -var loggedTypeFailures = {}; -var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); - } - } -} - -function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } -} - -var valueStack = []; -var fiberStack; - -{ - fiberStack = []; -} - -var index = -1; - -function createCursor(defaultValue) { - return { - current: defaultValue - }; -} - -function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); - } - - return; - } - - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); - } - } - - cursor.current = valueStack[index]; - valueStack[index] = null; - - { - fiberStack[index] = null; - } - - index--; -} - -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; - - { - fiberStack[index] = fiber; - } - - cursor.current = value; -} - -var warnedAboutMissingGetChildContext; - -{ - warnedAboutMissingGetChildContext = {}; -} - -var emptyContextObject = {}; - -{ - Object.freeze(emptyContextObject); -} // A cursor to the current merged context object on the stack. - - -var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. - -var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. -// We use this to get access to the parent context after we have already -// pushed the next context provider, and now need to merge their contexts. - -var previousContext = emptyContextObject; - -function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { - { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; - } - - return contextStackCursor.current; - } -} - -function cacheContext(workInProgress, unmaskedContext, maskedContext) { - { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } -} - -function getMaskedContext(workInProgress, unmaskedContext) { - { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - - if (!contextTypes) { - return emptyContextObject; - } // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. - - - var instance = workInProgress.stateNode; - - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; - } - - var context = {}; - - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } - - { - var name = getComponentName(type) || 'Unknown'; - checkPropTypes(contextTypes, context, 'context', name); - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - - - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); - } - - return context; - } -} - -function hasContextChanged() { - { - return didPerformWorkStackCursor.current; - } -} - -function isContextProvider(type) { - { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; - } -} - -function popContext(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } -} - -function popTopLevelContextObject(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } -} - -function pushTopLevelContextObject(fiber, context, didChange) { - { - if (!(contextStackCursor.current === emptyContextObject)) { - { - throw Error( "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - push(contextStackCursor, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); - } -} - -function processChildContext(fiber, type, parentContext) { - { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentName(type) || 'Unknown'; - - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - - error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } - - return parentContext; - } - - var childContext = instance.getChildContext(); - - for (var contextKey in childContext) { - if (!(contextKey in childContextTypes)) { - { - throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." ); - } - } - } - - { - var name = getComponentName(type) || 'Unknown'; - checkPropTypes(childContextTypes, childContext, 'child context', name); - } - - return _assign({}, parentContext, childContext); - } -} - -function pushContextProvider(workInProgress) { - { - var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. - - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - - previousContext = contextStackCursor.current; - push(contextStackCursor, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); - return true; - } -} - -function invalidateContextProvider(workInProgress, type, didChange) { - { - var instance = workInProgress.stateNode; - - if (!instance) { - { - throw Error( "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, type, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. - - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. - - push(contextStackCursor, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } - } -} - -function findCurrentUnmaskedContext(fiber) { - { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { - { - throw Error( "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var node = fiber; - - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - - case ClassComponent: - { - var Component = node.type; - - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - - break; - } - } - - node = node.return; - } while (node !== null); - - { - { - throw Error( "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } -} - -var LegacyRoot = 0; -var BlockingRoot = 1; -var ConcurrentRoot = 2; - -var rendererID = null; -var injectedHook = null; -var hasLoggedError = false; -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } - - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } - - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://reactjs.org/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. - - - return true; - } - - try { - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. - - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); - } - } // DevTools exists - - - return true; -} -function onScheduleRoot(root, children) { - { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if ( !hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } -} -function onCommitRoot(root, priorityLevel) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; - - if (enableProfilerTimer) { - injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); - } else { - injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } -} -function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } -} - -var Scheduler_now = Scheduler$1.unstable_now; - -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) { - { - throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" ); - } - } -} -// ascending numbers so we can compare them like numbers. They start at 90 to -// avoid clashing with Scheduler's priorities. - -var ImmediatePriority = 99; -var UserBlockingPriority = 98; -var NormalPriority = 97; -var LowPriority = 96; -var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. - -var NoPriority = 90; -var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. - -var SyncLanePriority = 15; -var SyncBatchedLanePriority = 14; -var InputDiscreteHydrationLanePriority = 13; -var InputDiscreteLanePriority = 12; -var InputContinuousHydrationLanePriority = 11; -var InputContinuousLanePriority = 10; -var DefaultHydrationLanePriority = 9; -var DefaultLanePriority = 8; -var TransitionHydrationPriority = 7; -var TransitionPriority = 6; -var RetryLanePriority = 5; -var SelectiveHydrationLanePriority = 4; -var IdleHydrationLanePriority = 3; -var IdleLanePriority = 2; -var OffscreenLanePriority = 1; -var NoLanePriority = 0; -var TotalLanes = 31; -var NoLanes = -/* */ -0; -var NoLane = -/* */ -0; -var SyncLane = -/* */ -1; -var SyncBatchedLane = -/* */ -2; -var InputDiscreteHydrationLane = -/* */ -4; -var InputDiscreteLanes = -/* */ -24; -var InputContinuousHydrationLane = -/* */ -32; -var InputContinuousLanes = -/* */ -192; -var DefaultHydrationLane = -/* */ -256; -var DefaultLanes = -/* */ -3584; -var TransitionHydrationLane = -/* */ -4096; -var TransitionLanes = -/* */ -4186112; -var RetryLanes = -/* */ -62914560; -var SomeRetryLane = -/* */ -33554432; -var SelectiveHydrationLane = -/* */ -67108864; -var NonIdleLanes = -/* */ -134217727; -var IdleHydrationLane = -/* */ -134217728; -var IdleLanes = -/* */ -805306368; -var OffscreenLane = -/* */ -1073741824; -var NoTimestamp = -1; -// Used by getHighestPriorityLanes and getNextLanes: - -var return_highestLanePriority = DefaultLanePriority; - -function getHighestPriorityLanes(lanes) { - if ((SyncLane & lanes) !== NoLanes) { - return_highestLanePriority = SyncLanePriority; - return SyncLane; - } - - if ((SyncBatchedLane & lanes) !== NoLanes) { - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; - } - - if ((InputDiscreteHydrationLane & lanes) !== NoLanes) { - return_highestLanePriority = InputDiscreteHydrationLanePriority; - return InputDiscreteHydrationLane; - } - - var inputDiscreteLanes = InputDiscreteLanes & lanes; - - if (inputDiscreteLanes !== NoLanes) { - return_highestLanePriority = InputDiscreteLanePriority; - return inputDiscreteLanes; - } - - if ((lanes & InputContinuousHydrationLane) !== NoLanes) { - return_highestLanePriority = InputContinuousHydrationLanePriority; - return InputContinuousHydrationLane; - } - - var inputContinuousLanes = InputContinuousLanes & lanes; - - if (inputContinuousLanes !== NoLanes) { - return_highestLanePriority = InputContinuousLanePriority; - return inputContinuousLanes; - } - - if ((lanes & DefaultHydrationLane) !== NoLanes) { - return_highestLanePriority = DefaultHydrationLanePriority; - return DefaultHydrationLane; - } - - var defaultLanes = DefaultLanes & lanes; - - if (defaultLanes !== NoLanes) { - return_highestLanePriority = DefaultLanePriority; - return defaultLanes; - } - - if ((lanes & TransitionHydrationLane) !== NoLanes) { - return_highestLanePriority = TransitionHydrationPriority; - return TransitionHydrationLane; - } - - var transitionLanes = TransitionLanes & lanes; - - if (transitionLanes !== NoLanes) { - return_highestLanePriority = TransitionPriority; - return transitionLanes; - } - - var retryLanes = RetryLanes & lanes; - - if (retryLanes !== NoLanes) { - return_highestLanePriority = RetryLanePriority; - return retryLanes; - } - - if (lanes & SelectiveHydrationLane) { - return_highestLanePriority = SelectiveHydrationLanePriority; - return SelectiveHydrationLane; - } - - if ((lanes & IdleHydrationLane) !== NoLanes) { - return_highestLanePriority = IdleHydrationLanePriority; - return IdleHydrationLane; - } - - var idleLanes = IdleLanes & lanes; - - if (idleLanes !== NoLanes) { - return_highestLanePriority = IdleLanePriority; - return idleLanes; - } - - if ((OffscreenLane & lanes) !== NoLanes) { - return_highestLanePriority = OffscreenLanePriority; - return OffscreenLane; - } - - { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - - - return_highestLanePriority = DefaultLanePriority; - return lanes; -} - -function schedulerPriorityToLanePriority(schedulerPriorityLevel) { - switch (schedulerPriorityLevel) { - case ImmediatePriority: - return SyncLanePriority; - - case UserBlockingPriority: - return InputContinuousLanePriority; - - case NormalPriority: - case LowPriority: - // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration. - return DefaultLanePriority; - - case IdlePriority: - return IdleLanePriority; - - default: - return NoLanePriority; - } -} -function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case SyncLanePriority: - case SyncBatchedLanePriority: - return ImmediatePriority; - - case InputDiscreteHydrationLanePriority: - case InputDiscreteLanePriority: - case InputContinuousHydrationLanePriority: - case InputContinuousLanePriority: - return UserBlockingPriority; - - case DefaultHydrationLanePriority: - case DefaultLanePriority: - case TransitionHydrationPriority: - case TransitionPriority: - case SelectiveHydrationLanePriority: - case RetryLanePriority: - return NormalPriority; - - case IdleHydrationLanePriority: - case IdleLanePriority: - case OffscreenLanePriority: - return IdlePriority; - - case NoLanePriority: - return NoPriority; - - default: - { - { - throw Error( "Invalid update priority: " + lanePriority + ". This is a bug in React." ); - } - } - - } -} -function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; - - if (pendingLanes === NoLanes) { - return_highestLanePriority = NoLanePriority; - return NoLanes; - } - - var nextLanes = NoLanes; - var nextLanePriority = NoLanePriority; - var expiredLanes = root.expiredLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Check if any work has expired. - - if (expiredLanes !== NoLanes) { - nextLanes = expiredLanes; - nextLanePriority = return_highestLanePriority = SyncLanePriority; - } else { - // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - nextLanePriority = return_highestLanePriority; - } - } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; - - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - nextLanePriority = return_highestLanePriority; - } - } - } - } - - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If there are higher priority lanes, we'll include them even if they - // are suspended. - - - nextLanes = pendingLanes & getEqualOrHigherPriorityLanes(nextLanes); // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. - - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - getHighestPriorityLanes(wipLanes); - var wipLanePriority = return_highestLanePriority; - - if (nextLanePriority <= wipLanePriority) { - return wipLanes; - } else { - return_highestLanePriority = nextLanePriority; - } - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // - // For those exceptions where entanglement is semantically important, like - // useMutableSource, we should ensure that there is no partial work at the - // time we apply the entanglement. - - - var entangledLanes = root.entangledLanes; - - if (entangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = nextLanes & entangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - nextLanes |= entanglements[index]; - lanes &= ~lane; - } - } - - return nextLanes; -} -function getMostRecentEventTime(root, lanes) { - var eventTimes = root.eventTimes; - var mostRecentEventTime = NoTimestamp; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var eventTime = eventTimes[index]; - - if (eventTime > mostRecentEventTime) { - mostRecentEventTime = eventTime; - } - - lanes &= ~lane; - } - - return mostRecentEventTime; -} - -function computeExpirationTime(lane, currentTime) { - // TODO: Expiration heuristic is constant per lane, so could use a map. - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - - if (priority >= InputContinuousLanePriority) { - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. When - // we made it larger, a product metric in www regressed, suggesting there's - // a user interaction that's being starved by a series of synchronous - // updates. If that theory is correct, the proper solution is to fix the - // starvation. However, this scenario supports the idea that expiration - // times are an important safeguard when starvation does happen. - // - // Also note that, in the case of user input specifically, this will soon no - // longer be an issue because we plan to make user input synchronous by - // default (until you enter `startTransition`, of course.) - // - // If weren't planning to make these updates synchronous soon anyway, I - // would probably make this number a configurable parameter. - return currentTime + 250; - } else if (priority >= TransitionPriority) { - return currentTime + 5000; - } else { - // Anything idle priority or lower should never expire. - return NoTimestamp; - } -} - -function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - - var lanes = pendingLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; - - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; - } - - lanes &= ~lane; - } -} // This returns the highest priority pending lanes regardless of whether they -function getLanesToRetrySynchronouslyOnError(root) { - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; - } - - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; - } - - return NoLanes; -} -function returnNextLanesPriority() { - return return_highestLanePriority; -} -function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; -} -function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; -} -function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; -} // To ensure consistency across multiple updates in the same event, this should -// be a pure function, so that it always returns the same lane for given inputs. - -function findUpdateLane(lanePriority, wipLanes) { - switch (lanePriority) { - case NoLanePriority: - break; - - case SyncLanePriority: - return SyncLane; - - case SyncBatchedLanePriority: - return SyncBatchedLane; - - case InputDiscreteLanePriority: - { - var _lane = pickArbitraryLane(InputDiscreteLanes & ~wipLanes); - - if (_lane === NoLane) { - // Shift to the next priority level - return findUpdateLane(InputContinuousLanePriority, wipLanes); - } - - return _lane; - } - - case InputContinuousLanePriority: - { - var _lane2 = pickArbitraryLane(InputContinuousLanes & ~wipLanes); - - if (_lane2 === NoLane) { - // Shift to the next priority level - return findUpdateLane(DefaultLanePriority, wipLanes); - } - - return _lane2; - } - - case DefaultLanePriority: - { - var _lane3 = pickArbitraryLane(DefaultLanes & ~wipLanes); - - if (_lane3 === NoLane) { - // If all the default lanes are already being worked on, look for a - // lane in the transition range. - _lane3 = pickArbitraryLane(TransitionLanes & ~wipLanes); - - if (_lane3 === NoLane) { - // All the transition lanes are taken, too. This should be very - // rare, but as a last resort, pick a default lane. This will have - // the effect of interrupting the current work-in-progress render. - _lane3 = pickArbitraryLane(DefaultLanes); - } - } - - return _lane3; - } - - case TransitionPriority: // Should be handled by findTransitionLane instead - - case RetryLanePriority: - // Should be handled by findRetryLane instead - break; - - case IdleLanePriority: - var lane = pickArbitraryLane(IdleLanes & ~wipLanes); - - if (lane === NoLane) { - lane = pickArbitraryLane(IdleLanes); - } - - return lane; - } - - { - { - throw Error( "Invalid update priority: " + lanePriority + ". This is a bug in React." ); - } - } -} // To ensure consistency across multiple updates in the same event, this should -// be pure function, so that it always returns the same lane for given inputs. - -function findTransitionLane(wipLanes, pendingLanes) { - // First look for lanes that are completely unclaimed, i.e. have no - // pending work. - var lane = pickArbitraryLane(TransitionLanes & ~pendingLanes); - - if (lane === NoLane) { - // If all lanes have pending work, look for a lane that isn't currently - // being worked on. - lane = pickArbitraryLane(TransitionLanes & ~wipLanes); - - if (lane === NoLane) { - // If everything is being worked on, pick any lane. This has the - // effect of interrupting the current work-in-progress. - lane = pickArbitraryLane(TransitionLanes); - } - } - - return lane; -} // To ensure consistency across multiple updates in the same event, this should -// be pure function, so that it always returns the same lane for given inputs. - -function findRetryLane(wipLanes) { - // This is a fork of `findUpdateLane` designed specifically for Suspense - // "retries" — a special update that attempts to flip a Suspense boundary - // from its placeholder state to its primary/resolved state. - var lane = pickArbitraryLane(RetryLanes & ~wipLanes); - - if (lane === NoLane) { - lane = pickArbitraryLane(RetryLanes); - } - - return lane; -} - -function getHighestPriorityLane(lanes) { - return lanes & -lanes; -} - -function getLowestPriorityLane(lanes) { - // This finds the most significant non-zero bit. - var index = 31 - clz32(lanes); - return index < 0 ? NoLanes : 1 << index; -} - -function getEqualOrHigherPriorityLanes(lanes) { - return (getLowestPriorityLane(lanes) << 1) - 1; -} - -function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); -} - -function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); -} - -function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); -} - -function includesSomeLane(a, b) { - return (a & b) !== NoLanes; -} -function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; -} -function mergeLanes(a, b) { - return a | b; -} -function removeLanes(set, subset) { - return set & ~subset; -} // Seems redundant, but it changes the type from a single lane (used for -// updates) to a group of lanes (used for flushing work). - -function laneToLanes(lane) { - return lane; -} -function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; - - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); - } - - return laneMap; -} -function markRootUpdated(root, updateLane, eventTime) { - root.pendingLanes |= updateLane; // TODO: Theoretically, any update to any lane can unblock any other lane. But - // it's not practical to try every single possible combination. We need a - // heuristic to decide which lanes to attempt to render, and in which batches. - // For now, we use the same heuristic as in the old ExpirationTimes model: - // retry any lane at equal or lower priority, but don't try updates at higher - // priority without also including the lower priority updates. This works well - // when considering updates across different priority levels, but isn't - // sufficient for updates within the same priority, since we want to treat - // those updates as parallel. - // Unsuspend any update at equal or lower priority. - - var higherPriorityLanes = updateLane - 1; // Turns 0b1000 into 0b0111 - - root.suspendedLanes &= higherPriorityLanes; - root.pingedLanes &= higherPriorityLanes; - var eventTimes = root.eventTimes; - var index = laneToIndex(updateLane); // We can always overwrite an existing timestamp because we prefer the most - // recent event, and we assume time is monotonically increasing. - - eventTimes[index] = eventTime; -} -function markRootSuspended(root, suspendedLanes) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. - - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } -} -function markRootPinged(root, pingedLanes, eventTime) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; -} -function hasDiscreteLanes(lanes) { - return (lanes & InputDiscreteLanes) !== NoLanes; -} -function markRootMutableRead(root, updateLane) { - root.mutableReadLanes |= updateLane & root.pendingLanes; -} -function markRootFinished(root, remainingLanes) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again - - root.suspendedLanes = 0; - root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; - root.mutableReadLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - var entanglements = root.entanglements; - var eventTimes = root.eventTimes; - var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work - - var lanes = noLongerPendingLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - eventTimes[index] = NoTimestamp; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } -} -function markRootEntangled(root, entangledLanes) { - root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = entangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] |= entangledLanes; - lanes &= ~lane; - } -} -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. Only used on lanes, so assume input is an integer. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 - -var log = Math.log; -var LN2 = Math.LN2; - -function clz32Fallback(lanes) { - if (lanes === 0) { - return 32; - } - - return 31 - (log(lanes) / LN2 | 0) | 0; -} - -var Scheduler_runWithPriority = Scheduler$1.unstable_runWithPriority, - Scheduler_scheduleCallback = Scheduler$1.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler$1.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler$1.unstable_shouldYield, - Scheduler_requestPaint = Scheduler$1.unstable_requestPaint, - Scheduler_now$1 = Scheduler$1.unstable_now, - Scheduler_getCurrentPriorityLevel = Scheduler$1.unstable_getCurrentPriorityLevel, - Scheduler_ImmediatePriority = Scheduler$1.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler$1.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler$1.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler$1.unstable_IdlePriority; - -{ - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) { - { - throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" ); - } - } -} - -var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use -// ascending numbers so we can compare them like numbers. They start at 90 to -// avoid clashing with Scheduler's priorities. - -var ImmediatePriority$1 = 99; -var UserBlockingPriority$1 = 98; -var NormalPriority$1 = 97; -var LowPriority$1 = 96; -var IdlePriority$1 = 95; // NoPriority is the absence of priority. Also React-only. - -var NoPriority$1 = 90; -var shouldYield = Scheduler_shouldYield; -var requestPaint = // Fall back gracefully if we're running an older version of Scheduler. -Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {}; -var syncQueue = null; -var immediateQueueCallbackNode = null; -var isFlushingSyncQueue = false; -var initialTimeMs$1 = Scheduler_now$1(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. -// This will be the case for modern browsers that support `performance.now`. In -// older browsers, Scheduler falls back to `Date.now`, which returns a Unix -// timestamp. In that case, subtract the module initialization time to simulate -// the behavior of performance.now and keep our times small enough to fit -// within 32 bits. -// TODO: Consider lifting this into Scheduler. - -var now = initialTimeMs$1 < 10000 ? Scheduler_now$1 : function () { - return Scheduler_now$1() - initialTimeMs$1; -}; -function getCurrentPriorityLevel() { - switch (Scheduler_getCurrentPriorityLevel()) { - case Scheduler_ImmediatePriority: - return ImmediatePriority$1; - - case Scheduler_UserBlockingPriority: - return UserBlockingPriority$1; - - case Scheduler_NormalPriority: - return NormalPriority$1; - - case Scheduler_LowPriority: - return LowPriority$1; - - case Scheduler_IdlePriority: - return IdlePriority$1; - - default: - { - { - throw Error( "Unknown priority level." ); - } - } - - } -} - -function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case ImmediatePriority$1: - return Scheduler_ImmediatePriority; - - case UserBlockingPriority$1: - return Scheduler_UserBlockingPriority; - - case NormalPriority$1: - return Scheduler_NormalPriority; - - case LowPriority$1: - return Scheduler_LowPriority; - - case IdlePriority$1: - return Scheduler_IdlePriority; - - default: - { - { - throw Error( "Unknown priority level." ); - } - } - - } -} - -function runWithPriority(reactPriorityLevel, fn) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_runWithPriority(priorityLevel, fn); -} -function scheduleCallback(reactPriorityLevel, callback, options) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(priorityLevel, callback, options); -} -function scheduleSyncCallback(callback) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushSyncCallbackQueue`. - if (syncQueue === null) { - syncQueue = [callback]; // Flush the queue in the next tick, at the earliest. - - immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl); - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - syncQueue.push(callback); - } - - return fakeCallbackNode; -} -function cancelCallback(callbackNode) { - if (callbackNode !== fakeCallbackNode) { - Scheduler_cancelCallback(callbackNode); - } -} -function flushSyncCallbackQueue() { - if (immediateQueueCallbackNode !== null) { - var node = immediateQueueCallbackNode; - immediateQueueCallbackNode = null; - Scheduler_cancelCallback(node); - } - - flushSyncCallbackQueueImpl(); -} - -function flushSyncCallbackQueueImpl() { - if (!isFlushingSyncQueue && syncQueue !== null) { - // Prevent re-entrancy. - isFlushingSyncQueue = true; - var i = 0; - - { - try { - var _isSync2 = true; - var _queue = syncQueue; - runWithPriority(ImmediatePriority$1, function () { - for (; i < _queue.length; i++) { - var callback = _queue[i]; - - do { - callback = callback(_isSync2); - } while (callback !== null); - } - }); - syncQueue = null; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - if (syncQueue !== null) { - syncQueue = syncQueue.slice(i + 1); - } // Resume flushing in the next tick - - - Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue); - throw error; - } finally { - isFlushingSyncQueue = false; - } - } - } -} - -// TODO: this is special because it gets imported during build. -var ReactVersion = '17.0.2'; - -var NoMode = 0; -var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root -// tag instead - -var BlockingMode = 2; -var ConcurrentMode = 4; -var ProfileMode = 8; -var DebugTracingMode = 16; - -var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; -var NoTransition = 0; -function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; -} - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; -} - -var objectIs = typeof Object.is === 'function' ? Object.is : is; - -var hasOwnProperty = Object.prototype.hasOwnProperty; -/** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ - -function shallowEqual(objA, objB) { - if (objectIs(objA, objB)) { - return true; - } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; - } // Test for A's keys different from B. - - - for (var i = 0; i < keysA.length; i++) { - if (!hasOwnProperty.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) { - return false; - } - } - - return true; -} - -function describeFiber(fiber) { - var owner = fiber._debugOwner ? fiber._debugOwner.type : null ; - var source = fiber._debugSource ; - - switch (fiber.tag) { - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case IndeterminateComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case Block: - return describeFunctionComponentFrame(fiber.type._render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner !== null && typeof owner !== 'undefined') { - return getComponentName(owner.type); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactDebugCurrentFrame$1.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} -function getIsRendering() { - { - return isRendering; - } -} - -var ReactStrictModeWarnings = { - recordUnsafeLifecycleWarnings: function (fiber, instance) {}, - flushPendingUnsafeLifecycleWarnings: function () {}, - recordLegacyContextWarning: function (fiber, instance) {}, - flushLegacyContextWarning: function () {}, - discardPendingWarnings: function () {} -}; - -{ - var findStrictRoot = function (fiber) { - var maybeStrictRoot = null; - var node = fiber; - - while (node !== null) { - if (node.mode & StrictMode) { - maybeStrictRoot = node; - } - - node = node.return; - } - - return maybeStrictRoot; - }; - - var setToSortedString = function (set) { - var array = []; - set.forEach(function (value) { - array.push(value); - }); - return array.sort().join(', '); - }; - - var pendingComponentWillMountWarnings = []; - var pendingUNSAFE_ComponentWillMountWarnings = []; - var pendingComponentWillReceivePropsWarnings = []; - var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - var pendingComponentWillUpdateWarnings = []; - var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. - - var didWarnAboutUnsafeLifecycles = new Set(); - - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { - // Dedup strategy: Warn once per component. - if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { - return; - } - - if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components. - instance.componentWillMount.__suppressDeprecationWarning !== true) { - pendingComponentWillMountWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') { - pendingUNSAFE_ComponentWillMountWarnings.push(fiber); - } - - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - pendingComponentWillReceivePropsWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); - } - - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - pendingComponentWillUpdateWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') { - pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); - } - }; - - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { - // We do an initial pass to gather component names - var componentWillMountUniqueNames = new Set(); - - if (pendingComponentWillMountWarnings.length > 0) { - pendingComponentWillMountWarnings.forEach(function (fiber) { - componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillMountWarnings = []; - } - - var UNSAFE_componentWillMountUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { - pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) { - UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillMountWarnings = []; - } - - var componentWillReceivePropsUniqueNames = new Set(); - - if (pendingComponentWillReceivePropsWarnings.length > 0) { - pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { - componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillReceivePropsWarnings = []; - } - - var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { - pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) { - UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - } - - var componentWillUpdateUniqueNames = new Set(); - - if (pendingComponentWillUpdateWarnings.length > 0) { - pendingComponentWillUpdateWarnings.forEach(function (fiber) { - componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillUpdateWarnings = []; - } - - var UNSAFE_componentWillUpdateUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { - pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) { - UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillUpdateWarnings = []; - } // Finally, we flush all the warnings - // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' - - - if (UNSAFE_componentWillMountUniqueNames.size > 0) { - var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); - - error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames); - } - - if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { - var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); - - error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '\nPlease update the following components: %s', _sortedNames); - } - - if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { - var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); - - error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2); - } - - if (componentWillMountUniqueNames.size > 0) { - var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); - - warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3); - } - - if (componentWillReceivePropsUniqueNames.size > 0) { - var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); - - warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4); - } - - if (componentWillUpdateUniqueNames.size > 0) { - var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); - - warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5); - } - }; - - var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. - - var didWarnAboutLegacyContext = new Set(); - - ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) { - var strictRoot = findStrictRoot(fiber); - - if (strictRoot === null) { - error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - - return; - } // Dedup strategy: Warn once per component. - - - if (didWarnAboutLegacyContext.has(fiber.type)) { - return; - } - - var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); - - if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') { - if (warningsForRoot === undefined) { - warningsForRoot = []; - pendingLegacyContextWarning.set(strictRoot, warningsForRoot); - } - - warningsForRoot.push(fiber); - } - }; - - ReactStrictModeWarnings.flushLegacyContextWarning = function () { - pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) { - if (fiberArray.length === 0) { - return; - } - - var firstFiber = fiberArray[0]; - var uniqueNames = new Set(); - fiberArray.forEach(function (fiber) { - uniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutLegacyContext.add(fiber.type); - }); - var sortedNames = setToSortedString(uniqueNames); - - try { - setCurrentFiber(firstFiber); - - error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context', sortedNames); - } finally { - resetCurrentFiber(); - } - }); - }; - - ReactStrictModeWarnings.discardPendingWarnings = function () { - pendingComponentWillMountWarnings = []; - pendingUNSAFE_ComponentWillMountWarnings = []; - pendingComponentWillReceivePropsWarnings = []; - pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - pendingComponentWillUpdateWarnings = []; - pendingUNSAFE_ComponentWillUpdateWarnings = []; - pendingLegacyContextWarning = new Map(); - }; -} - -function resolveDefaultProps(Component, baseProps) { - if (Component && Component.defaultProps) { - // Resolve default props. Taken from ReactElement - var props = _assign({}, baseProps); - - var defaultProps = Component.defaultProps; - - for (var propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - - return props; - } - - return baseProps; -} - -// Max 31 bit integer. The max integer size in V8 for 32-bit systems. -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 -var MAX_SIGNED_31_BIT_INT = 1073741823; - -var valueCursor = createCursor(null); -var rendererSigil; - -{ - // Use this to detect multiple renderers using the same context - rendererSigil = {}; -} - -var currentlyRenderingFiber = null; -var lastContextDependency = null; -var lastContextWithAllBitsObserved = null; -var isDisallowedContextReadInDEV = false; -function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastContextWithAllBitsObserved = null; - - { - isDisallowedContextReadInDEV = false; - } -} -function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } -} -function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } -} -function pushProvider(providerFiber, nextValue) { - var context = providerFiber.type._context; - - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if (context._currentRenderer2 !== undefined && context._currentRenderer2 !== null && context._currentRenderer2 !== rendererSigil) { - error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); - } - - context._currentRenderer2 = rendererSigil; - } - } -} -function popProvider(providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - var context = providerFiber.type._context; - - { - context._currentValue2 = currentValue; - } -} -function calculateChangedBits(context, newValue, oldValue) { - if (objectIs(oldValue, newValue)) { - // No change - return 0; - } else { - var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; - - { - if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) { - error('calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); - } - } - - return changedBits | 0; - } -} -function scheduleWorkOnParentPath(parent, renderLanes) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes)) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } else { - // Neither alternate was updated, which means the rest of the - // ancestor path already has sufficient priority. - break; - } - - node = node.return; - } -} -function propagateContextChange(workInProgress, context, changedBits, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var update = createUpdate(NoTimestamp, pickArbitraryLane(renderLanes)); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - - enqueueUpdate(fiber, update); - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } -} -function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastContextWithAllBitsObserved = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - - dependencies.firstContext = null; - } - } -} -function readContext(context, observedBits) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); - } - } - - if (lastContextWithAllBitsObserved === context) ; else if (observedBits === false || observedBits === 0) ; else { - var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types. - - if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) { - // Observe all updates. - lastContextWithAllBitsObserved = context; - resolvedObservedBits = MAX_SIGNED_31_BIT_INT; - } else { - resolvedObservedBits = observedBits; - } - - var contextItem = { - context: context, - observedBits: resolvedObservedBits, - next: null - }; - - if (lastContextDependency === null) { - if (!(currentlyRenderingFiber !== null)) { - { - throw Error( "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." ); - } - } // This is the first dependency for this component. Create a new list. - - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem, - responders: null - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return context._currentValue2; -} - -var UpdateState = 0; -var ReplaceState = 1; -var ForceUpdate = 2; -var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. -// It should only be read right after calling `processUpdateQueue`, via -// `checkHasForceUpdateAfterProcessing`. - -var hasForceUpdate = false; -var didWarnUpdateInsideUpdate; -var currentlyProcessingQueue; - -{ - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; -} - -function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null - }, - effects: null - }; - fiber.updateQueue = queue; -} -function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - effects: currentQueue.effects - }; - workInProgress.updateQueue = clone; - } -} -function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; -} -function enqueueUpdate(fiber, update) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - - { - if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { - error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); - - didWarnUpdateInsideUpdate = true; - } - } -} -function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - effects: currentQueue.effects - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; -} - -function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { - switch (update.tag) { - case ReplaceState: - { - var payload = update.payload; - - if (typeof payload === 'function') { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - - return payload; - } - - case CaptureUpdate: - { - workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture; - } - // Intentional fallthrough - - case UpdateState: - { - var _payload = update.payload; - var partialState; - - if (typeof _payload === 'function') { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - - return _assign({}, prevState, partialState); - } - - case ForceUpdate: - { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; -} - -function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - var updateLane = update.lane; - var updateEventTime = update.eventTime; - - if (!isSubsetOfLanes(renderLanes, updateLane)) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - - newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - var effects = queue.effects; - - if (effects === null) { - queue.effects = [update]; - } else { - effects.push(update); - } - } - } - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } -} - -function callCallback(callback, context) { - if (!(typeof callback === 'function')) { - { - throw Error( "Invalid argument passed as callback. Expected a function. Instead received: " + callback ); - } - } - - callback.call(context); -} - -function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; -} -function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; -} -function commitUpdateQueue(finishedWork, finishedQueue, instance) { - // Commit the effects - var effects = finishedQueue.effects; - finishedQueue.effects = null; - - if (effects !== null) { - for (var i = 0; i < effects.length; i++) { - var effect = effects[i]; - var callback = effect.callback; - - if (callback !== null) { - effect.callback = null; - callCallback(callback, instance); - } - } - } -} - -var fakeInternalInstance = {}; -var isArray = Array.isArray; // React.Component uses a shared frozen object by default. -// We'll use it to determine whether we need to initialize legacy refs. - -var emptyRefsObject = new React.Component().refs; -var didWarnAboutStateAssignmentForComponent; -var didWarnAboutUninitializedState; -var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; -var didWarnAboutLegacyLifecyclesAndDerivedState; -var didWarnAboutUndefinedDerivedState; -var warnOnUndefinedDerivedState; -var warnOnInvalidCallback; -var didWarnAboutDirectlyAssigningPropsToState; -var didWarnAboutContextTypeAndContextTypes; -var didWarnAboutInvalidateContextType; - -{ - didWarnAboutStateAssignmentForComponent = new Set(); - didWarnAboutUninitializedState = new Set(); - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); - didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); - didWarnAboutDirectlyAssigningPropsToState = new Set(); - didWarnAboutUndefinedDerivedState = new Set(); - didWarnAboutContextTypeAndContextTypes = new Set(); - didWarnAboutInvalidateContextType = new Set(); - var didWarnOnInvalidCallback = new Set(); - - warnOnInvalidCallback = function (callback, callerName) { - if (callback === null || typeof callback === 'function') { - return; - } - - var key = callerName + '_' + callback; - - if (!didWarnOnInvalidCallback.has(key)) { - didWarnOnInvalidCallback.add(key); - - error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); - } - }; - - warnOnUndefinedDerivedState = function (type, partialState) { - if (partialState === undefined) { - var componentName = getComponentName(type) || 'Component'; - - if (!didWarnAboutUndefinedDerivedState.has(componentName)) { - didWarnAboutUndefinedDerivedState.add(componentName); - - error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); - } - } - }; // This is so gross but it's at least non-critical and can be removed if - // it causes problems. This is meant to give a nicer error message for - // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, - // ...)) which otherwise throws a "_processChildContext is not a function" - // exception. - - - Object.defineProperty(fakeInternalInstance, '_processChildContext', { - enumerable: false, - value: function () { - { - { - throw Error( "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." ); - } - } - } - }); - Object.freeze(fakeInternalInstance); -} - -function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { - var prevState = workInProgress.memoizedState; - - var partialState = getDerivedStateFromProps(nextProps, prevState); - - { - warnOnUndefinedDerivedState(ctor, partialState); - } // Merge the partial state and the previous state. - - - var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState); - workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the - // base state. - - if (workInProgress.lanes === NoLanes) { - // Queue is always non-null for classes - var updateQueue = workInProgress.updateQueue; - updateQueue.baseState = memoizedState; - } -} -var classComponentUpdater = { - isMounted: isMounted, - enqueueSetState: function (inst, payload, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.payload = payload; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'setState'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - }, - enqueueReplaceState: function (inst, payload, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.tag = ReplaceState; - update.payload = payload; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'replaceState'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - }, - enqueueForceUpdate: function (inst, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.tag = ForceUpdate; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'forceUpdate'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - } -}; - -function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { - var instance = workInProgress.stateNode; - - if (typeof instance.shouldComponentUpdate === 'function') { - - var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); - - { - if (shouldUpdate === undefined) { - error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component'); - } - } - - return shouldUpdate; - } - - if (ctor.prototype && ctor.prototype.isPureReactComponent) { - return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); - } - - return true; -} - -function checkClassInstance(workInProgress, ctor, newProps) { - var instance = workInProgress.stateNode; - - { - var name = getComponentName(ctor) || 'Component'; - var renderPresent = instance.render; - - if (!renderPresent) { - if (ctor.prototype && typeof ctor.prototype.render === 'function') { - error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); - } else { - error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); - } - } - - if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { - error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); - } - - if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { - error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); - } - - if (instance.propTypes) { - error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); - } - - if (instance.contextType) { - error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); - } - - { - if (instance.contextTypes) { - error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); - } - - if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { - didWarnAboutContextTypeAndContextTypes.add(ctor); - - error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); - } - } - - if (typeof instance.componentShouldUpdate === 'function') { - error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); - } - - if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { - error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component'); - } - - if (typeof instance.componentDidUnmount === 'function') { - error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); - } - - if (typeof instance.componentDidReceiveProps === 'function') { - error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); - } - - if (typeof instance.componentWillRecieveProps === 'function') { - error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); - } - - if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') { - error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); - } - - var hasMutatedProps = instance.props !== newProps; - - if (instance.props !== undefined && hasMutatedProps) { - error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); - } - - if (instance.defaultProps) { - error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); - - error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor)); - } - - if (typeof instance.getDerivedStateFromProps === 'function') { - error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - } - - if (typeof instance.getDerivedStateFromError === 'function') { - error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - } - - if (typeof ctor.getSnapshotBeforeUpdate === 'function') { - error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); - } - - var _state = instance.state; - - if (_state && (typeof _state !== 'object' || isArray(_state))) { - error('%s.state: must be set to an object or null', name); - } - - if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') { - error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); - } - } -} - -function adoptClassInstance(workInProgress, instance) { - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } -} - -function constructClassInstance(workInProgress, ctor, props) { - var isLegacyContextConsumer = false; - var unmaskedContext = emptyContextObject; - var context = emptyContextObject; - var contextType = ctor.contextType; - - { - if ('contextType' in ctor) { - var isValid = // Allow null for conditional declaration - contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a - - if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { - didWarnAboutInvalidateContextType.add(ctor); - var addendum = ''; - - if (contextType === undefined) { - addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; - } else if (typeof contextType !== 'object') { - addendum = ' However, it is set to a ' + typeof contextType + '.'; - } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { - addendum = ' Did you accidentally pass the Context.Provider instead?'; - } else if (contextType._context !== undefined) { - // - addendum = ' Did you accidentally pass the Context.Consumer instead?'; - } else { - addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; - } - - error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum); - } - } - } - - if (typeof contextType === 'object' && contextType !== null) { - context = readContext(contextType); - } else { - unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - var contextTypes = ctor.contextTypes; - isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; - context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; - } // Instantiate twice to help detect side-effects. - - var instance = new ctor(props, context); - var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; - adoptClassInstance(workInProgress, instance); - - { - if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { - var componentName = getComponentName(ctor) || 'Component'; - - if (!didWarnAboutUninitializedState.has(componentName)) { - didWarnAboutUninitializedState.add(componentName); - - error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName); - } - } // If new component APIs are defined, "unsafe" lifecycles won't be called. - // Warn about these lifecycles if they are present. - // Don't warn about react-lifecycles-compat polyfilled methods though. - - - if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { - var foundWillMountName = null; - var foundWillReceivePropsName = null; - var foundWillUpdateName = null; - - if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { - foundWillMountName = 'componentWillMount'; - } else if (typeof instance.UNSAFE_componentWillMount === 'function') { - foundWillMountName = 'UNSAFE_componentWillMount'; - } - - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - foundWillReceivePropsName = 'componentWillReceiveProps'; - } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; - } - - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - foundWillUpdateName = 'componentWillUpdate'; - } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - foundWillUpdateName = 'UNSAFE_componentWillUpdate'; - } - - if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { - var _componentName = getComponentName(ctor) || 'Component'; - - var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; - - if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { - didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); - - error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ''); - } - } - } - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // ReactFiberContext usually updates this cache but can't for newly-created instances. - - - if (isLegacyContextConsumer) { - cacheContext(workInProgress, unmaskedContext, context); - } - - return instance; -} - -function callComponentWillMount(workInProgress, instance) { - var oldState = instance.state; - - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } - - if (oldState !== instance.state) { - { - error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component'); - } - - classComponentUpdater.enqueueReplaceState(instance, instance.state, null); - } -} - -function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { - var oldState = instance.state; - - if (typeof instance.componentWillReceiveProps === 'function') { - instance.componentWillReceiveProps(newProps, nextContext); - } - - if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); - } - - if (instance.state !== oldState) { - { - var componentName = getComponentName(workInProgress.type) || 'Component'; - - if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { - didWarnAboutStateAssignmentForComponent.add(componentName); - - error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); - } - } - - classComponentUpdater.enqueueReplaceState(instance, instance.state, null); - } -} // Invokes the mount life-cycles on a previously never rendered instance. - - -function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { - { - checkClassInstance(workInProgress, ctor, newProps); - } - - var instance = workInProgress.stateNode; - instance.props = newProps; - instance.state = workInProgress.memoizedState; - instance.refs = emptyRefsObject; - initializeUpdateQueue(workInProgress); - var contextType = ctor.contextType; - - if (typeof contextType === 'object' && contextType !== null) { - instance.context = readContext(contextType); - } else { - var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - instance.context = getMaskedContext(workInProgress, unmaskedContext); - } - - { - if (instance.state === newProps) { - var componentName = getComponentName(ctor) || 'Component'; - - if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { - didWarnAboutDirectlyAssigningPropsToState.add(componentName); - - error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName); - } - } - - if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); - } - - { - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); - } - } - - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - instance.state = workInProgress.memoizedState; - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - instance.state = workInProgress.memoizedState; - } // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - - if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's - // process them now. - - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - instance.state = workInProgress.memoizedState; - } - - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } -} - -function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { - var instance = workInProgress.stateNode; - var oldProps = workInProgress.memoizedProps; - instance.props = oldProps; - var oldContext = instance.context; - var contextType = ctor.contextType; - var nextContext = emptyContextObject; - - if (typeof contextType === 'object' && contextType !== null) { - nextContext = readContext(contextType); - } else { - var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); - } - - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (oldProps !== newProps || oldContext !== nextContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); - } - } - - resetHasForceUpdateBeforeProcessing(); - var oldState = workInProgress.memoizedState; - var newState = instance.state = oldState; - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - newState = workInProgress.memoizedState; - - if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } - - return false; - } - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - newState = workInProgress.memoizedState; - } - - var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); - - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } - } - - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } // If shouldComponentUpdate returned false, we should still update the - // memoized state to indicate that this work can be reused. - - - workInProgress.memoizedProps = newProps; - workInProgress.memoizedState = newState; - } // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - - - instance.props = newProps; - instance.state = newState; - instance.context = nextContext; - return shouldUpdate; -} // Invokes the update life-cycles and returns false if it shouldn't rerender. - - -function updateClassInstance(current, workInProgress, ctor, newProps, renderLanes) { - var instance = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); - var unresolvedOldProps = workInProgress.memoizedProps; - var oldProps = workInProgress.type === workInProgress.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress.type, unresolvedOldProps); - instance.props = oldProps; - var unresolvedNewProps = workInProgress.pendingProps; - var oldContext = instance.context; - var contextType = ctor.contextType; - var nextContext = emptyContextObject; - - if (typeof contextType === 'object' && contextType !== null) { - nextContext = readContext(contextType); - } else { - var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); - } - - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); - } - } - - resetHasForceUpdateBeforeProcessing(); - var oldState = workInProgress.memoizedState; - var newState = instance.state = oldState; - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - newState = workInProgress.memoizedState; - - if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Update; - } - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Snapshot; - } - } - - return false; - } - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - newState = workInProgress.memoizedState; - } - - var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); - - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { - if (typeof instance.componentWillUpdate === 'function') { - instance.componentWillUpdate(newProps, newState, nextContext); - } - - if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); - } - } - - if (typeof instance.componentDidUpdate === 'function') { - workInProgress.flags |= Update; - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - workInProgress.flags |= Snapshot; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Update; - } - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Snapshot; - } - } // If shouldComponentUpdate returned false, we should still update the - // memoized props/state to indicate that this work can be reused. - - - workInProgress.memoizedProps = newProps; - workInProgress.memoizedState = newState; - } // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - - - instance.props = newProps; - instance.state = newState; - instance.context = nextContext; - return shouldUpdate; -} - -var didWarnAboutMaps; -var didWarnAboutGenerators; -var didWarnAboutStringRefs; -var ownerHasKeyUseWarning; -var ownerHasFunctionTypeWarning; - -var warnForMissingKey = function (child, returnFiber) {}; - -{ - didWarnAboutMaps = false; - didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - ownerHasKeyUseWarning = {}; - ownerHasFunctionTypeWarning = {}; - - warnForMissingKey = function (child, returnFiber) { - if (child === null || typeof child !== 'object') { - return; - } - - if (!child._store || child._store.validated || child.key != null) { - return; - } - - if (!(typeof child._store === 'object')) { - { - throw Error( "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - child._store.validated = true; - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (ownerHasKeyUseWarning[componentName]) { - return; - } - - ownerHasKeyUseWarning[componentName] = true; - - error('Each child in a list should have a unique ' + '"key" prop. See https://reactjs.org/link/warning-keys for ' + 'more information.'); - }; -} - -var isArray$1 = Array.isArray; - -function coerceRef(returnFiber, current, element) { - var mixedRef = element.ref; - - if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { - { - // TODO: Clean this up once we turn on the string ref warning for - // everyone, because the strict mode case will no longer be relevant - if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs - // because these cannot be automatically converted to an arrow function - // using a codemod. Therefore, we don't have to warn about string refs again. - !(element._owner && element._self && element._owner.stateNode !== element._self)) { - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (!didWarnAboutStringRefs[componentName]) { - { - error('A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', mixedRef); - } - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - if (element._owner) { - var owner = element._owner; - var inst; - - if (owner) { - var ownerFiber = owner; - - if (!(ownerFiber.tag === ClassComponent)) { - { - throw Error( "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref" ); - } - } - - inst = ownerFiber.stateNode; - } - - if (!inst) { - { - throw Error( "Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref - - if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) { - return current.ref; - } - - var ref = function (value) { - var refs = inst.refs; - - if (refs === emptyRefsObject) { - // This is a lazy pooled frozen object, so we need to initialize. - refs = inst.refs = {}; - } - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } else { - if (!(typeof mixedRef === 'string')) { - { - throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - } - } - - if (!element._owner) { - { - throw Error( "Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information." ); - } - } - } - } - - return mixedRef; -} - -function throwOnInvalidObjectType(returnFiber, newChild) { - if (returnFiber.type !== 'textarea') { - { - { - throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + "). If you meant to render a collection of children, use an array instead." ); - } - } - } -} - -function warnOnFunctionType(returnFiber) { - { - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (ownerHasFunctionTypeWarning[componentName]) { - return; - } - - ownerHasFunctionTypeWarning[componentName] = true; - - error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.'); - } -} // We avoid inlining this to avoid potential deopts from using try/catch. -// to be able to optimize each path individually by branching early. This needs -// a compiler or we can do it manually. Helpers that don't need this branching -// live outside of this function. - - -function ChildReconciler(shouldTrackSideEffects) { - function deleteChild(returnFiber, childToDelete) { - if (!shouldTrackSideEffects) { - // Noop. - return; - } // Deletions are added in reversed order so we add it to the front. - // At this point, the return fiber's effect list is empty except for - // deletions, so we can just append the deletion to the list. The remaining - // effects aren't added until the complete phase. Once we implement - // resuming, this may not be true. - - - var last = returnFiber.lastEffect; - - if (last !== null) { - last.nextEffect = childToDelete; - returnFiber.lastEffect = childToDelete; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; - } - - childToDelete.nextEffect = null; - childToDelete.flags = Deletion; - } - - function deleteRemainingChildren(returnFiber, currentFirstChild) { - if (!shouldTrackSideEffects) { - // Noop. - return null; - } // TODO: For the shouldClone case, this could be micro-optimized a bit by - // assuming that after the first child we've already added everything. - - - var childToDelete = currentFirstChild; - - while (childToDelete !== null) { - deleteChild(returnFiber, childToDelete); - childToDelete = childToDelete.sibling; - } - - return null; - } - - function mapRemainingChildren(returnFiber, currentFirstChild) { - // Add the remaining children to a temporary map so that we can find them by - // keys quickly. Implicit (null) keys get added to this set with their index - // instead. - var existingChildren = new Map(); - var existingChild = currentFirstChild; - - while (existingChild !== null) { - if (existingChild.key !== null) { - existingChildren.set(existingChild.key, existingChild); - } else { - existingChildren.set(existingChild.index, existingChild); - } - - existingChild = existingChild.sibling; - } - - return existingChildren; - } - - function useFiber(fiber, pendingProps) { - // We currently set sibling to null and index to 0 here because it is easy - // to forget to do before returning it. E.g. for the single child case. - var clone = createWorkInProgress(fiber, pendingProps); - clone.index = 0; - clone.sibling = null; - return clone; - } - - function placeChild(newFiber, lastPlacedIndex, newIndex) { - newFiber.index = newIndex; - - if (!shouldTrackSideEffects) { - // Noop. - return lastPlacedIndex; - } - - var current = newFiber.alternate; - - if (current !== null) { - var oldIndex = current.index; - - if (oldIndex < lastPlacedIndex) { - // This is a move. - newFiber.flags = Placement; - return lastPlacedIndex; - } else { - // This item can stay in place. - return oldIndex; - } - } else { - // This is an insertion. - newFiber.flags = Placement; - return lastPlacedIndex; - } - } - - function placeSingleChild(newFiber) { - // This is simpler for the single child case. We only need to do a - // placement for inserting new children. - if (shouldTrackSideEffects && newFiber.alternate === null) { - newFiber.flags = Placement; - } - - return newFiber; - } - - function updateTextNode(returnFiber, current, textContent, lanes) { - if (current === null || current.tag !== HostText) { - // Insert - var created = createFiberFromText(textContent, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, textContent); - existing.return = returnFiber; - return existing; - } - } - - function updateElement(returnFiber, current, element, lanes) { - if (current !== null) { - if (current.elementType === element.type || ( // Keep this check inline so it only runs on the false path: - isCompatibleFamilyForHotReloading(current, element) )) { - // Move based on index - var existing = useFiber(current, element.props); - existing.ref = coerceRef(returnFiber, current, element); - existing.return = returnFiber; - - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - - return existing; - } - } // Insert - - - var created = createFiberFromElement(element, returnFiber.mode, lanes); - created.ref = coerceRef(returnFiber, current, element); - created.return = returnFiber; - return created; - } - - function updatePortal(returnFiber, current, portal, lanes) { - if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { - // Insert - var created = createFiberFromPortal(portal, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, portal.children || []); - existing.return = returnFiber; - return existing; - } - } - - function updateFragment(returnFiber, current, fragment, lanes, key) { - if (current === null || current.tag !== Fragment) { - // Insert - var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, fragment); - existing.return = returnFiber; - return existing; - } - } - - function createChild(returnFiber, newChild, lanes) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - var created = createFiberFromText('' + newChild, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _created = createFiberFromElement(newChild, returnFiber.mode, lanes); - - _created.ref = coerceRef(returnFiber, null, newChild); - _created.return = returnFiber; - return _created; - } - - case REACT_PORTAL_TYPE: - { - var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes); - - _created2.return = returnFiber; - return _created2; - } - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null); - - _created3.return = returnFiber; - return _created3; - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - - function updateSlot(returnFiber, oldFiber, newChild, lanes) { - // Update the fiber if the keys match, otherwise return null. - var key = oldFiber !== null ? oldFiber.key : null; - - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - if (key !== null) { - return null; - } - - return updateTextNode(returnFiber, oldFiber, '' + newChild, lanes); - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - if (newChild.key === key) { - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, oldFiber, newChild.props.children, lanes, key); - } - - return updateElement(returnFiber, oldFiber, newChild, lanes); - } else { - return null; - } - } - - case REACT_PORTAL_TYPE: - { - if (newChild.key === key) { - return updatePortal(returnFiber, oldFiber, newChild, lanes); - } else { - return null; - } - } - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - if (key !== null) { - return null; - } - - return updateFragment(returnFiber, oldFiber, newChild, lanes, null); - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - - function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys, so we neither have to check the old nor - // new node for the key. If both are text nodes, they match. - var matchedFiber = existingChildren.get(newIdx) || null; - return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes); - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, _matchedFiber, newChild.props.children, lanes, newChild.key); - } - - return updateElement(returnFiber, _matchedFiber, newChild, lanes); - } - - case REACT_PORTAL_TYPE: - { - var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - - return updatePortal(returnFiber, _matchedFiber2, newChild, lanes); - } - - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _matchedFiber3 = existingChildren.get(newIdx) || null; - - return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null); - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - /** - * Warns if there is a duplicate or missing key - */ - - - function warnOnInvalidKey(child, knownKeys, returnFiber) { - { - if (typeof child !== 'object' || child === null) { - return knownKeys; - } - - switch (child.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - warnForMissingKey(child, returnFiber); - var key = child.key; - - if (typeof key !== 'string') { - break; - } - - if (knownKeys === null) { - knownKeys = new Set(); - knownKeys.add(key); - break; - } - - if (!knownKeys.has(key)) { - knownKeys.add(key); - break; - } - - error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key); - - break; - } - } - - return knownKeys; - } - - function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { - // This algorithm can't optimize by searching from both ends since we - // don't have backpointers on fibers. I'm trying to see how far we can get - // with that model. If it ends up not being worth the tradeoffs, we can - // add it later. - // Even with a two ended optimization, we'd want to optimize for the case - // where there are few changes and brute force the comparison instead of - // going for the Map. It'd like to explore hitting that path first in - // forward-only mode and only go for the Map once we notice that we need - // lots of look ahead. This doesn't handle reversal as well as two ended - // search but that's unusual. Besides, for the two ended optimization to - // work on Iterables, we'd need to copy the whole set. - // In this first iteration, we'll just live with hitting the bad case - // (adding everything to a Map) in for every insert/move. - // If you change this code, also update reconcileChildrenIterator() which - // uses the same algorithm. - { - // First, validate keys. - var knownKeys = null; - - for (var i = 0; i < newChildren.length; i++) { - var child = newChildren[i]; - knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); - } - } - - var resultingFirstChild = null; - var previousNewFiber = null; - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; - - for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - - var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); - - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (oldFiber === null) { - oldFiber = nextOldFiber; - } - - break; - } - - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } - - if (newIdx === newChildren.length) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } - - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes); - - if (_newFiber === null) { - continue; - } - - lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber; - } else { - previousNewFiber.sibling = _newFiber; - } - - previousNewFiber = _newFiber; - } - - return resultingFirstChild; - } // Add all children to a key map for quick lookups. - - - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. - - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes); - - if (_newFiber2 !== null) { - if (shouldTrackSideEffects) { - if (_newFiber2.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); - } - } - - lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - resultingFirstChild = _newFiber2; - } else { - previousNewFiber.sibling = _newFiber2; - } - - previousNewFiber = _newFiber2; - } - } - - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); - } - - return resultingFirstChild; - } - - function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) { - // This is the same implementation as reconcileChildrenArray(), - // but using the iterator instead. - var iteratorFn = getIteratorFn(newChildrenIterable); - - if (!(typeof iteratorFn === 'function')) { - { - throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - { - // We don't support rendering Generators because it's a mutation. - // See https://github.com/facebook/react/issues/12995 - if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag - newChildrenIterable[Symbol.toStringTag] === 'Generator') { - if (!didWarnAboutGenerators) { - error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); - } - - didWarnAboutGenerators = true; - } // Warn about using Maps as children - - - if (newChildrenIterable.entries === iteratorFn) { - if (!didWarnAboutMaps) { - error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } // First, validate keys. - // We'll get a different iterator later for the main pass. - - - var _newChildren = iteratorFn.call(newChildrenIterable); - - if (_newChildren) { - var knownKeys = null; - - var _step = _newChildren.next(); - - for (; !_step.done; _step = _newChildren.next()) { - var child = _step.value; - knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); - } - } - } - - var newChildren = iteratorFn.call(newChildrenIterable); - - if (!(newChildren != null)) { - { - throw Error( "An iterable object provided no iterator." ); - } - } - - var resultingFirstChild = null; - var previousNewFiber = null; - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; - var step = newChildren.next(); - - for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - - var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); - - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (oldFiber === null) { - oldFiber = nextOldFiber; - } - - break; - } - - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } - - if (step.done) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } - - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber3 = createChild(returnFiber, step.value, lanes); - - if (_newFiber3 === null) { - continue; - } - - lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber3; - } else { - previousNewFiber.sibling = _newFiber3; - } - - previousNewFiber = _newFiber3; - } - - return resultingFirstChild; - } // Add all children to a key map for quick lookups. - - - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. - - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes); - - if (_newFiber4 !== null) { - if (shouldTrackSideEffects) { - if (_newFiber4.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); - } - } - - lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - resultingFirstChild = _newFiber4; - } else { - previousNewFiber.sibling = _newFiber4; - } - - previousNewFiber = _newFiber4; - } - } - - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); - } - - return resultingFirstChild; - } - - function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) { - // There's no need to check for keys on text nodes since we don't have a - // way to define them. - if (currentFirstChild !== null && currentFirstChild.tag === HostText) { - // We already have an existing node so let's just update it and delete - // the rest. - deleteRemainingChildren(returnFiber, currentFirstChild.sibling); - var existing = useFiber(currentFirstChild, textContent); - existing.return = returnFiber; - return existing; - } // The existing first child is not a text node so we need to create one - // and delete the existing ones. - - - deleteRemainingChildren(returnFiber, currentFirstChild); - var created = createFiberFromText(textContent, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } - - function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) { - var key = element.key; - var child = currentFirstChild; - - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - switch (child.tag) { - case Fragment: - { - if (element.type === REACT_FRAGMENT_TYPE) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, element.props.children); - existing.return = returnFiber; - - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - - return existing; - } - - break; - } - - case Block: - - // We intentionally fallthrough here if enableBlocksAPI is not on. - // eslint-disable-next-lined no-fallthrough - - default: - { - if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path: - isCompatibleFamilyForHotReloading(child, element) )) { - deleteRemainingChildren(returnFiber, child.sibling); - - var _existing3 = useFiber(child, element.props); - - _existing3.ref = coerceRef(returnFiber, child, element); - _existing3.return = returnFiber; - - { - _existing3._debugSource = element._source; - _existing3._debugOwner = element._owner; - } - - return _existing3; - } - - break; - } - } // Didn't match. - - - deleteRemainingChildren(returnFiber, child); - break; - } else { - deleteChild(returnFiber, child); - } - - child = child.sibling; - } - - if (element.type === REACT_FRAGMENT_TYPE) { - var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key); - created.return = returnFiber; - return created; - } else { - var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); - - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); - _created4.return = returnFiber; - return _created4; - } - } - - function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) { - var key = portal.key; - var child = currentFirstChild; - - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, portal.children || []); - existing.return = returnFiber; - return existing; - } else { - deleteRemainingChildren(returnFiber, child); - break; - } - } else { - deleteChild(returnFiber, child); - } - - child = child.sibling; - } - - var created = createFiberFromPortal(portal, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } // This API will tag the children with the side-effect of the reconciliation - // itself. They will be added to the side-effect list as we pass through the - // children and the parent. - - - function reconcileChildFibers(returnFiber, currentFirstChild, newChild, lanes) { - // This function is not recursive. - // If the top level item is an array, we treat it as a set of children, - // not as a fragment. Nested arrays on the other hand will be treated as - // fragment nodes. Recursion happens at the normal flow. - // Handle top level unkeyed fragments as if they were arrays. - // This leads to an ambiguity between <>{[...]} and <>.... - // We treat the ambiguous cases above the same. - var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; - - if (isUnkeyedTopLevelFragment) { - newChild = newChild.props.children; - } // Handle object types - - - var isObject = typeof newChild === 'object' && newChild !== null; - - if (isObject) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes)); - - case REACT_PORTAL_TYPE: - return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes)); - - } - } - - if (typeof newChild === 'string' || typeof newChild === 'number') { - return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, lanes)); - } - - if (isArray$1(newChild)) { - return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); - } - - if (getIteratorFn(newChild)) { - return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); - } - - if (isObject) { - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) { - // If the new child is undefined, and the return fiber is a composite - // component, throw an error. If Fiber return types are disabled, - // we already threw above. - switch (returnFiber.tag) { - case ClassComponent: - { - { - var instance = returnFiber.stateNode; - - if (instance.render._isMockFunction) { - // We allow auto-mocks to proceed as if they're returning null. - break; - } - } - } - // Intentionally fall through to the next case, which handles both - // functions and classes - // eslint-disable-next-lined no-fallthrough - - case Block: - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - { - { - throw Error( (getComponentName(returnFiber.type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." ); - } - } - } - } - } // Remaining cases are all treated as empty. - - - return deleteRemainingChildren(returnFiber, currentFirstChild); - } - - return reconcileChildFibers; -} - -var reconcileChildFibers = ChildReconciler(true); -var mountChildFibers = ChildReconciler(false); -function cloneChildFibers(current, workInProgress) { - if (!(current === null || workInProgress.child === current.child)) { - { - throw Error( "Resuming work not yet implemented." ); - } - } - - if (workInProgress.child === null) { - return; - } - - var currentChild = workInProgress.child; - var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); - workInProgress.child = newChild; - newChild.return = workInProgress; - - while (currentChild.sibling !== null) { - currentChild = currentChild.sibling; - newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); - newChild.return = workInProgress; - } - - newChild.sibling = null; -} // Reset a workInProgress child set to prepare it for a second pass. - -function resetChildFibers(workInProgress, lanes) { - var child = workInProgress.child; - - while (child !== null) { - resetWorkInProgress(child, lanes); - child = child.sibling; - } -} - -var NO_CONTEXT$1 = {}; -var contextStackCursor$1 = createCursor(NO_CONTEXT$1); -var contextFiberStackCursor = createCursor(NO_CONTEXT$1); -var rootInstanceStackCursor = createCursor(NO_CONTEXT$1); - -function requiredContext(c) { - if (!(c !== NO_CONTEXT$1)) { - { - throw Error( "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - return c; -} - -function getRootHostContainer() { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - return rootInstance; -} - -function pushHostContainer(fiber, nextRootInstance) { - // Push current root instance onto the stack; - // This allows us to reset root when portals are popped. - push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. - // However, we can't just call getRootHostContext() and push it because - // we'd have a different number of entries on the stack depending on - // whether getRootHostContext() throws somewhere in renderer code or not. - // So we push an empty value first. This lets us safely unwind on errors. - - push(contextStackCursor$1, NO_CONTEXT$1, fiber); - var nextRootContext = getRootHostContext(); // Now that we know this function doesn't throw, replace it. - - pop(contextStackCursor$1, fiber); - push(contextStackCursor$1, nextRootContext, fiber); -} - -function popHostContainer(fiber) { - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); - pop(rootInstanceStackCursor, fiber); -} - -function getHostContext() { - var context = requiredContext(contextStackCursor$1.current); - return context; -} - -function pushHostContext(fiber) { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - var context = requiredContext(contextStackCursor$1.current); - var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. - - if (context === nextContext) { - return; - } // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); -} - -function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; - } - - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); -} - -var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is -// inherited deeply down the subtree. The upper bits only affect -// this immediate suspense boundary and gets reset each new -// boundary or suspense list. - -var SubtreeSuspenseContextMask = 1; // Subtree Flags: -// InvisibleParentSuspenseContext indicates that one of our parent Suspense -// boundaries is not currently showing visible main content. -// Either because it is already showing a fallback or is not mounted at all. -// We can use this to determine if it is desirable to trigger a fallback at -// the parent. If not, then we might need to trigger undesirable boundaries -// and/or suspend the commit to avoid hiding the parent content. - -var InvisibleParentSuspenseContext = 1; // Shallow Flags: -// ForceSuspenseFallback can be used by SuspenseList to force newly added -// items into their fallback state during one of the render passes. - -var ForceSuspenseFallback = 2; -var suspenseStackCursor = createCursor(DefaultSuspenseContext); -function hasSuspenseContext(parentContext, flag) { - return (parentContext & flag) !== 0; -} -function setDefaultShallowSuspenseContext(parentContext) { - return parentContext & SubtreeSuspenseContextMask; -} -function setShallowSuspenseContext(parentContext, shallowContext) { - return parentContext & SubtreeSuspenseContextMask | shallowContext; -} -function addSubtreeSuspenseContext(parentContext, subtreeContext) { - return parentContext | subtreeContext; -} -function pushSuspenseContext(fiber, newContext) { - push(suspenseStackCursor, newContext, fiber); -} -function popSuspenseContext(fiber) { - pop(suspenseStackCursor, fiber); -} - -function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { - // If it was the primary children that just suspended, capture and render the - // fallback. Otherwise, don't capture and bubble to the next boundary. - var nextState = workInProgress.memoizedState; - - if (nextState !== null) { - if (nextState.dehydrated !== null) { - // A dehydrated boundary always captures. - return true; - } - - return false; - } - - var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop. - - if (props.fallback === undefined) { - return false; - } // Regular boundaries always capture. - - - if (props.unstable_avoidThisFallback !== true) { - return true; - } // If it's a boundary we should avoid, then we prefer to bubble up to the - // parent boundary if it is currently invisible. - - - if (hasInvisibleParent) { - return false; - } // If the parent is not able to handle it, we must handle it. - - - return true; -} -function findFirstSuspended(row) { - var node = row; - - while (node !== null) { - if (node.tag === SuspenseComponent) { - var state = node.memoizedState; - - if (state !== null) { - var dehydrated = state.dehydrated; - - if (dehydrated === null || isSuspenseInstancePending() || isSuspenseInstanceFallback()) { - return node; - } - } - } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't - // keep track of whether it suspended or not. - node.memoizedProps.revealOrder !== undefined) { - var didSuspend = (node.flags & DidCapture) !== NoFlags; - - if (didSuspend) { - return node; - } - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === row) { - return null; - } - - while (node.sibling === null) { - if (node.return === null || node.return === row) { - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - - return null; -} - -var NoFlags$1 = -/* */ -0; // Represents whether effect should fire. - -var HasEffect = -/* */ -1; // Represents the phase in which the effect (not the clean-up) fires. - -var Layout = -/* */ -2; -var Passive$1 = -/* */ -4; - -var isHydrating = false; - -function enterHydrationState(fiber) { - { - return false; - } -} - -function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { - { - { - { - throw Error( "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } -} - -function prepareToHydrateHostTextInstance(fiber) { - { - { - { - throw Error( "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - var shouldUpdate = hydrateTextInstance(); -} - -function popHydrationState(fiber) { - { - return false; - } -} - -function getIsHydrating() { - return isHydrating; -} - -// and should be reset before starting a new render. -// This tracks which mutable sources need to be reset after a render. - -var workInProgressSources = []; -var rendererSigil$1; - -{ - // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; -} - -function markSourceAsDirty(mutableSource) { - workInProgressSources.push(mutableSource); -} -function resetWorkInProgressVersions() { - for (var i = 0; i < workInProgressSources.length; i++) { - var mutableSource = workInProgressSources[i]; - - { - mutableSource._workInProgressVersionSecondary = null; - } - } - - workInProgressSources.length = 0; -} -function getWorkInProgressVersion(mutableSource) { - { - return mutableSource._workInProgressVersionSecondary; - } -} -function setWorkInProgressVersion(mutableSource, version) { - { - mutableSource._workInProgressVersionSecondary = version; - } - - workInProgressSources.push(mutableSource); -} -function warnAboutMultipleRenderersDEV(mutableSource) { - { - { - if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { - error('Detected multiple renderers concurrently rendering the ' + 'same mutable source. This is currently unsupported.'); - } - } - } -} // Eager reads the version of a mutable source and stores it on the root. - -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; -var didWarnAboutMismatchedHooksForComponent; -var didWarnAboutUseOpaqueIdentifier; - -{ - didWarnAboutUseOpaqueIdentifier = {}; - didWarnAboutMismatchedHooksForComponent = new Set(); -} - -// These are set right before calling the component. -var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from -// the work-in-progress hook. - -var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The -// current hook list is the list that belongs to the current fiber. The -// work-in-progress hook list is a new list that will be added to the -// work-in-progress fiber. - -var currentHook = null; -var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This -// does not get reset if we do another render pass; only when we're completely -// finished evaluating this component. This is an optimization so we know -// whether we need to clear render phase updates after a throw. - -var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only during the current render pass. This -// gets reset after each attempt. -// TODO: Maybe there's some way to consolidate this with -// `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. - -var didScheduleRenderPhaseUpdateDuringThisPass = false; -var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook - -var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. -// The list stores the order of hooks used during the initial render (mount). -// Subsequent renders (updates) reference this list. - -var hookTypesDev = null; -var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore -// the dependencies for Hooks that need them (e.g. useEffect or useMemo). -// When true, such Hooks will always be "remounted". Only used during hot reload. - -var ignorePreviousDependencies = false; - -function mountHookTypesDev() { - { - var hookName = currentHookNameInDev; - - if (hookTypesDev === null) { - hookTypesDev = [hookName]; - } else { - hookTypesDev.push(hookName); - } - } -} - -function updateHookTypesDev() { - { - var hookName = currentHookNameInDev; - - if (hookTypesDev !== null) { - hookTypesUpdateIndexDev++; - - if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { - warnOnHookMismatchInDev(hookName); - } - } - } -} - -function checkDepsAreArrayDev(deps) { - { - if (deps !== undefined && deps !== null && !Array.isArray(deps)) { - // Verify deps, but only on mount to avoid extra checks. - // It's unlikely their type would change as usually you define them inline. - error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps); - } - } -} - -function warnOnHookMismatchInDev(currentHookName) { - { - var componentName = getComponentName(currentlyRenderingFiber$1.type); - - if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { - didWarnAboutMismatchedHooksForComponent.add(componentName); - - if (hookTypesDev !== null) { - var table = ''; - var secondColumnStart = 30; - - for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { - var oldHookName = hookTypesDev[i]; - var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; - var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up - // lol @ IE not supporting String#repeat - - while (row.length < secondColumnStart) { - row += ' '; - } - - row += newHookName + '\n'; - table += row; - } - - error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table); - } - } - } -} - -function throwInvalidHookError() { - { - { - throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." ); - } - } -} - -function areHookInputsEqual(nextDeps, prevDeps) { - { - if (ignorePreviousDependencies) { - // Only true when this component is being hot reloaded. - return false; - } - } - - if (prevDeps === null) { - { - error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev); - } - - return false; - } - - { - // Don't bother comparing lengths in prod because these arrays should be - // passed inline. - if (nextDeps.length !== prevDeps.length) { - error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]"); - } - } - - for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { - if (objectIs(nextDeps[i], prevDeps[i])) { - continue; - } - - return false; - } - - return true; -} - -function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { - renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; - - { - hookTypesDev = current !== null ? current._debugHookTypes : null; - hookTypesUpdateIndexDev = -1; // Used for hot reloading: - - ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; - } - - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; - workInProgress.lanes = NoLanes; // The following should have already been reset - // currentHook = null; - // workInProgressHook = null; - // didScheduleRenderPhaseUpdate = false; - // TODO Warn if no hooks are used at all during mount, then some are used during update. - // Currently we will identify the update render as a mount because memoizedState === null. - // This is tricky because it's valid for certain types of components (e.g. React.lazy) - // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used. - // Non-stateful hooks (e.g. context) don't get added to memoizedState, - // so memoizedState would be null during updates and mounts. - - { - if (current !== null && current.memoizedState !== null) { - ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; - } else if (hookTypesDev !== null) { - // This dispatcher handles an edge case where a component is updating, - // but no stateful hooks have been used. - // We want to match the production code behavior (which will use HooksDispatcherOnMount), - // but with the extra DEV validation to ensure hooks ordering hasn't changed. - // This dispatcher does that. - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; - } else { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; - } - } - - var children = Component(props, secondArg); // Check if there was a render phase update - - if (didScheduleRenderPhaseUpdateDuringThisPass) { - // Keep rendering in a loop for as long as render phase updates continue to - // be scheduled. Use a counter to prevent infinite loops. - var numberOfReRenders = 0; - - do { - didScheduleRenderPhaseUpdateDuringThisPass = false; - - if (!(numberOfReRenders < RE_RENDER_LIMIT)) { - { - throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); - } - } - - numberOfReRenders += 1; - - { - // Even when hot reloading, allow dependencies to stabilize - // after first render to prevent infinite render phase updates. - ignorePreviousDependencies = false; - } // Start over from the beginning of the list - - - currentHook = null; - workInProgressHook = null; - workInProgress.updateQueue = null; - - { - // Also validate hook order for cascading updates. - hookTypesUpdateIndexDev = -1; - } - - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV ; - children = Component(props, secondArg); - } while (didScheduleRenderPhaseUpdateDuringThisPass); - } // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrancy. - - - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - - { - workInProgress._debugHookTypes = hookTypesDev; - } // This check uses currentHook so that it works the same in DEV and prod bundles. - // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. - - - var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; - renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; - currentHook = null; - workInProgressHook = null; - - { - currentHookNameInDev = null; - hookTypesDev = null; - hookTypesUpdateIndexDev = -1; - } - - didScheduleRenderPhaseUpdate = false; - - if (!!didRenderTooFewHooks) { - { - throw Error( "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." ); - } - } - - return children; -} -function bailoutHooks(current, workInProgress, lanes) { - workInProgress.updateQueue = current.updateQueue; - workInProgress.flags &= ~(Passive | Update); - current.lanes = removeLanes(current.lanes, lanes); -} -function resetHooksAfterThrow() { - // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrancy. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - - if (didScheduleRenderPhaseUpdate) { - // There were render phase updates. These are only valid for this render - // phase, which we are now aborting. Remove the updates from the queues so - // they do not persist to the next render. Do not remove updates from hooks - // that weren't processed. - // - // Only reset the updates from the queue if it has a clone. If it does - // not have a clone, that means it wasn't processed, and the updates were - // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; - - while (hook !== null) { - var queue = hook.queue; - - if (queue !== null) { - queue.pending = null; - } - - hook = hook.next; - } - - didScheduleRenderPhaseUpdate = false; - } - - renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; - currentHook = null; - workInProgressHook = null; - - { - hookTypesDev = null; - hookTypesUpdateIndexDev = -1; - currentHookNameInDev = null; - isUpdatingOpaqueValueInRenderPhase = false; - } - - didScheduleRenderPhaseUpdateDuringThisPass = false; -} - -function mountWorkInProgressHook() { - var hook = { - memoizedState: null, - baseState: null, - baseQueue: null, - queue: null, - next: null - }; - - if (workInProgressHook === null) { - // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; - } else { - // Append to the end of the list - workInProgressHook = workInProgressHook.next = hook; - } - - return workInProgressHook; -} - -function updateWorkInProgressHook() { - // This function is used both for updates and for re-renders triggered by a - // render phase update. It assumes there is either a current hook we can - // clone, or a work-in-progress hook from a previous render pass that we can - // use as a base. When we reach the end of the base list, we must switch to - // the dispatcher used for mounts. - var nextCurrentHook; - - if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; - - if (current !== null) { - nextCurrentHook = current.memoizedState; - } else { - nextCurrentHook = null; - } - } else { - nextCurrentHook = currentHook.next; - } - - var nextWorkInProgressHook; - - if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; - } else { - nextWorkInProgressHook = workInProgressHook.next; - } - - if (nextWorkInProgressHook !== null) { - // There's already a work-in-progress. Reuse it. - workInProgressHook = nextWorkInProgressHook; - nextWorkInProgressHook = workInProgressHook.next; - currentHook = nextCurrentHook; - } else { - // Clone from the current hook. - if (!(nextCurrentHook !== null)) { - { - throw Error( "Rendered more hooks than during the previous render." ); - } - } - - currentHook = nextCurrentHook; - var newHook = { - memoizedState: currentHook.memoizedState, - baseState: currentHook.baseState, - baseQueue: currentHook.baseQueue, - queue: currentHook.queue, - next: null - }; - - if (workInProgressHook === null) { - // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; - } else { - // Append to the end of the list. - workInProgressHook = workInProgressHook.next = newHook; - } - } - - return workInProgressHook; -} - -function createFunctionComponentUpdateQueue() { - return { - lastEffect: null - }; -} - -function basicStateReducer(state, action) { - // $FlowFixMe: Flow doesn't like mixed types - return typeof action === 'function' ? action(state) : action; -} - -function mountReducer(reducer, initialArg, init) { - var hook = mountWorkInProgressHook(); - var initialState; - - if (init !== undefined) { - initialState = init(initialArg); - } else { - initialState = initialArg; - } - - hook.memoizedState = hook.baseState = initialState; - var queue = hook.queue = { - pending: null, - dispatch: null, - lastRenderedReducer: reducer, - lastRenderedState: initialState - }; - var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); - return [hook.memoizedState, dispatch]; -} - -function updateReducer(reducer, initialArg, init) { - var hook = updateWorkInProgressHook(); - var queue = hook.queue; - - if (!(queue !== null)) { - { - throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); - } - } - - queue.lastRenderedReducer = reducer; - var current = currentHook; // The last rebase update that is NOT part of the base state. - - var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. - - var pendingQueue = queue.pending; - - if (pendingQueue !== null) { - // We have new updates that haven't been processed yet. - // We'll add them to the base queue. - if (baseQueue !== null) { - // Merge the pending queue and the base queue. - var baseFirst = baseQueue.next; - var pendingFirst = pendingQueue.next; - baseQueue.next = pendingFirst; - pendingQueue.next = baseFirst; - } - - { - if (current.baseQueue !== baseQueue) { - // Internal invariant that should never happen, but feasibly could in - // the future if we implement resuming, or some form of that. - error('Internal error: Expected work-in-progress queue to be a clone. ' + 'This is a bug in React.'); - } - } - - current.baseQueue = baseQueue = pendingQueue; - queue.pending = null; - } - - if (baseQueue !== null) { - // We have a queue to process. - var first = baseQueue.next; - var newState = current.baseState; - var newBaseState = null; - var newBaseQueueFirst = null; - var newBaseQueueLast = null; - var update = first; - - do { - var updateLane = update.lane; - - if (!isSubsetOfLanes(renderLanes, updateLane)) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - lane: updateLane, - action: update.action, - eagerReducer: update.eagerReducer, - eagerState: update.eagerState, - next: null - }; - - if (newBaseQueueLast === null) { - newBaseQueueFirst = newBaseQueueLast = clone; - newBaseState = newState; - } else { - newBaseQueueLast = newBaseQueueLast.next = clone; - } // Update the remaining priority in the queue. - // TODO: Don't need to accumulate this. Instead, we can remove - // renderLanes from the original lanes. - - - currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane); - markSkippedUpdateLanes(updateLane); - } else { - // This update does have sufficient priority. - if (newBaseQueueLast !== null) { - var _clone = { - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - action: update.action, - eagerReducer: update.eagerReducer, - eagerState: update.eagerState, - next: null - }; - newBaseQueueLast = newBaseQueueLast.next = _clone; - } // Process this update. - - - if (update.eagerReducer === reducer) { - // If this update was processed eagerly, and its reducer matches the - // current reducer, we can use the eagerly computed state. - newState = update.eagerState; - } else { - var action = update.action; - newState = reducer(newState, action); - } - } - - update = update.next; - } while (update !== null && update !== first); - - if (newBaseQueueLast === null) { - newBaseState = newState; - } else { - newBaseQueueLast.next = newBaseQueueFirst; - } // Mark that the fiber performed work, but only if the new state is - // different from the current state. - - - if (!objectIs(newState, hook.memoizedState)) { - markWorkInProgressReceivedUpdate(); - } - - hook.memoizedState = newState; - hook.baseState = newBaseState; - hook.baseQueue = newBaseQueueLast; - queue.lastRenderedState = newState; - } - - var dispatch = queue.dispatch; - return [hook.memoizedState, dispatch]; -} - -function rerenderReducer(reducer, initialArg, init) { - var hook = updateWorkInProgressHook(); - var queue = hook.queue; - - if (!(queue !== null)) { - { - throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); - } - } - - queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous - // work-in-progress hook. - - var dispatch = queue.dispatch; - var lastRenderPhaseUpdate = queue.pending; - var newState = hook.memoizedState; - - if (lastRenderPhaseUpdate !== null) { - // The queue doesn't persist past this render pass. - queue.pending = null; - var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; - var update = firstRenderPhaseUpdate; - - do { - // Process this render phase update. We don't have to check the - // priority because it will always be the same as the current - // render's. - var action = update.action; - newState = reducer(newState, action); - update = update.next; - } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is - // different from the current state. - - - if (!objectIs(newState, hook.memoizedState)) { - markWorkInProgressReceivedUpdate(); - } - - hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to - // the base state unless the queue is empty. - // TODO: Not sure if this is the desired semantics, but it's what we - // do for gDSFP. I can't remember why. - - if (hook.baseQueue === null) { - hook.baseState = newState; - } - - queue.lastRenderedState = newState; - } - - return [newState, dispatch]; -} - -function readFromUnsubcribedMutableSource(root, source, getSnapshot) { - { - warnAboutMultipleRenderersDEV(source); - } - - var getVersion = source._getVersion; - var version = getVersion(source._source); // Is it safe for this component to read from this source during the current render? - - var isSafeToReadFromSource = false; // Check the version first. - // If this render has already been started with a specific version, - // we can use it alone to determine if we can safely read from the source. - - var currentRenderVersion = getWorkInProgressVersion(source); - - if (currentRenderVersion !== null) { - // It's safe to read if the store hasn't been mutated since the last time - // we read something. - isSafeToReadFromSource = currentRenderVersion === version; - } else { - // If there's no version, then this is the first time we've read from the - // source during the current render pass, so we need to do a bit more work. - // What we need to determine is if there are any hooks that already - // subscribed to the source, and if so, whether there are any pending - // mutations that haven't been synchronized yet. - // - // If there are no pending mutations, then `root.mutableReadLanes` will be - // empty, and we know we can safely read. - // - // If there *are* pending mutations, we may still be able to safely read - // if the currently rendering lanes are inclusive of the pending mutation - // lanes, since that guarantees that the value we're about to read from - // the source is consistent with the values that we read during the most - // recent mutation. - isSafeToReadFromSource = isSubsetOfLanes(renderLanes, root.mutableReadLanes); - - if (isSafeToReadFromSource) { - // If it's safe to read from this source during the current render, - // store the version in case other components read from it. - // A changed version number will let those components know to throw and restart the render. - setWorkInProgressVersion(source, version); - } - } - - if (isSafeToReadFromSource) { - var snapshot = getSnapshot(source._source); - - { - if (typeof snapshot === 'function') { - error('Mutable source should not return a function as the snapshot value. ' + 'Functions may close over mutable values and cause tearing.'); - } - } - - return snapshot; - } else { - // This handles the special case of a mutable source being shared between renderers. - // In that case, if the source is mutated between the first and second renderer, - // The second renderer don't know that it needs to reset the WIP version during unwind, - // (because the hook only marks sources as dirty if it's written to their WIP version). - // That would cause this tear check to throw again and eventually be visible to the user. - // We can avoid this infinite loop by explicitly marking the source as dirty. - // - // This can lead to tearing in the first renderer when it resumes, - // but there's nothing we can do about that (short of throwing here and refusing to continue the render). - markSourceAsDirty(source); - - { - { - throw Error( "Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue." ); - } - } - } -} - -function useMutableSource(hook, source, getSnapshot, subscribe) { - var root = getWorkInProgressRoot(); - - if (!(root !== null)) { - { - throw Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); - } - } - - var getVersion = source._getVersion; - var version = getVersion(source._source); - var dispatcher = ReactCurrentDispatcher$1.current; // eslint-disable-next-line prefer-const - - var _dispatcher$useState = dispatcher.useState(function () { - return readFromUnsubcribedMutableSource(root, source, getSnapshot); - }), - currentSnapshot = _dispatcher$useState[0], - setSnapshot = _dispatcher$useState[1]; - - var snapshot = currentSnapshot; // Grab a handle to the state hook as well. - // We use it to clear the pending update queue if we have a new source. - - var stateHook = workInProgressHook; - var memoizedState = hook.memoizedState; - var refs = memoizedState.refs; - var prevGetSnapshot = refs.getSnapshot; - var prevSource = memoizedState.source; - var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; - hook.memoizedState = { - refs: refs, - source: source, - subscribe: subscribe - }; // Sync the values needed by our subscription handler after each commit. - - dispatcher.useEffect(function () { - refs.getSnapshot = getSnapshot; // Normally the dispatch function for a state hook never changes, - // but this hook recreates the queue in certain cases to avoid updates from stale sources. - // handleChange() below needs to reference the dispatch function without re-subscribing, - // so we use a ref to ensure that it always has the latest version. - - refs.setSnapshot = setSnapshot; // Check for a possible change between when we last rendered now. - - var maybeNewVersion = getVersion(source._source); - - if (!objectIs(version, maybeNewVersion)) { - var maybeNewSnapshot = getSnapshot(source._source); - - { - if (typeof maybeNewSnapshot === 'function') { - error('Mutable source should not return a function as the snapshot value. ' + 'Functions may close over mutable values and cause tearing.'); - } - } - - if (!objectIs(snapshot, maybeNewSnapshot)) { - setSnapshot(maybeNewSnapshot); - var lane = requestUpdateLane(fiber); - markRootMutableRead(root, lane); - } // If the source mutated between render and now, - // there may be state updates already scheduled from the old source. - // Entangle the updates so that they render in the same batch. - - - markRootEntangled(root, root.mutableReadLanes); - } - }, [getSnapshot, source, subscribe]); // If we got a new source or subscribe function, re-subscribe in a passive effect. - - dispatcher.useEffect(function () { - var handleChange = function () { - var latestGetSnapshot = refs.getSnapshot; - var latestSetSnapshot = refs.setSnapshot; - - try { - latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time. - - var lane = requestUpdateLane(fiber); - markRootMutableRead(root, lane); - } catch (error) { - // A selector might throw after a source mutation. - // e.g. it might try to read from a part of the store that no longer exists. - // In this case we should still schedule an update with React. - // Worst case the selector will throw again and then an error boundary will handle it. - latestSetSnapshot(function () { - throw error; - }); - } - }; - - var unsubscribe = subscribe(source._source, handleChange); - - { - if (typeof unsubscribe !== 'function') { - error('Mutable source subscribe function must return an unsubscribe function.'); - } - } - - return unsubscribe; - }, [source, subscribe]); // If any of the inputs to useMutableSource change, reading is potentially unsafe. - // - // If either the source or the subscription have changed we can't can't trust the update queue. - // Maybe the source changed in a way that the old subscription ignored but the new one depends on. - // - // If the getSnapshot function changed, we also shouldn't rely on the update queue. - // It's possible that the underlying source was mutated between the when the last "change" event fired, - // and when the current render (with the new getSnapshot function) is processed. - // - // In both cases, we need to throw away pending updates (since they are no longer relevant) - // and treat reading from the source as we do in the mount case. - - if (!objectIs(prevGetSnapshot, getSnapshot) || !objectIs(prevSource, source) || !objectIs(prevSubscribe, subscribe)) { - // Create a new queue and setState method, - // So if there are interleaved updates, they get pushed to the older queue. - // When this becomes current, the previous queue and dispatch method will be discarded, - // including any interleaving updates that occur. - var newQueue = { - pending: null, - dispatch: null, - lastRenderedReducer: basicStateReducer, - lastRenderedState: snapshot - }; - newQueue.dispatch = setSnapshot = dispatchAction.bind(null, currentlyRenderingFiber$1, newQueue); - stateHook.queue = newQueue; - stateHook.baseQueue = null; - snapshot = readFromUnsubcribedMutableSource(root, source, getSnapshot); - stateHook.memoizedState = stateHook.baseState = snapshot; - } - - return snapshot; -} - -function mountMutableSource(source, getSnapshot, subscribe) { - var hook = mountWorkInProgressHook(); - hook.memoizedState = { - refs: { - getSnapshot: getSnapshot, - setSnapshot: null - }, - source: source, - subscribe: subscribe - }; - return useMutableSource(hook, source, getSnapshot, subscribe); -} - -function updateMutableSource(source, getSnapshot, subscribe) { - var hook = updateWorkInProgressHook(); - return useMutableSource(hook, source, getSnapshot, subscribe); -} - -function mountState(initialState) { - var hook = mountWorkInProgressHook(); - - if (typeof initialState === 'function') { - // $FlowFixMe: Flow doesn't like mixed types - initialState = initialState(); - } - - hook.memoizedState = hook.baseState = initialState; - var queue = hook.queue = { - pending: null, - dispatch: null, - lastRenderedReducer: basicStateReducer, - lastRenderedState: initialState - }; - var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); - return [hook.memoizedState, dispatch]; -} - -function updateState(initialState) { - return updateReducer(basicStateReducer); -} - -function rerenderState(initialState) { - return rerenderReducer(basicStateReducer); -} - -function pushEffect(tag, create, destroy, deps) { - var effect = { - tag: tag, - create: create, - destroy: destroy, - deps: deps, - // Circular - next: null - }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; - - if (componentUpdateQueue === null) { - componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; - componentUpdateQueue.lastEffect = effect.next = effect; - } else { - var lastEffect = componentUpdateQueue.lastEffect; - - if (lastEffect === null) { - componentUpdateQueue.lastEffect = effect.next = effect; - } else { - var firstEffect = lastEffect.next; - lastEffect.next = effect; - effect.next = firstEffect; - componentUpdateQueue.lastEffect = effect; - } - } - - return effect; -} - -function mountRef(initialValue) { - var hook = mountWorkInProgressHook(); - var ref = { - current: initialValue - }; - - { - Object.seal(ref); - } - - hook.memoizedState = ref; - return ref; -} - -function updateRef(initialValue) { - var hook = updateWorkInProgressHook(); - return hook.memoizedState; -} - -function mountEffectImpl(fiberFlags, hookFlags, create, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; - hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps); -} - -function updateEffectImpl(fiberFlags, hookFlags, create, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var destroy = undefined; - - if (currentHook !== null) { - var prevEffect = currentHook.memoizedState; - destroy = prevEffect.destroy; - - if (nextDeps !== null) { - var prevDeps = prevEffect.deps; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - pushEffect(hookFlags, create, destroy, nextDeps); - return; - } - } - } - - currentlyRenderingFiber$1.flags |= fiberFlags; - hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps); -} - -function mountEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - - return mountEffectImpl(Update | Passive, Passive$1, create, deps); -} - -function updateEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - - return updateEffectImpl(Update | Passive, Passive$1, create, deps); -} - -function mountLayoutEffect(create, deps) { - return mountEffectImpl(Update, Layout, create, deps); -} - -function updateLayoutEffect(create, deps) { - return updateEffectImpl(Update, Layout, create, deps); -} - -function imperativeHandleEffect(create, ref) { - if (typeof ref === 'function') { - var refCallback = ref; - - var _inst = create(); - - refCallback(_inst); - return function () { - refCallback(null); - }; - } else if (ref !== null && ref !== undefined) { - var refObject = ref; - - { - if (!refObject.hasOwnProperty('current')) { - error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}'); - } - } - - var _inst2 = create(); - - refObject.current = _inst2; - return function () { - refObject.current = null; - }; - } -} - -function mountImperativeHandle(ref, create, deps) { - { - if (typeof create !== 'function') { - error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); - } - } // TODO: If deps are provided, should we skip comparing the ref itself? - - - var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; - return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); -} - -function updateImperativeHandle(ref, create, deps) { - { - if (typeof create !== 'function') { - error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); - } - } // TODO: If deps are provided, should we skip comparing the ref itself? - - - var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; - return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); -} - -function mountDebugValue(value, formatterFn) {// This hook is normally a no-op. - // The react-debug-hooks package injects its own implementation - // so that e.g. DevTools can display custom hook values. -} - -var updateDebugValue = mountDebugValue; - -function mountCallback(callback, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - hook.memoizedState = [callback, nextDeps]; - return callback; -} - -function updateCallback(callback, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var prevState = hook.memoizedState; - - if (prevState !== null) { - if (nextDeps !== null) { - var prevDeps = prevState[1]; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - return prevState[0]; - } - } - } - - hook.memoizedState = [callback, nextDeps]; - return callback; -} - -function mountMemo(nextCreate, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var nextValue = nextCreate(); - hook.memoizedState = [nextValue, nextDeps]; - return nextValue; -} - -function updateMemo(nextCreate, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var prevState = hook.memoizedState; - - if (prevState !== null) { - // Assume these are defined. If they're not, areHookInputsEqual will warn. - if (nextDeps !== null) { - var prevDeps = prevState[1]; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - return prevState[0]; - } - } - } - - var nextValue = nextCreate(); - hook.memoizedState = [nextValue, nextDeps]; - return nextValue; -} - -function mountDeferredValue(value) { - var _mountState = mountState(value), - prevValue = _mountState[0], - setValue = _mountState[1]; - - mountEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; -} - -function updateDeferredValue(value) { - var _updateState = updateState(), - prevValue = _updateState[0], - setValue = _updateState[1]; - - updateEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; -} - -function rerenderDeferredValue(value) { - var _rerenderState = rerenderState(), - prevValue = _rerenderState[0], - setValue = _rerenderState[1]; - - updateEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; -} - -function startTransition(setPending, callback) { - var priorityLevel = getCurrentPriorityLevel(); - - { - runWithPriority(priorityLevel < UserBlockingPriority$1 ? UserBlockingPriority$1 : priorityLevel, function () { - setPending(true); - }); - runWithPriority(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setPending(false); - callback(); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }); - } -} - -function mountTransition() { - var _mountState2 = mountState(false), - isPending = _mountState2[0], - setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending` - // never changes. - - - var start = startTransition.bind(null, setPending); - mountRef(start); - return [start, isPending]; -} - -function updateTransition() { - var _updateState2 = updateState(), - isPending = _updateState2[0]; - - var startRef = updateRef(); - var start = startRef.current; - return [start, isPending]; -} - -function rerenderTransition() { - var _rerenderState2 = rerenderState(), - isPending = _rerenderState2[0]; - - var startRef = updateRef(); - var start = startRef.current; - return [start, isPending]; -} - -var isUpdatingOpaqueValueInRenderPhase = false; -function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { - { - return isUpdatingOpaqueValueInRenderPhase; - } -} - -function warnOnOpaqueIdentifierAccessInDEV(fiber) { - { - // TODO: Should warn in effects and callbacks, too - var name = getComponentName(fiber.type) || 'Unknown'; - - if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) { - error('The object passed back from useOpaqueIdentifier is meant to be ' + 'passed through to attributes only. Do not read the ' + 'value directly.'); - - didWarnAboutUseOpaqueIdentifier[name] = true; - } - } -} - -function mountOpaqueIdentifier() { - var makeId = makeClientIdInDEV.bind(null, warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1)) ; - - { - var _id = makeId(); - - mountState(_id); - return _id; - } -} - -function updateOpaqueIdentifier() { - var id = updateState()[0]; - return id; -} - -function rerenderOpaqueIdentifier() { - var id = rerenderState()[0]; - return id; -} - -function dispatchAction(fiber, queue, action) { - { - if (typeof arguments[3] === 'function') { - error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); - } - } - - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = { - lane: lane, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }; // Append the update to the end of the list. - - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - var alternate = fiber.alternate; - - if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) { - // This is a render phase update. Stash it in a lazily-created map of - // queue -> linked list of updates. After this render pass, we'll restart - // and apply the stashed updates on top of the work-in-progress hook. - didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; - } else { - if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) { - // The queue is currently empty, which means we can eagerly compute the - // next state before entering the render phase. If the new state is the - // same as the current state, we may be able to bail out entirely. - var lastRenderedReducer = queue.lastRenderedReducer; - - if (lastRenderedReducer !== null) { - var prevDispatcher; - - { - prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - } - - try { - var currentState = queue.lastRenderedState; - var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute - // it, on the update object. If the reducer hasn't changed by the - // time we enter the render phase, then the eager state can be used - // without calling the reducer again. - - update.eagerReducer = lastRenderedReducer; - update.eagerState = eagerState; - - if (objectIs(eagerState, currentState)) { - // Fast path. We can bail out without scheduling React to re-render. - // It's still possible that we'll need to rebase this update later, - // if the component re-renders for a different reason and by that - // time the reducer has changed. - return; - } - } catch (error) {// Suppress the error. It will throw again in the render phase. - } finally { - { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - } - } - } - - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotScopedWithMatchingAct(fiber); - warnIfNotCurrentlyActingUpdatesInDev(fiber); - } - } - - scheduleUpdateOnFiber(fiber, lane, eventTime); - } -} - -var ContextOnlyDispatcher = { - readContext: readContext, - useCallback: throwInvalidHookError, - useContext: throwInvalidHookError, - useEffect: throwInvalidHookError, - useImperativeHandle: throwInvalidHookError, - useLayoutEffect: throwInvalidHookError, - useMemo: throwInvalidHookError, - useReducer: throwInvalidHookError, - useRef: throwInvalidHookError, - useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError, - useDeferredValue: throwInvalidHookError, - useTransition: throwInvalidHookError, - useMutableSource: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler -}; -var HooksDispatcherOnMountInDEV = null; -var HooksDispatcherOnMountWithHookTypesInDEV = null; -var HooksDispatcherOnUpdateInDEV = null; -var HooksDispatcherOnRerenderInDEV = null; -var InvalidNestedHooksDispatcherOnMountInDEV = null; -var InvalidNestedHooksDispatcherOnUpdateInDEV = null; -var InvalidNestedHooksDispatcherOnRerenderInDEV = null; - -{ - var warnInvalidContextAccess = function () { - error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); - }; - - var warnInvalidHookAccess = function () { - error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks'); - }; - - HooksDispatcherOnMountInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - mountHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - mountHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - mountHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - mountHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - mountHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - mountHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - mountHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnMountWithHookTypesInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnUpdateInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return updateDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return updateTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return updateOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnRerenderInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return rerenderReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return rerenderState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return rerenderDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return rerenderTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return rerenderOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnMountInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnUpdateInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnRerenderInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return rerenderReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return rerenderState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; -} - -var now$1 = Scheduler$1.unstable_now; -var commitTime = 0; -var profilerStartTime = -1; - -function getCommitTime() { - return commitTime; -} - -function recordCommitTime() { - - commitTime = now$1(); -} - -function startProfilerTimer(fiber) { - - profilerStartTime = now$1(); - - if (fiber.actualStartTime < 0) { - fiber.actualStartTime = now$1(); - } -} - -function stopProfilerTimerIfRunning(fiber) { - - profilerStartTime = -1; -} - -function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { - - if (profilerStartTime >= 0) { - var elapsedTime = now$1() - profilerStartTime; - fiber.actualDuration += elapsedTime; - - if (overrideBaseTime) { - fiber.selfBaseDuration = elapsedTime; - } - - profilerStartTime = -1; - } -} - -function transferActualDuration(fiber) { - // Transfer time spent rendering these children so we don't lose it - // after we rerender. This is used as a helper in special cases - // where we should count the work of multiple passes. - var child = fiber.child; - - while (child) { - fiber.actualDuration += child.actualDuration; - child = child.sibling; - } -} - -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; -var didReceiveUpdate = false; -var didWarnAboutBadClass; -var didWarnAboutModulePatternComponent; -var didWarnAboutContextTypeOnFunctionComponent; -var didWarnAboutGetDerivedStateOnFunctionComponent; -var didWarnAboutFunctionRefs; -var didWarnAboutReassigningProps; -var didWarnAboutRevealOrder; -var didWarnAboutTailOptions; - -{ - didWarnAboutBadClass = {}; - didWarnAboutModulePatternComponent = {}; - didWarnAboutContextTypeOnFunctionComponent = {}; - didWarnAboutGetDerivedStateOnFunctionComponent = {}; - didWarnAboutFunctionRefs = {}; - didWarnAboutReassigningProps = false; - didWarnAboutRevealOrder = {}; - didWarnAboutTailOptions = {}; -} - -function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { - if (current === null) { - // If this is a fresh new component that hasn't been rendered yet, we - // won't update its child set by applying minimal side-effects. Instead, - // we will add them all to the child before it gets rendered. That means - // we can optimize this reconciliation pass by not tracking side-effects. - workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); - } else { - // If the current child is the same as the work in progress, it means that - // we haven't yet started any work on these children. Therefore, we use - // the clone algorithm to create a copy of all the current children. - // If we had any progressed work already, that is invalid at this point so - // let's throw it out. - workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); - } -} - -function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) { - // This function is fork of reconcileChildren. It's used in cases where we - // want to reconcile without matching against the existing set. This has the - // effect of all current children being unmounted; even if the type and key - // are the same, the old child is unmounted and a new child is created. - // - // To do this, we're going to go through the reconcile algorithm twice. In - // the first pass, we schedule a deletion for all the current children by - // passing null. - workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we - // pass null in place of where we usually pass the current child set. This has - // the effect of remounting all children regardless of whether their - // identities match. - - workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); -} - -function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { - // TODO: current can be non-null here even if the component - // hasn't yet mounted. This happens after the first render suspends. - // We'll need to figure out if this is fine or can cause issues. - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } - - var render = Component.render; - var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent - - var nextChildren; - prepareToReadContext(workInProgress, renderLanes); - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); - - setIsRendering(false); - } - - if (current !== null && !didReceiveUpdate) { - bailoutHooks(current, workInProgress, renderLanes); - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function updateMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { - if (current === null) { - var type = Component.type; - - if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. - Component.defaultProps === undefined) { - var resolvedType = type; - - { - resolvedType = resolveFunctionForHotReloading(type); - } // If this is a plain function component without default props, - // and with only the default shallow comparison, we upgrade it - // to a SimpleMemoComponent to allow fast path updates. - - - workInProgress.tag = SimpleMemoComponent; - workInProgress.type = resolvedType; - - { - validateFunctionComponentInDev(workInProgress, type); - } - - return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateLanes, renderLanes); - } - - { - var innerPropTypes = type.propTypes; - - if (innerPropTypes) { - // Inner memo component props aren't currently validated in createElement. - // We could move it there, but we'd still need this for lazy code path. - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(type)); - } - } - - var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); - child.ref = workInProgress.ref; - child.return = workInProgress; - workInProgress.child = child; - return child; - } - - { - var _type = Component.type; - var _innerPropTypes = _type.propTypes; - - if (_innerPropTypes) { - // Inner memo component props aren't currently validated in createElement. - // We could move it there, but we'd still need this for lazy code path. - checkPropTypes(_innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(_type)); - } - } - - var currentChild = current.child; // This is always exactly one child - - if (!includesSomeLane(updateLanes, renderLanes)) { - // This will be the props with resolved defaultProps, - // unlike current.memoizedProps which will be the unresolved ones. - var prevProps = currentChild.memoizedProps; // Default to shallow comparison - - var compare = Component.compare; - compare = compare !== null ? compare : shallowEqual; - - if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - var newChild = createWorkInProgress(currentChild, nextProps); - newChild.ref = workInProgress.ref; - newChild.return = workInProgress; - workInProgress.child = newChild; - return newChild; -} - -function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { - // TODO: current can be non-null here even if the component - // hasn't yet mounted. This happens when the inner render suspends. - // We'll need to figure out if this is fine or can cause issues. - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var outerMemoType = workInProgress.elementType; - - if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { - // We warn when you define propTypes on lazy() - // so let's just skip over it to find memo() outer wrapper. - // Inner props for memo are validated later. - var lazyComponent = outerMemoType; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - outerMemoType = init(payload); - } catch (x) { - outerMemoType = null; - } // Inner propTypes will be validated in the function component path. - - - var outerPropTypes = outerMemoType && outerMemoType.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps) - 'prop', getComponentName(outerMemoType)); - } - } - } - } - - if (current !== null) { - var prevProps = current.memoizedProps; - - if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload. - workInProgress.type === current.type )) { - didReceiveUpdate = false; - - if (!includesSomeLane(renderLanes, updateLanes)) { - // The pending lanes were cleared at the beginning of beginWork. We're - // about to bail out, but there might be other lanes that weren't - // included in the current render. Usually, the priority level of the - // remaining updates is accumlated during the evaluation of the - // component (i.e. when processing the update queue). But since since - // we're bailing out early *without* evaluating the component, we need - // to account for it here, too. Reset to the value of the current fiber. - // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, - // because a MemoComponent fiber does not have hooks or an update queue; - // rather, it wraps around an inner component, which may or may not - // contains hooks. - // TODO: Move the reset at in beginWork out of the common path so that - // this is no longer necessary. - workInProgress.lanes = current.lanes; - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { - // This is a special case that only exists for legacy mode. - // See https://github.com/facebook/react/pull/19216. - didReceiveUpdate = true; - } - } - } - - return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); -} - -function updateOffscreenComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; - var nextChildren = nextProps.children; - var prevState = current !== null ? current.memoizedState : null; - - if (nextProps.mode === 'hidden' || nextProps.mode === 'unstable-defer-without-hiding') { - if ((workInProgress.mode & ConcurrentMode) === NoMode) { - // In legacy sync mode, don't defer the subtree. Render it now. - // TODO: Figure out what we should do in Blocking mode. - var nextState = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = nextState; - pushRenderLanes(workInProgress, renderLanes); - } else if (!includesSomeLane(renderLanes, OffscreenLane)) { - var nextBaseLanes; - - if (prevState !== null) { - var prevBaseLanes = prevState.baseLanes; - nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes); - } else { - nextBaseLanes = renderLanes; - } // Schedule this fiber to re-render at offscreen priority. Then bailout. - - - { - markSpawnedWork(OffscreenLane); - } - - workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane); - var _nextState = { - baseLanes: nextBaseLanes - }; - workInProgress.memoizedState = _nextState; // We're about to bail out, but we need to push this to the stack anyway - // to avoid a push/pop misalignment. - - pushRenderLanes(workInProgress, nextBaseLanes); - return null; - } else { - // Rendering at offscreen, so we can clear the base lanes. - var _nextState2 = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out. - - var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes; - pushRenderLanes(workInProgress, subtreeRenderLanes); - } - } else { - var _subtreeRenderLanes; - - if (prevState !== null) { - _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); // Since we're not hidden anymore, reset the state - - workInProgress.memoizedState = null; - } else { - // We weren't previously hidden, and we still aren't, so there's nothing - // special to do. Need to push to the stack regardless, though, to avoid - // a push/pop misalignment. - _subtreeRenderLanes = renderLanes; - } - - pushRenderLanes(workInProgress, _subtreeRenderLanes); - } - - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} // Note: These happen to have identical begin phases, for now. We shouldn't hold -// ourselves to this constraint, though. If the behavior diverges, we should -// fork the function. - - -var updateLegacyHiddenComponent = updateOffscreenComponent; - -function updateFragment(current, workInProgress, renderLanes) { - var nextChildren = workInProgress.pendingProps; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function updateMode(current, workInProgress, renderLanes) { - var nextChildren = workInProgress.pendingProps.children; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function updateProfiler(current, workInProgress, renderLanes) { - { - workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase. - // These are reset during render to allow the DevTools commit hook a chance to read them, - - var stateNode = workInProgress.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - } - - var nextProps = workInProgress.pendingProps; - var nextChildren = nextProps.children; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function markRef(current, workInProgress) { - var ref = workInProgress.ref; - - if (current === null && ref !== null || current !== null && current.ref !== ref) { - // Schedule a Ref effect - workInProgress.flags |= Ref; - } -} - -function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } - - var context; - - { - var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); - context = getMaskedContext(workInProgress, unmaskedContext); - } - - var nextChildren; - prepareToReadContext(workInProgress, renderLanes); - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); - - setIsRendering(false); - } - - if (current !== null && !didReceiveUpdate) { - bailoutHooks(current, workInProgress, renderLanes); - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - - var hasContext; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - prepareToReadContext(workInProgress, renderLanes); - var instance = workInProgress.stateNode; - var shouldUpdate; - - if (instance === null) { - if (current !== null) { - // A class component without an instance only mounts if it suspended - // inside a non-concurrent tree, in an inconsistent state. We want to - // treat it like a new mount, even though an empty version of it already - // committed. Disconnect the alternate pointers. - current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } // In the initial pass we might need to construct the instance. - - - constructClassInstance(workInProgress, Component, nextProps); - mountClassInstance(workInProgress, Component, nextProps, renderLanes); - shouldUpdate = true; - } else if (current === null) { - // In a resume, we'll already have an instance we can reuse. - shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes); - } else { - shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes); - } - - var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes); - - { - var inst = workInProgress.stateNode; - - if (shouldUpdate && inst.props !== nextProps) { - if (!didWarnAboutReassigningProps) { - error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component'); - } - - didWarnAboutReassigningProps = true; - } - } - - return nextUnitOfWork; -} - -function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) { - // Refs should update even if shouldComponentUpdate returns false - markRef(current, workInProgress); - var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags; - - if (!shouldUpdate && !didCaptureError) { - // Context providers should defer to sCU for rendering - if (hasContext) { - invalidateContextProvider(workInProgress, Component, false); - } - - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - - var instance = workInProgress.stateNode; // Rerender - - ReactCurrentOwner$1.current = workInProgress; - var nextChildren; - - if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') { - // If we captured an error, but getDerivedStateFromError is not defined, - // unmount all the children. componentDidCatch will schedule an update to - // re-render a fallback. This is temporary until we migrate everyone to - // the new API. - // TODO: Warn in a future release. - nextChildren = null; - - { - stopProfilerTimerIfRunning(); - } - } else { - { - setIsRendering(true); - nextChildren = instance.render(); - - setIsRendering(false); - } - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - - if (current !== null && didCaptureError) { - // If we're recovering from an error, reconcile without reusing any of - // the existing children. Conceptually, the normal children and the children - // that are shown on error are two different sets, so we shouldn't reuse - // normal children even if their identities match. - forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes); - } else { - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } // Memoize state using the values we just used to render. - // TODO: Restructure so we never read values from the instance. - - - workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. - - if (hasContext) { - invalidateContextProvider(workInProgress, Component, true); - } - - return workInProgress.child; -} - -function pushHostRootContext(workInProgress) { - var root = workInProgress.stateNode; - - if (root.pendingContext) { - pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); - } else if (root.context) { - // Should always be set - pushTopLevelContextObject(workInProgress, root.context, false); - } - - pushHostContainer(workInProgress, root.containerInfo); -} - -function updateHostRoot(current, workInProgress, renderLanes) { - pushHostRootContext(workInProgress); - var updateQueue = workInProgress.updateQueue; - - if (!(current !== null && updateQueue !== null)) { - { - throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var nextProps = workInProgress.pendingProps; - var prevState = workInProgress.memoizedState; - var prevChildren = prevState !== null ? prevState.element : null; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property - // being called "element". - - var nextChildren = nextState.element; - - if (nextChildren === prevChildren) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - - var root = workInProgress.stateNode; - - if (root.hydrate && enterHydrationState()) { - - var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); - workInProgress.child = child; - var node = child; - - while (node) { - // Mark each child as hydrating. This is a fast path to know whether this - // tree is part of a hydrating tree. This is used to determine if a child - // node has fully mounted yet, and for scheduling event replaying. - // Conceptually this is similar to Placement in that a new subtree is - // inserted into the React tree here. It just happens to not need DOM - // mutations because it already exists. - node.flags = node.flags & ~Placement | Hydrating; - node = node.sibling; - } - } else { - // Otherwise reset hydration state in case we aborted and resumed another - // root. - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } - - return workInProgress.child; -} - -function updateHostComponent(current, workInProgress, renderLanes) { - pushHostContext(workInProgress); - - var type = workInProgress.type; - var nextProps = workInProgress.pendingProps; - var prevProps = current !== null ? current.memoizedProps : null; - var nextChildren = nextProps.children; - - if (prevProps !== null && shouldSetTextContent()) { - // If we're switching from a direct text child to a normal child, or to - // empty, we need to schedule the text content to be reset. - workInProgress.flags |= ContentReset; - } - - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; -} - -function updateHostText(current, workInProgress) { - // immediately after. - - - return null; -} - -function mountLazyComponent(_current, workInProgress, elementType, updateLanes, renderLanes) { - if (_current !== null) { - // A lazy component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } - - var props = workInProgress.pendingProps; - var lazyComponent = elementType; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - var Component = init(payload); // Store the unwrapped component in the type. - - workInProgress.type = Component; - var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); - var resolvedProps = resolveDefaultProps(Component, props); - var child; - - switch (resolvedTag) { - case FunctionComponent: - { - { - validateFunctionComponentInDev(workInProgress, Component); - workInProgress.type = Component = resolveFunctionForHotReloading(Component); - } - - child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case ClassComponent: - { - { - workInProgress.type = Component = resolveClassForHotReloading(Component); - } - - child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case ForwardRef: - { - { - workInProgress.type = Component = resolveForwardRefForHotReloading(Component); - } - - child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case MemoComponent: - { - { - if (workInProgress.type !== workInProgress.elementType) { - var outerPropTypes = Component.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only - 'prop', getComponentName(Component)); - } - } - } - - child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too - updateLanes, renderLanes); - return child; - } - } - - var hint = ''; - - { - if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) { - hint = ' Did you wrap a component in React.lazy() more than once?'; - } - } // This message intentionally doesn't mention ForwardRef or MemoComponent - // because the fact that it's a separate type of work is an - // implementation detail. - - - { - { - throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint ); - } - } -} - -function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) { - if (_current !== null) { - // An incomplete component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } // Promote the fiber to a class and try rendering again. - - - workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` - // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - var hasContext; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - prepareToReadContext(workInProgress, renderLanes); - constructClassInstance(workInProgress, Component, nextProps); - mountClassInstance(workInProgress, Component, nextProps, renderLanes); - return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); -} - -function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) { - if (_current !== null) { - // An indeterminate component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } - - var props = workInProgress.pendingProps; - var context; - - { - var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); - context = getMaskedContext(workInProgress, unmaskedContext); - } - - prepareToReadContext(workInProgress, renderLanes); - var value; - - { - if (Component.prototype && typeof Component.prototype.render === 'function') { - var componentName = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutBadClass[componentName]) { - error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); - } - - setIsRendering(true); - ReactCurrentOwner$1.current = workInProgress; - value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); - setIsRendering(false); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - - { - // Support for module components is deprecated and is removed behind a flag. - // Whether or not it would crash later, we want to show a good message in DEV first. - if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { - var _componentName = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutModulePatternComponent[_componentName]) { - error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName); - - didWarnAboutModulePatternComponent[_componentName] = true; - } - } - } - - if ( // Run these checks in production only if the flag is off. - // Eventually we'll delete this branch altogether. - typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { - { - var _componentName2 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutModulePatternComponent[_componentName2]) { - error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2); - - didWarnAboutModulePatternComponent[_componentName2] = true; - } - } // Proceed under the assumption that this is a class instance - - - workInProgress.tag = ClassComponent; // Throw out any hooks that were used. - - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - var hasContext = false; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; - initializeUpdateQueue(workInProgress); - var getDerivedStateFromProps = Component.getDerivedStateFromProps; - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props); - } - - adoptClassInstance(workInProgress, value); - mountClassInstance(workInProgress, Component, props, renderLanes); - return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); - } else { - // Proceed under the assumption that this is a function component - workInProgress.tag = FunctionComponent; - - reconcileChildren(null, workInProgress, value, renderLanes); - - { - validateFunctionComponentInDev(workInProgress, Component); - } - - return workInProgress.child; - } -} - -function validateFunctionComponentInDev(workInProgress, Component) { - { - if (Component) { - if (Component.childContextTypes) { - error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component'); - } - } - - if (workInProgress.ref !== null) { - var info = ''; - var ownerName = getCurrentFiberOwnerNameInDevOrNull(); - - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } - - var warningKey = ownerName || workInProgress._debugID || ''; - var debugSource = workInProgress._debugSource; - - if (debugSource) { - warningKey = debugSource.fileName + ':' + debugSource.lineNumber; - } - - if (!didWarnAboutFunctionRefs[warningKey]) { - didWarnAboutFunctionRefs[warningKey] = true; - - error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info); - } - } - - if (typeof Component.getDerivedStateFromProps === 'function') { - var _componentName3 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) { - error('%s: Function components do not support getDerivedStateFromProps.', _componentName3); - - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; - } - } - - if (typeof Component.contextType === 'object' && Component.contextType !== null) { - var _componentName4 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { - error('%s: Function components do not support contextType.', _componentName4); - - didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; - } - } - } -} - -var SUSPENDED_MARKER = { - dehydrated: null, - retryLane: NoLane -}; - -function mountSuspenseOffscreenState(renderLanes) { - return { - baseLanes: renderLanes - }; -} - -function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) { - return { - baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes) - }; -} // TODO: Probably should inline this back - - -function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) { - // If we're already showing a fallback, there are cases where we need to - // remain on that fallback regardless of whether the content has resolved. - // For example, SuspenseList coordinates when nested content appears. - if (current !== null) { - var suspenseState = current.memoizedState; - - if (suspenseState === null) { - // Currently showing content. Don't hide it, even if ForceSuspenseFallack - // is true. More precise name might be "ForceRemainSuspenseFallback". - // Note: This is a factoring smell. Can't remain on a fallback if there's - // no fallback to remain on. - return false; - } - } // Not currently showing content. Consult the Suspense context. - - - return hasSuspenseContext(suspenseContext, ForceSuspenseFallback); -} - -function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); -} - -function updateSuspenseComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. - - { - if (shouldSuspend(workInProgress)) { - workInProgress.flags |= DidCapture; - } - } - - var suspenseContext = suspenseStackCursor.current; - var showFallback = false; - var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags; - - if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { - // Something in this boundary's subtree already suspended. Switch to - // rendering the fallback children. - showFallback = true; - workInProgress.flags &= ~DidCapture; - } else { - // Attempting the main content - if (current === null || current.memoizedState !== null) { - // This is a new mount or this boundary is already showing a fallback state. - // Mark this subtree context as having at least one invisible parent that could - // handle the fallback state. - // Boundaries without fallbacks or should be avoided are not considered since - // they cannot handle preferred fallback states. - if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) { - suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); - } - } - } - - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense - // boundary's children. This involves some custom reconcilation logic. Two - // main reasons this is so complicated. - // - // First, Legacy Mode has different semantics for backwards compatibility. The - // primary tree will commit in an inconsistent state, so when we do the - // second pass to render the fallback, we do some exceedingly, uh, clever - // hacks to make that not totally break. Like transferring effects and - // deletions from hidden tree. In Concurrent Mode, it's much simpler, - // because we bailout on the primary tree completely and leave it in its old - // state, no effects. Same as what we do for Offscreen (except that - // Offscreen doesn't have the first render pass). - // - // Second is hydration. During hydration, the Suspense fiber has a slightly - // different layout, where the child points to a dehydrated fragment, which - // contains the DOM rendered by the server. - // - // Third, even if you set all that aside, Suspense is like error boundaries in - // that we first we try to render one tree, and if that fails, we render again - // and switch to a different tree. Like a try/catch block. So we have to track - // which branch we're currently rendering. Ideally we would model this using - // a stack. - - if (current === null) { - // Initial mount - // If we're currently hydrating, try to hydrate this boundary. - // But only if this has a fallback. - if (nextProps.fallback !== undefined) ; - - var nextPrimaryChildren = nextProps.children; - var nextFallbackChildren = nextProps.fallback; - - if (showFallback) { - var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); - var primaryChildFragment = workInProgress.child; - primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; - return fallbackFragment; - } else if (typeof nextProps.unstable_expectedLoadTime === 'number') { - // This is a CPU-bound tree. Skip this tree and show a placeholder to - // unblock the surrounding content. Then immediately retry after the - // initial commit. - var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); - - var _primaryChildFragment = workInProgress.child; - _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to - // get it started back up to attempt the next item. While in terms of - // priority this work has the same priority as this current render, it's - // not part of the same transition once the transition has committed. If - // it's sync, we still want to yield so that it can be painted. - // Conceptually, this is really the same as pinging. We can use any - // RetryLane even if it's the one currently rendering since we're leaving - // it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - - return _fallbackFragment; - } else { - return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes); - } - } else { - // This is an update. - // If the current fiber has a SuspenseState, that means it's already showing - // a fallback. - var prevState = current.memoizedState; - - if (prevState !== null) { - - if (showFallback) { - var _nextFallbackChildren2 = nextProps.fallback; - var _nextPrimaryChildren2 = nextProps.children; - - var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes); - - var _primaryChildFragment3 = workInProgress.child; - var prevOffscreenState = current.child.memoizedState; - _primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes); - _primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; - return _fallbackChildFragment; - } else { - var _nextPrimaryChildren3 = nextProps.children; - - var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes); - - workInProgress.memoizedState = null; - return _primaryChildFragment4; - } - } else { - // The current tree is not already showing a fallback. - if (showFallback) { - // Timed out. - var _nextFallbackChildren3 = nextProps.fallback; - var _nextPrimaryChildren4 = nextProps.children; - - var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes); - - var _primaryChildFragment5 = workInProgress.child; - var _prevOffscreenState = current.child.memoizedState; - _primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes); - _primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the - // fallback children. - - workInProgress.memoizedState = SUSPENDED_MARKER; - return _fallbackChildFragment2; - } else { - // Still haven't timed out. Continue rendering the children, like we - // normally do. - var _nextPrimaryChildren5 = nextProps.children; - - var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes); - - workInProgress.memoizedState = null; - return _primaryChildFragment6; - } - } - } -} - -function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) { - var mode = workInProgress.mode; - var primaryChildProps = { - mode: 'visible', - children: primaryChildren - }; - var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes, null); - primaryChildFragment.return = workInProgress; - workInProgress.child = primaryChildFragment; - return primaryChildFragment; -} - -function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) { - var mode = workInProgress.mode; - var progressedPrimaryFragment = workInProgress.child; - var primaryChildProps = { - mode: 'hidden', - children: primaryChildren - }; - var primaryChildFragment; - var fallbackChildFragment; - - if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) { - // In legacy mode, we commit the primary tree as if it successfully - // completed, even though it's in an inconsistent state. - primaryChildFragment = progressedPrimaryFragment; - primaryChildFragment.childLanes = NoLanes; - primaryChildFragment.pendingProps = primaryChildProps; - - if ( workInProgress.mode & ProfileMode) { - // Reset the durations from the first pass so they aren't included in the - // final amounts. This seems counterintuitive, since we're intentionally - // not measuring part of the render phase, but this makes it match what we - // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; - primaryChildFragment.selfBaseDuration = 0; - primaryChildFragment.treeBaseDuration = 0; - } - - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); - } else { - primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null); - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); - } - - primaryChildFragment.return = workInProgress; - fallbackChildFragment.return = workInProgress; - primaryChildFragment.sibling = fallbackChildFragment; - workInProgress.child = primaryChildFragment; - return fallbackChildFragment; -} - -function createWorkInProgressOffscreenFiber(current, offscreenProps) { - // The props argument to `createWorkInProgress` is `any` typed, so we use this - // wrapper function to constrain it. - return createWorkInProgress(current, offscreenProps); -} - -function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { - var currentPrimaryChildFragment = current.child; - var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; - var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, { - mode: 'visible', - children: primaryChildren - }); - - if ((workInProgress.mode & BlockingMode) === NoMode) { - primaryChildFragment.lanes = renderLanes; - } - - primaryChildFragment.return = workInProgress; - primaryChildFragment.sibling = null; - - if (currentFallbackChildFragment !== null) { - // Delete the fallback child fragment - currentFallbackChildFragment.nextEffect = null; - currentFallbackChildFragment.flags = Deletion; - workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; - } - - workInProgress.child = primaryChildFragment; - return primaryChildFragment; -} - -function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { - var mode = workInProgress.mode; - var currentPrimaryChildFragment = current.child; - var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; - var primaryChildProps = { - mode: 'hidden', - children: primaryChildren - }; - var primaryChildFragment; - - if ( // In legacy mode, we commit the primary tree as if it successfully - // completed, even though it's in an inconsistent state. - (mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was - // already cloned. In legacy mode, the only case where this isn't true is - // when DevTools forces us to display a fallback; we skip the first render - // pass entirely and go straight to rendering the fallback. (In Concurrent - // Mode, SuspenseList can also trigger this scenario, but this is a legacy- - // only codepath.) - workInProgress.child !== currentPrimaryChildFragment) { - var progressedPrimaryFragment = workInProgress.child; - primaryChildFragment = progressedPrimaryFragment; - primaryChildFragment.childLanes = NoLanes; - primaryChildFragment.pendingProps = primaryChildProps; - - if ( workInProgress.mode & ProfileMode) { - // Reset the durations from the first pass so they aren't included in the - // final amounts. This seems counterintuitive, since we're intentionally - // not measuring part of the render phase, but this makes it match what we - // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; - primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; - primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration; - } // The fallback fiber was added as a deletion effect during the first pass. - // However, since we're going to remain on the fallback, we no longer want - // to delete it. So we need to remove it from the list. Deletions are stored - // on the same list as effects. We want to keep the effects from the primary - // tree. So we copy the primary child fragment's effect list, which does not - // include the fallback deletion effect. - - - var progressedLastEffect = primaryChildFragment.lastEffect; - - if (progressedLastEffect !== null) { - workInProgress.firstEffect = primaryChildFragment.firstEffect; - workInProgress.lastEffect = progressedLastEffect; - progressedLastEffect.nextEffect = null; - } else { - // TODO: Reset this somewhere else? Lol legacy mode is so weird. - workInProgress.firstEffect = workInProgress.lastEffect = null; - } - } else { - primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); - } - - var fallbackChildFragment; - - if (currentFallbackChildFragment !== null) { - fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren); - } else { - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already - // mounted but this is a new fiber. - - fallbackChildFragment.flags |= Placement; - } - - fallbackChildFragment.return = workInProgress; - primaryChildFragment.return = workInProgress; - primaryChildFragment.sibling = fallbackChildFragment; - workInProgress.child = primaryChildFragment; - return fallbackChildFragment; -} - -function scheduleWorkOnFiber(fiber, renderLanes) { - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleWorkOnParentPath(fiber.return, renderLanes); -} - -function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) { - // Mark any Suspense boundaries with fallbacks as having work to do. - // If they were previously forced into fallbacks, they may now be able - // to unblock. - var node = firstChild; - - while (node !== null) { - if (node.tag === SuspenseComponent) { - var state = node.memoizedState; - - if (state !== null) { - scheduleWorkOnFiber(node, renderLanes); - } - } else if (node.tag === SuspenseListComponent) { - // If the tail is hidden there might not be an Suspense boundaries - // to schedule work on. In this case we have to schedule it on the - // list itself. - // We don't have to traverse to the children of the list since - // the list will propagate the change when it rerenders. - scheduleWorkOnFiber(node, renderLanes); - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === workInProgress) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === workInProgress) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } -} - -function findLastContentRow(firstChild) { - // This is going to find the last row among these children that is already - // showing content on the screen, as opposed to being in fallback state or - // new. If a row has multiple Suspense boundaries, any of them being in the - // fallback state, counts as the whole row being in a fallback state. - // Note that the "rows" will be workInProgress, but any nested children - // will still be current since we haven't rendered them yet. The mounted - // order may not be the same as the new order. We use the new order. - var row = firstChild; - var lastContentRow = null; - - while (row !== null) { - var currentRow = row.alternate; // New rows can't be content rows. - - if (currentRow !== null && findFirstSuspended(currentRow) === null) { - lastContentRow = row; - } - - row = row.sibling; - } - - return lastContentRow; -} - -function validateRevealOrder(revealOrder) { - { - if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) { - didWarnAboutRevealOrder[revealOrder] = true; - - if (typeof revealOrder === 'string') { - switch (revealOrder.toLowerCase()) { - case 'together': - case 'forwards': - case 'backwards': - { - error('"%s" is not a valid value for revealOrder on . ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); - - break; - } - - case 'forward': - case 'backward': - { - error('"%s" is not a valid value for revealOrder on . ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); - - break; - } - - default: - error('"%s" is not a supported revealOrder on . ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); - - break; - } - } else { - error('%s is not a supported value for revealOrder on . ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); - } - } - } -} - -function validateTailOptions(tailMode, revealOrder) { - { - if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { - if (tailMode !== 'collapsed' && tailMode !== 'hidden') { - didWarnAboutTailOptions[tailMode] = true; - - error('"%s" is not a supported value for tail on . ' + 'Did you mean "collapsed" or "hidden"?', tailMode); - } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') { - didWarnAboutTailOptions[tailMode] = true; - - error(' is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode); - } - } - } -} - -function validateSuspenseListNestedChild(childSlot, index) { - { - var isArray = Array.isArray(childSlot); - var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function'; - - if (isArray || isIterable) { - var type = isArray ? 'array' : 'iterable'; - - error('A nested %s was passed to row #%s in . Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + ' ... ' + '{%s} ... ' + '', type, index, type); - - return false; - } - } - - return true; -} - -function validateSuspenseListChildren(children, revealOrder) { - { - if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - if (!validateSuspenseListNestedChild(children[i], i)) { - return; - } - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - var childrenIterator = iteratorFn.call(children); - - if (childrenIterator) { - var step = childrenIterator.next(); - var _i = 0; - - for (; !step.done; step = childrenIterator.next()) { - if (!validateSuspenseListNestedChild(step.value, _i)) { - return; - } - - _i++; - } - } - } else { - error('A single row was passed to a . ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder); - } - } - } - } -} - -function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) { - var renderState = workInProgress.memoizedState; - - if (renderState === null) { - workInProgress.memoizedState = { - isBackwards: isBackwards, - rendering: null, - renderingStartTime: 0, - last: lastContentRow, - tail: tail, - tailMode: tailMode, - lastEffect: lastEffectBeforeRendering - }; - } else { - // We can reuse the existing object from previous renders. - renderState.isBackwards = isBackwards; - renderState.rendering = null; - renderState.renderingStartTime = 0; - renderState.last = lastContentRow; - renderState.tail = tail; - renderState.tailMode = tailMode; - renderState.lastEffect = lastEffectBeforeRendering; - } -} // This can end up rendering this component multiple passes. -// The first pass splits the children fibers into two sets. A head and tail. -// We first render the head. If anything is in fallback state, we do another -// pass through beginWork to rerender all children (including the tail) with -// the force suspend context. If the first render didn't have anything in -// in fallback state. Then we render each row in the tail one-by-one. -// That happens in the completeWork phase without going back to beginWork. - - -function updateSuspenseListComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; - var revealOrder = nextProps.revealOrder; - var tailMode = nextProps.tail; - var newChildren = nextProps.children; - validateRevealOrder(revealOrder); - validateTailOptions(tailMode, revealOrder); - validateSuspenseListChildren(newChildren, revealOrder); - reconcileChildren(current, workInProgress, newChildren, renderLanes); - var suspenseContext = suspenseStackCursor.current; - var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); - - if (shouldForceFallback) { - suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); - workInProgress.flags |= DidCapture; - } else { - var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags; - - if (didSuspendBefore) { - // If we previously forced a fallback, we need to schedule work - // on any nested boundaries to let them know to try to render - // again. This is the same as context updating. - propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes); - } - - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - } - - pushSuspenseContext(workInProgress, suspenseContext); - - if ((workInProgress.mode & BlockingMode) === NoMode) { - // In legacy mode, SuspenseList doesn't work so we just - // use make it a noop by treating it as the default revealOrder. - workInProgress.memoizedState = null; - } else { - switch (revealOrder) { - case 'forwards': - { - var lastContentRow = findLastContentRow(workInProgress.child); - var tail; - - if (lastContentRow === null) { - // The whole list is part of the tail. - // TODO: We could fast path by just rendering the tail now. - tail = workInProgress.child; - workInProgress.child = null; - } else { - // Disconnect the tail rows after the content row. - // We're going to render them separately later. - tail = lastContentRow.sibling; - lastContentRow.sibling = null; - } - - initSuspenseListRenderState(workInProgress, false, // isBackwards - tail, lastContentRow, tailMode, workInProgress.lastEffect); - break; - } - - case 'backwards': - { - // We're going to find the first row that has existing content. - // At the same time we're going to reverse the list of everything - // we pass in the meantime. That's going to be our tail in reverse - // order. - var _tail = null; - var row = workInProgress.child; - workInProgress.child = null; - - while (row !== null) { - var currentRow = row.alternate; // New rows can't be content rows. - - if (currentRow !== null && findFirstSuspended(currentRow) === null) { - // This is the beginning of the main content. - workInProgress.child = row; - break; - } - - var nextRow = row.sibling; - row.sibling = _tail; - _tail = row; - row = nextRow; - } // TODO: If workInProgress.child is null, we can continue on the tail immediately. - - - initSuspenseListRenderState(workInProgress, true, // isBackwards - _tail, null, // last - tailMode, workInProgress.lastEffect); - break; - } - - case 'together': - { - initSuspenseListRenderState(workInProgress, false, // isBackwards - null, // tail - null, // last - undefined, workInProgress.lastEffect); - break; - } - - default: - { - // The default reveal order is the same as not having - // a boundary. - workInProgress.memoizedState = null; - } - } - } - - return workInProgress.child; -} - -function updatePortalComponent(current, workInProgress, renderLanes) { - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - var nextChildren = workInProgress.pendingProps; - - if (current === null) { - // Portals are special because we don't append the children during mount - // but at commit. Therefore we need to track insertions which the normal - // flow doesn't do during mount. This doesn't happen at the root because - // the root always starts with a "current" with a null child. - // TODO: Consider unifying this with how the root works. - workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); - } else { - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } - - return workInProgress.child; -} - -var hasWarnedAboutUsingNoValuePropOnContextProvider = false; - -function updateContextProvider(current, workInProgress, renderLanes) { - var providerType = workInProgress.type; - var context = providerType._context; - var newProps = workInProgress.pendingProps; - var oldProps = workInProgress.memoizedProps; - var newValue = newProps.value; - - { - if (!('value' in newProps)) { - if (!hasWarnedAboutUsingNoValuePropOnContextProvider) { - hasWarnedAboutUsingNoValuePropOnContextProvider = true; - - error('The `value` prop is required for the ``. Did you misspell it or forget to pass it?'); - } - } - - var providerPropTypes = workInProgress.type.propTypes; - - if (providerPropTypes) { - checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider'); - } - } - - pushProvider(workInProgress, newValue); - - if (oldProps !== null) { - var oldValue = oldProps.value; - var changedBits = calculateChangedBits(context, newValue, oldValue); - - if (changedBits === 0) { - // No change. Bailout early if children are the same. - if (oldProps.children === newProps.children && !hasContextChanged()) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - } else { - // The context value changed. Search for matching consumers and schedule - // them to update. - propagateContextChange(workInProgress, context, changedBits, renderLanes); - } - } - - var newChildren = newProps.children; - reconcileChildren(current, workInProgress, newChildren, renderLanes); - return workInProgress.child; -} - -var hasWarnedAboutUsingContextAsConsumer = false; - -function updateContextConsumer(current, workInProgress, renderLanes) { - var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In - // DEV mode, we create a separate object for Context.Consumer that acts - // like a proxy to Context. This proxy object adds unnecessary code in PROD - // so we use the old behaviour (Context.Consumer references Context) to - // reduce size and overhead. The separate object references context via - // a property called "_context", which also gives us the ability to check - // in DEV mode if this property exists or not and warn if it does not. - - { - if (context._context === undefined) { - // This may be because it's a Context (rather than a Consumer). - // Or it may be because it's older React where they're the same thing. - // We only want to warn if we're sure it's a new React. - if (context !== context.Consumer) { - if (!hasWarnedAboutUsingContextAsConsumer) { - hasWarnedAboutUsingContextAsConsumer = true; - - error('Rendering directly is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - } - } else { - context = context._context; - } - } - - var newProps = workInProgress.pendingProps; - var render = newProps.children; - - { - if (typeof render !== 'function') { - error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); - } - } - - prepareToReadContext(workInProgress, renderLanes); - var newValue = readContext(context, newProps.unstable_observedBits); - var newChildren; - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - newChildren = render(newValue); - setIsRendering(false); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, newChildren, renderLanes); - return workInProgress.child; -} - -function markWorkInProgressReceivedUpdate() { - didReceiveUpdate = true; -} - -function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { - if (current !== null) { - // Reuse previous dependencies - workInProgress.dependencies = current.dependencies; - } - - { - // Don't update "base" render times for bailouts. - stopProfilerTimerIfRunning(); - } - - markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work. - - if (!includesSomeLane(renderLanes, workInProgress.childLanes)) { - // The children don't have any work either. We can skip them. - // TODO: Once we add back resuming, we should check if the children are - // a work-in-progress set. If so, we need to transfer their effects. - return null; - } else { - // This fiber doesn't have work, but its subtree does. Clone the child - // fibers and continue. - cloneChildFibers(current, workInProgress); - return workInProgress.child; - } -} - -function remountFiber(current, oldWorkInProgress, newWorkInProgress) { - { - var returnFiber = oldWorkInProgress.return; - - if (returnFiber === null) { - throw new Error('Cannot swap the root fiber.'); - } // Disconnect from the old current. - // It will get deleted. - - - current.alternate = null; - oldWorkInProgress.alternate = null; // Connect to the new tree. - - newWorkInProgress.index = oldWorkInProgress.index; - newWorkInProgress.sibling = oldWorkInProgress.sibling; - newWorkInProgress.return = oldWorkInProgress.return; - newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. - - if (oldWorkInProgress === returnFiber.child) { - returnFiber.child = newWorkInProgress; - } else { - var prevSibling = returnFiber.child; - - if (prevSibling === null) { - throw new Error('Expected parent to have a child.'); - } - - while (prevSibling.sibling !== oldWorkInProgress) { - prevSibling = prevSibling.sibling; - - if (prevSibling === null) { - throw new Error('Expected to find the previous sibling.'); - } - } - - prevSibling.sibling = newWorkInProgress; - } // Delete the old fiber and place the new one. - // Since the old fiber is disconnected, we have to schedule it manually. - - - var last = returnFiber.lastEffect; - - if (last !== null) { - last.nextEffect = current; - returnFiber.lastEffect = current; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = current; - } - - current.nextEffect = null; - current.flags = Deletion; - newWorkInProgress.flags |= Placement; // Restart work from the new fiber. - - return newWorkInProgress; - } -} - -function beginWork(current, workInProgress, renderLanes) { - var updateLanes = workInProgress.lanes; - - { - if (workInProgress._debugNeedsRemount && current !== null) { - // This will restart the begin phase with a new fiber. - return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); - } - } - - if (current !== null) { - var oldProps = current.memoizedProps; - var newProps = workInProgress.pendingProps; - - if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: - workInProgress.type !== current.type )) { - // If props or context changed, mark the fiber as having performed work. - // This may be unset if the props are determined to be equal later (memo). - didReceiveUpdate = true; - } else if (!includesSomeLane(renderLanes, updateLanes)) { - didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering - // the begin phase. There's still some bookkeeping we that needs to be done - // in this optimized path, mostly pushing stuff onto the stack. - - switch (workInProgress.tag) { - case HostRoot: - pushHostRootContext(workInProgress); - break; - - case HostComponent: - pushHostContext(workInProgress); - break; - - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - pushContextProvider(workInProgress); - } - - break; - } - - case HostPortal: - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - break; - - case ContextProvider: - { - var newValue = workInProgress.memoizedProps.value; - pushProvider(workInProgress, newValue); - break; - } - - case Profiler: - { - // Profiler should only call onRender when one of its descendants actually rendered. - var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); - - if (hasChildWork) { - workInProgress.flags |= Update; - } // Reset effect durations for the next eventual effect phase. - // These are reset during render to allow the DevTools commit hook a chance to read them, - - - var stateNode = workInProgress.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - } - - break; - - case SuspenseComponent: - { - var state = workInProgress.memoizedState; - - if (state !== null) { - // whether to retry the primary children, or to skip over it and - // go straight to the fallback. Check the priority of the primary - // child fragment. - - - var primaryChildFragment = workInProgress.child; - var primaryChildLanes = primaryChildFragment.childLanes; - - if (includesSomeLane(renderLanes, primaryChildLanes)) { - // The primary children have pending work. Use the normal path - // to attempt to render the primary children again. - return updateSuspenseComponent(current, workInProgress, renderLanes); - } else { - // The primary child fragment does not have pending work marked - // on it - pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient - // priority. Bailout. - - var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - - if (child !== null) { - // The fallback children have pending work. Skip over the - // primary children and work on the fallback. - return child.sibling; - } else { - return null; - } - } - } else { - pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); - } - - break; - } - - case SuspenseListComponent: - { - var didSuspendBefore = (current.flags & DidCapture) !== NoFlags; - - var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); - - if (didSuspendBefore) { - if (_hasChildWork) { - // If something was in fallback state last time, and we have all the - // same children then we're still in progressive loading state. - // Something might get unblocked by state updates or retries in the - // tree which will affect the tail. So we need to use the normal - // path to compute the correct tail. - return updateSuspenseListComponent(current, workInProgress, renderLanes); - } // If none of the children had any work, that means that none of - // them got retried so they'll still be blocked in the same way - // as before. We can fast bail out. - - - workInProgress.flags |= DidCapture; - } // If nothing suspended before and we're rendering the same children, - // then the tail doesn't matter. Anything new that suspends will work - // in the "together" mode, so we can continue from the state we had. - - - var renderState = workInProgress.memoizedState; - - if (renderState !== null) { - // Reset to the "together" mode in case we've started a different - // update in the past but didn't complete it. - renderState.rendering = null; - renderState.tail = null; - renderState.lastEffect = null; - } - - pushSuspenseContext(workInProgress, suspenseStackCursor.current); - - if (_hasChildWork) { - break; - } else { - // If none of the children had any work, that means that none of - // them got retried so they'll still be blocked in the same way - // as before. We can fast bail out. - return null; - } - } - - case OffscreenComponent: - case LegacyHiddenComponent: - { - // Need to check if the tree still needs to be deferred. This is - // almost identical to the logic used in the normal update path, - // so we'll just enter that. The only difference is we'll bail out - // at the next level instead of this one, because the child props - // have not changed. Which is fine. - // TODO: Probably should refactor `beginWork` to split the bailout - // path from the normal path. I'm tempted to do a labeled break here - // but I won't :) - workInProgress.lanes = NoLanes; - return updateOffscreenComponent(current, workInProgress, renderLanes); - } - } - - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } else { - if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { - // This is a special case that only exists for legacy mode. - // See https://github.com/facebook/react/pull/19216. - didReceiveUpdate = true; - } else { - // An update was scheduled on this fiber, but there are no new props - // nor legacy context. Set this to false. If an update queue or context - // consumer produces a changed value, it will set this to true. Otherwise, - // the component will assume the children have not changed and bail out. - didReceiveUpdate = false; - } - } - } else { - didReceiveUpdate = false; - } // Before entering the begin phase, clear pending update priority. - // TODO: This assumes that we're about to evaluate the component and process - // the update queue. However, there's an exception: SimpleMemoComponent - // sometimes bails out later in the begin phase. This indicates that we should - // move this assignment out of the common path and into each branch. - - - workInProgress.lanes = NoLanes; - - switch (workInProgress.tag) { - case IndeterminateComponent: - { - return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes); - } - - case LazyComponent: - { - var elementType = workInProgress.elementType; - return mountLazyComponent(current, workInProgress, elementType, updateLanes, renderLanes); - } - - case FunctionComponent: - { - var _Component = workInProgress.type; - var unresolvedProps = workInProgress.pendingProps; - var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps); - return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderLanes); - } - - case ClassComponent: - { - var _Component2 = workInProgress.type; - var _unresolvedProps = workInProgress.pendingProps; - - var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps); - - return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderLanes); - } - - case HostRoot: - return updateHostRoot(current, workInProgress, renderLanes); - - case HostComponent: - return updateHostComponent(current, workInProgress, renderLanes); - - case HostText: - return updateHostText(); - - case SuspenseComponent: - return updateSuspenseComponent(current, workInProgress, renderLanes); - - case HostPortal: - return updatePortalComponent(current, workInProgress, renderLanes); - - case ForwardRef: - { - var type = workInProgress.type; - var _unresolvedProps2 = workInProgress.pendingProps; - - var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); - - return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes); - } - - case Fragment: - return updateFragment(current, workInProgress, renderLanes); - - case Mode: - return updateMode(current, workInProgress, renderLanes); - - case Profiler: - return updateProfiler(current, workInProgress, renderLanes); - - case ContextProvider: - return updateContextProvider(current, workInProgress, renderLanes); - - case ContextConsumer: - return updateContextConsumer(current, workInProgress, renderLanes); - - case MemoComponent: - { - var _type2 = workInProgress.type; - var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. - - var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); - - { - if (workInProgress.type !== workInProgress.elementType) { - var outerPropTypes = _type2.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only - 'prop', getComponentName(_type2)); - } - } - } - - _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); - return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateLanes, renderLanes); - } - - case SimpleMemoComponent: - { - return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateLanes, renderLanes); - } - - case IncompleteClassComponent: - { - var _Component3 = workInProgress.type; - var _unresolvedProps4 = workInProgress.pendingProps; - - var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4); - - return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderLanes); - } - - case SuspenseListComponent: - { - return updateSuspenseListComponent(current, workInProgress, renderLanes); - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case Block: - { - - break; - } - - case OffscreenComponent: - { - return updateOffscreenComponent(current, workInProgress, renderLanes); - } - - case LegacyHiddenComponent: - { - return updateLegacyHiddenComponent(current, workInProgress, renderLanes); - } - } - - { - { - throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function markUpdate(workInProgress) { - // Tag the fiber with an update effect. This turns a Placement into - // a PlacementAndUpdate. - workInProgress.flags |= Update; -} - -function markRef$1(workInProgress) { - workInProgress.flags |= Ref; -} - -var appendAllChildren; -var updateHostContainer; -var updateHostComponent$1; -var updateHostText$1; - -{ - // Mutation mode - appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) { - // We only have the top Fiber that was created but we need recurse down its - // children to find all the terminal nodes. - var node = workInProgress.child; - - while (node !== null) { - if (node.tag === HostComponent || node.tag === HostText) { - appendInitialChild(parent, node.stateNode); - } else if (node.tag === HostPortal) ; else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === workInProgress) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === workInProgress) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - }; - - updateHostContainer = function (workInProgress) {// Noop - }; - - updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) { - // If we have an alternate, that means this is an update and we need to - // schedule a side-effect to do the updates. - var oldProps = current.memoizedProps; - - if (oldProps === newProps) { - // In mutation mode, this is sufficient for a bailout because - // we won't touch this node even if children changed. - return; - } // If we get updated because one of our children updated, we don't - // have newProps so we'll have to reuse them. - // TODO: Split the update API as separate for the props vs. children. - // Even better would be if children weren't special cased at all tho. - - - var instance = workInProgress.stateNode; - var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host - // component is hitting the resume path. Figure out why. Possibly - // related to `hidden`. - - var updatePayload = prepareUpdate(); // TODO: Type this specific to this type of component. - - workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there - // is a new ref we mark this as an update. All the work is done in commitWork. - - if (updatePayload) { - markUpdate(workInProgress); - } - }; - - updateHostText$1 = function (current, workInProgress, oldText, newText) { - // If the text differs, mark it as an update. All the work in done in commitWork. - if (oldText !== newText) { - markUpdate(workInProgress); - } - }; -} - -function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - - switch (renderState.tailMode) { - case 'hidden': - { - // Any insertions at the end of the tail list after this point - // should be invisible. If there are already mounted boundaries - // anything before them are not considered for collapsing. - // Therefore we need to go through the whole tail to find if - // there are any. - var tailNode = renderState.tail; - var lastTailNode = null; - - while (tailNode !== null) { - if (tailNode.alternate !== null) { - lastTailNode = tailNode; - } - - tailNode = tailNode.sibling; - } // Next we're simply going to delete all insertions after the - // last rendered item. - - - if (lastTailNode === null) { - // All remaining items in the tail are insertions. - renderState.tail = null; - } else { - // Detach the insertion after the last node that was already - // inserted. - lastTailNode.sibling = null; - } - - break; - } - - case 'collapsed': - { - // Any insertions at the end of the tail list after this point - // should be invisible. If there are already mounted boundaries - // anything before them are not considered for collapsing. - // Therefore we need to go through the whole tail to find if - // there are any. - var _tailNode = renderState.tail; - var _lastTailNode = null; - - while (_tailNode !== null) { - if (_tailNode.alternate !== null) { - _lastTailNode = _tailNode; - } - - _tailNode = _tailNode.sibling; - } // Next we're simply going to delete all insertions after the - // last rendered item. - - - if (_lastTailNode === null) { - // All remaining items in the tail are insertions. - if (!hasRenderedATailFallback && renderState.tail !== null) { - // We suspended during the head. We want to show at least one - // row at the tail. So we'll keep on and cut off the rest. - renderState.tail.sibling = null; - } else { - renderState.tail = null; - } - } else { - // Detach the insertion after the last node that was already - // inserted. - _lastTailNode.sibling = null; - } - - break; - } - } -} - -function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - - switch (workInProgress.tag) { - case IndeterminateComponent: - case LazyComponent: - case SimpleMemoComponent: - case FunctionComponent: - case ForwardRef: - case Fragment: - case Mode: - case Profiler: - case ContextConsumer: - case MemoComponent: - return null; - - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - popContext(workInProgress); - } - - return null; - } - - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - resetWorkInProgressVersions(); - var fiberRoot = workInProgress.stateNode; - - if (fiberRoot.pendingContext) { - fiberRoot.context = fiberRoot.pendingContext; - fiberRoot.pendingContext = null; - } - - if (current === null || current.child === null) { - // If we hydrated, pop so that we can delete any remaining children - // that weren't hydrated. - var wasHydrated = popHydrationState(); - - if (wasHydrated) { - // If we hydrated, then we'll need to schedule an update for - // the commit side-effects on the root. - markUpdate(workInProgress); - } else if (!fiberRoot.hydrate) { - // Schedule an effect to clear this container at the start of the next commit. - // This handles the case of React rendering into a container with previous children. - // It's also safe to do for updates too, because current.child would only be null - // if the previous render was null (so the the container would already be empty). - workInProgress.flags |= Snapshot; - } - } - - updateHostContainer(workInProgress); - return null; - } - - case HostComponent: - { - popHostContext(workInProgress); - var rootContainerInstance = getRootHostContainer(); - var type = workInProgress.type; - - if (current !== null && workInProgress.stateNode != null) { - updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); - - if (current.ref !== workInProgress.ref) { - markRef$1(workInProgress); - } - } else { - if (!newProps) { - if (!(workInProgress.stateNode !== null)) { - { - throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); - } - } // This can happen when we abort work. - - - return null; - } - - var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context - // "stack" as the parent. Then append children as we go in beginWork - // or completeWork depending on whether we want to add them top->down or - // bottom->up. Top->down is faster in IE11. - - var _wasHydrated = popHydrationState(); - - if (_wasHydrated) { - // TODO: Move this and createInstance step into the beginPhase - // to consolidate. - if (prepareToHydrateHostInstance()) { - // If changes to the hydrated node need to be applied at the - // commit-phase we mark this as such. - markUpdate(workInProgress); - } - } else { - var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); - appendAllChildren(instance, workInProgress, false, false); - workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount. - } - - if (workInProgress.ref !== null) { - // If there is a ref on a host node we need to schedule a callback - markRef$1(workInProgress); - } - } - - return null; - } - - case HostText: - { - var newText = newProps; - - if (current && workInProgress.stateNode != null) { - var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need - // to schedule a side-effect to do the updates. - - updateHostText$1(current, workInProgress, oldText, newText); - } else { - if (typeof newText !== 'string') { - if (!(workInProgress.stateNode !== null)) { - { - throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); - } - } // This can happen when we abort work. - - } - - var _rootContainerInstance = getRootHostContainer(); - - var _currentHostContext = getHostContext(); - - var _wasHydrated2 = popHydrationState(); - - if (_wasHydrated2) { - if (prepareToHydrateHostTextInstance()) { - markUpdate(workInProgress); - } - } else { - workInProgress.stateNode = createTextInstance(newText); - } - } - - return null; - } - - case SuspenseComponent: - { - popSuspenseContext(workInProgress); - var nextState = workInProgress.memoizedState; - - if ((workInProgress.flags & DidCapture) !== NoFlags) { - // Something suspended. Re-render with the fallback children. - workInProgress.lanes = renderLanes; // Do not reset the effect list. - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - var nextDidTimeout = nextState !== null; - var prevDidTimeout = false; - - if (current === null) { - if (workInProgress.memoizedProps.fallback !== undefined) ; - } else { - var prevState = current.memoizedState; - prevDidTimeout = prevState !== null; - } - - if (nextDidTimeout && !prevDidTimeout) { - // If this subtreee is running in blocking mode we can suspend, - // otherwise we won't suspend. - // TODO: This will still suspend a synchronous tree if anything - // in the concurrent tree already suspended during this render. - // This is a known bug. - if ((workInProgress.mode & BlockingMode) !== NoMode) { - // TODO: Move this back to throwException because this is too late - // if this is a large tree which is common for initial loads. We - // don't know if we should restart a render or not until we get - // this marker, and this is too late. - // If this render already had a ping or lower pri updates, - // and this is the first time we know we're going to suspend we - // should be able to immediately restart from within throwException. - var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true; - - if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) { - // If this was in an invisible tree or a new render, then showing - // this boundary is ok. - renderDidSuspend(); - } else { - // Otherwise, we're going to have to hide content so we should - // suspend for longer if possible. - renderDidSuspendDelayIfPossible(); - } - } - } - - { - // TODO: Only schedule updates if these values are non equal, i.e. it changed. - if (nextDidTimeout || prevDidTimeout) { - // If this boundary just timed out, schedule an effect to attach a - // retry listener to the promise. This flag is also used to hide the - // primary children. In mutation mode, we also need the flag to - // *unhide* children that were previously hidden, so check if this - // is currently timed out, too. - workInProgress.flags |= Update; - } - } - - return null; - } - - case HostPortal: - popHostContainer(workInProgress); - updateHostContainer(workInProgress); - - if (current === null) { - preparePortalMount(workInProgress.stateNode.containerInfo); - } - - return null; - - case ContextProvider: - // Pop provider fiber - popProvider(workInProgress); - return null; - - case IncompleteClassComponent: - { - // Same as class component case. I put it down here so that the tags are - // sequential to ensure this switch is compiled to a jump table. - var _Component = workInProgress.type; - - if (isContextProvider(_Component)) { - popContext(workInProgress); - } - - return null; - } - - case SuspenseListComponent: - { - popSuspenseContext(workInProgress); - var renderState = workInProgress.memoizedState; - - if (renderState === null) { - // We're running in the default, "independent" mode. - // We don't do anything in this mode. - return null; - } - - var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags; - var renderedTail = renderState.rendering; - - if (renderedTail === null) { - // We just rendered the head. - if (!didSuspendAlready) { - // This is the first pass. We need to figure out if anything is still - // suspended in the rendered set. - // If new content unsuspended, but there's still some content that - // didn't. Then we need to do a second pass that forces everything - // to keep showing their fallbacks. - // We might be suspended if something in this render pass suspended, or - // something in the previous committed pass suspended. Otherwise, - // there's no chance so we can skip the expensive call to - // findFirstSuspended. - var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags); - - if (!cannotBeSuspended) { - var row = workInProgress.child; - - while (row !== null) { - var suspended = findFirstSuspended(row); - - if (suspended !== null) { - didSuspendAlready = true; - workInProgress.flags |= DidCapture; - cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as - // part of the second pass. In that case nothing will subscribe to - // its thennables. Instead, we'll transfer its thennables to the - // SuspenseList so that it can retry if they resolve. - // There might be multiple of these in the list but since we're - // going to wait for all of them anyway, it doesn't really matter - // which ones gets to ping. In theory we could get clever and keep - // track of how many dependencies remain but it gets tricky because - // in the meantime, we can add/remove/change items and dependencies. - // We might bail out of the loop before finding any but that - // doesn't matter since that means that the other boundaries that - // we did find already has their listeners attached. - - var newThennables = suspended.updateQueue; - - if (newThennables !== null) { - workInProgress.updateQueue = newThennables; - workInProgress.flags |= Update; - } // Rerender the whole list, but this time, we'll force fallbacks - // to stay in place. - // Reset the effect list before doing the second pass since that's now invalid. - - - if (renderState.lastEffect === null) { - workInProgress.firstEffect = null; - } - - workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state. - - resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately - // rerender the children. - - pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); - return workInProgress.child; - } - - row = row.sibling; - } - } - - if (renderState.tail !== null && now() > getRenderTargetTime()) { - // We have already passed our CPU deadline but we still have rows - // left in the tail. We'll just give up further attempts to render - // the main content and only render fallbacks. - workInProgress.flags |= DidCapture; - didSuspendAlready = true; - cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this - // to get it started back up to attempt the next item. While in terms - // of priority this work has the same priority as this current render, - // it's not part of the same transition once the transition has - // committed. If it's sync, we still want to yield so that it can be - // painted. Conceptually, this is really the same as pinging. - // We can use any RetryLane even if it's the one currently rendering - // since we're leaving it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - } - } else { - cutOffTailIfNeeded(renderState, false); - } // Next we're going to render the tail. - - } else { - // Append the rendered row to the child list. - if (!didSuspendAlready) { - var _suspended = findFirstSuspended(renderedTail); - - if (_suspended !== null) { - workInProgress.flags |= DidCapture; - didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't - // get lost if this row ends up dropped during a second pass. - - var _newThennables = _suspended.updateQueue; - - if (_newThennables !== null) { - workInProgress.updateQueue = _newThennables; - workInProgress.flags |= Update; - } - - cutOffTailIfNeeded(renderState, true); // This might have been modified. - - if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating. - ) { - // We need to delete the row we just rendered. - // Reset the effect list to what it was before we rendered this - // child. The nested children have already appended themselves. - var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point. - - if (lastEffect !== null) { - lastEffect.nextEffect = null; - } // We're done. - - - return null; - } - } else if ( // The time it took to render last row is greater than the remaining - // time we have to render. So rendering one more row would likely - // exceed it. - now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) { - // We have now passed our CPU deadline and we'll just give up further - // attempts to render the main content and only render fallbacks. - // The assumption is that this is usually faster. - workInProgress.flags |= DidCapture; - didSuspendAlready = true; - cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this - // to get it started back up to attempt the next item. While in terms - // of priority this work has the same priority as this current render, - // it's not part of the same transition once the transition has - // committed. If it's sync, we still want to yield so that it can be - // painted. Conceptually, this is really the same as pinging. - // We can use any RetryLane even if it's the one currently rendering - // since we're leaving it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - } - } - - if (renderState.isBackwards) { - // The effect list of the backwards tail will have been added - // to the end. This breaks the guarantee that life-cycles fire in - // sibling order but that isn't a strong guarantee promised by React. - // Especially since these might also just pop in during future commits. - // Append to the beginning of the list. - renderedTail.sibling = workInProgress.child; - workInProgress.child = renderedTail; - } else { - var previousSibling = renderState.last; - - if (previousSibling !== null) { - previousSibling.sibling = renderedTail; - } else { - workInProgress.child = renderedTail; - } - - renderState.last = renderedTail; - } - } - - if (renderState.tail !== null) { - // We still have tail rows to render. - // Pop a row. - var next = renderState.tail; - renderState.rendering = next; - renderState.tail = next.sibling; - renderState.lastEffect = workInProgress.lastEffect; - renderState.renderingStartTime = now(); - next.sibling = null; // Restore the context. - // TODO: We can probably just avoid popping it instead and only - // setting it the first time we go from not suspended to suspended. - - var suspenseContext = suspenseStackCursor.current; - - if (didSuspendAlready) { - suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); - } else { - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - } - - pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. - - return next; - } - - return null; - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case Block: - - break; - - case OffscreenComponent: - case LegacyHiddenComponent: - { - popRenderLanes(workInProgress); - - if (current !== null) { - var _nextState = workInProgress.memoizedState; - var _prevState = current.memoizedState; - var prevIsHidden = _prevState !== null; - var nextIsHidden = _nextState !== null; - - if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') { - workInProgress.flags |= Update; - } - } - - return null; - } - } - - { - { - throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function unwindWork(workInProgress, renderLanes) { - switch (workInProgress.tag) { - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - popContext(workInProgress); - } - - var flags = workInProgress.flags; - - if (flags & ShouldCapture) { - workInProgress.flags = flags & ~ShouldCapture | DidCapture; - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - return null; - } - - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - resetWorkInProgressVersions(); - var _flags = workInProgress.flags; - - if (!((_flags & DidCapture) === NoFlags)) { - { - throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - } - } - - workInProgress.flags = _flags & ~ShouldCapture | DidCapture; - return workInProgress; - } - - case HostComponent: - { - // TODO: popHydrationState - popHostContext(workInProgress); - return null; - } - - case SuspenseComponent: - { - popSuspenseContext(workInProgress); - - var _flags2 = workInProgress.flags; - - if (_flags2 & ShouldCapture) { - workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - return null; - } - - case SuspenseListComponent: - { - popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been - // caught by a nested boundary. If not, it should bubble through. - - return null; - } - - case HostPortal: - popHostContainer(workInProgress); - return null; - - case ContextProvider: - popProvider(workInProgress); - return null; - - case OffscreenComponent: - case LegacyHiddenComponent: - popRenderLanes(workInProgress); - return null; - - default: - return null; - } -} - -function unwindInterruptedWork(interruptedWork) { - switch (interruptedWork.tag) { - case ClassComponent: - { - var childContextTypes = interruptedWork.type.childContextTypes; - - if (childContextTypes !== null && childContextTypes !== undefined) { - popContext(interruptedWork); - } - - break; - } - - case HostRoot: - { - popHostContainer(interruptedWork); - popTopLevelContextObject(interruptedWork); - resetWorkInProgressVersions(); - break; - } - - case HostComponent: - { - popHostContext(interruptedWork); - break; - } - - case HostPortal: - popHostContainer(interruptedWork); - break; - - case SuspenseComponent: - popSuspenseContext(interruptedWork); - break; - - case SuspenseListComponent: - popSuspenseContext(interruptedWork); - break; - - case ContextProvider: - popProvider(interruptedWork); - break; - - case OffscreenComponent: - case LegacyHiddenComponent: - popRenderLanes(interruptedWork); - break; - } -} - -function createCapturedValue(value, source) { - // If the value is an error, call this function immediately after it is thrown - // so the stack is accurate. - return { - value: value, - source: source, - stack: getStackByFiberInDevAndProd(source) - }; -} - -// This module is forked in different environments. -// By default, return `true` to log errors to the console. -// Forks can return `false` if this isn't desirable. -function showErrorDialog(boundary, errorInfo) { - return true; -} - -function logCapturedError(boundary, errorInfo) { - try { - var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. - // This enables renderers like ReactNative to better manage redbox behavior. - - if (logError === false) { - return; - } - - var error = errorInfo.value; - - if (true) { - var source = errorInfo.source; - var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (boundary.tag === ClassComponent) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - - - console['error'](error); // Don't transform to our wrapper - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 - } - - var componentName = source ? getComponentName(source.type) : null; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; - var errorBoundaryMessage; - var errorBoundaryName = getComponentName(boundary.type); - - if (errorBoundaryName) { - errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); - } else { - errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.'; - } - - var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - - console['error'](combinedMessage); // Don't transform to our wrapper - } else { - // In production, we print the error directly. - // This will include the message, the JS stack, and anything the browser wants to show. - // We pass the error object instead of custom message so that the browser displays the error natively. - console['error'](error); // Don't transform to our wrapper - } - } catch (e) { - // This method must not throw, or React internal state will get messed up. - // If console.error is overridden, or logCapturedError() shows a dialog that throws, - // we want to report this error outside of the normal stack as a last resort. - // https://github.com/facebook/react/issues/13188 - setTimeout(function () { - throw e; - }); - } -} - -var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - -function createRootErrorUpdate(fiber, errorInfo, lane) { - var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null. - - update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property - // being called "element". - - update.payload = { - element: null - }; - var error = errorInfo.value; - - update.callback = function () { - onUncaughtError(error); - logCapturedError(fiber, errorInfo); - }; - - return update; -} - -function createClassErrorUpdate(fiber, errorInfo, lane) { - var update = createUpdate(NoTimestamp, lane); - update.tag = CaptureUpdate; - var getDerivedStateFromError = fiber.type.getDerivedStateFromError; - - if (typeof getDerivedStateFromError === 'function') { - var error$1 = errorInfo.value; - - update.payload = function () { - logCapturedError(fiber, errorInfo); - return getDerivedStateFromError(error$1); - }; - } - - var inst = fiber.stateNode; - - if (inst !== null && typeof inst.componentDidCatch === 'function') { - update.callback = function callback() { - { - markFailedErrorBoundaryForHotReloading(fiber); - } - - if (typeof getDerivedStateFromError !== 'function') { - // To preserve the preexisting retry behavior of error boundaries, - // we keep track of which ones already failed during this batch. - // This gets reset before we yield back to the browser. - // TODO: Warn in strict mode if getDerivedStateFromError is - // not defined. - markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined - - logCapturedError(fiber, errorInfo); - } - - var error$1 = errorInfo.value; - var stack = errorInfo.stack; - this.componentDidCatch(error$1, { - componentStack: stack !== null ? stack : '' - }); - - { - if (typeof getDerivedStateFromError !== 'function') { - // If componentDidCatch is the only error boundary method defined, - // then it needs to call setState to recover from errors. - // If no state update is scheduled then the boundary will swallow the error. - if (!includesSomeLane(fiber.lanes, SyncLane)) { - error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown'); - } - } - } - }; - } else { - update.callback = function () { - markFailedErrorBoundaryForHotReloading(fiber); - }; - } - - return update; -} - -function attachPingListener(root, wakeable, lanes) { - // Attach a listener to the promise to "ping" the root and retry. But only if - // one does not already exist for the lanes we're currently rendering (which - // acts like a "thread ID" here). - var pingCache = root.pingCache; - var threadIDs; - - if (pingCache === null) { - pingCache = root.pingCache = new PossiblyWeakMap$1(); - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else { - threadIDs = pingCache.get(wakeable); - - if (threadIDs === undefined) { - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } - } - - if (!threadIDs.has(lanes)) { - // Memoize using the thread ID to prevent redundant listeners. - threadIDs.add(lanes); - var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); - wakeable.then(ping, ping); - } -} - -function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { - // The source fiber did not complete. - sourceFiber.flags |= Incomplete; // Its effect list is no longer valid. - - sourceFiber.firstEffect = sourceFiber.lastEffect = null; - - if (value !== null && typeof value === 'object' && typeof value.then === 'function') { - // This is a wakeable. - var wakeable = value; - - if ((sourceFiber.mode & BlockingMode) === NoMode) { - // Reset the memoizedState to what it was before we attempted - // to render it. - var currentSource = sourceFiber.alternate; - - if (currentSource) { - sourceFiber.updateQueue = currentSource.updateQueue; - sourceFiber.memoizedState = currentSource.memoizedState; - sourceFiber.lanes = currentSource.lanes; - } else { - sourceFiber.updateQueue = null; - sourceFiber.memoizedState = null; - } - } - - var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view. - - var _workInProgress = returnFiber; - - do { - if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) { - // Found the nearest boundary. - // Stash the promise on the boundary fiber. If the boundary times out, we'll - // attach another listener to flip the boundary back to its normal state. - var wakeables = _workInProgress.updateQueue; - - if (wakeables === null) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - _workInProgress.updateQueue = updateQueue; - } else { - wakeables.add(wakeable); - } // If the boundary is outside of blocking mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. In the commit phase, we'll schedule a - // subsequent synchronous update to re-render the Suspense. - // - // Note: It doesn't matter whether the component that suspended was - // inside a blocking mode tree. If the Suspense is outside of it, we - // should *not* suspend the commit. - - - if ((_workInProgress.mode & BlockingMode) === NoMode) { - _workInProgress.flags |= DidCapture; - sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. - // But we shouldn't call any lifecycle methods or callbacks. Remove - // all lifecycle effect tags. - - sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); - - if (sourceFiber.tag === ClassComponent) { - var currentSourceFiber = sourceFiber.alternate; - - if (currentSourceFiber === null) { - // This is a new mount. Change the tag so it's not mistaken for a - // completed class component. For example, we should not call - // componentWillUnmount if it is deleted. - sourceFiber.tag = IncompleteClassComponent; - } else { - // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force update to - // prevent a bail out. - var update = createUpdate(NoTimestamp, SyncLane); - update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); - } - } // The source fiber did not complete. Mark it with Sync priority to - // indicate that it still has pending work. - - - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending. - - return; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. - - - attachPingListener(root, wakeable, rootRenderLanes); - _workInProgress.flags |= ShouldCapture; - _workInProgress.lanes = rootRenderLanes; - return; - } // This boundary already captured during this render. Continue to the next - // boundary. - - - _workInProgress = _workInProgress.return; - } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. - // TODO: Use invariant so the message is stripped in prod? - - - value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a component higher in the tree to ' + 'provide a loading indicator or placeholder to display.'); - } // We didn't find a boundary that could handle this type of exception. Start - // over and traverse parent path again, this time treating the exception - // as an error. - - - renderDidError(); - value = createCapturedValue(value, sourceFiber); - var workInProgress = returnFiber; - - do { - switch (workInProgress.tag) { - case HostRoot: - { - var _errorInfo = value; - workInProgress.flags |= ShouldCapture; - var lane = pickArbitraryLane(rootRenderLanes); - workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); - - var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); - - enqueueCapturedUpdate(workInProgress, _update); - return; - } - - case ClassComponent: - // Capture and retry - var errorInfo = value; - var ctor = workInProgress.type; - var instance = workInProgress.stateNode; - - if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) { - workInProgress.flags |= ShouldCapture; - - var _lane = pickArbitraryLane(rootRenderLanes); - - workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state - - var _update2 = createClassErrorUpdate(workInProgress, errorInfo, _lane); - - enqueueCapturedUpdate(workInProgress, _update2); - return; - } - - break; - } - - workInProgress = workInProgress.return; - } while (workInProgress !== null); -} - -function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } -} - -var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; - -{ - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); - - invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - if (!(typeof document !== 'undefined')) { - { - throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); - } - } - - var evt = document.createEvent('Event'); - var didCall = false; // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); - - function restoreAfterDispatch() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { - window.event = windowEvent; - } - } // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - function callCallback() { - didCall = true; - restoreAfterDispatch(); - func.apply(context, funcArgs); - didError = false; - } // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - function handleWindowError(event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === 'object') { - try { - error._suppressLogging = true; - } catch (inner) {// Ignore. - } - } - } - } // Create a fake event type. - - - var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers - - window.addEventListener('error', handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, 'event', windowEventDescriptor); - } - - if (didCall && didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://reactjs.org/link/crossorigin-error for more information.'); - } - - this.onError(error); - } // Remove our event listeners - - - window.removeEventListener('error', handleWindowError); - - if (!didCall) { - // Something went really wrong, and our event was not dispatched. - // https://github.com/facebook/react/issues/16734 - // https://github.com/facebook/react/issues/16585 - // Fall back to the production implementation. - restoreAfterDispatch(); - return invokeGuardedCallbackProd.apply(this, arguments); - } - }; - } -} - -var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - -var hasError = false; -var caughtError = null; // Used by event system to capture/rethrow the first error. -var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } -}; -/** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl$1.apply(reporter, arguments); -} -function hasCaughtError() { - return hasError; -} -function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - { - { - throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } -} - -var didWarnAboutUndefinedSnapshotBeforeUpdate = null; - -{ - didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); -} - -var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set; - -var callComponentWillUnmountWithTimer = function (current, instance) { - instance.props = current.memoizedProps; - instance.state = current.memoizedState; - - { - instance.componentWillUnmount(); - } -}; // Capture errors so they don't interrupt unmounting. - - -function safelyCallComponentWillUnmount(current, instance) { - { - invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance); - - if (hasCaughtError()) { - var unmountError = clearCaughtError(); - captureCommitPhaseError(current, unmountError); - } - } -} - -function safelyDetachRef(current) { - var ref = current.ref; - - if (ref !== null) { - if (typeof ref === 'function') { - { - invokeGuardedCallback(null, ref, null, null); - - if (hasCaughtError()) { - var refError = clearCaughtError(); - captureCommitPhaseError(current, refError); - } - } - } else { - ref.current = null; - } - } -} - -function safelyCallDestroy(current, destroy) { - { - invokeGuardedCallback(null, destroy, null); - - if (hasCaughtError()) { - var error = clearCaughtError(); - captureCommitPhaseError(current, error); - } - } -} - -function commitBeforeMutationLifeCycles(current, finishedWork) { - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - case Block: - { - return; - } - - case ClassComponent: - { - if (finishedWork.flags & Snapshot) { - if (current !== null) { - var prevProps = current.memoizedProps; - var prevState = current.memoizedState; - var instance = finishedWork.stateNode; // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); - - { - var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; - - if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { - didWarnSet.add(finishedWork.type); - - error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type)); - } - } - - instance.__reactInternalSnapshotBeforeUpdate = snapshot; - } - } - - return; - } - - case HostRoot: - { - { - if (finishedWork.flags & Snapshot) { - var root = finishedWork.stateNode; - clearContainer(root.containerInfo); - } - } - - return; - } - - case HostComponent: - case HostText: - case HostPortal: - case IncompleteClassComponent: - // Nothing to do for these component types - return; - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function commitHookEffectListUnmount(tag, finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - if ((effect.tag & tag) === tag) { - // Unmount - var destroy = effect.destroy; - effect.destroy = undefined; - - if (destroy !== undefined) { - destroy(); - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } -} - -function commitHookEffectListMount(tag, finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - if ((effect.tag & tag) === tag) { - // Mount - var create = effect.create; - effect.destroy = create(); - - { - var destroy = effect.destroy; - - if (destroy !== undefined && typeof destroy !== 'function') { - var addendum = void 0; - - if (destroy === null) { - addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; - } else if (typeof destroy.then === 'function') { - addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching'; - } else { - addendum = ' You returned: ' + destroy; - } - - error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s', addendum); - } - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } -} - -function schedulePassiveEffects(finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - var _effect = effect, - next = _effect.next, - tag = _effect.tag; - - if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) { - enqueuePendingPassiveHookEffectUnmount(finishedWork, effect); - enqueuePendingPassiveHookEffectMount(finishedWork, effect); - } - - effect = next; - } while (effect !== firstEffect); - } -} - -function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) { - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - case Block: - { - // At this point layout effects have already been destroyed (during mutation phase). - // This is done to prevent sibling component effects from interfering with each other, - // e.g. a destroy function in one component should never override a ref set - // by a create function in another component during the same commit. - { - commitHookEffectListMount(Layout | HasEffect, finishedWork); - } - - schedulePassiveEffects(finishedWork); - return; - } - - case ClassComponent: - { - var instance = finishedWork.stateNode; - - if (finishedWork.flags & Update) { - if (current === null) { - // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - { - instance.componentDidMount(); - } - } else { - var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); - var prevState = current.memoizedState; // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - { - instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); - } - } - } // TODO: I think this is now always non-null by the time it reaches the - // commit phase. Consider removing the type check. - - - var updateQueue = finishedWork.updateQueue; - - if (updateQueue !== null) { - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - - commitUpdateQueue(finishedWork, updateQueue, instance); - } - - return; - } - - case HostRoot: - { - // TODO: I think this is now always non-null by the time it reaches the - // commit phase. Consider removing the type check. - var _updateQueue = finishedWork.updateQueue; - - if (_updateQueue !== null) { - var _instance = null; - - if (finishedWork.child !== null) { - switch (finishedWork.child.tag) { - case HostComponent: - _instance = getPublicInstance(finishedWork.child.stateNode); - break; - - case ClassComponent: - _instance = finishedWork.child.stateNode; - break; - } - } - - commitUpdateQueue(finishedWork, _updateQueue, _instance); - } - - return; - } - - case HostComponent: - { - var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted - // (eg DOM renderer may schedule auto-focus for inputs and form controls). - // These effects should only be committed when components are first mounted, - // aka when there is no current/alternate. - - if (current === null && finishedWork.flags & Update) { - var type = finishedWork.type; - var props = finishedWork.memoizedProps; - } - - return; - } - - case HostText: - { - // We have no life-cycles associated with text. - return; - } - - case HostPortal: - { - // We have no life-cycles associated with portals. - return; - } - - case Profiler: - { - { - var _finishedWork$memoize2 = finishedWork.memoizedProps, - onCommit = _finishedWork$memoize2.onCommit, - onRender = _finishedWork$memoize2.onRender; - var effectDuration = finishedWork.stateNode.effectDuration; - var commitTime = getCommitTime(); - - if (typeof onRender === 'function') { - { - onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime, finishedRoot.memoizedInteractions); - } - } - } - - return; - } - - case SuspenseComponent: - { - return; - } - - case SuspenseListComponent: - case IncompleteClassComponent: - case FundamentalComponent: - case ScopeComponent: - case OffscreenComponent: - case LegacyHiddenComponent: - return; - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function hideOrUnhideAllChildren(finishedWork, isHidden) { - { - // We only have the top Fiber that was inserted but we need to recurse down its - // children to find all the terminal nodes. - var node = finishedWork; - - while (true) { - if (node.tag === HostComponent) { - var instance = node.stateNode; - - if (isHidden) { - hideInstance(instance); - } else { - unhideInstance(node.stateNode, node.memoizedProps); - } - } else if (node.tag === HostText) { - var _instance3 = node.stateNode; - - if (isHidden) { - hideTextInstance(_instance3); - } else { - unhideTextInstance(_instance3, node.memoizedProps); - } - } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === finishedWork) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === finishedWork) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } -} - -function commitAttachRef(finishedWork) { - var ref = finishedWork.ref; - - if (ref !== null) { - var instance = finishedWork.stateNode; - var instanceToUse; - - switch (finishedWork.tag) { - case HostComponent: - instanceToUse = getPublicInstance(instance); - break; - - default: - instanceToUse = instance; - } // Moved outside to ensure DCE works with this flag - - if (typeof ref === 'function') { - ref(instanceToUse); - } else { - { - if (!ref.hasOwnProperty('current')) { - error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentName(finishedWork.type)); - } - } - - ref.current = instanceToUse; - } - } -} - -function commitDetachRef(current) { - var currentRef = current.ref; - - if (currentRef !== null) { - if (typeof currentRef === 'function') { - currentRef(null); - } else { - currentRef.current = null; - } - } -} // User-originating errors (lifecycles and refs) should not interrupt -// deletion, so don't let them throw. Host-originating errors should -// interrupt deletion, so it's okay - - -function commitUnmount(finishedRoot, current, renderPriorityLevel) { - onCommitUnmount(current); - - switch (current.tag) { - case FunctionComponent: - case ForwardRef: - case MemoComponent: - case SimpleMemoComponent: - case Block: - { - var updateQueue = current.updateQueue; - - if (updateQueue !== null) { - var lastEffect = updateQueue.lastEffect; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - var _effect2 = effect, - destroy = _effect2.destroy, - tag = _effect2.tag; - - if (destroy !== undefined) { - if ((tag & Passive$1) !== NoFlags$1) { - enqueuePendingPassiveHookEffectUnmount(current, effect); - } else { - { - safelyCallDestroy(current, destroy); - } - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } - } - - return; - } - - case ClassComponent: - { - safelyDetachRef(current); - var instance = current.stateNode; - - if (typeof instance.componentWillUnmount === 'function') { - safelyCallComponentWillUnmount(current, instance); - } - - return; - } - - case HostComponent: - { - safelyDetachRef(current); - return; - } - - case HostPortal: - { - // TODO: this is recursive. - // We are also not using this parent because - // the portal will get pushed immediately. - { - unmountHostComponents(finishedRoot, current); - } - - return; - } - - case FundamentalComponent: - { - - return; - } - - case DehydratedFragment: - { - - return; - } - - case ScopeComponent: - { - - return; - } - } -} - -function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) { - // While we're inside a removed host node we don't want to call - // removeChild on the inner nodes because they're removed by the top - // call anyway. We also want to call componentWillUnmount on all - // composites before this host node is removed from the tree. Therefore - // we do an inner loop while we're still inside the host node. - var node = root; - - while (true) { - commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes. - // Skip portals because commitUnmount() currently visits them recursively. - - if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above. - // If we don't use mutation we drill down into portals here instead. - node.tag !== HostPortal)) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === root) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === root) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } -} - -function detachFiberMutation(fiber) { - // Cut off the return pointers to disconnect it from the tree. Ideally, we - // should clear the child pointer of the parent alternate to let this - // get GC:ed but we don't know which for sure which parent is the current - // one so we'll settle for GC:ing the subtree of this child. This child - // itself will be GC:ed when the parent updates the next time. - // Note: we cannot null out sibling here, otherwise it can cause issues - // with findDOMNode and how it requires the sibling field to carry out - // traversal in a later effect. See PR #16820. We now clear the sibling - // field after effects, see: detachFiberAfterEffects. - // - // Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects. - // It may be required if the current component is an error boundary, - // and one of its descendants throws while unmounting a passive effect. - fiber.alternate = null; - fiber.child = null; - fiber.dependencies = null; - fiber.firstEffect = null; - fiber.lastEffect = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.return = null; - fiber.updateQueue = null; - - { - fiber._debugOwner = null; - } -} - -function getHostParentFiber(fiber) { - var parent = fiber.return; - - while (parent !== null) { - if (isHostParent(parent)) { - return parent; - } - - parent = parent.return; - } - - { - { - throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function isHostParent(fiber) { - return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; -} - -function getHostSibling(fiber) { - // We're going to search forward into the tree until we find a sibling host - // node. Unfortunately, if multiple insertions are done in a row we have to - // search past them. This leads to exponential search for the next sibling. - // TODO: Find a more efficient way to do this. - var node = fiber; - - siblings: while (true) { - // If we didn't find anything, let's try the next sibling. - while (node.sibling === null) { - if (node.return === null || isHostParent(node.return)) { - // If we pop out of the root or hit the parent the fiber we are the - // last sibling. - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - - while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { - // If it is not host node and, we might have a host node inside it. - // Try to search down until we find one. - if (node.flags & Placement) { - // If we don't have a child, try the siblings instead. - continue siblings; - } // If we don't have a child, try the siblings instead. - // We also skip portals because they are not part of this host tree. - - - if (node.child === null || node.tag === HostPortal) { - continue siblings; - } else { - node.child.return = node; - node = node.child; - } - } // Check if this host node is stable or about to be placed. - - - if (!(node.flags & Placement)) { - // Found it! - return node.stateNode; - } - } -} - -function commitPlacement(finishedWork) { - - - var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. - - var parent; - var isContainer; - var parentStateNode = parentFiber.stateNode; - - switch (parentFiber.tag) { - case HostComponent: - parent = parentStateNode; - isContainer = false; - break; - - case HostRoot: - parent = parentStateNode.containerInfo; - isContainer = true; - break; - - case HostPortal: - parent = parentStateNode.containerInfo; - isContainer = true; - break; - - case FundamentalComponent: - - // eslint-disable-next-line-no-fallthrough - - default: - { - { - throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - } - - if (parentFiber.flags & ContentReset) { - - parentFiber.flags &= ~ContentReset; - } - - var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its - // children to find all the terminal nodes. - - if (isContainer) { - insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent); - } else { - insertOrAppendPlacementNode(finishedWork, before, parent); - } -} - -function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - var isHost = tag === HostComponent || tag === HostText; - - if (isHost || enableFundamentalAPI ) { - var stateNode = isHost ? node.stateNode : node.stateNode.instance; - - if (before) { - insertInContainerBefore(parent, stateNode, before); - } else { - appendChildToContainer(parent, stateNode); - } - } else if (tag === HostPortal) ; else { - var child = node.child; - - if (child !== null) { - insertOrAppendPlacementNodeIntoContainer(child, before, parent); - var sibling = child.sibling; - - while (sibling !== null) { - insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); - sibling = sibling.sibling; - } - } - } -} - -function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - var isHost = tag === HostComponent || tag === HostText; - - if (isHost || enableFundamentalAPI ) { - var stateNode = isHost ? node.stateNode : node.stateNode.instance; - - if (before) { - insertBefore(parent, stateNode, before); - } else { - appendChild(parent, stateNode); - } - } else if (tag === HostPortal) ; else { - var child = node.child; - - if (child !== null) { - insertOrAppendPlacementNode(child, before, parent); - var sibling = child.sibling; - - while (sibling !== null) { - insertOrAppendPlacementNode(sibling, before, parent); - sibling = sibling.sibling; - } - } - } -} - -function unmountHostComponents(finishedRoot, current, renderPriorityLevel) { - // We only have the top Fiber that was deleted but we need to recurse down its - // children to find all the terminal nodes. - var node = current; // Each iteration, currentParent is populated with node's host parent if not - // currentParentIsValid. - - var currentParentIsValid = false; // Note: these two variables *must* always be updated together. - - var currentParent; - var currentParentIsContainer; - - while (true) { - if (!currentParentIsValid) { - var parent = node.return; - - findParent: while (true) { - if (!(parent !== null)) { - { - throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var parentStateNode = parent.stateNode; - - switch (parent.tag) { - case HostComponent: - currentParent = parentStateNode; - currentParentIsContainer = false; - break findParent; - - case HostRoot: - currentParent = parentStateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - - case HostPortal: - currentParent = parentStateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - - } - - parent = parent.return; - } - - currentParentIsValid = true; - } - - if (node.tag === HostComponent || node.tag === HostText) { - commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the - // node from the tree. - - if (currentParentIsContainer) { - removeChildFromContainer(currentParent, node.stateNode); - } else { - removeChild(currentParent, node.stateNode); - } // Don't visit children because we already visited them. - - } else if (node.tag === HostPortal) { - if (node.child !== null) { - // When we go into a portal, it becomes the parent to remove from. - // We will reassign it back when we pop the portal on the way up. - currentParent = node.stateNode.containerInfo; - currentParentIsContainer = true; // Visit children because portals might contain host components. - - node.child.return = node; - node = node.child; - continue; - } - } else { - commitUnmount(finishedRoot, node); // Visit children because we may find more host components below. - - if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - } - - if (node === current) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === current) { - return; - } - - node = node.return; - - if (node.tag === HostPortal) { - // When we go out of the portal, we need to restore the parent. - // Since we don't keep a stack of them, we will search for it. - currentParentIsValid = false; - } - } - - node.sibling.return = node.return; - node = node.sibling; - } -} - -function commitDeletion(finishedRoot, current, renderPriorityLevel) { - { - // Recursively delete all host nodes from the parent. - // Detach refs and call componentWillUnmount() on the whole subtree. - unmountHostComponents(finishedRoot, current); - } - - var alternate = current.alternate; - detachFiberMutation(current); - - if (alternate !== null) { - detachFiberMutation(alternate); - } -} - -function commitWork(current, finishedWork) { - - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case MemoComponent: - case SimpleMemoComponent: - case Block: - { - // Layout effects are destroyed during the mutation phase so that all - // destroy functions for all fibers are called before any create functions. - // This prevents sibling component effects from interfering with each other, - // e.g. a destroy function in one component should never override a ref set - // by a create function in another component during the same commit. - { - commitHookEffectListUnmount(Layout | HasEffect, finishedWork); - } - - return; - } - - case ClassComponent: - { - return; - } - - case HostComponent: - { - var instance = finishedWork.stateNode; - - if (instance != null) { - // Commit the work prepared earlier. - var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - - var oldProps = current !== null ? current.memoizedProps : newProps; - var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. - - var updatePayload = finishedWork.updateQueue; - finishedWork.updateQueue = null; - - if (updatePayload !== null) { - commitUpdate(instance, updatePayload, type, oldProps, newProps); - } - } - - return; - } - - case HostText: - { - if (!(finishedWork.stateNode !== null)) { - { - throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var textInstance = finishedWork.stateNode; - var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - - var oldText = current !== null ? current.memoizedProps : newText; - commitTextUpdate(textInstance, oldText, newText); - return; - } - - case HostRoot: - { - - return; - } - - case Profiler: - { - return; - } - - case SuspenseComponent: - { - commitSuspenseComponent(finishedWork); - attachSuspenseRetryListeners(finishedWork); - return; - } - - case SuspenseListComponent: - { - attachSuspenseRetryListeners(finishedWork); - return; - } - - case IncompleteClassComponent: - { - return; - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case OffscreenComponent: - case LegacyHiddenComponent: - { - var newState = finishedWork.memoizedState; - var isHidden = newState !== null; - hideOrUnhideAllChildren(finishedWork, isHidden); - return; - } - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } -} - -function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState; - - if (newState !== null) { - markCommitTimeOfFallback(); - - { - // Hide the Offscreen component that contains the primary children. TODO: - // Ideally, this effect would have been scheduled on the Offscreen fiber - // itself. That's how unhiding works: the Offscreen component schedules an - // effect on itself. However, in this case, the component didn't complete, - // so the fiber was never added to the effect list in the normal path. We - // could have appended it to the effect list in the Suspense component's - // second pass, but doing it this way is less complicated. This would be - // simpler if we got rid of the effect list and traversed the tree, like - // we're planning to do. - var primaryChildParent = finishedWork.child; - hideOrUnhideAllChildren(primaryChildParent, true); - } - } -} - -function attachSuspenseRetryListeners(finishedWork) { - // If this boundary just timed out, then it will have a set of wakeables. - // For each wakeable, attach a listener so that when it resolves, React - // attempts to re-render the boundary in the primary (pre-timeout) state. - var wakeables = finishedWork.updateQueue; - - if (wakeables !== null) { - finishedWork.updateQueue = null; - var retryCache = finishedWork.stateNode; - - if (retryCache === null) { - retryCache = finishedWork.stateNode = new PossiblyWeakSet(); - } - - wakeables.forEach(function (wakeable) { - // Memoize using the boundary fiber to prevent redundant listeners. - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - - if (!retryCache.has(wakeable)) { - { - if (wakeable.__reactDoNotTraceInteractions !== true) { - retry = tracing.unstable_wrap(retry); - } - } - - retryCache.add(wakeable); - wakeable.then(retry, retry); - } - }); - } -} // This function detects when a Suspense boundary goes from visible to hidden. -// It returns false if the boundary is already hidden. -// TODO: Use an effect tag. - - -function isSuspenseBoundaryBeingHidden(current, finishedWork) { - if (current !== null) { - var oldState = current.memoizedState; - - if (oldState === null || oldState.dehydrated !== null) { - var newState = finishedWork.memoizedState; - return newState !== null && newState.dehydrated === null; - } - } - - return false; -} - -function commitResetTextContent(current) { - - resetTextContent(current.stateNode); -} - -var COMPONENT_TYPE = 0; -var HAS_PSEUDO_CLASS_TYPE = 1; -var ROLE_TYPE = 2; -var TEST_NAME_TYPE = 3; -var TEXT_TYPE = 4; - -if (typeof Symbol === 'function' && Symbol.for) { - var symbolFor$1 = Symbol.for; - COMPONENT_TYPE = symbolFor$1('selector.component'); - HAS_PSEUDO_CLASS_TYPE = symbolFor$1('selector.has_pseudo_class'); - ROLE_TYPE = symbolFor$1('selector.role'); - TEST_NAME_TYPE = symbolFor$1('selector.test_id'); - TEXT_TYPE = symbolFor$1('selector.text'); -} - -var didWarnAboutMessageChannel = false; -var enqueueTaskImpl = null; -function enqueueTask(task) { - if (enqueueTaskImpl === null) { - try { - // read require off the module object to get around the bundlers. - // we don't want them to detect a require and bundle a Node polyfill. - var requireString = ('require' + Math.random()).slice(0, 7); - var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's - // version of setImmediate, bypassing fake timers if any. - - enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; - } catch (_err) { - // we're in a browser - // we can't use regular timers because they may still be faked - // so we try MessageChannel+postMessage instead - enqueueTaskImpl = function (callback) { - { - if (didWarnAboutMessageChannel === false) { - didWarnAboutMessageChannel = true; - - if (typeof MessageChannel === 'undefined') { - error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); - } - } - } - - var channel = new MessageChannel(); - channel.port1.onmessage = callback; - channel.port2.postMessage(undefined); - }; - } - } - - return enqueueTaskImpl(task); -} - -var ceil = Math.ceil; -var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; -var NoContext = -/* */ -0; -var BatchedContext = -/* */ -1; -var DiscreteEventContext = -/* */ -4; -var LegacyUnbatchedContext = -/* */ -8; -var RenderContext = -/* */ -16; -var CommitContext = -/* */ -32; -var RetryAfterError = -/* */ -64; -var RootIncomplete = 0; -var RootFatalErrored = 1; -var RootErrored = 2; -var RootSuspended = 3; -var RootSuspendedWithDelay = 4; -var RootCompleted = 5; // Describes where we are in the React execution stack - -var executionContext = NoContext; // The root we're working on - -var workInProgressRoot = null; // The fiber we're working on - -var workInProgress = null; // The lanes we're rendering - -var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree -// This is a superset of the lanes we started working on at the root. The only -// case where it's different from `workInProgressRootRenderLanes` is when we -// enter a subtree that is hidden and needs to be unhidden: Suspense and -// Offscreen component. -// -// Most things in the work loop should deal with workInProgressRootRenderLanes. -// Most things in begin/complete phases should deal with subtreeRenderLanes. - -var subtreeRenderLanes = NoLanes; -var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. - -var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown - -var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's -// slightly different than `renderLanes` because `renderLanes` can change as you -// enter and exit an Offscreen tree. This value is the combination of all render -// lanes for the entire render phase. - -var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only -// includes unprocessed updates, not work in bailed out children. - -var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. - -var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. - -var workInProgressRootPingedLanes = NoLanes; -var mostRecentlyUpdatedRoot = null; // The most recent time we committed a fallback. This lets us ensure a train -// model where we don't commit new loading states in too quick succession. - -var globalMostRecentFallbackTime = 0; -var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering -// more and prefer CPU suspense heuristics instead. - -var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU -// suspense heuristics and opt out of rendering more content. - -var RENDER_TIMEOUT_MS = 500; - -function resetRenderTimer() { - workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; -} - -function getRenderTargetTime() { - return workInProgressRootRenderTargetTime; -} -var nextEffect = null; -var hasUncaughtError = false; -var firstUncaughtError = null; -var legacyErrorBoundariesThatAlreadyFailed = null; -var rootDoesHavePassiveEffects = false; -var rootWithPendingPassiveEffects = null; -var pendingPassiveEffectsRenderPriority = NoPriority$1; -var pendingPassiveEffectsLanes = NoLanes; -var pendingPassiveHookEffectsMount = []; -var pendingPassiveHookEffectsUnmount = []; -var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates - -var NESTED_UPDATE_LIMIT = 50; -var nestedUpdateCount = 0; -var rootWithNestedUpdates = null; -var NESTED_PASSIVE_UPDATE_LIMIT = 50; -var nestedPassiveUpdateCount = 0; // Marks the need to reschedule pending interactions at these lanes -// during the commit phase. This enables them to be traced across components -// that spawn new work during render. E.g. hidden boundaries, suspended SSR -// hydration or SuspenseList. -// TODO: Can use a bitmask instead of an array - -var spawnedWorkDuringRender = null; // If two updates are scheduled within the same event, we should treat their -// event times as simultaneous, even if the actual clock time has advanced -// between the first and second call. - -var currentEventTime = NoTimestamp; -var currentEventWipLanes = NoLanes; -var currentEventPendingLanes = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed. -// We warn about state updates for unmounted components differently in this case. - -var isFlushingPassiveEffects = false; -var focusedInstanceHandle = null; -var shouldFireAfterActiveInstanceBlur = false; -function getWorkInProgressRoot() { - return workInProgressRoot; -} -function requestEventTime() { - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - // We're inside React, so it's fine to read the actual time. - return now(); - } // We're not inside React, so we may be in the middle of a browser event. - - - if (currentEventTime !== NoTimestamp) { - // Use the same start time for all updates until we enter React again. - return currentEventTime; - } // This is the first update since React yielded. Compute a new start time. - - - currentEventTime = now(); - return currentEventTime; -} -function requestUpdateLane(fiber) { - // Special cases - var mode = fiber.mode; - - if ((mode & BlockingMode) === NoMode) { - return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; - } // The algorithm for assigning an update to a lane should be stable for all - // updates at the same priority within the same event. To do this, the inputs - // to the algorithm must be the same. For example, we use the `renderLanes` - // to avoid choosing a lane that is already in the middle of rendering. - // - // However, the "included" lanes could be mutated in between updates in the - // same event, like if you perform an update inside `flushSync`. Or any other - // code path that might call `prepareFreshStack`. - // - // The trick we use is to cache the first of each of these inputs within an - // event. Then reset the cached values once we can be sure the event is over. - // Our heuristic for that is whenever we enter a concurrent work loop. - // - // We'll do the same for `currentEventPendingLanes` below. - - - if (currentEventWipLanes === NoLanes) { - currentEventWipLanes = workInProgressRootIncludedLanes; - } - - var isTransition = requestCurrentTransition() !== NoTransition; - - if (isTransition) { - if (currentEventPendingLanes !== NoLanes) { - currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes; - } - - return findTransitionLane(currentEventWipLanes, currentEventPendingLanes); - } // TODO: Remove this dependency on the Scheduler priority. - // To do that, we're replacing it with an update lane priority. - - - var schedulerPriority = getCurrentPriorityLevel(); // The old behavior was using the priority level of the Scheduler. - // This couples React to the Scheduler internals, so we're replacing it - // with the currentUpdateLanePriority above. As an example of how this - // could be problematic, if we're not inside `Scheduler.runWithPriority`, - // then we'll get the priority of the current running Scheduler task, - // which is probably not what we want. - - var lane; - - if ( // TODO: Temporary. We're removing the concept of discrete updates. - (executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$1) { - lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes); - } else { - var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority); - - lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes); - } - - return lane; -} - -function requestRetryLane(fiber) { - // This is a fork of `requestUpdateLane` designed specifically for Suspense - // "retries" — a special update that attempts to flip a Suspense boundary - // from its placeholder state to its primary/resolved state. - // Special cases - var mode = fiber.mode; - - if ((mode & BlockingMode) === NoMode) { - return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; - } // See `requestUpdateLane` for explanation of `currentEventWipLanes` - - - if (currentEventWipLanes === NoLanes) { - currentEventWipLanes = workInProgressRootIncludedLanes; - } - - return findRetryLane(currentEventWipLanes); -} - -function scheduleUpdateOnFiber(fiber, lane, eventTime) { - checkForNestedUpdates(); - warnAboutRenderPhaseUpdatesInDEV(fiber); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - - if (root === null) { - warnAboutUpdateOnUnmountedFiberInDEV(fiber); - return null; - } // Mark that the root has a pending update. - - - markRootUpdated(root, lane, eventTime); - - if (root === workInProgressRoot) { - // Received an update to a tree that's in the middle of rendering. Mark - // that there was an interleaved update work on this root. Unless the - // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render - // phase update. In that case, we don't treat render phase updates as if - // they were interleaved, for backwards compat reasons. - { - workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane); - } - - if (workInProgressRootExitStatus === RootSuspendedWithDelay) { - // The root already suspended with a delay, which means this render - // definitely won't finish. Since we have a new update, let's mark it as - // suspended now, right before marking the incoming update. This has the - // effect of interrupting the current render and switching to the update. - // TODO: Make sure this doesn't override pings that happen while we've - // already started rendering. - markRootSuspended$1(root, workInProgressRootRenderLanes); - } - } // TODO: requestUpdateLanePriority also reads the priority. Pass the - // priority as an argument to that function and this one. - - - var priorityLevel = getCurrentPriorityLevel(); - - if (lane === SyncLane) { - if ( // Check if we're inside unbatchedUpdates - (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering - (executionContext & (RenderContext | CommitContext)) === NoContext) { - // Register pending interactions on the root to avoid losing traced interaction data. - schedulePendingInteractions(root, lane); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed - // root inside of batchedUpdates should be synchronous, but layout updates - // should be deferred until the end of the batch. - - performSyncWorkOnRoot(root); - } else { - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, lane); - - if (executionContext === NoContext) { - // Flush the synchronous work now, unless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initiated - // updates, to preserve historical behavior of legacy mode. - resetRenderTimer(); - flushSyncCallbackQueue(); - } - } - } else { - // Schedule a discrete update but only if it's not Sync. - if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered - // discrete, even inside a discrete event. - priorityLevel === UserBlockingPriority$1 || priorityLevel === ImmediatePriority$1)) { - // This is the result of a discrete event. Track the lowest priority - // discrete update per root so we can flush them early, if needed. - if (rootsWithPendingDiscreteUpdates === null) { - rootsWithPendingDiscreteUpdates = new Set([root]); - } else { - rootsWithPendingDiscreteUpdates.add(root); - } - } // Schedule other updates after in case the callback is sync. - - - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, lane); - } // We use this when assigning a lane for a transition inside - // `requestUpdateLane`. We assume it's the same as the root being updated, - // since in the common case of a single root app it probably is. If it's not - // the same root, then it's not a huge deal, we just might batch more stuff - // together more than necessary. - - - mostRecentlyUpdatedRoot = root; -} // This is split into a separate function so we can mark a fiber with pending -// work without treating it as a typical update that originates from an event; -// e.g. retrying a Suspense boundary isn't an update, but it does schedule work -// on a fiber. - -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } - - { - if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } // Walk the parent path to the root and update the child expiration time. - - - var node = sourceFiber; - var parent = sourceFiber.return; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } else { - { - if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } - } - - node = parent; - parent = parent.return; - } - - if (node.tag === HostRoot) { - var root = node.stateNode; - return root; - } else { - return null; - } -} // Use this function to schedule a task for a root. There's only one task per -// root; if a task was already scheduled, we'll check to make sure the priority -// of the existing task is the same as the priority of the next level that the -// root has work on. This function is called on every update, and right before -// exiting a task. - - -function ensureRootIsScheduled(root, currentTime) { - var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as - // expired so we know to work on those next. - - markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. - - var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); // This returns the priority level computed during the `getNextLanes` call. - - var newCallbackPriority = returnNextLanesPriority(); - - if (nextLanes === NoLanes) { - // Special case: There's nothing to work on. - if (existingCallbackNode !== null) { - cancelCallback(existingCallbackNode); - root.callbackNode = null; - root.callbackPriority = NoLanePriority; - } - - return; - } // Check if there's an existing task. We may be able to reuse it. - - - if (existingCallbackNode !== null) { - var existingCallbackPriority = root.callbackPriority; - - if (existingCallbackPriority === newCallbackPriority) { - // The priority hasn't changed. We can reuse the existing task. Exit. - return; - } // The priority changed. Cancel the existing callback. We'll schedule a new - // one below. - - - cancelCallback(existingCallbackNode); - } // Schedule a new callback. - - - var newCallbackNode; - - if (newCallbackPriority === SyncLanePriority) { - // Special case: Sync React callbacks are scheduled on a special - // internal queue - newCallbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback(ImmediatePriority$1, performSyncWorkOnRoot.bind(null, root)); - } else { - var schedulerPriorityLevel = lanePriorityToSchedulerPriority(newCallbackPriority); - newCallbackNode = scheduleCallback(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); - } - - root.callbackPriority = newCallbackPriority; - root.callbackNode = newCallbackNode; -} // This is the entry point for every concurrent task, i.e. anything that -// goes through Scheduler. - - -function performConcurrentWorkOnRoot(root) { - // Since we know we're in a React event, we can clear the current - // event time. The next update will compute a new event time. - currentEventTime = NoTimestamp; - currentEventWipLanes = NoLanes; - currentEventPendingLanes = NoLanes; - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } // Flush any pending passive effects before deciding which lanes to work on, - // in case they schedule additional work. - - - var originalCallbackNode = root.callbackNode; - var didFlushPassiveEffects = flushPassiveEffects(); - - if (didFlushPassiveEffects) { - // Something in the passive effect phase may have canceled the current task. - // Check if the task node for this root was changed. - if (root.callbackNode !== originalCallbackNode) { - // The current task was canceled. Exit. We don't need to call - // `ensureRootIsScheduled` because the check above implies either that - // there's a new task, or that there's no remaining work on this root. - return null; - } - } // Determine the next expiration time to work on, using the fields stored - // on the root. - - - var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); - - if (lanes === NoLanes) { - // Defensive coding. This is never expected to happen. - return null; - } - - var exitStatus = renderRootConcurrent(root, lanes); - - if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) { - // The render included lanes that were updated during the render phase. - // For example, when unhiding a hidden tree, we include all the lanes - // that were previously skipped when the tree was hidden. That set of - // lanes is a superset of the lanes we started rendering with. - // - // So we'll throw out the current work and restart. - prepareFreshStack(root, NoLanes); - } else if (exitStatus !== RootIncomplete) { - if (exitStatus === RootErrored) { - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.hydrate) { - root.hydrate = false; - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render - // synchronously to block concurrent data mutations, and we'll includes - // all pending updates are included. If it still fails after the second - // attempt, we'll give up and commit the resulting tree. - - - lanes = getLanesToRetrySynchronouslyOnError(root); - - if (lanes !== NoLanes) { - exitStatus = renderRootSync(root, lanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } // We now have a consistent tree. The next step is either to commit it, - // or, if something suspended, wait to commit it after a timeout. - - - var finishedWork = root.current.alternate; - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - finishConcurrentRender(root, exitStatus, lanes); - } - - ensureRootIsScheduled(root, now()); - - if (root.callbackNode === originalCallbackNode) { - // The task node scheduled for this root is the same one that's - // currently executed. Need to return a continuation. - return performConcurrentWorkOnRoot.bind(null, root); - } - - return null; -} - -function finishConcurrentRender(root, exitStatus, lanes) { - switch (exitStatus) { - case RootIncomplete: - case RootFatalErrored: - { - { - { - throw Error( "Root did not complete. This is a bug in React." ); - } - } - } - // Flow knows about invariant, so it complains if I add a break - // statement, but eslint doesn't know about invariant, so it complains - // if I do. eslint-disable-next-line no-fallthrough - - case RootErrored: - { - // We should have already attempted to retry this tree. If we reached - // this point, it errored again. Commit it. - commitRoot(root); - break; - } - - case RootSuspended: - { - markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we - // should immediately commit it or wait a bit. - - if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope - !shouldForceFlushFallbacksInDEV()) { - // This render only included retries, no updates. Throttle committing - // retries so that we don't show too many loading states too quickly. - var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. - - if (msUntilTimeout > 10) { - var nextLanes = getNextLanes(root, NoLanes); - - if (nextLanes !== NoLanes) { - // There's additional work on this root. - break; - } - - var suspendedLanes = root.suspendedLanes; - - if (!isSubsetOfLanes(suspendedLanes, lanes)) { - // We should prefer to render the fallback of at the last - // suspended level. Ping the last suspended level to try - // rendering it again. - // FIXME: What if the suspended lanes are Idle? Should not restart. - var eventTime = requestEventTime(); - markRootPinged(root, suspendedLanes); - break; - } // The render is suspended, it hasn't timed out, and there's no - // lower priority work to do. Instead of committing the fallback - // immediately, wait for more data to arrive. - - - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout); - break; - } - } // The work expired. Commit immediately. - - - commitRoot(root); - break; - } - - case RootSuspendedWithDelay: - { - markRootSuspended$1(root, lanes); - - if (includesOnlyTransitions(lanes)) { - // This is a transition, so we should exit without committing a - // placeholder and without scheduling a timeout. Delay indefinitely - // until we receive more data. - break; - } - - if (!shouldForceFlushFallbacksInDEV()) { - // This is not a transition, but we did trigger an avoided state. - // Schedule a placeholder to display after a short delay, using the Just - // Noticeable Difference. - // TODO: Is the JND optimization worth the added complexity? If this is - // the only reason we track the event time, then probably not. - // Consider removing. - var mostRecentEventTime = getMostRecentEventTime(root, lanes); - var eventTimeMs = mostRecentEventTime; - var timeElapsedMs = now() - eventTimeMs; - - var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. - - - if (_msUntilTimeout > 10) { - // Instead of committing the fallback immediately, wait for more data - // to arrive. - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout); - break; - } - } // Commit the placeholder. - - - commitRoot(root); - break; - } - - case RootCompleted: - { - // The work completed. Ready to commit. - commitRoot(root); - break; - } - - default: - { - { - { - throw Error( "Unknown root exit status." ); - } - } - } - } -} - -function markRootSuspended$1(root, suspendedLanes) { - // When suspending, we should always exclude lanes that were pinged or (more - // rarely, since we try to avoid it) updated during the render phase. - // TODO: Lol maybe there's a better way to factor this besides this - // obnoxiously named function :) - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes); - markRootSuspended(root, suspendedLanes); -} // This is the entry point for synchronous tasks that don't go -// through Scheduler - - -function performSyncWorkOnRoot(root) { - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } - - flushPassiveEffects(); - var lanes; - var exitStatus; - - if (root === workInProgressRoot && includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes)) { - // There's a partial tree, and at least one of its lanes has expired. Finish - // rendering it before rendering the rest of the expired work. - lanes = workInProgressRootRenderLanes; - exitStatus = renderRootSync(root, lanes); - - if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) { - // The render included lanes that were updated during the render phase. - // For example, when unhiding a hidden tree, we include all the lanes - // that were previously skipped when the tree was hidden. That set of - // lanes is a superset of the lanes we started rendering with. - // - // Note that this only happens when part of the tree is rendered - // concurrently. If the whole tree is rendered synchronously, then there - // are no interleaved events. - lanes = getNextLanes(root, lanes); - exitStatus = renderRootSync(root, lanes); - } - } else { - lanes = getNextLanes(root, NoLanes); - exitStatus = renderRootSync(root, lanes); - } - - if (root.tag !== LegacyRoot && exitStatus === RootErrored) { - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.hydrate) { - root.hydrate = false; - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render - // synchronously to block concurrent data mutations, and we'll includes - // all pending updates are included. If it still fails after the second - // attempt, we'll give up and commit the resulting tree. - - - lanes = getLanesToRetrySynchronouslyOnError(root); - - if (lanes !== NoLanes) { - exitStatus = renderRootSync(root, lanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } // We now have a consistent tree. Because this is a sync render, we - // will commit it even if something suspended. - - - var finishedWork = root.current.alternate; - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next - // pending level. - - ensureRootIsScheduled(root, now()); - return null; -} - -function batchedUpdates(fn, a) { - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - - try { - return fn(a); - } finally { - executionContext = prevExecutionContext; - - if (executionContext === NoContext) { - // Flush the immediate callbacks that were scheduled during this batch - resetRenderTimer(); - flushSyncCallbackQueue(); - } - } -} -function flushSync(fn, a) { - var prevExecutionContext = executionContext; - - if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) { - { - error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.'); - } - - return fn(a); - } - - executionContext |= BatchedContext; - - { - try { - if (fn) { - return runWithPriority(ImmediatePriority$1, fn.bind(null, a)); - } else { - return undefined; - } - } finally { - executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. - // Note that this will happen even if batchedUpdates is higher up - // the stack. - - flushSyncCallbackQueue(); - } - } -} -function pushRenderLanes(fiber, lanes) { - push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); - subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); - workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); -} -function popRenderLanes(fiber) { - subtreeRenderLanes = subtreeRenderLanesCursor.current; - pop(subtreeRenderLanesCursor, fiber); -} - -function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = NoLanes; - var timeoutHandle = root.timeoutHandle; - - if (timeoutHandle !== noTimeout) { - // The root previous suspended and scheduled a timeout to commit a fallback - // state. Now that we have additional work, cancel the timeout. - root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above - - cancelTimeout(timeoutHandle); - } - - if (workInProgress !== null) { - var interruptedWork = workInProgress.return; - - while (interruptedWork !== null) { - unwindInterruptedWork(interruptedWork); - interruptedWork = interruptedWork.return; - } - } - - workInProgressRoot = root; - workInProgress = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; - workInProgressRootExitStatus = RootIncomplete; - workInProgressRootFatalError = null; - workInProgressRootSkippedLanes = NoLanes; - workInProgressRootUpdatedLanes = NoLanes; - workInProgressRootPingedLanes = NoLanes; - - { - spawnedWorkDuringRender = null; - } - - { - ReactStrictModeWarnings.discardPendingWarnings(); - } -} - -function handleError(root, thrownValue) { - do { - var erroredWork = workInProgress; - - try { - // Reset module-level state that was set during the render phase. - resetContextDependencies(); - resetHooksAfterThrow(); - resetCurrentFiber(); // TODO: I found and added this missing line while investigating a - // separate issue. Write a regression test using string refs. - - ReactCurrentOwner$2.current = null; - - if (erroredWork === null || erroredWork.return === null) { - // Expected to be working on a non-root fiber. This is a fatal error - // because there's no ancestor that can handle it; the root is - // supposed to capture all errors that weren't caught by an error - // boundary. - workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next - // sibling, or the parent if there are no siblings. But since the root - // has no siblings nor a parent, we set it to null. Usually this is - // handled by `completeUnitOfWork` or `unwindWork`, but since we're - // intentionally not calling those, we need set it here. - // TODO: Consider calling `unwindWork` to pop the contexts. - - workInProgress = null; - return; - } - - if (enableProfilerTimer && erroredWork.mode & ProfileMode) { - // Record the time spent rendering before an error was thrown. This - // avoids inaccurate Profiler durations in the case of a - // suspended render. - stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); - } - - throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); - completeUnitOfWork(erroredWork); - } catch (yetAnotherThrownValue) { - // Something in the return path also threw. - thrownValue = yetAnotherThrownValue; - - if (workInProgress === erroredWork && erroredWork !== null) { - // If this boundary has already errored, then we had trouble processing - // the error. Bubble it to the next boundary. - erroredWork = erroredWork.return; - workInProgress = erroredWork; - } else { - erroredWork = workInProgress; - } - - continue; - } // Return to the normal work loop. - - - return; - } while (true); -} - -function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher$2.current; - ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; - - if (prevDispatcher === null) { - // The React isomorphic package does not include a default dispatcher. - // Instead the first renderer will lazily attach one, in order to give - // nicer error messages. - return ContextOnlyDispatcher; - } else { - return prevDispatcher; - } -} - -function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher$2.current = prevDispatcher; -} - -function pushInteractions(root) { - { - var prevInteractions = tracing.__interactionsRef.current; - tracing.__interactionsRef.current = root.memoizedInteractions; - return prevInteractions; - } -} - -function popInteractions(prevInteractions) { - { - tracing.__interactionsRef.current = prevInteractions; - } -} - -function markCommitTimeOfFallback() { - globalMostRecentFallbackTime = now(); -} -function markSkippedUpdateLanes(lane) { - workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); -} -function renderDidSuspend() { - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootSuspended; - } -} -function renderDidSuspendDelayIfPossible() { - if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) { - workInProgressRootExitStatus = RootSuspendedWithDelay; - } // Check if there are updates that we skipped tree that might have unblocked - // this render. - - - if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes))) { - // Mark the current render as suspended so that we switch to working on - // the updates that were skipped. Usually we only suspend at the end of - // the render phase. - // TODO: We should probably always mark the root as suspended immediately - // (inside this function), since by suspending at the end of the render - // phase introduces a potential mistake where we suspend lanes that were - // pinged or updated while we were rendering. - markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); - } -} -function renderDidError() { - if (workInProgressRootExitStatus !== RootCompleted) { - workInProgressRootExitStatus = RootErrored; - } -} // Called during render to determine if anything has suspended. -// Returns false if we're not sure. - -function renderHasNotSuspendedYet() { - // If something errored or completed, we can't really be sure, - // so those are false. - return workInProgressRootExitStatus === RootIncomplete; -} - -function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - prepareFreshStack(root, lanes); - startWorkOnPendingInteractions(root, lanes); - } - - var prevInteractions = pushInteractions(root); - - do { - try { - workLoopSync(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - - { - popInteractions(prevInteractions); - } - - executionContext = prevExecutionContext; - popDispatcher(prevDispatcher); - - if (workInProgress !== null) { - // This is a sync render, so we should have finished the whole tree. - { - { - throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; - return workInProgressRootExitStatus; -} // The work loop is an extremely hot path. Tell Closure not to inline it. - -/** @noinline */ - - -function workLoopSync() { - // Already timed out, so perform work without checking if we need to yield. - while (workInProgress !== null) { - performUnitOfWork(workInProgress); - } -} - -function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - resetRenderTimer(); - prepareFreshStack(root, lanes); - startWorkOnPendingInteractions(root, lanes); - } - - var prevInteractions = pushInteractions(root); - - do { - try { - workLoopConcurrent(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - - { - popInteractions(prevInteractions); - } - - popDispatcher(prevDispatcher); - executionContext = prevExecutionContext; - - - if (workInProgress !== null) { - - return RootIncomplete; - } else { - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; // Return the final exit status. - - return workInProgressRootExitStatus; - } -} -/** @noinline */ - - -function workLoopConcurrent() { - // Perform work until Scheduler asks us to yield - while (workInProgress !== null && !shouldYield()) { - performUnitOfWork(workInProgress); - } -} - -function performUnitOfWork(unitOfWork) { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); - var next; - - if ( (unitOfWork.mode & ProfileMode) !== NoMode) { - startProfilerTimer(unitOfWork); - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } else { - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - } - - resetCurrentFiber(); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } - - ReactCurrentOwner$2.current = null; -} - -function completeUnitOfWork(unitOfWork) { - // Attempt to complete the current unit of work, then move to the next - // sibling. If there are no more siblings, return to the parent fiber. - var completedWork = unitOfWork; - - do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags) { - setCurrentFiber(completedWork); - var next = void 0; - - if ( (completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, subtreeRenderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; - return; - } - - resetChildLanes(completedWork); - - if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete - (returnFiber.flags & Incomplete) === NoFlags) { - // Append all the effects of the subtree and this fiber onto the effect - // list of the parent. The completion order of the children affects the - // side-effect order. - if (returnFiber.firstEffect === null) { - returnFiber.firstEffect = completedWork.firstEffect; - } - - if (completedWork.lastEffect !== null) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = completedWork.firstEffect; - } - - returnFiber.lastEffect = completedWork.lastEffect; - } // If this fiber had side-effects, we append it AFTER the children's - // side-effects. We can perform certain side-effects earlier if needed, - // by doing multiple passes over the effect list. We don't want to - // schedule our own side-effect on our own list because if end up - // reusing children we'll schedule this effect onto itself since we're - // at the end. - - - var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect - // list. PerformedWork effect is read by React DevTools but shouldn't be - // committed. - - if (flags > PerformedWork) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = completedWork; - } else { - returnFiber.firstEffect = completedWork; - } - - returnFiber.lastEffect = completedWork; - } - } - } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(completedWork); // Because this fiber did not complete, don't reset its expiration time. - - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; - } - - if ( (completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. - - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; - - while (child !== null) { - actualDuration += child.actualDuration; - child = child.sibling; - } - - completedWork.actualDuration = actualDuration; - } - - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its effect list. - returnFiber.firstEffect = returnFiber.lastEffect = null; - returnFiber.flags |= Incomplete; - } - } - - var siblingFiber = completedWork.sibling; - - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - workInProgress = siblingFiber; - return; - } // Otherwise, return to the parent - - - completedWork = returnFiber; // Update the next thing we're working on in case something throws. - - workInProgress = completedWork; - } while (completedWork !== null); // We've reached the root. - - - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootCompleted; - } -} - -function resetChildLanes(completedWork) { - if ( // TODO: Move this check out of the hot path by moving `resetChildLanes` - // to switch statement in `completeWork`. - (completedWork.tag === LegacyHiddenComponent || completedWork.tag === OffscreenComponent) && completedWork.memoizedState !== null && !includesSomeLane(subtreeRenderLanes, OffscreenLane) && (completedWork.mode & ConcurrentMode) !== NoLanes) { - // The children of this component are hidden. Don't bubble their - // expiration times. - return; - } - - var newChildLanes = NoLanes; // Bubble up the earliest expiration time. - - if ( (completedWork.mode & ProfileMode) !== NoMode) { - // In profiling mode, resetChildExpirationTime is also used to reset - // profiler durations. - var actualDuration = completedWork.actualDuration; - var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will - // only be updated if work is done on the fiber (i.e. it doesn't bailout). - // When work is done, it should bubble to the parent's actualDuration. If - // the fiber has not been cloned though, (meaning no work was done), then - // this value will reflect the amount of time spent working on a previous - // render. In that case it should not bubble. We determine whether it was - // cloned by comparing the child pointer. - - var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child; - var child = completedWork.child; - - while (child !== null) { - newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes)); - - if (shouldBubbleActualDurations) { - actualDuration += child.actualDuration; - } - - treeBaseDuration += child.treeBaseDuration; - child = child.sibling; - } - - var isTimedOutSuspense = completedWork.tag === SuspenseComponent && completedWork.memoizedState !== null; - - if (isTimedOutSuspense) { - // Don't count time spent in a timed out Suspense subtree as part of the base duration. - var primaryChildFragment = completedWork.child; - - if (primaryChildFragment !== null) { - treeBaseDuration -= primaryChildFragment.treeBaseDuration; - } - } - - completedWork.actualDuration = actualDuration; - completedWork.treeBaseDuration = treeBaseDuration; - } else { - var _child = completedWork.child; - - while (_child !== null) { - newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes)); - _child = _child.sibling; - } - } - - completedWork.childLanes = newChildLanes; -} - -function commitRoot(root) { - var renderPriorityLevel = getCurrentPriorityLevel(); - runWithPriority(ImmediatePriority$1, commitRootImpl.bind(null, root, renderPriorityLevel)); - return null; -} - -function commitRootImpl(root, renderPriorityLevel) { - do { - // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which - // means `flushPassiveEffects` will sometimes result in additional - // passive effects. So we need to keep flushing in a loop until there are - // no more pending effects. - // TODO: Might be better if `flushPassiveEffects` did not automatically - // flush synchronous work at the end, to avoid factoring hazards like this. - flushPassiveEffects(); - } while (rootWithPendingPassiveEffects !== null); - - flushRenderPhaseStrictModeWarningsInDEV(); - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } - - var finishedWork = root.finishedWork; - var lanes = root.finishedLanes; - - if (finishedWork === null) { - - return null; - } - - root.finishedWork = null; - root.finishedLanes = NoLanes; - - if (!(finishedWork !== root.current)) { - { - throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); - } - } // commitRoot never returns a continuation; it always finishes synchronously. - // So we can clear these now to allow a new callback to be scheduled. - - - root.callbackNode = null; // Update the first and last pending times on this root. The new first - // pending time is whatever is left on the root fiber. - - var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); - markRootFinished(root, remainingLanes); // Clear already finished discrete updates in case that a later call of - // `flushDiscreteUpdates` starts a useless render pass which may cancels - // a scheduled timeout. - - if (rootsWithPendingDiscreteUpdates !== null) { - if (!hasDiscreteLanes(remainingLanes) && rootsWithPendingDiscreteUpdates.has(root)) { - rootsWithPendingDiscreteUpdates.delete(root); - } - } - - if (root === workInProgressRoot) { - // We can reset these now that they are finished. - workInProgressRoot = null; - workInProgress = null; - workInProgressRootRenderLanes = NoLanes; - } // Get the list of effects. - - - var firstEffect; - - if (finishedWork.flags > PerformedWork) { - // A fiber's effect list consists only of its children, not itself. So if - // the root has an effect, we need to add it to the end of the list. The - // resulting list is the set that would belong to the root's parent, if it - // had one; that is, all the effects in the tree including the root. - if (finishedWork.lastEffect !== null) { - finishedWork.lastEffect.nextEffect = finishedWork; - firstEffect = finishedWork.firstEffect; - } else { - firstEffect = finishedWork; - } - } else { - // There is no effect on the root. - firstEffect = finishedWork.firstEffect; - } - - if (firstEffect !== null) { - - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles - - ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass - // of the effect list for each phase: all mutation effects come before all - // layout effects, and so on. - // The first phase a "before mutation" phase. We use this phase to read the - // state of the host tree right before we mutate it. This is where - // getSnapshotBeforeUpdate is called. - - focusedInstanceHandle = prepareForCommit(root.containerInfo); - shouldFireAfterActiveInstanceBlur = false; - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitBeforeMutationEffects, null); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var error = clearCaughtError(); - captureCommitPhaseError(nextEffect, error); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); // We no longer need to track the active instance fiber - - - focusedInstanceHandle = null; - - { - // Mark the current commit time to be shared by all Profilers in this - // batch. This enables them to be grouped later. - recordCommitTime(); - } // The next phase is the mutation phase, where we mutate the host tree. - - - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error = clearCaughtError(); - - captureCommitPhaseError(nextEffect, _error); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); - - resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after - // the mutation phase, so that the previous tree is still current during - // componentWillUnmount, but before the layout phase, so that the finished - // work is current during componentDidMount/Update. - - root.current = finishedWork; // The next phase is the layout phase, where we call effects that read - // the host tree after it's been mutated. The idiomatic use case for this is - // layout, but class component lifecycles also fire here for legacy reasons. - - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitLayoutEffects, null, root, lanes); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error2 = clearCaughtError(); - - captureCommitPhaseError(nextEffect, _error2); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); - - nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an - // opportunity to paint. - - requestPaint(); - - { - popInteractions(prevInteractions); - } - - executionContext = prevExecutionContext; - } else { - // No effects. - root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were - // no effects. - // TODO: Maybe there's a better way to report this. - - { - recordCommitTime(); - } - } - - var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; - - if (rootDoesHavePassiveEffects) { - // This commit has passive effects. Stash a reference to them. But don't - // schedule a callback until after flushing layout work. - rootDoesHavePassiveEffects = false; - rootWithPendingPassiveEffects = root; - pendingPassiveEffectsLanes = lanes; - pendingPassiveEffectsRenderPriority = renderPriorityLevel; - } else { - // We are done with the effect chain at this point so let's clear the - // nextEffect pointers to assist with GC. If we have passive effects, we'll - // clear this in flushPassiveEffects. - nextEffect = firstEffect; - - while (nextEffect !== null) { - var nextNextEffect = nextEffect.nextEffect; - nextEffect.nextEffect = null; - - if (nextEffect.flags & Deletion) { - detachFiberAfterEffects(nextEffect); - } - - nextEffect = nextNextEffect; - } - } // Read this again, since an effect might have updated it - - - remainingLanes = root.pendingLanes; // Check if there's remaining work on this root - - if (remainingLanes !== NoLanes) { - { - if (spawnedWorkDuringRender !== null) { - var expirationTimes = spawnedWorkDuringRender; - spawnedWorkDuringRender = null; - - for (var i = 0; i < expirationTimes.length; i++) { - scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions); - } - } - - schedulePendingInteractions(root, remainingLanes); - } - } else { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; - } - - { - if (!rootDidHavePassiveEffects) { - // If there are no passive effects, then we can complete the pending interactions. - // Otherwise, we'll wait until after the passive effects are flushed. - // Wait to do this until after remaining work has been scheduled, - // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. - finishPendingInteractions(root, lanes); - } - } - - if (remainingLanes === SyncLane) { - // Count the number of times the root synchronously re-renders without - // finishing. If there are too many, it indicates an infinite update loop. - if (root === rootWithNestedUpdates) { - nestedUpdateCount++; - } else { - nestedUpdateCount = 0; - rootWithNestedUpdates = root; - } - } else { - nestedUpdateCount = 0; - } - - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - // additional work on this root is scheduled. - - - ensureRootIsScheduled(root, now()); - - if (hasUncaughtError) { - hasUncaughtError = false; - var _error3 = firstUncaughtError; - firstUncaughtError = null; - throw _error3; - } - - if ((executionContext & LegacyUnbatchedContext) !== NoContext) { - // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired - // synchronously, but layout updates should be deferred until the end - // of the batch. - - - return null; - } // If layout work was scheduled, flush it now. - - - flushSyncCallbackQueue(); - - return null; -} - -function commitBeforeMutationEffects() { - while (nextEffect !== null) { - var current = nextEffect.alternate; - - if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) { - if ((nextEffect.flags & Deletion) !== NoFlags) { - if (doesFiberContain(nextEffect, focusedInstanceHandle)) { - shouldFireAfterActiveInstanceBlur = true; - } - } else { - // TODO: Move this out of the hot path using a dedicated effect tag. - if (nextEffect.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle)) { - shouldFireAfterActiveInstanceBlur = true; - } - } - } - - var flags = nextEffect.flags; - - if ((flags & Snapshot) !== NoFlags) { - setCurrentFiber(nextEffect); - commitBeforeMutationLifeCycles(current, nextEffect); - resetCurrentFiber(); - } - - if ((flags & Passive) !== NoFlags) { - // If there are passive effects, schedule a callback to flush at - // the earliest opportunity. - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } - } - - nextEffect = nextEffect.nextEffect; - } -} - -function commitMutationEffects(root, renderPriorityLevel) { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); - var flags = nextEffect.flags; - - if (flags & ContentReset) { - commitResetTextContent(nextEffect); - } - - if (flags & Ref) { - var current = nextEffect.alternate; - - if (current !== null) { - commitDetachRef(current); - } - } // The following switch statement is only concerned about placement, - // updates, and deletions. To avoid needing to add a case for every possible - // bitmap value, we remove the secondary effects from the effect tag and - // switch on that value. - - - var primaryFlags = flags & (Placement | Update | Deletion | Hydrating); - - switch (primaryFlags) { - case Placement: - { - commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - // TODO: findDOMNode doesn't rely on this any more but isMounted does - // and isMounted is deprecated anyway so we should be able to kill this. - - nextEffect.flags &= ~Placement; - break; - } - - case PlacementAndUpdate: - { - // Placement - commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - - nextEffect.flags &= ~Placement; // Update - - var _current = nextEffect.alternate; - commitWork(_current, nextEffect); - break; - } - - case Hydrating: - { - nextEffect.flags &= ~Hydrating; - break; - } - - case HydratingAndUpdate: - { - nextEffect.flags &= ~Hydrating; // Update - - var _current2 = nextEffect.alternate; - commitWork(_current2, nextEffect); - break; - } - - case Update: - { - var _current3 = nextEffect.alternate; - commitWork(_current3, nextEffect); - break; - } - - case Deletion: - { - commitDeletion(root, nextEffect); - break; - } - } - - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; - } -} - -function commitLayoutEffects(root, committedLanes) { - - - while (nextEffect !== null) { - setCurrentFiber(nextEffect); - var flags = nextEffect.flags; - - if (flags & (Update | Callback)) { - var current = nextEffect.alternate; - commitLifeCycles(root, current, nextEffect); - } - - { - if (flags & Ref) { - commitAttachRef(nextEffect); - } - } - - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; - } -} - -function flushPassiveEffects() { - // Returns whether passive effects were flushed. - if (pendingPassiveEffectsRenderPriority !== NoPriority$1) { - var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority$1 ? NormalPriority$1 : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = NoPriority$1; - - { - return runWithPriority(priorityLevel, flushPassiveEffectsImpl); - } - } - - return false; -} -function enqueuePendingPassiveHookEffectMount(fiber, effect) { - pendingPassiveHookEffectsMount.push(effect, fiber); - - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } -} -function enqueuePendingPassiveHookEffectUnmount(fiber, effect) { - pendingPassiveHookEffectsUnmount.push(effect, fiber); - - { - fiber.flags |= PassiveUnmountPendingDev; - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.flags |= PassiveUnmountPendingDev; - } - } - - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } -} - -function invokePassiveEffectCreate(effect) { - var create = effect.create; - effect.destroy = create(); -} - -function flushPassiveEffectsImpl() { - if (rootWithPendingPassiveEffects === null) { - return false; - } - - var root = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = NoLanes; - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Cannot flush passive effects while already rendering." ); - } - } - - { - isFlushingPassiveEffects = true; - } - - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - var prevInteractions = pushInteractions(root); // It's important that ALL pending passive effect destroy functions are called - // before ANY passive effect create functions are called. - // Otherwise effects in sibling components might interfere with each other. - // e.g. a destroy function in one component may unintentionally override a ref - // value set by a create function in another component. - // Layout effects have the same constraint. - // First pass: Destroy stale passive effects. - - var unmountEffects = pendingPassiveHookEffectsUnmount; - pendingPassiveHookEffectsUnmount = []; - - for (var i = 0; i < unmountEffects.length; i += 2) { - var _effect = unmountEffects[i]; - var fiber = unmountEffects[i + 1]; - var destroy = _effect.destroy; - _effect.destroy = undefined; - - { - fiber.flags &= ~PassiveUnmountPendingDev; - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.flags &= ~PassiveUnmountPendingDev; - } - } - - if (typeof destroy === 'function') { - { - setCurrentFiber(fiber); - - { - invokeGuardedCallback(null, destroy, null); - } - - if (hasCaughtError()) { - if (!(fiber !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var error = clearCaughtError(); - captureCommitPhaseError(fiber, error); - } - - resetCurrentFiber(); - } - } - } // Second pass: Create new passive effects. - - - var mountEffects = pendingPassiveHookEffectsMount; - pendingPassiveHookEffectsMount = []; - - for (var _i = 0; _i < mountEffects.length; _i += 2) { - var _effect2 = mountEffects[_i]; - var _fiber = mountEffects[_i + 1]; - - { - setCurrentFiber(_fiber); - - { - invokeGuardedCallback(null, invokePassiveEffectCreate, null, _effect2); - } - - if (hasCaughtError()) { - if (!(_fiber !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error4 = clearCaughtError(); - - captureCommitPhaseError(_fiber, _error4); - } - - resetCurrentFiber(); - } - } // Note: This currently assumes there are no passive effects on the root fiber - // because the root is not part of its own effect list. - // This could change in the future. - - - var effect = root.current.firstEffect; - - while (effect !== null) { - var nextNextEffect = effect.nextEffect; // Remove nextEffect pointer to assist GC - - effect.nextEffect = null; - - if (effect.flags & Deletion) { - detachFiberAfterEffects(effect); - } - - effect = nextNextEffect; - } - - { - popInteractions(prevInteractions); - finishPendingInteractions(root, lanes); - } - - { - isFlushingPassiveEffects = false; - } - - executionContext = prevExecutionContext; - flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this - // exceeds the limit, we'll fire a warning. - - nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; - return true; -} - -function isAlreadyFailedLegacyErrorBoundary(instance) { - return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); -} -function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); - } -} - -function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } -} - -var onUncaughtError = prepareToThrowUncaughtError; - -function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); - enqueueUpdate(rootFiber, update); - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, SyncLane); - } -} - -function captureCommitPhaseError(sourceFiber, error) { - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - return; - } - - var fiber = sourceFiber.return; - - while (fiber !== null) { - if (fiber.tag === HostRoot) { - captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); - return; - } else if (fiber.tag === ClassComponent) { - var ctor = fiber.type; - var instance = fiber.stateNode; - - if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); - enqueueUpdate(fiber, update); - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, SyncLane); - } else { - // This component has already been unmounted. - // We can't schedule any follow up work for the root because the fiber is already unmounted, - // but we can still call the log-only boundary so the error isn't swallowed. - // - // TODO This is only a temporary bandaid for the old reconciler fork. - // We can delete this special case once the new fork is merged. - if (typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - try { - instance.componentDidCatch(error, errorInfo); - } catch (errorToIgnore) {// TODO Ignore this error? Rethrow it? - // This is kind of an edge case. - } - } - } - - return; - } - } - - fiber = fiber.return; - } -} -function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - - if (pingCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - pingCache.delete(wakeable); - } - - var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes); - - if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { - // Received a ping at the same priority level at which we're currently - // rendering. We might want to restart this render. This should mirror - // the logic of whether or not a root suspends once it completes. - // TODO: If we're rendering sync either due to Sync, Batched or expired, - // we should probably never restart. - // If we're suspended with delay, or if it's a retry, we'll always suspend - // so we can always restart. - if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { - // Restart from the root. - prepareFreshStack(root, NoLanes); - } else { - // Even though we can't restart right now, we might get an - // opportunity later. So we mark this render as having a ping. - workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); - } - } - - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, pingedLanes); -} - -function retryTimedOutBoundary(boundaryFiber, retryLane) { - // The boundary fiber (a Suspense component or SuspenseList component) - // previously was rendered in its fallback state. One of the promises that - // suspended it has resolved, which means at least part of the tree was - // likely unblocked. Try rendering again, at a new expiration time. - if (retryLane === NoLane) { - retryLane = requestRetryLane(boundaryFiber); - } // TODO: Special case idle priority? - - - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane); - - if (root !== null) { - markRootUpdated(root, retryLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, retryLane); - } -} -function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = NoLane; // Default - - var retryCache; - - { - retryCache = boundaryFiber.stateNode; - } - - if (retryCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - retryCache.delete(wakeable); - } - - retryTimedOutBoundary(boundaryFiber, retryLane); -} // Computes the next Just Noticeable Difference (JND) boundary. -// The theory is that a person can't tell the difference between small differences in time. -// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable -// difference in the experience. However, waiting for longer might mean that we can avoid -// showing an intermediate loading state. The longer we have already waited, the harder it -// is to tell small differences in time. Therefore, the longer we've already waited, -// the longer we can wait additionally. At some point we have to give up though. -// We pick a train model where the next boundary commits at a consistent schedule. -// These particular numbers are vague estimates. We expect to adjust them based on research. - -function jnd(timeElapsed) { - return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; -} - -function checkForNestedUpdates() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - nestedUpdateCount = 0; - rootWithNestedUpdates = null; - - { - { - throw Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." ); - } - } - } - - { - if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { - nestedPassiveUpdateCount = 0; - - error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); - } - } -} - -function flushRenderPhaseStrictModeWarningsInDEV() { - { - ReactStrictModeWarnings.flushLegacyContextWarning(); - - { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - } - } -} - -var didWarnStateUpdateForNotYetMountedComponent = null; - -function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { - { - if ((executionContext & RenderContext) !== NoContext) { - // We let the other warning about render phase updates deal with this one. - return; - } - - if (!(fiber.mode & (BlockingMode | ConcurrentMode))) { - return; - } - - var tag = fiber.tag; - - if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - - - var componentName = getComponentName(fiber.type) || 'ReactComponent'; - - if (didWarnStateUpdateForNotYetMountedComponent !== null) { - if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) { - return; - } - - didWarnStateUpdateForNotYetMountedComponent.add(componentName); - } else { - didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); - } - - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } -} - -var didWarnStateUpdateForUnmountedComponent = null; - -function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { - { - var tag = fiber.tag; - - if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } // If there are pending passive effects unmounts for this Fiber, - // we can assume that they would have prevented this update. - - - if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) { - return; - } // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - - - var componentName = getComponentName(fiber.type) || 'ReactComponent'; - - if (didWarnStateUpdateForUnmountedComponent !== null) { - if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { - return; - } - - didWarnStateUpdateForUnmountedComponent.add(componentName); - } else { - didWarnStateUpdateForUnmountedComponent = new Set([componentName]); - } - - if (isFlushingPassiveEffects) ; else { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } -} - -var beginWork$1; - -{ - beginWork$1 = beginWork; -} - -var didWarnAboutUpdateInRender = false; -var didWarnAboutUpdateInRenderForAnotherComponent; - -{ - didWarnAboutUpdateInRenderForAnotherComponent = new Set(); -} - -function warnAboutRenderPhaseUpdatesInDEV(fiber) { - { - if (isRendering && (executionContext & RenderContext) !== NoContext && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. - - var dedupeKey = renderingComponentName; - - if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { - didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); - var setStateComponentName = getComponentName(fiber.type) || 'Unknown'; - - error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); - } - - break; - } - - case ClassComponent: - { - if (!didWarnAboutUpdateInRender) { - error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); - - didWarnAboutUpdateInRender = true; - } - - break; - } - } - } - } -} // a 'shared' variable that changes when act() opens/closes in tests. - - -var IsThisRendererActing = { - current: false -}; -function warnIfNotScopedWithMatchingAct(fiber) { - { - if ( IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + // Break up imports to avoid accidentally parsing them as dependencies. - 'import {act} fr' + "om 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + // Break up imports to avoid accidentally parsing them as dependencies. - 'import TestRenderer fr' + "om react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } -} -function warnIfNotCurrentlyActingEffectsInDEV(fiber) { - { - if ( (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { - error('An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentName(fiber.type)); - } - } -} - -function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { - { - if ( executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentName(fiber.type)); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } -} - -var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler. - -var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked -// scheduler is the actual recommendation. The alternative could be a testing build, -// a new lib, or whatever; we dunno just yet. This message is for early adopters -// to get their tests right. - -function warnIfUnmockedScheduler(fiber) { - { - if (didWarnAboutUnmockedScheduler === false && Scheduler$1.unstable_flushAllWithoutAsserting === undefined) { - if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { - didWarnAboutUnmockedScheduler = true; - - error('In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + // Break up requires to avoid accidentally parsing them as dependencies. - "jest.mock('scheduler', () => require" + "('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://reactjs.org/link/mock-scheduler'); - } - } - } -} - -function computeThreadID(root, lane) { - // Interaction threads are unique per root and expiration time. - // NOTE: Intentionally unsound cast. All that matters is that it's a number - // and it represents a batch of work. Could make a helper function instead, - // but meh this is fine for now. - return lane * 1000 + root.interactionThreadID; -} - -function markSpawnedWork(lane) { - - if (spawnedWorkDuringRender === null) { - spawnedWorkDuringRender = [lane]; - } else { - spawnedWorkDuringRender.push(lane); - } -} - -function scheduleInteractions(root, lane, interactions) { - - if (interactions.size > 0) { - var pendingInteractionMap = root.pendingInteractionMap; - var pendingInteractions = pendingInteractionMap.get(lane); - - if (pendingInteractions != null) { - interactions.forEach(function (interaction) { - if (!pendingInteractions.has(interaction)) { - // Update the pending async work count for previously unscheduled interaction. - interaction.__count++; - } - - pendingInteractions.add(interaction); - }); - } else { - pendingInteractionMap.set(lane, new Set(interactions)); // Update the pending async work count for the current interactions. - - interactions.forEach(function (interaction) { - interaction.__count++; - }); - } - - var subscriber = tracing.__subscriberRef.current; - - if (subscriber !== null) { - var threadID = computeThreadID(root, lane); - subscriber.onWorkScheduled(interactions, threadID); - } - } -} - -function schedulePendingInteractions(root, lane) { - - scheduleInteractions(root, lane, tracing.__interactionsRef.current); -} - -function startWorkOnPendingInteractions(root, lanes) { - // we can accurately attribute time spent working on it, And so that cascading - // work triggered during the render phase will be associated with it. - - - var interactions = new Set(); - root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledLane) { - if (includesSomeLane(lanes, scheduledLane)) { - scheduledInteractions.forEach(function (interaction) { - return interactions.add(interaction); - }); - } - }); // Store the current set of interactions on the FiberRoot for a few reasons: - // We can re-use it in hot functions like performConcurrentWorkOnRoot() - // without having to recalculate it. We will also use it in commitWork() to - // pass to any Profiler onRender() hooks. This also provides DevTools with a - // way to access it when the onCommitRoot() hook is called. - - root.memoizedInteractions = interactions; - - if (interactions.size > 0) { - var subscriber = tracing.__subscriberRef.current; - - if (subscriber !== null) { - var threadID = computeThreadID(root, lanes); - - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } - } - } -} - -function finishPendingInteractions(root, committedLanes) { - - var remainingLanesAfterCommit = root.pendingLanes; - var subscriber; - - try { - subscriber = tracing.__subscriberRef.current; - - if (subscriber !== null && root.memoizedInteractions.size > 0) { - // FIXME: More than one lane can finish in a single commit. - var threadID = computeThreadID(root, committedLanes); - subscriber.onWorkStopped(root.memoizedInteractions, threadID); - } - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } finally { - // Clear completed interactions from the pending Map. - // Unless the render was suspended or cascading work was scheduled, - // In which case– leave pending interactions until the subsequent render. - var pendingInteractionMap = root.pendingInteractionMap; - pendingInteractionMap.forEach(function (scheduledInteractions, lane) { - // Only decrement the pending interaction count if we're done. - // If there's still work at the current priority, - // That indicates that we are waiting for suspense data. - if (!includesSomeLane(remainingLanesAfterCommit, lane)) { - pendingInteractionMap.delete(lane); - scheduledInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber !== null && interaction.__count === 0) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } - } - }); - } - }); - } -} // `act` testing API - -function shouldForceFlushFallbacksInDEV() { - // Never force flush in production. This function should get stripped out. - return actingUpdatesScopeDepth > 0; -} - -var flushMockScheduler = Scheduler$1.unstable_flushAllWithoutAsserting; -var isSchedulerMocked = typeof flushMockScheduler === 'function'; // Returns whether additional work was scheduled. Caller should keep flushing -// until there's no work left. - -function flushActWork() { - if (flushMockScheduler !== undefined) { - - try { - return flushMockScheduler(); - } finally { - } - } else { - - try { - var didFlushWork = false; - - while (flushPassiveEffects()) { - didFlushWork = true; - } - - return didFlushWork; - } finally { - } - } -} - -function flushWorkAndMicroTasks(onDone) { - try { - flushActWork(); - enqueueTask(function () { - if (flushActWork()) { - flushWorkAndMicroTasks(onDone); - } else { - onDone(); - } - }); - } catch (err) { - onDone(err); - } -} // we track the 'depth' of the act() calls with this counter, -// so we can tell if any async act() calls try to run in parallel. - - -var actingUpdatesScopeDepth = 0; -function act(callback) { - - var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth; - actingUpdatesScopeDepth++; - var previousIsSomeRendererActing = IsSomeRendererActing.current; - var previousIsThisRendererActing = IsThisRendererActing.current; - IsSomeRendererActing.current = true; - IsThisRendererActing.current = true; - - function onDone() { - actingUpdatesScopeDepth--; - IsSomeRendererActing.current = previousIsSomeRendererActing; - IsThisRendererActing.current = previousIsThisRendererActing; - - { - if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) { - // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - } - } - - var result; - - try { - result = batchedUpdates(callback); - } catch (error) { - // on sync errors, we still want to 'cleanup' and decrement actingUpdatesScopeDepth - onDone(); - throw error; - } - - if (result !== null && typeof result === 'object' && typeof result.then === 'function') { - // setup a boolean that gets set to true only - // once this act() call is await-ed - var called = false; - - { - if (typeof Promise !== 'undefined') { - //eslint-disable-next-line no-undef - Promise.resolve().then(function () {}).then(function () { - if (called === false) { - error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, interleaving multiple act ' + 'calls and mixing their scopes. You should - await act(async () => ...);'); - } - }); - } - } // in the async case, the returned thenable runs the callback, flushes - // effects and microtasks in a loop until flushPassiveEffects() === false, - // and cleans up - - - return { - then: function (resolve, reject) { - called = true; - result.then(function () { - if (actingUpdatesScopeDepth > 1 || isSchedulerMocked === true && previousIsSomeRendererActing === true) { - onDone(); - resolve(); - return; - } // we're about to exit the act() scope, - // now's the time to flush tasks/effects - - - flushWorkAndMicroTasks(function (err) { - onDone(); - - if (err) { - reject(err); - } else { - resolve(); - } - }); - }, function (err) { - onDone(); - reject(err); - }); - } - }; - } else { - { - if (result !== undefined) { - error('The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result); - } - } // flush effects until none remain, and cleanup - - - try { - if (actingUpdatesScopeDepth === 1 && (isSchedulerMocked === false || previousIsSomeRendererActing === false)) { - // we're about to exit the act() scope, - // now's the time to flush effects - flushActWork(); - } - - onDone(); - } catch (err) { - onDone(); - throw err; - } // in the sync case, the returned thenable only warns *if* await-ed - - - return { - then: function (resolve) { - { - error('Do not await the result of calling act(...) with sync logic, it is not a Promise.'); - } - - resolve(); - } - }; - } -} - -function detachFiberAfterEffects(fiber) { - fiber.sibling = null; - fiber.stateNode = null; -} - -var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. - -var failedBoundaries = null; -var setRefreshHandler = function (handler) { - { - resolveFamily = handler; - } -}; -function resolveFunctionForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - return type; - } // Use the latest known implementation. - - - return family.current; - } -} -function resolveClassForHotReloading(type) { - // No implementation differences. - return resolveFunctionForHotReloading(type); -} -function resolveForwardRefForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - // Check if we're dealing with a real forwardRef. Don't want to crash early. - if (type !== null && type !== undefined && typeof type.render === 'function') { - // ForwardRef is special because its resolved .type is an object, - // but it's possible that we only have its inner render function in the map. - // If that inner render function is different, we'll build a new forwardRef type. - var currentRender = resolveFunctionForHotReloading(type.render); - - if (type.render !== currentRender) { - var syntheticType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: currentRender - }; - - if (type.displayName !== undefined) { - syntheticType.displayName = type.displayName; - } - - return syntheticType; - } - } - - return type; - } // Use the latest known implementation. - - - return family.current; - } -} -function isCompatibleFamilyForHotReloading(fiber, element) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return false; - } - - var prevType = fiber.elementType; - var nextType = element.type; // If we got here, we know types aren't === equal. - - var needsCompareFamilies = false; - var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; - - switch (fiber.tag) { - case ClassComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } - - break; - } - - case FunctionComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - // We don't know the inner type yet. - // We're going to assume that the lazy inner type is stable, - // and so it is sufficient to avoid reconciling it away. - // We're not going to unwrap or actually use the new lazy type. - needsCompareFamilies = true; - } - - break; - } - - case ForwardRef: - { - if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - case MemoComponent: - case SimpleMemoComponent: - { - if ($$typeofNextType === REACT_MEMO_TYPE) { - // TODO: if it was but can no longer be simple, - // we shouldn't set this. - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - default: - return false; - } // Check if both types have a family and it's the same one. - - - if (needsCompareFamilies) { - // Note: memo() and forwardRef() we'll compare outer rather than inner type. - // This means both of them need to be registered to preserve state. - // If we unwrapped and compared the inner types for wrappers instead, - // then we would risk falsely saying two separate memo(Foo) - // calls are equivalent because they wrap the same Foo function. - var prevFamily = resolveFamily(prevType); - - if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { - return true; - } - } - - return false; - } -} -function markFailedErrorBoundaryForHotReloading(fiber) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - if (typeof WeakSet !== 'function') { - return; - } - - if (failedBoundaries === null) { - failedBoundaries = new WeakSet(); - } - - failedBoundaries.add(fiber); - } -} -var scheduleRefresh = function (root, update) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - var staleFamilies = update.staleFamilies, - updatedFamilies = update.updatedFamilies; - flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); - }); - } -}; -var scheduleRoot = function (root, element) { - { - if (root.context !== emptyContextObject) { - // Super edge case: root has a legacy _renderSubtree context - // but we don't know the parentComponent so we can't pass it. - // Just ignore. We'll delete this with _renderSubtree code path later. - return; - } - - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); - } -}; - -function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { - { - var alternate = fiber.alternate, - child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - if (resolveFamily === null) { - throw new Error('Expected resolveFamily to be set during hot reload.'); - } - - var needsRender = false; - var needsRemount = false; - - if (candidateType !== null) { - var family = resolveFamily(candidateType); - - if (family !== undefined) { - if (staleFamilies.has(family)) { - needsRemount = true; - } else if (updatedFamilies.has(family)) { - if (tag === ClassComponent) { - needsRemount = true; - } else { - needsRender = true; - } - } - } - } - - if (failedBoundaries !== null) { - if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { - needsRemount = true; - } - } - - if (needsRemount) { - fiber._debugNeedsRemount = true; - } - - if (needsRemount || needsRender) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - - if (child !== null && !needsRemount) { - scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); - } - - if (sibling !== null) { - scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); - } - } -} - -var findHostInstancesForRefresh = function (root, families) { - { - var hostInstances = new Set(); - var types = new Set(families.map(function (family) { - return family.current; - })); - findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); - return hostInstances; - } -}; - -function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { - { - var child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - var didMatch = false; - - if (candidateType !== null) { - if (types.has(candidateType)) { - didMatch = true; - } - } - - if (didMatch) { - // We have a match. This only drills down to the closest host components. - // There's no need to search deeper because for the purpose of giving - // visual feedback, "flashing" outermost parent rectangles is sufficient. - findHostInstancesForFiberShallowly(fiber, hostInstances); - } else { - // If there's no match, maybe there will be one further down in the child tree. - if (child !== null) { - findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); - } - } - - if (sibling !== null) { - findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); - } - } -} - -function findHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); - - if (foundHostInstances) { - return; - } // If we didn't find any host children, fallback to closest host parent. - - - var node = fiber; - - while (true) { - switch (node.tag) { - case HostComponent: - hostInstances.add(node.stateNode); - return; - - case HostPortal: - hostInstances.add(node.stateNode.containerInfo); - return; - - case HostRoot: - hostInstances.add(node.stateNode.containerInfo); - return; - } - - if (node.return === null) { - throw new Error('Expected to reach root first.'); - } - - node = node.return; - } - } -} - -function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var node = fiber; - var foundHostInstances = false; - - while (true) { - if (node.tag === HostComponent) { - // We got a match. - foundHostInstances = true; - hostInstances.add(node.stateNode); // There may still be more, so keep searching. - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === fiber) { - return foundHostInstances; - } - - while (node.sibling === null) { - if (node.return === null || node.return === fiber) { - return foundHostInstances; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - return false; -} - -var hasBadMapPolyfill; - -{ - hasBadMapPolyfill = false; - - try { - var nonExtensibleObject = Object.preventExtensions({}); - /* eslint-disable no-new */ - - new Map([[nonExtensibleObject, null]]); - new Set([nonExtensibleObject]); - /* eslint-enable no-new */ - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; - } -} - -var debugCounter = 1; - -function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.elementType = null; - this.type = null; - this.stateNode = null; // Fiber - - this.return = null; - this.child = null; - this.sibling = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; - this.dependencies = null; - this.mode = mode; // Effects - - this.flags = NoFlags; - this.nextEffect = null; - this.firstEffect = null; - this.lastEffect = null; - this.lanes = NoLanes; - this.childLanes = NoLanes; - this.alternate = null; - - { - // Note: The following is done to avoid a v8 performance cliff. - // - // Initializing the fields below to smis and later updating them with - // double values will cause Fibers to end up having separate shapes. - // This behavior/bug has something to do with Object.preventExtension(). - // Fortunately this only impacts DEV builds. - // Unfortunately it makes React unusably slow for some applications. - // To work around this, initialize the fields below with doubles. - // - // Learn more about this here: - // https://github.com/facebook/react/issues/14365 - // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; - } - - { - // This isn't directly used but is handy for debugging internals: - this._debugID = debugCounter++; - this._debugSource = null; - this._debugOwner = null; - this._debugNeedsRemount = false; - this._debugHookTypes = null; - - if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { - Object.preventExtensions(this); - } - } -} // This is a constructor function, rather than a POJO constructor, still -// please ensure we do the following: -// 1) Nobody should add any instance methods on this. Instance methods can be -// more difficult to predict when they get optimized and they are almost -// never inlined properly in static compilers. -// 2) Nobody should rely on `instanceof Fiber` for type testing. We should -// always know when it is a fiber. -// 3) We might want to experiment with using numeric keys since they are easier -// to optimize in a non-JIT environment. -// 4) We can easily go from a constructor to a createFiber object literal if that -// is faster. -// 5) It should be easy to port this to a C struct and keep a C implementation -// compatible. - - -var createFiber = function (tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); -}; - -function shouldConstruct$1(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} - -function isSimpleFunctionComponent(type) { - return typeof type === 'function' && !shouldConstruct$1(type) && type.defaultProps === undefined; -} -function resolveLazyComponentTag(Component) { - if (typeof Component === 'function') { - return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - return ForwardRef; - } - - if ($$typeof === REACT_MEMO_TYPE) { - return MemoComponent; - } - } - - return IndeterminateComponent; -} // This is used to create an alternate fiber to do work on. - -function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); - workInProgress.elementType = current.elementType; - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; - - { - // DEV-only fields - workInProgress._debugID = current._debugID; - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; - workInProgress._debugHookTypes = current._debugHookTypes; - } - - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // We already have an alternate. - // Reset the effect tag. - - workInProgress.flags = NoFlags; // The effect list is no longer valid. - - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; - - { - // We intentionally reset, rather than copy, actualDuration & actualStartTime. - // This prevents time from endlessly accumulating in new commits. - // This has the downside of resetting values for different priority renders, - // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; - } - } - - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; // These will be overridden during the parent's reconciliation - - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - - { - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - - { - workInProgress._debugNeedsRemount = current._debugNeedsRemount; - - switch (workInProgress.tag) { - case IndeterminateComponent: - case FunctionComponent: - case SimpleMemoComponent: - workInProgress.type = resolveFunctionForHotReloading(current.type); - break; - - case ClassComponent: - workInProgress.type = resolveClassForHotReloading(current.type); - break; - - case ForwardRef: - workInProgress.type = resolveForwardRefForHotReloading(current.type); - break; - } - } - - return workInProgress; -} // Used to reuse a Fiber for a second pass. - -function resetWorkInProgress(workInProgress, renderLanes) { - // This resets the Fiber to what createFiber or createWorkInProgress would - // have set the values to before during the first pass. Ideally this wouldn't - // be necessary but unfortunately many code paths reads from the workInProgress - // when they should be reading from current and writing to workInProgress. - // We assume pendingProps, index, key, ref, return are still untouched to - // avoid doing another reconciliation. - // Reset the effect tag but keep any Placement tags, since that's something - // that child fiber is setting, not the reconciliation. - workInProgress.flags &= Placement; // The effect list is no longer valid. - - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; - var current = workInProgress.alternate; - - if (current === null) { - // Reset to createFiber's initial values. - workInProgress.childLanes = NoLanes; - workInProgress.lanes = renderLanes; - workInProgress.child = null; - workInProgress.memoizedProps = null; - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; - workInProgress.dependencies = null; - workInProgress.stateNode = null; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = 0; - workInProgress.treeBaseDuration = 0; - } - } else { - // Reset to the cloned values that createWorkInProgress would've. - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - } - - return workInProgress; -} -function createHostRootFiber(tag) { - var mode; - - if (tag === ConcurrentRoot) { - mode = ConcurrentMode | BlockingMode | StrictMode; - } else if (tag === BlockingRoot) { - mode = BlockingMode | StrictMode; - } else { - mode = NoMode; - } - - if ( isDevToolsPresent) { - // Always collect profile timings when DevTools are present. - // This enables DevTools to start capturing timing at any point– - // Without some nodes in the tree having empty base times. - mode |= ProfileMode; - } - - return createFiber(HostRoot, null, null, mode); -} -function createFiberFromTypeAndProps(type, // React$ElementType -key, pendingProps, owner, mode, lanes) { - var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. - - var resolvedType = type; - - if (typeof type === 'function') { - if (shouldConstruct$1(type)) { - fiberTag = ClassComponent; - - { - resolvedType = resolveClassForHotReloading(resolvedType); - } - } else { - { - resolvedType = resolveFunctionForHotReloading(resolvedType); - } - } - } else if (typeof type === 'string') { - fiberTag = HostComponent; - } else { - getTag: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment(pendingProps.children, mode, lanes, key); - - case REACT_DEBUG_TRACING_MODE_TYPE: - fiberTag = Mode; - mode |= DebugTracingMode; - break; - - case REACT_STRICT_MODE_TYPE: - fiberTag = Mode; - mode |= StrictMode; - break; - - case REACT_PROFILER_TYPE: - return createFiberFromProfiler(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_TYPE: - return createFiberFromSuspense(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_LIST_TYPE: - return createFiberFromSuspenseList(pendingProps, mode, lanes, key); - - case REACT_OFFSCREEN_TYPE: - return createFiberFromOffscreen(pendingProps, mode, lanes, key); - - case REACT_LEGACY_HIDDEN_TYPE: - return createFiberFromLegacyHidden(pendingProps, mode, lanes, key); - - case REACT_SCOPE_TYPE: - - // eslint-disable-next-line no-fallthrough - - default: - { - if (typeof type === 'object' && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break getTag; - - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break getTag; - - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - - { - resolvedType = resolveForwardRefForHotReloading(resolvedType); - } - - break getTag; - - case REACT_MEMO_TYPE: - fiberTag = MemoComponent; - break getTag; - - case REACT_LAZY_TYPE: - fiberTag = LazyComponent; - resolvedType = null; - break getTag; - - case REACT_BLOCK_TYPE: - fiberTag = Block; - break getTag; - } - } - - var info = ''; - - { - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; - } - - var ownerName = owner ? getComponentName(owner.type) : null; - - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } - } - - { - { - throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info ); - } - } - } - } - } - - var fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.elementType = type; - fiber.type = resolvedType; - fiber.lanes = lanes; - - { - fiber._debugOwner = owner; - } - - return fiber; -} -function createFiberFromElement(element, mode, lanes) { - var owner = null; - - { - owner = element._owner; - } - - var type = element.type; - var key = element.key; - var pendingProps = element.props; - var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); - - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; - } - - return fiber; -} -function createFiberFromFragment(elements, mode, lanes, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.lanes = lanes; - return fiber; -} - -function createFiberFromProfiler(pendingProps, mode, lanes, key) { - { - if (typeof pendingProps.id !== 'string') { - error('Profiler must specify an "id" as a prop'); - } - } - - var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag. - - fiber.elementType = REACT_PROFILER_TYPE; - fiber.type = REACT_PROFILER_TYPE; - fiber.lanes = lanes; - - { - fiber.stateNode = { - effectDuration: 0, - passiveEffectDuration: 0 - }; - } - - return fiber; -} - -function createFiberFromSuspense(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - fiber.type = REACT_SUSPENSE_TYPE; - fiber.elementType = REACT_SUSPENSE_TYPE; - fiber.lanes = lanes; - return fiber; -} -function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); - - { - // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - fiber.type = REACT_SUSPENSE_LIST_TYPE; - } - - fiber.elementType = REACT_SUSPENSE_LIST_TYPE; - fiber.lanes = lanes; - return fiber; -} -function createFiberFromOffscreen(pendingProps, mode, lanes, key) { - var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); // TODO: The OffscreenComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - { - fiber.type = REACT_OFFSCREEN_TYPE; - } - - fiber.elementType = REACT_OFFSCREEN_TYPE; - fiber.lanes = lanes; - return fiber; -} -function createFiberFromLegacyHidden(pendingProps, mode, lanes, key) { - var fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode); // TODO: The LegacyHidden fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - { - fiber.type = REACT_LEGACY_HIDDEN_TYPE; - } - - fiber.elementType = REACT_LEGACY_HIDDEN_TYPE; - fiber.lanes = lanes; - return fiber; -} -function createFiberFromText(content, mode, lanes) { - var fiber = createFiber(HostText, content, null, mode); - fiber.lanes = lanes; - return fiber; -} -function createFiberFromPortal(portal, mode, lanes) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.lanes = lanes; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - // Used by persistent updates - implementation: portal.implementation - }; - return fiber; -} // Used for stashing WIP properties to replay failed work in DEV. - -function FiberRootNode(containerInfo, tag, hydrate) { - this.tag = tag; - this.containerInfo = containerInfo; - this.pendingChildren = null; - this.current = null; - this.pingCache = null; - this.finishedWork = null; - this.timeoutHandle = noTimeout; - this.context = null; - this.pendingContext = null; - this.hydrate = hydrate; - this.callbackNode = null; - this.callbackPriority = NoLanePriority; - this.eventTimes = createLaneMap(NoLanes); - this.expirationTimes = createLaneMap(NoTimestamp); - this.pendingLanes = NoLanes; - this.suspendedLanes = NoLanes; - this.pingedLanes = NoLanes; - this.expiredLanes = NoLanes; - this.mutableReadLanes = NoLanes; - this.finishedLanes = NoLanes; - this.entangledLanes = NoLanes; - this.entanglements = createLaneMap(NoLanes); - - { - this.interactionThreadID = tracing.unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); - } - - { - switch (tag) { - case BlockingRoot: - this._debugRootType = 'createBlockingRoot()'; - break; - - case ConcurrentRoot: - this._debugRootType = 'createRoot()'; - break; - - case LegacyRoot: - this._debugRootType = 'createLegacyRoot()'; - break; - } - } -} - -function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) { - var root = new FiberRootNode(containerInfo, tag, hydrate); - // stateNode is any. - - - var uninitializedFiber = createHostRootFiber(tag); - root.current = uninitializedFiber; - uninitializedFiber.stateNode = root; - initializeUpdateQueue(uninitializedFiber); - return root; -} - -var didWarnAboutNestedUpdates; - -{ - didWarnAboutNestedUpdates = false; -} - -function getContextForSubtree(parentComponent) { - if (!parentComponent) { - return emptyContextObject; - } - - var fiber = get(parentComponent); - var parentContext = findCurrentUnmaskedContext(fiber); - - if (fiber.tag === ClassComponent) { - var Component = fiber.type; - - if (isContextProvider(Component)) { - return processChildContext(fiber, Component, parentContext); - } - } - - return parentContext; -} - -function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) { - return createFiberRoot(containerInfo, tag, hydrate); -} -function updateContainer(element, container, parentComponent, callback) { - { - onScheduleRoot(container, element); - } - - var current$1 = container.current; - var eventTime = requestEventTime(); - - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfUnmockedScheduler(current$1); - warnIfNotScopedWithMatchingAct(current$1); - } - } - - var lane = requestUpdateLane(current$1); - - var context = getContextForSubtree(parentComponent); - - if (container.context === null) { - container.context = context; - } else { - container.pendingContext = context; - } - - { - if (isRendering && current !== null && !didWarnAboutNestedUpdates) { - didWarnAboutNestedUpdates = true; - - error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown'); - } - } - - var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property - // being called "element". - - update.payload = { - element: element - }; - callback = callback === undefined ? null : callback; - - if (callback !== null) { - { - if (typeof callback !== 'function') { - error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); - } - } - - update.callback = callback; - } - - enqueueUpdate(current$1, update); - scheduleUpdateOnFiber(current$1, lane, eventTime); - return lane; -} -function getPublicRootInstance(container) { - var containerFiber = container.current; - - if (!containerFiber.child) { - return null; - } - - switch (containerFiber.child.tag) { - case HostComponent: - return getPublicInstance(containerFiber.child.stateNode); - - default: - return containerFiber.child.stateNode; - } -} - -var shouldSuspendImpl = function (fiber) { - return false; -}; - -function shouldSuspend(fiber) { - return shouldSuspendImpl(fiber); -} -var overrideHookState = null; -var overrideHookStateDeletePath = null; -var overrideHookStateRenamePath = null; -var overrideProps = null; -var overridePropsDeletePath = null; -var overridePropsRenamePath = null; -var scheduleUpdate = null; -var setSuspenseHandler = null; - -{ - var copyWithDeleteImpl = function (obj, path, index) { - var key = path[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); - - if (index + 1 === path.length) { - if (Array.isArray(updated)) { - updated.splice(key, 1); - } else { - delete updated[key]; - } - - return updated; - } // $FlowFixMe number or string is fine here - - - updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); - return updated; - }; - - var copyWithDelete = function (obj, path) { - return copyWithDeleteImpl(obj, path, 0); - }; - - var copyWithRenameImpl = function (obj, oldPath, newPath, index) { - var oldKey = oldPath[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); - - if (index + 1 === oldPath.length) { - var newKey = newPath[index]; // $FlowFixMe number or string is fine here - - updated[newKey] = updated[oldKey]; - - if (Array.isArray(updated)) { - updated.splice(oldKey, 1); - } else { - delete updated[oldKey]; - } - } else { - // $FlowFixMe number or string is fine here - updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here - obj[oldKey], oldPath, newPath, index + 1); - } - - return updated; - }; - - var copyWithRename = function (obj, oldPath, newPath) { - if (oldPath.length !== newPath.length) { - warn('copyWithRename() expects paths of the same length'); - - return; - } else { - for (var i = 0; i < newPath.length - 1; i++) { - if (oldPath[i] !== newPath[i]) { - warn('copyWithRename() expects paths to be the same except for the deepest key'); - - return; - } - } - } - - return copyWithRenameImpl(obj, oldPath, newPath, 0); - }; - - var copyWithSetImpl = function (obj, path, index, value) { - if (index >= path.length) { - return value; - } - - var key = path[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here - - updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); - return updated; - }; - - var copyWithSet = function (obj, path, value) { - return copyWithSetImpl(obj, path, 0, value); - }; - - var findHook = function (fiber, id) { - // For now, the "id" of stateful hooks is just the stateful hook index. - // This may change in the future with e.g. nested hooks. - var currentHook = fiber.memoizedState; - - while (currentHook !== null && id > 0) { - currentHook = currentHook.next; - id--; - } - - return currentHook; - }; // Support DevTools editable values for useState and useReducer. - - - overrideHookState = function (fiber, id, path, value) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithSet(hook.memoizedState, path, value); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; - - overrideHookStateDeletePath = function (fiber, id, path) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithDelete(hook.memoizedState, path); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; - - overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithRename(hook.memoizedState, oldPath, newPath); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; // Support DevTools props for function components, forwardRef, memo, host components, etc. - - - overrideProps = function (fiber, path, value) { - fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - overridePropsDeletePath = function (fiber, path) { - fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - overridePropsRenamePath = function (fiber, oldPath, newPath) { - fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - scheduleUpdate = function (fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - setSuspenseHandler = function (newShouldSuspendImpl) { - shouldSuspendImpl = newShouldSuspendImpl; - }; -} - -function findHostInstanceByFiber(fiber) { - var hostFiber = findCurrentHostFiber(fiber); - - if (hostFiber === null) { - return null; - } - - return hostFiber.stateNode; -} - -function emptyFindFiberByHostInstance(instance) { - return null; -} - -function getCurrentFiberForDevTools() { - return current; -} - -function injectIntoDevTools(devToolsConfig) { - var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; - return injectInternals({ - bundleType: devToolsConfig.bundleType, - version: devToolsConfig.version, - rendererPackageName: devToolsConfig.rendererPackageName, - rendererConfig: devToolsConfig.rendererConfig, - overrideHookState: overrideHookState, - overrideHookStateDeletePath: overrideHookStateDeletePath, - overrideHookStateRenamePath: overrideHookStateRenamePath, - overrideProps: overrideProps, - overridePropsDeletePath: overridePropsDeletePath, - overridePropsRenamePath: overridePropsRenamePath, - setSuspenseHandler: setSuspenseHandler, - scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, - findHostInstanceByFiber: findHostInstanceByFiber, - findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, - // React Refresh - findHostInstancesForRefresh: findHostInstancesForRefresh , - scheduleRefresh: scheduleRefresh , - scheduleRoot: scheduleRoot , - setRefreshHandler: setRefreshHandler , - // Enables DevTools to append owner stacks to error messages in DEV mode. - getCurrentFiber: getCurrentFiberForDevTools - }); -} - -var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing; -var defaultTestOptions = { - createNodeMock: function () { - return null; - } -}; - -function toJSON(inst) { - if (inst.isHidden) { - // Omit timed out children from output entirely. This seems like the least - // surprising behavior. We could perhaps add a separate API that includes - // them, if it turns out people need it. - return null; - } - - switch (inst.tag) { - case 'TEXT': - return inst.text; - - case 'INSTANCE': - { - /* eslint-disable no-unused-vars */ - // We don't include the `children` prop in JSON. - // Instead, we will include the actual rendered children. - var _inst$props = inst.props, - children = _inst$props.children, - props = _objectWithoutPropertiesLoose(_inst$props, ["children"]); - /* eslint-enable */ - - - var renderedChildren = null; - - if (inst.children && inst.children.length) { - for (var i = 0; i < inst.children.length; i++) { - var renderedChild = toJSON(inst.children[i]); - - if (renderedChild !== null) { - if (renderedChildren === null) { - renderedChildren = [renderedChild]; - } else { - renderedChildren.push(renderedChild); - } - } - } - } - - var json = { - type: inst.type, - props: props, - children: renderedChildren - }; - Object.defineProperty(json, '$$typeof', { - value: Symbol.for('react.test.json') - }); - return json; - } - - default: - throw new Error("Unexpected node type in toJSON: " + inst.tag); - } -} - -function childrenToTree(node) { - if (!node) { - return null; - } - - var children = nodeAndSiblingsArray(node); - - if (children.length === 0) { - return null; - } else if (children.length === 1) { - return toTree(children[0]); - } - - return flatten(children.map(toTree)); -} - -function nodeAndSiblingsArray(nodeWithSibling) { - var array = []; - var node = nodeWithSibling; - - while (node != null) { - array.push(node); - node = node.sibling; - } - - return array; -} - -function flatten(arr) { - var result = []; - var stack = [{ - i: 0, - array: arr - }]; - - while (stack.length) { - var n = stack.pop(); - - while (n.i < n.array.length) { - var el = n.array[n.i]; - n.i += 1; - - if (Array.isArray(el)) { - stack.push(n); - stack.push({ - i: 0, - array: el - }); - break; - } - - result.push(el); - } - } - - return result; -} - -function toTree(node) { - if (node == null) { - return null; - } - - switch (node.tag) { - case HostRoot: - return childrenToTree(node.child); - - case HostPortal: - return childrenToTree(node.child); - - case ClassComponent: - return { - nodeType: 'component', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: node.stateNode, - rendered: childrenToTree(node.child) - }; - - case FunctionComponent: - case SimpleMemoComponent: - return { - nodeType: 'component', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - rendered: childrenToTree(node.child) - }; - - case Block: - return { - nodeType: 'block', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - rendered: childrenToTree(node.child) - }; - - case HostComponent: - { - return { - nodeType: 'host', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - // TODO: use createNodeMock here somehow? - rendered: flatten(nodeAndSiblingsArray(node.child).map(toTree)) - }; - } - - case HostText: - return node.stateNode.text; - - case Fragment: - case ContextProvider: - case ContextConsumer: - case Mode: - case Profiler: - case ForwardRef: - case MemoComponent: - case IncompleteClassComponent: - case ScopeComponent: - return childrenToTree(node.child); - - default: - { - { - throw Error( "toTree() does not yet know how to handle nodes with tag=" + node.tag ); - } - } - - } -} - -var validWrapperTypes = new Set([FunctionComponent, ClassComponent, HostComponent, ForwardRef, MemoComponent, SimpleMemoComponent, Block, // Normally skipped, but used when there's more than one root child. -HostRoot]); - -function getChildren(parent) { - var children = []; - var startingNode = parent; - var node = startingNode; - - if (node.child === null) { - return children; - } - - node.child.return = node; - node = node.child; - - outer: while (true) { - var descend = false; - - if (validWrapperTypes.has(node.tag)) { - children.push(wrapFiber(node)); - } else if (node.tag === HostText) { - children.push('' + node.memoizedProps); - } else { - descend = true; - } - - if (descend && node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - while (node.sibling === null) { - if (node.return === startingNode) { - break outer; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - - return children; -} - -var ReactTestInstance = /*#__PURE__*/function () { - var _proto = ReactTestInstance.prototype; - - _proto._currentFiber = function _currentFiber() { - // Throws if this component has been unmounted. - var fiber = findCurrentFiberUsingSlowPath(this._fiber); - - if (!(fiber !== null)) { - { - throw Error( "Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - return fiber; - }; - - function ReactTestInstance(fiber) { - if (!validWrapperTypes.has(fiber.tag)) { - { - throw Error( "Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React." ); - } - } - - this._fiber = fiber; - } - - // Custom search functions - _proto.find = function find(predicate) { - return expectOne(this.findAll(predicate, { - deep: false - }), "matching custom predicate: " + predicate.toString()); - }; - - _proto.findByType = function findByType(type) { - return expectOne(this.findAllByType(type, { - deep: false - }), "with node type: \"" + (getComponentName(type) || 'Unknown') + "\""); - }; - - _proto.findByProps = function findByProps(props) { - return expectOne(this.findAllByProps(props, { - deep: false - }), "with props: " + JSON.stringify(props)); - }; - - _proto.findAll = function findAll(predicate) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, predicate, options); - }; - - _proto.findAllByType = function findAllByType(type) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, function (node) { - return node.type === type; - }, options); - }; - - _proto.findAllByProps = function findAllByProps(props) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, function (node) { - return node.props && propsMatch(node.props, props); - }, options); - }; - - _createClass(ReactTestInstance, [{ - key: "instance", - get: function () { - if (this._fiber.tag === HostComponent) { - return getPublicInstance(this._fiber.stateNode); - } else { - return this._fiber.stateNode; - } - } - }, { - key: "type", - get: function () { - return this._fiber.type; - } - }, { - key: "props", - get: function () { - return this._currentFiber().memoizedProps; - } - }, { - key: "parent", - get: function () { - var parent = this._fiber.return; - - while (parent !== null) { - if (validWrapperTypes.has(parent.tag)) { - if (parent.tag === HostRoot) { - // Special case: we only "materialize" instances for roots - // if they have more than a single child. So we'll check that now. - if (getChildren(parent).length < 2) { - return null; - } - } - - return wrapFiber(parent); - } - - parent = parent.return; - } - - return null; - } - }, { - key: "children", - get: function () { - return getChildren(this._currentFiber()); - } - }]); - - return ReactTestInstance; -}(); - -function _findAll(root, predicate, options) { - var deep = options ? options.deep : true; - var results = []; - - if (predicate(root)) { - results.push(root); - - if (!deep) { - return results; - } - } - - root.children.forEach(function (child) { - if (typeof child === 'string') { - return; - } - - results.push.apply(results, _findAll(child, predicate, options)); - }); - return results; -} - -function expectOne(all, message) { - if (all.length === 1) { - return all[0]; - } - - var prefix = all.length === 0 ? 'No instances found ' : "Expected 1 but found " + all.length + " instances "; - throw new Error(prefix + message); -} - -function propsMatch(props, filter) { - for (var key in filter) { - if (props[key] !== filter[key]) { - return false; - } - } - - return true; -} - -function create(element, options) { - var createNodeMock = defaultTestOptions.createNodeMock; - var isConcurrent = false; - - if (typeof options === 'object' && options !== null) { - if (typeof options.createNodeMock === 'function') { - createNodeMock = options.createNodeMock; - } - - if (options.unstable_isConcurrent === true) { - isConcurrent = true; - } - } - - var container = { - children: [], - createNodeMock: createNodeMock, - tag: 'CONTAINER' - }; - var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false); - - if (!(root != null)) { - { - throw Error( "something went wrong" ); - } - } - - updateContainer(element, root, null, null); - var entry = { - _Scheduler: Scheduler, - root: undefined, - // makes flow happy - // we define a 'getter' for 'root' below using 'Object.defineProperty' - toJSON: function () { - if (root == null || root.current == null || container == null) { - return null; - } - - if (container.children.length === 0) { - return null; - } - - if (container.children.length === 1) { - return toJSON(container.children[0]); - } - - if (container.children.length === 2 && container.children[0].isHidden === true && container.children[1].isHidden === false) { - // Omit timed out children from output entirely, including the fact that we - // temporarily wrap fallback and timed out children in an array. - return toJSON(container.children[1]); - } - - var renderedChildren = null; - - if (container.children && container.children.length) { - for (var i = 0; i < container.children.length; i++) { - var renderedChild = toJSON(container.children[i]); - - if (renderedChild !== null) { - if (renderedChildren === null) { - renderedChildren = [renderedChild]; - } else { - renderedChildren.push(renderedChild); - } - } - } - } - - return renderedChildren; - }, - toTree: function () { - if (root == null || root.current == null) { - return null; - } - - return toTree(root.current); - }, - update: function (newElement) { - if (root == null || root.current == null) { - return; - } - - updateContainer(newElement, root, null, null); - }, - unmount: function () { - if (root == null || root.current == null) { - return; - } - - updateContainer(null, root, null, null); - container = null; - root = null; - }, - getInstance: function () { - if (root == null || root.current == null) { - return null; - } - - return getPublicRootInstance(root); - }, - unstable_flushSync: function (fn) { - return flushSync(fn); - } - }; - Object.defineProperty(entry, 'root', { - configurable: true, - enumerable: true, - get: function () { - if (root === null) { - throw new Error("Can't access .root on unmounted test renderer"); - } - - var children = getChildren(root.current); - - if (children.length === 0) { - throw new Error("Can't access .root on unmounted test renderer"); - } else if (children.length === 1) { - // Normally, we skip the root and just give you the child. - return children[0]; - } else { - // However, we give you the root if there's more than one root child. - // We could make this the behavior for all cases but it would be a breaking change. - return wrapFiber(root.current); - } - } - }); - return entry; -} - -var fiberToWrapper = new WeakMap(); - -function wrapFiber(fiber) { - var wrapper = fiberToWrapper.get(fiber); - - if (wrapper === undefined && fiber.alternate !== null) { - wrapper = fiberToWrapper.get(fiber.alternate); - } - - if (wrapper === undefined) { - wrapper = new ReactTestInstance(fiber); - fiberToWrapper.set(fiber, wrapper); - } - - return wrapper; -} // Enable ReactTestRenderer to be used to test DevTools integration. - - -injectIntoDevTools({ - findFiberByHostInstance: function () { - throw new Error('TestRenderer does not support findFiberByHostInstance()'); - }, - bundleType: 1 , - version: ReactVersion, - rendererPackageName: 'react-test-renderer' -}); -var actingUpdatesScopeDepth$1 = 0; // This version of `act` is only used by our tests. Unlike the public version -// of `act`, it's designed to work identically in both production and -// development. It may have slightly different behavior from the public -// version, too, since our constraints in our test suite are not the same as -// those of developers using React — we're testing React itself, as opposed to -// building an app with React. -// TODO: Migrate our tests to use ReactNoop. Although we would need to figure -// out a solution for Relay, which has some Concurrent Mode tests. - -function unstable_concurrentAct(scope) { - if (Scheduler.unstable_flushAllWithoutAsserting === undefined) { - throw Error('This version of `act` requires a special mock build of Scheduler.'); - } - - if (setTimeout._isMockFunction !== true) { - throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).'); - } - - var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1; - var previousIsSomeRendererActing = IsSomeRendererActing$1.current; - var previousIsThisRendererActing = IsThisRendererActing.current; - IsSomeRendererActing$1.current = true; - IsThisRendererActing.current = true; - actingUpdatesScopeDepth$1++; - - var unwind = function () { - actingUpdatesScopeDepth$1--; - IsSomeRendererActing$1.current = previousIsSomeRendererActing; - IsThisRendererActing.current = previousIsThisRendererActing; - - { - if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) { - // if it's _less than_ previousActingUpdatesScopeDepth, then we can - // assume the 'other' one has warned - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - } - }; // TODO: This would be way simpler if 1) we required a promise to be - // returned and 2) we could use async/await. Since it's only our used in - // our test suite, we should be able to. - - - try { - var thenable = batchedUpdates(scope); - - if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') { - return { - then: function (resolve, reject) { - thenable.then(function () { - flushActWork$1(function () { - unwind(); - resolve(); - }, function (error) { - unwind(); - reject(error); - }); - }, function (error) { - unwind(); - reject(error); - }); - } - }; - } else { - try { - // TODO: Let's not support non-async scopes at all in our tests. Need to - // migrate existing tests. - var didFlushWork; - - do { - didFlushWork = Scheduler.unstable_flushAllWithoutAsserting(); - } while (didFlushWork); - } finally { - unwind(); - } - } - } catch (error) { - unwind(); - throw error; - } -} - -function flushActWork$1(resolve, reject) { - // Flush suspended fallbacks - // $FlowFixMe: Flow doesn't know about global Jest object - jest.runOnlyPendingTimers(); - enqueueTask(function () { - try { - var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting(); - - if (didFlushWork) { - flushActWork$1(resolve, reject); - } else { - resolve(); - } - } catch (error) { - reject(error); - } - }); -} - -exports._Scheduler = Scheduler; -exports.act = act; -exports.create = create; -exports.unstable_batchedUpdates = batchedUpdates; -exports.unstable_concurrentAct = unstable_concurrentAct; - })(); -} diff --git a/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js b/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js deleted file mode 100644 index 4fd8cbaf82662..0000000000000 --- a/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js +++ /dev/null @@ -1,198 +0,0 @@ -/** @license React v17.0.2 - * react-test-renderer.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. - */ -'use strict';var aa=require("object-assign"),ba=require("scheduler/unstable_mock"),ca=require("react"),n=require("scheduler");function q(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cg||e[h]!==f[g])return"\n"+e[h].replace(" at new "," at ");while(1<=h&&0<=g)}break}}}finally{Ra=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:"")?Qa(a):""}var Ta=[],Ua=-1;function Va(a){return{current:a}}function A(a){0>Ua||(a.current=Ta[Ua],Ta[Ua]=null,Ua--)}function B(a,b){Ua++;Ta[Ua]=a.current;a.current=b} -var Wa={},C=Va(Wa),D=Va(!1),Xa=Wa;function Ya(a,b){var c=a.type.contextTypes;if(!c)return Wa;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function E(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Za(){A(D);A(C)} -function $a(a,b,c){if(C.current!==Wa)throw Error(q(168));B(C,b);B(D,c)}function ab(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(q(108,za(b)||"Unknown",e));return aa({},c,d)}function bb(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Wa;Xa=C.current;B(C,a);B(D,D.current);return!0} -function cb(a,b,c){var d=a.stateNode;if(!d)throw Error(q(169));c?(a=ab(a,b,Xa),d.__reactInternalMemoizedMergedChildContext=a,A(D),A(C),B(C,a)):A(D);B(D,c)}var db=null,eb=null,fb=n.unstable_now;fb();var F=8; -function gb(a){if(0!==(1&a))return F=15,1;if(0!==(2&a))return F=14,2;if(0!==(4&a))return F=13,4;var b=24&a;if(0!==b)return F=12,b;if(0!==(a&32))return F=11,32;b=192&a;if(0!==b)return F=10,b;if(0!==(a&256))return F=9,256;b=3584&a;if(0!==b)return F=8,b;if(0!==(a&4096))return F=7,4096;b=4186112&a;if(0!==b)return F=6,b;b=62914560&a;if(0!==b)return F=5,b;if(a&67108864)return F=4,67108864;if(0!==(a&134217728))return F=3,134217728;b=805306368&a;if(0!==b)return F=2,b;if(0!==(1073741824&a))return F=1,1073741824; -F=8;return a}function hb(a){switch(a){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function ib(a){switch(a){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(q(358,a));}} -function jb(a,b){var c=a.pendingLanes;if(0===c)return F=0;var d=0,e=0,f=a.expiredLanes,h=a.suspendedLanes,g=a.pingedLanes;if(0!==f)d=f,e=F=15;else if(f=c&134217727,0!==f){var k=f&~h;0!==k?(d=gb(k),e=F):(g&=f,0!==g&&(d=gb(g),e=F))}else f=c&~h,0!==f?(d=gb(f),e=F):0!==g&&(d=gb(g),e=F);if(0===d)return 0;d=31-kb(d);d=c&((0>d?0:1<c;c++)b.push(a);return b} -function pb(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-kb(b);a[b]=c}var kb=Math.clz32?Math.clz32:qb,rb=Math.log,sb=Math.LN2;function qb(a){return 0===a?32:31-(rb(a)/sb|0)|0} -var tb=n.unstable_runWithPriority,ub=n.unstable_scheduleCallback,vb=n.unstable_cancelCallback,wb=n.unstable_shouldYield,xb=n.unstable_requestPaint,yb=n.unstable_now,zb=n.unstable_getCurrentPriorityLevel,Ab=n.unstable_ImmediatePriority,Bb=n.unstable_UserBlockingPriority,Cb=n.unstable_NormalPriority,Db=n.unstable_LowPriority,Eb=n.unstable_IdlePriority,Fb={},Gb=void 0!==xb?xb:function(){},Hb=null,Ib=null,Jb=!1,Kb=yb(),G=1E4>Kb?yb:function(){return yb()-Kb}; -function Lb(){switch(zb()){case Ab:return 99;case Bb:return 98;case Cb:return 97;case Db:return 96;case Eb:return 95;default:throw Error(q(332));}}function Mb(a){switch(a){case 99:return Ab;case 98:return Bb;case 97:return Cb;case 96:return Db;case 95:return Eb;default:throw Error(q(332));}}function Nb(a,b){a=Mb(a);return tb(a,b)}function Ob(a,b,c){a=Mb(a);return ub(a,b,c)}function Pb(){if(null!==Ib){var a=Ib;Ib=null;vb(a)}Qb()} -function Qb(){if(!Jb&&null!==Hb){Jb=!0;var a=0;try{var b=Hb;Nb(99,function(){for(;ay?(p=t,t=null):p=t.sibling;var v=m(e,t,g[y],k);if(null===v){null===t&&(t=p);break}a&&t&&null=== -v.alternate&&b(e,t);h=f(v,h,y);null===l?u=v:l.sibling=v;l=v;t=p}if(y===g.length)return c(e,t),u;if(null===t){for(;yy?(p=u,u=null):p=u.sibling;var x=m(e,u,v.value,k);if(null===x){null===u&&(u=p);break}a&&u&&null===x.alternate&&b(e,u);h=f(x,h,y);null===l?t=x:l.sibling=x;l=x;u=p}if(v.done)return c(e,u),t;if(null===u){for(;!v.done;y++,v=g.next())v=r(e,v.value,k),null!==v&&(h=f(v,h,y),null===l?t=v:l.sibling=v,l=v);return t}for(u=d(e,u);!v.done;y++,v=g.next())v=z(u,e,y,v.value,k),null!==v&&(a&&null!==v.alternate&& -u.delete(null===v.key?y:v.key),h=f(v,h,y),null===l?t=v:l.sibling=v,l=v);a&&u.forEach(function(a){return b(e,a)});return t}return function(a,d,f,g){var k="object"===typeof f&&null!==f&&f.type===ja&&null===f.key;k&&(f=f.props.children);var l="object"===typeof f&&null!==f;if(l)switch(f.$$typeof){case ha:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ja){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling); -d=e(k,f.props);d.ref=xc(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling}f.type===ja?(d=Ec(f.props.children,a.mode,g,f.key),d.return=a,a=d):(g=Cc(f.type,f.key,f.props,null,a.mode,g),g.ref=xc(a,d,f),g.return=a,a=g)}return h(a);case ia:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d= -Dc(f,a.mode,g);d.return=a;a=d}return h(a)}if("string"===typeof f||"number"===typeof f)return f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Bc(f,a.mode,g),d.return=a,a=d),h(a);if(wc(f))return x(a,d,f,g);if(ya(f))return V(a,d,f,g);l&&yc(a,f);if("undefined"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(q(152,za(a.type)||"Component"));}return c(a,d)}}var Fc=zc(!0),Gc=zc(!1),Hc={},Ic=Va(Hc),Jc=Va(Hc),Kc=Va(Hc); -function Lc(a){if(a===Hc)throw Error(q(174));return a}function Mc(a,b){B(Kc,b);B(Jc,a);B(Ic,Hc);A(Ic);B(Ic,Ga)}function Nc(){A(Ic);A(Jc);A(Kc)}function Oc(a){Lc(Kc.current);Lc(Ic.current)!==Ga&&(B(Jc,a),B(Ic,Ga))}function Qc(a){Jc.current===a&&(A(Ic),A(Jc))}var L=Va(0); -function Rc(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState,d;if(d=null!==c){if(!(c=null===c.dehydrated))throw Error(q(305));if(!c)throw Error(q(305));d=c}if(d)return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Sc=[]; -function Tc(){for(var a=0;af))throw Error(q(301));f+=1;P=O=null;b.updateQueue=null;Uc.current=bd;a=c(d,e)}while(Xc)}Uc.current=cd;b=null!==O&&null!==O.next;Vc=0;P=O=N=null;Wc=!1;if(b)throw Error(q(300));return a}function dd(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===P?N.memoizedState=P=a:P=P.next=a;return P} -function ed(){if(null===O){var a=N.alternate;a=null!==a?a.memoizedState:null}else a=O.next;var b=null===P?N.memoizedState:P.next;if(null!==b)P=b,O=a;else{if(null===a)throw Error(q(310));O=a;a={memoizedState:O.memoizedState,baseState:O.baseState,baseQueue:O.baseQueue,queue:O.queue,next:null};null===P?N.memoizedState=P=a:P=P.next=a}return P}function fd(a,b){return"function"===typeof b?b(a):b} -function gd(a){var b=ed(),c=b.queue;if(null===c)throw Error(q(311));c.lastRenderedReducer=a;var d=O,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var h=e.next;e.next=f.next;f.next=h}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var g=h=f=null,k=e;do{var l=k.lane;if((Vc&l)===l)null!==g&&(g=g.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else{var p={lane:l,action:k.action,eagerReducer:k.eagerReducer, -eagerState:k.eagerState,next:null};null===g?(h=g=p,f=d):g=g.next=p;N.lanes|=l;kc|=l}k=k.next}while(null!==k&&k!==e);null===g?f=d:g.next=h;H(d,b.memoizedState)||(J=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=g;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]} -function hd(a){var b=ed(),c=b.queue;if(null===c)throw Error(q(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var h=e=e.next;do f=a(f,h.action),h=h.next;while(h!==e);H(f,b.memoizedState)||(J=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]} -function id(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionSecondary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(Vc&a)===a)b._workInProgressVersionSecondary=d,Sc.push(b);if(a)return c(b._source);Sc.push(b);throw Error(q(350));} -function jd(a,b,c,d){var e=R;if(null===e)throw Error(q(349));var f=b._getVersion,h=f(b._source),g=Uc.current,k=g.useState(function(){return id(e,b,c)}),l=k[1],p=k[0];k=P;var r=a.memoizedState,m=r.refs,z=m.getSnapshot,x=r.source;r=r.subscribe;var V=N;a.memoizedState={refs:m,source:b,subscribe:d};g.useEffect(function(){m.getSnapshot=c;m.setSnapshot=l;var a=f(b._source);if(!H(h,a)){a=c(b._source);H(p,a)||(l(a),a=pc(V),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d= -e.entanglements,g=a;0c?98:c,function(){a(!0)});Nb(97ee&&(b.flags|=64,e=!0,ae(d,!1),b.lanes=33554432)}else{if(!e)if(a=Rc(f),null!==a){if(b.flags|=64,e=!0,a=a.updateQueue,null!==a&&(b.updateQueue=a,b.flags|=4),ae(d,!0),null===d.tail&&"hidden"===d.tailMode&& -!f.alternate)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*G()-d.renderingStartTime>ee&&1073741824!==c&&(b.flags|=64,e=!0,ae(d,!1),b.lanes=33554432);d.isBackwards?(f.sibling=b.child,b.child=f):(a=d.last,null!==a?a.sibling=f:b.child=f,d.last=f)}return null!==d.tail?(a=d.tail,d.rendering=a,d.tail=a.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=G(),a.sibling=null,b=L.current,B(L,e?b&1|2:b&1),a):null;case 23:case 24:return fe(),null!==a&&null!==a.memoizedState!== -(null!==b.memoizedState)&&"unstable-defer-without-hiding"!==d.mode&&(b.flags|=4),null}throw Error(q(156,b.tag));} -function ge(a){switch(a.tag){case 1:E(a.type)&&Za();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:Nc();A(D);A(C);Tc();b=a.flags;if(0!==(b&64))throw Error(q(285));a.flags=b&-4097|64;return a;case 5:return Qc(a),null;case 13:return A(L),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return A(L),null;case 4:return Nc(),null;case 10:return ac(a),null;case 23:case 24:return fe(),null;default:return null}} -function he(a,b){try{var c="",d=b;do c+=Vb(d),d=d.return;while(d);var e=c}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack}return{value:a,source:b,stack:e}}function ie(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}var je="function"===typeof WeakMap?WeakMap:Map;function le(a,b,c){c=gc(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){me||(me=!0,ne=d);ie(a,b)};return c} -function oe(a,b,c){c=gc(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){ie(a,b);return d(e)}}var f=a.stateNode;null!==f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){"function"!==typeof d&&(null===pe?pe=new Set([this]):pe.add(this),ie(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""})});return c}var qe="function"===typeof WeakSet?WeakSet:Set; -function re(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null)}catch(c){se(a,c)}else b.current=null} -function te(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:I(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&b.stateNode.containerInfo.children.splice(0);return;case 5:case 6:case 4:case 17:return}throw Error(q(163));} -function ue(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d()}a=a.next}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(ve(c,a),we(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:I(c.type,b.memoizedProps),a.componentDidUpdate(d, -b.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&lc(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=Ja(c.child.stateNode);break;case 1:a=c.child.stateNode}lc(c,b,a)}return;case 5:return;case 6:return;case 4:return;case 12:return;case 13:return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(q(163));} -function xe(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;b?d.isHidden=!0:c.stateNode.isHidden=!1}else if(6===c.tag)c.stateNode.isHidden=b?!0:!1;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===a)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}} -function ye(a,b){if(eb&&"function"===typeof eb.onCommitFiberUnmount)try{eb.onCommitFiberUnmount(db,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))ve(b,c);else{d=b;try{e()}catch(f){se(d,f)}}c=c.next}while(c!==a)}break;case 1:re(b);a=b.stateNode;if("function"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(f){se(b, -f)}break;case 5:re(b);break;case 4:ze(a,b)}}function Ae(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function Be(a){return 5===a.tag||3===a.tag||4===a.tag} -function Ce(a){a:{for(var b=a.return;null!==b;){if(Be(b))break a;b=b.return}throw Error(q(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(q(161));}c.flags&16&&(c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||Be(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===c.child|| -4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?De(a,c,b):Ee(a,c,b)}function De(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?La(c,a,b):Ka(c,a);else if(4!==d&&(a=a.child,null!==a))for(De(a,b,c),a=a.sibling;null!==a;)De(a,b,c),a=a.sibling} -function Ee(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?La(c,a,b):Ka(c,a);else if(4!==d&&(a=a.child,null!==a))for(Ee(a,b,c),a=a.sibling;null!==a;)Ee(a,b,c),a=a.sibling} -function ze(a,b){for(var c=b,d=!1,e;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(q(160));e=d.stateNode;switch(d.tag){case 5:break a;case 3:e=e.containerInfo;break a;case 4:e=e.containerInfo;break a}d=d.return}d=!0}if(5===c.tag||6===c.tag){a:for(var f=a,h=c,g=h;;)if(ye(f,g),null!==g.child&&4!==g.tag)g.child.return=g,g=g.child;else{if(g===h)break a;for(;null===g.sibling;){if(null===g.return||g.return===h)break a;g=g.return}g.sibling.return=g.return;g=g.sibling}f=e;h=f.children.indexOf(c.stateNode); -f.children.splice(h,1)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;c.child.return=c;c=c.child;continue}}else if(ye(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}} -function Fe(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var c=a.destroy;a.destroy=void 0;void 0!==c&&c()}a=a.next}while(a!==b)}return;case 1:return;case 5:a=b.stateNode;if(null!=a){c=b.memoizedProps;var d=b.type,e=b.updateQueue;b.updateQueue=null;null!==e&&(a.type=d,a.props=c)}return;case 6:if(null===b.stateNode)throw Error(q(162));b.stateNode.text=b.memoizedProps;return;case 3:return;case 12:return; -case 13:null!==b.memoizedState&&(Ge=G(),xe(b.child,!0));He(b);return;case 19:He(b);return;case 17:return;case 23:case 24:xe(b,null!==b.memoizedState);return}throw Error(q(163));}function He(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new qe);b.forEach(function(b){var d=Ie.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}} -function Je(a,b){return null!==a&&(a=a.memoizedState,null===a||null!==a.dehydrated)?(b=b.memoizedState,null!==b&&null===b.dehydrated):!1}var Ke=null;function Le(a){if(null===Ke)try{var b=("require"+Math.random()).slice(0,7);Ke=(module&&module[b]).call(module,"timers").setImmediate}catch(c){Ke=function(a){var b=new MessageChannel;b.port1.onmessage=a;b.port2.postMessage(void 0)}}return Ke(a)} -var Me=Math.ceil,Ne=fa.ReactCurrentDispatcher,Oe=fa.ReactCurrentOwner,Pe=fa.IsSomeRendererActing,W=0,R=null,X=null,U=0,Qe=0,Re=Va(0),T=0,Se=null,Te=0,kc=0,ce=0,Ue=0,Ve=null,Ge=0,ee=Infinity,Y=null,me=!1,ne=null,pe=null,We=!1,Xe=null,Ye=90,Ze=[],$e=[],af=null,bf=0,cf=null,df=-1,ef=0,ff=0,gf=null,hf=!1;function oc(){return 0!==(W&48)?G():-1!==df?df:df=G()} -function pc(a){a=a.mode;if(0===(a&2))return 1;if(0===(a&4))return 99===Lb()?1:2;0===ef&&(ef=Te);if(0!==Rb.transition){0!==ff&&(ff=null!==Ve?Ve.pendingLanes:0);a=ef;var b=4186112&~ff;b&=-b;0===b&&(a=4186112&~a,b=a&-a,0===b&&(b=8192));return b}a=Lb();0!==(W&4)&&98===a?a=mb(12,ef):(a=hb(a),a=mb(a,ef));return a} -function qc(a,b,c){if(50e&&(e=h);c&=~f}c=e;c=G()-c;c=(120>c?120:480>c?480:1080>c?1080: -1920>c?1920:3E3>c?3E3:4320>c?4320:1960*Me(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.")}5!==T&&(T=2);k= -he(k,g);m=h;do{switch(m.tag){case 3:f=k;m.flags|=4096;b&=-b;m.lanes|=b;var Ef=le(m,f,b);ic(m,Ef);break a;case 1:f=k;var Ff=m.type,Pc=m.stateNode;if(0===(m.flags&64)&&("function"===typeof Ff.getDerivedStateFromError||null!==Pc&&"function"===typeof Pc.componentDidCatch&&(null===pe||!pe.has(Pc)))){m.flags|=4096;b&=-b;m.lanes|=b;var Gf=oe(m,f,b);ic(m,Gf);break a}}m=m.return}while(null!==m)}vf(c)}catch(v){b=v;X===c&&null!==c&&(X=c=c.return);continue}break}while(1)} -function nf(){var a=Ne.current;Ne.current=cd;return null===a?cd:a}function rf(a,b){var c=W;W|=16;var d=nf();R===a&&U===b||of(a,b);do try{wf();break}catch(e){qf(a,e)}while(1);$b();W=c;Ne.current=d;if(null!==X)throw Error(q(261));R=null;U=0;return T}function wf(){for(;null!==X;)xf(X)}function pf(){for(;null!==X&&!wb();)xf(X)}function xf(a){var b=yf(a.alternate,a,Qe);a.memoizedProps=a.pendingProps;null===b?vf(a):X=b;Oe.current=null} -function vf(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=be(c,b,Qe);if(null!==c){X=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(Qe&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1G()-Ge?of(a,0):Ue|=c);Z(a,b)}function Ie(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===Lb()?1:2:(0===ef&&(ef=Te),b=nb(62914560&~ef),0===b&&(b=4194304)));c=oc();a=jf(a,b);null!==a&&(pb(a,b,c),Z(a,c))}var yf; -yf=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||D.current)J=!0;else if(0!==(c&d))J=0!==(a.flags&16384)?!0:!1;else{J=!1;switch(b.tag){case 3:Nd(b);break;case 5:Oc(b);break;case 1:E(b.type)&&bb(b);break;case 4:Mc(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;B(Wb,e._currentValue2);e._currentValue2=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return Pd(a,b,c);B(L,L.current&1);b=Dd(a,b,c);return null!== -b?b.sibling:null}B(L,L.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Wd(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);B(L,L.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,Id(a,b,c)}return Dd(a,b,c)}else J=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ya(b,C.current);cc(b,c);e=Zc(null,b,d,a,e,c);b.flags|=1;if("object"=== -typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(E(d)){var f=!0;bb(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;ec(b);var h=d.getDerivedStateFromProps;"function"===typeof h&&nc(b,d,h,a);e.updater=rc;b.stateNode=e;e._reactInternals=b;vc(b,d,a,c);b=Md(null,b,d,!0,f,c)}else b.tag=0,S(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a= -b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=Df(e);a=I(e,a);switch(f){case 0:b=Hd(null,b,e,a,c);break a;case 1:b=Ld(null,b,e,a,c);break a;case 11:b=Cd(null,b,e,a,c);break a;case 14:b=Ed(null,b,e,I(e.type,a),d,c);break a}throw Error(q(306,e,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:I(d,e),Hd(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:I(d,e),Ld(a,b,d,e,c);case 3:Nd(b);d=b.updateQueue;if(null===a||null===d)throw Error(q(282)); -d=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;fc(a,b);jc(b,d,null,c);d=b.memoizedState.element;d===e?b=Dd(a,b,c):(S(a,b,d,c),b=b.child);return b;case 5:return Oc(b),d=b.pendingProps.children,Kd(a,b),S(a,b,d,c),b.child;case 6:return null;case 13:return Pd(a,b,c);case 4:return Mc(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Fc(b,null,d,c):S(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:I(d,e),Cd(a,b,d,e,c);case 7:return S(a,b,b.pendingProps, -c),b.child;case 8:return S(a,b,b.pendingProps.children,c),b.child;case 12:return S(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;h=b.memoizedProps;f=e.value;var g=b.type._context;B(Wb,g._currentValue2);g._currentValue2=f;if(null!==h)if(g=h.value,f=H(g,f)?0:("function"===typeof d._calculateChangedBits?d._calculateChangedBits(g,f):1073741823)|0,0===f){if(h.children===e.children&&!D.current){b=Dd(a,b,c);break a}}else for(g=b.child,null!==g&&(g.return=b);null!== -g;){var k=g.dependencies;if(null!==k){h=g.child;for(var l=k.firstContext;null!==l;){if(l.context===d&&0!==(l.observedBits&f)){1===g.tag&&(l=gc(-1,c&-c),l.tag=2,hc(g,l));g.lanes|=c;l=g.alternate;null!==l&&(l.lanes|=c);bc(g.return,c);k.lanes|=c;break}l=l.next}}else h=10===g.tag?g.type===b.type?null:g.child:g.child;if(null!==h)h.return=g;else for(h=g;null!==h;){if(h===b){h=null;break}g=h.sibling;if(null!==g){g.return=h.return;h=g;break}h=h.return}g=h}S(a,b,e.children,c);b=b.child}return b;case 9:return e= -b.type,f=b.pendingProps,d=f.children,cc(b,c),e=K(e,f.unstable_observedBits),d=d(e),b.flags|=1,S(a,b,d,c),b.child;case 14:return e=b.type,f=I(e,b.pendingProps),f=I(e.type,f),Ed(a,b,e,f,d,c);case 15:return Gd(a,b,b.type,b.pendingProps,d,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:I(d,e),null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2),b.tag=1,E(d)?(a=!0,bb(b)):a=!1,cc(b,c),tc(b,d,e),vc(b,d,e,c),Md(null,b,d,!0,a,c);case 19:return Wd(a,b,c);case 23:return Id(a,b,c);case 24:return Id(a, -b,c)}throw Error(q(156,b.tag));};var Hf=n.unstable_flushAllWithoutAsserting,If="function"===typeof Hf;function Jf(){if(void 0!==Hf)return Hf();for(var a=!1;mf();)a=!0;return a}function Kf(a){try{Jf(),Le(function(){Jf()?Kf(a):a()})}catch(b){a(b)}}var Lf=0,Mf=!1; -function Nf(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.flags=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childLanes=this.lanes=0;this.alternate=null}function Of(a,b,c,d){return new Nf(a,b,c,d)}function Fd(a){a=a.prototype;return!(!a||!a.isReactComponent)} -function Df(a){if("function"===typeof a)return Fd(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===oa)return 11;if(a===ra)return 14}return 2} -function Ac(a,b){var c=a.alternate;null===c?(c=Of(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.nextEffect=null,c.firstEffect=null,c.lastEffect=null);c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext}; -c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c} -function Cc(a,b,c,d,e,f){var h=2;d=a;if("function"===typeof a)Fd(a)&&(h=1);else if("string"===typeof a)h=5;else a:switch(a){case ja:return Ec(c.children,e,f,b);case ua:h=8;e|=16;break;case ka:h=8;e|=1;break;case la:return a=Of(12,c,b,e|8),a.elementType=la,a.type=la,a.lanes=f,a;case pa:return a=Of(13,c,b,e),a.type=pa,a.elementType=pa,a.lanes=f,a;case qa:return a=Of(19,c,b,e),a.elementType=qa,a.lanes=f,a;case va:return Rd(c,e,f,b);case wa:return a=Of(24,c,b,e),a.elementType=wa,a.lanes=f,a;default:if("object"=== -typeof a&&null!==a)switch(a.$$typeof){case ma:h=10;break a;case na:h=9;break a;case oa:h=11;break a;case ra:h=14;break a;case sa:h=16;d=null;break a;case ta:h=22;break a}throw Error(q(130,null==a?a:typeof a,""));}b=Of(h,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Ec(a,b,c,d){a=Of(7,a,d,b);a.lanes=c;return a}function Rd(a,b,c,d){a=Of(23,a,d,b);a.elementType=va;a.lanes=c;return a}function Bc(a,b,c){a=Of(6,a,null,b);a.lanes=c;return a} -function Dc(a,b,c){b=Of(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b} -function Pf(a,b,c){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.pendingContext=this.context=null;this.hydrate=c;this.callbackNode=null;this.callbackPriority=0;this.eventTimes=ob(0);this.expirationTimes=ob(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=ob(0)} -function Qf(a,b,c){a=new Pf(a,b,c);b=Of(3,null,null,2===b?7:1===b?3:0);a.current=b;b.stateNode=a;ec(b);return a} -function Rf(a,b,c,d){var e=b.current,f=oc(),h=pc(e);a:if(c){c=c._reactInternals;b:{if(Ba(c)!==c||1!==c.tag)throw Error(q(170));var g=c;do{switch(g.tag){case 3:g=g.stateNode.context;break b;case 1:if(E(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break b}}g=g.return}while(null!==g);throw Error(q(171));}if(1===c.tag){var k=c.type;if(E(k)){c=ab(c,k,g);break a}}c=g}else c=Wa;null===b.context?b.context=c:b.pendingContext=c;b=gc(f,h);b.payload={element:a};d=void 0===d?null:d;null!== -d&&(b.callback=d);hc(e,b);qc(e,h,f);return h}function Sf(){return null}var Tf=fa.IsSomeRendererActing,Uf={createNodeMock:function(){return null}}; -function Vf(a){if(a.isHidden)return null;switch(a.tag){case "TEXT":return a.text;case "INSTANCE":var b=a.props;var c=["children"];if(null==b)b={};else{var d={},e=Object.keys(b),f;for(f=0;fag(a).length)break;return bg(a)}a=a.return}return null}},{key:"children",get:function(){return ag(this._currentFiber())}}]);return a}(); -function dg(a,b,c){var d=c?c.deep:!0,e=[];if(b(a)&&(e.push(a),!d))return e;a.children.forEach(function(a){"string"!==typeof a&&e.push.apply(e,dg(a,b,c))});return e}function cg(a,b){if(1===a.length)return a[0];throw Error((0===a.length?"No instances found ":"Expected 1 but found "+a.length+" instances ")+b);}var fg=new WeakMap;function bg(a){var b=fg.get(a);void 0===b&&null!==a.alternate&&(b=fg.get(a.alternate));void 0===b&&(b=new eg(a),fg.set(a,b));return b} -var gg={findFiberByHostInstance:function(){throw Error("TestRenderer does not support findFiberByHostInstance()");},bundleType:0,version:"17.0.2",rendererPackageName:"react-test-renderer"}; -var hg={bundleType:gg.bundleType,version:gg.version,rendererPackageName:gg.rendererPackageName,rendererConfig:gg.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:fa.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){a=Ea(a);return null===a?null:a.stateNode},findFiberByHostInstance:gg.findFiberByHostInstance|| -Sf,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ig=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ig.isDisabled&&ig.supportsFiber)try{db=ig.inject(hg),eb=ig}catch(a){}}function jg(a,b){jest.runOnlyPendingTimers();Le(function(){try{ba.unstable_flushAllWithoutAsserting()?jg(a,b):a()}catch(c){b(c)}})}exports._Scheduler=ba; -exports.act=function(a){function b(){Lf--;Pe.current=c}!1===Mf&&(Mf=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected."));Lf++;var c=Pe.current;Pe.current=!0;try{var d=tf(a)}catch(e){throw b(),e;}if(null!==d&&"object"===typeof d&&"function"===typeof d.then)return{then:function(a,f){d.then(function(){1 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - - return target; - } - - var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - var _assign = ReactInternals.assign; - - var FunctionComponent = 0; - var ClassComponent = 1; - var IndeterminateComponent = 2; // Before we know whether it is function or class - - var HostRoot = 3; // Root of a host tree. Could be nested inside another node. - - var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. - - var HostComponent = 5; - var HostText = 6; - var Fragment = 7; - var Mode = 8; - var ContextConsumer = 9; - var ContextProvider = 10; - var ForwardRef = 11; - var Profiler = 12; - var SuspenseComponent = 13; - var MemoComponent = 14; - var SimpleMemoComponent = 15; - var LazyComponent = 16; - var IncompleteClassComponent = 17; - var DehydratedFragment = 18; - var SuspenseListComponent = 19; - var FundamentalComponent = 20; - var ScopeComponent = 21; - var Block = 22; - var OffscreenComponent = 23; - var LegacyHiddenComponent = 24; - - /** - * `ReactInstanceMap` maintains a mapping from a public facing stateful - * instance (key) and the internal representation (value). This allows public - * methods to accept the user facing instance as an argument and map them back - * to internal methods. - * - * Note that this module is currently shared and assumed to be stateless. - * If this becomes an actual Map, that will break. - */ - function get(key) { - return key._reactInternals; - } - function set(key, value) { - key._reactInternals = value; - } - - // 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_SCOPE_TYPE = 0xead7; - var REACT_OPAQUE_ID_TYPE = 0xeae0; - var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; - var REACT_OFFSCREEN_TYPE = 0xeae2; - 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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); - } - - var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; - } - - function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); - } - - function getContextName(type) { - return type.displayName || 'Context'; - } - - function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; - } - - // Don't change these two values. They're used by React Dev Tools. - var NoFlags = - /* */ - 0; - var PerformedWork = - /* */ - 1; // You can change the rest (and add more). - - var Placement = - /* */ - 2; - var Update = - /* */ - 4; - var PlacementAndUpdate = - /* */ - 6; - var Deletion = - /* */ - 8; - var ContentReset = - /* */ - 16; - var Callback = - /* */ - 32; - var DidCapture = - /* */ - 64; - var Ref = - /* */ - 128; - var Snapshot = - /* */ - 256; - var Passive = - /* */ - 512; // TODO (effects) Remove this bit once the new reconciler is synced to the old. - - var PassiveUnmountPendingDev = - /* */ - 8192; - var Hydrating = - /* */ - 1024; - var HydratingAndUpdate = - /* */ - 1028; // Passive & Update & Callback & Ref & Snapshot - - var LifecycleEffectMask = - /* */ - 932; // Union of all host effects - - var HostEffectMask = - /* */ - 2047; // These are not really side effects, but we still reuse this field. - - var Incomplete = - /* */ - 2048; - var ShouldCapture = - /* */ - 4096; - var ForceUpdateForLegacySuspense = - /* */ - 16384; // Static tags describe aspects of a fiber that are not specific to a render, - - var enableProfilerTimer = true; - var enableFundamentalAPI = false; - var warnAboutStringRefs = false; - var enableNewReconciler = false; - - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; - function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; - - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; - - do { - node = nextNode; - - if ((node.flags & (Placement | Hydrating)) !== NoFlags) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } - - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; - } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - - return null; - } - function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; - } - function isMounted(component) { - { - var owner = ReactCurrentOwner.current; - - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; - - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component'); - } - - instance._warnedAboutRefsInRender = true; - } - } - - var fiber = get(component); - - if (!fiber) { - return false; - } - - return getNearestMountedFiber(fiber) === fiber; - } - - function assertIsMounted(fiber) { - if (!(getNearestMountedFiber(fiber) === fiber)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - } - - function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); - - if (!(nearestMounted !== null)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - - if (nearestMounted !== fiber) { - return null; - } - - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - - - var a = fiber; - var b = alternate; - - while (true) { - var parentA = a.return; - - if (parentA === null) { - // We're at the root. - break; - } - - var parentB = parentA.alternate; - - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; - - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. - - - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. - - - if (parentA.child === parentB.child) { - var child = parentA.child; - - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } - - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } - - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. - - - { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - } - - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; - - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } - - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } - - _child = _child.sibling; - } - - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; - - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } - - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - - _child = _child.sibling; - } - - if (!didFindChild) { - { - throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." ); - } - } - } - } - - if (!(a.alternate === b)) { - { - throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. - - - if (!(a.tag === HostRoot)) { - { - throw Error( "Unable to find node on an unmounted component." ); - } - } - - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. - - - return alternate; - } - function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - - if (!currentParent) { - return null; - } // Next we'll drill down this component to find the first HostComponent/Text. - - - var node = currentParent; - - while (true) { - if (node.tag === HostComponent || node.tag === HostText) { - return node; - } else if (node.child) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === currentParent) { - return null; - } - - while (!node.sibling) { - if (!node.return || node.return === currentParent) { - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } // Flow needs the return null here, but ESLint complains about it. - // eslint-disable-next-line no-unreachable - - - return null; - } - function doesFiberContain(parentFiber, childFiber) { - var node = childFiber; - var parentFiberAlternate = parentFiber.alternate; - - while (node !== null) { - if (node === parentFiber || node === parentFiberAlternate) { - return true; - } - - node = node.return; - } - - return false; - } - - // can re-export everything from this module. - - function shim() { - { - { - throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } // Hydration (when unsupported) - var isSuspenseInstancePending = shim; - var isSuspenseInstanceFallback = shim; - var hydrateTextInstance = shim; - - var NO_CONTEXT = {}; - var UPDATE_SIGNAL = {}; - var nodeToInstanceMap = new WeakMap(); - - { - Object.freeze(NO_CONTEXT); - Object.freeze(UPDATE_SIGNAL); - } - - function getPublicInstance(inst) { - switch (inst.tag) { - case 'INSTANCE': - var createNodeMock = inst.rootContainerInstance.createNodeMock; - var mockNode = createNodeMock({ - type: inst.type, - props: inst.props - }); - - if (typeof mockNode === 'object' && mockNode !== null) { - nodeToInstanceMap.set(mockNode, inst); - } - - return mockNode; - - default: - return inst; - } - } - function appendChild(parentInstance, child) { - { - if (!Array.isArray(parentInstance.children)) { - error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); - } - } - - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - parentInstance.children.push(child); - } - function insertBefore(parentInstance, child, beforeChild) { - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - var beforeIndex = parentInstance.children.indexOf(beforeChild); - parentInstance.children.splice(beforeIndex, 0, child); - } - function removeChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - parentInstance.children.splice(index, 1); - } - function clearContainer(container) { - container.children.splice(0); - } - function getRootHostContext(rootContainerInstance) { - return NO_CONTEXT; - } - function getChildHostContext(parentHostContext, type, rootContainerInstance) { - return NO_CONTEXT; - } - function prepareForCommit(containerInfo) { - // noop - return null; - } - function resetAfterCommit(containerInfo) {// noop - } - function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - type: type, - props: props, - isHidden: false, - children: [], - internalInstanceHandle: internalInstanceHandle, - rootContainerInstance: rootContainerInstance, - tag: 'INSTANCE' - }; - } - function appendInitialChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - - if (index !== -1) { - parentInstance.children.splice(index, 1); - } - - parentInstance.children.push(child); - } - function prepareUpdate(testElement, type, oldProps, newProps, rootContainerInstance, hostContext) { - return UPDATE_SIGNAL; - } - function shouldSetTextContent(type, props) { - return false; - } - function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - text: text, - isHidden: false, - tag: 'TEXT' - }; - } - var scheduleTimeout = setTimeout; - var cancelTimeout = clearTimeout; - var noTimeout = -1; // ------------------- - function commitUpdate(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle) { - instance.type = type; - instance.props = newProps; - } - function commitTextUpdate(textInstance, oldText, newText) { - textInstance.text = newText; - } - function resetTextContent(testElement) {// noop - } - var appendChildToContainer = appendChild; - var insertInContainerBefore = insertBefore; - var removeChildFromContainer = removeChild; - function hideInstance(instance) { - instance.isHidden = true; - } - function hideTextInstance(textInstance) { - textInstance.isHidden = true; - } - function unhideInstance(instance, props) { - instance.isHidden = false; - } - function unhideTextInstance(textInstance, text) { - textInstance.isHidden = false; - } - var clientId = 0; - function makeClientIdInDEV(warnOnAccessInDEV) { - var id = 'c_' + (clientId++).toString(36); - return { - toString: function () { - warnOnAccessInDEV(); - return id; - }, - valueOf: function () { - warnOnAccessInDEV(); - return id; - } - }; - } - function preparePortalMount(portalInstance) {// noop - } - - // Helpers to patch console.logs to avoid logging during side-effect free - // replaying on render function. This currently only patches the object - // lazily which won't cover if the log function was extracted eagerly. - // We could also eagerly patch the method. - var disabledDepth = 0; - var prevLog; - var prevInfo; - var prevWarn; - var prevError; - var prevGroup; - var prevGroupCollapsed; - var prevGroupEnd; - - function disabledLog() {} - - disabledLog.__reactDisabledLog = true; - function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } - } - function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: _assign({}, props, { - value: prevLog - }), - info: _assign({}, props, { - value: prevInfo - }), - warn: _assign({}, props, { - value: prevWarn - }), - error: _assign({}, props, { - value: prevError - }), - group: _assign({}, props, { - value: prevGroup - }), - groupCollapsed: _assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: _assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } - } - - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; - var prefix; - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } - } - var reentry = false; - var componentFrameCache; - - { - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); - } - - function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; - } - - function describeClassComponentFrame(ctor, source, ownerFn) { - { - return describeNativeComponentFrame(ctor, true); - } - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } - } - - function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; - } - - var loggedTypeFailures = {}; - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); - } - } - } - - function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } - } - - var valueStack = []; - var fiberStack; - - { - fiberStack = []; - } - - var index = -1; - - function createCursor(defaultValue) { - return { - current: defaultValue - }; - } - - function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); - } - - return; - } - - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); - } - } - - cursor.current = valueStack[index]; - valueStack[index] = null; - - { - fiberStack[index] = null; - } - - index--; - } - - function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; - - { - fiberStack[index] = fiber; - } - - cursor.current = value; - } - - var warnedAboutMissingGetChildContext; - - { - warnedAboutMissingGetChildContext = {}; - } - - var emptyContextObject = {}; - - { - Object.freeze(emptyContextObject); - } // A cursor to the current merged context object on the stack. - - - var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. - - var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. - // We use this to get access to the parent context after we have already - // pushed the next context provider, and now need to merge their contexts. - - var previousContext = emptyContextObject; - - function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { - { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; - } - - return contextStackCursor.current; - } - } - - function cacheContext(workInProgress, unmaskedContext, maskedContext) { - { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } - } - - function getMaskedContext(workInProgress, unmaskedContext) { - { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - - if (!contextTypes) { - return emptyContextObject; - } // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. - - - var instance = workInProgress.stateNode; - - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; - } - - var context = {}; - - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } - - { - var name = getComponentName(type) || 'Unknown'; - checkPropTypes(contextTypes, context, 'context', name); - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - - - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); - } - - return context; - } - } - - function hasContextChanged() { - { - return didPerformWorkStackCursor.current; - } - } - - function isContextProvider(type) { - { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; - } - } - - function popContext(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } - } - - function popTopLevelContextObject(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor, fiber); - } - } - - function pushTopLevelContextObject(fiber, context, didChange) { - { - if (!(contextStackCursor.current === emptyContextObject)) { - { - throw Error( "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - push(contextStackCursor, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); - } - } - - function processChildContext(fiber, type, parentContext) { - { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentName(type) || 'Unknown'; - - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - - error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } - - return parentContext; - } - - var childContext = instance.getChildContext(); - - for (var contextKey in childContext) { - if (!(contextKey in childContextTypes)) { - { - throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." ); - } - } - } - - { - var name = getComponentName(type) || 'Unknown'; - checkPropTypes(childContextTypes, childContext, 'child context', name); - } - - return _assign({}, parentContext, childContext); - } - } - - function pushContextProvider(workInProgress) { - { - var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. - - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - - previousContext = contextStackCursor.current; - push(contextStackCursor, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); - return true; - } - } - - function invalidateContextProvider(workInProgress, type, didChange) { - { - var instance = workInProgress.stateNode; - - if (!instance) { - { - throw Error( "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, type, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. - - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. - - push(contextStackCursor, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } - } - } - - function findCurrentUnmaskedContext(fiber) { - { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) { - { - throw Error( "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var node = fiber; - - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - - case ClassComponent: - { - var Component = node.type; - - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - - break; - } - } - - node = node.return; - } while (node !== null); - - { - { - throw Error( "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - } - - var LegacyRoot = 0; - var BlockingRoot = 1; - var ConcurrentRoot = 2; - - var rendererID = null; - var injectedHook = null; - var hasLoggedError = false; - var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; - function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } - - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } - - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://reactjs.org/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. - - - return true; - } - - try { - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. - - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); - } - } // DevTools exists - - - return true; - } - function onScheduleRoot(root, children) { - { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if ( !hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } - } - function onCommitRoot(root, priorityLevel) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; - - if (enableProfilerTimer) { - injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); - } else { - injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } - } - function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } - } - - var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - var _ReactInternals$Sched = ReactInternals$1.SchedulerTracing, - __interactionsRef = _ReactInternals$Sched.__interactionsRef, - __subscriberRef = _ReactInternals$Sched.__subscriberRef, - unstable_clear = _ReactInternals$Sched.unstable_clear, - unstable_getCurrent = _ReactInternals$Sched.unstable_getCurrent, - unstable_getThreadID = _ReactInternals$Sched.unstable_getThreadID, - unstable_subscribe = _ReactInternals$Sched.unstable_subscribe, - unstable_trace = _ReactInternals$Sched.unstable_trace, - unstable_unsubscribe = _ReactInternals$Sched.unstable_unsubscribe, - unstable_wrap = _ReactInternals$Sched.unstable_wrap; - - var Scheduler_now = Scheduler$1.unstable_now; - - { - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if (!(__interactionsRef != null && __interactionsRef.current != null)) { - { - throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" ); - } - } - } - // ascending numbers so we can compare them like numbers. They start at 90 to - // avoid clashing with Scheduler's priorities. - - var ImmediatePriority = 99; - var UserBlockingPriority = 98; - var NormalPriority = 97; - var LowPriority = 96; - var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only. - - var NoPriority = 90; - var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. - - var SyncLanePriority = 15; - var SyncBatchedLanePriority = 14; - var InputDiscreteHydrationLanePriority = 13; - var InputDiscreteLanePriority = 12; - var InputContinuousHydrationLanePriority = 11; - var InputContinuousLanePriority = 10; - var DefaultHydrationLanePriority = 9; - var DefaultLanePriority = 8; - var TransitionHydrationPriority = 7; - var TransitionPriority = 6; - var RetryLanePriority = 5; - var SelectiveHydrationLanePriority = 4; - var IdleHydrationLanePriority = 3; - var IdleLanePriority = 2; - var OffscreenLanePriority = 1; - var NoLanePriority = 0; - var TotalLanes = 31; - var NoLanes = - /* */ - 0; - var NoLane = - /* */ - 0; - var SyncLane = - /* */ - 1; - var SyncBatchedLane = - /* */ - 2; - var InputDiscreteHydrationLane = - /* */ - 4; - var InputDiscreteLanes = - /* */ - 24; - var InputContinuousHydrationLane = - /* */ - 32; - var InputContinuousLanes = - /* */ - 192; - var DefaultHydrationLane = - /* */ - 256; - var DefaultLanes = - /* */ - 3584; - var TransitionHydrationLane = - /* */ - 4096; - var TransitionLanes = - /* */ - 4186112; - var RetryLanes = - /* */ - 62914560; - var SomeRetryLane = - /* */ - 33554432; - var SelectiveHydrationLane = - /* */ - 67108864; - var NonIdleLanes = - /* */ - 134217727; - var IdleHydrationLane = - /* */ - 134217728; - var IdleLanes = - /* */ - 805306368; - var OffscreenLane = - /* */ - 1073741824; - var NoTimestamp = -1; - // Used by getHighestPriorityLanes and getNextLanes: - - var return_highestLanePriority = DefaultLanePriority; - - function getHighestPriorityLanes(lanes) { - if ((SyncLane & lanes) !== NoLanes) { - return_highestLanePriority = SyncLanePriority; - return SyncLane; - } - - if ((SyncBatchedLane & lanes) !== NoLanes) { - return_highestLanePriority = SyncBatchedLanePriority; - return SyncBatchedLane; - } - - if ((InputDiscreteHydrationLane & lanes) !== NoLanes) { - return_highestLanePriority = InputDiscreteHydrationLanePriority; - return InputDiscreteHydrationLane; - } - - var inputDiscreteLanes = InputDiscreteLanes & lanes; - - if (inputDiscreteLanes !== NoLanes) { - return_highestLanePriority = InputDiscreteLanePriority; - return inputDiscreteLanes; - } - - if ((lanes & InputContinuousHydrationLane) !== NoLanes) { - return_highestLanePriority = InputContinuousHydrationLanePriority; - return InputContinuousHydrationLane; - } - - var inputContinuousLanes = InputContinuousLanes & lanes; - - if (inputContinuousLanes !== NoLanes) { - return_highestLanePriority = InputContinuousLanePriority; - return inputContinuousLanes; - } - - if ((lanes & DefaultHydrationLane) !== NoLanes) { - return_highestLanePriority = DefaultHydrationLanePriority; - return DefaultHydrationLane; - } - - var defaultLanes = DefaultLanes & lanes; - - if (defaultLanes !== NoLanes) { - return_highestLanePriority = DefaultLanePriority; - return defaultLanes; - } - - if ((lanes & TransitionHydrationLane) !== NoLanes) { - return_highestLanePriority = TransitionHydrationPriority; - return TransitionHydrationLane; - } - - var transitionLanes = TransitionLanes & lanes; - - if (transitionLanes !== NoLanes) { - return_highestLanePriority = TransitionPriority; - return transitionLanes; - } - - var retryLanes = RetryLanes & lanes; - - if (retryLanes !== NoLanes) { - return_highestLanePriority = RetryLanePriority; - return retryLanes; - } - - if (lanes & SelectiveHydrationLane) { - return_highestLanePriority = SelectiveHydrationLanePriority; - return SelectiveHydrationLane; - } - - if ((lanes & IdleHydrationLane) !== NoLanes) { - return_highestLanePriority = IdleHydrationLanePriority; - return IdleHydrationLane; - } - - var idleLanes = IdleLanes & lanes; - - if (idleLanes !== NoLanes) { - return_highestLanePriority = IdleLanePriority; - return idleLanes; - } - - if ((OffscreenLane & lanes) !== NoLanes) { - return_highestLanePriority = OffscreenLanePriority; - return OffscreenLane; - } - - { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - - - return_highestLanePriority = DefaultLanePriority; - return lanes; - } - - function schedulerPriorityToLanePriority(schedulerPriorityLevel) { - switch (schedulerPriorityLevel) { - case ImmediatePriority: - return SyncLanePriority; - - case UserBlockingPriority: - return InputContinuousLanePriority; - - case NormalPriority: - case LowPriority: - // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration. - return DefaultLanePriority; - - case IdlePriority: - return IdleLanePriority; - - default: - return NoLanePriority; - } - } - function lanePriorityToSchedulerPriority(lanePriority) { - switch (lanePriority) { - case SyncLanePriority: - case SyncBatchedLanePriority: - return ImmediatePriority; - - case InputDiscreteHydrationLanePriority: - case InputDiscreteLanePriority: - case InputContinuousHydrationLanePriority: - case InputContinuousLanePriority: - return UserBlockingPriority; - - case DefaultHydrationLanePriority: - case DefaultLanePriority: - case TransitionHydrationPriority: - case TransitionPriority: - case SelectiveHydrationLanePriority: - case RetryLanePriority: - return NormalPriority; - - case IdleHydrationLanePriority: - case IdleLanePriority: - case OffscreenLanePriority: - return IdlePriority; - - case NoLanePriority: - return NoPriority; - - default: - { - { - throw Error( "Invalid update priority: " + lanePriority + ". This is a bug in React." ); - } - } - - } - } - function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; - - if (pendingLanes === NoLanes) { - return_highestLanePriority = NoLanePriority; - return NoLanes; - } - - var nextLanes = NoLanes; - var nextLanePriority = NoLanePriority; - var expiredLanes = root.expiredLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Check if any work has expired. - - if (expiredLanes !== NoLanes) { - nextLanes = expiredLanes; - nextLanePriority = return_highestLanePriority = SyncLanePriority; - } else { - // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - nextLanePriority = return_highestLanePriority; - } - } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; - - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - nextLanePriority = return_highestLanePriority; - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - nextLanePriority = return_highestLanePriority; - } - } - } - } - - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If there are higher priority lanes, we'll include them even if they - // are suspended. - - - nextLanes = pendingLanes & getEqualOrHigherPriorityLanes(nextLanes); // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. - - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - getHighestPriorityLanes(wipLanes); - var wipLanePriority = return_highestLanePriority; - - if (nextLanePriority <= wipLanePriority) { - return wipLanes; - } else { - return_highestLanePriority = nextLanePriority; - } - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // - // For those exceptions where entanglement is semantically important, like - // useMutableSource, we should ensure that there is no partial work at the - // time we apply the entanglement. - - - var entangledLanes = root.entangledLanes; - - if (entangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = nextLanes & entangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - nextLanes |= entanglements[index]; - lanes &= ~lane; - } - } - - return nextLanes; - } - function getMostRecentEventTime(root, lanes) { - var eventTimes = root.eventTimes; - var mostRecentEventTime = NoTimestamp; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var eventTime = eventTimes[index]; - - if (eventTime > mostRecentEventTime) { - mostRecentEventTime = eventTime; - } - - lanes &= ~lane; - } - - return mostRecentEventTime; - } - - function computeExpirationTime(lane, currentTime) { - // TODO: Expiration heuristic is constant per lane, so could use a map. - getHighestPriorityLanes(lane); - var priority = return_highestLanePriority; - - if (priority >= InputContinuousLanePriority) { - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. When - // we made it larger, a product metric in www regressed, suggesting there's - // a user interaction that's being starved by a series of synchronous - // updates. If that theory is correct, the proper solution is to fix the - // starvation. However, this scenario supports the idea that expiration - // times are an important safeguard when starvation does happen. - // - // Also note that, in the case of user input specifically, this will soon no - // longer be an issue because we plan to make user input synchronous by - // default (until you enter `startTransition`, of course.) - // - // If weren't planning to make these updates synchronous soon anyway, I - // would probably make this number a configurable parameter. - return currentTime + 250; - } else if (priority >= TransitionPriority) { - return currentTime + 5000; - } else { - // Anything idle priority or lower should never expire. - return NoTimestamp; - } - } - - function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - - var lanes = pendingLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; - - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; - } - - lanes &= ~lane; - } - } // This returns the highest priority pending lanes regardless of whether they - function getLanesToRetrySynchronouslyOnError(root) { - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; - } - - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; - } - - return NoLanes; - } - function returnNextLanesPriority() { - return return_highestLanePriority; - } - function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; - } - function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; - } - function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; - } // To ensure consistency across multiple updates in the same event, this should - // be a pure function, so that it always returns the same lane for given inputs. - - function findUpdateLane(lanePriority, wipLanes) { - switch (lanePriority) { - case NoLanePriority: - break; - - case SyncLanePriority: - return SyncLane; - - case SyncBatchedLanePriority: - return SyncBatchedLane; - - case InputDiscreteLanePriority: - { - var _lane = pickArbitraryLane(InputDiscreteLanes & ~wipLanes); - - if (_lane === NoLane) { - // Shift to the next priority level - return findUpdateLane(InputContinuousLanePriority, wipLanes); - } - - return _lane; - } - - case InputContinuousLanePriority: - { - var _lane2 = pickArbitraryLane(InputContinuousLanes & ~wipLanes); - - if (_lane2 === NoLane) { - // Shift to the next priority level - return findUpdateLane(DefaultLanePriority, wipLanes); - } - - return _lane2; - } - - case DefaultLanePriority: - { - var _lane3 = pickArbitraryLane(DefaultLanes & ~wipLanes); - - if (_lane3 === NoLane) { - // If all the default lanes are already being worked on, look for a - // lane in the transition range. - _lane3 = pickArbitraryLane(TransitionLanes & ~wipLanes); - - if (_lane3 === NoLane) { - // All the transition lanes are taken, too. This should be very - // rare, but as a last resort, pick a default lane. This will have - // the effect of interrupting the current work-in-progress render. - _lane3 = pickArbitraryLane(DefaultLanes); - } - } - - return _lane3; - } - - case TransitionPriority: // Should be handled by findTransitionLane instead - - case RetryLanePriority: - // Should be handled by findRetryLane instead - break; - - case IdleLanePriority: - var lane = pickArbitraryLane(IdleLanes & ~wipLanes); - - if (lane === NoLane) { - lane = pickArbitraryLane(IdleLanes); - } - - return lane; - } - - { - { - throw Error( "Invalid update priority: " + lanePriority + ". This is a bug in React." ); - } - } - } // To ensure consistency across multiple updates in the same event, this should - // be pure function, so that it always returns the same lane for given inputs. - - function findTransitionLane(wipLanes, pendingLanes) { - // First look for lanes that are completely unclaimed, i.e. have no - // pending work. - var lane = pickArbitraryLane(TransitionLanes & ~pendingLanes); - - if (lane === NoLane) { - // If all lanes have pending work, look for a lane that isn't currently - // being worked on. - lane = pickArbitraryLane(TransitionLanes & ~wipLanes); - - if (lane === NoLane) { - // If everything is being worked on, pick any lane. This has the - // effect of interrupting the current work-in-progress. - lane = pickArbitraryLane(TransitionLanes); - } - } - - return lane; - } // To ensure consistency across multiple updates in the same event, this should - // be pure function, so that it always returns the same lane for given inputs. - - function findRetryLane(wipLanes) { - // This is a fork of `findUpdateLane` designed specifically for Suspense - // "retries" — a special update that attempts to flip a Suspense boundary - // from its placeholder state to its primary/resolved state. - var lane = pickArbitraryLane(RetryLanes & ~wipLanes); - - if (lane === NoLane) { - lane = pickArbitraryLane(RetryLanes); - } - - return lane; - } - - function getHighestPriorityLane(lanes) { - return lanes & -lanes; - } - - function getLowestPriorityLane(lanes) { - // This finds the most significant non-zero bit. - var index = 31 - clz32(lanes); - return index < 0 ? NoLanes : 1 << index; - } - - function getEqualOrHigherPriorityLanes(lanes) { - return (getLowestPriorityLane(lanes) << 1) - 1; - } - - function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); - } - - function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); - } - - function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); - } - - function includesSomeLane(a, b) { - return (a & b) !== NoLanes; - } - function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; - } - function mergeLanes(a, b) { - return a | b; - } - function removeLanes(set, subset) { - return set & ~subset; - } // Seems redundant, but it changes the type from a single lane (used for - // updates) to a group of lanes (used for flushing work). - - function laneToLanes(lane) { - return lane; - } - function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; - - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); - } - - return laneMap; - } - function markRootUpdated(root, updateLane, eventTime) { - root.pendingLanes |= updateLane; // TODO: Theoretically, any update to any lane can unblock any other lane. But - // it's not practical to try every single possible combination. We need a - // heuristic to decide which lanes to attempt to render, and in which batches. - // For now, we use the same heuristic as in the old ExpirationTimes model: - // retry any lane at equal or lower priority, but don't try updates at higher - // priority without also including the lower priority updates. This works well - // when considering updates across different priority levels, but isn't - // sufficient for updates within the same priority, since we want to treat - // those updates as parallel. - // Unsuspend any update at equal or lower priority. - - var higherPriorityLanes = updateLane - 1; // Turns 0b1000 into 0b0111 - - root.suspendedLanes &= higherPriorityLanes; - root.pingedLanes &= higherPriorityLanes; - var eventTimes = root.eventTimes; - var index = laneToIndex(updateLane); // We can always overwrite an existing timestamp because we prefer the most - // recent event, and we assume time is monotonically increasing. - - eventTimes[index] = eventTime; - } - function markRootSuspended(root, suspendedLanes) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. - - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } - } - function markRootPinged(root, pingedLanes, eventTime) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; - } - function hasDiscreteLanes(lanes) { - return (lanes & InputDiscreteLanes) !== NoLanes; - } - function markRootMutableRead(root, updateLane) { - root.mutableReadLanes |= updateLane & root.pendingLanes; - } - function markRootFinished(root, remainingLanes) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again - - root.suspendedLanes = 0; - root.pingedLanes = 0; - root.expiredLanes &= remainingLanes; - root.mutableReadLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - var entanglements = root.entanglements; - var eventTimes = root.eventTimes; - var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work - - var lanes = noLongerPendingLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - eventTimes[index] = NoTimestamp; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } - } - function markRootEntangled(root, entangledLanes) { - root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = entangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] |= entangledLanes; - lanes &= ~lane; - } - } - var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. Only used on lanes, so assume input is an integer. - // Based on: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 - - var log = Math.log; - var LN2 = Math.LN2; - - function clz32Fallback(lanes) { - if (lanes === 0) { - return 32; - } - - return 31 - (log(lanes) / LN2 | 0) | 0; - } - - var Scheduler_runWithPriority = Scheduler$1.unstable_runWithPriority, - Scheduler_scheduleCallback = Scheduler$1.unstable_scheduleCallback, - Scheduler_cancelCallback = Scheduler$1.unstable_cancelCallback, - Scheduler_shouldYield = Scheduler$1.unstable_shouldYield, - Scheduler_requestPaint = Scheduler$1.unstable_requestPaint, - Scheduler_now$1 = Scheduler$1.unstable_now, - Scheduler_getCurrentPriorityLevel = Scheduler$1.unstable_getCurrentPriorityLevel, - Scheduler_ImmediatePriority = Scheduler$1.unstable_ImmediatePriority, - Scheduler_UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority, - Scheduler_NormalPriority = Scheduler$1.unstable_NormalPriority, - Scheduler_LowPriority = Scheduler$1.unstable_LowPriority, - Scheduler_IdlePriority = Scheduler$1.unstable_IdlePriority; - - { - // Provide explicit error message when production+profiling bundle of e.g. - // react-dom is used with production (non-profiling) bundle of - // scheduler/tracing - if (!(__interactionsRef != null && __interactionsRef.current != null)) { - { - throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling" ); - } - } - } - - var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use - // ascending numbers so we can compare them like numbers. They start at 90 to - // avoid clashing with Scheduler's priorities. - - var ImmediatePriority$1 = 99; - var UserBlockingPriority$1 = 98; - var NormalPriority$1 = 97; - var LowPriority$1 = 96; - var IdlePriority$1 = 95; // NoPriority is the absence of priority. Also React-only. - - var NoPriority$1 = 90; - var shouldYield = Scheduler_shouldYield; - var requestPaint = // Fall back gracefully if we're running an older version of Scheduler. - Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {}; - var syncQueue = null; - var immediateQueueCallbackNode = null; - var isFlushingSyncQueue = false; - var initialTimeMs$1 = Scheduler_now$1(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. - // This will be the case for modern browsers that support `performance.now`. In - // older browsers, Scheduler falls back to `Date.now`, which returns a Unix - // timestamp. In that case, subtract the module initialization time to simulate - // the behavior of performance.now and keep our times small enough to fit - // within 32 bits. - // TODO: Consider lifting this into Scheduler. - - var now = initialTimeMs$1 < 10000 ? Scheduler_now$1 : function () { - return Scheduler_now$1() - initialTimeMs$1; - }; - function getCurrentPriorityLevel() { - switch (Scheduler_getCurrentPriorityLevel()) { - case Scheduler_ImmediatePriority: - return ImmediatePriority$1; - - case Scheduler_UserBlockingPriority: - return UserBlockingPriority$1; - - case Scheduler_NormalPriority: - return NormalPriority$1; - - case Scheduler_LowPriority: - return LowPriority$1; - - case Scheduler_IdlePriority: - return IdlePriority$1; - - default: - { - { - throw Error( "Unknown priority level." ); - } - } - - } - } - - function reactPriorityToSchedulerPriority(reactPriorityLevel) { - switch (reactPriorityLevel) { - case ImmediatePriority$1: - return Scheduler_ImmediatePriority; - - case UserBlockingPriority$1: - return Scheduler_UserBlockingPriority; - - case NormalPriority$1: - return Scheduler_NormalPriority; - - case LowPriority$1: - return Scheduler_LowPriority; - - case IdlePriority$1: - return Scheduler_IdlePriority; - - default: - { - { - throw Error( "Unknown priority level." ); - } - } - - } - } - - function runWithPriority(reactPriorityLevel, fn) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_runWithPriority(priorityLevel, fn); - } - function scheduleCallback(reactPriorityLevel, callback, options) { - var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); - return Scheduler_scheduleCallback(priorityLevel, callback, options); - } - function scheduleSyncCallback(callback) { - // Push this callback into an internal queue. We'll flush these either in - // the next tick, or earlier if something calls `flushSyncCallbackQueue`. - if (syncQueue === null) { - syncQueue = [callback]; // Flush the queue in the next tick, at the earliest. - - immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl); - } else { - // Push onto existing queue. Don't need to schedule a callback because - // we already scheduled one when we created the queue. - syncQueue.push(callback); - } - - return fakeCallbackNode; - } - function cancelCallback(callbackNode) { - if (callbackNode !== fakeCallbackNode) { - Scheduler_cancelCallback(callbackNode); - } - } - function flushSyncCallbackQueue() { - if (immediateQueueCallbackNode !== null) { - var node = immediateQueueCallbackNode; - immediateQueueCallbackNode = null; - Scheduler_cancelCallback(node); - } - - flushSyncCallbackQueueImpl(); - } - - function flushSyncCallbackQueueImpl() { - if (!isFlushingSyncQueue && syncQueue !== null) { - // Prevent re-entrancy. - isFlushingSyncQueue = true; - var i = 0; - - { - try { - var _isSync2 = true; - var _queue = syncQueue; - runWithPriority(ImmediatePriority$1, function () { - for (; i < _queue.length; i++) { - var callback = _queue[i]; - - do { - callback = callback(_isSync2); - } while (callback !== null); - } - }); - syncQueue = null; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - if (syncQueue !== null) { - syncQueue = syncQueue.slice(i + 1); - } // Resume flushing in the next tick - - - Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue); - throw error; - } finally { - isFlushingSyncQueue = false; - } - } - } - } - - // TODO: this is special because it gets imported during build. - var ReactVersion = '17.0.2'; - - var NoMode = 0; - var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root - // tag instead - - var BlockingMode = 2; - var ConcurrentMode = 4; - var ProfileMode = 8; - var DebugTracingMode = 16; - - var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; - var NoTransition = 0; - function requestCurrentTransition() { - return ReactCurrentBatchConfig.transition; - } - - /** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ - function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; - } - - var objectIs = typeof Object.is === 'function' ? Object.is : is; - - var hasOwnProperty = Object.prototype.hasOwnProperty; - /** - * Performs equality by iterating through keys on an object and returning false - * when any key has values which are not strictly equal between the arguments. - * Returns true when the values of all keys are strictly equal. - */ - - function shallowEqual(objA, objB) { - if (objectIs(objA, objB)) { - return true; - } - - if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; - } // Test for A's keys different from B. - - - for (var i = 0; i < keysA.length; i++) { - if (!hasOwnProperty.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) { - return false; - } - } - - return true; - } - - function describeFiber(fiber) { - var owner = fiber._debugOwner ? fiber._debugOwner.type : null ; - var source = fiber._debugSource ; - - switch (fiber.tag) { - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case IndeterminateComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case Block: - return describeFunctionComponentFrame(fiber.type._render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } - } - - function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } - } - - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - var current = null; - var isRendering = false; - function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner !== null && typeof owner !== 'undefined') { - return getComponentName(owner.type); - } - } - - return null; - } - - function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } - } - - function resetCurrentFiber() { - { - ReactDebugCurrentFrame$1.getCurrentStack = null; - current = null; - isRendering = false; - } - } - function setCurrentFiber(fiber) { - { - ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } - } - function setIsRendering(rendering) { - { - isRendering = rendering; - } - } - function getIsRendering() { - { - return isRendering; - } - } - - var ReactStrictModeWarnings = { - recordUnsafeLifecycleWarnings: function (fiber, instance) {}, - flushPendingUnsafeLifecycleWarnings: function () {}, - recordLegacyContextWarning: function (fiber, instance) {}, - flushLegacyContextWarning: function () {}, - discardPendingWarnings: function () {} - }; - - { - var findStrictRoot = function (fiber) { - var maybeStrictRoot = null; - var node = fiber; - - while (node !== null) { - if (node.mode & StrictMode) { - maybeStrictRoot = node; - } - - node = node.return; - } - - return maybeStrictRoot; - }; - - var setToSortedString = function (set) { - var array = []; - set.forEach(function (value) { - array.push(value); - }); - return array.sort().join(', '); - }; - - var pendingComponentWillMountWarnings = []; - var pendingUNSAFE_ComponentWillMountWarnings = []; - var pendingComponentWillReceivePropsWarnings = []; - var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - var pendingComponentWillUpdateWarnings = []; - var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. - - var didWarnAboutUnsafeLifecycles = new Set(); - - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { - // Dedup strategy: Warn once per component. - if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { - return; - } - - if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components. - instance.componentWillMount.__suppressDeprecationWarning !== true) { - pendingComponentWillMountWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') { - pendingUNSAFE_ComponentWillMountWarnings.push(fiber); - } - - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - pendingComponentWillReceivePropsWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); - } - - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - pendingComponentWillUpdateWarnings.push(fiber); - } - - if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') { - pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); - } - }; - - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { - // We do an initial pass to gather component names - var componentWillMountUniqueNames = new Set(); - - if (pendingComponentWillMountWarnings.length > 0) { - pendingComponentWillMountWarnings.forEach(function (fiber) { - componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillMountWarnings = []; - } - - var UNSAFE_componentWillMountUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { - pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) { - UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillMountWarnings = []; - } - - var componentWillReceivePropsUniqueNames = new Set(); - - if (pendingComponentWillReceivePropsWarnings.length > 0) { - pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { - componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillReceivePropsWarnings = []; - } - - var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { - pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) { - UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - } - - var componentWillUpdateUniqueNames = new Set(); - - if (pendingComponentWillUpdateWarnings.length > 0) { - pendingComponentWillUpdateWarnings.forEach(function (fiber) { - componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingComponentWillUpdateWarnings = []; - } - - var UNSAFE_componentWillUpdateUniqueNames = new Set(); - - if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { - pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) { - UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutUnsafeLifecycles.add(fiber.type); - }); - pendingUNSAFE_ComponentWillUpdateWarnings = []; - } // Finally, we flush all the warnings - // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' - - - if (UNSAFE_componentWillMountUniqueNames.size > 0) { - var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); - - error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames); - } - - if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { - var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); - - error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '\nPlease update the following components: %s', _sortedNames); - } - - if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { - var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); - - error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2); - } - - if (componentWillMountUniqueNames.size > 0) { - var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); - - warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3); - } - - if (componentWillReceivePropsUniqueNames.size > 0) { - var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); - - warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4); - } - - if (componentWillUpdateUniqueNames.size > 0) { - var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); - - warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5); - } - }; - - var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. - - var didWarnAboutLegacyContext = new Set(); - - ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) { - var strictRoot = findStrictRoot(fiber); - - if (strictRoot === null) { - error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - - return; - } // Dedup strategy: Warn once per component. - - - if (didWarnAboutLegacyContext.has(fiber.type)) { - return; - } - - var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); - - if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') { - if (warningsForRoot === undefined) { - warningsForRoot = []; - pendingLegacyContextWarning.set(strictRoot, warningsForRoot); - } - - warningsForRoot.push(fiber); - } - }; - - ReactStrictModeWarnings.flushLegacyContextWarning = function () { - pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) { - if (fiberArray.length === 0) { - return; - } - - var firstFiber = fiberArray[0]; - var uniqueNames = new Set(); - fiberArray.forEach(function (fiber) { - uniqueNames.add(getComponentName(fiber.type) || 'Component'); - didWarnAboutLegacyContext.add(fiber.type); - }); - var sortedNames = setToSortedString(uniqueNames); - - try { - setCurrentFiber(firstFiber); - - error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context', sortedNames); - } finally { - resetCurrentFiber(); - } - }); - }; - - ReactStrictModeWarnings.discardPendingWarnings = function () { - pendingComponentWillMountWarnings = []; - pendingUNSAFE_ComponentWillMountWarnings = []; - pendingComponentWillReceivePropsWarnings = []; - pendingUNSAFE_ComponentWillReceivePropsWarnings = []; - pendingComponentWillUpdateWarnings = []; - pendingUNSAFE_ComponentWillUpdateWarnings = []; - pendingLegacyContextWarning = new Map(); - }; - } - - function resolveDefaultProps(Component, baseProps) { - if (Component && Component.defaultProps) { - // Resolve default props. Taken from ReactElement - var props = _assign({}, baseProps); - - var defaultProps = Component.defaultProps; - - for (var propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - - return props; - } - - return baseProps; - } - - // Max 31 bit integer. The max integer size in V8 for 32-bit systems. - // Math.pow(2, 30) - 1 - // 0b111111111111111111111111111111 - var MAX_SIGNED_31_BIT_INT = 1073741823; - - var valueCursor = createCursor(null); - var rendererSigil; - - { - // Use this to detect multiple renderers using the same context - rendererSigil = {}; - } - - var currentlyRenderingFiber = null; - var lastContextDependency = null; - var lastContextWithAllBitsObserved = null; - var isDisallowedContextReadInDEV = false; - function resetContextDependencies() { - // This is called right before React yields execution, to ensure `readContext` - // cannot be called outside the render phase. - currentlyRenderingFiber = null; - lastContextDependency = null; - lastContextWithAllBitsObserved = null; - - { - isDisallowedContextReadInDEV = false; - } - } - function enterDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = true; - } - } - function exitDisallowedContextReadInDEV() { - { - isDisallowedContextReadInDEV = false; - } - } - function pushProvider(providerFiber, nextValue) { - var context = providerFiber.type._context; - - { - push(valueCursor, context._currentValue2, providerFiber); - context._currentValue2 = nextValue; - - { - if (context._currentRenderer2 !== undefined && context._currentRenderer2 !== null && context._currentRenderer2 !== rendererSigil) { - error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); - } - - context._currentRenderer2 = rendererSigil; - } - } - } - function popProvider(providerFiber) { - var currentValue = valueCursor.current; - pop(valueCursor, providerFiber); - var context = providerFiber.type._context; - - { - context._currentValue2 = currentValue; - } - } - function calculateChangedBits(context, newValue, oldValue) { - if (objectIs(oldValue, newValue)) { - // No change - return 0; - } else { - var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; - - { - if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) { - error('calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits); - } - } - - return changedBits | 0; - } - } - function scheduleWorkOnParentPath(parent, renderLanes) { - // Update the child lanes of all the ancestors, including the alternates. - var node = parent; - - while (node !== null) { - var alternate = node.alternate; - - if (!isSubsetOfLanes(node.childLanes, renderLanes)) { - node.childLanes = mergeLanes(node.childLanes, renderLanes); - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } - } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes)) { - alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); - } else { - // Neither alternate was updated, which means the rest of the - // ancestor path already has sufficient priority. - break; - } - - node = node.return; - } - } - function propagateContextChange(workInProgress, context, changedBits, renderLanes) { - var fiber = workInProgress.child; - - if (fiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - fiber.return = workInProgress; - } - - while (fiber !== null) { - var nextFiber = void 0; // Visit this fiber. - - var list = fiber.dependencies; - - if (list !== null) { - nextFiber = fiber.child; - var dependency = list.firstContext; - - while (dependency !== null) { - // Check if the context matches. - if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) { - // Match! Schedule an update on this fiber. - if (fiber.tag === ClassComponent) { - // Schedule a force update on the work-in-progress. - var update = createUpdate(NoTimestamp, pickArbitraryLane(renderLanes)); - update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the - // update to the current fiber, too, which means it will persist even if - // this render is thrown away. Since it's a race condition, not sure it's - // worth fixing. - - enqueueUpdate(fiber, update); - } - - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too. - - list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the - // dependency list. - - break; - } - - dependency = dependency.next; - } - } else if (fiber.tag === ContextProvider) { - // Don't scan deeper if this is a matching provider - nextFiber = fiber.type === workInProgress.type ? null : fiber.child; - } else { - // Traverse down. - nextFiber = fiber.child; - } - - if (nextFiber !== null) { - // Set the return pointer of the child to the work-in-progress fiber. - nextFiber.return = fiber; - } else { - // No child. Traverse to next sibling. - nextFiber = fiber; - - while (nextFiber !== null) { - if (nextFiber === workInProgress) { - // We're back to the root of this subtree. Exit. - nextFiber = null; - break; - } - - var sibling = nextFiber.sibling; - - if (sibling !== null) { - // Set the return pointer of the sibling to the work-in-progress fiber. - sibling.return = nextFiber.return; - nextFiber = sibling; - break; - } // No more siblings. Traverse up. - - - nextFiber = nextFiber.return; - } - } - - fiber = nextFiber; - } - } - function prepareToReadContext(workInProgress, renderLanes) { - currentlyRenderingFiber = workInProgress; - lastContextDependency = null; - lastContextWithAllBitsObserved = null; - var dependencies = workInProgress.dependencies; - - if (dependencies !== null) { - var firstContext = dependencies.firstContext; - - if (firstContext !== null) { - if (includesSomeLane(dependencies.lanes, renderLanes)) { - // Context list has a pending update. Mark that this fiber performed work. - markWorkInProgressReceivedUpdate(); - } // Reset the work-in-progress list - - - dependencies.firstContext = null; - } - } - } - function readContext(context, observedBits) { - { - // This warning would fire if you read context inside a Hook like useMemo. - // Unlike the class check below, it's not enforced in production for perf. - if (isDisallowedContextReadInDEV) { - error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); - } - } - - if (lastContextWithAllBitsObserved === context) ; else if (observedBits === false || observedBits === 0) ; else { - var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types. - - if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) { - // Observe all updates. - lastContextWithAllBitsObserved = context; - resolvedObservedBits = MAX_SIGNED_31_BIT_INT; - } else { - resolvedObservedBits = observedBits; - } - - var contextItem = { - context: context, - observedBits: resolvedObservedBits, - next: null - }; - - if (lastContextDependency === null) { - if (!(currentlyRenderingFiber !== null)) { - { - throw Error( "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." ); - } - } // This is the first dependency for this component. Create a new list. - - - lastContextDependency = contextItem; - currentlyRenderingFiber.dependencies = { - lanes: NoLanes, - firstContext: contextItem, - responders: null - }; - } else { - // Append a new context item. - lastContextDependency = lastContextDependency.next = contextItem; - } - } - - return context._currentValue2; - } - - var UpdateState = 0; - var ReplaceState = 1; - var ForceUpdate = 2; - var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. - // It should only be read right after calling `processUpdateQueue`, via - // `checkHasForceUpdateAfterProcessing`. - - var hasForceUpdate = false; - var didWarnUpdateInsideUpdate; - var currentlyProcessingQueue; - - { - didWarnUpdateInsideUpdate = false; - currentlyProcessingQueue = null; - } - - function initializeUpdateQueue(fiber) { - var queue = { - baseState: fiber.memoizedState, - firstBaseUpdate: null, - lastBaseUpdate: null, - shared: { - pending: null - }, - effects: null - }; - fiber.updateQueue = queue; - } - function cloneUpdateQueue(current, workInProgress) { - // Clone the update queue from current. Unless it's already a clone. - var queue = workInProgress.updateQueue; - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - var clone = { - baseState: currentQueue.baseState, - firstBaseUpdate: currentQueue.firstBaseUpdate, - lastBaseUpdate: currentQueue.lastBaseUpdate, - shared: currentQueue.shared, - effects: currentQueue.effects - }; - workInProgress.updateQueue = clone; - } - } - function createUpdate(eventTime, lane) { - var update = { - eventTime: eventTime, - lane: lane, - tag: UpdateState, - payload: null, - callback: null, - next: null - }; - return update; - } - function enqueueUpdate(fiber, update) { - var updateQueue = fiber.updateQueue; - - if (updateQueue === null) { - // Only occurs if the fiber has been unmounted. - return; - } - - var sharedQueue = updateQueue.shared; - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - - { - if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { - error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); - - didWarnUpdateInsideUpdate = true; - } - } - } - function enqueueCapturedUpdate(workInProgress, capturedUpdate) { - // Captured updates are updates that are thrown by a child during the render - // phase. They should be discarded if the render is aborted. Therefore, - // we should only put them on the work-in-progress queue, not the current one. - var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. - - var current = workInProgress.alternate; - - if (current !== null) { - var currentQueue = current.updateQueue; - - if (queue === currentQueue) { - // The work-in-progress queue is the same as current. This happens when - // we bail out on a parent fiber that then captures an error thrown by - // a child. Since we want to append the update only to the work-in - // -progress queue, we need to clone the updates. We usually clone during - // processUpdateQueue, but that didn't happen in this case because we - // skipped over the parent when we bailed out. - var newFirst = null; - var newLast = null; - var firstBaseUpdate = queue.firstBaseUpdate; - - if (firstBaseUpdate !== null) { - // Loop through the updates and clone them. - var update = firstBaseUpdate; - - do { - var clone = { - eventTime: update.eventTime, - lane: update.lane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLast === null) { - newFirst = newLast = clone; - } else { - newLast.next = clone; - newLast = clone; - } - - update = update.next; - } while (update !== null); // Append the captured update the end of the cloned list. - - - if (newLast === null) { - newFirst = newLast = capturedUpdate; - } else { - newLast.next = capturedUpdate; - newLast = capturedUpdate; - } - } else { - // There are no base updates. - newFirst = newLast = capturedUpdate; - } - - queue = { - baseState: currentQueue.baseState, - firstBaseUpdate: newFirst, - lastBaseUpdate: newLast, - shared: currentQueue.shared, - effects: currentQueue.effects - }; - workInProgress.updateQueue = queue; - return; - } - } // Append the update to the end of the list. - - - var lastBaseUpdate = queue.lastBaseUpdate; - - if (lastBaseUpdate === null) { - queue.firstBaseUpdate = capturedUpdate; - } else { - lastBaseUpdate.next = capturedUpdate; - } - - queue.lastBaseUpdate = capturedUpdate; - } - - function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { - switch (update.tag) { - case ReplaceState: - { - var payload = update.payload; - - if (typeof payload === 'function') { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - var nextState = payload.call(instance, prevState, nextProps); - - { - - exitDisallowedContextReadInDEV(); - } - - return nextState; - } // State object - - - return payload; - } - - case CaptureUpdate: - { - workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture; - } - // Intentional fallthrough - - case UpdateState: - { - var _payload = update.payload; - var partialState; - - if (typeof _payload === 'function') { - // Updater function - { - enterDisallowedContextReadInDEV(); - } - - partialState = _payload.call(instance, prevState, nextProps); - - { - - exitDisallowedContextReadInDEV(); - } - } else { - // Partial state object - partialState = _payload; - } - - if (partialState === null || partialState === undefined) { - // Null and undefined are treated as no-ops. - return prevState; - } // Merge the partial state and the previous state. - - - return _assign({}, prevState, partialState); - } - - case ForceUpdate: - { - hasForceUpdate = true; - return prevState; - } - } - - return prevState; - } - - function processUpdateQueue(workInProgress, props, instance, renderLanes) { - // This is always non-null on a ClassComponent or HostRoot - var queue = workInProgress.updateQueue; - hasForceUpdate = false; - - { - currentlyProcessingQueue = queue.shared; - } - - var firstBaseUpdate = queue.firstBaseUpdate; - var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. - - var pendingQueue = queue.shared.pending; - - if (pendingQueue !== null) { - queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first - // and last so that it's non-circular. - - var lastPendingUpdate = pendingQueue; - var firstPendingUpdate = lastPendingUpdate.next; - lastPendingUpdate.next = null; // Append pending updates to base queue - - if (lastBaseUpdate === null) { - firstBaseUpdate = firstPendingUpdate; - } else { - lastBaseUpdate.next = firstPendingUpdate; - } - - lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then - // we need to transfer the updates to that queue, too. Because the base - // queue is a singly-linked list with no cycles, we can append to both - // lists and take advantage of structural sharing. - // TODO: Pass `current` as argument - - var current = workInProgress.alternate; - - if (current !== null) { - // This is always non-null on a ClassComponent or HostRoot - var currentQueue = current.updateQueue; - var currentLastBaseUpdate = currentQueue.lastBaseUpdate; - - if (currentLastBaseUpdate !== lastBaseUpdate) { - if (currentLastBaseUpdate === null) { - currentQueue.firstBaseUpdate = firstPendingUpdate; - } else { - currentLastBaseUpdate.next = firstPendingUpdate; - } - - currentQueue.lastBaseUpdate = lastPendingUpdate; - } - } - } // These values may change as we process the queue. - - - if (firstBaseUpdate !== null) { - // Iterate through the list of updates to compute the result. - var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes - // from the original lanes. - - var newLanes = NoLanes; - var newBaseState = null; - var newFirstBaseUpdate = null; - var newLastBaseUpdate = null; - var update = firstBaseUpdate; - - do { - var updateLane = update.lane; - var updateEventTime = update.eventTime; - - if (!isSubsetOfLanes(renderLanes, updateLane)) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - eventTime: updateEventTime, - lane: updateLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - - if (newLastBaseUpdate === null) { - newFirstBaseUpdate = newLastBaseUpdate = clone; - newBaseState = newState; - } else { - newLastBaseUpdate = newLastBaseUpdate.next = clone; - } // Update the remaining priority in the queue. - - - newLanes = mergeLanes(newLanes, updateLane); - } else { - // This update does have sufficient priority. - if (newLastBaseUpdate !== null) { - var _clone = { - eventTime: updateEventTime, - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - tag: update.tag, - payload: update.payload, - callback: update.callback, - next: null - }; - newLastBaseUpdate = newLastBaseUpdate.next = _clone; - } // Process this update. - - - newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); - var callback = update.callback; - - if (callback !== null) { - workInProgress.flags |= Callback; - var effects = queue.effects; - - if (effects === null) { - queue.effects = [update]; - } else { - effects.push(update); - } - } - } - - update = update.next; - - if (update === null) { - pendingQueue = queue.shared.pending; - - if (pendingQueue === null) { - break; - } else { - // An update was scheduled from inside a reducer. Add the new - // pending updates to the end of the list and keep processing. - var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we - // unravel them when transferring them to the base queue. - - var _firstPendingUpdate = _lastPendingUpdate.next; - _lastPendingUpdate.next = null; - update = _firstPendingUpdate; - queue.lastBaseUpdate = _lastPendingUpdate; - queue.shared.pending = null; - } - } - } while (true); - - if (newLastBaseUpdate === null) { - newBaseState = newState; - } - - queue.baseState = newBaseState; - queue.firstBaseUpdate = newFirstBaseUpdate; - queue.lastBaseUpdate = newLastBaseUpdate; // Set the remaining expiration time to be whatever is remaining in the queue. - // This should be fine because the only two other things that contribute to - // expiration time are props and context. We're already in the middle of the - // begin phase by the time we start processing the queue, so we've already - // dealt with the props. Context in components that specify - // shouldComponentUpdate is tricky; but we'll have to account for - // that regardless. - - markSkippedUpdateLanes(newLanes); - workInProgress.lanes = newLanes; - workInProgress.memoizedState = newState; - } - - { - currentlyProcessingQueue = null; - } - } - - function callCallback(callback, context) { - if (!(typeof callback === 'function')) { - { - throw Error( "Invalid argument passed as callback. Expected a function. Instead received: " + callback ); - } - } - - callback.call(context); - } - - function resetHasForceUpdateBeforeProcessing() { - hasForceUpdate = false; - } - function checkHasForceUpdateAfterProcessing() { - return hasForceUpdate; - } - function commitUpdateQueue(finishedWork, finishedQueue, instance) { - // Commit the effects - var effects = finishedQueue.effects; - finishedQueue.effects = null; - - if (effects !== null) { - for (var i = 0; i < effects.length; i++) { - var effect = effects[i]; - var callback = effect.callback; - - if (callback !== null) { - effect.callback = null; - callCallback(callback, instance); - } - } - } - } - - var fakeInternalInstance = {}; - var isArray = Array.isArray; // React.Component uses a shared frozen object by default. - // We'll use it to determine whether we need to initialize legacy refs. - - var emptyRefsObject = new React.Component().refs; - var didWarnAboutStateAssignmentForComponent; - var didWarnAboutUninitializedState; - var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; - var didWarnAboutLegacyLifecyclesAndDerivedState; - var didWarnAboutUndefinedDerivedState; - var warnOnUndefinedDerivedState; - var warnOnInvalidCallback; - var didWarnAboutDirectlyAssigningPropsToState; - var didWarnAboutContextTypeAndContextTypes; - var didWarnAboutInvalidateContextType; - - { - didWarnAboutStateAssignmentForComponent = new Set(); - didWarnAboutUninitializedState = new Set(); - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); - didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); - didWarnAboutDirectlyAssigningPropsToState = new Set(); - didWarnAboutUndefinedDerivedState = new Set(); - didWarnAboutContextTypeAndContextTypes = new Set(); - didWarnAboutInvalidateContextType = new Set(); - var didWarnOnInvalidCallback = new Set(); - - warnOnInvalidCallback = function (callback, callerName) { - if (callback === null || typeof callback === 'function') { - return; - } - - var key = callerName + '_' + callback; - - if (!didWarnOnInvalidCallback.has(key)) { - didWarnOnInvalidCallback.add(key); - - error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); - } - }; - - warnOnUndefinedDerivedState = function (type, partialState) { - if (partialState === undefined) { - var componentName = getComponentName(type) || 'Component'; - - if (!didWarnAboutUndefinedDerivedState.has(componentName)) { - didWarnAboutUndefinedDerivedState.add(componentName); - - error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); - } - } - }; // This is so gross but it's at least non-critical and can be removed if - // it causes problems. This is meant to give a nicer error message for - // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, - // ...)) which otherwise throws a "_processChildContext is not a function" - // exception. - - - Object.defineProperty(fakeInternalInstance, '_processChildContext', { - enumerable: false, - value: function () { - { - { - throw Error( "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." ); - } - } - } - }); - Object.freeze(fakeInternalInstance); - } - - function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { - var prevState = workInProgress.memoizedState; - - var partialState = getDerivedStateFromProps(nextProps, prevState); - - { - warnOnUndefinedDerivedState(ctor, partialState); - } // Merge the partial state and the previous state. - - - var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState); - workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the - // base state. - - if (workInProgress.lanes === NoLanes) { - // Queue is always non-null for classes - var updateQueue = workInProgress.updateQueue; - updateQueue.baseState = memoizedState; - } - } - var classComponentUpdater = { - isMounted: isMounted, - enqueueSetState: function (inst, payload, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.payload = payload; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'setState'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - }, - enqueueReplaceState: function (inst, payload, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.tag = ReplaceState; - update.payload = payload; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'replaceState'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - }, - enqueueForceUpdate: function (inst, callback) { - var fiber = get(inst); - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = createUpdate(eventTime, lane); - update.tag = ForceUpdate; - - if (callback !== undefined && callback !== null) { - { - warnOnInvalidCallback(callback, 'forceUpdate'); - } - - update.callback = callback; - } - - enqueueUpdate(fiber, update); - scheduleUpdateOnFiber(fiber, lane, eventTime); - } - }; - - function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { - var instance = workInProgress.stateNode; - - if (typeof instance.shouldComponentUpdate === 'function') { - - var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); - - { - if (shouldUpdate === undefined) { - error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component'); - } - } - - return shouldUpdate; - } - - if (ctor.prototype && ctor.prototype.isPureReactComponent) { - return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); - } - - return true; - } - - function checkClassInstance(workInProgress, ctor, newProps) { - var instance = workInProgress.stateNode; - - { - var name = getComponentName(ctor) || 'Component'; - var renderPresent = instance.render; - - if (!renderPresent) { - if (ctor.prototype && typeof ctor.prototype.render === 'function') { - error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); - } else { - error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); - } - } - - if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { - error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); - } - - if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { - error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); - } - - if (instance.propTypes) { - error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); - } - - if (instance.contextType) { - error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); - } - - { - if (instance.contextTypes) { - error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); - } - - if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { - didWarnAboutContextTypeAndContextTypes.add(ctor); - - error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); - } - } - - if (typeof instance.componentShouldUpdate === 'function') { - error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); - } - - if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { - error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component'); - } - - if (typeof instance.componentDidUnmount === 'function') { - error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); - } - - if (typeof instance.componentDidReceiveProps === 'function') { - error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); - } - - if (typeof instance.componentWillRecieveProps === 'function') { - error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); - } - - if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') { - error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); - } - - var hasMutatedProps = instance.props !== newProps; - - if (instance.props !== undefined && hasMutatedProps) { - error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); - } - - if (instance.defaultProps) { - error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { - didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); - - error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor)); - } - - if (typeof instance.getDerivedStateFromProps === 'function') { - error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - } - - if (typeof instance.getDerivedStateFromError === 'function') { - error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); - } - - if (typeof ctor.getSnapshotBeforeUpdate === 'function') { - error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); - } - - var _state = instance.state; - - if (_state && (typeof _state !== 'object' || isArray(_state))) { - error('%s.state: must be set to an object or null', name); - } - - if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') { - error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); - } - } - } - - function adoptClassInstance(workInProgress, instance) { - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } - } - - function constructClassInstance(workInProgress, ctor, props) { - var isLegacyContextConsumer = false; - var unmaskedContext = emptyContextObject; - var context = emptyContextObject; - var contextType = ctor.contextType; - - { - if ('contextType' in ctor) { - var isValid = // Allow null for conditional declaration - contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a - - if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { - didWarnAboutInvalidateContextType.add(ctor); - var addendum = ''; - - if (contextType === undefined) { - addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; - } else if (typeof contextType !== 'object') { - addendum = ' However, it is set to a ' + typeof contextType + '.'; - } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { - addendum = ' Did you accidentally pass the Context.Provider instead?'; - } else if (contextType._context !== undefined) { - // - addendum = ' Did you accidentally pass the Context.Consumer instead?'; - } else { - addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; - } - - error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum); - } - } - } - - if (typeof contextType === 'object' && contextType !== null) { - context = readContext(contextType); - } else { - unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - var contextTypes = ctor.contextTypes; - isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; - context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; - } // Instantiate twice to help detect side-effects. - - var instance = new ctor(props, context); - var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; - adoptClassInstance(workInProgress, instance); - - { - if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { - var componentName = getComponentName(ctor) || 'Component'; - - if (!didWarnAboutUninitializedState.has(componentName)) { - didWarnAboutUninitializedState.add(componentName); - - error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName); - } - } // If new component APIs are defined, "unsafe" lifecycles won't be called. - // Warn about these lifecycles if they are present. - // Don't warn about react-lifecycles-compat polyfilled methods though. - - - if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { - var foundWillMountName = null; - var foundWillReceivePropsName = null; - var foundWillUpdateName = null; - - if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { - foundWillMountName = 'componentWillMount'; - } else if (typeof instance.UNSAFE_componentWillMount === 'function') { - foundWillMountName = 'UNSAFE_componentWillMount'; - } - - if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { - foundWillReceivePropsName = 'componentWillReceiveProps'; - } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; - } - - if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { - foundWillUpdateName = 'componentWillUpdate'; - } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - foundWillUpdateName = 'UNSAFE_componentWillUpdate'; - } - - if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { - var _componentName = getComponentName(ctor) || 'Component'; - - var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; - - if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { - didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); - - error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ''); - } - } - } - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // ReactFiberContext usually updates this cache but can't for newly-created instances. - - - if (isLegacyContextConsumer) { - cacheContext(workInProgress, unmaskedContext, context); - } - - return instance; - } - - function callComponentWillMount(workInProgress, instance) { - var oldState = instance.state; - - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } - - if (oldState !== instance.state) { - { - error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component'); - } - - classComponentUpdater.enqueueReplaceState(instance, instance.state, null); - } - } - - function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { - var oldState = instance.state; - - if (typeof instance.componentWillReceiveProps === 'function') { - instance.componentWillReceiveProps(newProps, nextContext); - } - - if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { - instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); - } - - if (instance.state !== oldState) { - { - var componentName = getComponentName(workInProgress.type) || 'Component'; - - if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { - didWarnAboutStateAssignmentForComponent.add(componentName); - - error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); - } - } - - classComponentUpdater.enqueueReplaceState(instance, instance.state, null); - } - } // Invokes the mount life-cycles on a previously never rendered instance. - - - function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { - { - checkClassInstance(workInProgress, ctor, newProps); - } - - var instance = workInProgress.stateNode; - instance.props = newProps; - instance.state = workInProgress.memoizedState; - instance.refs = emptyRefsObject; - initializeUpdateQueue(workInProgress); - var contextType = ctor.contextType; - - if (typeof contextType === 'object' && contextType !== null) { - instance.context = readContext(contextType); - } else { - var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - instance.context = getMaskedContext(workInProgress, unmaskedContext); - } - - { - if (instance.state === newProps) { - var componentName = getComponentName(ctor) || 'Component'; - - if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { - didWarnAboutDirectlyAssigningPropsToState.add(componentName); - - error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName); - } - } - - if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); - } - - { - ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); - } - } - - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - instance.state = workInProgress.memoizedState; - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - instance.state = workInProgress.memoizedState; - } // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - - if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's - // process them now. - - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - instance.state = workInProgress.memoizedState; - } - - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } - } - - function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { - var instance = workInProgress.stateNode; - var oldProps = workInProgress.memoizedProps; - instance.props = oldProps; - var oldContext = instance.context; - var contextType = ctor.contextType; - var nextContext = emptyContextObject; - - if (typeof contextType === 'object' && contextType !== null) { - nextContext = readContext(contextType); - } else { - var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); - } - - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (oldProps !== newProps || oldContext !== nextContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); - } - } - - resetHasForceUpdateBeforeProcessing(); - var oldState = workInProgress.memoizedState; - var newState = instance.state = oldState; - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - newState = workInProgress.memoizedState; - - if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } - - return false; - } - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - newState = workInProgress.memoizedState; - } - - var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); - - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { - if (typeof instance.componentWillMount === 'function') { - instance.componentWillMount(); - } - - if (typeof instance.UNSAFE_componentWillMount === 'function') { - instance.UNSAFE_componentWillMount(); - } - } - - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidMount === 'function') { - workInProgress.flags |= Update; - } // If shouldComponentUpdate returned false, we should still update the - // memoized state to indicate that this work can be reused. - - - workInProgress.memoizedProps = newProps; - workInProgress.memoizedState = newState; - } // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - - - instance.props = newProps; - instance.state = newState; - instance.context = nextContext; - return shouldUpdate; - } // Invokes the update life-cycles and returns false if it shouldn't rerender. - - - function updateClassInstance(current, workInProgress, ctor, newProps, renderLanes) { - var instance = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); - var unresolvedOldProps = workInProgress.memoizedProps; - var oldProps = workInProgress.type === workInProgress.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress.type, unresolvedOldProps); - instance.props = oldProps; - var unresolvedNewProps = workInProgress.pendingProps; - var oldContext = instance.context; - var contextType = ctor.contextType; - var nextContext = emptyContextObject; - - if (typeof contextType === 'object' && contextType !== null) { - nextContext = readContext(contextType); - } else { - var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); - nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); - } - - var getDerivedStateFromProps = ctor.getDerivedStateFromProps; - var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what - // ever the previously attempted to render - not the "current". However, - // during componentDidUpdate we pass the "current" props. - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { - if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) { - callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); - } - } - - resetHasForceUpdateBeforeProcessing(); - var oldState = workInProgress.memoizedState; - var newState = instance.state = oldState; - processUpdateQueue(workInProgress, newProps, instance, renderLanes); - newState = workInProgress.memoizedState; - - if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Update; - } - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Snapshot; - } - } - - return false; - } - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); - newState = workInProgress.memoizedState; - } - - var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); - - if (shouldUpdate) { - // In order to support react-lifecycles-compat polyfilled components, - // Unsafe lifecycles should not be invoked for components using the new APIs. - if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { - if (typeof instance.componentWillUpdate === 'function') { - instance.componentWillUpdate(newProps, newState, nextContext); - } - - if (typeof instance.UNSAFE_componentWillUpdate === 'function') { - instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); - } - } - - if (typeof instance.componentDidUpdate === 'function') { - workInProgress.flags |= Update; - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - workInProgress.flags |= Snapshot; - } - } else { - // If an update was already in progress, we should schedule an Update - // effect even though we're bailing out, so that cWU/cDU are called. - if (typeof instance.componentDidUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Update; - } - } - - if (typeof instance.getSnapshotBeforeUpdate === 'function') { - if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { - workInProgress.flags |= Snapshot; - } - } // If shouldComponentUpdate returned false, we should still update the - // memoized props/state to indicate that this work can be reused. - - - workInProgress.memoizedProps = newProps; - workInProgress.memoizedState = newState; - } // Update the existing instance's state, props, and context pointers even - // if shouldComponentUpdate returns false. - - - instance.props = newProps; - instance.state = newState; - instance.context = nextContext; - return shouldUpdate; - } - - var didWarnAboutMaps; - var didWarnAboutGenerators; - var didWarnAboutStringRefs; - var ownerHasKeyUseWarning; - var ownerHasFunctionTypeWarning; - - var warnForMissingKey = function (child, returnFiber) {}; - - { - didWarnAboutMaps = false; - didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - ownerHasKeyUseWarning = {}; - ownerHasFunctionTypeWarning = {}; - - warnForMissingKey = function (child, returnFiber) { - if (child === null || typeof child !== 'object') { - return; - } - - if (!child._store || child._store.validated || child.key != null) { - return; - } - - if (!(typeof child._store === 'object')) { - { - throw Error( "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - child._store.validated = true; - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (ownerHasKeyUseWarning[componentName]) { - return; - } - - ownerHasKeyUseWarning[componentName] = true; - - error('Each child in a list should have a unique ' + '"key" prop. See https://reactjs.org/link/warning-keys for ' + 'more information.'); - }; - } - - var isArray$1 = Array.isArray; - - function coerceRef(returnFiber, current, element) { - var mixedRef = element.ref; - - if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { - { - // TODO: Clean this up once we turn on the string ref warning for - // everyone, because the strict mode case will no longer be relevant - if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs - // because these cannot be automatically converted to an arrow function - // using a codemod. Therefore, we don't have to warn about string refs again. - !(element._owner && element._self && element._owner.stateNode !== element._self)) { - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (!didWarnAboutStringRefs[componentName]) { - { - error('A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', mixedRef); - } - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - if (element._owner) { - var owner = element._owner; - var inst; - - if (owner) { - var ownerFiber = owner; - - if (!(ownerFiber.tag === ClassComponent)) { - { - throw Error( "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref" ); - } - } - - inst = ownerFiber.stateNode; - } - - if (!inst) { - { - throw Error( "Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref - - if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) { - return current.ref; - } - - var ref = function (value) { - var refs = inst.refs; - - if (refs === emptyRefsObject) { - // This is a lazy pooled frozen object, so we need to initialize. - refs = inst.refs = {}; - } - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } else { - if (!(typeof mixedRef === 'string')) { - { - throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." ); - } - } - - if (!element._owner) { - { - throw Error( "Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information." ); - } - } - } - } - - return mixedRef; - } - - function throwOnInvalidObjectType(returnFiber, newChild) { - if (returnFiber.type !== 'textarea') { - { - { - throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + "). If you meant to render a collection of children, use an array instead." ); - } - } - } - } - - function warnOnFunctionType(returnFiber) { - { - var componentName = getComponentName(returnFiber.type) || 'Component'; - - if (ownerHasFunctionTypeWarning[componentName]) { - return; - } - - ownerHasFunctionTypeWarning[componentName] = true; - - error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of from render. ' + 'Or maybe you meant to call this function rather than return it.'); - } - } // We avoid inlining this to avoid potential deopts from using try/catch. - // to be able to optimize each path individually by branching early. This needs - // a compiler or we can do it manually. Helpers that don't need this branching - // live outside of this function. - - - function ChildReconciler(shouldTrackSideEffects) { - function deleteChild(returnFiber, childToDelete) { - if (!shouldTrackSideEffects) { - // Noop. - return; - } // Deletions are added in reversed order so we add it to the front. - // At this point, the return fiber's effect list is empty except for - // deletions, so we can just append the deletion to the list. The remaining - // effects aren't added until the complete phase. Once we implement - // resuming, this may not be true. - - - var last = returnFiber.lastEffect; - - if (last !== null) { - last.nextEffect = childToDelete; - returnFiber.lastEffect = childToDelete; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; - } - - childToDelete.nextEffect = null; - childToDelete.flags = Deletion; - } - - function deleteRemainingChildren(returnFiber, currentFirstChild) { - if (!shouldTrackSideEffects) { - // Noop. - return null; - } // TODO: For the shouldClone case, this could be micro-optimized a bit by - // assuming that after the first child we've already added everything. - - - var childToDelete = currentFirstChild; - - while (childToDelete !== null) { - deleteChild(returnFiber, childToDelete); - childToDelete = childToDelete.sibling; - } - - return null; - } - - function mapRemainingChildren(returnFiber, currentFirstChild) { - // Add the remaining children to a temporary map so that we can find them by - // keys quickly. Implicit (null) keys get added to this set with their index - // instead. - var existingChildren = new Map(); - var existingChild = currentFirstChild; - - while (existingChild !== null) { - if (existingChild.key !== null) { - existingChildren.set(existingChild.key, existingChild); - } else { - existingChildren.set(existingChild.index, existingChild); - } - - existingChild = existingChild.sibling; - } - - return existingChildren; - } - - function useFiber(fiber, pendingProps) { - // We currently set sibling to null and index to 0 here because it is easy - // to forget to do before returning it. E.g. for the single child case. - var clone = createWorkInProgress(fiber, pendingProps); - clone.index = 0; - clone.sibling = null; - return clone; - } - - function placeChild(newFiber, lastPlacedIndex, newIndex) { - newFiber.index = newIndex; - - if (!shouldTrackSideEffects) { - // Noop. - return lastPlacedIndex; - } - - var current = newFiber.alternate; - - if (current !== null) { - var oldIndex = current.index; - - if (oldIndex < lastPlacedIndex) { - // This is a move. - newFiber.flags = Placement; - return lastPlacedIndex; - } else { - // This item can stay in place. - return oldIndex; - } - } else { - // This is an insertion. - newFiber.flags = Placement; - return lastPlacedIndex; - } - } - - function placeSingleChild(newFiber) { - // This is simpler for the single child case. We only need to do a - // placement for inserting new children. - if (shouldTrackSideEffects && newFiber.alternate === null) { - newFiber.flags = Placement; - } - - return newFiber; - } - - function updateTextNode(returnFiber, current, textContent, lanes) { - if (current === null || current.tag !== HostText) { - // Insert - var created = createFiberFromText(textContent, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, textContent); - existing.return = returnFiber; - return existing; - } - } - - function updateElement(returnFiber, current, element, lanes) { - if (current !== null) { - if (current.elementType === element.type || ( // Keep this check inline so it only runs on the false path: - isCompatibleFamilyForHotReloading(current, element) )) { - // Move based on index - var existing = useFiber(current, element.props); - existing.ref = coerceRef(returnFiber, current, element); - existing.return = returnFiber; - - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - - return existing; - } - } // Insert - - - var created = createFiberFromElement(element, returnFiber.mode, lanes); - created.ref = coerceRef(returnFiber, current, element); - created.return = returnFiber; - return created; - } - - function updatePortal(returnFiber, current, portal, lanes) { - if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { - // Insert - var created = createFiberFromPortal(portal, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, portal.children || []); - existing.return = returnFiber; - return existing; - } - } - - function updateFragment(returnFiber, current, fragment, lanes, key) { - if (current === null || current.tag !== Fragment) { - // Insert - var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key); - created.return = returnFiber; - return created; - } else { - // Update - var existing = useFiber(current, fragment); - existing.return = returnFiber; - return existing; - } - } - - function createChild(returnFiber, newChild, lanes) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - var created = createFiberFromText('' + newChild, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _created = createFiberFromElement(newChild, returnFiber.mode, lanes); - - _created.ref = coerceRef(returnFiber, null, newChild); - _created.return = returnFiber; - return _created; - } - - case REACT_PORTAL_TYPE: - { - var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes); - - _created2.return = returnFiber; - return _created2; - } - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null); - - _created3.return = returnFiber; - return _created3; - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - - function updateSlot(returnFiber, oldFiber, newChild, lanes) { - // Update the fiber if the keys match, otherwise return null. - var key = oldFiber !== null ? oldFiber.key : null; - - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys. If the previous node is implicitly keyed - // we can continue to replace it without aborting even if it is not a text - // node. - if (key !== null) { - return null; - } - - return updateTextNode(returnFiber, oldFiber, '' + newChild, lanes); - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - if (newChild.key === key) { - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, oldFiber, newChild.props.children, lanes, key); - } - - return updateElement(returnFiber, oldFiber, newChild, lanes); - } else { - return null; - } - } - - case REACT_PORTAL_TYPE: - { - if (newChild.key === key) { - return updatePortal(returnFiber, oldFiber, newChild, lanes); - } else { - return null; - } - } - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - if (key !== null) { - return null; - } - - return updateFragment(returnFiber, oldFiber, newChild, lanes, null); - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - - function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { - if (typeof newChild === 'string' || typeof newChild === 'number') { - // Text nodes don't have keys, so we neither have to check the old nor - // new node for the key. If both are text nodes, they match. - var matchedFiber = existingChildren.get(newIdx) || null; - return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes); - } - - if (typeof newChild === 'object' && newChild !== null) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - { - var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - - if (newChild.type === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, _matchedFiber, newChild.props.children, lanes, newChild.key); - } - - return updateElement(returnFiber, _matchedFiber, newChild, lanes); - } - - case REACT_PORTAL_TYPE: - { - var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; - - return updatePortal(returnFiber, _matchedFiber2, newChild, lanes); - } - - } - - if (isArray$1(newChild) || getIteratorFn(newChild)) { - var _matchedFiber3 = existingChildren.get(newIdx) || null; - - return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null); - } - - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - return null; - } - /** - * Warns if there is a duplicate or missing key - */ - - - function warnOnInvalidKey(child, knownKeys, returnFiber) { - { - if (typeof child !== 'object' || child === null) { - return knownKeys; - } - - switch (child.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - warnForMissingKey(child, returnFiber); - var key = child.key; - - if (typeof key !== 'string') { - break; - } - - if (knownKeys === null) { - knownKeys = new Set(); - knownKeys.add(key); - break; - } - - if (!knownKeys.has(key)) { - knownKeys.add(key); - break; - } - - error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key); - - break; - } - } - - return knownKeys; - } - - function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { - // This algorithm can't optimize by searching from both ends since we - // don't have backpointers on fibers. I'm trying to see how far we can get - // with that model. If it ends up not being worth the tradeoffs, we can - // add it later. - // Even with a two ended optimization, we'd want to optimize for the case - // where there are few changes and brute force the comparison instead of - // going for the Map. It'd like to explore hitting that path first in - // forward-only mode and only go for the Map once we notice that we need - // lots of look ahead. This doesn't handle reversal as well as two ended - // search but that's unusual. Besides, for the two ended optimization to - // work on Iterables, we'd need to copy the whole set. - // In this first iteration, we'll just live with hitting the bad case - // (adding everything to a Map) in for every insert/move. - // If you change this code, also update reconcileChildrenIterator() which - // uses the same algorithm. - { - // First, validate keys. - var knownKeys = null; - - for (var i = 0; i < newChildren.length; i++) { - var child = newChildren[i]; - knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); - } - } - - var resultingFirstChild = null; - var previousNewFiber = null; - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; - - for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - - var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); - - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (oldFiber === null) { - oldFiber = nextOldFiber; - } - - break; - } - - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } - - if (newIdx === newChildren.length) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } - - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes); - - if (_newFiber === null) { - continue; - } - - lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber; - } else { - previousNewFiber.sibling = _newFiber; - } - - previousNewFiber = _newFiber; - } - - return resultingFirstChild; - } // Add all children to a key map for quick lookups. - - - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. - - for (; newIdx < newChildren.length; newIdx++) { - var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes); - - if (_newFiber2 !== null) { - if (shouldTrackSideEffects) { - if (_newFiber2.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); - } - } - - lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - resultingFirstChild = _newFiber2; - } else { - previousNewFiber.sibling = _newFiber2; - } - - previousNewFiber = _newFiber2; - } - } - - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); - } - - return resultingFirstChild; - } - - function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) { - // This is the same implementation as reconcileChildrenArray(), - // but using the iterator instead. - var iteratorFn = getIteratorFn(newChildrenIterable); - - if (!(typeof iteratorFn === 'function')) { - { - throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - { - // We don't support rendering Generators because it's a mutation. - // See https://github.com/facebook/react/issues/12995 - if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag - newChildrenIterable[Symbol.toStringTag] === 'Generator') { - if (!didWarnAboutGenerators) { - error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); - } - - didWarnAboutGenerators = true; - } // Warn about using Maps as children - - - if (newChildrenIterable.entries === iteratorFn) { - if (!didWarnAboutMaps) { - error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } // First, validate keys. - // We'll get a different iterator later for the main pass. - - - var _newChildren = iteratorFn.call(newChildrenIterable); - - if (_newChildren) { - var knownKeys = null; - - var _step = _newChildren.next(); - - for (; !_step.done; _step = _newChildren.next()) { - var child = _step.value; - knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); - } - } - } - - var newChildren = iteratorFn.call(newChildrenIterable); - - if (!(newChildren != null)) { - { - throw Error( "An iterable object provided no iterator." ); - } - } - - var resultingFirstChild = null; - var previousNewFiber = null; - var oldFiber = currentFirstChild; - var lastPlacedIndex = 0; - var newIdx = 0; - var nextOldFiber = null; - var step = newChildren.next(); - - for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { - if (oldFiber.index > newIdx) { - nextOldFiber = oldFiber; - oldFiber = null; - } else { - nextOldFiber = oldFiber.sibling; - } - - var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); - - if (newFiber === null) { - // TODO: This breaks on empty slots like null children. That's - // unfortunate because it triggers the slow path all the time. We need - // a better way to communicate whether this was a miss or null, - // boolean, undefined, etc. - if (oldFiber === null) { - oldFiber = nextOldFiber; - } - - break; - } - - if (shouldTrackSideEffects) { - if (oldFiber && newFiber.alternate === null) { - // We matched the slot, but we didn't reuse the existing fiber, so we - // need to delete the existing child. - deleteChild(returnFiber, oldFiber); - } - } - - lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = newFiber; - } else { - // TODO: Defer siblings if we're not at the right index for this slot. - // I.e. if we had null values before, then we want to defer this - // for each null value. However, we also don't want to call updateSlot - // with the previous one. - previousNewFiber.sibling = newFiber; - } - - previousNewFiber = newFiber; - oldFiber = nextOldFiber; - } - - if (step.done) { - // We've reached the end of the new children. We can delete the rest. - deleteRemainingChildren(returnFiber, oldFiber); - return resultingFirstChild; - } - - if (oldFiber === null) { - // If we don't have any more existing children we can choose a fast path - // since the rest will all be insertions. - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber3 = createChild(returnFiber, step.value, lanes); - - if (_newFiber3 === null) { - continue; - } - - lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - // TODO: Move out of the loop. This only happens for the first run. - resultingFirstChild = _newFiber3; - } else { - previousNewFiber.sibling = _newFiber3; - } - - previousNewFiber = _newFiber3; - } - - return resultingFirstChild; - } // Add all children to a key map for quick lookups. - - - var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. - - for (; !step.done; newIdx++, step = newChildren.next()) { - var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes); - - if (_newFiber4 !== null) { - if (shouldTrackSideEffects) { - if (_newFiber4.alternate !== null) { - // The new fiber is a work in progress, but if there exists a - // current, that means that we reused the fiber. We need to delete - // it from the child list so that we don't add it to the deletion - // list. - existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); - } - } - - lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); - - if (previousNewFiber === null) { - resultingFirstChild = _newFiber4; - } else { - previousNewFiber.sibling = _newFiber4; - } - - previousNewFiber = _newFiber4; - } - } - - if (shouldTrackSideEffects) { - // Any existing children that weren't consumed above were deleted. We need - // to add them to the deletion list. - existingChildren.forEach(function (child) { - return deleteChild(returnFiber, child); - }); - } - - return resultingFirstChild; - } - - function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) { - // There's no need to check for keys on text nodes since we don't have a - // way to define them. - if (currentFirstChild !== null && currentFirstChild.tag === HostText) { - // We already have an existing node so let's just update it and delete - // the rest. - deleteRemainingChildren(returnFiber, currentFirstChild.sibling); - var existing = useFiber(currentFirstChild, textContent); - existing.return = returnFiber; - return existing; - } // The existing first child is not a text node so we need to create one - // and delete the existing ones. - - - deleteRemainingChildren(returnFiber, currentFirstChild); - var created = createFiberFromText(textContent, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } - - function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) { - var key = element.key; - var child = currentFirstChild; - - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - switch (child.tag) { - case Fragment: - { - if (element.type === REACT_FRAGMENT_TYPE) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, element.props.children); - existing.return = returnFiber; - - { - existing._debugSource = element._source; - existing._debugOwner = element._owner; - } - - return existing; - } - - break; - } - - case Block: - - // We intentionally fallthrough here if enableBlocksAPI is not on. - // eslint-disable-next-lined no-fallthrough - - default: - { - if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path: - isCompatibleFamilyForHotReloading(child, element) )) { - deleteRemainingChildren(returnFiber, child.sibling); - - var _existing3 = useFiber(child, element.props); - - _existing3.ref = coerceRef(returnFiber, child, element); - _existing3.return = returnFiber; - - { - _existing3._debugSource = element._source; - _existing3._debugOwner = element._owner; - } - - return _existing3; - } - - break; - } - } // Didn't match. - - - deleteRemainingChildren(returnFiber, child); - break; - } else { - deleteChild(returnFiber, child); - } - - child = child.sibling; - } - - if (element.type === REACT_FRAGMENT_TYPE) { - var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key); - created.return = returnFiber; - return created; - } else { - var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); - - _created4.ref = coerceRef(returnFiber, currentFirstChild, element); - _created4.return = returnFiber; - return _created4; - } - } - - function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) { - var key = portal.key; - var child = currentFirstChild; - - while (child !== null) { - // TODO: If key === null and child.key === null, then this only applies to - // the first item in the list. - if (child.key === key) { - if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { - deleteRemainingChildren(returnFiber, child.sibling); - var existing = useFiber(child, portal.children || []); - existing.return = returnFiber; - return existing; - } else { - deleteRemainingChildren(returnFiber, child); - break; - } - } else { - deleteChild(returnFiber, child); - } - - child = child.sibling; - } - - var created = createFiberFromPortal(portal, returnFiber.mode, lanes); - created.return = returnFiber; - return created; - } // This API will tag the children with the side-effect of the reconciliation - // itself. They will be added to the side-effect list as we pass through the - // children and the parent. - - - function reconcileChildFibers(returnFiber, currentFirstChild, newChild, lanes) { - // This function is not recursive. - // If the top level item is an array, we treat it as a set of children, - // not as a fragment. Nested arrays on the other hand will be treated as - // fragment nodes. Recursion happens at the normal flow. - // Handle top level unkeyed fragments as if they were arrays. - // This leads to an ambiguity between <>{[...]} and <>.... - // We treat the ambiguous cases above the same. - var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; - - if (isUnkeyedTopLevelFragment) { - newChild = newChild.props.children; - } // Handle object types - - - var isObject = typeof newChild === 'object' && newChild !== null; - - if (isObject) { - switch (newChild.$$typeof) { - case REACT_ELEMENT_TYPE: - return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes)); - - case REACT_PORTAL_TYPE: - return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes)); - - } - } - - if (typeof newChild === 'string' || typeof newChild === 'number') { - return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, lanes)); - } - - if (isArray$1(newChild)) { - return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); - } - - if (getIteratorFn(newChild)) { - return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); - } - - if (isObject) { - throwOnInvalidObjectType(returnFiber, newChild); - } - - { - if (typeof newChild === 'function') { - warnOnFunctionType(returnFiber); - } - } - - if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) { - // If the new child is undefined, and the return fiber is a composite - // component, throw an error. If Fiber return types are disabled, - // we already threw above. - switch (returnFiber.tag) { - case ClassComponent: - { - { - var instance = returnFiber.stateNode; - - if (instance.render._isMockFunction) { - // We allow auto-mocks to proceed as if they're returning null. - break; - } - } - } - // Intentionally fall through to the next case, which handles both - // functions and classes - // eslint-disable-next-lined no-fallthrough - - case Block: - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - { - { - throw Error( (getComponentName(returnFiber.type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." ); - } - } - } - } - } // Remaining cases are all treated as empty. - - - return deleteRemainingChildren(returnFiber, currentFirstChild); - } - - return reconcileChildFibers; - } - - var reconcileChildFibers = ChildReconciler(true); - var mountChildFibers = ChildReconciler(false); - function cloneChildFibers(current, workInProgress) { - if (!(current === null || workInProgress.child === current.child)) { - { - throw Error( "Resuming work not yet implemented." ); - } - } - - if (workInProgress.child === null) { - return; - } - - var currentChild = workInProgress.child; - var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); - workInProgress.child = newChild; - newChild.return = workInProgress; - - while (currentChild.sibling !== null) { - currentChild = currentChild.sibling; - newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); - newChild.return = workInProgress; - } - - newChild.sibling = null; - } // Reset a workInProgress child set to prepare it for a second pass. - - function resetChildFibers(workInProgress, lanes) { - var child = workInProgress.child; - - while (child !== null) { - resetWorkInProgress(child, lanes); - child = child.sibling; - } - } - - var NO_CONTEXT$1 = {}; - var contextStackCursor$1 = createCursor(NO_CONTEXT$1); - var contextFiberStackCursor = createCursor(NO_CONTEXT$1); - var rootInstanceStackCursor = createCursor(NO_CONTEXT$1); - - function requiredContext(c) { - if (!(c !== NO_CONTEXT$1)) { - { - throw Error( "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - return c; - } - - function getRootHostContainer() { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - return rootInstance; - } - - function pushHostContainer(fiber, nextRootInstance) { - // Push current root instance onto the stack; - // This allows us to reset root when portals are popped. - push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. - // However, we can't just call getRootHostContext() and push it because - // we'd have a different number of entries on the stack depending on - // whether getRootHostContext() throws somewhere in renderer code or not. - // So we push an empty value first. This lets us safely unwind on errors. - - push(contextStackCursor$1, NO_CONTEXT$1, fiber); - var nextRootContext = getRootHostContext(); // Now that we know this function doesn't throw, replace it. - - pop(contextStackCursor$1, fiber); - push(contextStackCursor$1, nextRootContext, fiber); - } - - function popHostContainer(fiber) { - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); - pop(rootInstanceStackCursor, fiber); - } - - function getHostContext() { - var context = requiredContext(contextStackCursor$1.current); - return context; - } - - function pushHostContext(fiber) { - var rootInstance = requiredContext(rootInstanceStackCursor.current); - var context = requiredContext(contextStackCursor$1.current); - var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. - - if (context === nextContext) { - return; - } // Track the context and the Fiber that provided it. - // This enables us to pop only Fibers that provide unique contexts. - - - push(contextFiberStackCursor, fiber, fiber); - push(contextStackCursor$1, nextContext, fiber); - } - - function popHostContext(fiber) { - // Do not pop unless this Fiber provided the current context. - // pushHostContext() only pushes Fibers that provide unique contexts. - if (contextFiberStackCursor.current !== fiber) { - return; - } - - pop(contextStackCursor$1, fiber); - pop(contextFiberStackCursor, fiber); - } - - var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is - // inherited deeply down the subtree. The upper bits only affect - // this immediate suspense boundary and gets reset each new - // boundary or suspense list. - - var SubtreeSuspenseContextMask = 1; // Subtree Flags: - // InvisibleParentSuspenseContext indicates that one of our parent Suspense - // boundaries is not currently showing visible main content. - // Either because it is already showing a fallback or is not mounted at all. - // We can use this to determine if it is desirable to trigger a fallback at - // the parent. If not, then we might need to trigger undesirable boundaries - // and/or suspend the commit to avoid hiding the parent content. - - var InvisibleParentSuspenseContext = 1; // Shallow Flags: - // ForceSuspenseFallback can be used by SuspenseList to force newly added - // items into their fallback state during one of the render passes. - - var ForceSuspenseFallback = 2; - var suspenseStackCursor = createCursor(DefaultSuspenseContext); - function hasSuspenseContext(parentContext, flag) { - return (parentContext & flag) !== 0; - } - function setDefaultShallowSuspenseContext(parentContext) { - return parentContext & SubtreeSuspenseContextMask; - } - function setShallowSuspenseContext(parentContext, shallowContext) { - return parentContext & SubtreeSuspenseContextMask | shallowContext; - } - function addSubtreeSuspenseContext(parentContext, subtreeContext) { - return parentContext | subtreeContext; - } - function pushSuspenseContext(fiber, newContext) { - push(suspenseStackCursor, newContext, fiber); - } - function popSuspenseContext(fiber) { - pop(suspenseStackCursor, fiber); - } - - function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { - // If it was the primary children that just suspended, capture and render the - // fallback. Otherwise, don't capture and bubble to the next boundary. - var nextState = workInProgress.memoizedState; - - if (nextState !== null) { - if (nextState.dehydrated !== null) { - // A dehydrated boundary always captures. - return true; - } - - return false; - } - - var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop. - - if (props.fallback === undefined) { - return false; - } // Regular boundaries always capture. - - - if (props.unstable_avoidThisFallback !== true) { - return true; - } // If it's a boundary we should avoid, then we prefer to bubble up to the - // parent boundary if it is currently invisible. - - - if (hasInvisibleParent) { - return false; - } // If the parent is not able to handle it, we must handle it. - - - return true; - } - function findFirstSuspended(row) { - var node = row; - - while (node !== null) { - if (node.tag === SuspenseComponent) { - var state = node.memoizedState; - - if (state !== null) { - var dehydrated = state.dehydrated; - - if (dehydrated === null || isSuspenseInstancePending() || isSuspenseInstanceFallback()) { - return node; - } - } - } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't - // keep track of whether it suspended or not. - node.memoizedProps.revealOrder !== undefined) { - var didSuspend = (node.flags & DidCapture) !== NoFlags; - - if (didSuspend) { - return node; - } - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === row) { - return null; - } - - while (node.sibling === null) { - if (node.return === null || node.return === row) { - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - - return null; - } - - var NoFlags$1 = - /* */ - 0; // Represents whether effect should fire. - - var HasEffect = - /* */ - 1; // Represents the phase in which the effect (not the clean-up) fires. - - var Layout = - /* */ - 2; - var Passive$1 = - /* */ - 4; - - var isHydrating = false; - - function enterHydrationState(fiber) { - { - return false; - } - } - - function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { - { - { - { - throw Error( "Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - } - - function prepareToHydrateHostTextInstance(fiber) { - { - { - { - throw Error( "Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - var shouldUpdate = hydrateTextInstance(); - } - - function popHydrationState(fiber) { - { - return false; - } - } - - function getIsHydrating() { - return isHydrating; - } - - // and should be reset before starting a new render. - // This tracks which mutable sources need to be reset after a render. - - var workInProgressSources = []; - var rendererSigil$1; - - { - // Used to detect multiple renderers using the same mutable source. - rendererSigil$1 = {}; - } - - function markSourceAsDirty(mutableSource) { - workInProgressSources.push(mutableSource); - } - function resetWorkInProgressVersions() { - for (var i = 0; i < workInProgressSources.length; i++) { - var mutableSource = workInProgressSources[i]; - - { - mutableSource._workInProgressVersionSecondary = null; - } - } - - workInProgressSources.length = 0; - } - function getWorkInProgressVersion(mutableSource) { - { - return mutableSource._workInProgressVersionSecondary; - } - } - function setWorkInProgressVersion(mutableSource, version) { - { - mutableSource._workInProgressVersionSecondary = version; - } - - workInProgressSources.push(mutableSource); - } - function warnAboutMultipleRenderersDEV(mutableSource) { - { - { - if (mutableSource._currentSecondaryRenderer == null) { - mutableSource._currentSecondaryRenderer = rendererSigil$1; - } else if (mutableSource._currentSecondaryRenderer !== rendererSigil$1) { - error('Detected multiple renderers concurrently rendering the ' + 'same mutable source. This is currently unsupported.'); - } - } - } - } // Eager reads the version of a mutable source and stores it on the root. - - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; - var didWarnAboutMismatchedHooksForComponent; - var didWarnAboutUseOpaqueIdentifier; - - { - didWarnAboutUseOpaqueIdentifier = {}; - didWarnAboutMismatchedHooksForComponent = new Set(); - } - - // These are set right before calling the component. - var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from - // the work-in-progress hook. - - var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The - // current hook list is the list that belongs to the current fiber. The - // work-in-progress hook list is a new list that will be added to the - // work-in-progress fiber. - - var currentHook = null; - var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This - // does not get reset if we do another render pass; only when we're completely - // finished evaluating this component. This is an optimization so we know - // whether we need to clear render phase updates after a throw. - - var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only during the current render pass. This - // gets reset after each attempt. - // TODO: Maybe there's some way to consolidate this with - // `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. - - var didScheduleRenderPhaseUpdateDuringThisPass = false; - var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook - - var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. - // The list stores the order of hooks used during the initial render (mount). - // Subsequent renders (updates) reference this list. - - var hookTypesDev = null; - var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore - // the dependencies for Hooks that need them (e.g. useEffect or useMemo). - // When true, such Hooks will always be "remounted". Only used during hot reload. - - var ignorePreviousDependencies = false; - - function mountHookTypesDev() { - { - var hookName = currentHookNameInDev; - - if (hookTypesDev === null) { - hookTypesDev = [hookName]; - } else { - hookTypesDev.push(hookName); - } - } - } - - function updateHookTypesDev() { - { - var hookName = currentHookNameInDev; - - if (hookTypesDev !== null) { - hookTypesUpdateIndexDev++; - - if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { - warnOnHookMismatchInDev(hookName); - } - } - } - } - - function checkDepsAreArrayDev(deps) { - { - if (deps !== undefined && deps !== null && !Array.isArray(deps)) { - // Verify deps, but only on mount to avoid extra checks. - // It's unlikely their type would change as usually you define them inline. - error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps); - } - } - } - - function warnOnHookMismatchInDev(currentHookName) { - { - var componentName = getComponentName(currentlyRenderingFiber$1.type); - - if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { - didWarnAboutMismatchedHooksForComponent.add(componentName); - - if (hookTypesDev !== null) { - var table = ''; - var secondColumnStart = 30; - - for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { - var oldHookName = hookTypesDev[i]; - var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; - var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up - // lol @ IE not supporting String#repeat - - while (row.length < secondColumnStart) { - row += ' '; - } - - row += newHookName + '\n'; - table += row; - } - - error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table); - } - } - } - } - - function throwInvalidHookError() { - { - { - throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." ); - } - } - } - - function areHookInputsEqual(nextDeps, prevDeps) { - { - if (ignorePreviousDependencies) { - // Only true when this component is being hot reloaded. - return false; - } - } - - if (prevDeps === null) { - { - error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev); - } - - return false; - } - - { - // Don't bother comparing lengths in prod because these arrays should be - // passed inline. - if (nextDeps.length !== prevDeps.length) { - error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]"); - } - } - - for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { - if (objectIs(nextDeps[i], prevDeps[i])) { - continue; - } - - return false; - } - - return true; - } - - function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { - renderLanes = nextRenderLanes; - currentlyRenderingFiber$1 = workInProgress; - - { - hookTypesDev = current !== null ? current._debugHookTypes : null; - hookTypesUpdateIndexDev = -1; // Used for hot reloading: - - ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; - } - - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; - workInProgress.lanes = NoLanes; // The following should have already been reset - // currentHook = null; - // workInProgressHook = null; - // didScheduleRenderPhaseUpdate = false; - // TODO Warn if no hooks are used at all during mount, then some are used during update. - // Currently we will identify the update render as a mount because memoizedState === null. - // This is tricky because it's valid for certain types of components (e.g. React.lazy) - // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used. - // Non-stateful hooks (e.g. context) don't get added to memoizedState, - // so memoizedState would be null during updates and mounts. - - { - if (current !== null && current.memoizedState !== null) { - ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; - } else if (hookTypesDev !== null) { - // This dispatcher handles an edge case where a component is updating, - // but no stateful hooks have been used. - // We want to match the production code behavior (which will use HooksDispatcherOnMount), - // but with the extra DEV validation to ensure hooks ordering hasn't changed. - // This dispatcher does that. - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; - } else { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; - } - } - - var children = Component(props, secondArg); // Check if there was a render phase update - - if (didScheduleRenderPhaseUpdateDuringThisPass) { - // Keep rendering in a loop for as long as render phase updates continue to - // be scheduled. Use a counter to prevent infinite loops. - var numberOfReRenders = 0; - - do { - didScheduleRenderPhaseUpdateDuringThisPass = false; - - if (!(numberOfReRenders < RE_RENDER_LIMIT)) { - { - throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." ); - } - } - - numberOfReRenders += 1; - - { - // Even when hot reloading, allow dependencies to stabilize - // after first render to prevent infinite render phase updates. - ignorePreviousDependencies = false; - } // Start over from the beginning of the list - - - currentHook = null; - workInProgressHook = null; - workInProgress.updateQueue = null; - - { - // Also validate hook order for cascading updates. - hookTypesUpdateIndexDev = -1; - } - - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV ; - children = Component(props, secondArg); - } while (didScheduleRenderPhaseUpdateDuringThisPass); - } // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrancy. - - - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - - { - workInProgress._debugHookTypes = hookTypesDev; - } // This check uses currentHook so that it works the same in DEV and prod bundles. - // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. - - - var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; - renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; - currentHook = null; - workInProgressHook = null; - - { - currentHookNameInDev = null; - hookTypesDev = null; - hookTypesUpdateIndexDev = -1; - } - - didScheduleRenderPhaseUpdate = false; - - if (!!didRenderTooFewHooks) { - { - throw Error( "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." ); - } - } - - return children; - } - function bailoutHooks(current, workInProgress, lanes) { - workInProgress.updateQueue = current.updateQueue; - workInProgress.flags &= ~(Passive | Update); - current.lanes = removeLanes(current.lanes, lanes); - } - function resetHooksAfterThrow() { - // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrancy. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - - if (didScheduleRenderPhaseUpdate) { - // There were render phase updates. These are only valid for this render - // phase, which we are now aborting. Remove the updates from the queues so - // they do not persist to the next render. Do not remove updates from hooks - // that weren't processed. - // - // Only reset the updates from the queue if it has a clone. If it does - // not have a clone, that means it wasn't processed, and the updates were - // scheduled before we entered the render phase. - var hook = currentlyRenderingFiber$1.memoizedState; - - while (hook !== null) { - var queue = hook.queue; - - if (queue !== null) { - queue.pending = null; - } - - hook = hook.next; - } - - didScheduleRenderPhaseUpdate = false; - } - - renderLanes = NoLanes; - currentlyRenderingFiber$1 = null; - currentHook = null; - workInProgressHook = null; - - { - hookTypesDev = null; - hookTypesUpdateIndexDev = -1; - currentHookNameInDev = null; - isUpdatingOpaqueValueInRenderPhase = false; - } - - didScheduleRenderPhaseUpdateDuringThisPass = false; - } - - function mountWorkInProgressHook() { - var hook = { - memoizedState: null, - baseState: null, - baseQueue: null, - queue: null, - next: null - }; - - if (workInProgressHook === null) { - // This is the first hook in the list - currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; - } else { - // Append to the end of the list - workInProgressHook = workInProgressHook.next = hook; - } - - return workInProgressHook; - } - - function updateWorkInProgressHook() { - // This function is used both for updates and for re-renders triggered by a - // render phase update. It assumes there is either a current hook we can - // clone, or a work-in-progress hook from a previous render pass that we can - // use as a base. When we reach the end of the base list, we must switch to - // the dispatcher used for mounts. - var nextCurrentHook; - - if (currentHook === null) { - var current = currentlyRenderingFiber$1.alternate; - - if (current !== null) { - nextCurrentHook = current.memoizedState; - } else { - nextCurrentHook = null; - } - } else { - nextCurrentHook = currentHook.next; - } - - var nextWorkInProgressHook; - - if (workInProgressHook === null) { - nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; - } else { - nextWorkInProgressHook = workInProgressHook.next; - } - - if (nextWorkInProgressHook !== null) { - // There's already a work-in-progress. Reuse it. - workInProgressHook = nextWorkInProgressHook; - nextWorkInProgressHook = workInProgressHook.next; - currentHook = nextCurrentHook; - } else { - // Clone from the current hook. - if (!(nextCurrentHook !== null)) { - { - throw Error( "Rendered more hooks than during the previous render." ); - } - } - - currentHook = nextCurrentHook; - var newHook = { - memoizedState: currentHook.memoizedState, - baseState: currentHook.baseState, - baseQueue: currentHook.baseQueue, - queue: currentHook.queue, - next: null - }; - - if (workInProgressHook === null) { - // This is the first hook in the list. - currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; - } else { - // Append to the end of the list. - workInProgressHook = workInProgressHook.next = newHook; - } - } - - return workInProgressHook; - } - - function createFunctionComponentUpdateQueue() { - return { - lastEffect: null - }; - } - - function basicStateReducer(state, action) { - // $FlowFixMe: Flow doesn't like mixed types - return typeof action === 'function' ? action(state) : action; - } - - function mountReducer(reducer, initialArg, init) { - var hook = mountWorkInProgressHook(); - var initialState; - - if (init !== undefined) { - initialState = init(initialArg); - } else { - initialState = initialArg; - } - - hook.memoizedState = hook.baseState = initialState; - var queue = hook.queue = { - pending: null, - dispatch: null, - lastRenderedReducer: reducer, - lastRenderedState: initialState - }; - var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); - return [hook.memoizedState, dispatch]; - } - - function updateReducer(reducer, initialArg, init) { - var hook = updateWorkInProgressHook(); - var queue = hook.queue; - - if (!(queue !== null)) { - { - throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); - } - } - - queue.lastRenderedReducer = reducer; - var current = currentHook; // The last rebase update that is NOT part of the base state. - - var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. - - var pendingQueue = queue.pending; - - if (pendingQueue !== null) { - // We have new updates that haven't been processed yet. - // We'll add them to the base queue. - if (baseQueue !== null) { - // Merge the pending queue and the base queue. - var baseFirst = baseQueue.next; - var pendingFirst = pendingQueue.next; - baseQueue.next = pendingFirst; - pendingQueue.next = baseFirst; - } - - { - if (current.baseQueue !== baseQueue) { - // Internal invariant that should never happen, but feasibly could in - // the future if we implement resuming, or some form of that. - error('Internal error: Expected work-in-progress queue to be a clone. ' + 'This is a bug in React.'); - } - } - - current.baseQueue = baseQueue = pendingQueue; - queue.pending = null; - } - - if (baseQueue !== null) { - // We have a queue to process. - var first = baseQueue.next; - var newState = current.baseState; - var newBaseState = null; - var newBaseQueueFirst = null; - var newBaseQueueLast = null; - var update = first; - - do { - var updateLane = update.lane; - - if (!isSubsetOfLanes(renderLanes, updateLane)) { - // Priority is insufficient. Skip this update. If this is the first - // skipped update, the previous update/state is the new base - // update/state. - var clone = { - lane: updateLane, - action: update.action, - eagerReducer: update.eagerReducer, - eagerState: update.eagerState, - next: null - }; - - if (newBaseQueueLast === null) { - newBaseQueueFirst = newBaseQueueLast = clone; - newBaseState = newState; - } else { - newBaseQueueLast = newBaseQueueLast.next = clone; - } // Update the remaining priority in the queue. - // TODO: Don't need to accumulate this. Instead, we can remove - // renderLanes from the original lanes. - - - currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane); - markSkippedUpdateLanes(updateLane); - } else { - // This update does have sufficient priority. - if (newBaseQueueLast !== null) { - var _clone = { - // This update is going to be committed so we never want uncommit - // it. Using NoLane works because 0 is a subset of all bitmasks, so - // this will never be skipped by the check above. - lane: NoLane, - action: update.action, - eagerReducer: update.eagerReducer, - eagerState: update.eagerState, - next: null - }; - newBaseQueueLast = newBaseQueueLast.next = _clone; - } // Process this update. - - - if (update.eagerReducer === reducer) { - // If this update was processed eagerly, and its reducer matches the - // current reducer, we can use the eagerly computed state. - newState = update.eagerState; - } else { - var action = update.action; - newState = reducer(newState, action); - } - } - - update = update.next; - } while (update !== null && update !== first); - - if (newBaseQueueLast === null) { - newBaseState = newState; - } else { - newBaseQueueLast.next = newBaseQueueFirst; - } // Mark that the fiber performed work, but only if the new state is - // different from the current state. - - - if (!objectIs(newState, hook.memoizedState)) { - markWorkInProgressReceivedUpdate(); - } - - hook.memoizedState = newState; - hook.baseState = newBaseState; - hook.baseQueue = newBaseQueueLast; - queue.lastRenderedState = newState; - } - - var dispatch = queue.dispatch; - return [hook.memoizedState, dispatch]; - } - - function rerenderReducer(reducer, initialArg, init) { - var hook = updateWorkInProgressHook(); - var queue = hook.queue; - - if (!(queue !== null)) { - { - throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." ); - } - } - - queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous - // work-in-progress hook. - - var dispatch = queue.dispatch; - var lastRenderPhaseUpdate = queue.pending; - var newState = hook.memoizedState; - - if (lastRenderPhaseUpdate !== null) { - // The queue doesn't persist past this render pass. - queue.pending = null; - var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; - var update = firstRenderPhaseUpdate; - - do { - // Process this render phase update. We don't have to check the - // priority because it will always be the same as the current - // render's. - var action = update.action; - newState = reducer(newState, action); - update = update.next; - } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is - // different from the current state. - - - if (!objectIs(newState, hook.memoizedState)) { - markWorkInProgressReceivedUpdate(); - } - - hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to - // the base state unless the queue is empty. - // TODO: Not sure if this is the desired semantics, but it's what we - // do for gDSFP. I can't remember why. - - if (hook.baseQueue === null) { - hook.baseState = newState; - } - - queue.lastRenderedState = newState; - } - - return [newState, dispatch]; - } - - function readFromUnsubcribedMutableSource(root, source, getSnapshot) { - { - warnAboutMultipleRenderersDEV(source); - } - - var getVersion = source._getVersion; - var version = getVersion(source._source); // Is it safe for this component to read from this source during the current render? - - var isSafeToReadFromSource = false; // Check the version first. - // If this render has already been started with a specific version, - // we can use it alone to determine if we can safely read from the source. - - var currentRenderVersion = getWorkInProgressVersion(source); - - if (currentRenderVersion !== null) { - // It's safe to read if the store hasn't been mutated since the last time - // we read something. - isSafeToReadFromSource = currentRenderVersion === version; - } else { - // If there's no version, then this is the first time we've read from the - // source during the current render pass, so we need to do a bit more work. - // What we need to determine is if there are any hooks that already - // subscribed to the source, and if so, whether there are any pending - // mutations that haven't been synchronized yet. - // - // If there are no pending mutations, then `root.mutableReadLanes` will be - // empty, and we know we can safely read. - // - // If there *are* pending mutations, we may still be able to safely read - // if the currently rendering lanes are inclusive of the pending mutation - // lanes, since that guarantees that the value we're about to read from - // the source is consistent with the values that we read during the most - // recent mutation. - isSafeToReadFromSource = isSubsetOfLanes(renderLanes, root.mutableReadLanes); - - if (isSafeToReadFromSource) { - // If it's safe to read from this source during the current render, - // store the version in case other components read from it. - // A changed version number will let those components know to throw and restart the render. - setWorkInProgressVersion(source, version); - } - } - - if (isSafeToReadFromSource) { - var snapshot = getSnapshot(source._source); - - { - if (typeof snapshot === 'function') { - error('Mutable source should not return a function as the snapshot value. ' + 'Functions may close over mutable values and cause tearing.'); - } - } - - return snapshot; - } else { - // This handles the special case of a mutable source being shared between renderers. - // In that case, if the source is mutated between the first and second renderer, - // The second renderer don't know that it needs to reset the WIP version during unwind, - // (because the hook only marks sources as dirty if it's written to their WIP version). - // That would cause this tear check to throw again and eventually be visible to the user. - // We can avoid this infinite loop by explicitly marking the source as dirty. - // - // This can lead to tearing in the first renderer when it resumes, - // but there's nothing we can do about that (short of throwing here and refusing to continue the render). - markSourceAsDirty(source); - - { - { - throw Error( "Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue." ); - } - } - } - } - - function useMutableSource(hook, source, getSnapshot, subscribe) { - var root = getWorkInProgressRoot(); - - if (!(root !== null)) { - { - throw Error( "Expected a work-in-progress root. This is a bug in React. Please file an issue." ); - } - } - - var getVersion = source._getVersion; - var version = getVersion(source._source); - var dispatcher = ReactCurrentDispatcher$1.current; // eslint-disable-next-line prefer-const - - var _dispatcher$useState = dispatcher.useState(function () { - return readFromUnsubcribedMutableSource(root, source, getSnapshot); - }), - currentSnapshot = _dispatcher$useState[0], - setSnapshot = _dispatcher$useState[1]; - - var snapshot = currentSnapshot; // Grab a handle to the state hook as well. - // We use it to clear the pending update queue if we have a new source. - - var stateHook = workInProgressHook; - var memoizedState = hook.memoizedState; - var refs = memoizedState.refs; - var prevGetSnapshot = refs.getSnapshot; - var prevSource = memoizedState.source; - var prevSubscribe = memoizedState.subscribe; - var fiber = currentlyRenderingFiber$1; - hook.memoizedState = { - refs: refs, - source: source, - subscribe: subscribe - }; // Sync the values needed by our subscription handler after each commit. - - dispatcher.useEffect(function () { - refs.getSnapshot = getSnapshot; // Normally the dispatch function for a state hook never changes, - // but this hook recreates the queue in certain cases to avoid updates from stale sources. - // handleChange() below needs to reference the dispatch function without re-subscribing, - // so we use a ref to ensure that it always has the latest version. - - refs.setSnapshot = setSnapshot; // Check for a possible change between when we last rendered now. - - var maybeNewVersion = getVersion(source._source); - - if (!objectIs(version, maybeNewVersion)) { - var maybeNewSnapshot = getSnapshot(source._source); - - { - if (typeof maybeNewSnapshot === 'function') { - error('Mutable source should not return a function as the snapshot value. ' + 'Functions may close over mutable values and cause tearing.'); - } - } - - if (!objectIs(snapshot, maybeNewSnapshot)) { - setSnapshot(maybeNewSnapshot); - var lane = requestUpdateLane(fiber); - markRootMutableRead(root, lane); - } // If the source mutated between render and now, - // there may be state updates already scheduled from the old source. - // Entangle the updates so that they render in the same batch. - - - markRootEntangled(root, root.mutableReadLanes); - } - }, [getSnapshot, source, subscribe]); // If we got a new source or subscribe function, re-subscribe in a passive effect. - - dispatcher.useEffect(function () { - var handleChange = function () { - var latestGetSnapshot = refs.getSnapshot; - var latestSetSnapshot = refs.setSnapshot; - - try { - latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time. - - var lane = requestUpdateLane(fiber); - markRootMutableRead(root, lane); - } catch (error) { - // A selector might throw after a source mutation. - // e.g. it might try to read from a part of the store that no longer exists. - // In this case we should still schedule an update with React. - // Worst case the selector will throw again and then an error boundary will handle it. - latestSetSnapshot(function () { - throw error; - }); - } - }; - - var unsubscribe = subscribe(source._source, handleChange); - - { - if (typeof unsubscribe !== 'function') { - error('Mutable source subscribe function must return an unsubscribe function.'); - } - } - - return unsubscribe; - }, [source, subscribe]); // If any of the inputs to useMutableSource change, reading is potentially unsafe. - // - // If either the source or the subscription have changed we can't can't trust the update queue. - // Maybe the source changed in a way that the old subscription ignored but the new one depends on. - // - // If the getSnapshot function changed, we also shouldn't rely on the update queue. - // It's possible that the underlying source was mutated between the when the last "change" event fired, - // and when the current render (with the new getSnapshot function) is processed. - // - // In both cases, we need to throw away pending updates (since they are no longer relevant) - // and treat reading from the source as we do in the mount case. - - if (!objectIs(prevGetSnapshot, getSnapshot) || !objectIs(prevSource, source) || !objectIs(prevSubscribe, subscribe)) { - // Create a new queue and setState method, - // So if there are interleaved updates, they get pushed to the older queue. - // When this becomes current, the previous queue and dispatch method will be discarded, - // including any interleaving updates that occur. - var newQueue = { - pending: null, - dispatch: null, - lastRenderedReducer: basicStateReducer, - lastRenderedState: snapshot - }; - newQueue.dispatch = setSnapshot = dispatchAction.bind(null, currentlyRenderingFiber$1, newQueue); - stateHook.queue = newQueue; - stateHook.baseQueue = null; - snapshot = readFromUnsubcribedMutableSource(root, source, getSnapshot); - stateHook.memoizedState = stateHook.baseState = snapshot; - } - - return snapshot; - } - - function mountMutableSource(source, getSnapshot, subscribe) { - var hook = mountWorkInProgressHook(); - hook.memoizedState = { - refs: { - getSnapshot: getSnapshot, - setSnapshot: null - }, - source: source, - subscribe: subscribe - }; - return useMutableSource(hook, source, getSnapshot, subscribe); - } - - function updateMutableSource(source, getSnapshot, subscribe) { - var hook = updateWorkInProgressHook(); - return useMutableSource(hook, source, getSnapshot, subscribe); - } - - function mountState(initialState) { - var hook = mountWorkInProgressHook(); - - if (typeof initialState === 'function') { - // $FlowFixMe: Flow doesn't like mixed types - initialState = initialState(); - } - - hook.memoizedState = hook.baseState = initialState; - var queue = hook.queue = { - pending: null, - dispatch: null, - lastRenderedReducer: basicStateReducer, - lastRenderedState: initialState - }; - var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); - return [hook.memoizedState, dispatch]; - } - - function updateState(initialState) { - return updateReducer(basicStateReducer); - } - - function rerenderState(initialState) { - return rerenderReducer(basicStateReducer); - } - - function pushEffect(tag, create, destroy, deps) { - var effect = { - tag: tag, - create: create, - destroy: destroy, - deps: deps, - // Circular - next: null - }; - var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; - - if (componentUpdateQueue === null) { - componentUpdateQueue = createFunctionComponentUpdateQueue(); - currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; - componentUpdateQueue.lastEffect = effect.next = effect; - } else { - var lastEffect = componentUpdateQueue.lastEffect; - - if (lastEffect === null) { - componentUpdateQueue.lastEffect = effect.next = effect; - } else { - var firstEffect = lastEffect.next; - lastEffect.next = effect; - effect.next = firstEffect; - componentUpdateQueue.lastEffect = effect; - } - } - - return effect; - } - - function mountRef(initialValue) { - var hook = mountWorkInProgressHook(); - var ref = { - current: initialValue - }; - - { - Object.seal(ref); - } - - hook.memoizedState = ref; - return ref; - } - - function updateRef(initialValue) { - var hook = updateWorkInProgressHook(); - return hook.memoizedState; - } - - function mountEffectImpl(fiberFlags, hookFlags, create, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - currentlyRenderingFiber$1.flags |= fiberFlags; - hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps); - } - - function updateEffectImpl(fiberFlags, hookFlags, create, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var destroy = undefined; - - if (currentHook !== null) { - var prevEffect = currentHook.memoizedState; - destroy = prevEffect.destroy; - - if (nextDeps !== null) { - var prevDeps = prevEffect.deps; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - pushEffect(hookFlags, create, destroy, nextDeps); - return; - } - } - } - - currentlyRenderingFiber$1.flags |= fiberFlags; - hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps); - } - - function mountEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - - return mountEffectImpl(Update | Passive, Passive$1, create, deps); - } - - function updateEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - - return updateEffectImpl(Update | Passive, Passive$1, create, deps); - } - - function mountLayoutEffect(create, deps) { - return mountEffectImpl(Update, Layout, create, deps); - } - - function updateLayoutEffect(create, deps) { - return updateEffectImpl(Update, Layout, create, deps); - } - - function imperativeHandleEffect(create, ref) { - if (typeof ref === 'function') { - var refCallback = ref; - - var _inst = create(); - - refCallback(_inst); - return function () { - refCallback(null); - }; - } else if (ref !== null && ref !== undefined) { - var refObject = ref; - - { - if (!refObject.hasOwnProperty('current')) { - error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}'); - } - } - - var _inst2 = create(); - - refObject.current = _inst2; - return function () { - refObject.current = null; - }; - } - } - - function mountImperativeHandle(ref, create, deps) { - { - if (typeof create !== 'function') { - error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); - } - } // TODO: If deps are provided, should we skip comparing the ref itself? - - - var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; - return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); - } - - function updateImperativeHandle(ref, create, deps) { - { - if (typeof create !== 'function') { - error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); - } - } // TODO: If deps are provided, should we skip comparing the ref itself? - - - var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; - return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); - } - - function mountDebugValue(value, formatterFn) {// This hook is normally a no-op. - // The react-debug-hooks package injects its own implementation - // so that e.g. DevTools can display custom hook values. - } - - var updateDebugValue = mountDebugValue; - - function mountCallback(callback, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - hook.memoizedState = [callback, nextDeps]; - return callback; - } - - function updateCallback(callback, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var prevState = hook.memoizedState; - - if (prevState !== null) { - if (nextDeps !== null) { - var prevDeps = prevState[1]; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - return prevState[0]; - } - } - } - - hook.memoizedState = [callback, nextDeps]; - return callback; - } - - function mountMemo(nextCreate, deps) { - var hook = mountWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var nextValue = nextCreate(); - hook.memoizedState = [nextValue, nextDeps]; - return nextValue; - } - - function updateMemo(nextCreate, deps) { - var hook = updateWorkInProgressHook(); - var nextDeps = deps === undefined ? null : deps; - var prevState = hook.memoizedState; - - if (prevState !== null) { - // Assume these are defined. If they're not, areHookInputsEqual will warn. - if (nextDeps !== null) { - var prevDeps = prevState[1]; - - if (areHookInputsEqual(nextDeps, prevDeps)) { - return prevState[0]; - } - } - } - - var nextValue = nextCreate(); - hook.memoizedState = [nextValue, nextDeps]; - return nextValue; - } - - function mountDeferredValue(value) { - var _mountState = mountState(value), - prevValue = _mountState[0], - setValue = _mountState[1]; - - mountEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; - } - - function updateDeferredValue(value) { - var _updateState = updateState(), - prevValue = _updateState[0], - setValue = _updateState[1]; - - updateEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; - } - - function rerenderDeferredValue(value) { - var _rerenderState = rerenderState(), - prevValue = _rerenderState[0], - setValue = _rerenderState[1]; - - updateEffect(function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setValue(value); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }, [value]); - return prevValue; - } - - function startTransition(setPending, callback) { - var priorityLevel = getCurrentPriorityLevel(); - - { - runWithPriority(priorityLevel < UserBlockingPriority$1 ? UserBlockingPriority$1 : priorityLevel, function () { - setPending(true); - }); - runWithPriority(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function () { - var prevTransition = ReactCurrentBatchConfig$1.transition; - ReactCurrentBatchConfig$1.transition = 1; - - try { - setPending(false); - callback(); - } finally { - ReactCurrentBatchConfig$1.transition = prevTransition; - } - }); - } - } - - function mountTransition() { - var _mountState2 = mountState(false), - isPending = _mountState2[0], - setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending` - // never changes. - - - var start = startTransition.bind(null, setPending); - mountRef(start); - return [start, isPending]; - } - - function updateTransition() { - var _updateState2 = updateState(), - isPending = _updateState2[0]; - - var startRef = updateRef(); - var start = startRef.current; - return [start, isPending]; - } - - function rerenderTransition() { - var _rerenderState2 = rerenderState(), - isPending = _rerenderState2[0]; - - var startRef = updateRef(); - var start = startRef.current; - return [start, isPending]; - } - - var isUpdatingOpaqueValueInRenderPhase = false; - function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { - { - return isUpdatingOpaqueValueInRenderPhase; - } - } - - function warnOnOpaqueIdentifierAccessInDEV(fiber) { - { - // TODO: Should warn in effects and callbacks, too - var name = getComponentName(fiber.type) || 'Unknown'; - - if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) { - error('The object passed back from useOpaqueIdentifier is meant to be ' + 'passed through to attributes only. Do not read the ' + 'value directly.'); - - didWarnAboutUseOpaqueIdentifier[name] = true; - } - } - } - - function mountOpaqueIdentifier() { - var makeId = makeClientIdInDEV.bind(null, warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1)) ; - - { - var _id = makeId(); - - mountState(_id); - return _id; - } - } - - function updateOpaqueIdentifier() { - var id = updateState()[0]; - return id; - } - - function rerenderOpaqueIdentifier() { - var id = rerenderState()[0]; - return id; - } - - function dispatchAction(fiber, queue, action) { - { - if (typeof arguments[3] === 'function') { - error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); - } - } - - var eventTime = requestEventTime(); - var lane = requestUpdateLane(fiber); - var update = { - lane: lane, - action: action, - eagerReducer: null, - eagerState: null, - next: null - }; // Append the update to the end of the list. - - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - var alternate = fiber.alternate; - - if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) { - // This is a render phase update. Stash it in a lazily-created map of - // queue -> linked list of updates. After this render pass, we'll restart - // and apply the stashed updates on top of the work-in-progress hook. - didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; - } else { - if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) { - // The queue is currently empty, which means we can eagerly compute the - // next state before entering the render phase. If the new state is the - // same as the current state, we may be able to bail out entirely. - var lastRenderedReducer = queue.lastRenderedReducer; - - if (lastRenderedReducer !== null) { - var prevDispatcher; - - { - prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - } - - try { - var currentState = queue.lastRenderedState; - var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute - // it, on the update object. If the reducer hasn't changed by the - // time we enter the render phase, then the eager state can be used - // without calling the reducer again. - - update.eagerReducer = lastRenderedReducer; - update.eagerState = eagerState; - - if (objectIs(eagerState, currentState)) { - // Fast path. We can bail out without scheduling React to re-render. - // It's still possible that we'll need to rebase this update later, - // if the component re-renders for a different reason and by that - // time the reducer has changed. - return; - } - } catch (error) {// Suppress the error. It will throw again in the render phase. - } finally { - { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - } - } - } - - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfNotScopedWithMatchingAct(fiber); - warnIfNotCurrentlyActingUpdatesInDev(fiber); - } - } - - scheduleUpdateOnFiber(fiber, lane, eventTime); - } - } - - var ContextOnlyDispatcher = { - readContext: readContext, - useCallback: throwInvalidHookError, - useContext: throwInvalidHookError, - useEffect: throwInvalidHookError, - useImperativeHandle: throwInvalidHookError, - useLayoutEffect: throwInvalidHookError, - useMemo: throwInvalidHookError, - useReducer: throwInvalidHookError, - useRef: throwInvalidHookError, - useState: throwInvalidHookError, - useDebugValue: throwInvalidHookError, - useDeferredValue: throwInvalidHookError, - useTransition: throwInvalidHookError, - useMutableSource: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, - unstable_isNewReconciler: enableNewReconciler - }; - var HooksDispatcherOnMountInDEV = null; - var HooksDispatcherOnMountWithHookTypesInDEV = null; - var HooksDispatcherOnUpdateInDEV = null; - var HooksDispatcherOnRerenderInDEV = null; - var InvalidNestedHooksDispatcherOnMountInDEV = null; - var InvalidNestedHooksDispatcherOnUpdateInDEV = null; - var InvalidNestedHooksDispatcherOnRerenderInDEV = null; - - { - var warnInvalidContextAccess = function () { - error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); - }; - - var warnInvalidHookAccess = function () { - error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks'); - }; - - HooksDispatcherOnMountInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - mountHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - mountHookTypesDev(); - checkDepsAreArrayDev(deps); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - mountHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - mountHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - mountHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - mountHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - mountHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - mountHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnMountWithHookTypesInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnUpdateInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return updateDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return updateTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return updateOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - HooksDispatcherOnRerenderInDEV = { - readContext: function (context, observedBits) { - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return rerenderReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; - - try { - return rerenderState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - updateHookTypesDev(); - return rerenderDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - updateHookTypesDev(); - return rerenderTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - updateHookTypesDev(); - return rerenderOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnMountInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountRef(initialValue); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; - - try { - return mountState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - mountHookTypesDev(); - return mountOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnUpdateInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - InvalidNestedHooksDispatcherOnRerenderInDEV = { - readContext: function (context, observedBits) { - warnInvalidContextAccess(); - return readContext(context, observedBits); - }, - useCallback: function (callback, deps) { - currentHookNameInDev = 'useCallback'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateCallback(callback, deps); - }, - useContext: function (context, observedBits) { - currentHookNameInDev = 'useContext'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return readContext(context, observedBits); - }, - useEffect: function (create, deps) { - currentHookNameInDev = 'useEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateEffect(create, deps); - }, - useImperativeHandle: function (ref, create, deps) { - currentHookNameInDev = 'useImperativeHandle'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateImperativeHandle(ref, create, deps); - }, - useLayoutEffect: function (create, deps) { - currentHookNameInDev = 'useLayoutEffect'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateLayoutEffect(create, deps); - }, - useMemo: function (create, deps) { - currentHookNameInDev = 'useMemo'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return updateMemo(create, deps); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useReducer: function (reducer, initialArg, init) { - currentHookNameInDev = 'useReducer'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return rerenderReducer(reducer, initialArg, init); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useRef: function (initialValue) { - currentHookNameInDev = 'useRef'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateRef(); - }, - useState: function (initialState) { - currentHookNameInDev = 'useState'; - warnInvalidHookAccess(); - updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; - - try { - return rerenderState(initialState); - } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; - } - }, - useDebugValue: function (value, formatterFn) { - currentHookNameInDev = 'useDebugValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateDebugValue(); - }, - useDeferredValue: function (value) { - currentHookNameInDev = 'useDeferredValue'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderDeferredValue(value); - }, - useTransition: function () { - currentHookNameInDev = 'useTransition'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderTransition(); - }, - useMutableSource: function (source, getSnapshot, subscribe) { - currentHookNameInDev = 'useMutableSource'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return updateMutableSource(source, getSnapshot, subscribe); - }, - useOpaqueIdentifier: function () { - currentHookNameInDev = 'useOpaqueIdentifier'; - warnInvalidHookAccess(); - updateHookTypesDev(); - return rerenderOpaqueIdentifier(); - }, - unstable_isNewReconciler: enableNewReconciler - }; - } - - var now$1 = Scheduler$1.unstable_now; - var commitTime = 0; - var profilerStartTime = -1; - - function getCommitTime() { - return commitTime; - } - - function recordCommitTime() { - - commitTime = now$1(); - } - - function startProfilerTimer(fiber) { - - profilerStartTime = now$1(); - - if (fiber.actualStartTime < 0) { - fiber.actualStartTime = now$1(); - } - } - - function stopProfilerTimerIfRunning(fiber) { - - profilerStartTime = -1; - } - - function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { - - if (profilerStartTime >= 0) { - var elapsedTime = now$1() - profilerStartTime; - fiber.actualDuration += elapsedTime; - - if (overrideBaseTime) { - fiber.selfBaseDuration = elapsedTime; - } - - profilerStartTime = -1; - } - } - - function transferActualDuration(fiber) { - // Transfer time spent rendering these children so we don't lose it - // after we rerender. This is used as a helper in special cases - // where we should count the work of multiple passes. - var child = fiber.child; - - while (child) { - fiber.actualDuration += child.actualDuration; - child = child.sibling; - } - } - - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; - var didReceiveUpdate = false; - var didWarnAboutBadClass; - var didWarnAboutModulePatternComponent; - var didWarnAboutContextTypeOnFunctionComponent; - var didWarnAboutGetDerivedStateOnFunctionComponent; - var didWarnAboutFunctionRefs; - var didWarnAboutReassigningProps; - var didWarnAboutRevealOrder; - var didWarnAboutTailOptions; - - { - didWarnAboutBadClass = {}; - didWarnAboutModulePatternComponent = {}; - didWarnAboutContextTypeOnFunctionComponent = {}; - didWarnAboutGetDerivedStateOnFunctionComponent = {}; - didWarnAboutFunctionRefs = {}; - didWarnAboutReassigningProps = false; - didWarnAboutRevealOrder = {}; - didWarnAboutTailOptions = {}; - } - - function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { - if (current === null) { - // If this is a fresh new component that hasn't been rendered yet, we - // won't update its child set by applying minimal side-effects. Instead, - // we will add them all to the child before it gets rendered. That means - // we can optimize this reconciliation pass by not tracking side-effects. - workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); - } else { - // If the current child is the same as the work in progress, it means that - // we haven't yet started any work on these children. Therefore, we use - // the clone algorithm to create a copy of all the current children. - // If we had any progressed work already, that is invalid at this point so - // let's throw it out. - workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); - } - } - - function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) { - // This function is fork of reconcileChildren. It's used in cases where we - // want to reconcile without matching against the existing set. This has the - // effect of all current children being unmounted; even if the type and key - // are the same, the old child is unmounted and a new child is created. - // - // To do this, we're going to go through the reconcile algorithm twice. In - // the first pass, we schedule a deletion for all the current children by - // passing null. - workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we - // pass null in place of where we usually pass the current child set. This has - // the effect of remounting all children regardless of whether their - // identities match. - - workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); - } - - function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { - // TODO: current can be non-null here even if the component - // hasn't yet mounted. This happens after the first render suspends. - // We'll need to figure out if this is fine or can cause issues. - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } - - var render = Component.render; - var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent - - var nextChildren; - prepareToReadContext(workInProgress, renderLanes); - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); - - setIsRendering(false); - } - - if (current !== null && !didReceiveUpdate) { - bailoutHooks(current, workInProgress, renderLanes); - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function updateMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { - if (current === null) { - var type = Component.type; - - if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. - Component.defaultProps === undefined) { - var resolvedType = type; - - { - resolvedType = resolveFunctionForHotReloading(type); - } // If this is a plain function component without default props, - // and with only the default shallow comparison, we upgrade it - // to a SimpleMemoComponent to allow fast path updates. - - - workInProgress.tag = SimpleMemoComponent; - workInProgress.type = resolvedType; - - { - validateFunctionComponentInDev(workInProgress, type); - } - - return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateLanes, renderLanes); - } - - { - var innerPropTypes = type.propTypes; - - if (innerPropTypes) { - // Inner memo component props aren't currently validated in createElement. - // We could move it there, but we'd still need this for lazy code path. - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(type)); - } - } - - var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); - child.ref = workInProgress.ref; - child.return = workInProgress; - workInProgress.child = child; - return child; - } - - { - var _type = Component.type; - var _innerPropTypes = _type.propTypes; - - if (_innerPropTypes) { - // Inner memo component props aren't currently validated in createElement. - // We could move it there, but we'd still need this for lazy code path. - checkPropTypes(_innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(_type)); - } - } - - var currentChild = current.child; // This is always exactly one child - - if (!includesSomeLane(updateLanes, renderLanes)) { - // This will be the props with resolved defaultProps, - // unlike current.memoizedProps which will be the unresolved ones. - var prevProps = currentChild.memoizedProps; // Default to shallow comparison - - var compare = Component.compare; - compare = compare !== null ? compare : shallowEqual; - - if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - var newChild = createWorkInProgress(currentChild, nextProps); - newChild.ref = workInProgress.ref; - newChild.return = workInProgress; - workInProgress.child = newChild; - return newChild; - } - - function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { - // TODO: current can be non-null here even if the component - // hasn't yet mounted. This happens when the inner render suspends. - // We'll need to figure out if this is fine or can cause issues. - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var outerMemoType = workInProgress.elementType; - - if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { - // We warn when you define propTypes on lazy() - // so let's just skip over it to find memo() outer wrapper. - // Inner props for memo are validated later. - var lazyComponent = outerMemoType; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - outerMemoType = init(payload); - } catch (x) { - outerMemoType = null; - } // Inner propTypes will be validated in the function component path. - - - var outerPropTypes = outerMemoType && outerMemoType.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps) - 'prop', getComponentName(outerMemoType)); - } - } - } - } - - if (current !== null) { - var prevProps = current.memoizedProps; - - if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload. - workInProgress.type === current.type )) { - didReceiveUpdate = false; - - if (!includesSomeLane(renderLanes, updateLanes)) { - // The pending lanes were cleared at the beginning of beginWork. We're - // about to bail out, but there might be other lanes that weren't - // included in the current render. Usually, the priority level of the - // remaining updates is accumlated during the evaluation of the - // component (i.e. when processing the update queue). But since since - // we're bailing out early *without* evaluating the component, we need - // to account for it here, too. Reset to the value of the current fiber. - // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, - // because a MemoComponent fiber does not have hooks or an update queue; - // rather, it wraps around an inner component, which may or may not - // contains hooks. - // TODO: Move the reset at in beginWork out of the common path so that - // this is no longer necessary. - workInProgress.lanes = current.lanes; - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { - // This is a special case that only exists for legacy mode. - // See https://github.com/facebook/react/pull/19216. - didReceiveUpdate = true; - } - } - } - - return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); - } - - function updateOffscreenComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; - var nextChildren = nextProps.children; - var prevState = current !== null ? current.memoizedState : null; - - if (nextProps.mode === 'hidden' || nextProps.mode === 'unstable-defer-without-hiding') { - if ((workInProgress.mode & ConcurrentMode) === NoMode) { - // In legacy sync mode, don't defer the subtree. Render it now. - // TODO: Figure out what we should do in Blocking mode. - var nextState = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = nextState; - pushRenderLanes(workInProgress, renderLanes); - } else if (!includesSomeLane(renderLanes, OffscreenLane)) { - var nextBaseLanes; - - if (prevState !== null) { - var prevBaseLanes = prevState.baseLanes; - nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes); - } else { - nextBaseLanes = renderLanes; - } // Schedule this fiber to re-render at offscreen priority. Then bailout. - - - { - markSpawnedWork(OffscreenLane); - } - - workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane); - var _nextState = { - baseLanes: nextBaseLanes - }; - workInProgress.memoizedState = _nextState; // We're about to bail out, but we need to push this to the stack anyway - // to avoid a push/pop misalignment. - - pushRenderLanes(workInProgress, nextBaseLanes); - return null; - } else { - // Rendering at offscreen, so we can clear the base lanes. - var _nextState2 = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out. - - var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes; - pushRenderLanes(workInProgress, subtreeRenderLanes); - } - } else { - var _subtreeRenderLanes; - - if (prevState !== null) { - _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); // Since we're not hidden anymore, reset the state - - workInProgress.memoizedState = null; - } else { - // We weren't previously hidden, and we still aren't, so there's nothing - // special to do. Need to push to the stack regardless, though, to avoid - // a push/pop misalignment. - _subtreeRenderLanes = renderLanes; - } - - pushRenderLanes(workInProgress, _subtreeRenderLanes); - } - - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } // Note: These happen to have identical begin phases, for now. We shouldn't hold - // ourselves to this constraint, though. If the behavior diverges, we should - // fork the function. - - - var updateLegacyHiddenComponent = updateOffscreenComponent; - - function updateFragment(current, workInProgress, renderLanes) { - var nextChildren = workInProgress.pendingProps; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function updateMode(current, workInProgress, renderLanes) { - var nextChildren = workInProgress.pendingProps.children; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function updateProfiler(current, workInProgress, renderLanes) { - { - workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase. - // These are reset during render to allow the DevTools commit hook a chance to read them, - - var stateNode = workInProgress.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - } - - var nextProps = workInProgress.pendingProps; - var nextChildren = nextProps.children; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function markRef(current, workInProgress) { - var ref = workInProgress.ref; - - if (current === null && ref !== null || current !== null && current.ref !== ref) { - // Schedule a Ref effect - workInProgress.flags |= Ref; - } - } - - function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } - - var context; - - { - var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); - context = getMaskedContext(workInProgress, unmaskedContext); - } - - var nextChildren; - prepareToReadContext(workInProgress, renderLanes); - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); - - setIsRendering(false); - } - - if (current !== null && !didReceiveUpdate) { - bailoutHooks(current, workInProgress, renderLanes); - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { - { - if (workInProgress.type !== workInProgress.elementType) { - // Lazy component props can't be validated in createElement - // because they're only guaranteed to be resolved here. - var innerPropTypes = Component.propTypes; - - if (innerPropTypes) { - checkPropTypes(innerPropTypes, nextProps, // Resolved props - 'prop', getComponentName(Component)); - } - } - } // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - - var hasContext; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - prepareToReadContext(workInProgress, renderLanes); - var instance = workInProgress.stateNode; - var shouldUpdate; - - if (instance === null) { - if (current !== null) { - // A class component without an instance only mounts if it suspended - // inside a non-concurrent tree, in an inconsistent state. We want to - // treat it like a new mount, even though an empty version of it already - // committed. Disconnect the alternate pointers. - current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } // In the initial pass we might need to construct the instance. - - - constructClassInstance(workInProgress, Component, nextProps); - mountClassInstance(workInProgress, Component, nextProps, renderLanes); - shouldUpdate = true; - } else if (current === null) { - // In a resume, we'll already have an instance we can reuse. - shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes); - } else { - shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes); - } - - var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes); - - { - var inst = workInProgress.stateNode; - - if (shouldUpdate && inst.props !== nextProps) { - if (!didWarnAboutReassigningProps) { - error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component'); - } - - didWarnAboutReassigningProps = true; - } - } - - return nextUnitOfWork; - } - - function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) { - // Refs should update even if shouldComponentUpdate returns false - markRef(current, workInProgress); - var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags; - - if (!shouldUpdate && !didCaptureError) { - // Context providers should defer to sCU for rendering - if (hasContext) { - invalidateContextProvider(workInProgress, Component, false); - } - - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - - var instance = workInProgress.stateNode; // Rerender - - ReactCurrentOwner$1.current = workInProgress; - var nextChildren; - - if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') { - // If we captured an error, but getDerivedStateFromError is not defined, - // unmount all the children. componentDidCatch will schedule an update to - // re-render a fallback. This is temporary until we migrate everyone to - // the new API. - // TODO: Warn in a future release. - nextChildren = null; - - { - stopProfilerTimerIfRunning(); - } - } else { - { - setIsRendering(true); - nextChildren = instance.render(); - - setIsRendering(false); - } - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - - if (current !== null && didCaptureError) { - // If we're recovering from an error, reconcile without reusing any of - // the existing children. Conceptually, the normal children and the children - // that are shown on error are two different sets, so we shouldn't reuse - // normal children even if their identities match. - forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes); - } else { - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } // Memoize state using the values we just used to render. - // TODO: Restructure so we never read values from the instance. - - - workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. - - if (hasContext) { - invalidateContextProvider(workInProgress, Component, true); - } - - return workInProgress.child; - } - - function pushHostRootContext(workInProgress) { - var root = workInProgress.stateNode; - - if (root.pendingContext) { - pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); - } else if (root.context) { - // Should always be set - pushTopLevelContextObject(workInProgress, root.context, false); - } - - pushHostContainer(workInProgress, root.containerInfo); - } - - function updateHostRoot(current, workInProgress, renderLanes) { - pushHostRootContext(workInProgress); - var updateQueue = workInProgress.updateQueue; - - if (!(current !== null && updateQueue !== null)) { - { - throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var nextProps = workInProgress.pendingProps; - var prevState = workInProgress.memoizedState; - var prevChildren = prevState !== null ? prevState.element : null; - cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, nextProps, null, renderLanes); - var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property - // being called "element". - - var nextChildren = nextState.element; - - if (nextChildren === prevChildren) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - - var root = workInProgress.stateNode; - - if (root.hydrate && enterHydrationState()) { - - var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); - workInProgress.child = child; - var node = child; - - while (node) { - // Mark each child as hydrating. This is a fast path to know whether this - // tree is part of a hydrating tree. This is used to determine if a child - // node has fully mounted yet, and for scheduling event replaying. - // Conceptually this is similar to Placement in that a new subtree is - // inserted into the React tree here. It just happens to not need DOM - // mutations because it already exists. - node.flags = node.flags & ~Placement | Hydrating; - node = node.sibling; - } - } else { - // Otherwise reset hydration state in case we aborted and resumed another - // root. - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } - - return workInProgress.child; - } - - function updateHostComponent(current, workInProgress, renderLanes) { - pushHostContext(workInProgress); - - var type = workInProgress.type; - var nextProps = workInProgress.pendingProps; - var prevProps = current !== null ? current.memoizedProps : null; - var nextChildren = nextProps.children; - - if (prevProps !== null && shouldSetTextContent()) { - // If we're switching from a direct text child to a normal child, or to - // empty, we need to schedule the text content to be reset. - workInProgress.flags |= ContentReset; - } - - markRef(current, workInProgress); - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - return workInProgress.child; - } - - function updateHostText(current, workInProgress) { - // immediately after. - - - return null; - } - - function mountLazyComponent(_current, workInProgress, elementType, updateLanes, renderLanes) { - if (_current !== null) { - // A lazy component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } - - var props = workInProgress.pendingProps; - var lazyComponent = elementType; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - var Component = init(payload); // Store the unwrapped component in the type. - - workInProgress.type = Component; - var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); - var resolvedProps = resolveDefaultProps(Component, props); - var child; - - switch (resolvedTag) { - case FunctionComponent: - { - { - validateFunctionComponentInDev(workInProgress, Component); - workInProgress.type = Component = resolveFunctionForHotReloading(Component); - } - - child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case ClassComponent: - { - { - workInProgress.type = Component = resolveClassForHotReloading(Component); - } - - child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case ForwardRef: - { - { - workInProgress.type = Component = resolveForwardRefForHotReloading(Component); - } - - child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes); - return child; - } - - case MemoComponent: - { - { - if (workInProgress.type !== workInProgress.elementType) { - var outerPropTypes = Component.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only - 'prop', getComponentName(Component)); - } - } - } - - child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too - updateLanes, renderLanes); - return child; - } - } - - var hint = ''; - - { - if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) { - hint = ' Did you wrap a component in React.lazy() more than once?'; - } - } // This message intentionally doesn't mention ForwardRef or MemoComponent - // because the fact that it's a separate type of work is an - // implementation detail. - - - { - { - throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint ); - } - } - } - - function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) { - if (_current !== null) { - // An incomplete component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } // Promote the fiber to a class and try rendering again. - - - workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` - // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - var hasContext; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - prepareToReadContext(workInProgress, renderLanes); - constructClassInstance(workInProgress, Component, nextProps); - mountClassInstance(workInProgress, Component, nextProps, renderLanes); - return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); - } - - function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) { - if (_current !== null) { - // An indeterminate component only mounts if it suspended inside a non- - // concurrent tree, in an inconsistent state. We want to treat it like - // a new mount, even though an empty version of it already committed. - // Disconnect the alternate pointers. - _current.alternate = null; - workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect - - workInProgress.flags |= Placement; - } - - var props = workInProgress.pendingProps; - var context; - - { - var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); - context = getMaskedContext(workInProgress, unmaskedContext); - } - - prepareToReadContext(workInProgress, renderLanes); - var value; - - { - if (Component.prototype && typeof Component.prototype.render === 'function') { - var componentName = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutBadClass[componentName]) { - error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictMode) { - ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); - } - - setIsRendering(true); - ReactCurrentOwner$1.current = workInProgress; - value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); - setIsRendering(false); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - - { - // Support for module components is deprecated and is removed behind a flag. - // Whether or not it would crash later, we want to show a good message in DEV first. - if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { - var _componentName = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutModulePatternComponent[_componentName]) { - error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName); - - didWarnAboutModulePatternComponent[_componentName] = true; - } - } - } - - if ( // Run these checks in production only if the flag is off. - // Eventually we'll delete this branch altogether. - typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { - { - var _componentName2 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutModulePatternComponent[_componentName2]) { - error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2); - - didWarnAboutModulePatternComponent[_componentName2] = true; - } - } // Proceed under the assumption that this is a class instance - - - workInProgress.tag = ClassComponent; // Throw out any hooks that were used. - - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. - // During mounting we don't know the child context yet as the instance doesn't exist. - // We will invalidate the child context in finishClassComponent() right after rendering. - - var hasContext = false; - - if (isContextProvider(Component)) { - hasContext = true; - pushContextProvider(workInProgress); - } else { - hasContext = false; - } - - workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; - initializeUpdateQueue(workInProgress); - var getDerivedStateFromProps = Component.getDerivedStateFromProps; - - if (typeof getDerivedStateFromProps === 'function') { - applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props); - } - - adoptClassInstance(workInProgress, value); - mountClassInstance(workInProgress, Component, props, renderLanes); - return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); - } else { - // Proceed under the assumption that this is a function component - workInProgress.tag = FunctionComponent; - - reconcileChildren(null, workInProgress, value, renderLanes); - - { - validateFunctionComponentInDev(workInProgress, Component); - } - - return workInProgress.child; - } - } - - function validateFunctionComponentInDev(workInProgress, Component) { - { - if (Component) { - if (Component.childContextTypes) { - error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component'); - } - } - - if (workInProgress.ref !== null) { - var info = ''; - var ownerName = getCurrentFiberOwnerNameInDevOrNull(); - - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } - - var warningKey = ownerName || workInProgress._debugID || ''; - var debugSource = workInProgress._debugSource; - - if (debugSource) { - warningKey = debugSource.fileName + ':' + debugSource.lineNumber; - } - - if (!didWarnAboutFunctionRefs[warningKey]) { - didWarnAboutFunctionRefs[warningKey] = true; - - error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info); - } - } - - if (typeof Component.getDerivedStateFromProps === 'function') { - var _componentName3 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) { - error('%s: Function components do not support getDerivedStateFromProps.', _componentName3); - - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; - } - } - - if (typeof Component.contextType === 'object' && Component.contextType !== null) { - var _componentName4 = getComponentName(Component) || 'Unknown'; - - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { - error('%s: Function components do not support contextType.', _componentName4); - - didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; - } - } - } - } - - var SUSPENDED_MARKER = { - dehydrated: null, - retryLane: NoLane - }; - - function mountSuspenseOffscreenState(renderLanes) { - return { - baseLanes: renderLanes - }; - } - - function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) { - return { - baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes) - }; - } // TODO: Probably should inline this back - - - function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) { - // If we're already showing a fallback, there are cases where we need to - // remain on that fallback regardless of whether the content has resolved. - // For example, SuspenseList coordinates when nested content appears. - if (current !== null) { - var suspenseState = current.memoizedState; - - if (suspenseState === null) { - // Currently showing content. Don't hide it, even if ForceSuspenseFallack - // is true. More precise name might be "ForceRemainSuspenseFallback". - // Note: This is a factoring smell. Can't remain on a fallback if there's - // no fallback to remain on. - return false; - } - } // Not currently showing content. Consult the Suspense context. - - - return hasSuspenseContext(suspenseContext, ForceSuspenseFallback); - } - - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); - } - - function updateSuspenseComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. - - { - if (shouldSuspend(workInProgress)) { - workInProgress.flags |= DidCapture; - } - } - - var suspenseContext = suspenseStackCursor.current; - var showFallback = false; - var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags; - - if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { - // Something in this boundary's subtree already suspended. Switch to - // rendering the fallback children. - showFallback = true; - workInProgress.flags &= ~DidCapture; - } else { - // Attempting the main content - if (current === null || current.memoizedState !== null) { - // This is a new mount or this boundary is already showing a fallback state. - // Mark this subtree context as having at least one invisible parent that could - // handle the fallback state. - // Boundaries without fallbacks or should be avoided are not considered since - // they cannot handle preferred fallback states. - if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) { - suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); - } - } - } - - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense - // boundary's children. This involves some custom reconcilation logic. Two - // main reasons this is so complicated. - // - // First, Legacy Mode has different semantics for backwards compatibility. The - // primary tree will commit in an inconsistent state, so when we do the - // second pass to render the fallback, we do some exceedingly, uh, clever - // hacks to make that not totally break. Like transferring effects and - // deletions from hidden tree. In Concurrent Mode, it's much simpler, - // because we bailout on the primary tree completely and leave it in its old - // state, no effects. Same as what we do for Offscreen (except that - // Offscreen doesn't have the first render pass). - // - // Second is hydration. During hydration, the Suspense fiber has a slightly - // different layout, where the child points to a dehydrated fragment, which - // contains the DOM rendered by the server. - // - // Third, even if you set all that aside, Suspense is like error boundaries in - // that we first we try to render one tree, and if that fails, we render again - // and switch to a different tree. Like a try/catch block. So we have to track - // which branch we're currently rendering. Ideally we would model this using - // a stack. - - if (current === null) { - // Initial mount - // If we're currently hydrating, try to hydrate this boundary. - // But only if this has a fallback. - if (nextProps.fallback !== undefined) ; - - var nextPrimaryChildren = nextProps.children; - var nextFallbackChildren = nextProps.fallback; - - if (showFallback) { - var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); - var primaryChildFragment = workInProgress.child; - primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; - return fallbackFragment; - } else if (typeof nextProps.unstable_expectedLoadTime === 'number') { - // This is a CPU-bound tree. Skip this tree and show a placeholder to - // unblock the surrounding content. Then immediately retry after the - // initial commit. - var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); - - var _primaryChildFragment = workInProgress.child; - _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to - // get it started back up to attempt the next item. While in terms of - // priority this work has the same priority as this current render, it's - // not part of the same transition once the transition has committed. If - // it's sync, we still want to yield so that it can be painted. - // Conceptually, this is really the same as pinging. We can use any - // RetryLane even if it's the one currently rendering since we're leaving - // it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - - return _fallbackFragment; - } else { - return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes); - } - } else { - // This is an update. - // If the current fiber has a SuspenseState, that means it's already showing - // a fallback. - var prevState = current.memoizedState; - - if (prevState !== null) { - - if (showFallback) { - var _nextFallbackChildren2 = nextProps.fallback; - var _nextPrimaryChildren2 = nextProps.children; - - var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes); - - var _primaryChildFragment3 = workInProgress.child; - var prevOffscreenState = current.child.memoizedState; - _primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes); - _primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); - workInProgress.memoizedState = SUSPENDED_MARKER; - return _fallbackChildFragment; - } else { - var _nextPrimaryChildren3 = nextProps.children; - - var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes); - - workInProgress.memoizedState = null; - return _primaryChildFragment4; - } - } else { - // The current tree is not already showing a fallback. - if (showFallback) { - // Timed out. - var _nextFallbackChildren3 = nextProps.fallback; - var _nextPrimaryChildren4 = nextProps.children; - - var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes); - - var _primaryChildFragment5 = workInProgress.child; - var _prevOffscreenState = current.child.memoizedState; - _primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes); - _primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the - // fallback children. - - workInProgress.memoizedState = SUSPENDED_MARKER; - return _fallbackChildFragment2; - } else { - // Still haven't timed out. Continue rendering the children, like we - // normally do. - var _nextPrimaryChildren5 = nextProps.children; - - var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes); - - workInProgress.memoizedState = null; - return _primaryChildFragment6; - } - } - } - } - - function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) { - var mode = workInProgress.mode; - var primaryChildProps = { - mode: 'visible', - children: primaryChildren - }; - var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes, null); - primaryChildFragment.return = workInProgress; - workInProgress.child = primaryChildFragment; - return primaryChildFragment; - } - - function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) { - var mode = workInProgress.mode; - var progressedPrimaryFragment = workInProgress.child; - var primaryChildProps = { - mode: 'hidden', - children: primaryChildren - }; - var primaryChildFragment; - var fallbackChildFragment; - - if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) { - // In legacy mode, we commit the primary tree as if it successfully - // completed, even though it's in an inconsistent state. - primaryChildFragment = progressedPrimaryFragment; - primaryChildFragment.childLanes = NoLanes; - primaryChildFragment.pendingProps = primaryChildProps; - - if ( workInProgress.mode & ProfileMode) { - // Reset the durations from the first pass so they aren't included in the - // final amounts. This seems counterintuitive, since we're intentionally - // not measuring part of the render phase, but this makes it match what we - // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; - primaryChildFragment.selfBaseDuration = 0; - primaryChildFragment.treeBaseDuration = 0; - } - - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); - } else { - primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null); - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); - } - - primaryChildFragment.return = workInProgress; - fallbackChildFragment.return = workInProgress; - primaryChildFragment.sibling = fallbackChildFragment; - workInProgress.child = primaryChildFragment; - return fallbackChildFragment; - } - - function createWorkInProgressOffscreenFiber(current, offscreenProps) { - // The props argument to `createWorkInProgress` is `any` typed, so we use this - // wrapper function to constrain it. - return createWorkInProgress(current, offscreenProps); - } - - function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { - var currentPrimaryChildFragment = current.child; - var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; - var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, { - mode: 'visible', - children: primaryChildren - }); - - if ((workInProgress.mode & BlockingMode) === NoMode) { - primaryChildFragment.lanes = renderLanes; - } - - primaryChildFragment.return = workInProgress; - primaryChildFragment.sibling = null; - - if (currentFallbackChildFragment !== null) { - // Delete the fallback child fragment - currentFallbackChildFragment.nextEffect = null; - currentFallbackChildFragment.flags = Deletion; - workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; - } - - workInProgress.child = primaryChildFragment; - return primaryChildFragment; - } - - function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { - var mode = workInProgress.mode; - var currentPrimaryChildFragment = current.child; - var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; - var primaryChildProps = { - mode: 'hidden', - children: primaryChildren - }; - var primaryChildFragment; - - if ( // In legacy mode, we commit the primary tree as if it successfully - // completed, even though it's in an inconsistent state. - (mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was - // already cloned. In legacy mode, the only case where this isn't true is - // when DevTools forces us to display a fallback; we skip the first render - // pass entirely and go straight to rendering the fallback. (In Concurrent - // Mode, SuspenseList can also trigger this scenario, but this is a legacy- - // only codepath.) - workInProgress.child !== currentPrimaryChildFragment) { - var progressedPrimaryFragment = workInProgress.child; - primaryChildFragment = progressedPrimaryFragment; - primaryChildFragment.childLanes = NoLanes; - primaryChildFragment.pendingProps = primaryChildProps; - - if ( workInProgress.mode & ProfileMode) { - // Reset the durations from the first pass so they aren't included in the - // final amounts. This seems counterintuitive, since we're intentionally - // not measuring part of the render phase, but this makes it match what we - // do in Concurrent Mode. - primaryChildFragment.actualDuration = 0; - primaryChildFragment.actualStartTime = -1; - primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; - primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration; - } // The fallback fiber was added as a deletion effect during the first pass. - // However, since we're going to remain on the fallback, we no longer want - // to delete it. So we need to remove it from the list. Deletions are stored - // on the same list as effects. We want to keep the effects from the primary - // tree. So we copy the primary child fragment's effect list, which does not - // include the fallback deletion effect. - - - var progressedLastEffect = primaryChildFragment.lastEffect; - - if (progressedLastEffect !== null) { - workInProgress.firstEffect = primaryChildFragment.firstEffect; - workInProgress.lastEffect = progressedLastEffect; - progressedLastEffect.nextEffect = null; - } else { - // TODO: Reset this somewhere else? Lol legacy mode is so weird. - workInProgress.firstEffect = workInProgress.lastEffect = null; - } - } else { - primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); - } - - var fallbackChildFragment; - - if (currentFallbackChildFragment !== null) { - fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren); - } else { - fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already - // mounted but this is a new fiber. - - fallbackChildFragment.flags |= Placement; - } - - fallbackChildFragment.return = workInProgress; - primaryChildFragment.return = workInProgress; - primaryChildFragment.sibling = fallbackChildFragment; - workInProgress.child = primaryChildFragment; - return fallbackChildFragment; - } - - function scheduleWorkOnFiber(fiber, renderLanes) { - fiber.lanes = mergeLanes(fiber.lanes, renderLanes); - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, renderLanes); - } - - scheduleWorkOnParentPath(fiber.return, renderLanes); - } - - function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) { - // Mark any Suspense boundaries with fallbacks as having work to do. - // If they were previously forced into fallbacks, they may now be able - // to unblock. - var node = firstChild; - - while (node !== null) { - if (node.tag === SuspenseComponent) { - var state = node.memoizedState; - - if (state !== null) { - scheduleWorkOnFiber(node, renderLanes); - } - } else if (node.tag === SuspenseListComponent) { - // If the tail is hidden there might not be an Suspense boundaries - // to schedule work on. In this case we have to schedule it on the - // list itself. - // We don't have to traverse to the children of the list since - // the list will propagate the change when it rerenders. - scheduleWorkOnFiber(node, renderLanes); - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === workInProgress) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === workInProgress) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - function findLastContentRow(firstChild) { - // This is going to find the last row among these children that is already - // showing content on the screen, as opposed to being in fallback state or - // new. If a row has multiple Suspense boundaries, any of them being in the - // fallback state, counts as the whole row being in a fallback state. - // Note that the "rows" will be workInProgress, but any nested children - // will still be current since we haven't rendered them yet. The mounted - // order may not be the same as the new order. We use the new order. - var row = firstChild; - var lastContentRow = null; - - while (row !== null) { - var currentRow = row.alternate; // New rows can't be content rows. - - if (currentRow !== null && findFirstSuspended(currentRow) === null) { - lastContentRow = row; - } - - row = row.sibling; - } - - return lastContentRow; - } - - function validateRevealOrder(revealOrder) { - { - if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) { - didWarnAboutRevealOrder[revealOrder] = true; - - if (typeof revealOrder === 'string') { - switch (revealOrder.toLowerCase()) { - case 'together': - case 'forwards': - case 'backwards': - { - error('"%s" is not a valid value for revealOrder on . ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); - - break; - } - - case 'forward': - case 'backward': - { - error('"%s" is not a valid value for revealOrder on . ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); - - break; - } - - default: - error('"%s" is not a supported revealOrder on . ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); - - break; - } - } else { - error('%s is not a supported value for revealOrder on . ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); - } - } - } - } - - function validateTailOptions(tailMode, revealOrder) { - { - if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { - if (tailMode !== 'collapsed' && tailMode !== 'hidden') { - didWarnAboutTailOptions[tailMode] = true; - - error('"%s" is not a supported value for tail on . ' + 'Did you mean "collapsed" or "hidden"?', tailMode); - } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') { - didWarnAboutTailOptions[tailMode] = true; - - error(' is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode); - } - } - } - } - - function validateSuspenseListNestedChild(childSlot, index) { - { - var isArray = Array.isArray(childSlot); - var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function'; - - if (isArray || isIterable) { - var type = isArray ? 'array' : 'iterable'; - - error('A nested %s was passed to row #%s in . Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + ' ... ' + '{%s} ... ' + '', type, index, type); - - return false; - } - } - - return true; - } - - function validateSuspenseListChildren(children, revealOrder) { - { - if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - if (!validateSuspenseListNestedChild(children[i], i)) { - return; - } - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - var childrenIterator = iteratorFn.call(children); - - if (childrenIterator) { - var step = childrenIterator.next(); - var _i = 0; - - for (; !step.done; step = childrenIterator.next()) { - if (!validateSuspenseListNestedChild(step.value, _i)) { - return; - } - - _i++; - } - } - } else { - error('A single row was passed to a . ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder); - } - } - } - } - } - - function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) { - var renderState = workInProgress.memoizedState; - - if (renderState === null) { - workInProgress.memoizedState = { - isBackwards: isBackwards, - rendering: null, - renderingStartTime: 0, - last: lastContentRow, - tail: tail, - tailMode: tailMode, - lastEffect: lastEffectBeforeRendering - }; - } else { - // We can reuse the existing object from previous renders. - renderState.isBackwards = isBackwards; - renderState.rendering = null; - renderState.renderingStartTime = 0; - renderState.last = lastContentRow; - renderState.tail = tail; - renderState.tailMode = tailMode; - renderState.lastEffect = lastEffectBeforeRendering; - } - } // This can end up rendering this component multiple passes. - // The first pass splits the children fibers into two sets. A head and tail. - // We first render the head. If anything is in fallback state, we do another - // pass through beginWork to rerender all children (including the tail) with - // the force suspend context. If the first render didn't have anything in - // in fallback state. Then we render each row in the tail one-by-one. - // That happens in the completeWork phase without going back to beginWork. - - - function updateSuspenseListComponent(current, workInProgress, renderLanes) { - var nextProps = workInProgress.pendingProps; - var revealOrder = nextProps.revealOrder; - var tailMode = nextProps.tail; - var newChildren = nextProps.children; - validateRevealOrder(revealOrder); - validateTailOptions(tailMode, revealOrder); - validateSuspenseListChildren(newChildren, revealOrder); - reconcileChildren(current, workInProgress, newChildren, renderLanes); - var suspenseContext = suspenseStackCursor.current; - var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); - - if (shouldForceFallback) { - suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); - workInProgress.flags |= DidCapture; - } else { - var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags; - - if (didSuspendBefore) { - // If we previously forced a fallback, we need to schedule work - // on any nested boundaries to let them know to try to render - // again. This is the same as context updating. - propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes); - } - - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - } - - pushSuspenseContext(workInProgress, suspenseContext); - - if ((workInProgress.mode & BlockingMode) === NoMode) { - // In legacy mode, SuspenseList doesn't work so we just - // use make it a noop by treating it as the default revealOrder. - workInProgress.memoizedState = null; - } else { - switch (revealOrder) { - case 'forwards': - { - var lastContentRow = findLastContentRow(workInProgress.child); - var tail; - - if (lastContentRow === null) { - // The whole list is part of the tail. - // TODO: We could fast path by just rendering the tail now. - tail = workInProgress.child; - workInProgress.child = null; - } else { - // Disconnect the tail rows after the content row. - // We're going to render them separately later. - tail = lastContentRow.sibling; - lastContentRow.sibling = null; - } - - initSuspenseListRenderState(workInProgress, false, // isBackwards - tail, lastContentRow, tailMode, workInProgress.lastEffect); - break; - } - - case 'backwards': - { - // We're going to find the first row that has existing content. - // At the same time we're going to reverse the list of everything - // we pass in the meantime. That's going to be our tail in reverse - // order. - var _tail = null; - var row = workInProgress.child; - workInProgress.child = null; - - while (row !== null) { - var currentRow = row.alternate; // New rows can't be content rows. - - if (currentRow !== null && findFirstSuspended(currentRow) === null) { - // This is the beginning of the main content. - workInProgress.child = row; - break; - } - - var nextRow = row.sibling; - row.sibling = _tail; - _tail = row; - row = nextRow; - } // TODO: If workInProgress.child is null, we can continue on the tail immediately. - - - initSuspenseListRenderState(workInProgress, true, // isBackwards - _tail, null, // last - tailMode, workInProgress.lastEffect); - break; - } - - case 'together': - { - initSuspenseListRenderState(workInProgress, false, // isBackwards - null, // tail - null, // last - undefined, workInProgress.lastEffect); - break; - } - - default: - { - // The default reveal order is the same as not having - // a boundary. - workInProgress.memoizedState = null; - } - } - } - - return workInProgress.child; - } - - function updatePortalComponent(current, workInProgress, renderLanes) { - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - var nextChildren = workInProgress.pendingProps; - - if (current === null) { - // Portals are special because we don't append the children during mount - // but at commit. Therefore we need to track insertions which the normal - // flow doesn't do during mount. This doesn't happen at the root because - // the root always starts with a "current" with a null child. - // TODO: Consider unifying this with how the root works. - workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); - } else { - reconcileChildren(current, workInProgress, nextChildren, renderLanes); - } - - return workInProgress.child; - } - - var hasWarnedAboutUsingNoValuePropOnContextProvider = false; - - function updateContextProvider(current, workInProgress, renderLanes) { - var providerType = workInProgress.type; - var context = providerType._context; - var newProps = workInProgress.pendingProps; - var oldProps = workInProgress.memoizedProps; - var newValue = newProps.value; - - { - if (!('value' in newProps)) { - if (!hasWarnedAboutUsingNoValuePropOnContextProvider) { - hasWarnedAboutUsingNoValuePropOnContextProvider = true; - - error('The `value` prop is required for the ``. Did you misspell it or forget to pass it?'); - } - } - - var providerPropTypes = workInProgress.type.propTypes; - - if (providerPropTypes) { - checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider'); - } - } - - pushProvider(workInProgress, newValue); - - if (oldProps !== null) { - var oldValue = oldProps.value; - var changedBits = calculateChangedBits(context, newValue, oldValue); - - if (changedBits === 0) { - // No change. Bailout early if children are the same. - if (oldProps.children === newProps.children && !hasContextChanged()) { - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } - } else { - // The context value changed. Search for matching consumers and schedule - // them to update. - propagateContextChange(workInProgress, context, changedBits, renderLanes); - } - } - - var newChildren = newProps.children; - reconcileChildren(current, workInProgress, newChildren, renderLanes); - return workInProgress.child; - } - - var hasWarnedAboutUsingContextAsConsumer = false; - - function updateContextConsumer(current, workInProgress, renderLanes) { - var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In - // DEV mode, we create a separate object for Context.Consumer that acts - // like a proxy to Context. This proxy object adds unnecessary code in PROD - // so we use the old behaviour (Context.Consumer references Context) to - // reduce size and overhead. The separate object references context via - // a property called "_context", which also gives us the ability to check - // in DEV mode if this property exists or not and warn if it does not. - - { - if (context._context === undefined) { - // This may be because it's a Context (rather than a Consumer). - // Or it may be because it's older React where they're the same thing. - // We only want to warn if we're sure it's a new React. - if (context !== context.Consumer) { - if (!hasWarnedAboutUsingContextAsConsumer) { - hasWarnedAboutUsingContextAsConsumer = true; - - error('Rendering directly is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - } - } else { - context = context._context; - } - } - - var newProps = workInProgress.pendingProps; - var render = newProps.children; - - { - if (typeof render !== 'function') { - error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); - } - } - - prepareToReadContext(workInProgress, renderLanes); - var newValue = readContext(context, newProps.unstable_observedBits); - var newChildren; - - { - ReactCurrentOwner$1.current = workInProgress; - setIsRendering(true); - newChildren = render(newValue); - setIsRendering(false); - } // React DevTools reads this flag. - - - workInProgress.flags |= PerformedWork; - reconcileChildren(current, workInProgress, newChildren, renderLanes); - return workInProgress.child; - } - - function markWorkInProgressReceivedUpdate() { - didReceiveUpdate = true; - } - - function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { - if (current !== null) { - // Reuse previous dependencies - workInProgress.dependencies = current.dependencies; - } - - { - // Don't update "base" render times for bailouts. - stopProfilerTimerIfRunning(); - } - - markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work. - - if (!includesSomeLane(renderLanes, workInProgress.childLanes)) { - // The children don't have any work either. We can skip them. - // TODO: Once we add back resuming, we should check if the children are - // a work-in-progress set. If so, we need to transfer their effects. - return null; - } else { - // This fiber doesn't have work, but its subtree does. Clone the child - // fibers and continue. - cloneChildFibers(current, workInProgress); - return workInProgress.child; - } - } - - function remountFiber(current, oldWorkInProgress, newWorkInProgress) { - { - var returnFiber = oldWorkInProgress.return; - - if (returnFiber === null) { - throw new Error('Cannot swap the root fiber.'); - } // Disconnect from the old current. - // It will get deleted. - - - current.alternate = null; - oldWorkInProgress.alternate = null; // Connect to the new tree. - - newWorkInProgress.index = oldWorkInProgress.index; - newWorkInProgress.sibling = oldWorkInProgress.sibling; - newWorkInProgress.return = oldWorkInProgress.return; - newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. - - if (oldWorkInProgress === returnFiber.child) { - returnFiber.child = newWorkInProgress; - } else { - var prevSibling = returnFiber.child; - - if (prevSibling === null) { - throw new Error('Expected parent to have a child.'); - } - - while (prevSibling.sibling !== oldWorkInProgress) { - prevSibling = prevSibling.sibling; - - if (prevSibling === null) { - throw new Error('Expected to find the previous sibling.'); - } - } - - prevSibling.sibling = newWorkInProgress; - } // Delete the old fiber and place the new one. - // Since the old fiber is disconnected, we have to schedule it manually. - - - var last = returnFiber.lastEffect; - - if (last !== null) { - last.nextEffect = current; - returnFiber.lastEffect = current; - } else { - returnFiber.firstEffect = returnFiber.lastEffect = current; - } - - current.nextEffect = null; - current.flags = Deletion; - newWorkInProgress.flags |= Placement; // Restart work from the new fiber. - - return newWorkInProgress; - } - } - - function beginWork(current, workInProgress, renderLanes) { - var updateLanes = workInProgress.lanes; - - { - if (workInProgress._debugNeedsRemount && current !== null) { - // This will restart the begin phase with a new fiber. - return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); - } - } - - if (current !== null) { - var oldProps = current.memoizedProps; - var newProps = workInProgress.pendingProps; - - if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: - workInProgress.type !== current.type )) { - // If props or context changed, mark the fiber as having performed work. - // This may be unset if the props are determined to be equal later (memo). - didReceiveUpdate = true; - } else if (!includesSomeLane(renderLanes, updateLanes)) { - didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering - // the begin phase. There's still some bookkeeping we that needs to be done - // in this optimized path, mostly pushing stuff onto the stack. - - switch (workInProgress.tag) { - case HostRoot: - pushHostRootContext(workInProgress); - break; - - case HostComponent: - pushHostContext(workInProgress); - break; - - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - pushContextProvider(workInProgress); - } - - break; - } - - case HostPortal: - pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); - break; - - case ContextProvider: - { - var newValue = workInProgress.memoizedProps.value; - pushProvider(workInProgress, newValue); - break; - } - - case Profiler: - { - // Profiler should only call onRender when one of its descendants actually rendered. - var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); - - if (hasChildWork) { - workInProgress.flags |= Update; - } // Reset effect durations for the next eventual effect phase. - // These are reset during render to allow the DevTools commit hook a chance to read them, - - - var stateNode = workInProgress.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - } - - break; - - case SuspenseComponent: - { - var state = workInProgress.memoizedState; - - if (state !== null) { - // whether to retry the primary children, or to skip over it and - // go straight to the fallback. Check the priority of the primary - // child fragment. - - - var primaryChildFragment = workInProgress.child; - var primaryChildLanes = primaryChildFragment.childLanes; - - if (includesSomeLane(renderLanes, primaryChildLanes)) { - // The primary children have pending work. Use the normal path - // to attempt to render the primary children again. - return updateSuspenseComponent(current, workInProgress, renderLanes); - } else { - // The primary child fragment does not have pending work marked - // on it - pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient - // priority. Bailout. - - var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - - if (child !== null) { - // The fallback children have pending work. Skip over the - // primary children and work on the fallback. - return child.sibling; - } else { - return null; - } - } - } else { - pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); - } - - break; - } - - case SuspenseListComponent: - { - var didSuspendBefore = (current.flags & DidCapture) !== NoFlags; - - var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); - - if (didSuspendBefore) { - if (_hasChildWork) { - // If something was in fallback state last time, and we have all the - // same children then we're still in progressive loading state. - // Something might get unblocked by state updates or retries in the - // tree which will affect the tail. So we need to use the normal - // path to compute the correct tail. - return updateSuspenseListComponent(current, workInProgress, renderLanes); - } // If none of the children had any work, that means that none of - // them got retried so they'll still be blocked in the same way - // as before. We can fast bail out. - - - workInProgress.flags |= DidCapture; - } // If nothing suspended before and we're rendering the same children, - // then the tail doesn't matter. Anything new that suspends will work - // in the "together" mode, so we can continue from the state we had. - - - var renderState = workInProgress.memoizedState; - - if (renderState !== null) { - // Reset to the "together" mode in case we've started a different - // update in the past but didn't complete it. - renderState.rendering = null; - renderState.tail = null; - renderState.lastEffect = null; - } - - pushSuspenseContext(workInProgress, suspenseStackCursor.current); - - if (_hasChildWork) { - break; - } else { - // If none of the children had any work, that means that none of - // them got retried so they'll still be blocked in the same way - // as before. We can fast bail out. - return null; - } - } - - case OffscreenComponent: - case LegacyHiddenComponent: - { - // Need to check if the tree still needs to be deferred. This is - // almost identical to the logic used in the normal update path, - // so we'll just enter that. The only difference is we'll bail out - // at the next level instead of this one, because the child props - // have not changed. Which is fine. - // TODO: Probably should refactor `beginWork` to split the bailout - // path from the normal path. I'm tempted to do a labeled break here - // but I won't :) - workInProgress.lanes = NoLanes; - return updateOffscreenComponent(current, workInProgress, renderLanes); - } - } - - return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } else { - if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { - // This is a special case that only exists for legacy mode. - // See https://github.com/facebook/react/pull/19216. - didReceiveUpdate = true; - } else { - // An update was scheduled on this fiber, but there are no new props - // nor legacy context. Set this to false. If an update queue or context - // consumer produces a changed value, it will set this to true. Otherwise, - // the component will assume the children have not changed and bail out. - didReceiveUpdate = false; - } - } - } else { - didReceiveUpdate = false; - } // Before entering the begin phase, clear pending update priority. - // TODO: This assumes that we're about to evaluate the component and process - // the update queue. However, there's an exception: SimpleMemoComponent - // sometimes bails out later in the begin phase. This indicates that we should - // move this assignment out of the common path and into each branch. - - - workInProgress.lanes = NoLanes; - - switch (workInProgress.tag) { - case IndeterminateComponent: - { - return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes); - } - - case LazyComponent: - { - var elementType = workInProgress.elementType; - return mountLazyComponent(current, workInProgress, elementType, updateLanes, renderLanes); - } - - case FunctionComponent: - { - var _Component = workInProgress.type; - var unresolvedProps = workInProgress.pendingProps; - var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps); - return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderLanes); - } - - case ClassComponent: - { - var _Component2 = workInProgress.type; - var _unresolvedProps = workInProgress.pendingProps; - - var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps); - - return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderLanes); - } - - case HostRoot: - return updateHostRoot(current, workInProgress, renderLanes); - - case HostComponent: - return updateHostComponent(current, workInProgress, renderLanes); - - case HostText: - return updateHostText(); - - case SuspenseComponent: - return updateSuspenseComponent(current, workInProgress, renderLanes); - - case HostPortal: - return updatePortalComponent(current, workInProgress, renderLanes); - - case ForwardRef: - { - var type = workInProgress.type; - var _unresolvedProps2 = workInProgress.pendingProps; - - var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); - - return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes); - } - - case Fragment: - return updateFragment(current, workInProgress, renderLanes); - - case Mode: - return updateMode(current, workInProgress, renderLanes); - - case Profiler: - return updateProfiler(current, workInProgress, renderLanes); - - case ContextProvider: - return updateContextProvider(current, workInProgress, renderLanes); - - case ContextConsumer: - return updateContextConsumer(current, workInProgress, renderLanes); - - case MemoComponent: - { - var _type2 = workInProgress.type; - var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. - - var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); - - { - if (workInProgress.type !== workInProgress.elementType) { - var outerPropTypes = _type2.propTypes; - - if (outerPropTypes) { - checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only - 'prop', getComponentName(_type2)); - } - } - } - - _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); - return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateLanes, renderLanes); - } - - case SimpleMemoComponent: - { - return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateLanes, renderLanes); - } - - case IncompleteClassComponent: - { - var _Component3 = workInProgress.type; - var _unresolvedProps4 = workInProgress.pendingProps; - - var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4); - - return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderLanes); - } - - case SuspenseListComponent: - { - return updateSuspenseListComponent(current, workInProgress, renderLanes); - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case Block: - { - - break; - } - - case OffscreenComponent: - { - return updateOffscreenComponent(current, workInProgress, renderLanes); - } - - case LegacyHiddenComponent: - { - return updateLegacyHiddenComponent(current, workInProgress, renderLanes); - } - } - - { - { - throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function markUpdate(workInProgress) { - // Tag the fiber with an update effect. This turns a Placement into - // a PlacementAndUpdate. - workInProgress.flags |= Update; - } - - function markRef$1(workInProgress) { - workInProgress.flags |= Ref; - } - - var appendAllChildren; - var updateHostContainer; - var updateHostComponent$1; - var updateHostText$1; - - { - // Mutation mode - appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) { - // We only have the top Fiber that was created but we need recurse down its - // children to find all the terminal nodes. - var node = workInProgress.child; - - while (node !== null) { - if (node.tag === HostComponent || node.tag === HostText) { - appendInitialChild(parent, node.stateNode); - } else if (node.tag === HostPortal) ; else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === workInProgress) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === workInProgress) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - }; - - updateHostContainer = function (workInProgress) {// Noop - }; - - updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) { - // If we have an alternate, that means this is an update and we need to - // schedule a side-effect to do the updates. - var oldProps = current.memoizedProps; - - if (oldProps === newProps) { - // In mutation mode, this is sufficient for a bailout because - // we won't touch this node even if children changed. - return; - } // If we get updated because one of our children updated, we don't - // have newProps so we'll have to reuse them. - // TODO: Split the update API as separate for the props vs. children. - // Even better would be if children weren't special cased at all tho. - - - var instance = workInProgress.stateNode; - var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host - // component is hitting the resume path. Figure out why. Possibly - // related to `hidden`. - - var updatePayload = prepareUpdate(); // TODO: Type this specific to this type of component. - - workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there - // is a new ref we mark this as an update. All the work is done in commitWork. - - if (updatePayload) { - markUpdate(workInProgress); - } - }; - - updateHostText$1 = function (current, workInProgress, oldText, newText) { - // If the text differs, mark it as an update. All the work in done in commitWork. - if (oldText !== newText) { - markUpdate(workInProgress); - } - }; - } - - function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { - - switch (renderState.tailMode) { - case 'hidden': - { - // Any insertions at the end of the tail list after this point - // should be invisible. If there are already mounted boundaries - // anything before them are not considered for collapsing. - // Therefore we need to go through the whole tail to find if - // there are any. - var tailNode = renderState.tail; - var lastTailNode = null; - - while (tailNode !== null) { - if (tailNode.alternate !== null) { - lastTailNode = tailNode; - } - - tailNode = tailNode.sibling; - } // Next we're simply going to delete all insertions after the - // last rendered item. - - - if (lastTailNode === null) { - // All remaining items in the tail are insertions. - renderState.tail = null; - } else { - // Detach the insertion after the last node that was already - // inserted. - lastTailNode.sibling = null; - } - - break; - } - - case 'collapsed': - { - // Any insertions at the end of the tail list after this point - // should be invisible. If there are already mounted boundaries - // anything before them are not considered for collapsing. - // Therefore we need to go through the whole tail to find if - // there are any. - var _tailNode = renderState.tail; - var _lastTailNode = null; - - while (_tailNode !== null) { - if (_tailNode.alternate !== null) { - _lastTailNode = _tailNode; - } - - _tailNode = _tailNode.sibling; - } // Next we're simply going to delete all insertions after the - // last rendered item. - - - if (_lastTailNode === null) { - // All remaining items in the tail are insertions. - if (!hasRenderedATailFallback && renderState.tail !== null) { - // We suspended during the head. We want to show at least one - // row at the tail. So we'll keep on and cut off the rest. - renderState.tail.sibling = null; - } else { - renderState.tail = null; - } - } else { - // Detach the insertion after the last node that was already - // inserted. - _lastTailNode.sibling = null; - } - - break; - } - } - } - - function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; - - switch (workInProgress.tag) { - case IndeterminateComponent: - case LazyComponent: - case SimpleMemoComponent: - case FunctionComponent: - case ForwardRef: - case Fragment: - case Mode: - case Profiler: - case ContextConsumer: - case MemoComponent: - return null; - - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - popContext(workInProgress); - } - - return null; - } - - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - resetWorkInProgressVersions(); - var fiberRoot = workInProgress.stateNode; - - if (fiberRoot.pendingContext) { - fiberRoot.context = fiberRoot.pendingContext; - fiberRoot.pendingContext = null; - } - - if (current === null || current.child === null) { - // If we hydrated, pop so that we can delete any remaining children - // that weren't hydrated. - var wasHydrated = popHydrationState(); - - if (wasHydrated) { - // If we hydrated, then we'll need to schedule an update for - // the commit side-effects on the root. - markUpdate(workInProgress); - } else if (!fiberRoot.hydrate) { - // Schedule an effect to clear this container at the start of the next commit. - // This handles the case of React rendering into a container with previous children. - // It's also safe to do for updates too, because current.child would only be null - // if the previous render was null (so the the container would already be empty). - workInProgress.flags |= Snapshot; - } - } - - updateHostContainer(workInProgress); - return null; - } - - case HostComponent: - { - popHostContext(workInProgress); - var rootContainerInstance = getRootHostContainer(); - var type = workInProgress.type; - - if (current !== null && workInProgress.stateNode != null) { - updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); - - if (current.ref !== workInProgress.ref) { - markRef$1(workInProgress); - } - } else { - if (!newProps) { - if (!(workInProgress.stateNode !== null)) { - { - throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); - } - } // This can happen when we abort work. - - - return null; - } - - var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context - // "stack" as the parent. Then append children as we go in beginWork - // or completeWork depending on whether we want to add them top->down or - // bottom->up. Top->down is faster in IE11. - - var _wasHydrated = popHydrationState(); - - if (_wasHydrated) { - // TODO: Move this and createInstance step into the beginPhase - // to consolidate. - if (prepareToHydrateHostInstance()) { - // If changes to the hydrated node need to be applied at the - // commit-phase we mark this as such. - markUpdate(workInProgress); - } - } else { - var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); - appendAllChildren(instance, workInProgress, false, false); - workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount. - } - - if (workInProgress.ref !== null) { - // If there is a ref on a host node we need to schedule a callback - markRef$1(workInProgress); - } - } - - return null; - } - - case HostText: - { - var newText = newProps; - - if (current && workInProgress.stateNode != null) { - var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need - // to schedule a side-effect to do the updates. - - updateHostText$1(current, workInProgress, oldText, newText); - } else { - if (typeof newText !== 'string') { - if (!(workInProgress.stateNode !== null)) { - { - throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." ); - } - } // This can happen when we abort work. - - } - - var _rootContainerInstance = getRootHostContainer(); - - var _currentHostContext = getHostContext(); - - var _wasHydrated2 = popHydrationState(); - - if (_wasHydrated2) { - if (prepareToHydrateHostTextInstance()) { - markUpdate(workInProgress); - } - } else { - workInProgress.stateNode = createTextInstance(newText); - } - } - - return null; - } - - case SuspenseComponent: - { - popSuspenseContext(workInProgress); - var nextState = workInProgress.memoizedState; - - if ((workInProgress.flags & DidCapture) !== NoFlags) { - // Something suspended. Re-render with the fallback children. - workInProgress.lanes = renderLanes; // Do not reset the effect list. - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - var nextDidTimeout = nextState !== null; - var prevDidTimeout = false; - - if (current === null) { - if (workInProgress.memoizedProps.fallback !== undefined) ; - } else { - var prevState = current.memoizedState; - prevDidTimeout = prevState !== null; - } - - if (nextDidTimeout && !prevDidTimeout) { - // If this subtreee is running in blocking mode we can suspend, - // otherwise we won't suspend. - // TODO: This will still suspend a synchronous tree if anything - // in the concurrent tree already suspended during this render. - // This is a known bug. - if ((workInProgress.mode & BlockingMode) !== NoMode) { - // TODO: Move this back to throwException because this is too late - // if this is a large tree which is common for initial loads. We - // don't know if we should restart a render or not until we get - // this marker, and this is too late. - // If this render already had a ping or lower pri updates, - // and this is the first time we know we're going to suspend we - // should be able to immediately restart from within throwException. - var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true; - - if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) { - // If this was in an invisible tree or a new render, then showing - // this boundary is ok. - renderDidSuspend(); - } else { - // Otherwise, we're going to have to hide content so we should - // suspend for longer if possible. - renderDidSuspendDelayIfPossible(); - } - } - } - - { - // TODO: Only schedule updates if these values are non equal, i.e. it changed. - if (nextDidTimeout || prevDidTimeout) { - // If this boundary just timed out, schedule an effect to attach a - // retry listener to the promise. This flag is also used to hide the - // primary children. In mutation mode, we also need the flag to - // *unhide* children that were previously hidden, so check if this - // is currently timed out, too. - workInProgress.flags |= Update; - } - } - - return null; - } - - case HostPortal: - popHostContainer(workInProgress); - updateHostContainer(workInProgress); - - if (current === null) { - preparePortalMount(workInProgress.stateNode.containerInfo); - } - - return null; - - case ContextProvider: - // Pop provider fiber - popProvider(workInProgress); - return null; - - case IncompleteClassComponent: - { - // Same as class component case. I put it down here so that the tags are - // sequential to ensure this switch is compiled to a jump table. - var _Component = workInProgress.type; - - if (isContextProvider(_Component)) { - popContext(workInProgress); - } - - return null; - } - - case SuspenseListComponent: - { - popSuspenseContext(workInProgress); - var renderState = workInProgress.memoizedState; - - if (renderState === null) { - // We're running in the default, "independent" mode. - // We don't do anything in this mode. - return null; - } - - var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags; - var renderedTail = renderState.rendering; - - if (renderedTail === null) { - // We just rendered the head. - if (!didSuspendAlready) { - // This is the first pass. We need to figure out if anything is still - // suspended in the rendered set. - // If new content unsuspended, but there's still some content that - // didn't. Then we need to do a second pass that forces everything - // to keep showing their fallbacks. - // We might be suspended if something in this render pass suspended, or - // something in the previous committed pass suspended. Otherwise, - // there's no chance so we can skip the expensive call to - // findFirstSuspended. - var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags); - - if (!cannotBeSuspended) { - var row = workInProgress.child; - - while (row !== null) { - var suspended = findFirstSuspended(row); - - if (suspended !== null) { - didSuspendAlready = true; - workInProgress.flags |= DidCapture; - cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as - // part of the second pass. In that case nothing will subscribe to - // its thennables. Instead, we'll transfer its thennables to the - // SuspenseList so that it can retry if they resolve. - // There might be multiple of these in the list but since we're - // going to wait for all of them anyway, it doesn't really matter - // which ones gets to ping. In theory we could get clever and keep - // track of how many dependencies remain but it gets tricky because - // in the meantime, we can add/remove/change items and dependencies. - // We might bail out of the loop before finding any but that - // doesn't matter since that means that the other boundaries that - // we did find already has their listeners attached. - - var newThennables = suspended.updateQueue; - - if (newThennables !== null) { - workInProgress.updateQueue = newThennables; - workInProgress.flags |= Update; - } // Rerender the whole list, but this time, we'll force fallbacks - // to stay in place. - // Reset the effect list before doing the second pass since that's now invalid. - - - if (renderState.lastEffect === null) { - workInProgress.firstEffect = null; - } - - workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state. - - resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately - // rerender the children. - - pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); - return workInProgress.child; - } - - row = row.sibling; - } - } - - if (renderState.tail !== null && now() > getRenderTargetTime()) { - // We have already passed our CPU deadline but we still have rows - // left in the tail. We'll just give up further attempts to render - // the main content and only render fallbacks. - workInProgress.flags |= DidCapture; - didSuspendAlready = true; - cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this - // to get it started back up to attempt the next item. While in terms - // of priority this work has the same priority as this current render, - // it's not part of the same transition once the transition has - // committed. If it's sync, we still want to yield so that it can be - // painted. Conceptually, this is really the same as pinging. - // We can use any RetryLane even if it's the one currently rendering - // since we're leaving it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - } - } else { - cutOffTailIfNeeded(renderState, false); - } // Next we're going to render the tail. - - } else { - // Append the rendered row to the child list. - if (!didSuspendAlready) { - var _suspended = findFirstSuspended(renderedTail); - - if (_suspended !== null) { - workInProgress.flags |= DidCapture; - didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't - // get lost if this row ends up dropped during a second pass. - - var _newThennables = _suspended.updateQueue; - - if (_newThennables !== null) { - workInProgress.updateQueue = _newThennables; - workInProgress.flags |= Update; - } - - cutOffTailIfNeeded(renderState, true); // This might have been modified. - - if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating. - ) { - // We need to delete the row we just rendered. - // Reset the effect list to what it was before we rendered this - // child. The nested children have already appended themselves. - var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point. - - if (lastEffect !== null) { - lastEffect.nextEffect = null; - } // We're done. - - - return null; - } - } else if ( // The time it took to render last row is greater than the remaining - // time we have to render. So rendering one more row would likely - // exceed it. - now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) { - // We have now passed our CPU deadline and we'll just give up further - // attempts to render the main content and only render fallbacks. - // The assumption is that this is usually faster. - workInProgress.flags |= DidCapture; - didSuspendAlready = true; - cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this - // to get it started back up to attempt the next item. While in terms - // of priority this work has the same priority as this current render, - // it's not part of the same transition once the transition has - // committed. If it's sync, we still want to yield so that it can be - // painted. Conceptually, this is really the same as pinging. - // We can use any RetryLane even if it's the one currently rendering - // since we're leaving it behind on this node. - - workInProgress.lanes = SomeRetryLane; - - { - markSpawnedWork(SomeRetryLane); - } - } - } - - if (renderState.isBackwards) { - // The effect list of the backwards tail will have been added - // to the end. This breaks the guarantee that life-cycles fire in - // sibling order but that isn't a strong guarantee promised by React. - // Especially since these might also just pop in during future commits. - // Append to the beginning of the list. - renderedTail.sibling = workInProgress.child; - workInProgress.child = renderedTail; - } else { - var previousSibling = renderState.last; - - if (previousSibling !== null) { - previousSibling.sibling = renderedTail; - } else { - workInProgress.child = renderedTail; - } - - renderState.last = renderedTail; - } - } - - if (renderState.tail !== null) { - // We still have tail rows to render. - // Pop a row. - var next = renderState.tail; - renderState.rendering = next; - renderState.tail = next.sibling; - renderState.lastEffect = workInProgress.lastEffect; - renderState.renderingStartTime = now(); - next.sibling = null; // Restore the context. - // TODO: We can probably just avoid popping it instead and only - // setting it the first time we go from not suspended to suspended. - - var suspenseContext = suspenseStackCursor.current; - - if (didSuspendAlready) { - suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); - } else { - suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); - } - - pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. - - return next; - } - - return null; - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case Block: - - break; - - case OffscreenComponent: - case LegacyHiddenComponent: - { - popRenderLanes(workInProgress); - - if (current !== null) { - var _nextState = workInProgress.memoizedState; - var _prevState = current.memoizedState; - var prevIsHidden = _prevState !== null; - var nextIsHidden = _nextState !== null; - - if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') { - workInProgress.flags |= Update; - } - } - - return null; - } - } - - { - { - throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function unwindWork(workInProgress, renderLanes) { - switch (workInProgress.tag) { - case ClassComponent: - { - var Component = workInProgress.type; - - if (isContextProvider(Component)) { - popContext(workInProgress); - } - - var flags = workInProgress.flags; - - if (flags & ShouldCapture) { - workInProgress.flags = flags & ~ShouldCapture | DidCapture; - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - return null; - } - - case HostRoot: - { - popHostContainer(workInProgress); - popTopLevelContextObject(workInProgress); - resetWorkInProgressVersions(); - var _flags = workInProgress.flags; - - if (!((_flags & DidCapture) === NoFlags)) { - { - throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." ); - } - } - - workInProgress.flags = _flags & ~ShouldCapture | DidCapture; - return workInProgress; - } - - case HostComponent: - { - // TODO: popHydrationState - popHostContext(workInProgress); - return null; - } - - case SuspenseComponent: - { - popSuspenseContext(workInProgress); - - var _flags2 = workInProgress.flags; - - if (_flags2 & ShouldCapture) { - workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. - - if ( (workInProgress.mode & ProfileMode) !== NoMode) { - transferActualDuration(workInProgress); - } - - return workInProgress; - } - - return null; - } - - case SuspenseListComponent: - { - popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been - // caught by a nested boundary. If not, it should bubble through. - - return null; - } - - case HostPortal: - popHostContainer(workInProgress); - return null; - - case ContextProvider: - popProvider(workInProgress); - return null; - - case OffscreenComponent: - case LegacyHiddenComponent: - popRenderLanes(workInProgress); - return null; - - default: - return null; - } - } - - function unwindInterruptedWork(interruptedWork) { - switch (interruptedWork.tag) { - case ClassComponent: - { - var childContextTypes = interruptedWork.type.childContextTypes; - - if (childContextTypes !== null && childContextTypes !== undefined) { - popContext(interruptedWork); - } - - break; - } - - case HostRoot: - { - popHostContainer(interruptedWork); - popTopLevelContextObject(interruptedWork); - resetWorkInProgressVersions(); - break; - } - - case HostComponent: - { - popHostContext(interruptedWork); - break; - } - - case HostPortal: - popHostContainer(interruptedWork); - break; - - case SuspenseComponent: - popSuspenseContext(interruptedWork); - break; - - case SuspenseListComponent: - popSuspenseContext(interruptedWork); - break; - - case ContextProvider: - popProvider(interruptedWork); - break; - - case OffscreenComponent: - case LegacyHiddenComponent: - popRenderLanes(interruptedWork); - break; - } - } - - function createCapturedValue(value, source) { - // If the value is an error, call this function immediately after it is thrown - // so the stack is accurate. - return { - value: value, - source: source, - stack: getStackByFiberInDevAndProd(source) - }; - } - - // This module is forked in different environments. - // By default, return `true` to log errors to the console. - // Forks can return `false` if this isn't desirable. - function showErrorDialog(boundary, errorInfo) { - return true; - } - - function logCapturedError(boundary, errorInfo) { - try { - var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. - // This enables renderers like ReactNative to better manage redbox behavior. - - if (logError === false) { - return; - } - - var error = errorInfo.value; - - if (true) { - var source = errorInfo.source; - var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling - // `preventDefault()` in window `error` handler. - // We record this information as an expando on the error. - - if (error != null && error._suppressLogging) { - if (boundary.tag === ClassComponent) { - // The error is recoverable and was silenced. - // Ignore it and don't print the stack addendum. - // This is handy for testing error boundaries without noise. - return; - } // The error is fatal. Since the silencing might have - // been accidental, we'll surface it anyway. - // However, the browser would have silenced the original error - // so we'll print it first, and then print the stack addendum. - - - console['error'](error); // Don't transform to our wrapper - // For a more detailed description of this block, see: - // https://github.com/facebook/react/pull/13384 - } - - var componentName = source ? getComponentName(source.type) : null; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; - var errorBoundaryMessage; - var errorBoundaryName = getComponentName(boundary.type); - - if (errorBoundaryName) { - errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); - } else { - errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.'; - } - - var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. - // We don't include the original error message and JS stack because the browser - // has already printed it. Even if the application swallows the error, it is still - // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. - - console['error'](combinedMessage); // Don't transform to our wrapper - } else { - // In production, we print the error directly. - // This will include the message, the JS stack, and anything the browser wants to show. - // We pass the error object instead of custom message so that the browser displays the error natively. - console['error'](error); // Don't transform to our wrapper - } - } catch (e) { - // This method must not throw, or React internal state will get messed up. - // If console.error is overridden, or logCapturedError() shows a dialog that throws, - // we want to report this error outside of the normal stack as a last resort. - // https://github.com/facebook/react/issues/13188 - setTimeout(function () { - throw e; - }); - } - } - - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - - function createRootErrorUpdate(fiber, errorInfo, lane) { - var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null. - - update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property - // being called "element". - - update.payload = { - element: null - }; - var error = errorInfo.value; - - update.callback = function () { - onUncaughtError(error); - logCapturedError(fiber, errorInfo); - }; - - return update; - } - - function createClassErrorUpdate(fiber, errorInfo, lane) { - var update = createUpdate(NoTimestamp, lane); - update.tag = CaptureUpdate; - var getDerivedStateFromError = fiber.type.getDerivedStateFromError; - - if (typeof getDerivedStateFromError === 'function') { - var error$1 = errorInfo.value; - - update.payload = function () { - logCapturedError(fiber, errorInfo); - return getDerivedStateFromError(error$1); - }; - } - - var inst = fiber.stateNode; - - if (inst !== null && typeof inst.componentDidCatch === 'function') { - update.callback = function callback() { - { - markFailedErrorBoundaryForHotReloading(fiber); - } - - if (typeof getDerivedStateFromError !== 'function') { - // To preserve the preexisting retry behavior of error boundaries, - // we keep track of which ones already failed during this batch. - // This gets reset before we yield back to the browser. - // TODO: Warn in strict mode if getDerivedStateFromError is - // not defined. - markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined - - logCapturedError(fiber, errorInfo); - } - - var error$1 = errorInfo.value; - var stack = errorInfo.stack; - this.componentDidCatch(error$1, { - componentStack: stack !== null ? stack : '' - }); - - { - if (typeof getDerivedStateFromError !== 'function') { - // If componentDidCatch is the only error boundary method defined, - // then it needs to call setState to recover from errors. - // If no state update is scheduled then the boundary will swallow the error. - if (!includesSomeLane(fiber.lanes, SyncLane)) { - error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown'); - } - } - } - }; - } else { - update.callback = function () { - markFailedErrorBoundaryForHotReloading(fiber); - }; - } - - return update; - } - - function attachPingListener(root, wakeable, lanes) { - // Attach a listener to the promise to "ping" the root and retry. But only if - // one does not already exist for the lanes we're currently rendering (which - // acts like a "thread ID" here). - var pingCache = root.pingCache; - var threadIDs; - - if (pingCache === null) { - pingCache = root.pingCache = new PossiblyWeakMap$1(); - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } else { - threadIDs = pingCache.get(wakeable); - - if (threadIDs === undefined) { - threadIDs = new Set(); - pingCache.set(wakeable, threadIDs); - } - } - - if (!threadIDs.has(lanes)) { - // Memoize using the thread ID to prevent redundant listeners. - threadIDs.add(lanes); - var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); - wakeable.then(ping, ping); - } - } - - function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { - // The source fiber did not complete. - sourceFiber.flags |= Incomplete; // Its effect list is no longer valid. - - sourceFiber.firstEffect = sourceFiber.lastEffect = null; - - if (value !== null && typeof value === 'object' && typeof value.then === 'function') { - // This is a wakeable. - var wakeable = value; - - if ((sourceFiber.mode & BlockingMode) === NoMode) { - // Reset the memoizedState to what it was before we attempted - // to render it. - var currentSource = sourceFiber.alternate; - - if (currentSource) { - sourceFiber.updateQueue = currentSource.updateQueue; - sourceFiber.memoizedState = currentSource.memoizedState; - sourceFiber.lanes = currentSource.lanes; - } else { - sourceFiber.updateQueue = null; - sourceFiber.memoizedState = null; - } - } - - var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view. - - var _workInProgress = returnFiber; - - do { - if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) { - // Found the nearest boundary. - // Stash the promise on the boundary fiber. If the boundary times out, we'll - // attach another listener to flip the boundary back to its normal state. - var wakeables = _workInProgress.updateQueue; - - if (wakeables === null) { - var updateQueue = new Set(); - updateQueue.add(wakeable); - _workInProgress.updateQueue = updateQueue; - } else { - wakeables.add(wakeable); - } // If the boundary is outside of blocking mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. In the commit phase, we'll schedule a - // subsequent synchronous update to re-render the Suspense. - // - // Note: It doesn't matter whether the component that suspended was - // inside a blocking mode tree. If the Suspense is outside of it, we - // should *not* suspend the commit. - - - if ((_workInProgress.mode & BlockingMode) === NoMode) { - _workInProgress.flags |= DidCapture; - sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. - // But we shouldn't call any lifecycle methods or callbacks. Remove - // all lifecycle effect tags. - - sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); - - if (sourceFiber.tag === ClassComponent) { - var currentSourceFiber = sourceFiber.alternate; - - if (currentSourceFiber === null) { - // This is a new mount. Change the tag so it's not mistaken for a - // completed class component. For example, we should not call - // componentWillUnmount if it is deleted. - sourceFiber.tag = IncompleteClassComponent; - } else { - // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force update to - // prevent a bail out. - var update = createUpdate(NoTimestamp, SyncLane); - update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); - } - } // The source fiber did not complete. Mark it with Sync priority to - // indicate that it still has pending work. - - - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending. - - return; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. - - - attachPingListener(root, wakeable, rootRenderLanes); - _workInProgress.flags |= ShouldCapture; - _workInProgress.lanes = rootRenderLanes; - return; - } // This boundary already captured during this render. Continue to the next - // boundary. - - - _workInProgress = _workInProgress.return; - } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. - // TODO: Use invariant so the message is stripped in prod? - - - value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a component higher in the tree to ' + 'provide a loading indicator or placeholder to display.'); - } // We didn't find a boundary that could handle this type of exception. Start - // over and traverse parent path again, this time treating the exception - // as an error. - - - renderDidError(); - value = createCapturedValue(value, sourceFiber); - var workInProgress = returnFiber; - - do { - switch (workInProgress.tag) { - case HostRoot: - { - var _errorInfo = value; - workInProgress.flags |= ShouldCapture; - var lane = pickArbitraryLane(rootRenderLanes); - workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); - - var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); - - enqueueCapturedUpdate(workInProgress, _update); - return; - } - - case ClassComponent: - // Capture and retry - var errorInfo = value; - var ctor = workInProgress.type; - var instance = workInProgress.stateNode; - - if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) { - workInProgress.flags |= ShouldCapture; - - var _lane = pickArbitraryLane(rootRenderLanes); - - workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state - - var _update2 = createClassErrorUpdate(workInProgress, errorInfo, _lane); - - enqueueCapturedUpdate(workInProgress, _update2); - return; - } - - break; - } - - workInProgress = workInProgress.return; - } while (workInProgress !== null); - } - - function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); - } - } - - var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; - - { - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); - - invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - if (!(typeof document !== 'undefined')) { - { - throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); - } - } - - var evt = document.createEvent('Event'); - var didCall = false; // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); - - function restoreAfterDispatch() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { - window.event = windowEvent; - } - } // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - function callCallback() { - didCall = true; - restoreAfterDispatch(); - func.apply(context, funcArgs); - didError = false; - } // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - function handleWindowError(event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === 'object') { - try { - error._suppressLogging = true; - } catch (inner) {// Ignore. - } - } - } - } // Create a fake event type. - - - var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers - - window.addEventListener('error', handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, 'event', windowEventDescriptor); - } - - if (didCall && didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://reactjs.org/link/crossorigin-error for more information.'); - } - - this.onError(error); - } // Remove our event listeners - - - window.removeEventListener('error', handleWindowError); - - if (!didCall) { - // Something went really wrong, and our event was not dispatched. - // https://github.com/facebook/react/issues/16734 - // https://github.com/facebook/react/issues/16585 - // Fall back to the production implementation. - restoreAfterDispatch(); - return invokeGuardedCallbackProd.apply(this, arguments); - } - }; - } - } - - var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - - var hasError = false; - var caughtError = null; // Used by event system to capture/rethrow the first error. - var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } - }; - /** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - - function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl$1.apply(reporter, arguments); - } - function hasCaughtError() { - return hasError; - } - function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - { - { - throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - } - - var didWarnAboutUndefinedSnapshotBeforeUpdate = null; - - { - didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); - } - - var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set; - - var callComponentWillUnmountWithTimer = function (current, instance) { - instance.props = current.memoizedProps; - instance.state = current.memoizedState; - - { - instance.componentWillUnmount(); - } - }; // Capture errors so they don't interrupt unmounting. - - - function safelyCallComponentWillUnmount(current, instance) { - { - invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance); - - if (hasCaughtError()) { - var unmountError = clearCaughtError(); - captureCommitPhaseError(current, unmountError); - } - } - } - - function safelyDetachRef(current) { - var ref = current.ref; - - if (ref !== null) { - if (typeof ref === 'function') { - { - invokeGuardedCallback(null, ref, null, null); - - if (hasCaughtError()) { - var refError = clearCaughtError(); - captureCommitPhaseError(current, refError); - } - } - } else { - ref.current = null; - } - } - } - - function safelyCallDestroy(current, destroy) { - { - invokeGuardedCallback(null, destroy, null); - - if (hasCaughtError()) { - var error = clearCaughtError(); - captureCommitPhaseError(current, error); - } - } - } - - function commitBeforeMutationLifeCycles(current, finishedWork) { - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - case Block: - { - return; - } - - case ClassComponent: - { - if (finishedWork.flags & Snapshot) { - if (current !== null) { - var prevProps = current.memoizedProps; - var prevState = current.memoizedState; - var instance = finishedWork.stateNode; // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); - - { - var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; - - if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { - didWarnSet.add(finishedWork.type); - - error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type)); - } - } - - instance.__reactInternalSnapshotBeforeUpdate = snapshot; - } - } - - return; - } - - case HostRoot: - { - { - if (finishedWork.flags & Snapshot) { - var root = finishedWork.stateNode; - clearContainer(root.containerInfo); - } - } - - return; - } - - case HostComponent: - case HostText: - case HostPortal: - case IncompleteClassComponent: - // Nothing to do for these component types - return; - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function commitHookEffectListUnmount(tag, finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - if ((effect.tag & tag) === tag) { - // Unmount - var destroy = effect.destroy; - effect.destroy = undefined; - - if (destroy !== undefined) { - destroy(); - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } - } - - function commitHookEffectListMount(tag, finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - if ((effect.tag & tag) === tag) { - // Mount - var create = effect.create; - effect.destroy = create(); - - { - var destroy = effect.destroy; - - if (destroy !== undefined && typeof destroy !== 'function') { - var addendum = void 0; - - if (destroy === null) { - addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; - } else if (typeof destroy.then === 'function') { - addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching'; - } else { - addendum = ' You returned: ' + destroy; - } - - error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s', addendum); - } - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } - } - - function schedulePassiveEffects(finishedWork) { - var updateQueue = finishedWork.updateQueue; - var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - var _effect = effect, - next = _effect.next, - tag = _effect.tag; - - if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) { - enqueuePendingPassiveHookEffectUnmount(finishedWork, effect); - enqueuePendingPassiveHookEffectMount(finishedWork, effect); - } - - effect = next; - } while (effect !== firstEffect); - } - } - - function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) { - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - case Block: - { - // At this point layout effects have already been destroyed (during mutation phase). - // This is done to prevent sibling component effects from interfering with each other, - // e.g. a destroy function in one component should never override a ref set - // by a create function in another component during the same commit. - { - commitHookEffectListMount(Layout | HasEffect, finishedWork); - } - - schedulePassiveEffects(finishedWork); - return; - } - - case ClassComponent: - { - var instance = finishedWork.stateNode; - - if (finishedWork.flags & Update) { - if (current === null) { - // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - { - instance.componentDidMount(); - } - } else { - var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); - var prevState = current.memoizedState; // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } - - { - instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); - } - } - } // TODO: I think this is now always non-null by the time it reaches the - // commit phase. Consider removing the type check. - - - var updateQueue = finishedWork.updateQueue; - - if (updateQueue !== null) { - { - if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { - if (instance.props !== finishedWork.memoizedProps) { - error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - - if (instance.state !== finishedWork.memoizedState) { - error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance'); - } - } - } // We could update instance props and state here, - // but instead we rely on them being set during last render. - // TODO: revisit this when we implement resuming. - - - commitUpdateQueue(finishedWork, updateQueue, instance); - } - - return; - } - - case HostRoot: - { - // TODO: I think this is now always non-null by the time it reaches the - // commit phase. Consider removing the type check. - var _updateQueue = finishedWork.updateQueue; - - if (_updateQueue !== null) { - var _instance = null; - - if (finishedWork.child !== null) { - switch (finishedWork.child.tag) { - case HostComponent: - _instance = getPublicInstance(finishedWork.child.stateNode); - break; - - case ClassComponent: - _instance = finishedWork.child.stateNode; - break; - } - } - - commitUpdateQueue(finishedWork, _updateQueue, _instance); - } - - return; - } - - case HostComponent: - { - var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted - // (eg DOM renderer may schedule auto-focus for inputs and form controls). - // These effects should only be committed when components are first mounted, - // aka when there is no current/alternate. - - if (current === null && finishedWork.flags & Update) { - var type = finishedWork.type; - var props = finishedWork.memoizedProps; - } - - return; - } - - case HostText: - { - // We have no life-cycles associated with text. - return; - } - - case HostPortal: - { - // We have no life-cycles associated with portals. - return; - } - - case Profiler: - { - { - var _finishedWork$memoize2 = finishedWork.memoizedProps, - onCommit = _finishedWork$memoize2.onCommit, - onRender = _finishedWork$memoize2.onRender; - var effectDuration = finishedWork.stateNode.effectDuration; - var commitTime = getCommitTime(); - - if (typeof onRender === 'function') { - { - onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime, finishedRoot.memoizedInteractions); - } - } - } - - return; - } - - case SuspenseComponent: - { - return; - } - - case SuspenseListComponent: - case IncompleteClassComponent: - case FundamentalComponent: - case ScopeComponent: - case OffscreenComponent: - case LegacyHiddenComponent: - return; - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function hideOrUnhideAllChildren(finishedWork, isHidden) { - { - // We only have the top Fiber that was inserted but we need to recurse down its - // children to find all the terminal nodes. - var node = finishedWork; - - while (true) { - if (node.tag === HostComponent) { - var instance = node.stateNode; - - if (isHidden) { - hideInstance(instance); - } else { - unhideInstance(node.stateNode, node.memoizedProps); - } - } else if (node.tag === HostText) { - var _instance3 = node.stateNode; - - if (isHidden) { - hideTextInstance(_instance3); - } else { - unhideTextInstance(_instance3, node.memoizedProps); - } - } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === finishedWork) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === finishedWork) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - } - - function commitAttachRef(finishedWork) { - var ref = finishedWork.ref; - - if (ref !== null) { - var instance = finishedWork.stateNode; - var instanceToUse; - - switch (finishedWork.tag) { - case HostComponent: - instanceToUse = getPublicInstance(instance); - break; - - default: - instanceToUse = instance; - } // Moved outside to ensure DCE works with this flag - - if (typeof ref === 'function') { - ref(instanceToUse); - } else { - { - if (!ref.hasOwnProperty('current')) { - error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentName(finishedWork.type)); - } - } - - ref.current = instanceToUse; - } - } - } - - function commitDetachRef(current) { - var currentRef = current.ref; - - if (currentRef !== null) { - if (typeof currentRef === 'function') { - currentRef(null); - } else { - currentRef.current = null; - } - } - } // User-originating errors (lifecycles and refs) should not interrupt - // deletion, so don't let them throw. Host-originating errors should - // interrupt deletion, so it's okay - - - function commitUnmount(finishedRoot, current, renderPriorityLevel) { - onCommitUnmount(current); - - switch (current.tag) { - case FunctionComponent: - case ForwardRef: - case MemoComponent: - case SimpleMemoComponent: - case Block: - { - var updateQueue = current.updateQueue; - - if (updateQueue !== null) { - var lastEffect = updateQueue.lastEffect; - - if (lastEffect !== null) { - var firstEffect = lastEffect.next; - var effect = firstEffect; - - do { - var _effect2 = effect, - destroy = _effect2.destroy, - tag = _effect2.tag; - - if (destroy !== undefined) { - if ((tag & Passive$1) !== NoFlags$1) { - enqueuePendingPassiveHookEffectUnmount(current, effect); - } else { - { - safelyCallDestroy(current, destroy); - } - } - } - - effect = effect.next; - } while (effect !== firstEffect); - } - } - - return; - } - - case ClassComponent: - { - safelyDetachRef(current); - var instance = current.stateNode; - - if (typeof instance.componentWillUnmount === 'function') { - safelyCallComponentWillUnmount(current, instance); - } - - return; - } - - case HostComponent: - { - safelyDetachRef(current); - return; - } - - case HostPortal: - { - // TODO: this is recursive. - // We are also not using this parent because - // the portal will get pushed immediately. - { - unmountHostComponents(finishedRoot, current); - } - - return; - } - - case FundamentalComponent: - { - - return; - } - - case DehydratedFragment: - { - - return; - } - - case ScopeComponent: - { - - return; - } - } - } - - function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) { - // While we're inside a removed host node we don't want to call - // removeChild on the inner nodes because they're removed by the top - // call anyway. We also want to call componentWillUnmount on all - // composites before this host node is removed from the tree. Therefore - // we do an inner loop while we're still inside the host node. - var node = root; - - while (true) { - commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes. - // Skip portals because commitUnmount() currently visits them recursively. - - if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above. - // If we don't use mutation we drill down into portals here instead. - node.tag !== HostPortal)) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === root) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === root) { - return; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - function detachFiberMutation(fiber) { - // Cut off the return pointers to disconnect it from the tree. Ideally, we - // should clear the child pointer of the parent alternate to let this - // get GC:ed but we don't know which for sure which parent is the current - // one so we'll settle for GC:ing the subtree of this child. This child - // itself will be GC:ed when the parent updates the next time. - // Note: we cannot null out sibling here, otherwise it can cause issues - // with findDOMNode and how it requires the sibling field to carry out - // traversal in a later effect. See PR #16820. We now clear the sibling - // field after effects, see: detachFiberAfterEffects. - // - // Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects. - // It may be required if the current component is an error boundary, - // and one of its descendants throws while unmounting a passive effect. - fiber.alternate = null; - fiber.child = null; - fiber.dependencies = null; - fiber.firstEffect = null; - fiber.lastEffect = null; - fiber.memoizedProps = null; - fiber.memoizedState = null; - fiber.pendingProps = null; - fiber.return = null; - fiber.updateQueue = null; - - { - fiber._debugOwner = null; - } - } - - function getHostParentFiber(fiber) { - var parent = fiber.return; - - while (parent !== null) { - if (isHostParent(parent)) { - return parent; - } - - parent = parent.return; - } - - { - { - throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function isHostParent(fiber) { - return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; - } - - function getHostSibling(fiber) { - // We're going to search forward into the tree until we find a sibling host - // node. Unfortunately, if multiple insertions are done in a row we have to - // search past them. This leads to exponential search for the next sibling. - // TODO: Find a more efficient way to do this. - var node = fiber; - - siblings: while (true) { - // If we didn't find anything, let's try the next sibling. - while (node.sibling === null) { - if (node.return === null || isHostParent(node.return)) { - // If we pop out of the root or hit the parent the fiber we are the - // last sibling. - return null; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - - while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { - // If it is not host node and, we might have a host node inside it. - // Try to search down until we find one. - if (node.flags & Placement) { - // If we don't have a child, try the siblings instead. - continue siblings; - } // If we don't have a child, try the siblings instead. - // We also skip portals because they are not part of this host tree. - - - if (node.child === null || node.tag === HostPortal) { - continue siblings; - } else { - node.child.return = node; - node = node.child; - } - } // Check if this host node is stable or about to be placed. - - - if (!(node.flags & Placement)) { - // Found it! - return node.stateNode; - } - } - } - - function commitPlacement(finishedWork) { - - - var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. - - var parent; - var isContainer; - var parentStateNode = parentFiber.stateNode; - - switch (parentFiber.tag) { - case HostComponent: - parent = parentStateNode; - isContainer = false; - break; - - case HostRoot: - parent = parentStateNode.containerInfo; - isContainer = true; - break; - - case HostPortal: - parent = parentStateNode.containerInfo; - isContainer = true; - break; - - case FundamentalComponent: - - // eslint-disable-next-line-no-fallthrough - - default: - { - { - throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - } - - if (parentFiber.flags & ContentReset) { - - parentFiber.flags &= ~ContentReset; - } - - var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its - // children to find all the terminal nodes. - - if (isContainer) { - insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent); - } else { - insertOrAppendPlacementNode(finishedWork, before, parent); - } - } - - function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { - var tag = node.tag; - var isHost = tag === HostComponent || tag === HostText; - - if (isHost || enableFundamentalAPI ) { - var stateNode = isHost ? node.stateNode : node.stateNode.instance; - - if (before) { - insertInContainerBefore(parent, stateNode, before); - } else { - appendChildToContainer(parent, stateNode); - } - } else if (tag === HostPortal) ; else { - var child = node.child; - - if (child !== null) { - insertOrAppendPlacementNodeIntoContainer(child, before, parent); - var sibling = child.sibling; - - while (sibling !== null) { - insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); - sibling = sibling.sibling; - } - } - } - } - - function insertOrAppendPlacementNode(node, before, parent) { - var tag = node.tag; - var isHost = tag === HostComponent || tag === HostText; - - if (isHost || enableFundamentalAPI ) { - var stateNode = isHost ? node.stateNode : node.stateNode.instance; - - if (before) { - insertBefore(parent, stateNode, before); - } else { - appendChild(parent, stateNode); - } - } else if (tag === HostPortal) ; else { - var child = node.child; - - if (child !== null) { - insertOrAppendPlacementNode(child, before, parent); - var sibling = child.sibling; - - while (sibling !== null) { - insertOrAppendPlacementNode(sibling, before, parent); - sibling = sibling.sibling; - } - } - } - } - - function unmountHostComponents(finishedRoot, current, renderPriorityLevel) { - // We only have the top Fiber that was deleted but we need to recurse down its - // children to find all the terminal nodes. - var node = current; // Each iteration, currentParent is populated with node's host parent if not - // currentParentIsValid. - - var currentParentIsValid = false; // Note: these two variables *must* always be updated together. - - var currentParent; - var currentParentIsContainer; - - while (true) { - if (!currentParentIsValid) { - var parent = node.return; - - findParent: while (true) { - if (!(parent !== null)) { - { - throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var parentStateNode = parent.stateNode; - - switch (parent.tag) { - case HostComponent: - currentParent = parentStateNode; - currentParentIsContainer = false; - break findParent; - - case HostRoot: - currentParent = parentStateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - - case HostPortal: - currentParent = parentStateNode.containerInfo; - currentParentIsContainer = true; - break findParent; - - } - - parent = parent.return; - } - - currentParentIsValid = true; - } - - if (node.tag === HostComponent || node.tag === HostText) { - commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the - // node from the tree. - - if (currentParentIsContainer) { - removeChildFromContainer(currentParent, node.stateNode); - } else { - removeChild(currentParent, node.stateNode); - } // Don't visit children because we already visited them. - - } else if (node.tag === HostPortal) { - if (node.child !== null) { - // When we go into a portal, it becomes the parent to remove from. - // We will reassign it back when we pop the portal on the way up. - currentParent = node.stateNode.containerInfo; - currentParentIsContainer = true; // Visit children because portals might contain host components. - - node.child.return = node; - node = node.child; - continue; - } - } else { - commitUnmount(finishedRoot, node); // Visit children because we may find more host components below. - - if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - } - - if (node === current) { - return; - } - - while (node.sibling === null) { - if (node.return === null || node.return === current) { - return; - } - - node = node.return; - - if (node.tag === HostPortal) { - // When we go out of the portal, we need to restore the parent. - // Since we don't keep a stack of them, we will search for it. - currentParentIsValid = false; - } - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - function commitDeletion(finishedRoot, current, renderPriorityLevel) { - { - // Recursively delete all host nodes from the parent. - // Detach refs and call componentWillUnmount() on the whole subtree. - unmountHostComponents(finishedRoot, current); - } - - var alternate = current.alternate; - detachFiberMutation(current); - - if (alternate !== null) { - detachFiberMutation(alternate); - } - } - - function commitWork(current, finishedWork) { - - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case MemoComponent: - case SimpleMemoComponent: - case Block: - { - // Layout effects are destroyed during the mutation phase so that all - // destroy functions for all fibers are called before any create functions. - // This prevents sibling component effects from interfering with each other, - // e.g. a destroy function in one component should never override a ref set - // by a create function in another component during the same commit. - { - commitHookEffectListUnmount(Layout | HasEffect, finishedWork); - } - - return; - } - - case ClassComponent: - { - return; - } - - case HostComponent: - { - var instance = finishedWork.stateNode; - - if (instance != null) { - // Commit the work prepared earlier. - var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - - var oldProps = current !== null ? current.memoizedProps : newProps; - var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. - - var updatePayload = finishedWork.updateQueue; - finishedWork.updateQueue = null; - - if (updatePayload !== null) { - commitUpdate(instance, updatePayload, type, oldProps, newProps); - } - } - - return; - } - - case HostText: - { - if (!(finishedWork.stateNode !== null)) { - { - throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - var textInstance = finishedWork.stateNode; - var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps - // as the newProps. The updatePayload will contain the real change in - // this case. - - var oldText = current !== null ? current.memoizedProps : newText; - commitTextUpdate(textInstance, oldText, newText); - return; - } - - case HostRoot: - { - - return; - } - - case Profiler: - { - return; - } - - case SuspenseComponent: - { - commitSuspenseComponent(finishedWork); - attachSuspenseRetryListeners(finishedWork); - return; - } - - case SuspenseListComponent: - { - attachSuspenseRetryListeners(finishedWork); - return; - } - - case IncompleteClassComponent: - { - return; - } - - case FundamentalComponent: - { - - break; - } - - case ScopeComponent: - { - - break; - } - - case OffscreenComponent: - case LegacyHiddenComponent: - { - var newState = finishedWork.memoizedState; - var isHidden = newState !== null; - hideOrUnhideAllChildren(finishedWork, isHidden); - return; - } - } - - { - { - throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - function commitSuspenseComponent(finishedWork) { - var newState = finishedWork.memoizedState; - - if (newState !== null) { - markCommitTimeOfFallback(); - - { - // Hide the Offscreen component that contains the primary children. TODO: - // Ideally, this effect would have been scheduled on the Offscreen fiber - // itself. That's how unhiding works: the Offscreen component schedules an - // effect on itself. However, in this case, the component didn't complete, - // so the fiber was never added to the effect list in the normal path. We - // could have appended it to the effect list in the Suspense component's - // second pass, but doing it this way is less complicated. This would be - // simpler if we got rid of the effect list and traversed the tree, like - // we're planning to do. - var primaryChildParent = finishedWork.child; - hideOrUnhideAllChildren(primaryChildParent, true); - } - } - } - - function attachSuspenseRetryListeners(finishedWork) { - // If this boundary just timed out, then it will have a set of wakeables. - // For each wakeable, attach a listener so that when it resolves, React - // attempts to re-render the boundary in the primary (pre-timeout) state. - var wakeables = finishedWork.updateQueue; - - if (wakeables !== null) { - finishedWork.updateQueue = null; - var retryCache = finishedWork.stateNode; - - if (retryCache === null) { - retryCache = finishedWork.stateNode = new PossiblyWeakSet(); - } - - wakeables.forEach(function (wakeable) { - // Memoize using the boundary fiber to prevent redundant listeners. - var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); - - if (!retryCache.has(wakeable)) { - { - if (wakeable.__reactDoNotTraceInteractions !== true) { - retry = unstable_wrap(retry); - } - } - - retryCache.add(wakeable); - wakeable.then(retry, retry); - } - }); - } - } // This function detects when a Suspense boundary goes from visible to hidden. - // It returns false if the boundary is already hidden. - // TODO: Use an effect tag. - - - function isSuspenseBoundaryBeingHidden(current, finishedWork) { - if (current !== null) { - var oldState = current.memoizedState; - - if (oldState === null || oldState.dehydrated !== null) { - var newState = finishedWork.memoizedState; - return newState !== null && newState.dehydrated === null; - } - } - - return false; - } - - function commitResetTextContent(current) { - - resetTextContent(current.stateNode); - } - - var COMPONENT_TYPE = 0; - var HAS_PSEUDO_CLASS_TYPE = 1; - var ROLE_TYPE = 2; - var TEST_NAME_TYPE = 3; - var TEXT_TYPE = 4; - - if (typeof Symbol === 'function' && Symbol.for) { - var symbolFor$1 = Symbol.for; - COMPONENT_TYPE = symbolFor$1('selector.component'); - HAS_PSEUDO_CLASS_TYPE = symbolFor$1('selector.has_pseudo_class'); - ROLE_TYPE = symbolFor$1('selector.role'); - TEST_NAME_TYPE = symbolFor$1('selector.test_id'); - TEXT_TYPE = symbolFor$1('selector.text'); - } - - var didWarnAboutMessageChannel = false; - var enqueueTaskImpl = null; - function enqueueTask(task) { - if (enqueueTaskImpl === null) { - try { - // read require off the module object to get around the bundlers. - // we don't want them to detect a require and bundle a Node polyfill. - var requireString = ('require' + Math.random()).slice(0, 7); - var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's - // version of setImmediate, bypassing fake timers if any. - - enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; - } catch (_err) { - // we're in a browser - // we can't use regular timers because they may still be faked - // so we try MessageChannel+postMessage instead - enqueueTaskImpl = function (callback) { - { - if (didWarnAboutMessageChannel === false) { - didWarnAboutMessageChannel = true; - - if (typeof MessageChannel === 'undefined') { - error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); - } - } - } - - var channel = new MessageChannel(); - channel.port1.onmessage = callback; - channel.port2.postMessage(undefined); - }; - } - } - - return enqueueTaskImpl(task); - } - - var ceil = Math.ceil; - var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; - var NoContext = - /* */ - 0; - var BatchedContext = - /* */ - 1; - var DiscreteEventContext = - /* */ - 4; - var LegacyUnbatchedContext = - /* */ - 8; - var RenderContext = - /* */ - 16; - var CommitContext = - /* */ - 32; - var RetryAfterError = - /* */ - 64; - var RootIncomplete = 0; - var RootFatalErrored = 1; - var RootErrored = 2; - var RootSuspended = 3; - var RootSuspendedWithDelay = 4; - var RootCompleted = 5; // Describes where we are in the React execution stack - - var executionContext = NoContext; // The root we're working on - - var workInProgressRoot = null; // The fiber we're working on - - var workInProgress = null; // The lanes we're rendering - - var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree - // This is a superset of the lanes we started working on at the root. The only - // case where it's different from `workInProgressRootRenderLanes` is when we - // enter a subtree that is hidden and needs to be unhidden: Suspense and - // Offscreen component. - // - // Most things in the work loop should deal with workInProgressRootRenderLanes. - // Most things in begin/complete phases should deal with subtreeRenderLanes. - - var subtreeRenderLanes = NoLanes; - var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. - - var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown - - var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's - // slightly different than `renderLanes` because `renderLanes` can change as you - // enter and exit an Offscreen tree. This value is the combination of all render - // lanes for the entire render phase. - - var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only - // includes unprocessed updates, not work in bailed out children. - - var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. - - var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. - - var workInProgressRootPingedLanes = NoLanes; - var mostRecentlyUpdatedRoot = null; // The most recent time we committed a fallback. This lets us ensure a train - // model where we don't commit new loading states in too quick succession. - - var globalMostRecentFallbackTime = 0; - var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering - // more and prefer CPU suspense heuristics instead. - - var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU - // suspense heuristics and opt out of rendering more content. - - var RENDER_TIMEOUT_MS = 500; - - function resetRenderTimer() { - workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; - } - - function getRenderTargetTime() { - return workInProgressRootRenderTargetTime; - } - var nextEffect = null; - var hasUncaughtError = false; - var firstUncaughtError = null; - var legacyErrorBoundariesThatAlreadyFailed = null; - var rootDoesHavePassiveEffects = false; - var rootWithPendingPassiveEffects = null; - var pendingPassiveEffectsRenderPriority = NoPriority$1; - var pendingPassiveEffectsLanes = NoLanes; - var pendingPassiveHookEffectsMount = []; - var pendingPassiveHookEffectsUnmount = []; - var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates - - var NESTED_UPDATE_LIMIT = 50; - var nestedUpdateCount = 0; - var rootWithNestedUpdates = null; - var NESTED_PASSIVE_UPDATE_LIMIT = 50; - var nestedPassiveUpdateCount = 0; // Marks the need to reschedule pending interactions at these lanes - // during the commit phase. This enables them to be traced across components - // that spawn new work during render. E.g. hidden boundaries, suspended SSR - // hydration or SuspenseList. - // TODO: Can use a bitmask instead of an array - - var spawnedWorkDuringRender = null; // If two updates are scheduled within the same event, we should treat their - // event times as simultaneous, even if the actual clock time has advanced - // between the first and second call. - - var currentEventTime = NoTimestamp; - var currentEventWipLanes = NoLanes; - var currentEventPendingLanes = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed. - // We warn about state updates for unmounted components differently in this case. - - var isFlushingPassiveEffects = false; - var focusedInstanceHandle = null; - var shouldFireAfterActiveInstanceBlur = false; - function getWorkInProgressRoot() { - return workInProgressRoot; - } - function requestEventTime() { - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - // We're inside React, so it's fine to read the actual time. - return now(); - } // We're not inside React, so we may be in the middle of a browser event. - - - if (currentEventTime !== NoTimestamp) { - // Use the same start time for all updates until we enter React again. - return currentEventTime; - } // This is the first update since React yielded. Compute a new start time. - - - currentEventTime = now(); - return currentEventTime; - } - function requestUpdateLane(fiber) { - // Special cases - var mode = fiber.mode; - - if ((mode & BlockingMode) === NoMode) { - return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; - } // The algorithm for assigning an update to a lane should be stable for all - // updates at the same priority within the same event. To do this, the inputs - // to the algorithm must be the same. For example, we use the `renderLanes` - // to avoid choosing a lane that is already in the middle of rendering. - // - // However, the "included" lanes could be mutated in between updates in the - // same event, like if you perform an update inside `flushSync`. Or any other - // code path that might call `prepareFreshStack`. - // - // The trick we use is to cache the first of each of these inputs within an - // event. Then reset the cached values once we can be sure the event is over. - // Our heuristic for that is whenever we enter a concurrent work loop. - // - // We'll do the same for `currentEventPendingLanes` below. - - - if (currentEventWipLanes === NoLanes) { - currentEventWipLanes = workInProgressRootIncludedLanes; - } - - var isTransition = requestCurrentTransition() !== NoTransition; - - if (isTransition) { - if (currentEventPendingLanes !== NoLanes) { - currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes; - } - - return findTransitionLane(currentEventWipLanes, currentEventPendingLanes); - } // TODO: Remove this dependency on the Scheduler priority. - // To do that, we're replacing it with an update lane priority. - - - var schedulerPriority = getCurrentPriorityLevel(); // The old behavior was using the priority level of the Scheduler. - // This couples React to the Scheduler internals, so we're replacing it - // with the currentUpdateLanePriority above. As an example of how this - // could be problematic, if we're not inside `Scheduler.runWithPriority`, - // then we'll get the priority of the current running Scheduler task, - // which is probably not what we want. - - var lane; - - if ( // TODO: Temporary. We're removing the concept of discrete updates. - (executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$1) { - lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes); - } else { - var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority); - - lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes); - } - - return lane; - } - - function requestRetryLane(fiber) { - // This is a fork of `requestUpdateLane` designed specifically for Suspense - // "retries" — a special update that attempts to flip a Suspense boundary - // from its placeholder state to its primary/resolved state. - // Special cases - var mode = fiber.mode; - - if ((mode & BlockingMode) === NoMode) { - return SyncLane; - } else if ((mode & ConcurrentMode) === NoMode) { - return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; - } // See `requestUpdateLane` for explanation of `currentEventWipLanes` - - - if (currentEventWipLanes === NoLanes) { - currentEventWipLanes = workInProgressRootIncludedLanes; - } - - return findRetryLane(currentEventWipLanes); - } - - function scheduleUpdateOnFiber(fiber, lane, eventTime) { - checkForNestedUpdates(); - warnAboutRenderPhaseUpdatesInDEV(fiber); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - - if (root === null) { - warnAboutUpdateOnUnmountedFiberInDEV(fiber); - return null; - } // Mark that the root has a pending update. - - - markRootUpdated(root, lane, eventTime); - - if (root === workInProgressRoot) { - // Received an update to a tree that's in the middle of rendering. Mark - // that there was an interleaved update work on this root. Unless the - // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render - // phase update. In that case, we don't treat render phase updates as if - // they were interleaved, for backwards compat reasons. - { - workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane); - } - - if (workInProgressRootExitStatus === RootSuspendedWithDelay) { - // The root already suspended with a delay, which means this render - // definitely won't finish. Since we have a new update, let's mark it as - // suspended now, right before marking the incoming update. This has the - // effect of interrupting the current render and switching to the update. - // TODO: Make sure this doesn't override pings that happen while we've - // already started rendering. - markRootSuspended$1(root, workInProgressRootRenderLanes); - } - } // TODO: requestUpdateLanePriority also reads the priority. Pass the - // priority as an argument to that function and this one. - - - var priorityLevel = getCurrentPriorityLevel(); - - if (lane === SyncLane) { - if ( // Check if we're inside unbatchedUpdates - (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering - (executionContext & (RenderContext | CommitContext)) === NoContext) { - // Register pending interactions on the root to avoid losing traced interaction data. - schedulePendingInteractions(root, lane); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed - // root inside of batchedUpdates should be synchronous, but layout updates - // should be deferred until the end of the batch. - - performSyncWorkOnRoot(root); - } else { - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, lane); - - if (executionContext === NoContext) { - // Flush the synchronous work now, unless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initiated - // updates, to preserve historical behavior of legacy mode. - resetRenderTimer(); - flushSyncCallbackQueue(); - } - } - } else { - // Schedule a discrete update but only if it's not Sync. - if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered - // discrete, even inside a discrete event. - priorityLevel === UserBlockingPriority$1 || priorityLevel === ImmediatePriority$1)) { - // This is the result of a discrete event. Track the lowest priority - // discrete update per root so we can flush them early, if needed. - if (rootsWithPendingDiscreteUpdates === null) { - rootsWithPendingDiscreteUpdates = new Set([root]); - } else { - rootsWithPendingDiscreteUpdates.add(root); - } - } // Schedule other updates after in case the callback is sync. - - - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, lane); - } // We use this when assigning a lane for a transition inside - // `requestUpdateLane`. We assume it's the same as the root being updated, - // since in the common case of a single root app it probably is. If it's not - // the same root, then it's not a huge deal, we just might batch more stuff - // together more than necessary. - - - mostRecentlyUpdatedRoot = root; - } // This is split into a separate function so we can mark a fiber with pending - // work without treating it as a typical update that originates from an event; - // e.g. retrying a Suspense boundary isn't an update, but it does schedule work - // on a fiber. - - function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } - - { - if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } // Walk the parent path to the root and update the child expiration time. - - - var node = sourceFiber; - var parent = sourceFiber.return; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } else { - { - if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } - } - - node = parent; - parent = parent.return; - } - - if (node.tag === HostRoot) { - var root = node.stateNode; - return root; - } else { - return null; - } - } // Use this function to schedule a task for a root. There's only one task per - // root; if a task was already scheduled, we'll check to make sure the priority - // of the existing task is the same as the priority of the next level that the - // root has work on. This function is called on every update, and right before - // exiting a task. - - - function ensureRootIsScheduled(root, currentTime) { - var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as - // expired so we know to work on those next. - - markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. - - var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); // This returns the priority level computed during the `getNextLanes` call. - - var newCallbackPriority = returnNextLanesPriority(); - - if (nextLanes === NoLanes) { - // Special case: There's nothing to work on. - if (existingCallbackNode !== null) { - cancelCallback(existingCallbackNode); - root.callbackNode = null; - root.callbackPriority = NoLanePriority; - } - - return; - } // Check if there's an existing task. We may be able to reuse it. - - - if (existingCallbackNode !== null) { - var existingCallbackPriority = root.callbackPriority; - - if (existingCallbackPriority === newCallbackPriority) { - // The priority hasn't changed. We can reuse the existing task. Exit. - return; - } // The priority changed. Cancel the existing callback. We'll schedule a new - // one below. - - - cancelCallback(existingCallbackNode); - } // Schedule a new callback. - - - var newCallbackNode; - - if (newCallbackPriority === SyncLanePriority) { - // Special case: Sync React callbacks are scheduled on a special - // internal queue - newCallbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); - } else if (newCallbackPriority === SyncBatchedLanePriority) { - newCallbackNode = scheduleCallback(ImmediatePriority$1, performSyncWorkOnRoot.bind(null, root)); - } else { - var schedulerPriorityLevel = lanePriorityToSchedulerPriority(newCallbackPriority); - newCallbackNode = scheduleCallback(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); - } - - root.callbackPriority = newCallbackPriority; - root.callbackNode = newCallbackNode; - } // This is the entry point for every concurrent task, i.e. anything that - // goes through Scheduler. - - - function performConcurrentWorkOnRoot(root) { - // Since we know we're in a React event, we can clear the current - // event time. The next update will compute a new event time. - currentEventTime = NoTimestamp; - currentEventWipLanes = NoLanes; - currentEventPendingLanes = NoLanes; - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } // Flush any pending passive effects before deciding which lanes to work on, - // in case they schedule additional work. - - - var originalCallbackNode = root.callbackNode; - var didFlushPassiveEffects = flushPassiveEffects(); - - if (didFlushPassiveEffects) { - // Something in the passive effect phase may have canceled the current task. - // Check if the task node for this root was changed. - if (root.callbackNode !== originalCallbackNode) { - // The current task was canceled. Exit. We don't need to call - // `ensureRootIsScheduled` because the check above implies either that - // there's a new task, or that there's no remaining work on this root. - return null; - } - } // Determine the next expiration time to work on, using the fields stored - // on the root. - - - var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); - - if (lanes === NoLanes) { - // Defensive coding. This is never expected to happen. - return null; - } - - var exitStatus = renderRootConcurrent(root, lanes); - - if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) { - // The render included lanes that were updated during the render phase. - // For example, when unhiding a hidden tree, we include all the lanes - // that were previously skipped when the tree was hidden. That set of - // lanes is a superset of the lanes we started rendering with. - // - // So we'll throw out the current work and restart. - prepareFreshStack(root, NoLanes); - } else if (exitStatus !== RootIncomplete) { - if (exitStatus === RootErrored) { - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.hydrate) { - root.hydrate = false; - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render - // synchronously to block concurrent data mutations, and we'll includes - // all pending updates are included. If it still fails after the second - // attempt, we'll give up and commit the resulting tree. - - - lanes = getLanesToRetrySynchronouslyOnError(root); - - if (lanes !== NoLanes) { - exitStatus = renderRootSync(root, lanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } // We now have a consistent tree. The next step is either to commit it, - // or, if something suspended, wait to commit it after a timeout. - - - var finishedWork = root.current.alternate; - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - finishConcurrentRender(root, exitStatus, lanes); - } - - ensureRootIsScheduled(root, now()); - - if (root.callbackNode === originalCallbackNode) { - // The task node scheduled for this root is the same one that's - // currently executed. Need to return a continuation. - return performConcurrentWorkOnRoot.bind(null, root); - } - - return null; - } - - function finishConcurrentRender(root, exitStatus, lanes) { - switch (exitStatus) { - case RootIncomplete: - case RootFatalErrored: - { - { - { - throw Error( "Root did not complete. This is a bug in React." ); - } - } - } - // Flow knows about invariant, so it complains if I add a break - // statement, but eslint doesn't know about invariant, so it complains - // if I do. eslint-disable-next-line no-fallthrough - - case RootErrored: - { - // We should have already attempted to retry this tree. If we reached - // this point, it errored again. Commit it. - commitRoot(root); - break; - } - - case RootSuspended: - { - markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we - // should immediately commit it or wait a bit. - - if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope - !shouldForceFlushFallbacksInDEV()) { - // This render only included retries, no updates. Throttle committing - // retries so that we don't show too many loading states too quickly. - var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. - - if (msUntilTimeout > 10) { - var nextLanes = getNextLanes(root, NoLanes); - - if (nextLanes !== NoLanes) { - // There's additional work on this root. - break; - } - - var suspendedLanes = root.suspendedLanes; - - if (!isSubsetOfLanes(suspendedLanes, lanes)) { - // We should prefer to render the fallback of at the last - // suspended level. Ping the last suspended level to try - // rendering it again. - // FIXME: What if the suspended lanes are Idle? Should not restart. - var eventTime = requestEventTime(); - markRootPinged(root, suspendedLanes); - break; - } // The render is suspended, it hasn't timed out, and there's no - // lower priority work to do. Instead of committing the fallback - // immediately, wait for more data to arrive. - - - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout); - break; - } - } // The work expired. Commit immediately. - - - commitRoot(root); - break; - } - - case RootSuspendedWithDelay: - { - markRootSuspended$1(root, lanes); - - if (includesOnlyTransitions(lanes)) { - // This is a transition, so we should exit without committing a - // placeholder and without scheduling a timeout. Delay indefinitely - // until we receive more data. - break; - } - - if (!shouldForceFlushFallbacksInDEV()) { - // This is not a transition, but we did trigger an avoided state. - // Schedule a placeholder to display after a short delay, using the Just - // Noticeable Difference. - // TODO: Is the JND optimization worth the added complexity? If this is - // the only reason we track the event time, then probably not. - // Consider removing. - var mostRecentEventTime = getMostRecentEventTime(root, lanes); - var eventTimeMs = mostRecentEventTime; - var timeElapsedMs = now() - eventTimeMs; - - var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. - - - if (_msUntilTimeout > 10) { - // Instead of committing the fallback immediately, wait for more data - // to arrive. - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout); - break; - } - } // Commit the placeholder. - - - commitRoot(root); - break; - } - - case RootCompleted: - { - // The work completed. Ready to commit. - commitRoot(root); - break; - } - - default: - { - { - { - throw Error( "Unknown root exit status." ); - } - } - } - } - } - - function markRootSuspended$1(root, suspendedLanes) { - // When suspending, we should always exclude lanes that were pinged or (more - // rarely, since we try to avoid it) updated during the render phase. - // TODO: Lol maybe there's a better way to factor this besides this - // obnoxiously named function :) - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes); - markRootSuspended(root, suspendedLanes); - } // This is the entry point for synchronous tasks that don't go - // through Scheduler - - - function performSyncWorkOnRoot(root) { - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } - - flushPassiveEffects(); - var lanes; - var exitStatus; - - if (root === workInProgressRoot && includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes)) { - // There's a partial tree, and at least one of its lanes has expired. Finish - // rendering it before rendering the rest of the expired work. - lanes = workInProgressRootRenderLanes; - exitStatus = renderRootSync(root, lanes); - - if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) { - // The render included lanes that were updated during the render phase. - // For example, when unhiding a hidden tree, we include all the lanes - // that were previously skipped when the tree was hidden. That set of - // lanes is a superset of the lanes we started rendering with. - // - // Note that this only happens when part of the tree is rendered - // concurrently. If the whole tree is rendered synchronously, then there - // are no interleaved events. - lanes = getNextLanes(root, lanes); - exitStatus = renderRootSync(root, lanes); - } - } else { - lanes = getNextLanes(root, NoLanes); - exitStatus = renderRootSync(root, lanes); - } - - if (root.tag !== LegacyRoot && exitStatus === RootErrored) { - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.hydrate) { - root.hydrate = false; - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render - // synchronously to block concurrent data mutations, and we'll includes - // all pending updates are included. If it still fails after the second - // attempt, we'll give up and commit the resulting tree. - - - lanes = getLanesToRetrySynchronouslyOnError(root); - - if (lanes !== NoLanes) { - exitStatus = renderRootSync(root, lanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } // We now have a consistent tree. Because this is a sync render, we - // will commit it even if something suspended. - - - var finishedWork = root.current.alternate; - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next - // pending level. - - ensureRootIsScheduled(root, now()); - return null; - } - - function batchedUpdates(fn, a) { - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - - try { - return fn(a); - } finally { - executionContext = prevExecutionContext; - - if (executionContext === NoContext) { - // Flush the immediate callbacks that were scheduled during this batch - resetRenderTimer(); - flushSyncCallbackQueue(); - } - } - } - function flushSync(fn, a) { - var prevExecutionContext = executionContext; - - if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) { - { - error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.'); - } - - return fn(a); - } - - executionContext |= BatchedContext; - - { - try { - if (fn) { - return runWithPriority(ImmediatePriority$1, fn.bind(null, a)); - } else { - return undefined; - } - } finally { - executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. - // Note that this will happen even if batchedUpdates is higher up - // the stack. - - flushSyncCallbackQueue(); - } - } - } - function pushRenderLanes(fiber, lanes) { - push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); - subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); - workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); - } - function popRenderLanes(fiber) { - subtreeRenderLanes = subtreeRenderLanesCursor.current; - pop(subtreeRenderLanesCursor, fiber); - } - - function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = NoLanes; - var timeoutHandle = root.timeoutHandle; - - if (timeoutHandle !== noTimeout) { - // The root previous suspended and scheduled a timeout to commit a fallback - // state. Now that we have additional work, cancel the timeout. - root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above - - cancelTimeout(timeoutHandle); - } - - if (workInProgress !== null) { - var interruptedWork = workInProgress.return; - - while (interruptedWork !== null) { - unwindInterruptedWork(interruptedWork); - interruptedWork = interruptedWork.return; - } - } - - workInProgressRoot = root; - workInProgress = createWorkInProgress(root.current, null); - workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; - workInProgressRootExitStatus = RootIncomplete; - workInProgressRootFatalError = null; - workInProgressRootSkippedLanes = NoLanes; - workInProgressRootUpdatedLanes = NoLanes; - workInProgressRootPingedLanes = NoLanes; - - { - spawnedWorkDuringRender = null; - } - - { - ReactStrictModeWarnings.discardPendingWarnings(); - } - } - - function handleError(root, thrownValue) { - do { - var erroredWork = workInProgress; - - try { - // Reset module-level state that was set during the render phase. - resetContextDependencies(); - resetHooksAfterThrow(); - resetCurrentFiber(); // TODO: I found and added this missing line while investigating a - // separate issue. Write a regression test using string refs. - - ReactCurrentOwner$2.current = null; - - if (erroredWork === null || erroredWork.return === null) { - // Expected to be working on a non-root fiber. This is a fatal error - // because there's no ancestor that can handle it; the root is - // supposed to capture all errors that weren't caught by an error - // boundary. - workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next - // sibling, or the parent if there are no siblings. But since the root - // has no siblings nor a parent, we set it to null. Usually this is - // handled by `completeUnitOfWork` or `unwindWork`, but since we're - // intentionally not calling those, we need set it here. - // TODO: Consider calling `unwindWork` to pop the contexts. - - workInProgress = null; - return; - } - - if (enableProfilerTimer && erroredWork.mode & ProfileMode) { - // Record the time spent rendering before an error was thrown. This - // avoids inaccurate Profiler durations in the case of a - // suspended render. - stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); - } - - throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); - completeUnitOfWork(erroredWork); - } catch (yetAnotherThrownValue) { - // Something in the return path also threw. - thrownValue = yetAnotherThrownValue; - - if (workInProgress === erroredWork && erroredWork !== null) { - // If this boundary has already errored, then we had trouble processing - // the error. Bubble it to the next boundary. - erroredWork = erroredWork.return; - workInProgress = erroredWork; - } else { - erroredWork = workInProgress; - } - - continue; - } // Return to the normal work loop. - - - return; - } while (true); - } - - function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher$2.current; - ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; - - if (prevDispatcher === null) { - // The React isomorphic package does not include a default dispatcher. - // Instead the first renderer will lazily attach one, in order to give - // nicer error messages. - return ContextOnlyDispatcher; - } else { - return prevDispatcher; - } - } - - function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher$2.current = prevDispatcher; - } - - function pushInteractions(root) { - { - var prevInteractions = __interactionsRef.current; - __interactionsRef.current = root.memoizedInteractions; - return prevInteractions; - } - } - - function popInteractions(prevInteractions) { - { - __interactionsRef.current = prevInteractions; - } - } - - function markCommitTimeOfFallback() { - globalMostRecentFallbackTime = now(); - } - function markSkippedUpdateLanes(lane) { - workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); - } - function renderDidSuspend() { - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootSuspended; - } - } - function renderDidSuspendDelayIfPossible() { - if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) { - workInProgressRootExitStatus = RootSuspendedWithDelay; - } // Check if there are updates that we skipped tree that might have unblocked - // this render. - - - if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes))) { - // Mark the current render as suspended so that we switch to working on - // the updates that were skipped. Usually we only suspend at the end of - // the render phase. - // TODO: We should probably always mark the root as suspended immediately - // (inside this function), since by suspending at the end of the render - // phase introduces a potential mistake where we suspend lanes that were - // pinged or updated while we were rendering. - markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); - } - } - function renderDidError() { - if (workInProgressRootExitStatus !== RootCompleted) { - workInProgressRootExitStatus = RootErrored; - } - } // Called during render to determine if anything has suspended. - // Returns false if we're not sure. - - function renderHasNotSuspendedYet() { - // If something errored or completed, we can't really be sure, - // so those are false. - return workInProgressRootExitStatus === RootIncomplete; - } - - function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - prepareFreshStack(root, lanes); - startWorkOnPendingInteractions(root, lanes); - } - - var prevInteractions = pushInteractions(root); - - do { - try { - workLoopSync(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - - { - popInteractions(prevInteractions); - } - - executionContext = prevExecutionContext; - popDispatcher(prevDispatcher); - - if (workInProgress !== null) { - // This is a sync render, so we should have finished the whole tree. - { - { - throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; - return workInProgressRootExitStatus; - } // The work loop is an extremely hot path. Tell Closure not to inline it. - - /** @noinline */ - - - function workLoopSync() { - // Already timed out, so perform work without checking if we need to yield. - while (workInProgress !== null) { - performUnitOfWork(workInProgress); - } - } - - function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - resetRenderTimer(); - prepareFreshStack(root, lanes); - startWorkOnPendingInteractions(root, lanes); - } - - var prevInteractions = pushInteractions(root); - - do { - try { - workLoopConcurrent(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - - { - popInteractions(prevInteractions); - } - - popDispatcher(prevDispatcher); - executionContext = prevExecutionContext; - - - if (workInProgress !== null) { - - return RootIncomplete; - } else { - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; // Return the final exit status. - - return workInProgressRootExitStatus; - } - } - /** @noinline */ - - - function workLoopConcurrent() { - // Perform work until Scheduler asks us to yield - while (workInProgress !== null && !shouldYield()) { - performUnitOfWork(workInProgress); - } - } - - function performUnitOfWork(unitOfWork) { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); - var next; - - if ( (unitOfWork.mode & ProfileMode) !== NoMode) { - startProfilerTimer(unitOfWork); - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } else { - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - } - - resetCurrentFiber(); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } - - ReactCurrentOwner$2.current = null; - } - - function completeUnitOfWork(unitOfWork) { - // Attempt to complete the current unit of work, then move to the next - // sibling. If there are no more siblings, return to the parent fiber. - var completedWork = unitOfWork; - - do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags) { - setCurrentFiber(completedWork); - var next = void 0; - - if ( (completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, subtreeRenderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; - return; - } - - resetChildLanes(completedWork); - - if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete - (returnFiber.flags & Incomplete) === NoFlags) { - // Append all the effects of the subtree and this fiber onto the effect - // list of the parent. The completion order of the children affects the - // side-effect order. - if (returnFiber.firstEffect === null) { - returnFiber.firstEffect = completedWork.firstEffect; - } - - if (completedWork.lastEffect !== null) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = completedWork.firstEffect; - } - - returnFiber.lastEffect = completedWork.lastEffect; - } // If this fiber had side-effects, we append it AFTER the children's - // side-effects. We can perform certain side-effects earlier if needed, - // by doing multiple passes over the effect list. We don't want to - // schedule our own side-effect on our own list because if end up - // reusing children we'll schedule this effect onto itself since we're - // at the end. - - - var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect - // list. PerformedWork effect is read by React DevTools but shouldn't be - // committed. - - if (flags > PerformedWork) { - if (returnFiber.lastEffect !== null) { - returnFiber.lastEffect.nextEffect = completedWork; - } else { - returnFiber.firstEffect = completedWork; - } - - returnFiber.lastEffect = completedWork; - } - } - } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(completedWork); // Because this fiber did not complete, don't reset its expiration time. - - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; - } - - if ( (completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. - - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; - - while (child !== null) { - actualDuration += child.actualDuration; - child = child.sibling; - } - - completedWork.actualDuration = actualDuration; - } - - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its effect list. - returnFiber.firstEffect = returnFiber.lastEffect = null; - returnFiber.flags |= Incomplete; - } - } - - var siblingFiber = completedWork.sibling; - - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - workInProgress = siblingFiber; - return; - } // Otherwise, return to the parent - - - completedWork = returnFiber; // Update the next thing we're working on in case something throws. - - workInProgress = completedWork; - } while (completedWork !== null); // We've reached the root. - - - if (workInProgressRootExitStatus === RootIncomplete) { - workInProgressRootExitStatus = RootCompleted; - } - } - - function resetChildLanes(completedWork) { - if ( // TODO: Move this check out of the hot path by moving `resetChildLanes` - // to switch statement in `completeWork`. - (completedWork.tag === LegacyHiddenComponent || completedWork.tag === OffscreenComponent) && completedWork.memoizedState !== null && !includesSomeLane(subtreeRenderLanes, OffscreenLane) && (completedWork.mode & ConcurrentMode) !== NoLanes) { - // The children of this component are hidden. Don't bubble their - // expiration times. - return; - } - - var newChildLanes = NoLanes; // Bubble up the earliest expiration time. - - if ( (completedWork.mode & ProfileMode) !== NoMode) { - // In profiling mode, resetChildExpirationTime is also used to reset - // profiler durations. - var actualDuration = completedWork.actualDuration; - var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will - // only be updated if work is done on the fiber (i.e. it doesn't bailout). - // When work is done, it should bubble to the parent's actualDuration. If - // the fiber has not been cloned though, (meaning no work was done), then - // this value will reflect the amount of time spent working on a previous - // render. In that case it should not bubble. We determine whether it was - // cloned by comparing the child pointer. - - var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child; - var child = completedWork.child; - - while (child !== null) { - newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes)); - - if (shouldBubbleActualDurations) { - actualDuration += child.actualDuration; - } - - treeBaseDuration += child.treeBaseDuration; - child = child.sibling; - } - - var isTimedOutSuspense = completedWork.tag === SuspenseComponent && completedWork.memoizedState !== null; - - if (isTimedOutSuspense) { - // Don't count time spent in a timed out Suspense subtree as part of the base duration. - var primaryChildFragment = completedWork.child; - - if (primaryChildFragment !== null) { - treeBaseDuration -= primaryChildFragment.treeBaseDuration; - } - } - - completedWork.actualDuration = actualDuration; - completedWork.treeBaseDuration = treeBaseDuration; - } else { - var _child = completedWork.child; - - while (_child !== null) { - newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes)); - _child = _child.sibling; - } - } - - completedWork.childLanes = newChildLanes; - } - - function commitRoot(root) { - var renderPriorityLevel = getCurrentPriorityLevel(); - runWithPriority(ImmediatePriority$1, commitRootImpl.bind(null, root, renderPriorityLevel)); - return null; - } - - function commitRootImpl(root, renderPriorityLevel) { - do { - // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which - // means `flushPassiveEffects` will sometimes result in additional - // passive effects. So we need to keep flushing in a loop until there are - // no more pending effects. - // TODO: Might be better if `flushPassiveEffects` did not automatically - // flush synchronous work at the end, to avoid factoring hazards like this. - flushPassiveEffects(); - } while (rootWithPendingPassiveEffects !== null); - - flushRenderPhaseStrictModeWarningsInDEV(); - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Should not already be working." ); - } - } - - var finishedWork = root.finishedWork; - var lanes = root.finishedLanes; - - if (finishedWork === null) { - - return null; - } - - root.finishedWork = null; - root.finishedLanes = NoLanes; - - if (!(finishedWork !== root.current)) { - { - throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." ); - } - } // commitRoot never returns a continuation; it always finishes synchronously. - // So we can clear these now to allow a new callback to be scheduled. - - - root.callbackNode = null; // Update the first and last pending times on this root. The new first - // pending time is whatever is left on the root fiber. - - var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); - markRootFinished(root, remainingLanes); // Clear already finished discrete updates in case that a later call of - // `flushDiscreteUpdates` starts a useless render pass which may cancels - // a scheduled timeout. - - if (rootsWithPendingDiscreteUpdates !== null) { - if (!hasDiscreteLanes(remainingLanes) && rootsWithPendingDiscreteUpdates.has(root)) { - rootsWithPendingDiscreteUpdates.delete(root); - } - } - - if (root === workInProgressRoot) { - // We can reset these now that they are finished. - workInProgressRoot = null; - workInProgress = null; - workInProgressRootRenderLanes = NoLanes; - } // Get the list of effects. - - - var firstEffect; - - if (finishedWork.flags > PerformedWork) { - // A fiber's effect list consists only of its children, not itself. So if - // the root has an effect, we need to add it to the end of the list. The - // resulting list is the set that would belong to the root's parent, if it - // had one; that is, all the effects in the tree including the root. - if (finishedWork.lastEffect !== null) { - finishedWork.lastEffect.nextEffect = finishedWork; - firstEffect = finishedWork.firstEffect; - } else { - firstEffect = finishedWork; - } - } else { - // There is no effect on the root. - firstEffect = finishedWork.firstEffect; - } - - if (firstEffect !== null) { - - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles - - ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass - // of the effect list for each phase: all mutation effects come before all - // layout effects, and so on. - // The first phase a "before mutation" phase. We use this phase to read the - // state of the host tree right before we mutate it. This is where - // getSnapshotBeforeUpdate is called. - - focusedInstanceHandle = prepareForCommit(root.containerInfo); - shouldFireAfterActiveInstanceBlur = false; - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitBeforeMutationEffects, null); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var error = clearCaughtError(); - captureCommitPhaseError(nextEffect, error); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); // We no longer need to track the active instance fiber - - - focusedInstanceHandle = null; - - { - // Mark the current commit time to be shared by all Profilers in this - // batch. This enables them to be grouped later. - recordCommitTime(); - } // The next phase is the mutation phase, where we mutate the host tree. - - - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error = clearCaughtError(); - - captureCommitPhaseError(nextEffect, _error); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); - - resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after - // the mutation phase, so that the previous tree is still current during - // componentWillUnmount, but before the layout phase, so that the finished - // work is current during componentDidMount/Update. - - root.current = finishedWork; // The next phase is the layout phase, where we call effects that read - // the host tree after it's been mutated. The idiomatic use case for this is - // layout, but class component lifecycles also fire here for legacy reasons. - - nextEffect = firstEffect; - - do { - { - invokeGuardedCallback(null, commitLayoutEffects, null, root, lanes); - - if (hasCaughtError()) { - if (!(nextEffect !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error2 = clearCaughtError(); - - captureCommitPhaseError(nextEffect, _error2); - nextEffect = nextEffect.nextEffect; - } - } - } while (nextEffect !== null); - - nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an - // opportunity to paint. - - requestPaint(); - - { - popInteractions(prevInteractions); - } - - executionContext = prevExecutionContext; - } else { - // No effects. - root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were - // no effects. - // TODO: Maybe there's a better way to report this. - - { - recordCommitTime(); - } - } - - var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; - - if (rootDoesHavePassiveEffects) { - // This commit has passive effects. Stash a reference to them. But don't - // schedule a callback until after flushing layout work. - rootDoesHavePassiveEffects = false; - rootWithPendingPassiveEffects = root; - pendingPassiveEffectsLanes = lanes; - pendingPassiveEffectsRenderPriority = renderPriorityLevel; - } else { - // We are done with the effect chain at this point so let's clear the - // nextEffect pointers to assist with GC. If we have passive effects, we'll - // clear this in flushPassiveEffects. - nextEffect = firstEffect; - - while (nextEffect !== null) { - var nextNextEffect = nextEffect.nextEffect; - nextEffect.nextEffect = null; - - if (nextEffect.flags & Deletion) { - detachFiberAfterEffects(nextEffect); - } - - nextEffect = nextNextEffect; - } - } // Read this again, since an effect might have updated it - - - remainingLanes = root.pendingLanes; // Check if there's remaining work on this root - - if (remainingLanes !== NoLanes) { - { - if (spawnedWorkDuringRender !== null) { - var expirationTimes = spawnedWorkDuringRender; - spawnedWorkDuringRender = null; - - for (var i = 0; i < expirationTimes.length; i++) { - scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions); - } - } - - schedulePendingInteractions(root, remainingLanes); - } - } else { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; - } - - { - if (!rootDidHavePassiveEffects) { - // If there are no passive effects, then we can complete the pending interactions. - // Otherwise, we'll wait until after the passive effects are flushed. - // Wait to do this until after remaining work has been scheduled, - // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. - finishPendingInteractions(root, lanes); - } - } - - if (remainingLanes === SyncLane) { - // Count the number of times the root synchronously re-renders without - // finishing. If there are too many, it indicates an infinite update loop. - if (root === rootWithNestedUpdates) { - nestedUpdateCount++; - } else { - nestedUpdateCount = 0; - rootWithNestedUpdates = root; - } - } else { - nestedUpdateCount = 0; - } - - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - // additional work on this root is scheduled. - - - ensureRootIsScheduled(root, now()); - - if (hasUncaughtError) { - hasUncaughtError = false; - var _error3 = firstUncaughtError; - firstUncaughtError = null; - throw _error3; - } - - if ((executionContext & LegacyUnbatchedContext) !== NoContext) { - // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired - // synchronously, but layout updates should be deferred until the end - // of the batch. - - - return null; - } // If layout work was scheduled, flush it now. - - - flushSyncCallbackQueue(); - - return null; - } - - function commitBeforeMutationEffects() { - while (nextEffect !== null) { - var current = nextEffect.alternate; - - if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) { - if ((nextEffect.flags & Deletion) !== NoFlags) { - if (doesFiberContain(nextEffect, focusedInstanceHandle)) { - shouldFireAfterActiveInstanceBlur = true; - } - } else { - // TODO: Move this out of the hot path using a dedicated effect tag. - if (nextEffect.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle)) { - shouldFireAfterActiveInstanceBlur = true; - } - } - } - - var flags = nextEffect.flags; - - if ((flags & Snapshot) !== NoFlags) { - setCurrentFiber(nextEffect); - commitBeforeMutationLifeCycles(current, nextEffect); - resetCurrentFiber(); - } - - if ((flags & Passive) !== NoFlags) { - // If there are passive effects, schedule a callback to flush at - // the earliest opportunity. - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } - } - - nextEffect = nextEffect.nextEffect; - } - } - - function commitMutationEffects(root, renderPriorityLevel) { - // TODO: Should probably move the bulk of this function to commitWork. - while (nextEffect !== null) { - setCurrentFiber(nextEffect); - var flags = nextEffect.flags; - - if (flags & ContentReset) { - commitResetTextContent(nextEffect); - } - - if (flags & Ref) { - var current = nextEffect.alternate; - - if (current !== null) { - commitDetachRef(current); - } - } // The following switch statement is only concerned about placement, - // updates, and deletions. To avoid needing to add a case for every possible - // bitmap value, we remove the secondary effects from the effect tag and - // switch on that value. - - - var primaryFlags = flags & (Placement | Update | Deletion | Hydrating); - - switch (primaryFlags) { - case Placement: - { - commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - // TODO: findDOMNode doesn't rely on this any more but isMounted does - // and isMounted is deprecated anyway so we should be able to kill this. - - nextEffect.flags &= ~Placement; - break; - } - - case PlacementAndUpdate: - { - // Placement - commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is - // inserted, before any life-cycles like componentDidMount gets called. - - nextEffect.flags &= ~Placement; // Update - - var _current = nextEffect.alternate; - commitWork(_current, nextEffect); - break; - } - - case Hydrating: - { - nextEffect.flags &= ~Hydrating; - break; - } - - case HydratingAndUpdate: - { - nextEffect.flags &= ~Hydrating; // Update - - var _current2 = nextEffect.alternate; - commitWork(_current2, nextEffect); - break; - } - - case Update: - { - var _current3 = nextEffect.alternate; - commitWork(_current3, nextEffect); - break; - } - - case Deletion: - { - commitDeletion(root, nextEffect); - break; - } - } - - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; - } - } - - function commitLayoutEffects(root, committedLanes) { - - - while (nextEffect !== null) { - setCurrentFiber(nextEffect); - var flags = nextEffect.flags; - - if (flags & (Update | Callback)) { - var current = nextEffect.alternate; - commitLifeCycles(root, current, nextEffect); - } - - { - if (flags & Ref) { - commitAttachRef(nextEffect); - } - } - - resetCurrentFiber(); - nextEffect = nextEffect.nextEffect; - } - } - - function flushPassiveEffects() { - // Returns whether passive effects were flushed. - if (pendingPassiveEffectsRenderPriority !== NoPriority$1) { - var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority$1 ? NormalPriority$1 : pendingPassiveEffectsRenderPriority; - pendingPassiveEffectsRenderPriority = NoPriority$1; - - { - return runWithPriority(priorityLevel, flushPassiveEffectsImpl); - } - } - - return false; - } - function enqueuePendingPassiveHookEffectMount(fiber, effect) { - pendingPassiveHookEffectsMount.push(effect, fiber); - - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } - } - function enqueuePendingPassiveHookEffectUnmount(fiber, effect) { - pendingPassiveHookEffectsUnmount.push(effect, fiber); - - { - fiber.flags |= PassiveUnmountPendingDev; - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.flags |= PassiveUnmountPendingDev; - } - } - - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback(NormalPriority$1, function () { - flushPassiveEffects(); - return null; - }); - } - } - - function invokePassiveEffectCreate(effect) { - var create = effect.create; - effect.destroy = create(); - } - - function flushPassiveEffectsImpl() { - if (rootWithPendingPassiveEffects === null) { - return false; - } - - var root = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; - pendingPassiveEffectsLanes = NoLanes; - - if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) { - { - throw Error( "Cannot flush passive effects while already rendering." ); - } - } - - { - isFlushingPassiveEffects = true; - } - - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - var prevInteractions = pushInteractions(root); // It's important that ALL pending passive effect destroy functions are called - // before ANY passive effect create functions are called. - // Otherwise effects in sibling components might interfere with each other. - // e.g. a destroy function in one component may unintentionally override a ref - // value set by a create function in another component. - // Layout effects have the same constraint. - // First pass: Destroy stale passive effects. - - var unmountEffects = pendingPassiveHookEffectsUnmount; - pendingPassiveHookEffectsUnmount = []; - - for (var i = 0; i < unmountEffects.length; i += 2) { - var _effect = unmountEffects[i]; - var fiber = unmountEffects[i + 1]; - var destroy = _effect.destroy; - _effect.destroy = undefined; - - { - fiber.flags &= ~PassiveUnmountPendingDev; - var alternate = fiber.alternate; - - if (alternate !== null) { - alternate.flags &= ~PassiveUnmountPendingDev; - } - } - - if (typeof destroy === 'function') { - { - setCurrentFiber(fiber); - - { - invokeGuardedCallback(null, destroy, null); - } - - if (hasCaughtError()) { - if (!(fiber !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var error = clearCaughtError(); - captureCommitPhaseError(fiber, error); - } - - resetCurrentFiber(); - } - } - } // Second pass: Create new passive effects. - - - var mountEffects = pendingPassiveHookEffectsMount; - pendingPassiveHookEffectsMount = []; - - for (var _i = 0; _i < mountEffects.length; _i += 2) { - var _effect2 = mountEffects[_i]; - var _fiber = mountEffects[_i + 1]; - - { - setCurrentFiber(_fiber); - - { - invokeGuardedCallback(null, invokePassiveEffectCreate, null, _effect2); - } - - if (hasCaughtError()) { - if (!(_fiber !== null)) { - { - throw Error( "Should be working on an effect." ); - } - } - - var _error4 = clearCaughtError(); - - captureCommitPhaseError(_fiber, _error4); - } - - resetCurrentFiber(); - } - } // Note: This currently assumes there are no passive effects on the root fiber - // because the root is not part of its own effect list. - // This could change in the future. - - - var effect = root.current.firstEffect; - - while (effect !== null) { - var nextNextEffect = effect.nextEffect; // Remove nextEffect pointer to assist GC - - effect.nextEffect = null; - - if (effect.flags & Deletion) { - detachFiberAfterEffects(effect); - } - - effect = nextNextEffect; - } - - { - popInteractions(prevInteractions); - finishPendingInteractions(root, lanes); - } - - { - isFlushingPassiveEffects = false; - } - - executionContext = prevExecutionContext; - flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this - // exceeds the limit, we'll fire a warning. - - nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; - return true; - } - - function isAlreadyFailedLegacyErrorBoundary(instance) { - return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); - } - function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); - } - } - - function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } - } - - var onUncaughtError = prepareToThrowUncaughtError; - - function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); - enqueueUpdate(rootFiber, update); - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, SyncLane); - } - } - - function captureCommitPhaseError(sourceFiber, error) { - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); - return; - } - - var fiber = sourceFiber.return; - - while (fiber !== null) { - if (fiber.tag === HostRoot) { - captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); - return; - } else if (fiber.tag === ClassComponent) { - var ctor = fiber.type; - var instance = fiber.stateNode; - - if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - var errorInfo = createCapturedValue(error, sourceFiber); - var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); - enqueueUpdate(fiber, update); - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, SyncLane); - } else { - // This component has already been unmounted. - // We can't schedule any follow up work for the root because the fiber is already unmounted, - // but we can still call the log-only boundary so the error isn't swallowed. - // - // TODO This is only a temporary bandaid for the old reconciler fork. - // We can delete this special case once the new fork is merged. - if (typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - try { - instance.componentDidCatch(error, errorInfo); - } catch (errorToIgnore) {// TODO Ignore this error? Rethrow it? - // This is kind of an edge case. - } - } - } - - return; - } - } - - fiber = fiber.return; - } - } - function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - - if (pingCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - pingCache.delete(wakeable); - } - - var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes); - - if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { - // Received a ping at the same priority level at which we're currently - // rendering. We might want to restart this render. This should mirror - // the logic of whether or not a root suspends once it completes. - // TODO: If we're rendering sync either due to Sync, Batched or expired, - // we should probably never restart. - // If we're suspended with delay, or if it's a retry, we'll always suspend - // so we can always restart. - if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { - // Restart from the root. - prepareFreshStack(root, NoLanes); - } else { - // Even though we can't restart right now, we might get an - // opportunity later. So we mark this render as having a ping. - workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); - } - } - - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, pingedLanes); - } - - function retryTimedOutBoundary(boundaryFiber, retryLane) { - // The boundary fiber (a Suspense component or SuspenseList component) - // previously was rendered in its fallback state. One of the promises that - // suspended it has resolved, which means at least part of the tree was - // likely unblocked. Try rendering again, at a new expiration time. - if (retryLane === NoLane) { - retryLane = requestRetryLane(boundaryFiber); - } // TODO: Special case idle priority? - - - var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane); - - if (root !== null) { - markRootUpdated(root, retryLane, eventTime); - ensureRootIsScheduled(root, eventTime); - schedulePendingInteractions(root, retryLane); - } - } - function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = NoLane; // Default - - var retryCache; - - { - retryCache = boundaryFiber.stateNode; - } - - if (retryCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - retryCache.delete(wakeable); - } - - retryTimedOutBoundary(boundaryFiber, retryLane); - } // Computes the next Just Noticeable Difference (JND) boundary. - // The theory is that a person can't tell the difference between small differences in time. - // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable - // difference in the experience. However, waiting for longer might mean that we can avoid - // showing an intermediate loading state. The longer we have already waited, the harder it - // is to tell small differences in time. Therefore, the longer we've already waited, - // the longer we can wait additionally. At some point we have to give up though. - // We pick a train model where the next boundary commits at a consistent schedule. - // These particular numbers are vague estimates. We expect to adjust them based on research. - - function jnd(timeElapsed) { - return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; - } - - function checkForNestedUpdates() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - nestedUpdateCount = 0; - rootWithNestedUpdates = null; - - { - { - throw Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." ); - } - } - } - - { - if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { - nestedPassiveUpdateCount = 0; - - error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); - } - } - } - - function flushRenderPhaseStrictModeWarningsInDEV() { - { - ReactStrictModeWarnings.flushLegacyContextWarning(); - - { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - } - } - } - - var didWarnStateUpdateForNotYetMountedComponent = null; - - function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { - { - if ((executionContext & RenderContext) !== NoContext) { - // We let the other warning about render phase updates deal with this one. - return; - } - - if (!(fiber.mode & (BlockingMode | ConcurrentMode))) { - return; - } - - var tag = fiber.tag; - - if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - - - var componentName = getComponentName(fiber.type) || 'ReactComponent'; - - if (didWarnStateUpdateForNotYetMountedComponent !== null) { - if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) { - return; - } - - didWarnStateUpdateForNotYetMountedComponent.add(componentName); - } else { - didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); - } - - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - - var didWarnStateUpdateForUnmountedComponent = null; - - function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { - { - var tag = fiber.tag; - - if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } // If there are pending passive effects unmounts for this Fiber, - // we can assume that they would have prevented this update. - - - if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) { - return; - } // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - - - var componentName = getComponentName(fiber.type) || 'ReactComponent'; - - if (didWarnStateUpdateForUnmountedComponent !== null) { - if (didWarnStateUpdateForUnmountedComponent.has(componentName)) { - return; - } - - didWarnStateUpdateForUnmountedComponent.add(componentName); - } else { - didWarnStateUpdateForUnmountedComponent = new Set([componentName]); - } - - if (isFlushingPassiveEffects) ; else { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - } - - var beginWork$1; - - { - beginWork$1 = beginWork; - } - - var didWarnAboutUpdateInRender = false; - var didWarnAboutUpdateInRenderForAnotherComponent; - - { - didWarnAboutUpdateInRenderForAnotherComponent = new Set(); - } - - function warnAboutRenderPhaseUpdatesInDEV(fiber) { - { - if (isRendering && (executionContext & RenderContext) !== NoContext && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. - - var dedupeKey = renderingComponentName; - - if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { - didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); - var setStateComponentName = getComponentName(fiber.type) || 'Unknown'; - - error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); - } - - break; - } - - case ClassComponent: - { - if (!didWarnAboutUpdateInRender) { - error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); - - didWarnAboutUpdateInRender = true; - } - - break; - } - } - } - } - } // a 'shared' variable that changes when act() opens/closes in tests. - - - var IsThisRendererActing = { - current: false - }; - function warnIfNotScopedWithMatchingAct(fiber) { - { - if ( IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + // Break up imports to avoid accidentally parsing them as dependencies. - 'import {act} fr' + "om 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + // Break up imports to avoid accidentally parsing them as dependencies. - 'import TestRenderer fr' + "om react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - } - function warnIfNotCurrentlyActingEffectsInDEV(fiber) { - { - if ( (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { - error('An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentName(fiber.type)); - } - } - } - - function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { - { - if ( executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentName(fiber.type)); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - } - - var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler. - - var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked - // scheduler is the actual recommendation. The alternative could be a testing build, - // a new lib, or whatever; we dunno just yet. This message is for early adopters - // to get their tests right. - - function warnIfUnmockedScheduler(fiber) { - { - if (didWarnAboutUnmockedScheduler === false && Scheduler$1.unstable_flushAllWithoutAsserting === undefined) { - if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { - didWarnAboutUnmockedScheduler = true; - - error('In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + // Break up requires to avoid accidentally parsing them as dependencies. - "jest.mock('scheduler', () => require" + "('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://reactjs.org/link/mock-scheduler'); - } - } - } - } - - function computeThreadID(root, lane) { - // Interaction threads are unique per root and expiration time. - // NOTE: Intentionally unsound cast. All that matters is that it's a number - // and it represents a batch of work. Could make a helper function instead, - // but meh this is fine for now. - return lane * 1000 + root.interactionThreadID; - } - - function markSpawnedWork(lane) { - - if (spawnedWorkDuringRender === null) { - spawnedWorkDuringRender = [lane]; - } else { - spawnedWorkDuringRender.push(lane); - } - } - - function scheduleInteractions(root, lane, interactions) { - - if (interactions.size > 0) { - var pendingInteractionMap = root.pendingInteractionMap; - var pendingInteractions = pendingInteractionMap.get(lane); - - if (pendingInteractions != null) { - interactions.forEach(function (interaction) { - if (!pendingInteractions.has(interaction)) { - // Update the pending async work count for previously unscheduled interaction. - interaction.__count++; - } - - pendingInteractions.add(interaction); - }); - } else { - pendingInteractionMap.set(lane, new Set(interactions)); // Update the pending async work count for the current interactions. - - interactions.forEach(function (interaction) { - interaction.__count++; - }); - } - - var subscriber = __subscriberRef.current; - - if (subscriber !== null) { - var threadID = computeThreadID(root, lane); - subscriber.onWorkScheduled(interactions, threadID); - } - } - } - - function schedulePendingInteractions(root, lane) { - - scheduleInteractions(root, lane, __interactionsRef.current); - } - - function startWorkOnPendingInteractions(root, lanes) { - // we can accurately attribute time spent working on it, And so that cascading - // work triggered during the render phase will be associated with it. - - - var interactions = new Set(); - root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledLane) { - if (includesSomeLane(lanes, scheduledLane)) { - scheduledInteractions.forEach(function (interaction) { - return interactions.add(interaction); - }); - } - }); // Store the current set of interactions on the FiberRoot for a few reasons: - // We can re-use it in hot functions like performConcurrentWorkOnRoot() - // without having to recalculate it. We will also use it in commitWork() to - // pass to any Profiler onRender() hooks. This also provides DevTools with a - // way to access it when the onCommitRoot() hook is called. - - root.memoizedInteractions = interactions; - - if (interactions.size > 0) { - var subscriber = __subscriberRef.current; - - if (subscriber !== null) { - var threadID = computeThreadID(root, lanes); - - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } - } - } - } - - function finishPendingInteractions(root, committedLanes) { - - var remainingLanesAfterCommit = root.pendingLanes; - var subscriber; - - try { - subscriber = __subscriberRef.current; - - if (subscriber !== null && root.memoizedInteractions.size > 0) { - // FIXME: More than one lane can finish in a single commit. - var threadID = computeThreadID(root, committedLanes); - subscriber.onWorkStopped(root.memoizedInteractions, threadID); - } - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } finally { - // Clear completed interactions from the pending Map. - // Unless the render was suspended or cascading work was scheduled, - // In which case– leave pending interactions until the subsequent render. - var pendingInteractionMap = root.pendingInteractionMap; - pendingInteractionMap.forEach(function (scheduledInteractions, lane) { - // Only decrement the pending interaction count if we're done. - // If there's still work at the current priority, - // That indicates that we are waiting for suspense data. - if (!includesSomeLane(remainingLanesAfterCommit, lane)) { - pendingInteractionMap.delete(lane); - scheduledInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber !== null && interaction.__count === 0) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - // If the subscriber throws, rethrow it in a separate task - scheduleCallback(ImmediatePriority$1, function () { - throw error; - }); - } - } - }); - } - }); - } - } // `act` testing API - - function shouldForceFlushFallbacksInDEV() { - // Never force flush in production. This function should get stripped out. - return actingUpdatesScopeDepth > 0; - } - - var flushMockScheduler = Scheduler$1.unstable_flushAllWithoutAsserting; - var isSchedulerMocked = typeof flushMockScheduler === 'function'; // Returns whether additional work was scheduled. Caller should keep flushing - // until there's no work left. - - function flushActWork() { - if (flushMockScheduler !== undefined) { - - try { - return flushMockScheduler(); - } finally { - } - } else { - - try { - var didFlushWork = false; - - while (flushPassiveEffects()) { - didFlushWork = true; - } - - return didFlushWork; - } finally { - } - } - } - - function flushWorkAndMicroTasks(onDone) { - try { - flushActWork(); - enqueueTask(function () { - if (flushActWork()) { - flushWorkAndMicroTasks(onDone); - } else { - onDone(); - } - }); - } catch (err) { - onDone(err); - } - } // we track the 'depth' of the act() calls with this counter, - // so we can tell if any async act() calls try to run in parallel. - - - var actingUpdatesScopeDepth = 0; - function act(callback) { - - var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth; - actingUpdatesScopeDepth++; - var previousIsSomeRendererActing = IsSomeRendererActing.current; - var previousIsThisRendererActing = IsThisRendererActing.current; - IsSomeRendererActing.current = true; - IsThisRendererActing.current = true; - - function onDone() { - actingUpdatesScopeDepth--; - IsSomeRendererActing.current = previousIsSomeRendererActing; - IsThisRendererActing.current = previousIsThisRendererActing; - - { - if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) { - // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - } - } - - var result; - - try { - result = batchedUpdates(callback); - } catch (error) { - // on sync errors, we still want to 'cleanup' and decrement actingUpdatesScopeDepth - onDone(); - throw error; - } - - if (result !== null && typeof result === 'object' && typeof result.then === 'function') { - // setup a boolean that gets set to true only - // once this act() call is await-ed - var called = false; - - { - if (typeof Promise !== 'undefined') { - //eslint-disable-next-line no-undef - Promise.resolve().then(function () {}).then(function () { - if (called === false) { - error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, interleaving multiple act ' + 'calls and mixing their scopes. You should - await act(async () => ...);'); - } - }); - } - } // in the async case, the returned thenable runs the callback, flushes - // effects and microtasks in a loop until flushPassiveEffects() === false, - // and cleans up - - - return { - then: function (resolve, reject) { - called = true; - result.then(function () { - if (actingUpdatesScopeDepth > 1 || isSchedulerMocked === true && previousIsSomeRendererActing === true) { - onDone(); - resolve(); - return; - } // we're about to exit the act() scope, - // now's the time to flush tasks/effects - - - flushWorkAndMicroTasks(function (err) { - onDone(); - - if (err) { - reject(err); - } else { - resolve(); - } - }); - }, function (err) { - onDone(); - reject(err); - }); - } - }; - } else { - { - if (result !== undefined) { - error('The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result); - } - } // flush effects until none remain, and cleanup - - - try { - if (actingUpdatesScopeDepth === 1 && (isSchedulerMocked === false || previousIsSomeRendererActing === false)) { - // we're about to exit the act() scope, - // now's the time to flush effects - flushActWork(); - } - - onDone(); - } catch (err) { - onDone(); - throw err; - } // in the sync case, the returned thenable only warns *if* await-ed - - - return { - then: function (resolve) { - { - error('Do not await the result of calling act(...) with sync logic, it is not a Promise.'); - } - - resolve(); - } - }; - } - } - - function detachFiberAfterEffects(fiber) { - fiber.sibling = null; - fiber.stateNode = null; - } - - var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. - - var failedBoundaries = null; - var setRefreshHandler = function (handler) { - { - resolveFamily = handler; - } - }; - function resolveFunctionForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - return type; - } // Use the latest known implementation. - - - return family.current; - } - } - function resolveClassForHotReloading(type) { - // No implementation differences. - return resolveFunctionForHotReloading(type); - } - function resolveForwardRefForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - // Check if we're dealing with a real forwardRef. Don't want to crash early. - if (type !== null && type !== undefined && typeof type.render === 'function') { - // ForwardRef is special because its resolved .type is an object, - // but it's possible that we only have its inner render function in the map. - // If that inner render function is different, we'll build a new forwardRef type. - var currentRender = resolveFunctionForHotReloading(type.render); - - if (type.render !== currentRender) { - var syntheticType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: currentRender - }; - - if (type.displayName !== undefined) { - syntheticType.displayName = type.displayName; - } - - return syntheticType; - } - } - - return type; - } // Use the latest known implementation. - - - return family.current; - } - } - function isCompatibleFamilyForHotReloading(fiber, element) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return false; - } - - var prevType = fiber.elementType; - var nextType = element.type; // If we got here, we know types aren't === equal. - - var needsCompareFamilies = false; - var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; - - switch (fiber.tag) { - case ClassComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } - - break; - } - - case FunctionComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - // We don't know the inner type yet. - // We're going to assume that the lazy inner type is stable, - // and so it is sufficient to avoid reconciling it away. - // We're not going to unwrap or actually use the new lazy type. - needsCompareFamilies = true; - } - - break; - } - - case ForwardRef: - { - if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - case MemoComponent: - case SimpleMemoComponent: - { - if ($$typeofNextType === REACT_MEMO_TYPE) { - // TODO: if it was but can no longer be simple, - // we shouldn't set this. - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - default: - return false; - } // Check if both types have a family and it's the same one. - - - if (needsCompareFamilies) { - // Note: memo() and forwardRef() we'll compare outer rather than inner type. - // This means both of them need to be registered to preserve state. - // If we unwrapped and compared the inner types for wrappers instead, - // then we would risk falsely saying two separate memo(Foo) - // calls are equivalent because they wrap the same Foo function. - var prevFamily = resolveFamily(prevType); - - if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { - return true; - } - } - - return false; - } - } - function markFailedErrorBoundaryForHotReloading(fiber) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - if (typeof WeakSet !== 'function') { - return; - } - - if (failedBoundaries === null) { - failedBoundaries = new WeakSet(); - } - - failedBoundaries.add(fiber); - } - } - var scheduleRefresh = function (root, update) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - var staleFamilies = update.staleFamilies, - updatedFamilies = update.updatedFamilies; - flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); - }); - } - }; - var scheduleRoot = function (root, element) { - { - if (root.context !== emptyContextObject) { - // Super edge case: root has a legacy _renderSubtree context - // but we don't know the parentComponent so we can't pass it. - // Just ignore. We'll delete this with _renderSubtree code path later. - return; - } - - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); - } - }; - - function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { - { - var alternate = fiber.alternate, - child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - if (resolveFamily === null) { - throw new Error('Expected resolveFamily to be set during hot reload.'); - } - - var needsRender = false; - var needsRemount = false; - - if (candidateType !== null) { - var family = resolveFamily(candidateType); - - if (family !== undefined) { - if (staleFamilies.has(family)) { - needsRemount = true; - } else if (updatedFamilies.has(family)) { - if (tag === ClassComponent) { - needsRemount = true; - } else { - needsRender = true; - } - } - } - } - - if (failedBoundaries !== null) { - if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { - needsRemount = true; - } - } - - if (needsRemount) { - fiber._debugNeedsRemount = true; - } - - if (needsRemount || needsRender) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - - if (child !== null && !needsRemount) { - scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); - } - - if (sibling !== null) { - scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); - } - } - } - - var findHostInstancesForRefresh = function (root, families) { - { - var hostInstances = new Set(); - var types = new Set(families.map(function (family) { - return family.current; - })); - findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); - return hostInstances; - } - }; - - function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { - { - var child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - var didMatch = false; - - if (candidateType !== null) { - if (types.has(candidateType)) { - didMatch = true; - } - } - - if (didMatch) { - // We have a match. This only drills down to the closest host components. - // There's no need to search deeper because for the purpose of giving - // visual feedback, "flashing" outermost parent rectangles is sufficient. - findHostInstancesForFiberShallowly(fiber, hostInstances); - } else { - // If there's no match, maybe there will be one further down in the child tree. - if (child !== null) { - findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); - } - } - - if (sibling !== null) { - findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); - } - } - } - - function findHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); - - if (foundHostInstances) { - return; - } // If we didn't find any host children, fallback to closest host parent. - - - var node = fiber; - - while (true) { - switch (node.tag) { - case HostComponent: - hostInstances.add(node.stateNode); - return; - - case HostPortal: - hostInstances.add(node.stateNode.containerInfo); - return; - - case HostRoot: - hostInstances.add(node.stateNode.containerInfo); - return; - } - - if (node.return === null) { - throw new Error('Expected to reach root first.'); - } - - node = node.return; - } - } - } - - function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var node = fiber; - var foundHostInstances = false; - - while (true) { - if (node.tag === HostComponent) { - // We got a match. - foundHostInstances = true; - hostInstances.add(node.stateNode); // There may still be more, so keep searching. - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === fiber) { - return foundHostInstances; - } - - while (node.sibling === null) { - if (node.return === null || node.return === fiber) { - return foundHostInstances; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - return false; - } - - var hasBadMapPolyfill; - - { - hasBadMapPolyfill = false; - - try { - var nonExtensibleObject = Object.preventExtensions({}); - /* eslint-disable no-new */ - - new Map([[nonExtensibleObject, null]]); - new Set([nonExtensibleObject]); - /* eslint-enable no-new */ - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; - } - } - - var debugCounter = 1; - - function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.elementType = null; - this.type = null; - this.stateNode = null; // Fiber - - this.return = null; - this.child = null; - this.sibling = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; - this.dependencies = null; - this.mode = mode; // Effects - - this.flags = NoFlags; - this.nextEffect = null; - this.firstEffect = null; - this.lastEffect = null; - this.lanes = NoLanes; - this.childLanes = NoLanes; - this.alternate = null; - - { - // Note: The following is done to avoid a v8 performance cliff. - // - // Initializing the fields below to smis and later updating them with - // double values will cause Fibers to end up having separate shapes. - // This behavior/bug has something to do with Object.preventExtension(). - // Fortunately this only impacts DEV builds. - // Unfortunately it makes React unusably slow for some applications. - // To work around this, initialize the fields below with doubles. - // - // Learn more about this here: - // https://github.com/facebook/react/issues/14365 - // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; - } - - { - // This isn't directly used but is handy for debugging internals: - this._debugID = debugCounter++; - this._debugSource = null; - this._debugOwner = null; - this._debugNeedsRemount = false; - this._debugHookTypes = null; - - if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { - Object.preventExtensions(this); - } - } - } // This is a constructor function, rather than a POJO constructor, still - // please ensure we do the following: - // 1) Nobody should add any instance methods on this. Instance methods can be - // more difficult to predict when they get optimized and they are almost - // never inlined properly in static compilers. - // 2) Nobody should rely on `instanceof Fiber` for type testing. We should - // always know when it is a fiber. - // 3) We might want to experiment with using numeric keys since they are easier - // to optimize in a non-JIT environment. - // 4) We can easily go from a constructor to a createFiber object literal if that - // is faster. - // 5) It should be easy to port this to a C struct and keep a C implementation - // compatible. - - - var createFiber = function (tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); - }; - - function shouldConstruct$1(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - - function isSimpleFunctionComponent(type) { - return typeof type === 'function' && !shouldConstruct$1(type) && type.defaultProps === undefined; - } - function resolveLazyComponentTag(Component) { - if (typeof Component === 'function') { - return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - return ForwardRef; - } - - if ($$typeof === REACT_MEMO_TYPE) { - return MemoComponent; - } - } - - return IndeterminateComponent; - } // This is used to create an alternate fiber to do work on. - - function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); - workInProgress.elementType = current.elementType; - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; - - { - // DEV-only fields - workInProgress._debugID = current._debugID; - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; - workInProgress._debugHookTypes = current._debugHookTypes; - } - - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // We already have an alternate. - // Reset the effect tag. - - workInProgress.flags = NoFlags; // The effect list is no longer valid. - - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; - - { - // We intentionally reset, rather than copy, actualDuration & actualStartTime. - // This prevents time from endlessly accumulating in new commits. - // This has the downside of resetting values for different priority renders, - // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; - } - } - - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; // These will be overridden during the parent's reconciliation - - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - - { - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - - { - workInProgress._debugNeedsRemount = current._debugNeedsRemount; - - switch (workInProgress.tag) { - case IndeterminateComponent: - case FunctionComponent: - case SimpleMemoComponent: - workInProgress.type = resolveFunctionForHotReloading(current.type); - break; - - case ClassComponent: - workInProgress.type = resolveClassForHotReloading(current.type); - break; - - case ForwardRef: - workInProgress.type = resolveForwardRefForHotReloading(current.type); - break; - } - } - - return workInProgress; - } // Used to reuse a Fiber for a second pass. - - function resetWorkInProgress(workInProgress, renderLanes) { - // This resets the Fiber to what createFiber or createWorkInProgress would - // have set the values to before during the first pass. Ideally this wouldn't - // be necessary but unfortunately many code paths reads from the workInProgress - // when they should be reading from current and writing to workInProgress. - // We assume pendingProps, index, key, ref, return are still untouched to - // avoid doing another reconciliation. - // Reset the effect tag but keep any Placement tags, since that's something - // that child fiber is setting, not the reconciliation. - workInProgress.flags &= Placement; // The effect list is no longer valid. - - workInProgress.nextEffect = null; - workInProgress.firstEffect = null; - workInProgress.lastEffect = null; - var current = workInProgress.alternate; - - if (current === null) { - // Reset to createFiber's initial values. - workInProgress.childLanes = NoLanes; - workInProgress.lanes = renderLanes; - workInProgress.child = null; - workInProgress.memoizedProps = null; - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; - workInProgress.dependencies = null; - workInProgress.stateNode = null; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = 0; - workInProgress.treeBaseDuration = 0; - } - } else { - // Reset to the cloned values that createWorkInProgress would've. - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - } - - return workInProgress; - } - function createHostRootFiber(tag) { - var mode; - - if (tag === ConcurrentRoot) { - mode = ConcurrentMode | BlockingMode | StrictMode; - } else if (tag === BlockingRoot) { - mode = BlockingMode | StrictMode; - } else { - mode = NoMode; - } - - if ( isDevToolsPresent) { - // Always collect profile timings when DevTools are present. - // This enables DevTools to start capturing timing at any point– - // Without some nodes in the tree having empty base times. - mode |= ProfileMode; - } - - return createFiber(HostRoot, null, null, mode); - } - function createFiberFromTypeAndProps(type, // React$ElementType - key, pendingProps, owner, mode, lanes) { - var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. - - var resolvedType = type; - - if (typeof type === 'function') { - if (shouldConstruct$1(type)) { - fiberTag = ClassComponent; - - { - resolvedType = resolveClassForHotReloading(resolvedType); - } - } else { - { - resolvedType = resolveFunctionForHotReloading(resolvedType); - } - } - } else if (typeof type === 'string') { - fiberTag = HostComponent; - } else { - getTag: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment(pendingProps.children, mode, lanes, key); - - case REACT_DEBUG_TRACING_MODE_TYPE: - fiberTag = Mode; - mode |= DebugTracingMode; - break; - - case REACT_STRICT_MODE_TYPE: - fiberTag = Mode; - mode |= StrictMode; - break; - - case REACT_PROFILER_TYPE: - return createFiberFromProfiler(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_TYPE: - return createFiberFromSuspense(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_LIST_TYPE: - return createFiberFromSuspenseList(pendingProps, mode, lanes, key); - - case REACT_OFFSCREEN_TYPE: - return createFiberFromOffscreen(pendingProps, mode, lanes, key); - - case REACT_LEGACY_HIDDEN_TYPE: - return createFiberFromLegacyHidden(pendingProps, mode, lanes, key); - - case REACT_SCOPE_TYPE: - - // eslint-disable-next-line no-fallthrough - - default: - { - if (typeof type === 'object' && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break getTag; - - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break getTag; - - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - - { - resolvedType = resolveForwardRefForHotReloading(resolvedType); - } - - break getTag; - - case REACT_MEMO_TYPE: - fiberTag = MemoComponent; - break getTag; - - case REACT_LAZY_TYPE: - fiberTag = LazyComponent; - resolvedType = null; - break getTag; - - case REACT_BLOCK_TYPE: - fiberTag = Block; - break getTag; - } - } - - var info = ''; - - { - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; - } - - var ownerName = owner ? getComponentName(owner.type) : null; - - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } - } - - { - { - throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info ); - } - } - } - } - } - - var fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.elementType = type; - fiber.type = resolvedType; - fiber.lanes = lanes; - - { - fiber._debugOwner = owner; - } - - return fiber; - } - function createFiberFromElement(element, mode, lanes) { - var owner = null; - - { - owner = element._owner; - } - - var type = element.type; - var key = element.key; - var pendingProps = element.props; - var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); - - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; - } - - return fiber; - } - function createFiberFromFragment(elements, mode, lanes, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.lanes = lanes; - return fiber; - } - - function createFiberFromProfiler(pendingProps, mode, lanes, key) { - { - if (typeof pendingProps.id !== 'string') { - error('Profiler must specify an "id" as a prop'); - } - } - - var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag. - - fiber.elementType = REACT_PROFILER_TYPE; - fiber.type = REACT_PROFILER_TYPE; - fiber.lanes = lanes; - - { - fiber.stateNode = { - effectDuration: 0, - passiveEffectDuration: 0 - }; - } - - return fiber; - } - - function createFiberFromSuspense(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - fiber.type = REACT_SUSPENSE_TYPE; - fiber.elementType = REACT_SUSPENSE_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); - - { - // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - fiber.type = REACT_SUSPENSE_LIST_TYPE; - } - - fiber.elementType = REACT_SUSPENSE_LIST_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromOffscreen(pendingProps, mode, lanes, key) { - var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); // TODO: The OffscreenComponent fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - { - fiber.type = REACT_OFFSCREEN_TYPE; - } - - fiber.elementType = REACT_OFFSCREEN_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromLegacyHidden(pendingProps, mode, lanes, key) { - var fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode); // TODO: The LegacyHidden fiber shouldn't have a type. It has a tag. - // This needs to be fixed in getComponentName so that it relies on the tag - // instead. - - { - fiber.type = REACT_LEGACY_HIDDEN_TYPE; - } - - fiber.elementType = REACT_LEGACY_HIDDEN_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromText(content, mode, lanes) { - var fiber = createFiber(HostText, content, null, mode); - fiber.lanes = lanes; - return fiber; - } - function createFiberFromPortal(portal, mode, lanes) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.lanes = lanes; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - // Used by persistent updates - implementation: portal.implementation - }; - return fiber; - } // Used for stashing WIP properties to replay failed work in DEV. - - function FiberRootNode(containerInfo, tag, hydrate) { - this.tag = tag; - this.containerInfo = containerInfo; - this.pendingChildren = null; - this.current = null; - this.pingCache = null; - this.finishedWork = null; - this.timeoutHandle = noTimeout; - this.context = null; - this.pendingContext = null; - this.hydrate = hydrate; - this.callbackNode = null; - this.callbackPriority = NoLanePriority; - this.eventTimes = createLaneMap(NoLanes); - this.expirationTimes = createLaneMap(NoTimestamp); - this.pendingLanes = NoLanes; - this.suspendedLanes = NoLanes; - this.pingedLanes = NoLanes; - this.expiredLanes = NoLanes; - this.mutableReadLanes = NoLanes; - this.finishedLanes = NoLanes; - this.entangledLanes = NoLanes; - this.entanglements = createLaneMap(NoLanes); - - { - this.interactionThreadID = unstable_getThreadID(); - this.memoizedInteractions = new Set(); - this.pendingInteractionMap = new Map(); - } - - { - switch (tag) { - case BlockingRoot: - this._debugRootType = 'createBlockingRoot()'; - break; - - case ConcurrentRoot: - this._debugRootType = 'createRoot()'; - break; - - case LegacyRoot: - this._debugRootType = 'createLegacyRoot()'; - break; - } - } - } - - function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) { - var root = new FiberRootNode(containerInfo, tag, hydrate); - // stateNode is any. - - - var uninitializedFiber = createHostRootFiber(tag); - root.current = uninitializedFiber; - uninitializedFiber.stateNode = root; - initializeUpdateQueue(uninitializedFiber); - return root; - } - - var didWarnAboutNestedUpdates; - - { - didWarnAboutNestedUpdates = false; - } - - function getContextForSubtree(parentComponent) { - if (!parentComponent) { - return emptyContextObject; - } - - var fiber = get(parentComponent); - var parentContext = findCurrentUnmaskedContext(fiber); - - if (fiber.tag === ClassComponent) { - var Component = fiber.type; - - if (isContextProvider(Component)) { - return processChildContext(fiber, Component, parentContext); - } - } - - return parentContext; - } - - function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) { - return createFiberRoot(containerInfo, tag, hydrate); - } - function updateContainer(element, container, parentComponent, callback) { - { - onScheduleRoot(container, element); - } - - var current$1 = container.current; - var eventTime = requestEventTime(); - - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ('undefined' !== typeof jest) { - warnIfUnmockedScheduler(current$1); - warnIfNotScopedWithMatchingAct(current$1); - } - } - - var lane = requestUpdateLane(current$1); - - var context = getContextForSubtree(parentComponent); - - if (container.context === null) { - container.context = context; - } else { - container.pendingContext = context; - } - - { - if (isRendering && current !== null && !didWarnAboutNestedUpdates) { - didWarnAboutNestedUpdates = true; - - error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown'); - } - } - - var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property - // being called "element". - - update.payload = { - element: element - }; - callback = callback === undefined ? null : callback; - - if (callback !== null) { - { - if (typeof callback !== 'function') { - error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); - } - } - - update.callback = callback; - } - - enqueueUpdate(current$1, update); - scheduleUpdateOnFiber(current$1, lane, eventTime); - return lane; - } - function getPublicRootInstance(container) { - var containerFiber = container.current; - - if (!containerFiber.child) { - return null; - } - - switch (containerFiber.child.tag) { - case HostComponent: - return getPublicInstance(containerFiber.child.stateNode); - - default: - return containerFiber.child.stateNode; - } - } - - var shouldSuspendImpl = function (fiber) { - return false; - }; - - function shouldSuspend(fiber) { - return shouldSuspendImpl(fiber); - } - var overrideHookState = null; - var overrideHookStateDeletePath = null; - var overrideHookStateRenamePath = null; - var overrideProps = null; - var overridePropsDeletePath = null; - var overridePropsRenamePath = null; - var scheduleUpdate = null; - var setSuspenseHandler = null; - - { - var copyWithDeleteImpl = function (obj, path, index) { - var key = path[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); - - if (index + 1 === path.length) { - if (Array.isArray(updated)) { - updated.splice(key, 1); - } else { - delete updated[key]; - } - - return updated; - } // $FlowFixMe number or string is fine here - - - updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); - return updated; - }; - - var copyWithDelete = function (obj, path) { - return copyWithDeleteImpl(obj, path, 0); - }; - - var copyWithRenameImpl = function (obj, oldPath, newPath, index) { - var oldKey = oldPath[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); - - if (index + 1 === oldPath.length) { - var newKey = newPath[index]; // $FlowFixMe number or string is fine here - - updated[newKey] = updated[oldKey]; - - if (Array.isArray(updated)) { - updated.splice(oldKey, 1); - } else { - delete updated[oldKey]; - } - } else { - // $FlowFixMe number or string is fine here - updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here - obj[oldKey], oldPath, newPath, index + 1); - } - - return updated; - }; - - var copyWithRename = function (obj, oldPath, newPath) { - if (oldPath.length !== newPath.length) { - warn('copyWithRename() expects paths of the same length'); - - return; - } else { - for (var i = 0; i < newPath.length - 1; i++) { - if (oldPath[i] !== newPath[i]) { - warn('copyWithRename() expects paths to be the same except for the deepest key'); - - return; - } - } - } - - return copyWithRenameImpl(obj, oldPath, newPath, 0); - }; - - var copyWithSetImpl = function (obj, path, index, value) { - if (index >= path.length) { - return value; - } - - var key = path[index]; - var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here - - updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); - return updated; - }; - - var copyWithSet = function (obj, path, value) { - return copyWithSetImpl(obj, path, 0, value); - }; - - var findHook = function (fiber, id) { - // For now, the "id" of stateful hooks is just the stateful hook index. - // This may change in the future with e.g. nested hooks. - var currentHook = fiber.memoizedState; - - while (currentHook !== null && id > 0) { - currentHook = currentHook.next; - id--; - } - - return currentHook; - }; // Support DevTools editable values for useState and useReducer. - - - overrideHookState = function (fiber, id, path, value) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithSet(hook.memoizedState, path, value); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; - - overrideHookStateDeletePath = function (fiber, id, path) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithDelete(hook.memoizedState, path); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; - - overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithRename(hook.memoizedState, oldPath, newPath); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = _assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - } - }; // Support DevTools props for function components, forwardRef, memo, host components, etc. - - - overrideProps = function (fiber, path, value) { - fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - overridePropsDeletePath = function (fiber, path) { - fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - overridePropsRenamePath = function (fiber, oldPath, newPath) { - fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - scheduleUpdate = function (fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); - }; - - setSuspenseHandler = function (newShouldSuspendImpl) { - shouldSuspendImpl = newShouldSuspendImpl; - }; - } - - function findHostInstanceByFiber(fiber) { - var hostFiber = findCurrentHostFiber(fiber); - - if (hostFiber === null) { - return null; - } - - return hostFiber.stateNode; - } - - function emptyFindFiberByHostInstance(instance) { - return null; - } - - function getCurrentFiberForDevTools() { - return current; - } - - function injectIntoDevTools(devToolsConfig) { - var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; - return injectInternals({ - bundleType: devToolsConfig.bundleType, - version: devToolsConfig.version, - rendererPackageName: devToolsConfig.rendererPackageName, - rendererConfig: devToolsConfig.rendererConfig, - overrideHookState: overrideHookState, - overrideHookStateDeletePath: overrideHookStateDeletePath, - overrideHookStateRenamePath: overrideHookStateRenamePath, - overrideProps: overrideProps, - overridePropsDeletePath: overridePropsDeletePath, - overridePropsRenamePath: overridePropsRenamePath, - setSuspenseHandler: setSuspenseHandler, - scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, - findHostInstanceByFiber: findHostInstanceByFiber, - findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, - // React Refresh - findHostInstancesForRefresh: findHostInstancesForRefresh , - scheduleRefresh: scheduleRefresh , - scheduleRoot: scheduleRoot , - setRefreshHandler: setRefreshHandler , - // Enables DevTools to append owner stacks to error messages in DEV mode. - getCurrentFiber: getCurrentFiberForDevTools - }); - } - - var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing; - var defaultTestOptions = { - createNodeMock: function () { - return null; - } - }; - - function toJSON(inst) { - if (inst.isHidden) { - // Omit timed out children from output entirely. This seems like the least - // surprising behavior. We could perhaps add a separate API that includes - // them, if it turns out people need it. - return null; - } - - switch (inst.tag) { - case 'TEXT': - return inst.text; - - case 'INSTANCE': - { - /* eslint-disable no-unused-vars */ - // We don't include the `children` prop in JSON. - // Instead, we will include the actual rendered children. - var _inst$props = inst.props, - children = _inst$props.children, - props = _objectWithoutPropertiesLoose(_inst$props, ["children"]); - /* eslint-enable */ - - - var renderedChildren = null; - - if (inst.children && inst.children.length) { - for (var i = 0; i < inst.children.length; i++) { - var renderedChild = toJSON(inst.children[i]); - - if (renderedChild !== null) { - if (renderedChildren === null) { - renderedChildren = [renderedChild]; - } else { - renderedChildren.push(renderedChild); - } - } - } - } - - var json = { - type: inst.type, - props: props, - children: renderedChildren - }; - Object.defineProperty(json, '$$typeof', { - value: Symbol.for('react.test.json') - }); - return json; - } - - default: - throw new Error("Unexpected node type in toJSON: " + inst.tag); - } - } - - function childrenToTree(node) { - if (!node) { - return null; - } - - var children = nodeAndSiblingsArray(node); - - if (children.length === 0) { - return null; - } else if (children.length === 1) { - return toTree(children[0]); - } - - return flatten(children.map(toTree)); - } - - function nodeAndSiblingsArray(nodeWithSibling) { - var array = []; - var node = nodeWithSibling; - - while (node != null) { - array.push(node); - node = node.sibling; - } - - return array; - } - - function flatten(arr) { - var result = []; - var stack = [{ - i: 0, - array: arr - }]; - - while (stack.length) { - var n = stack.pop(); - - while (n.i < n.array.length) { - var el = n.array[n.i]; - n.i += 1; - - if (Array.isArray(el)) { - stack.push(n); - stack.push({ - i: 0, - array: el - }); - break; - } - - result.push(el); - } - } - - return result; - } - - function toTree(node) { - if (node == null) { - return null; - } - - switch (node.tag) { - case HostRoot: - return childrenToTree(node.child); - - case HostPortal: - return childrenToTree(node.child); - - case ClassComponent: - return { - nodeType: 'component', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: node.stateNode, - rendered: childrenToTree(node.child) - }; - - case FunctionComponent: - case SimpleMemoComponent: - return { - nodeType: 'component', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - rendered: childrenToTree(node.child) - }; - - case Block: - return { - nodeType: 'block', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - rendered: childrenToTree(node.child) - }; - - case HostComponent: - { - return { - nodeType: 'host', - type: node.type, - props: _assign({}, node.memoizedProps), - instance: null, - // TODO: use createNodeMock here somehow? - rendered: flatten(nodeAndSiblingsArray(node.child).map(toTree)) - }; - } - - case HostText: - return node.stateNode.text; - - case Fragment: - case ContextProvider: - case ContextConsumer: - case Mode: - case Profiler: - case ForwardRef: - case MemoComponent: - case IncompleteClassComponent: - case ScopeComponent: - return childrenToTree(node.child); - - default: - { - { - throw Error( "toTree() does not yet know how to handle nodes with tag=" + node.tag ); - } - } - - } - } - - var validWrapperTypes = new Set([FunctionComponent, ClassComponent, HostComponent, ForwardRef, MemoComponent, SimpleMemoComponent, Block, // Normally skipped, but used when there's more than one root child. - HostRoot]); - - function getChildren(parent) { - var children = []; - var startingNode = parent; - var node = startingNode; - - if (node.child === null) { - return children; - } - - node.child.return = node; - node = node.child; - - outer: while (true) { - var descend = false; - - if (validWrapperTypes.has(node.tag)) { - children.push(wrapFiber(node)); - } else if (node.tag === HostText) { - children.push('' + node.memoizedProps); - } else { - descend = true; - } - - if (descend && node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - while (node.sibling === null) { - if (node.return === startingNode) { - break outer; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - - return children; - } - - var ReactTestInstance = /*#__PURE__*/function () { - var _proto = ReactTestInstance.prototype; - - _proto._currentFiber = function _currentFiber() { - // Throws if this component has been unmounted. - var fiber = findCurrentFiberUsingSlowPath(this._fiber); - - if (!(fiber !== null)) { - { - throw Error( "Can't read from currently-mounting component. This error is likely caused by a bug in React. Please file an issue." ); - } - } - - return fiber; - }; - - function ReactTestInstance(fiber) { - if (!validWrapperTypes.has(fiber.tag)) { - { - throw Error( "Unexpected object passed to ReactTestInstance constructor (tag: " + fiber.tag + "). This is probably a bug in React." ); - } - } - - this._fiber = fiber; - } - - // Custom search functions - _proto.find = function find(predicate) { - return expectOne(this.findAll(predicate, { - deep: false - }), "matching custom predicate: " + predicate.toString()); - }; - - _proto.findByType = function findByType(type) { - return expectOne(this.findAllByType(type, { - deep: false - }), "with node type: \"" + (getComponentName(type) || 'Unknown') + "\""); - }; - - _proto.findByProps = function findByProps(props) { - return expectOne(this.findAllByProps(props, { - deep: false - }), "with props: " + JSON.stringify(props)); - }; - - _proto.findAll = function findAll(predicate) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, predicate, options); - }; - - _proto.findAllByType = function findAllByType(type) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, function (node) { - return node.type === type; - }, options); - }; - - _proto.findAllByProps = function findAllByProps(props) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - return _findAll(this, function (node) { - return node.props && propsMatch(node.props, props); - }, options); - }; - - _createClass(ReactTestInstance, [{ - key: "instance", - get: function () { - if (this._fiber.tag === HostComponent) { - return getPublicInstance(this._fiber.stateNode); - } else { - return this._fiber.stateNode; - } - } - }, { - key: "type", - get: function () { - return this._fiber.type; - } - }, { - key: "props", - get: function () { - return this._currentFiber().memoizedProps; - } - }, { - key: "parent", - get: function () { - var parent = this._fiber.return; - - while (parent !== null) { - if (validWrapperTypes.has(parent.tag)) { - if (parent.tag === HostRoot) { - // Special case: we only "materialize" instances for roots - // if they have more than a single child. So we'll check that now. - if (getChildren(parent).length < 2) { - return null; - } - } - - return wrapFiber(parent); - } - - parent = parent.return; - } - - return null; - } - }, { - key: "children", - get: function () { - return getChildren(this._currentFiber()); - } - }]); - - return ReactTestInstance; - }(); - - function _findAll(root, predicate, options) { - var deep = options ? options.deep : true; - var results = []; - - if (predicate(root)) { - results.push(root); - - if (!deep) { - return results; - } - } - - root.children.forEach(function (child) { - if (typeof child === 'string') { - return; - } - - results.push.apply(results, _findAll(child, predicate, options)); - }); - return results; - } - - function expectOne(all, message) { - if (all.length === 1) { - return all[0]; - } - - var prefix = all.length === 0 ? 'No instances found ' : "Expected 1 but found " + all.length + " instances "; - throw new Error(prefix + message); - } - - function propsMatch(props, filter) { - for (var key in filter) { - if (props[key] !== filter[key]) { - return false; - } - } - - return true; - } - - function create(element, options) { - var createNodeMock = defaultTestOptions.createNodeMock; - var isConcurrent = false; - - if (typeof options === 'object' && options !== null) { - if (typeof options.createNodeMock === 'function') { - createNodeMock = options.createNodeMock; - } - - if (options.unstable_isConcurrent === true) { - isConcurrent = true; - } - } - - var container = { - children: [], - createNodeMock: createNodeMock, - tag: 'CONTAINER' - }; - var root = createContainer(container, isConcurrent ? ConcurrentRoot : LegacyRoot, false); - - if (!(root != null)) { - { - throw Error( "something went wrong" ); - } - } - - updateContainer(element, root, null, null); - var entry = { - _Scheduler: Scheduler, - root: undefined, - // makes flow happy - // we define a 'getter' for 'root' below using 'Object.defineProperty' - toJSON: function () { - if (root == null || root.current == null || container == null) { - return null; - } - - if (container.children.length === 0) { - return null; - } - - if (container.children.length === 1) { - return toJSON(container.children[0]); - } - - if (container.children.length === 2 && container.children[0].isHidden === true && container.children[1].isHidden === false) { - // Omit timed out children from output entirely, including the fact that we - // temporarily wrap fallback and timed out children in an array. - return toJSON(container.children[1]); - } - - var renderedChildren = null; - - if (container.children && container.children.length) { - for (var i = 0; i < container.children.length; i++) { - var renderedChild = toJSON(container.children[i]); - - if (renderedChild !== null) { - if (renderedChildren === null) { - renderedChildren = [renderedChild]; - } else { - renderedChildren.push(renderedChild); - } - } - } - } - - return renderedChildren; - }, - toTree: function () { - if (root == null || root.current == null) { - return null; - } - - return toTree(root.current); - }, - update: function (newElement) { - if (root == null || root.current == null) { - return; - } - - updateContainer(newElement, root, null, null); - }, - unmount: function () { - if (root == null || root.current == null) { - return; - } - - updateContainer(null, root, null, null); - container = null; - root = null; - }, - getInstance: function () { - if (root == null || root.current == null) { - return null; - } - - return getPublicRootInstance(root); - }, - unstable_flushSync: function (fn) { - return flushSync(fn); - } - }; - Object.defineProperty(entry, 'root', { - configurable: true, - enumerable: true, - get: function () { - if (root === null) { - throw new Error("Can't access .root on unmounted test renderer"); - } - - var children = getChildren(root.current); - - if (children.length === 0) { - throw new Error("Can't access .root on unmounted test renderer"); - } else if (children.length === 1) { - // Normally, we skip the root and just give you the child. - return children[0]; - } else { - // However, we give you the root if there's more than one root child. - // We could make this the behavior for all cases but it would be a breaking change. - return wrapFiber(root.current); - } - } - }); - return entry; - } - - var fiberToWrapper = new WeakMap(); - - function wrapFiber(fiber) { - var wrapper = fiberToWrapper.get(fiber); - - if (wrapper === undefined && fiber.alternate !== null) { - wrapper = fiberToWrapper.get(fiber.alternate); - } - - if (wrapper === undefined) { - wrapper = new ReactTestInstance(fiber); - fiberToWrapper.set(fiber, wrapper); - } - - return wrapper; - } // Enable ReactTestRenderer to be used to test DevTools integration. - - - injectIntoDevTools({ - findFiberByHostInstance: function () { - throw new Error('TestRenderer does not support findFiberByHostInstance()'); - }, - bundleType: 1 , - version: ReactVersion, - rendererPackageName: 'react-test-renderer' - }); - var actingUpdatesScopeDepth$1 = 0; // This version of `act` is only used by our tests. Unlike the public version - // of `act`, it's designed to work identically in both production and - // development. It may have slightly different behavior from the public - // version, too, since our constraints in our test suite are not the same as - // those of developers using React — we're testing React itself, as opposed to - // building an app with React. - // TODO: Migrate our tests to use ReactNoop. Although we would need to figure - // out a solution for Relay, which has some Concurrent Mode tests. - - function unstable_concurrentAct(scope) { - if (Scheduler.unstable_flushAllWithoutAsserting === undefined) { - throw Error('This version of `act` requires a special mock build of Scheduler.'); - } - - if (setTimeout._isMockFunction !== true) { - throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).'); - } - - var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1; - var previousIsSomeRendererActing = IsSomeRendererActing$1.current; - var previousIsThisRendererActing = IsThisRendererActing.current; - IsSomeRendererActing$1.current = true; - IsThisRendererActing.current = true; - actingUpdatesScopeDepth$1++; - - var unwind = function () { - actingUpdatesScopeDepth$1--; - IsSomeRendererActing$1.current = previousIsSomeRendererActing; - IsThisRendererActing.current = previousIsThisRendererActing; - - { - if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) { - // if it's _less than_ previousActingUpdatesScopeDepth, then we can - // assume the 'other' one has warned - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - } - }; // TODO: This would be way simpler if 1) we required a promise to be - // returned and 2) we could use async/await. Since it's only our used in - // our test suite, we should be able to. - - - try { - var thenable = batchedUpdates(scope); - - if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') { - return { - then: function (resolve, reject) { - thenable.then(function () { - flushActWork$1(function () { - unwind(); - resolve(); - }, function (error) { - unwind(); - reject(error); - }); - }, function (error) { - unwind(); - reject(error); - }); - } - }; - } else { - try { - // TODO: Let's not support non-async scopes at all in our tests. Need to - // migrate existing tests. - var didFlushWork; - - do { - didFlushWork = Scheduler.unstable_flushAllWithoutAsserting(); - } while (didFlushWork); - } finally { - unwind(); - } - } - } catch (error) { - unwind(); - throw error; - } - } - - function flushActWork$1(resolve, reject) { - // Flush suspended fallbacks - // $FlowFixMe: Flow doesn't know about global Jest object - jest.runOnlyPendingTimers(); - enqueueTask(function () { - try { - var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting(); - - if (didFlushWork) { - flushActWork$1(resolve, reject); - } else { - resolve(); - } - } catch (error) { - reject(error); - } - }); - } - - exports._Scheduler = Scheduler; - exports.act = act; - exports.create = create; - exports.unstable_batchedUpdates = batchedUpdates; - exports.unstable_concurrentAct = unstable_concurrentAct; - -}))); diff --git a/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js b/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js deleted file mode 100644 index b85dfffb71b1e..0000000000000 --- a/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js +++ /dev/null @@ -1,162 +0,0 @@ -/** @license React v17.0.2 - * react-test-renderer.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. - */ -(function(){'use strict';(function(P,ta){"object"===typeof exports&&"undefined"!==typeof module?ta(exports,require("react"),require("scheduler/unstable_mock"),require("scheduler")):"function"===typeof define&&define.amd?define(["exports","react","scheduler/unstable_mock","scheduler"],ta):(P=P||self,ta(P.ReactTestRenderer={},P.React,P.SchedulerMock,P.Scheduler))})(this,function(P,ta,Xa,I){function m(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;ch||e[g]!==f[h])return"\n"+e[g].replace(" at new "," at ");while(1<=g&&0<=h)}break}}}finally{rc=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:"")?ab(a):""}function ia(a){return{current:a}}function n(a,b){0>Ga||(a.current=sc[Ga],sc[Ga]=null,Ga--)} -function v(a,b,c){Ga++;sc[Ga]=a.current;a.current=b}function Ha(a,b){var c=a.type.contextTypes;if(!c)return ja;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function M(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Ed(a,b,c){if(x.current!==ja)throw Error(m(168)); -v(x,b);v(A,c)}function Fd(a,b,c){var d=a.stateNode;a=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(m(108,ua(b)||"Unknown",e));return ka({},c,d)}function Db(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||ja;va=x.current;v(x,a);v(A,A.current);return!0}function Gd(a,b,c){var d=a.stateNode;if(!d)throw Error(m(169));c?(a=Fd(a,b,va),d.__reactInternalMemoizedMergedChildContext=a,n(A),n(x),v(x,a)):n(A); -v(A,c)}function Ia(a){if(0!==(1&a))return r=15,1;if(0!==(2&a))return r=14,2;if(0!==(4&a))return r=13,4;var b=24&a;if(0!==b)return r=12,b;if(0!==(a&32))return r=11,32;b=192&a;if(0!==b)return r=10,b;if(0!==(a&256))return r=9,256;b=3584&a;if(0!==b)return r=8,b;if(0!==(a&4096))return r=7,4096;b=4186112&a;if(0!==b)return r=6,b;b=62914560&a;if(0!==b)return r=5,b;if(a&67108864)return r=4,67108864;if(0!==(a&134217728))return r=3,134217728;b=805306368&a;if(0!==b)return r=2,b;if(0!==(1073741824&a))return r= -1,1073741824;r=8;return a}function $e(a){switch(a){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function af(a){switch(a){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(m(358,a));}}function bb(a,b){var c=a.pendingLanes;if(0===c)return r=0;var d=0,e=0,f=a.expiredLanes,g=a.suspendedLanes,h=a.pingedLanes;if(0!== -f)d=f,e=r=15;else if(f=c&134217727,0!==f){var l=f&~g;0!==l?(d=Ia(l),e=r):(h&=f,0!==h&&(d=Ia(h),e=r))}else f=c&~g,0!==f?(d=Ia(f),e=r):0!==h&&(d=Ia(h),e=r);if(0===d)return 0;d=31-la(d);d=c&((0>d?0:1<c;c++)b.push(a);return b}function Fb(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-la(b);a[b]=c}function bf(a){return 0===a?32:31-(cf(a)/df|0)|0}function Ka(){switch(ef()){case Gb:return 99; -case Id:return 98;case Jd:return 97;case Kd:return 96;case Ld:return 95;default:throw Error(m(332));}}function Md(a){switch(a){case 99:return Gb;case 98:return Id;case 97:return Jd;case 96:return Kd;case 95:return Ld;default:throw Error(m(332));}}function La(a,b){a=Md(a);return ff(a,b)}function cb(a,b,c){a=Md(a);return uc(a,b,c)}function Ma(){if(null!==Hb){var a=Hb;Hb=null;vc(a)}Nd()}function Nd(){if(!wc&&null!==ba){wc=!0;var a=0;try{var b=ba;La(99,function(){for(;au?(z=t,t=null):z=t.sibling;var F=p(e,t,h[u],l);if(null===F){null===t&&(t=z);break}a&&t&&null===F.alternate&&b(e,t);g=f(F,g,u); -null===m?k=F:m.sibling=F;m=F;t=z}if(u===h.length)return c(e,t),k;if(null===t){for(;uF?(z=u,u=null):z=u.sibling;var r=p(e,u,n.value,l);if(null===r){null===u&&(u=z);break}a&&u&&null===r.alternate&&b(e,u);g=f(r,g,F);null===t?k=r:t.sibling=r;t=r;u=z}if(n.done)return c(e,u),k;if(null===u){for(;!n.done;F++,n=h.next())n=J(e,n.value,l),null!==n&&(g=f(n,g,F),null===t?k=n:t.sibling=n,t=n);return k}for(u=d(e,u);!n.done;F++,n=h.next())n=q(u,e,F,n.value,l),null!==n&&(a&&null!==n.alternate&&u.delete(null===n.key?F:n.key), -g=f(n,g,F),null===t?k=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return k}return function(a,d,f,h){var l="object"===typeof f&&null!==f&&f.type===ha&&null===f.key;l&&(f=f.props.children);var k="object"===typeof f&&null!==f;if(k)switch(f.$$typeof){case fb:a:{k=f.key;for(l=d;null!==l;){if(l.key===k){switch(l.tag){case 7:if(f.type===ha){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}break;default:if(l.elementType===f.type){c(a,l.sibling);d=e(l,f.props);d.ref=eb(a,l,f); -d.return=a;a=d;break a}}c(a,l);break}else b(a,l);l=l.sibling}f.type===ha?(d=Pa(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Pb(f.type,f.key,f.props,null,a.mode,h),h.ref=eb(a,d,f),h.return=a,a=h)}return g(a);case Fa:a:{for(l=f.key;null!==d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Cc(f,a.mode,h);d.return=a;a=d}return g(a)}if("string"=== -typeof f||"number"===typeof f)return f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Bc(f,a.mode,h),d.return=a,a=d),g(a);if(Qb(f))return r(a,d,f,h);if(Ya(f))return v(a,d,f,h);k&&Ob(a,f);if("undefined"===typeof f&&!l)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(m(152,ua(a.type)||"Component"));}return c(a,d)}}function wa(a){if(a===gb)throw Error(m(174));return a}function Dc(a,b){v(hb,b);v(ib,a);v(X,gb);a=Xd;n(X);v(X,a)}function Qa(a){n(X);n(ib);n(hb)} -function Yd(a){wa(hb.current);var b=wa(X.current),c=Xd;b!==c&&(v(ib,a),v(X,c))}function Ec(a){ib.current===a&&(n(X),n(ib))}function Rb(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(null===c.dehydrated||mf()||nf()))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return= -b.return;b=b.sibling}return null}function Fc(){for(var a=0;af))throw Error(m(301));f+=1;G=K=null;b.updateQueue=null; -lb.current=qf;a=c(d,e)}while(mb)}lb.current=Sb;b=null!==K&&null!==K.next;kb=0;G=K=y=null;Tb=!1;if(b)throw Error(m(300));return a}function xa(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===G?y.memoizedState=G=a:G=G.next=a;return G}function ya(){if(null===K){var a=y.alternate;a=null!==a?a.memoizedState:null}else a=K.next;var b=null===G?y.memoizedState:G.next;if(null!==b)G=b,K=a;else{if(null===a)throw Error(m(310));K=a;a={memoizedState:K.memoizedState,baseState:K.baseState, -baseQueue:K.baseQueue,queue:K.queue,next:null};null===G?y.memoizedState=G=a:G=G.next=a}return G}function Y(a,b){return"function"===typeof b?b(a):b}function nb(a,b,c){b=ya();c=b.queue;if(null===c)throw Error(m(311));c.lastRenderedReducer=a;var d=K,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,l=e;do{var k=l.lane;if((kb&k)===k)null!==h&&(h=h.next={lane:0,action:l.action,eagerReducer:l.eagerReducer, -eagerState:l.eagerState,next:null}),d=l.eagerReducer===a?l.eagerState:a(d,l.action);else{var n={lane:k,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;y.lanes|=k;pa|=k}l=l.next}while(null!==l&&l!==e);null===h?f=d:h.next=g;Q(d,b.memoizedState)||(U=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]}function ob(a,b,c){b=ya();c=b.queue;if(null===c)throw Error(m(311));c.lastRenderedReducer= -a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);Q(f,b.memoizedState)||(U=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]}function Zd(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionSecondary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(kb&a)===a)b._workInProgressVersionSecondary=d,jb.push(b);if(a)return c(b._source);jb.push(b);throw Error(m(350)); -}function $d(a,b,c,d){var e=B;if(null===e)throw Error(m(349));var f=b._getVersion,g=f(b._source),h=lb.current,l=h.useState(function(){return Zd(e,b,c)}),k=l[1],n=l[0];l=G;var q=a.memoizedState,p=q.refs,r=p.getSnapshot,v=q.source;q=q.subscribe;var w=y;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=k;var a=f(b._source);if(!Q(g,a)){a=c(b._source);Q(n,a)||(k(a),a=za(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d= -e.entanglements,h=a;0c?98:c,function(){a(!0)});La(97rb&&(b.flags|=64,e=!0,qb(d,!1),b.lanes=33554432)}else{if(!e)if(a=Rb(f),null!==a){if(b.flags|=64,e=!0,a=a.updateQueue,null!==a&&(b.updateQueue=a,b.flags|=4),qb(d,!0),null===d.tail&&"hidden"===d.tailMode&&!f.alternate)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*C()-d.renderingStartTime>rb&&1073741824!== -c&&(b.flags|=64,e=!0,qb(d,!1),b.lanes=33554432);d.isBackwards?(f.sibling=b.child,b.child=f):(a=d.last,null!==a?a.sibling=f:b.child=f,d.last=f)}return null!==d.tail?(a=d.tail,d.rendering=a,d.tail=a.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=C(),a.sibling=null,b=w.current,v(w,e?b&1|2:b&1),a):null;case 23:case 24:return da=Aa.current,n(Aa),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&"unstable-defer-without-hiding"!==d.mode&&(b.flags|=4),null}throw Error(m(156,b.tag));}function yf(a, -b){switch(a.tag){case 1:return M(a.type)&&(n(A),n(x)),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 3:Qa();n(A);n(x);Fc();b=a.flags;if(0!==(b&64))throw Error(m(285));a.flags=b&-4097|64;return a;case 5:return Ec(a),null;case 13:return n(w),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return n(w),null;case 4:return Qa(),null;case 10:return yc(a),null;case 23:case 24:return da=Aa.current,n(Aa),null;default:return null}}function Tc(a,b){try{var c="",d=b;do c+=jf(d),d=d.return;while(d);var e= -c}catch(f){e="\nError generating stack: "+f.message+"\n"+f.stack}return{value:a,source:b,stack:e}}function Uc(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}function ve(a,b,c){c=ma(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){$b||($b=!0,Vc=d);Uc(a,b)};return c}function we(a,b,c){c=ma(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if("function"===typeof d){var e=b.value;c.payload=function(){Uc(a,b);return d(e)}}var f=a.stateNode;null!== -f&&"function"===typeof f.componentDidCatch&&(c.callback=function(){"function"!==typeof d&&(null===aa?aa=new Set([this]):aa.add(this),Uc(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:""})});return c}function xe(a){var b=a.ref;if(null!==b)if("function"===typeof b)try{b(null)}catch(c){ra(a,c)}else b.current=null}function zf(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b= -a.getSnapshotBeforeUpdate(b.elementType===b.type?c:T(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&b.stateNode.containerInfo.children.splice(0);return;case 5:case 6:case 4:case 17:return}throw Error(m(163));}function Af(a,b,c,d){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do 3===(a.tag&3)&&(d=a.create,a.destroy=d()),a=a.next;while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a= -b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(ye(c,a),Bf(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:T(c.type,b.memoizedProps),a.componentDidUpdate(d,b.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Rd(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=Bb(c.child.stateNode);break;case 1:a=c.child.stateNode}Rd(c, -b,a)}return;case 5:return;case 6:return;case 4:return;case 12:return;case 13:return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(m(163));}function ze(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;b?d.isHidden=!0:c.stateNode.isHidden=!1}else if(6===c.tag)c.stateNode.isHidden=b?!0:!1;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===a)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return; -c=c.return}c.sibling.return=c.return;c=c.sibling}}function Ae(a,b,c){if(Ba&&"function"===typeof Ba.onCommitFiberUnmount)try{Ba.onCommitFiberUnmount(Wc,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))ye(b,c);else{d=b;try{e()}catch(f){ra(d,f)}}c=c.next}while(c!==a)}break;case 1:xe(b);a=b.stateNode;if("function"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps, -a.state=b.memoizedState,a.componentWillUnmount()}catch(f){ra(b,f)}break;case 5:xe(b);break;case 4:Be(a,b)}}function Ce(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function De(a){return 5===a.tag||3===a.tag||4===a.tag}function Ee(a){a:{for(var b=a.return;null!==b;){if(De(b))break a;b=b.return}throw Error(m(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d= -!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(m(161));}c.flags&16&&(c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||De(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===c.child||4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?Xc(a,c,b):Yc(a,c,b)}function Xc(a,b,c){var d=a.tag, -e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?Cf(c,a,b):Df(c,a);else if(4!==d&&(a=a.child,null!==a))for(Xc(a,b,c),a=a.sibling;null!==a;)Xc(a,b,c),a=a.sibling}function Yc(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?Cd(c,a,b):Bd(c,a);else if(4!==d&&(a=a.child,null!==a))for(Yc(a,b,c),a=a.sibling;null!==a;)Yc(a,b,c),a=a.sibling}function Be(a,b,c){c=b;for(var d=!1,e,f;;){if(!d){e=c.return;a:for(;;){if(null===e)throw Error(m(160));f=e.stateNode;switch(e.tag){case 5:e= -f;f=!1;break a;case 3:e=f.containerInfo;f=!0;break a;case 4:e=f.containerInfo;f=!0;break a}e=e.return}d=!0}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,l=h;;)if(Ae(g,l),null!==l.child&&4!==l.tag)l.child.return=l,l=l.child;else{if(l===h)break a;for(;null===l.sibling;){if(null===l.return||l.return===h)break a;l=l.return}l.sibling.return=l.return;l=l.sibling}f?Ef(e,c.stateNode):Dd(e,c.stateNode)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(Ae(a, -c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}}function Zc(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var c=a.destroy;a.destroy=void 0;void 0!==c&&c()}a=a.next}while(a!==b)}return;case 1:return;case 5:a=b.stateNode;if(null!=a){c=b.memoizedProps; -var d=b.type,e=b.updateQueue;b.updateQueue=null;null!==e&&(a.type=d,a.props=c)}return;case 6:if(null===b.stateNode)throw Error(m(162));b.stateNode.text=b.memoizedProps;return;case 3:return;case 12:return;case 13:null!==b.memoizedState&&($c=C(),ze(b.child,!0));Fe(b);return;case 19:Fe(b);return;case 17:return;case 23:case 24:ze(b,null!==b.memoizedState);return}throw Error(m(163));}function Fe(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Ff);b.forEach(function(b){var d= -Gf.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}function Hf(a,b){return null!==a&&(a=a.memoizedState,null===a||null!==a.dehydrated)?(b=b.memoizedState,null!==b&&null===b.dehydrated):!1}function Ge(a){if(null===ac)try{var b=("require"+Math.random()).slice(0,7);ac=(module&&module[b]).call(module,"timers").setImmediate}catch(c){ac=function(a){var b=new MessageChannel;b.port1.onmessage=a;b.port2.postMessage(void 0)}}return ac(a)}function Z(){return 0!==(q&48)?C():-1!==bc?bc:bc=C()}function za(a){a= -a.mode;if(0===(a&2))return 1;if(0===(a&4))return 99===Ka()?1:2;0===ea&&(ea=Ta);if(0!==If.transition){0!==cc&&(cc=null!==ad?ad.pendingLanes:0);a=ea;var b=4186112&~cc;b&=-b;0===b&&(a=4186112&~a,b=a&-a,0===b&&(b=8192));return b}a=Ka();0!==(q&4)&&98===a?a=Eb(12,ea):(a=$e(a),a=Eb(a,ea));return a}function pb(a,b,c){if(50e&&(e=g);c&=~f}c=e;c=C()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>c?4320:1960*Kf(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.")}5!==H&&(H=2);l=Tc(l,h);p=g;do{switch(p.tag){case 3:f=l;p.flags|=4096;b&=-b;p.lanes|=b;var C=ve(p,f,b);Qd(p,C);break a;case 1:f=l;var E=p.type,B=p.stateNode;if(0===(p.flags&64)&&("function"===typeof E.getDerivedStateFromError||null!==B&&"function"===typeof B.componentDidCatch&& -(null===aa||!aa.has(B)))){p.flags|=4096;b&=-b;p.lanes|=b;var I=we(p,f,b);Qd(p,I);break a}}p=p.return}while(null!==p)}Le(c)}catch(lf){b=lf;D===c&&null!==c&&(D=c=c.return);continue}break}while(1)}function Ie(){var a=ec.current;ec.current=Sb;return null===a?Sb:a}function tb(a,b){var c=q;q|=16;var d=Ie();B===a&&L===b||Va(a,b);do try{Of();break}catch(e){Je(a,e)}while(1);xc();q=c;ec.current=d;if(null!==D)throw Error(m(261));B=null;L=0;return H}function Of(){for(;null!==D;)Me(D)}function Jf(){for(;null!== -D&&!Pf();)Me(D)}function Me(a){var b=Qf(a.alternate,a,da);a.memoizedProps=a.pendingProps;null===b?Le(a):D=b;gd.current=null}function Le(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=uf(c,b,da);if(null!==c){D=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(da&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!== -b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1C()-$c?Va(a,0):ed|=c);V(a,b)}function Gf(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===Ka()?1:2:(0===ea&&(ea=Ta),b=Ja(62914560&~ea),0===b&&(b=4194304)));c=Z();a=dc(a,b);null!==a&&(Fb(a,b,c),V(a,c))}function jd(){if(void 0!== -kd)return kd();for(var a=!1;Ca();)a=!0;return a}function Oe(a){try{jd(),Ge(function(){jd()?Oe(a):a()})}catch(b){a(b)}}function Vf(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.flags=0;this.lastEffect=this.firstEffect=this.nextEffect=null;this.childLanes=this.lanes=0;this.alternate=null}function Nc(a){a= -a.prototype;return!(!a||!a.isReactComponent)}function Wf(a){if("function"===typeof a)return Nc(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===yb)return 11;if(a===zb)return 14}return 2}function qa(a,b){var c=a.alternate;null===c?(c=W(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.nextEffect=null,c.firstEffect=null,c.lastEffect=null);c.childLanes=a.childLanes;c.lanes=a.lanes;c.child= -a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}function Pb(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)Nc(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ha:return Pa(c.children,e,f,b);case Pe:g=8;e|=16;break;case lc:g=8;e|=1;break;case Za:return a=W(12,c,b,e|8),a.elementType=Za, -a.type=Za,a.lanes=f,a;case $a:return a=W(13,c,b,e),a.type=$a,a.elementType=$a,a.lanes=f,a;case xb:return a=W(19,c,b,e),a.elementType=xb,a.lanes=f,a;case ld:return Rc(c,e,f,b);case md:return a=W(24,c,b,e),a.elementType=md,a.lanes=f,a;default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case nc:g=10;break a;case mc:g=9;break a;case yb:g=11;break a;case zb:g=14;break a;case pc:g=16;d=null;break a;case oc:g=22;break a}throw Error(m(130,null==a?a:typeof a,""));}b=W(g,c,b,e);b.elementType=a;b.type= -d;b.lanes=f;return b}function Pa(a,b,c,d){a=W(7,a,d,b);a.lanes=c;return a}function Rc(a,b,c,d){a=W(23,a,d,b);a.elementType=ld;a.lanes=c;return a}function Bc(a,b,c){a=W(6,a,null,b);a.lanes=c;return a}function Cc(a,b,c){b=W(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}function Xf(a,b,c){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null; -this.timeoutHandle=-1;this.pendingContext=this.context=null;this.hydrate=c;this.callbackNode=null;this.callbackPriority=0;this.eventTimes=tc(0);this.expirationTimes=tc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=tc(0)}function Yf(a,b,c,d){a=new Xf(a,b,c);b=W(3,null,null,2===b?7:1===b?3:0);a.current=b;b.stateNode=a;zc(b);return a}function nd(a,b,c,d){var e=b.current,f=Z(),g=za(e);a:if(c){c= -c._reactInternals;b:{if(Ab(c)!==c||1!==c.tag)throw Error(m(170));var h=c;do{switch(h.tag){case 3:h=h.stateNode.context;break b;case 1:if(M(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break b}}h=h.return}while(null!==h);throw Error(m(171));}if(1===c.tag){var l=c.type;if(M(l)){c=Fd(c,l,h);break a}}c=h}else c=ja;null===b.context?b.context=c:b.pendingContext=c;b=ma(f,g);b.payload={element:a};d=void 0===d?null:d;null!==d&&(b.callback=d);na(e,b);pb(e,g,f);return g}function Zf(a){a= -Ye(a);return null===a?null:a.stateNode}function $f(a){return null}function hc(a){if(a.isHidden)return null;switch(a.tag){case "TEXT":return a.text;case "INSTANCE":var b=a.props;var c=["children"];if(null==b)b={};else{var d={},e=Object.keys(b),f;for(f=0;fUe?td:function(){return td()-Ue},If=fa.ReactCurrentBatchConfig, -Q="function"===typeof Object.is?Object.is:gf,hf=Object.prototype.hasOwnProperty,Lb=ia(null),Kb=null,Na=null,Jb=null,oa=!1,Vd=(new ta.Component).refs,Nb={isMounted:function(a){return(a=a._reactInternals)?Ab(a)===a:!1},enqueueSetState:function(a,b,c){a=a._reactInternals;var d=Z(),e=za(a),f=ma(d,e);f.payload=b;void 0!==c&&null!==c&&(f.callback=c);na(a,f);pb(a,e,d)},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=Z(),e=za(a),f=ma(d,e);f.tag=1;f.payload=b;void 0!==c&&null!==c&&(f.callback= -c);na(a,f);pb(a,e,d)},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=Z(),d=za(a),e=ma(c,d);e.tag=2;void 0!==b&&null!==b&&(e.callback=b);na(a,e);pb(a,d,c)}},Qb=Array.isArray,Xb=Wd(!0),sf=Wd(!1),gb={},X=ia(gb),ib=ia(gb),hb=ia(gb),w=ia(0),jb=[],lb=fa.ReactCurrentDispatcher,S=fa.ReactCurrentBatchConfig,kb=0,y=null,K=null,G=null,Tb=!1,mb=!1,Sb={readContext:R,useCallback:N,useContext:N,useEffect:N,useImperativeHandle:N,useLayoutEffect:N,useMemo:N,useReducer:N,useRef:N,useState:N,useDebugValue:N, -useDeferredValue:N,useTransition:N,useMutableSource:N,useOpaqueIdentifier:N,unstable_isNewReconciler:!1},of={readContext:R,useCallback:function(a,b){xa().memoizedState=[a,void 0===b?null:b];return a},useContext:R,useEffect:ce,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Kc(4,2,ee.bind(null,b,a),c)},useLayoutEffect:function(a,b){return Kc(4,2,a,b)},useMemo:function(a,b){var c=xa();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a, -b,c){var d=xa();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a=d.queue={pending:null,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};a=a.dispatch=Ic.bind(null,y,a);return[d.memoizedState,a]},useRef:be,useState:Ub,useDebugValue:Mc,useDeferredValue:function(a){var b=Ub(a),c=b[0],d=b[1];ce(function(){var b=S.transition;S.transition=1;try{d(a)}finally{S.transition=b}},[a]);return c},useTransition:function(){var a=Ub(!1),b=a[0];a=rf.bind(null,a[1]);be(a);return[a,b]},useMutableSource:function(a, -b,c){var d=xa();d.memoizedState={refs:{getSnapshot:b,setSnapshot:null},source:a,subscribe:c};return $d(d,a,b,c)},useOpaqueIdentifier:function(){var a="c_"+(cg++).toString(36);Ub(a);return a},unstable_isNewReconciler:!1},pf={readContext:R,useCallback:ge,useContext:R,useEffect:Wb,useImperativeHandle:fe,useLayoutEffect:de,useMemo:he,useReducer:nb,useRef:Vb,useState:function(a){return nb(Y)},useDebugValue:Mc,useDeferredValue:function(a){var b=nb(Y),c=b[0],d=b[1];Wb(function(){var b=S.transition;S.transition= -1;try{d(a)}finally{S.transition=b}},[a]);return c},useTransition:function(){var a=nb(Y)[0];return[Vb().current,a]},useMutableSource:ae,useOpaqueIdentifier:function(){return nb(Y)[0]},unstable_isNewReconciler:!1},qf={readContext:R,useCallback:ge,useContext:R,useEffect:Wb,useImperativeHandle:fe,useLayoutEffect:de,useMemo:he,useReducer:ob,useRef:Vb,useState:function(a){return ob(Y)},useDebugValue:Mc,useDeferredValue:function(a){var b=ob(Y),c=b[0],d=b[1];Wb(function(){var b=S.transition;S.transition= -1;try{d(a)}finally{S.transition=b}},[a]);return c},useTransition:function(){var a=ob(Y)[0];return[Vb().current,a]},useMutableSource:ae,useOpaqueIdentifier:function(){return ob(Y)[0]},unstable_isNewReconciler:!1},tf=fa.ReactCurrentOwner,U=!1,Zb={dehydrated:null,retryLane:0};var wf=function(a,b,c,d){for(c=b.child;null!==c;){if(5===c.tag||6===c.tag){d=a;var e=c.stateNode,f=d.children.indexOf(e);-1!==f&&d.children.splice(f,1);d.children.push(e)}else if(4!==c.tag&&null!==c.child){c.child.return=c;c=c.child; -continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return}c.sibling.return=c.return;c=c.sibling}};var ue=function(a){};var vf=function(a,b,c,d,e){a.memoizedProps!==d&&(wa(X.current),b.updateQueue=bg)&&(b.flags|=4)};var xf=function(a,b,c,d){c!==d&&(b.flags|=4)};var Mf="function"===typeof WeakMap?WeakMap:Map,Ff="function"===typeof WeakSet?WeakSet:Set,ac=null,Kf=Math.ceil,ec=fa.ReactCurrentDispatcher,gd=fa.ReactCurrentOwner,ud=fa.IsSomeRendererActing,q=0,B=null, -D=null,L=0,da=0,Aa=ia(0),H=0,fc=null,Ta=0,pa=0,Ra=0,ed=0,ad=null,$c=0,rb=Infinity,k=null,$b=!1,Vc=null,aa=null,sa=!1,ub=null,wb=90,hd=[],id=[],Ua=null,sb=0,bd=null,bc=-1,ea=0,cc=0,vb=null,gc=!1;var Qf=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||A.current)U=!0;else if(0!==(c&d))U=0!==(a.flags&16384)?!0:!1;else{U=!1;switch(b.tag){case 3:ne(b);break;case 5:Yd(b);break;case 1:M(b.type)&&Db(b);break;case 4:Dc(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value; -var e=b.type._context;v(Lb,e._currentValue2);e._currentValue2=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return oe(a,b,c);v(w,w.current&1);b=ca(a,b,c);return null!==b?b.sibling:null}v(w,w.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return te(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);v(w,w.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,Pc(a,b,c)}return ca(a,b,c)}else U= -!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ha(b,x.current);Oa(b,c);e=Hc(null,b,d,a,e,c);b.flags|=1;if("object"===typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(M(d)){var f=!0;Db(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;zc(b);var g=d.getDerivedStateFromProps;"function"===typeof g&&Mb(b,d,g,a);e.updater=Nb;b.stateNode= -e;e._reactInternals=b;Ac(b,d,a,c);b=Qc(null,b,d,!0,f,c)}else b.tag=0,O(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=Wf(e);a=T(e,a);switch(f){case 0:b=Oc(null,b,e,a,c);break a;case 1:b=me(null,b,e,a,c);break a;case 11:b=ie(null,b,e,a,c);break a;case 14:b=je(null,b,e,T(e.type,a),d,c);break a}throw Error(m(306,e,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType=== -d?e:T(d,e),Oc(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:T(d,e),me(a,b,d,e,c);case 3:ne(b);d=b.updateQueue;if(null===a||null===d)throw Error(m(282));d=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;Pd(a,b);db(b,d,null,c);d=b.memoizedState.element;d===e?b=ca(a,b,c):(O(a,b,d,c),b=b.child);return b;case 5:return Yd(b),d=b.pendingProps.children,le(a,b),O(a,b,d,c),b.child;case 6:return null;case 13:return oe(a,b,c);case 4:return Dc(b,b.stateNode.containerInfo), -d=b.pendingProps,null===a?b.child=Xb(b,null,d,c):O(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:T(d,e),ie(a,b,d,e,c);case 7:return O(a,b,b.pendingProps,c),b.child;case 8:return O(a,b,b.pendingProps.children,c),b.child;case 12:return O(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;g=b.memoizedProps;f=e.value;var h=b.type._context;v(Lb,h._currentValue2);h._currentValue2=f;if(null!==g)if(h=g.value,f=Q(h,f)?0:("function"===typeof d._calculateChangedBits? -d._calculateChangedBits(h,f):1073741823)|0,0===f){if(g.children===e.children&&!A.current){b=ca(a,b,c);break a}}else for(h=b.child,null!==h&&(h.return=b);null!==h;){var l=h.dependencies;if(null!==l){g=h.child;for(var k=l.firstContext;null!==k;){if(k.context===d&&0!==(k.observedBits&f)){1===h.tag&&(k=ma(-1,c&-c),k.tag=2,na(h,k));h.lanes|=c;k=h.alternate;null!==k&&(k.lanes|=c);Od(h.return,c);l.lanes|=c;break}k=k.next}}else g=10===h.tag?h.type===b.type?null:h.child:h.child;if(null!==g)g.return=h;else for(g= -h;null!==g;){if(g===b){g=null;break}h=g.sibling;if(null!==h){h.return=g.return;g=h;break}g=g.return}h=g}O(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,f=b.pendingProps,d=f.children,Oa(b,c),e=R(e,f.unstable_observedBits),d=d(e),b.flags|=1,O(a,b,d,c),b.child;case 14:return e=b.type,f=T(e,b.pendingProps),f=T(e.type,f),je(a,b,e,f,d,c);case 15:return ke(a,b,b.type,b.pendingProps,d,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:T(d,e),null!==a&&(a.alternate=null,b.alternate= -null,b.flags|=2),b.tag=1,M(d)?(a=!0,Db(b)):a=!1,Oa(b,c),Td(b,d,e),Ac(b,d,e,c),Qc(null,b,d,!0,a,c);case 19:return te(a,b,c);case 23:return Pc(a,b,c);case 24:return Pc(a,b,c)}throw Error(m(156,b.tag));};var kd=I.unstable_flushAllWithoutAsserting,Ve="function"===typeof kd,kc=0,We=!1,W=function(a,b,c,d){return new Vf(a,b,c,d)},Ea=fa.IsSomeRendererActing,eg=function(){return null},pd=new Set([0,1,5,11,14,15,22,3]),ag=function(){function a(a){if(!pd.has(a.tag))throw Error(m(225,a.tag));this._fiber=a}var b= -a.prototype;b._currentFiber=function(){var a=yd(this._fiber);if(null===a)throw Error(m(224));return a};b.find=function(a){return rd(this.findAll(a,{deep:!1}),"matching custom predicate: "+a.toString())};b.findByType=function(a){return rd(this.findAllByType(a,{deep:!1}),'with node type: "'+(ua(a)||"Unknown")+'"')};b.findByProps=function(a){return rd(this.findAllByProps(a,{deep:!1}),"with props: "+JSON.stringify(a))};b.findAll=function(a){return jc(this,a,1od(a).length)break;return qd(a)}a=a.return}return null}},{key:"children",get:function(){return od(this._currentFiber())}}]);return a}(),sd=new WeakMap;(function(a){a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null, -overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:fa.ReactCurrentDispatcher,findHostInstanceByFiber:Zf,findFiberByHostInstance:a.findFiberByHostInstance||$f,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)a=!1;else{var b=__REACT_DEVTOOLS_GLOBAL_HOOK__; -if(!b.isDisabled&&b.supportsFiber)try{Wc=b.inject(a),Ba=b}catch(c){}a=!0}return a})({findFiberByHostInstance:function(){throw Error("TestRenderer does not support findFiberByHostInstance()");},bundleType:0,version:"17.0.2",rendererPackageName:"react-test-renderer"});P._Scheduler=Xa;P.act=function(a){function b(){kc--;ud.current=c}!1===We&&(We=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected."));kc++;var c=ud.current;ud.current=!0; -try{var d=fd(a)}catch(e){throw b(),e;}if(null!==d&&"object"===typeof d&&"function"===typeof d.then)return{then:function(a,f){d.then(function(){1 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } -} - -function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } -} - -// 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 === exports.Fragment || 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 getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); -} - -function getContextName(type) { - return type.displayName || 'Context'; -} - -function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case exports.Fragment: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; -} - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: _assign({}, props, { - value: prevLog - }), - info: _assign({}, props, { - value: prevInfo - }), - warn: _assign({}, props, { - value: prevWarn - }), - error: _assign({}, props, { - value: prevError - }), - group: _assign({}, props, { - value: prevGroup - }), - groupCollapsed: _assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: _assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - -var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; -var prefix; -function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); -} - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} -function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} - -function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; -} - -var loggedTypeFailures = {}; -var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); - } - } -} - -function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } -} - -var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true -}; -var specialPropKeyWarningShown; -var specialPropRefWarningShown; -var didWarnAboutStringRefs; - -{ - didWarnAboutStringRefs = {}; -} - -function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; -} - -function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; -} - -function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { - var componentName = getComponentName(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } -} - -function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } -} - -function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } -} -/** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - -var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; -}; -/** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - -function jsxDEV(type, config, maybeKey, source, self) { - { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - key = '' + maybeKey; - } - - if (hasValidKey(config)) { - key = '' + config.key; - } - - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } // Remaining properties are added to a new props object - - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } -} - -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; -var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } -} - -var propTypesMisspellWarningShown; - -{ - propTypesMisspellWarningShown = false; -} -/** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - -function isValidElement(object) { - { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } -} - -function getDeclarationErrorAddendum() { - { - if (ReactCurrentOwner$1.current) { - var name = getComponentName(ReactCurrentOwner$1.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } -} - -function getSourceInfoErrorAddendum(source) { - { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; - } -} -/** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - -var ownerHasKeyUseWarning = {}; - -function getCurrentComponentErrorInfo(parentType) { - { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } -} -/** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - -function validateExplicitKey(element, parentType) { - { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; - } - - setCurrentlyValidatingElement$1(element); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - - setCurrentlyValidatingElement$1(null); - } -} -/** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - -function validateChildKeys(node, parentType) { - { - if (typeof node !== 'object') { - return; - } - - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } -} -/** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - -function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentName(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentName(type); - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } -} -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement$1(null); - break; - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement$1(null); - } - } -} - -function jsxWithValidation(type, props, key, isStaticChildren, source, self) { - { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendum(source); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (Array.isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - - var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - var children = props.children; - - if (children !== undefined) { - if (isStaticChildren) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - validateChildKeys(children[i], type); - } - - if (Object.freeze) { - Object.freeze(children); - } - } else { - error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); - } - } else { - validateChildKeys(children, type); - } - } - } - - if (type === exports.Fragment) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; - } -} // These two functions exist to still get child warnings in dev - -var jsxDEV$1 = jsxWithValidation ; - -exports.jsxDEV = jsxDEV$1; - })(); -} diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js b/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js deleted file mode 100644 index 02c1a5b3a9aba..0000000000000 --- a/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @license React v17.0.2 - * react-jsx-dev-runtime.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. - */ -'use strict';require("object-assign");require("react");exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var a=Symbol.for;exports.Fragment=a("react.fragment")}exports.jsxDEV=void 0; diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js b/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js deleted file mode 100644 index 9c8898a30a18c..0000000000000 --- a/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @license React v17.0.2 - * react-jsx-dev-runtime.profiling.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. - */ -'use strict';require("object-assign");require("react");exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var a=Symbol.for;exports.Fragment=a("react.fragment")}exports.jsxDEV=void 0; diff --git a/node_modules/react/cjs/react-jsx-runtime.development.js b/node_modules/react/cjs/react-jsx-runtime.development.js deleted file mode 100644 index 38c92242c902c..0000000000000 --- a/node_modules/react/cjs/react-jsx-runtime.development.js +++ /dev/null @@ -1,1221 +0,0 @@ -/** @license React v17.0.2 - * react-jsx-runtime.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -var React = require('react'); -var _assign = require('object-assign'); - -// 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; -exports.Fragment = 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_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; -var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; -var REACT_OFFSCREEN_TYPE = 0xeae2; -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'); - exports.Fragment = 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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); -} - -var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; -} - -var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - -function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } -} - -function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } -} - -// 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 === exports.Fragment || 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 getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); -} - -function getContextName(type) { - return type.displayName || 'Context'; -} - -function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case exports.Fragment: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; -} - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: _assign({}, props, { - value: prevLog - }), - info: _assign({}, props, { - value: prevInfo - }), - warn: _assign({}, props, { - value: prevWarn - }), - error: _assign({}, props, { - value: prevError - }), - group: _assign({}, props, { - value: prevGroup - }), - groupCollapsed: _assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: _assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - -var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; -var prefix; -function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); -} - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} -function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} - -function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; -} - -var loggedTypeFailures = {}; -var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); - } - } -} - -function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } -} - -var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true -}; -var specialPropKeyWarningShown; -var specialPropRefWarningShown; -var didWarnAboutStringRefs; - -{ - didWarnAboutStringRefs = {}; -} - -function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; -} - -function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; -} - -function warnIfStringRefCannotBeAutoConverted(config, self) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { - var componentName = getComponentName(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } -} - -function defineKeyPropWarningGetter(props, displayName) { - { - var warnAboutAccessingKey = function () { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } -} - -function defineRefPropWarningGetter(props, displayName) { - { - var warnAboutAccessingRef = function () { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } -} -/** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - -var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; -}; -/** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} key - */ - -function jsxDEV(type, config, maybeKey, source, self) { - { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; // Currently, key can be spread in as a prop. This causes a potential - // issue if key is also explicitly declared (ie.
- // or
). We want to deprecate key spread, - // but as an intermediary step, we will use jsxDEV for everything except - //
, because we aren't currently able to tell if - // key is explicitly declared to be undefined or not. - - if (maybeKey !== undefined) { - key = '' + maybeKey; - } - - if (hasValidKey(config)) { - key = '' + config.key; - } - - if (hasValidRef(config)) { - ref = config.ref; - warnIfStringRefCannotBeAutoConverted(config, self); - } // Remaining properties are added to a new props object - - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } -} - -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; -var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } -} - -var propTypesMisspellWarningShown; - -{ - propTypesMisspellWarningShown = false; -} -/** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - -function isValidElement(object) { - { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } -} - -function getDeclarationErrorAddendum() { - { - if (ReactCurrentOwner$1.current) { - var name = getComponentName(ReactCurrentOwner$1.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } -} - -function getSourceInfoErrorAddendum(source) { - { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; - } -} -/** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - -var ownerHasKeyUseWarning = {}; - -function getCurrentComponentErrorInfo(parentType) { - { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } -} -/** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - -function validateExplicitKey(element, parentType) { - { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; - } - - setCurrentlyValidatingElement$1(element); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - - setCurrentlyValidatingElement$1(null); - } -} -/** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - -function validateChildKeys(node, parentType) { - { - if (typeof node !== 'object') { - return; - } - - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } -} -/** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - -function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentName(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentName(type); - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } -} -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement$1(null); - break; - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement$1(null); - } - } -} - -function jsxWithValidation(type, props, key, isStaticChildren, source, self) { - { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendum(source); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (Array.isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - - var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - var children = props.children; - - if (children !== undefined) { - if (isStaticChildren) { - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - validateChildKeys(children[i], type); - } - - if (Object.freeze) { - Object.freeze(children); - } - } else { - error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); - } - } else { - validateChildKeys(children, type); - } - } - } - - if (type === exports.Fragment) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; - } -} // These two functions exist to still get child warnings in dev -// even with the prod transform. This means that jsxDEV is purely -// opt-in behavior for better messages but that we won't stop -// giving you warnings if you use production apis. - -function jsxWithValidationStatic(type, props, key) { - { - return jsxWithValidation(type, props, key, true); - } -} -function jsxWithValidationDynamic(type, props, key) { - { - return jsxWithValidation(type, props, key, false); - } -} - -var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children. -// for now we can ship identical prod functions - -var jsxs = jsxWithValidationStatic ; - -exports.jsx = jsx; -exports.jsxs = jsxs; - })(); -} diff --git a/node_modules/react/cjs/react-jsx-runtime.production.min.js b/node_modules/react/cjs/react-jsx-runtime.production.min.js deleted file mode 100644 index 240488cf2c368..0000000000000 --- a/node_modules/react/cjs/react-jsx-runtime.production.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/** @license React v17.0.2 - * react-jsx-runtime.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. - */ -'use strict';require("object-assign");var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0}; -function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q; diff --git a/node_modules/react/cjs/react-jsx-runtime.profiling.min.js b/node_modules/react/cjs/react-jsx-runtime.profiling.min.js deleted file mode 100644 index e6516f7b4c7a3..0000000000000 --- a/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/** @license React v17.0.2 - * react-jsx-runtime.profiling.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. - */ -'use strict';require("object-assign");var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0}; -function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q; diff --git a/node_modules/react/cjs/react.development.js b/node_modules/react/cjs/react.development.js deleted file mode 100644 index 7f48126ebf8fc..0000000000000 --- a/node_modules/react/cjs/react.development.js +++ /dev/null @@ -1,2333 +0,0 @@ -/** @license React v17.0.2 - * react.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -var _assign = require('object-assign'); - -// TODO: this is special because it gets imported during build. -var ReactVersion = '17.0.2'; - -// 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; -exports.Fragment = 0xeacb; -exports.StrictMode = 0xeacc; -exports.Profiler = 0xead2; -var REACT_PROVIDER_TYPE = 0xeacd; -var REACT_CONTEXT_TYPE = 0xeace; -var REACT_FORWARD_REF_TYPE = 0xead0; -exports.Suspense = 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_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; -var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; -var REACT_OFFSCREEN_TYPE = 0xeae2; -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'); - exports.Fragment = symbolFor('react.fragment'); - exports.StrictMode = symbolFor('react.strict_mode'); - exports.Profiler = symbolFor('react.profiler'); - REACT_PROVIDER_TYPE = symbolFor('react.provider'); - REACT_CONTEXT_TYPE = symbolFor('react.context'); - REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); - exports.Suspense = 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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); -} - -var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; -} - -/** - * Keeps track of the current dispatcher. - */ -var ReactCurrentDispatcher = { - /** - * @internal - * @type {ReactComponent} - */ - current: null -}; - -/** - * Keeps track of the current batch's configuration such as how long an update - * should suspend for if it needs to. - */ -var ReactCurrentBatchConfig = { - transition: 0 -}; - -/** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - */ -var ReactCurrentOwner = { - /** - * @internal - * @type {ReactComponent} - */ - current: null -}; - -var ReactDebugCurrentFrame = {}; -var currentExtraStackFrame = null; -function setExtraStackFrame(stack) { - { - currentExtraStackFrame = stack; - } -} - -{ - ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { - { - currentExtraStackFrame = stack; - } - }; // Stack implementation injected by the current renderer. - - - ReactDebugCurrentFrame.getCurrentStack = null; - - ReactDebugCurrentFrame.getStackAddendum = function () { - var stack = ''; // Add an extra top frame while an element is being validated - - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } // Delegate to the injected renderer-specific implementation - - - var impl = ReactDebugCurrentFrame.getCurrentStack; - - if (impl) { - stack += impl() || ''; - } - - return stack; - }; -} - -/** - * Used by act() to track whether you're inside an act() scope. - */ -var IsSomeRendererActing = { - current: false -}; - -var ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: ReactCurrentOwner, - IsSomeRendererActing: IsSomeRendererActing, - // Used by renderers to avoid bundling object-assign twice in UMD bundles: - assign: _assign -}; - -{ - ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; -} - -// by calls to these methods by a Babel plugin. -// -// In PROD (or in packages without access to React internals), -// they are left as they are instead. - -function warn(format) { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } -} -function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } -} - -function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } -} - -var didWarnStateUpdateForUnmountedComponent = {}; - -function warnNoop(publicInstance, callerName) { - { - var _constructor = publicInstance.constructor; - var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; - var warningKey = componentName + "." + callerName; - - if (didWarnStateUpdateForUnmountedComponent[warningKey]) { - return; - } - - error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); - - didWarnStateUpdateForUnmountedComponent[warningKey] = true; - } -} -/** - * This is the abstract API for an update queue. - */ - - -var ReactNoopUpdateQueue = { - /** - * Checks whether or not this composite component is mounted. - * @param {ReactClass} publicInstance The instance we want to test. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function (publicInstance) { - return false; - }, - - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueForceUpdate: function (publicInstance, callback, callerName) { - warnNoop(publicInstance, 'forceUpdate'); - }, - - /** - * Replaces all of the state. Always use this or `setState` to mutate state. - * You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} completeState Next state. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { - warnNoop(publicInstance, 'replaceState'); - }, - - /** - * Sets a subset of the state. This only exists because _pendingState is - * internal. This provides a merging strategy that is not available to deep - * properties which is confusing. TODO: Expose pendingState or don't use it - * during the merge. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} partialState Next partial state to be merged with state. - * @param {?function} callback Called after component is updated. - * @param {?string} Name of the calling function in the public API. - * @internal - */ - enqueueSetState: function (publicInstance, partialState, callback, callerName) { - warnNoop(publicInstance, 'setState'); - } -}; - -var emptyObject = {}; - -{ - Object.freeze(emptyObject); -} -/** - * Base class helpers for the updating state of a component. - */ - - -function Component(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the - // renderer. - - this.updater = updater || ReactNoopUpdateQueue; -} - -Component.prototype.isReactComponent = {}; -/** - * Sets a subset of the state. Always use this to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * When a function is provided to setState, it will be called at some point in - * the future (not synchronously). It will be called with the up to date - * component arguments (state, props, context). These values can be different - * from this.* because your function may be called after receiveProps but before - * shouldComponentUpdate, and this new state, props, and context will not yet be - * assigned to this. - * - * @param {object|function} partialState Next partial state or function to - * produce next partial state to be merged with current state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - -Component.prototype.setState = function (partialState, callback) { - if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) { - { - throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." ); - } - } - - this.updater.enqueueSetState(this, partialState, callback, 'setState'); -}; -/** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ - - -Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); -}; -/** - * Deprecated APIs. These APIs used to exist on classic React classes but since - * we would like to deprecate them, we're not going to move them over to this - * modern base class. Instead, we define a getter that warns if it's accessed. - */ - - -{ - var deprecatedAPIs = { - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] - }; - - var defineDeprecationWarning = function (methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function () { - warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); - - return undefined; - } - }); - }; - - for (var fnName in deprecatedAPIs) { - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } -} - -function ComponentDummy() {} - -ComponentDummy.prototype = Component.prototype; -/** - * Convenience component with default shallow equality check for sCU. - */ - -function PureComponent(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; -} - -var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); -pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. - -_assign(pureComponentPrototype, Component.prototype); - -pureComponentPrototype.isPureReactComponent = true; - -// an immutable object with a single mutable value -function createRef() { - var refObject = { - current: null - }; - - { - Object.seal(refObject); - } - - return refObject; -} - -function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); -} - -function getContextName(type) { - return type.displayName || 'Context'; -} - -function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case exports.Fragment: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case exports.Profiler: - return 'Profiler'; - - case exports.StrictMode: - return 'StrictMode'; - - case exports.Suspense: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; -} - -var hasOwnProperty = Object.prototype.hasOwnProperty; -var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true -}; -var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; - -{ - didWarnAboutStringRefs = {}; -} - -function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; -} - -function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; -} - -function defineKeyPropWarningGetter(props, displayName) { - var warnAboutAccessingKey = function () { - { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); -} - -function defineRefPropWarningGetter(props, displayName) { - var warnAboutAccessingRef = function () { - { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); -} - -function warnIfStringRefCannotBeAutoConverted(config) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { - var componentName = getComponentName(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } -} -/** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - -var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; -}; -/** - * Create and return a new ReactElement of the given type. - * See https://reactjs.org/docs/react-api.html#createelement - */ - -function createElement(type, config, children) { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; - var self = null; - var source = null; - - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - - { - warnIfStringRefCannotBeAutoConverted(config); - } - } - - if (hasValidKey(config)) { - key = '' + config.key; - } - - self = config.__self === undefined ? null : config.__self; - source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - { - if (Object.freeze) { - Object.freeze(childArray); - } - } - - props.children = childArray; - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - { - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); -} -function cloneAndReplaceKey(oldElement, newKey) { - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - return newElement; -} -/** - * Clone and return a new ReactElement using element as the starting point. - * See https://reactjs.org/docs/react-api.html#cloneelement - */ - -function cloneElement(element, config, children) { - if (!!(element === null || element === undefined)) { - { - throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." ); - } - } - - var propName; // Original props are copied - - var props = _assign({}, element.props); // Reserved names are extracted - - - var key = element.key; - var ref = element.ref; // Self is preserved since the owner is preserved. - - var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a - // transpiler, and the original source is probably a better indicator of the - // true owner. - - var source = element._source; // Owner will be preserved, unless ref is overridden - - var owner = element._owner; - - if (config != null) { - if (hasValidRef(config)) { - // Silently steal the ref from the parent. - ref = config.ref; - owner = ReactCurrentOwner.current; - } - - if (hasValidKey(config)) { - key = '' + config.key; - } // Remaining properties override existing props - - - var defaultProps; - - if (element.type && element.type.defaultProps) { - defaultProps = element.type.defaultProps; - } - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - if (config[propName] === undefined && defaultProps !== undefined) { - // Resolve default props - props[propName] = defaultProps[propName]; - } else { - props[propName] = config[propName]; - } - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - props.children = childArray; - } - - return ReactElement(element.type, key, ref, self, source, owner, props); -} -/** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - -function isValidElement(object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; -} - -var SEPARATOR = '.'; -var SUBSEPARATOR = ':'; -/** - * Escape and wrap key so it is safe to use as a reactid - * - * @param {string} key to be escaped. - * @return {string} the escaped key. - */ - -function escape(key) { - var escapeRegex = /[=:]/g; - var escaperLookup = { - '=': '=0', - ':': '=2' - }; - var escapedString = key.replace(escapeRegex, function (match) { - return escaperLookup[match]; - }); - return '$' + escapedString; -} -/** - * TODO: Test that a single child and an array with one item have the same key - * pattern. - */ - - -var didWarnAboutMaps = false; -var userProvidedKeyEscapeRegex = /\/+/g; - -function escapeUserProvidedKey(text) { - return text.replace(userProvidedKeyEscapeRegex, '$&/'); -} -/** - * Generate a key string that identifies a element within a set. - * - * @param {*} element A element that could contain a manual key. - * @param {number} index Index that is used if a manual key is not provided. - * @return {string} - */ - - -function getElementKey(element, index) { - // Do some typechecking here since we call this blindly. We want to ensure - // that we don't block potential future ES APIs. - if (typeof element === 'object' && element !== null && element.key != null) { - // Explicit key - return escape('' + element.key); - } // Implicit key determined by the index in the set - - - return index.toString(36); -} - -function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - - if (type === 'undefined' || type === 'boolean') { - // All of the above are perceived as null. - children = null; - } - - var invokeCallback = false; - - if (children === null) { - invokeCallback = true; - } else { - switch (type) { - case 'string': - case 'number': - invokeCallback = true; - break; - - case 'object': - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = true; - } - - } - } - - if (invokeCallback) { - var _child = children; - var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array - // so that it's consistent if the number of children grows: - - var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; - - if (Array.isArray(mappedChild)) { - var escapedChildKey = ''; - - if (childKey != null) { - escapedChildKey = escapeUserProvidedKey(childKey) + '/'; - } - - mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { - return c; - }); - } else if (mappedChild != null) { - if (isValidElement(mappedChild)) { - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as - // traverseAllChildren used to do for objects as children - escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key - mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number - escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); - } - - array.push(mappedChild); - } - - return 1; - } - - var child; - var nextName; - var subtreeCount = 0; // Count of children found in the current subtree. - - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - child = children[i]; - nextName = nextNamePrefix + getElementKey(child, i); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - var iterableChildren = children; - - { - // Warn about using Maps as children - if (iteratorFn === iterableChildren.entries) { - if (!didWarnAboutMaps) { - warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } - } - - var iterator = iteratorFn.call(iterableChildren); - var step; - var ii = 0; - - while (!(step = iterator.next()).done) { - child = step.value; - nextName = nextNamePrefix + getElementKey(child, ii++); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else if (type === 'object') { - var childrenString = '' + children; - - { - { - throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." ); - } - } - } - } - - return subtreeCount; -} - -/** - * Maps children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenmap - * - * The provided mapFunction(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} func The map function. - * @param {*} context Context for mapFunction. - * @return {object} Object containing the ordered map of results. - */ -function mapChildren(children, func, context) { - if (children == null) { - return children; - } - - var result = []; - var count = 0; - mapIntoArray(children, result, '', '', function (child) { - return func.call(context, child, count++); - }); - return result; -} -/** - * Count the number of children that are typically specified as - * `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrencount - * - * @param {?*} children Children tree container. - * @return {number} The number of children. - */ - - -function countChildren(children) { - var n = 0; - mapChildren(children, function () { - n++; // Don't return anything - }); - return n; -} - -/** - * Iterates through children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenforeach - * - * The provided forEachFunc(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} forEachFunc - * @param {*} forEachContext Context for forEachContext. - */ -function forEachChildren(children, forEachFunc, forEachContext) { - mapChildren(children, function () { - forEachFunc.apply(this, arguments); // Don't return anything. - }, forEachContext); -} -/** - * Flatten a children object (typically specified as `props.children`) and - * return an array with appropriately re-keyed children. - * - * See https://reactjs.org/docs/react-api.html#reactchildrentoarray - */ - - -function toArray(children) { - return mapChildren(children, function (child) { - return child; - }) || []; -} -/** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenonly - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. - * - * @param {?object} children Child collection structure. - * @return {ReactElement} The first and only `ReactElement` contained in the - * structure. - */ - - -function onlyChild(children) { - if (!isValidElement(children)) { - { - throw Error( "React.Children.only expected to receive a single React element child." ); - } - } - - return children; -} - -function createContext(defaultValue, calculateChangedBits) { - if (calculateChangedBits === undefined) { - calculateChangedBits = null; - } else { - { - if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') { - error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits); - } - } - } - - var context = { - $$typeof: REACT_CONTEXT_TYPE, - _calculateChangedBits: calculateChangedBits, - // As a workaround to support multiple concurrent renderers, we categorize - // some renderers as primary and others as secondary. We only expect - // there to be two concurrent renderers at most: React Native (primary) and - // Fabric (secondary); React DOM (primary) and React ART (secondary). - // Secondary renderers store their context values on separate fields. - _currentValue: defaultValue, - _currentValue2: defaultValue, - // Used to track how many concurrent renderers this context currently - // supports within in a single renderer. Such as parallel server rendering. - _threadCount: 0, - // These are circular - Provider: null, - Consumer: null - }; - context.Provider = { - $$typeof: REACT_PROVIDER_TYPE, - _context: context - }; - var hasWarnedAboutUsingNestedContextConsumers = false; - var hasWarnedAboutUsingConsumerProvider = false; - var hasWarnedAboutDisplayNameOnConsumer = false; - - { - // A separate object, but proxies back to the original context object for - // backwards compatibility. It has a different $$typeof, so we can properly - // warn for the incorrect usage of Context as a Consumer. - var Consumer = { - $$typeof: REACT_CONTEXT_TYPE, - _context: context, - _calculateChangedBits: context._calculateChangedBits - }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here - - Object.defineProperties(Consumer, { - Provider: { - get: function () { - if (!hasWarnedAboutUsingConsumerProvider) { - hasWarnedAboutUsingConsumerProvider = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Provider; - }, - set: function (_Provider) { - context.Provider = _Provider; - } - }, - _currentValue: { - get: function () { - return context._currentValue; - }, - set: function (_currentValue) { - context._currentValue = _currentValue; - } - }, - _currentValue2: { - get: function () { - return context._currentValue2; - }, - set: function (_currentValue2) { - context._currentValue2 = _currentValue2; - } - }, - _threadCount: { - get: function () { - return context._threadCount; - }, - set: function (_threadCount) { - context._threadCount = _threadCount; - } - }, - Consumer: { - get: function () { - if (!hasWarnedAboutUsingNestedContextConsumers) { - hasWarnedAboutUsingNestedContextConsumers = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Consumer; - } - }, - displayName: { - get: function () { - return context.displayName; - }, - set: function (displayName) { - if (!hasWarnedAboutDisplayNameOnConsumer) { - warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); - - hasWarnedAboutDisplayNameOnConsumer = true; - } - } - } - }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty - - context.Consumer = Consumer; - } - - { - context._currentRenderer = null; - context._currentRenderer2 = null; - } - - return context; -} - -var Uninitialized = -1; -var Pending = 0; -var Resolved = 1; -var Rejected = 2; - -function lazyInitializer(payload) { - if (payload._status === Uninitialized) { - var ctor = payload._result; - var thenable = ctor(); // Transition to the next state. - - var pending = payload; - pending._status = Pending; - pending._result = thenable; - thenable.then(function (moduleObject) { - if (payload._status === Pending) { - var defaultExport = moduleObject.default; - - { - if (defaultExport === undefined) { - error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. - 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); - } - } // Transition to the next state. - - - var resolved = payload; - resolved._status = Resolved; - resolved._result = defaultExport; - } - }, function (error) { - if (payload._status === Pending) { - // Transition to the next state. - var rejected = payload; - rejected._status = Rejected; - rejected._result = error; - } - }); - } - - if (payload._status === Resolved) { - return payload._result; - } else { - throw payload._result; - } -} - -function lazy(ctor) { - var payload = { - // We use these fields to store the result. - _status: -1, - _result: ctor - }; - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: payload, - _init: lazyInitializer - }; - - { - // In production, this would just set it on the object. - var defaultProps; - var propTypes; // $FlowFixMe - - Object.defineProperties(lazyType, { - defaultProps: { - configurable: true, - get: function () { - return defaultProps; - }, - set: function (newDefaultProps) { - error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - defaultProps = newDefaultProps; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'defaultProps', { - enumerable: true - }); - } - }, - propTypes: { - configurable: true, - get: function () { - return propTypes; - }, - set: function (newPropTypes) { - error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - propTypes = newPropTypes; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'propTypes', { - enumerable: true - }); - } - } - }); - } - - return lazyType; -} - -function forwardRef(render) { - { - if (render != null && render.$$typeof === REACT_MEMO_TYPE) { - error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); - } else if (typeof render !== 'function') { - error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); - } else { - if (render.length !== 0 && render.length !== 2) { - error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); - } - } - - if (render != null) { - if (render.defaultProps != null || render.propTypes != null) { - error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); - } - } - } - - var elementType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: render - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - - if (render.displayName == null) { - render.displayName = name; - } - } - }); - } - - return elementType; -} - -// 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 === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || 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 memo(type, compare) { - { - if (!isValidElementType(type)) { - error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); - } - } - - var elementType = { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: compare === undefined ? null : compare - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - - if (type.displayName == null) { - type.displayName = name; - } - } - }); - } - - return elementType; -} - -function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher.current; - - if (!(dispatcher !== null)) { - { - throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." ); - } - } - - return dispatcher; -} - -function useContext(Context, unstable_observedBits) { - var dispatcher = resolveDispatcher(); - - { - if (unstable_observedBits !== undefined) { - error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : ''); - } // TODO: add a more generic warning for invalid values. - - - if (Context._context !== undefined) { - var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs - // and nobody should be using this in existing code. - - if (realContext.Consumer === Context) { - error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); - } else if (realContext.Provider === Context) { - error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); - } - } - } - - return dispatcher.useContext(Context, unstable_observedBits); -} -function useState(initialState) { - var dispatcher = resolveDispatcher(); - return dispatcher.useState(initialState); -} -function useReducer(reducer, initialArg, init) { - var dispatcher = resolveDispatcher(); - return dispatcher.useReducer(reducer, initialArg, init); -} -function useRef(initialValue) { - var dispatcher = resolveDispatcher(); - return dispatcher.useRef(initialValue); -} -function useEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useEffect(create, deps); -} -function useLayoutEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useLayoutEffect(create, deps); -} -function useCallback(callback, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useCallback(callback, deps); -} -function useMemo(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useMemo(create, deps); -} -function useImperativeHandle(ref, create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useImperativeHandle(ref, create, deps); -} -function useDebugValue(value, formatterFn) { - { - var dispatcher = resolveDispatcher(); - return dispatcher.useDebugValue(value, formatterFn); - } -} - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: _assign({}, props, { - value: prevLog - }), - info: _assign({}, props, { - value: prevInfo - }), - warn: _assign({}, props, { - value: prevWarn - }), - error: _assign({}, props, { - value: prevError - }), - group: _assign({}, props, { - value: prevGroup - }), - groupCollapsed: _assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: _assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; -var prefix; -function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); -} - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher$1.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher$1.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} -function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} - -function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case exports.Suspense: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; -} - -var loggedTypeFailures = {}; -var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - -function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } -} - -function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } -} - -function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } -} - -var propTypesMisspellWarningShown; - -{ - propTypesMisspellWarningShown = false; -} - -function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = getComponentName(ReactCurrentOwner.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; -} - -function getSourceInfoErrorAddendum(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; -} - -function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum(elementProps.__source); - } - - return ''; -} -/** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - -var ownerHasKeyUseWarning = {}; - -function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; -} -/** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - -function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - - setCurrentlyValidatingElement$1(null); - } -} -/** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - -function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } -} -/** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - -function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentName(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentName(type); - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } -} -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement$1(null); - break; - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement$1(null); - } - } -} -function createElementWithValidation(type, props, children) { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendumForProps(props); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (Array.isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - { - error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - } - - var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); - } - } - - if (type === exports.Fragment) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; -} -var didWarnAboutDeprecatedCreateFactory = false; -function createFactoryWithValidation(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - validatedFactory.type = type; - - { - if (!didWarnAboutDeprecatedCreateFactory) { - didWarnAboutDeprecatedCreateFactory = true; - - warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); - } // Legacy hook: remove it - - - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } - - return validatedFactory; -} -function cloneElementWithValidation(element, props, children) { - var newElement = cloneElement.apply(this, arguments); - - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); - } - - validatePropTypes(newElement); - return newElement; -} - -{ - - try { - var frozenObject = Object.freeze({}); - /* eslint-disable no-new */ - - new Map([[frozenObject, null]]); - new Set([frozenObject]); - /* eslint-enable no-new */ - } catch (e) { - } -} - -var createElement$1 = createElementWithValidation ; -var cloneElement$1 = cloneElementWithValidation ; -var createFactory = createFactoryWithValidation ; -var Children = { - map: mapChildren, - forEach: forEachChildren, - count: countChildren, - toArray: toArray, - only: onlyChild -}; - -exports.Children = Children; -exports.Component = Component; -exports.PureComponent = PureComponent; -exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; -exports.cloneElement = cloneElement$1; -exports.createContext = createContext; -exports.createElement = createElement$1; -exports.createFactory = createFactory; -exports.createRef = createRef; -exports.forwardRef = forwardRef; -exports.isValidElement = isValidElement; -exports.lazy = lazy; -exports.memo = memo; -exports.useCallback = useCallback; -exports.useContext = useContext; -exports.useDebugValue = useDebugValue; -exports.useEffect = useEffect; -exports.useImperativeHandle = useImperativeHandle; -exports.useLayoutEffect = useLayoutEffect; -exports.useMemo = useMemo; -exports.useReducer = useReducer; -exports.useRef = useRef; -exports.useState = useState; -exports.version = ReactVersion; - })(); -} diff --git a/node_modules/react/cjs/react.production.min.js b/node_modules/react/cjs/react.production.min.js deleted file mode 100644 index 9128695679a8d..0000000000000 --- a/node_modules/react/cjs/react.production.min.js +++ /dev/null @@ -1,23 +0,0 @@ -/** @license React v17.0.2 - * react.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. - */ -'use strict';var l=require("object-assign"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116; -if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy")}var x="function"===typeof Symbol&&Symbol.iterator; -function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return"function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c=0.10.0" - }, - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - }, - "browserify": { - "transform": [ - "loose-envify" - ] - } -} diff --git a/node_modules/react/umd/react.development.js b/node_modules/react/umd/react.development.js deleted file mode 100644 index 1124191bb61da..0000000000000 --- a/node_modules/react/umd/react.development.js +++ /dev/null @@ -1,3357 +0,0 @@ -/** @license React v17.0.2 - * react.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. - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.React = {})); -}(this, (function (exports) { 'use strict'; - - // TODO: this is special because it gets imported during build. - var ReactVersion = '17.0.2'; - - // 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; - exports.Fragment = 0xeacb; - exports.StrictMode = 0xeacc; - exports.Profiler = 0xead2; - var REACT_PROVIDER_TYPE = 0xeacd; - var REACT_CONTEXT_TYPE = 0xeace; - var REACT_FORWARD_REF_TYPE = 0xead0; - exports.Suspense = 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_SCOPE_TYPE = 0xead7; - var REACT_OPAQUE_ID_TYPE = 0xeae0; - var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; - var REACT_OFFSCREEN_TYPE = 0xeae2; - 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'); - exports.Fragment = symbolFor('react.fragment'); - exports.StrictMode = symbolFor('react.strict_mode'); - exports.Profiler = symbolFor('react.profiler'); - REACT_PROVIDER_TYPE = symbolFor('react.provider'); - REACT_CONTEXT_TYPE = symbolFor('react.context'); - REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); - exports.Suspense = 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'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); - } - - var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - var _assign = function (to, from) { - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - }; - - var assign = Object.assign || function (target, sources) { - if (target == null) { - throw new TypeError('Object.assign target cannot be null or undefined'); - } - - var to = Object(target); - - for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) { - var nextSource = arguments[nextIndex]; - - if (nextSource != null) { - _assign(to, Object(nextSource)); - } - } - - return to; - }; - - /** - * Keeps track of the current dispatcher. - */ - var ReactCurrentDispatcher = { - /** - * @internal - * @type {ReactComponent} - */ - current: null - }; - - /** - * Keeps track of the current batch's configuration such as how long an update - * should suspend for if it needs to. - */ - var ReactCurrentBatchConfig = { - transition: 0 - }; - - /** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - */ - var ReactCurrentOwner = { - /** - * @internal - * @type {ReactComponent} - */ - current: null - }; - - var ReactDebugCurrentFrame = {}; - var currentExtraStackFrame = null; - function setExtraStackFrame(stack) { - { - currentExtraStackFrame = stack; - } - } - - { - ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { - { - currentExtraStackFrame = stack; - } - }; // Stack implementation injected by the current renderer. - - - ReactDebugCurrentFrame.getCurrentStack = null; - - ReactDebugCurrentFrame.getStackAddendum = function () { - var stack = ''; // Add an extra top frame while an element is being validated - - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } // Delegate to the injected renderer-specific implementation - - - var impl = ReactDebugCurrentFrame.getCurrentStack; - - if (impl) { - stack += impl() || ''; - } - - return stack; - }; - } - - /** - * Used by act() to track whether you're inside an act() scope. - */ - var IsSomeRendererActing = { - current: false - }; - - var ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: ReactCurrentOwner, - IsSomeRendererActing: IsSomeRendererActing, - // Used by renderers to avoid bundling object-assign twice in UMD bundles: - assign: assign - }; - - { - ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; - } - - // by calls to these methods by a Babel plugin. - // - // In PROD (or in packages without access to React internals), - // they are left as they are instead. - - function warn(format) { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - function error(format) { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - - var argsWithFormat = args.map(function (item) { - return '' + item; - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - - var didWarnStateUpdateForUnmountedComponent = {}; - - function warnNoop(publicInstance, callerName) { - { - var _constructor = publicInstance.constructor; - var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; - var warningKey = componentName + "." + callerName; - - if (didWarnStateUpdateForUnmountedComponent[warningKey]) { - return; - } - - error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); - - didWarnStateUpdateForUnmountedComponent[warningKey] = true; - } - } - /** - * This is the abstract API for an update queue. - */ - - - var ReactNoopUpdateQueue = { - /** - * Checks whether or not this composite component is mounted. - * @param {ReactClass} publicInstance The instance we want to test. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function (publicInstance) { - return false; - }, - - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueForceUpdate: function (publicInstance, callback, callerName) { - warnNoop(publicInstance, 'forceUpdate'); - }, - - /** - * Replaces all of the state. Always use this or `setState` to mutate state. - * You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} completeState Next state. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { - warnNoop(publicInstance, 'replaceState'); - }, - - /** - * Sets a subset of the state. This only exists because _pendingState is - * internal. This provides a merging strategy that is not available to deep - * properties which is confusing. TODO: Expose pendingState or don't use it - * during the merge. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} partialState Next partial state to be merged with state. - * @param {?function} callback Called after component is updated. - * @param {?string} Name of the calling function in the public API. - * @internal - */ - enqueueSetState: function (publicInstance, partialState, callback, callerName) { - warnNoop(publicInstance, 'setState'); - } - }; - - var emptyObject = {}; - - { - Object.freeze(emptyObject); - } - /** - * Base class helpers for the updating state of a component. - */ - - - function Component(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the - // renderer. - - this.updater = updater || ReactNoopUpdateQueue; - } - - Component.prototype.isReactComponent = {}; - /** - * Sets a subset of the state. Always use this to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * When a function is provided to setState, it will be called at some point in - * the future (not synchronously). It will be called with the up to date - * component arguments (state, props, context). These values can be different - * from this.* because your function may be called after receiveProps but before - * shouldComponentUpdate, and this new state, props, and context will not yet be - * assigned to this. - * - * @param {object|function} partialState Next partial state or function to - * produce next partial state to be merged with current state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - - Component.prototype.setState = function (partialState, callback) { - if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) { - { - throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." ); - } - } - - this.updater.enqueueSetState(this, partialState, callback, 'setState'); - }; - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ - - - Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); - }; - /** - * Deprecated APIs. These APIs used to exist on classic React classes but since - * we would like to deprecate them, we're not going to move them over to this - * modern base class. Instead, we define a getter that warns if it's accessed. - */ - - - { - var deprecatedAPIs = { - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] - }; - - var defineDeprecationWarning = function (methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function () { - warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); - - return undefined; - } - }); - }; - - for (var fnName in deprecatedAPIs) { - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } - } - - function ComponentDummy() {} - - ComponentDummy.prototype = Component.prototype; - /** - * Convenience component with default shallow equality check for sCU. - */ - - function PureComponent(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a different object later. - - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - - var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); - pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. - - assign(pureComponentPrototype, Component.prototype); - - pureComponentPrototype.isPureReactComponent = true; - - // an immutable object with a single mutable value - function createRef() { - var refObject = { - current: null - }; - - { - Object.seal(refObject); - } - - return refObject; - } - - function getWrappedName(outerType, innerType, wrapperName) { - var functionName = innerType.displayName || innerType.name || ''; - return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); - } - - function getContextName(type) { - return type.displayName || 'Context'; - } - - function getComponentName(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case exports.Fragment: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case exports.Profiler: - return 'Profiler'; - - case exports.StrictMode: - return 'StrictMode'; - - case exports.Suspense: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - return getComponentName(type.type); - - case REACT_BLOCK_TYPE: - return getComponentName(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentName(init(payload)); - } catch (x) { - return null; - } - } - } - } - - return null; - } - - var hasOwnProperty$1 = Object.prototype.hasOwnProperty; - var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true - }; - var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } - - function hasValidRef(config) { - { - if (hasOwnProperty$1.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; - } - - function hasValidKey(config) { - { - if (hasOwnProperty$1.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; - } - - function defineKeyPropWarningGetter(props, displayName) { - var warnAboutAccessingKey = function () { - { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } - - function defineRefPropWarningGetter(props, displayName) { - var warnAboutAccessingRef = function () { - { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } - - function warnIfStringRefCannotBeAutoConverted(config) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { - var componentName = getComponentName(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - } - /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - - var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; - }; - /** - * Create and return a new ReactElement of the given type. - * See https://reactjs.org/docs/react-api.html#createelement - */ - - function createElement(type, config, children) { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; - var self = null; - var source = null; - - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - - { - warnIfStringRefCannotBeAutoConverted(config); - } - } - - if (hasValidKey(config)) { - key = '' + config.key; - } - - self = config.__self === undefined ? null : config.__self; - source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object - - for (propName in config) { - if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - { - if (Object.freeze) { - Object.freeze(childArray); - } - } - - props.children = childArray; - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - { - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } - function cloneAndReplaceKey(oldElement, newKey) { - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - return newElement; - } - /** - * Clone and return a new ReactElement using element as the starting point. - * See https://reactjs.org/docs/react-api.html#cloneelement - */ - - function cloneElement(element, config, children) { - if (!!(element === null || element === undefined)) { - { - throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." ); - } - } - - var propName; // Original props are copied - - var props = assign({}, element.props); // Reserved names are extracted - - - var key = element.key; - var ref = element.ref; // Self is preserved since the owner is preserved. - - var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a - // transpiler, and the original source is probably a better indicator of the - // true owner. - - var source = element._source; // Owner will be preserved, unless ref is overridden - - var owner = element._owner; - - if (config != null) { - if (hasValidRef(config)) { - // Silently steal the ref from the parent. - ref = config.ref; - owner = ReactCurrentOwner.current; - } - - if (hasValidKey(config)) { - key = '' + config.key; - } // Remaining properties override existing props - - - var defaultProps; - - if (element.type && element.type.defaultProps) { - defaultProps = element.type.defaultProps; - } - - for (propName in config) { - if (hasOwnProperty$1.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - if (config[propName] === undefined && defaultProps !== undefined) { - // Resolve default props - props[propName] = defaultProps[propName]; - } else { - props[propName] = config[propName]; - } - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - props.children = childArray; - } - - return ReactElement(element.type, key, ref, self, source, owner, props); - } - /** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - - function isValidElement(object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } - - var SEPARATOR = '.'; - var SUBSEPARATOR = ':'; - /** - * Escape and wrap key so it is safe to use as a reactid - * - * @param {string} key to be escaped. - * @return {string} the escaped key. - */ - - function escape(key) { - var escapeRegex = /[=:]/g; - var escaperLookup = { - '=': '=0', - ':': '=2' - }; - var escapedString = key.replace(escapeRegex, function (match) { - return escaperLookup[match]; - }); - return '$' + escapedString; - } - /** - * TODO: Test that a single child and an array with one item have the same key - * pattern. - */ - - - var didWarnAboutMaps = false; - var userProvidedKeyEscapeRegex = /\/+/g; - - function escapeUserProvidedKey(text) { - return text.replace(userProvidedKeyEscapeRegex, '$&/'); - } - /** - * Generate a key string that identifies a element within a set. - * - * @param {*} element A element that could contain a manual key. - * @param {number} index Index that is used if a manual key is not provided. - * @return {string} - */ - - - function getElementKey(element, index) { - // Do some typechecking here since we call this blindly. We want to ensure - // that we don't block potential future ES APIs. - if (typeof element === 'object' && element !== null && element.key != null) { - // Explicit key - return escape('' + element.key); - } // Implicit key determined by the index in the set - - - return index.toString(36); - } - - function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - - if (type === 'undefined' || type === 'boolean') { - // All of the above are perceived as null. - children = null; - } - - var invokeCallback = false; - - if (children === null) { - invokeCallback = true; - } else { - switch (type) { - case 'string': - case 'number': - invokeCallback = true; - break; - - case 'object': - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = true; - } - - } - } - - if (invokeCallback) { - var _child = children; - var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array - // so that it's consistent if the number of children grows: - - var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; - - if (Array.isArray(mappedChild)) { - var escapedChildKey = ''; - - if (childKey != null) { - escapedChildKey = escapeUserProvidedKey(childKey) + '/'; - } - - mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { - return c; - }); - } else if (mappedChild != null) { - if (isValidElement(mappedChild)) { - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as - // traverseAllChildren used to do for objects as children - escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key - mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number - escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); - } - - array.push(mappedChild); - } - - return 1; - } - - var child; - var nextName; - var subtreeCount = 0; // Count of children found in the current subtree. - - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - - if (Array.isArray(children)) { - for (var i = 0; i < children.length; i++) { - child = children[i]; - nextName = nextNamePrefix + getElementKey(child, i); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - var iterableChildren = children; - - { - // Warn about using Maps as children - if (iteratorFn === iterableChildren.entries) { - if (!didWarnAboutMaps) { - warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } - } - - var iterator = iteratorFn.call(iterableChildren); - var step; - var ii = 0; - - while (!(step = iterator.next()).done) { - child = step.value; - nextName = nextNamePrefix + getElementKey(child, ii++); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else if (type === 'object') { - var childrenString = '' + children; - - { - { - throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." ); - } - } - } - } - - return subtreeCount; - } - - /** - * Maps children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenmap - * - * The provided mapFunction(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} func The map function. - * @param {*} context Context for mapFunction. - * @return {object} Object containing the ordered map of results. - */ - function mapChildren(children, func, context) { - if (children == null) { - return children; - } - - var result = []; - var count = 0; - mapIntoArray(children, result, '', '', function (child) { - return func.call(context, child, count++); - }); - return result; - } - /** - * Count the number of children that are typically specified as - * `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrencount - * - * @param {?*} children Children tree container. - * @return {number} The number of children. - */ - - - function countChildren(children) { - var n = 0; - mapChildren(children, function () { - n++; // Don't return anything - }); - return n; - } - - /** - * Iterates through children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenforeach - * - * The provided forEachFunc(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} forEachFunc - * @param {*} forEachContext Context for forEachContext. - */ - function forEachChildren(children, forEachFunc, forEachContext) { - mapChildren(children, function () { - forEachFunc.apply(this, arguments); // Don't return anything. - }, forEachContext); - } - /** - * Flatten a children object (typically specified as `props.children`) and - * return an array with appropriately re-keyed children. - * - * See https://reactjs.org/docs/react-api.html#reactchildrentoarray - */ - - - function toArray(children) { - return mapChildren(children, function (child) { - return child; - }) || []; - } - /** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenonly - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. - * - * @param {?object} children Child collection structure. - * @return {ReactElement} The first and only `ReactElement` contained in the - * structure. - */ - - - function onlyChild(children) { - if (!isValidElement(children)) { - { - throw Error( "React.Children.only expected to receive a single React element child." ); - } - } - - return children; - } - - function createContext(defaultValue, calculateChangedBits) { - if (calculateChangedBits === undefined) { - calculateChangedBits = null; - } else { - { - if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') { - error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits); - } - } - } - - var context = { - $$typeof: REACT_CONTEXT_TYPE, - _calculateChangedBits: calculateChangedBits, - // As a workaround to support multiple concurrent renderers, we categorize - // some renderers as primary and others as secondary. We only expect - // there to be two concurrent renderers at most: React Native (primary) and - // Fabric (secondary); React DOM (primary) and React ART (secondary). - // Secondary renderers store their context values on separate fields. - _currentValue: defaultValue, - _currentValue2: defaultValue, - // Used to track how many concurrent renderers this context currently - // supports within in a single renderer. Such as parallel server rendering. - _threadCount: 0, - // These are circular - Provider: null, - Consumer: null - }; - context.Provider = { - $$typeof: REACT_PROVIDER_TYPE, - _context: context - }; - var hasWarnedAboutUsingNestedContextConsumers = false; - var hasWarnedAboutUsingConsumerProvider = false; - var hasWarnedAboutDisplayNameOnConsumer = false; - - { - // A separate object, but proxies back to the original context object for - // backwards compatibility. It has a different $$typeof, so we can properly - // warn for the incorrect usage of Context as a Consumer. - var Consumer = { - $$typeof: REACT_CONTEXT_TYPE, - _context: context, - _calculateChangedBits: context._calculateChangedBits - }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here - - Object.defineProperties(Consumer, { - Provider: { - get: function () { - if (!hasWarnedAboutUsingConsumerProvider) { - hasWarnedAboutUsingConsumerProvider = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Provider; - }, - set: function (_Provider) { - context.Provider = _Provider; - } - }, - _currentValue: { - get: function () { - return context._currentValue; - }, - set: function (_currentValue) { - context._currentValue = _currentValue; - } - }, - _currentValue2: { - get: function () { - return context._currentValue2; - }, - set: function (_currentValue2) { - context._currentValue2 = _currentValue2; - } - }, - _threadCount: { - get: function () { - return context._threadCount; - }, - set: function (_threadCount) { - context._threadCount = _threadCount; - } - }, - Consumer: { - get: function () { - if (!hasWarnedAboutUsingNestedContextConsumers) { - hasWarnedAboutUsingNestedContextConsumers = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Consumer; - } - }, - displayName: { - get: function () { - return context.displayName; - }, - set: function (displayName) { - if (!hasWarnedAboutDisplayNameOnConsumer) { - warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); - - hasWarnedAboutDisplayNameOnConsumer = true; - } - } - } - }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty - - context.Consumer = Consumer; - } - - { - context._currentRenderer = null; - context._currentRenderer2 = null; - } - - return context; - } - - var Uninitialized = -1; - var Pending = 0; - var Resolved = 1; - var Rejected = 2; - - function lazyInitializer(payload) { - if (payload._status === Uninitialized) { - var ctor = payload._result; - var thenable = ctor(); // Transition to the next state. - - var pending = payload; - pending._status = Pending; - pending._result = thenable; - thenable.then(function (moduleObject) { - if (payload._status === Pending) { - var defaultExport = moduleObject.default; - - { - if (defaultExport === undefined) { - error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. - 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); - } - } // Transition to the next state. - - - var resolved = payload; - resolved._status = Resolved; - resolved._result = defaultExport; - } - }, function (error) { - if (payload._status === Pending) { - // Transition to the next state. - var rejected = payload; - rejected._status = Rejected; - rejected._result = error; - } - }); - } - - if (payload._status === Resolved) { - return payload._result; - } else { - throw payload._result; - } - } - - function lazy(ctor) { - var payload = { - // We use these fields to store the result. - _status: -1, - _result: ctor - }; - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: payload, - _init: lazyInitializer - }; - - { - // In production, this would just set it on the object. - var defaultProps; - var propTypes; // $FlowFixMe - - Object.defineProperties(lazyType, { - defaultProps: { - configurable: true, - get: function () { - return defaultProps; - }, - set: function (newDefaultProps) { - error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - defaultProps = newDefaultProps; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'defaultProps', { - enumerable: true - }); - } - }, - propTypes: { - configurable: true, - get: function () { - return propTypes; - }, - set: function (newPropTypes) { - error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - propTypes = newPropTypes; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'propTypes', { - enumerable: true - }); - } - } - }); - } - - return lazyType; - } - - function forwardRef(render) { - { - if (render != null && render.$$typeof === REACT_MEMO_TYPE) { - error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); - } else if (typeof render !== 'function') { - error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); - } else { - if (render.length !== 0 && render.length !== 2) { - error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); - } - } - - if (render != null) { - if (render.defaultProps != null || render.propTypes != null) { - error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); - } - } - } - - var elementType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: render - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - - if (render.displayName == null) { - render.displayName = name; - } - } - }); - } - - return elementType; - } - - // 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 === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || 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 memo(type, compare) { - { - if (!isValidElementType(type)) { - error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); - } - } - - var elementType = { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: compare === undefined ? null : compare - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; - - if (type.displayName == null) { - type.displayName = name; - } - } - }); - } - - return elementType; - } - - function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher.current; - - if (!(dispatcher !== null)) { - { - throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." ); - } - } - - return dispatcher; - } - - function useContext(Context, unstable_observedBits) { - var dispatcher = resolveDispatcher(); - - { - if (unstable_observedBits !== undefined) { - error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : ''); - } // TODO: add a more generic warning for invalid values. - - - if (Context._context !== undefined) { - var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs - // and nobody should be using this in existing code. - - if (realContext.Consumer === Context) { - error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); - } else if (realContext.Provider === Context) { - error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); - } - } - } - - return dispatcher.useContext(Context, unstable_observedBits); - } - function useState(initialState) { - var dispatcher = resolveDispatcher(); - return dispatcher.useState(initialState); - } - function useReducer(reducer, initialArg, init) { - var dispatcher = resolveDispatcher(); - return dispatcher.useReducer(reducer, initialArg, init); - } - function useRef(initialValue) { - var dispatcher = resolveDispatcher(); - return dispatcher.useRef(initialValue); - } - function useEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useEffect(create, deps); - } - function useLayoutEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useLayoutEffect(create, deps); - } - function useCallback(callback, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useCallback(callback, deps); - } - function useMemo(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useMemo(create, deps); - } - function useImperativeHandle(ref, create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useImperativeHandle(ref, create, deps); - } - function useDebugValue(value, formatterFn) { - { - var dispatcher = resolveDispatcher(); - return dispatcher.useDebugValue(value, formatterFn); - } - } - - // Helpers to patch console.logs to avoid logging during side-effect free - // replaying on render function. This currently only patches the object - // lazily which won't cover if the log function was extracted eagerly. - // We could also eagerly patch the method. - var disabledDepth = 0; - var prevLog; - var prevInfo; - var prevWarn; - var prevError; - var prevGroup; - var prevGroupCollapsed; - var prevGroupEnd; - - function disabledLog() {} - - disabledLog.__reactDisabledLog = true; - function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } - } - function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } - } - - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; - var prefix; - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } - } - var reentry = false; - var componentFrameCache; - - { - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); - } - - function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher$1.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher$1.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } - } - - function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case exports.Suspense: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_BLOCK_TYPE: - return describeFunctionComponentFrame(type._render); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; - } - - var loggedTypeFailures = {}; - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } - } - - function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(Object.prototype.hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } - } - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - - var propTypesMisspellWarningShown; - - { - propTypesMisspellWarningShown = false; - } - - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = getComponentName(ReactCurrentOwner.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } - - function getSourceInfoErrorAddendum(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum(elementProps.__source); - } - - return ''; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - - var ownerHasKeyUseWarning = {}; - - function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - - setCurrentlyValidatingElement$1(null); - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - - function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - - if (Array.isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - - function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentName(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentName(type); - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } - } - /** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - - function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement$1(null); - break; - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement$1(null); - } - } - } - function createElementWithValidation(type, props, children) { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendumForProps(props); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (Array.isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - { - error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - } - - var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); - } - } - - if (type === exports.Fragment) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; - } - var didWarnAboutDeprecatedCreateFactory = false; - function createFactoryWithValidation(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - validatedFactory.type = type; - - { - if (!didWarnAboutDeprecatedCreateFactory) { - didWarnAboutDeprecatedCreateFactory = true; - - warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); - } // Legacy hook: remove it - - - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } - - return validatedFactory; - } - function cloneElementWithValidation(element, props, children) { - var newElement = cloneElement.apply(this, arguments); - - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); - } - - validatePropTypes(newElement); - return newElement; - } - - var enableSchedulerDebugging = false; - var enableProfiling = false; - - var requestHostCallback; - var requestHostTimeout; - var cancelHostTimeout; - var shouldYieldToHost; - var requestPaint; - var getCurrentTime; - var forceFrameRate; - var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; - - if (hasPerformanceNow) { - var localPerformance = performance; - - getCurrentTime = function () { - return localPerformance.now(); - }; - } else { - var localDate = Date; - var initialTime = localDate.now(); - - getCurrentTime = function () { - return localDate.now() - initialTime; - }; - } - - if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive - // implementation using setTimeout. - typeof window === 'undefined' || // Check if MessageChannel is supported, too. - typeof MessageChannel !== 'function') { - // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore, - // fallback to a naive implementation. - var _callback = null; - var _timeoutID = null; - - var _flushCallback = function () { - if (_callback !== null) { - try { - var currentTime = getCurrentTime(); - var hasRemainingTime = true; - - _callback(hasRemainingTime, currentTime); - - _callback = null; - } catch (e) { - setTimeout(_flushCallback, 0); - throw e; - } - } - }; - - requestHostCallback = function (cb) { - if (_callback !== null) { - // Protect against re-entrancy. - setTimeout(requestHostCallback, 0, cb); - } else { - _callback = cb; - setTimeout(_flushCallback, 0); - } - }; - - requestHostTimeout = function (cb, ms) { - _timeoutID = setTimeout(cb, ms); - }; - - cancelHostTimeout = function () { - clearTimeout(_timeoutID); - }; - - shouldYieldToHost = function () { - return false; - }; - - requestPaint = forceFrameRate = function () {}; - } else { - // Capture local references to native APIs, in case a polyfill overrides them. - var _setTimeout = window.setTimeout; - var _clearTimeout = window.clearTimeout; - - if (typeof console !== 'undefined') { - // TODO: Scheduler no longer requires these methods to be polyfilled. But - // maybe we want to continue warning if they don't exist, to preserve the - // option to rely on it in the future? - var requestAnimationFrame = window.requestAnimationFrame; - var cancelAnimationFrame = window.cancelAnimationFrame; - - if (typeof requestAnimationFrame !== 'function') { - // Using console['error'] to evade Babel and ESLint - console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); - } - - if (typeof cancelAnimationFrame !== 'function') { - // Using console['error'] to evade Babel and ESLint - console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); - } - } - - var isMessageLoopRunning = false; - var scheduledHostCallback = null; - var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main - // thread, like user events. By default, it yields multiple times per frame. - // It does not attempt to align with frame boundaries, since most tasks don't - // need to be frame aligned; for those that do, use requestAnimationFrame. - - var yieldInterval = 5; - var deadline = 0; // TODO: Make this configurable - - { - // `isInputPending` is not available. Since we have no way of knowing if - // there's pending input, always yield at the end of the frame. - shouldYieldToHost = function () { - return getCurrentTime() >= deadline; - }; // Since we yield every frame regardless, `requestPaint` has no effect. - - - requestPaint = function () {}; - } - - forceFrameRate = function (fps) { - if (fps < 0 || fps > 125) { - // Using console['error'] to evade Babel and ESLint - console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); - return; - } - - if (fps > 0) { - yieldInterval = Math.floor(1000 / fps); - } else { - // reset the framerate - yieldInterval = 5; - } - }; - - var performWorkUntilDeadline = function () { - if (scheduledHostCallback !== null) { - var currentTime = getCurrentTime(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync - // cycle. This means there's always time remaining at the beginning of - // the message event. - - deadline = currentTime + yieldInterval; - var hasTimeRemaining = true; - - try { - var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); - - if (!hasMoreWork) { - isMessageLoopRunning = false; - scheduledHostCallback = null; - } else { - // If there's more work, schedule the next message event at the end - // of the preceding one. - port.postMessage(null); - } - } catch (error) { - // If a scheduler task throws, exit the current browser task so the - // error can be observed. - port.postMessage(null); - throw error; - } - } else { - isMessageLoopRunning = false; - } // Yielding to the browser will give it a chance to paint, so we can - }; - - var channel = new MessageChannel(); - var port = channel.port2; - channel.port1.onmessage = performWorkUntilDeadline; - - requestHostCallback = function (callback) { - scheduledHostCallback = callback; - - if (!isMessageLoopRunning) { - isMessageLoopRunning = true; - port.postMessage(null); - } - }; - - requestHostTimeout = function (callback, ms) { - taskTimeoutID = _setTimeout(function () { - callback(getCurrentTime()); - }, ms); - }; - - cancelHostTimeout = function () { - _clearTimeout(taskTimeoutID); - - taskTimeoutID = -1; - }; - } - - function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); - } - function peek(heap) { - var first = heap[0]; - return first === undefined ? null : first; - } - function pop(heap) { - var first = heap[0]; - - if (first !== undefined) { - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } else { - return null; - } - } - - function siftUp(heap, node, i) { - var index = i; - - while (true) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (parent !== undefined && compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } - } - - function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - - while (index < length) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (left !== undefined && compare(left, node) < 0) { - if (right !== undefined && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (right !== undefined && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } - } - - function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; - } - - // TODO: Use symbols? - var ImmediatePriority = 1; - var UserBlockingPriority = 2; - var NormalPriority = 3; - var LowPriority = 4; - var IdlePriority = 5; - - function markTaskErrored(task, ms) { - } - - /* eslint-disable no-var */ - // Math.pow(2, 30) - 1 - // 0b111111111111111111111111111111 - - var maxSigned31BitInt = 1073741823; // Times out immediately - - var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - - var USER_BLOCKING_PRIORITY_TIMEOUT = 250; - var NORMAL_PRIORITY_TIMEOUT = 5000; - var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - - var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap - - var taskQueue = []; - var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - - var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. - var currentTask = null; - var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. - - var isPerformingWork = false; - var isHostCallbackScheduled = false; - var isHostTimeoutScheduled = false; - - function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } - } - - function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } - } - - function flushWork(hasTimeRemaining, initialTime) { - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = getCurrentTime(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod code path. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - } - } - - function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (typeof callback === 'function') { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = getCurrentTime(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - } else { - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } - } - - function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; - } - - function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = getCurrentTime(); - var startTime; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - } else { - startTime = currentTime; - } - - var timeout; - - switch (priorityLevel) { - case ImmediatePriority: - timeout = IMMEDIATE_PRIORITY_TIMEOUT; - break; - - case UserBlockingPriority: - timeout = USER_BLOCKING_PRIORITY_TIMEOUT; - break; - - case IdlePriority: - timeout = IDLE_PRIORITY_TIMEOUT; - break; - - case LowPriority: - timeout = LOW_PRIORITY_TIMEOUT; - break; - - case NormalPriority: - default: - timeout = NORMAL_PRIORITY_TIMEOUT; - break; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; - } - - function unstable_pauseExecution() { - } - - function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - function unstable_getFirstCallbackNode() { - return peek(taskQueue); - } - - function unstable_cancelCallback(task) { - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; - } - - function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; - } - - var unstable_requestPaint = requestPaint; - var unstable_Profiling = null; - - - - var Scheduler = /*#__PURE__*/Object.freeze({ - __proto__: null, - unstable_ImmediatePriority: ImmediatePriority, - unstable_UserBlockingPriority: UserBlockingPriority, - unstable_NormalPriority: NormalPriority, - unstable_IdlePriority: IdlePriority, - unstable_LowPriority: LowPriority, - unstable_runWithPriority: unstable_runWithPriority, - unstable_next: unstable_next, - unstable_scheduleCallback: unstable_scheduleCallback, - unstable_cancelCallback: unstable_cancelCallback, - unstable_wrapCallback: unstable_wrapCallback, - unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, - get unstable_shouldYield () { return shouldYieldToHost; }, - unstable_requestPaint: unstable_requestPaint, - unstable_continueExecution: unstable_continueExecution, - unstable_pauseExecution: unstable_pauseExecution, - unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, - get unstable_now () { return getCurrentTime; }, - get unstable_forceFrameRate () { return forceFrameRate; }, - unstable_Profiling: unstable_Profiling - }); - - var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs. - - var interactionIDCounter = 0; - var threadIDCounter = 0; // Set of currently traced interactions. - // Interactions "stack"– - // Meaning that newly traced interactions are appended to the previously active set. - // When an interaction goes out of scope, the previous set (if any) is restored. - - var interactionsRef = null; // Listener(s) to notify when interactions begin and end. - - var subscriberRef = null; - - { - interactionsRef = { - current: new Set() - }; - subscriberRef = { - current: null - }; - } - function unstable_clear(callback) { - - var prevInteractions = interactionsRef.current; - interactionsRef.current = new Set(); - - try { - return callback(); - } finally { - interactionsRef.current = prevInteractions; - } - } - function unstable_getCurrent() { - { - return interactionsRef.current; - } - } - function unstable_getThreadID() { - return ++threadIDCounter; - } - function unstable_trace(name, timestamp, callback) { - var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID; - - var interaction = { - __count: 1, - id: interactionIDCounter++, - name: name, - timestamp: timestamp - }; - var prevInteractions = interactionsRef.current; // Traced interactions should stack/accumulate. - // To do that, clone the current interactions. - // The previous set will be restored upon completion. - - var interactions = new Set(prevInteractions); - interactions.add(interaction); - interactionsRef.current = interactions; - var subscriber = subscriberRef.current; - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onInteractionTraced(interaction); - } - } finally { - try { - if (subscriber !== null) { - subscriber.onWorkStarted(interactions, threadID); - } - } finally { - try { - returnValue = callback(); - } finally { - interactionsRef.current = prevInteractions; - - try { - if (subscriber !== null) { - subscriber.onWorkStopped(interactions, threadID); - } - } finally { - interaction.__count--; // If no async work was scheduled for this interaction, - // Notify subscribers that it's completed. - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - } - } - } - } - - return returnValue; - } - function unstable_wrap(callback) { - var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID; - - var wrappedInteractions = interactionsRef.current; - var subscriber = subscriberRef.current; - - if (subscriber !== null) { - subscriber.onWorkScheduled(wrappedInteractions, threadID); - } // Update the pending async work count for the current interactions. - // Update after calling subscribers in case of error. - - - wrappedInteractions.forEach(function (interaction) { - interaction.__count++; - }); - var hasRun = false; - - function wrapped() { - var prevInteractions = interactionsRef.current; - interactionsRef.current = wrappedInteractions; - subscriber = subscriberRef.current; - - try { - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onWorkStarted(wrappedInteractions, threadID); - } - } finally { - try { - returnValue = callback.apply(undefined, arguments); - } finally { - interactionsRef.current = prevInteractions; - - if (subscriber !== null) { - subscriber.onWorkStopped(wrappedInteractions, threadID); - } - } - } - - return returnValue; - } finally { - if (!hasRun) { - // We only expect a wrapped function to be executed once, - // But in the event that it's executed more than once– - // Only decrement the outstanding interaction counts once. - hasRun = true; // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - } - } - - wrapped.cancel = function cancel() { - subscriber = subscriberRef.current; - - try { - if (subscriber !== null) { - subscriber.onWorkCanceled(wrappedInteractions, threadID); - } - } finally { - // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - }; - - return wrapped; - } - - var subscribers = null; - - { - subscribers = new Set(); - } - - function unstable_subscribe(subscriber) { - { - subscribers.add(subscriber); - - if (subscribers.size === 1) { - subscriberRef.current = { - onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted, - onInteractionTraced: onInteractionTraced, - onWorkCanceled: onWorkCanceled, - onWorkScheduled: onWorkScheduled, - onWorkStarted: onWorkStarted, - onWorkStopped: onWorkStopped - }; - } - } - } - function unstable_unsubscribe(subscriber) { - { - subscribers.delete(subscriber); - - if (subscribers.size === 0) { - subscriberRef.current = null; - } - } - } - - function onInteractionTraced(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionTraced(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onInteractionScheduledWorkCompleted(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkScheduled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkScheduled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkStarted(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkStopped(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStopped(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - function onWorkCanceled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkCanceled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } - } - - - - var SchedulerTracing = /*#__PURE__*/Object.freeze({ - __proto__: null, - get __interactionsRef () { return interactionsRef; }, - get __subscriberRef () { return subscriberRef; }, - unstable_clear: unstable_clear, - unstable_getCurrent: unstable_getCurrent, - unstable_getThreadID: unstable_getThreadID, - unstable_trace: unstable_trace, - unstable_wrap: unstable_wrap, - unstable_subscribe: unstable_subscribe, - unstable_unsubscribe: unstable_unsubscribe - }); - - var ReactSharedInternals$1 = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentOwner: ReactCurrentOwner, - IsSomeRendererActing: IsSomeRendererActing, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - // Used by renderers to avoid bundling object-assign twice in UMD bundles: - assign: assign, - // Re-export the schedule API(s) for UMD bundles. - // This avoids introducing a dependency on a new UMD global in a minor update, - // Since that would be a breaking change (e.g. for all existing CodeSandboxes). - // This re-export is only required for UMD bundles; - // CJS bundles use the shared NPM package. - Scheduler: Scheduler, - SchedulerTracing: SchedulerTracing - }; - - { - ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame; - } - - { - - try { - var frozenObject = Object.freeze({}); - /* eslint-disable no-new */ - - new Map([[frozenObject, null]]); - new Set([frozenObject]); - /* eslint-enable no-new */ - } catch (e) { - } - } - - var createElement$1 = createElementWithValidation ; - var cloneElement$1 = cloneElementWithValidation ; - var createFactory = createFactoryWithValidation ; - var Children = { - map: mapChildren, - forEach: forEachChildren, - count: countChildren, - toArray: toArray, - only: onlyChild - }; - - exports.Children = Children; - exports.Component = Component; - exports.PureComponent = PureComponent; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1; - exports.cloneElement = cloneElement$1; - exports.createContext = createContext; - exports.createElement = createElement$1; - exports.createFactory = createFactory; - exports.createRef = createRef; - exports.forwardRef = forwardRef; - exports.isValidElement = isValidElement; - exports.lazy = lazy; - exports.memo = memo; - exports.useCallback = useCallback; - exports.useContext = useContext; - exports.useDebugValue = useDebugValue; - exports.useEffect = useEffect; - exports.useImperativeHandle = useImperativeHandle; - exports.useLayoutEffect = useLayoutEffect; - exports.useMemo = useMemo; - exports.useReducer = useReducer; - exports.useRef = useRef; - exports.useState = useState; - exports.version = ReactVersion; - -}))); diff --git a/node_modules/react/umd/react.production.min.js b/node_modules/react/umd/react.production.min.js deleted file mode 100644 index 95f2ce7afbc41..0000000000000 --- a/node_modules/react/umd/react.production.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/** @license React v17.0.2 - * react.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. - */ -(function(){'use strict';(function(c,x){"object"===typeof exports&&"undefined"!==typeof module?x(exports):"function"===typeof define&&define.amd?define(["exports"],x):(c=c||self,x(c.React={}))})(this,function(c){function x(a){if(null===a||"object"!==typeof a)return null;a=Y&&a[Y]||a["@@iterator"];return"function"===typeof a?a:null}function y(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,e=1;e>>1,f=a[c];if(void 0!==f&&0E(g,e))void 0!==h&&0>E(h,g)?(a[c]=h,a[k]=e,c=k):(a[c]=g,a[d]=e,c=d);else if(void 0!==h&&0>E(h,e))a[c]=h,a[k]=e,c=k;else break a}}return b}return null}function E(a,b){var e=a.sortIndex-b.sortIndex;return 0!==e?e:a.id-b.id}function P(a){for(var b=p(r);null!==b;){if(null===b.callback)F(r);else if(b.startTime<=a)F(r),b.sortIndex=b.expirationTime,O(q,b);else break;b=p(r)}} -function Q(a){z=!1;P(a);if(!u)if(null!==p(q))u=!0,A(R);else{var b=p(r);null!==b&&G(Q,b.startTime-a)}}function R(a,b){u=!1;z&&(z=!1,S());H=!0;var e=g;try{P(b);for(m=p(q);null!==m&&(!(m.expirationTime>b)||a&&!T());){var c=m.callback;if("function"===typeof c){m.callback=null;g=m.priorityLevel;var f=c(m.expirationTime<=b);b=t();"function"===typeof f?m.callback=f:m===p(q)&&F(q);P(b)}else F(q);m=p(q)}if(null!==m)var d=!0;else{var n=p(r);null!==n&&G(Q,n.startTime-b);d=!1}return d}finally{m=null,g=e,H=!1}} -var w=60103,ha=60106;c.Fragment=60107;c.StrictMode=60108;c.Profiler=60114;var ka=60109,la=60110,ma=60112;c.Suspense=60113;var na=60115,oa=60116;if("function"===typeof Symbol&&Symbol.for){var d=Symbol.for;w=d("react.element");ha=d("react.portal");c.Fragment=d("react.fragment");c.StrictMode=d("react.strict_mode");c.Profiler=d("react.profiler");ka=d("react.provider");la=d("react.context");ma=d("react.forward_ref");c.Suspense=d("react.suspense");na=d("react.memo");oa=d("react.lazy")}var Y="function"=== -typeof Symbol&&Symbol.iterator,ya=Object.prototype.hasOwnProperty,U=Object.assign||function(a,b){if(null==a)throw new TypeError("Object.assign target cannot be null or undefined");for(var e=Object(a),c=1;c=ta};d=function(){};V=function(a){0>a||125d?(a.sortIndex= -c,O(r,a),null===p(q)&&a===p(r)&&(z?S():z=!0,G(Q,c-d))):(a.sortIndex=e,O(q,a),u||H||(u=!0,A(R)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=g;return function(){var c=g;g=b;try{return a.apply(this,arguments)}finally{g=c}}},unstable_getCurrentPriorityLevel:function(){return g},get unstable_shouldYield(){return T},unstable_requestPaint:d,unstable_continueExecution:function(){u||H||(u=!0,A(R))},unstable_pauseExecution:function(){},unstable_getFirstCallbackNode:function(){return p(q)}, -get unstable_now(){return t},get unstable_forceFrameRate(){return V},unstable_Profiling:null},SchedulerTracing:{__proto__:null,__interactionsRef:null,__subscriberRef:null,unstable_clear:function(a){return a()},unstable_getCurrent:function(){return null},unstable_getThreadID:function(){return++Ea},unstable_trace:function(a,b,c){return c()},unstable_wrap:function(a){return a},unstable_subscribe:function(a){},unstable_unsubscribe:function(a){}}};c.Children={map:D,forEach:function(a,b,c){D(a,function(){b.apply(this, -arguments)},c)},count:function(a){var b=0;D(a,function(){b++});return b},toArray:function(a){return D(a,function(a){return a})||[]},only:function(a){if(!M(a))throw Error(y(143));return a}};c.Component=v;c.PureComponent=K;c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=d;c.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(y(267,a));var d=U({},a.props),e=a.key,g=a.ref,n=a._owner;if(null!=b){void 0!==b.ref&&(g=b.ref,n=L.current);void 0!==b.key&&(e=""+b.key);if(a.type&&a.type.defaultProps)var k= -a.type.defaultProps;for(h in b)ea.call(b,h)&&!fa.hasOwnProperty(h)&&(d[h]=void 0===b[h]&&void 0!==k?k[h]:b[h])}var h=arguments.length-2;if(1===h)d.children=c;else if(1>>1,d=a[e];if(void 0!==d&&0J(h,c))void 0!==n&&0>J(n,h)?(a[e]=n,a[k]=c,e=k):(a[e]=h,a[f]=c,e=f);else if(void 0!==n&&0>J(n,c))a[e]=n,a[k]=c,e=k;else break a}}return b}return null}function J(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}function U(a){for(var b=r(w);null!==b;){if(null===b.callback)K(w);else if(b.startTime<=a)K(w),b.sortIndex=b.expirationTime,T(u,b);else break;b=r(w)}} -function V(a){E=!1;U(a);if(!z)if(null!==r(u))z=!0,F(W);else{var b=r(w);null!==b&&L(V,b.startTime-a)}}function W(a,b){z=!1;E&&(E=!1,X());M=!0;var c=m;try{U(b);for(q=r(u);null!==q&&(!(q.expirationTime>b)||a&&!Y());){var e=q.callback;if("function"===typeof e){q.callback=null;m=q.priorityLevel;var d=e(q.expirationTime<=b);b=x();"function"===typeof d?q.callback=d:q===r(u)&&K(u);U(b)}else K(u);q=r(u)}if(null!==q)var f=!0;else{var h=r(w);null!==h&&L(V,h.startTime-b);f=!1}return f}finally{q=null,m=c,M=!1}} -function Ca(a){var b=!1,c=null;t.forEach(function(e){try{e.onInteractionTraced(a)}catch(d){b||(b=!0,c=d)}});if(b)throw c;}function Da(a){var b=!1,c=null;t.forEach(function(e){try{e.onInteractionScheduledWorkCompleted(a)}catch(d){b||(b=!0,c=d)}});if(b)throw c;}function Ea(a,b){var c=!1,e=null;t.forEach(function(d){try{d.onWorkScheduled(a,b)}catch(l){c||(c=!0,e=l)}});if(c)throw e;}function Fa(a,b){var c=!1,e=null;t.forEach(function(d){try{d.onWorkStarted(a,b)}catch(l){c||(c=!0,e=l)}});if(c)throw e; -}function Ga(a,b){var c=!1,e=null;t.forEach(function(d){try{d.onWorkStopped(a,b)}catch(l){c||(c=!0,e=l)}});if(c)throw e;}function Ha(a,b){var c=!1,e=null;t.forEach(function(d){try{d.onWorkCanceled(a,b)}catch(l){c||(c=!0,e=l)}});if(c)throw e;}var B=60103,la=60106;f.Fragment=60107;f.StrictMode=60108;f.Profiler=60114;var oa=60109,pa=60110,qa=60112;f.Suspense=60113;var ra=60115,sa=60116;if("function"===typeof Symbol&&Symbol.for){var g=Symbol.for;B=g("react.element");la=g("react.portal");f.Fragment=g("react.fragment"); -f.StrictMode=g("react.strict_mode");f.Profiler=g("react.profiler");oa=g("react.provider");pa=g("react.context");qa=g("react.forward_ref");f.Suspense=g("react.suspense");ra=g("react.memo");sa=g("react.lazy")}var da="function"===typeof Symbol&&Symbol.iterator,Ia=Object.prototype.hasOwnProperty,Z=Object.assign||function(a,b){if(null==a)throw new TypeError("Object.assign target cannot be null or undefined");for(var c=Object(a),e=1;e=xa};g=function(){};aa=function(a){0>a||125e?(a.sortIndex=c,T(w,a),null===r(u)&&a===r(w)&&(E?X():E=!0,L(V,c-e))):(a.sortIndex=d,T(u,a),z||M||(z=!0,F(W)));return a},unstable_cancelCallback:function(a){a.callback=null},unstable_wrapCallback:function(a){var b=m;return function(){var c=m;m=b;try{return a.apply(this,arguments)}finally{m=c}}},unstable_getCurrentPriorityLevel:function(){return m},get unstable_shouldYield(){return Y},unstable_requestPaint:g,unstable_continueExecution:function(){z||M||(z=!0,F(W))},unstable_pauseExecution:function(){}, -unstable_getFirstCallbackNode:function(){return r(u)},get unstable_now(){return x},get unstable_forceFrameRate(){return aa},unstable_Profiling:null};var Oa=0,Pa=0,p=null,y=null;p={current:new Set};y={current:null};var t=null;t=new Set;g={ReactCurrentDispatcher:na,ReactCurrentOwner:Q,IsSomeRendererActing:{current:!1},ReactCurrentBatchConfig:{transition:0},assign:Z,Scheduler:g,SchedulerTracing:{__proto__:null,get __interactionsRef(){return p},get __subscriberRef(){return y},unstable_clear:function(a){var b= -p.current;p.current=new Set;try{return a()}finally{p.current=b}},unstable_getCurrent:function(){return p.current},unstable_getThreadID:function(){return++Pa},unstable_trace:function(a,b,c){var e=3 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID; - - var interaction = { - __count: 1, - id: interactionIDCounter++, - name: name, - timestamp: timestamp - }; - var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate. - // To do that, clone the current interactions. - // The previous set will be restored upon completion. - - var interactions = new Set(prevInteractions); - interactions.add(interaction); - exports.__interactionsRef.current = interactions; - var subscriber = exports.__subscriberRef.current; - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onInteractionTraced(interaction); - } - } finally { - try { - if (subscriber !== null) { - subscriber.onWorkStarted(interactions, threadID); - } - } finally { - try { - returnValue = callback(); - } finally { - exports.__interactionsRef.current = prevInteractions; - - try { - if (subscriber !== null) { - subscriber.onWorkStopped(interactions, threadID); - } - } finally { - interaction.__count--; // If no async work was scheduled for this interaction, - // Notify subscribers that it's completed. - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - } - } - } - } - - return returnValue; -} -function unstable_wrap(callback) { - var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID; - - var wrappedInteractions = exports.__interactionsRef.current; - var subscriber = exports.__subscriberRef.current; - - if (subscriber !== null) { - subscriber.onWorkScheduled(wrappedInteractions, threadID); - } // Update the pending async work count for the current interactions. - // Update after calling subscribers in case of error. - - - wrappedInteractions.forEach(function (interaction) { - interaction.__count++; - }); - var hasRun = false; - - function wrapped() { - var prevInteractions = exports.__interactionsRef.current; - exports.__interactionsRef.current = wrappedInteractions; - subscriber = exports.__subscriberRef.current; - - try { - var returnValue; - - try { - if (subscriber !== null) { - subscriber.onWorkStarted(wrappedInteractions, threadID); - } - } finally { - try { - returnValue = callback.apply(undefined, arguments); - } finally { - exports.__interactionsRef.current = prevInteractions; - - if (subscriber !== null) { - subscriber.onWorkStopped(wrappedInteractions, threadID); - } - } - } - - return returnValue; - } finally { - if (!hasRun) { - // We only expect a wrapped function to be executed once, - // But in the event that it's executed more than once– - // Only decrement the outstanding interaction counts once. - hasRun = true; // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber !== null && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - } - } - - wrapped.cancel = function cancel() { - subscriber = exports.__subscriberRef.current; - - try { - if (subscriber !== null) { - subscriber.onWorkCanceled(wrappedInteractions, threadID); - } - } finally { - // Update pending async counts for all wrapped interactions. - // If this was the last scheduled async work for any of them, - // Mark them as completed. - wrappedInteractions.forEach(function (interaction) { - interaction.__count--; - - if (subscriber && interaction.__count === 0) { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } - }); - } - }; - - return wrapped; -} - -var subscribers = null; - -{ - subscribers = new Set(); -} - -function unstable_subscribe(subscriber) { - { - subscribers.add(subscriber); - - if (subscribers.size === 1) { - exports.__subscriberRef.current = { - onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted, - onInteractionTraced: onInteractionTraced, - onWorkCanceled: onWorkCanceled, - onWorkScheduled: onWorkScheduled, - onWorkStarted: onWorkStarted, - onWorkStopped: onWorkStopped - }; - } - } -} -function unstable_unsubscribe(subscriber) { - { - subscribers.delete(subscriber); - - if (subscribers.size === 0) { - exports.__subscriberRef.current = null; - } - } -} - -function onInteractionTraced(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionTraced(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -function onInteractionScheduledWorkCompleted(interaction) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onInteractionScheduledWorkCompleted(interaction); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -function onWorkScheduled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkScheduled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -function onWorkStarted(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStarted(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -function onWorkStopped(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkStopped(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -function onWorkCanceled(interactions, threadID) { - var didCatchError = false; - var caughtError = null; - subscribers.forEach(function (subscriber) { - try { - subscriber.onWorkCanceled(interactions, threadID); - } catch (error) { - if (!didCatchError) { - didCatchError = true; - caughtError = error; - } - } - }); - - if (didCatchError) { - throw caughtError; - } -} - -exports.unstable_clear = unstable_clear; -exports.unstable_getCurrent = unstable_getCurrent; -exports.unstable_getThreadID = unstable_getThreadID; -exports.unstable_subscribe = unstable_subscribe; -exports.unstable_trace = unstable_trace; -exports.unstable_unsubscribe = unstable_unsubscribe; -exports.unstable_wrap = unstable_wrap; - })(); -} diff --git a/node_modules/scheduler/cjs/scheduler-tracing.production.min.js b/node_modules/scheduler/cjs/scheduler-tracing.production.min.js deleted file mode 100644 index b8a3c785aa9dd..0000000000000 --- a/node_modules/scheduler/cjs/scheduler-tracing.production.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @license React v0.20.2 - * scheduler-tracing.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. - */ -'use strict';var b=0;exports.__interactionsRef=null;exports.__subscriberRef=null;exports.unstable_clear=function(a){return a()};exports.unstable_getCurrent=function(){return null};exports.unstable_getThreadID=function(){return++b};exports.unstable_subscribe=function(){};exports.unstable_trace=function(a,d,c){return c()};exports.unstable_unsubscribe=function(){};exports.unstable_wrap=function(a){return a}; diff --git a/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js b/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js deleted file mode 100644 index a0565a0f3e674..0000000000000 --- a/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js +++ /dev/null @@ -1,16 +0,0 @@ -/** @license React v0.20.2 - * scheduler-tracing.profiling.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. - */ -'use strict';var g=0,l=0;exports.__interactionsRef=null;exports.__subscriberRef=null;exports.__interactionsRef={current:new Set};exports.__subscriberRef={current:null};var m=null;m=new Set;function n(e){var d=!1,a=null;m.forEach(function(c){try{c.onInteractionTraced(e)}catch(b){d||(d=!0,a=b)}});if(d)throw a;}function p(e){var d=!1,a=null;m.forEach(function(c){try{c.onInteractionScheduledWorkCompleted(e)}catch(b){d||(d=!0,a=b)}});if(d)throw a;} -function q(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkScheduled(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function r(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkStarted(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function t(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkStopped(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;}function u(e,d){var a=!1,c=null;m.forEach(function(b){try{b.onWorkCanceled(e,d)}catch(f){a||(a=!0,c=f)}});if(a)throw c;} -exports.unstable_clear=function(e){var d=exports.__interactionsRef.current;exports.__interactionsRef.current=new Set;try{return e()}finally{exports.__interactionsRef.current=d}};exports.unstable_getCurrent=function(){return exports.__interactionsRef.current};exports.unstable_getThreadID=function(){return++l}; -exports.unstable_subscribe=function(e){m.add(e);1===m.size&&(exports.__subscriberRef.current={onInteractionScheduledWorkCompleted:p,onInteractionTraced:n,onWorkCanceled:u,onWorkScheduled:q,onWorkStarted:r,onWorkStopped:t})}; -exports.unstable_trace=function(e,d,a){var c=3= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { - // We yielded at least as many values as expected. Stop flushing. - didStop = true; - return true; - } - - return false; -} -function getCurrentTime() { - return currentTime; -} -function forceFrameRate() {// No-op -} - -function unstable_flushNumberOfYields(count) { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - expectedNumberOfYields = count; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork && !didStop); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - expectedNumberOfYields = -1; - didStop = false; - isFlushing = false; - } - } -} -function unstable_flushUntilNextPaint() { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - shouldYieldForPaint = true; - needsPaint = false; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork && !didStop); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - shouldYieldForPaint = false; - didStop = false; - isFlushing = false; - } - } -} -function unstable_flushExpired() { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - isFlushing = true; - - try { - var hasMoreWork = scheduledCallback(false, currentTime); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - isFlushing = false; - } - } -} -function unstable_flushAllWithoutAsserting() { - // Returns false if no work was flushed. - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork); - - if (!hasMoreWork) { - scheduledCallback = null; - } - - return true; - } finally { - isFlushing = false; - } - } else { - return false; - } -} -function unstable_clearYields() { - if (yieldedValues === null) { - return []; - } - - var values = yieldedValues; - yieldedValues = null; - return values; -} -function unstable_flushAll() { - if (yieldedValues !== null) { - throw new Error('Log is not empty. Assert on the log of yielded values before ' + 'flushing additional work.'); - } - - unstable_flushAllWithoutAsserting(); - - if (yieldedValues !== null) { - throw new Error('While flushing work, something yielded a value. Use an ' + 'assertion helper to assert on the log of yielded values, e.g. ' + 'expect(Scheduler).toFlushAndYield([...])'); - } -} -function unstable_yieldValue(value) { - // eslint-disable-next-line react-internal/no-production-logging - if (console.log.name === 'disabledLog') { - // If console.log has been patched, we assume we're in render - // replaying and we ignore any values yielding in the second pass. - return; - } - - if (yieldedValues === null) { - yieldedValues = [value]; - } else { - yieldedValues.push(value); - } -} -function unstable_advanceTime(ms) { - // eslint-disable-next-line react-internal/no-production-logging - if (console.log.name === 'disabledLog') { - // If console.log has been patched, we assume we're in render - // replaying and we ignore any time advancing in the second pass. - return; - } - - currentTime += ms; - - if (scheduledTimeout !== null && timeoutTime <= currentTime) { - scheduledTimeout(currentTime); - timeoutTime = -1; - scheduledTimeout = null; - } -} -function requestPaint() { - needsPaint = true; -} - -function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); -} -function peek(heap) { - var first = heap[0]; - return first === undefined ? null : first; -} -function pop(heap) { - var first = heap[0]; - - if (first !== undefined) { - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } else { - return null; - } -} - -function siftUp(heap, node, i) { - var index = i; - - while (true) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (parent !== undefined && compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } -} - -function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - - while (index < length) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (left !== undefined && compare(left, node) < 0) { - if (right !== undefined && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (right !== undefined && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } -} - -function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; -} - -// TODO: Use symbols? -var ImmediatePriority = 1; -var UserBlockingPriority = 2; -var NormalPriority = 3; -var LowPriority = 4; -var IdlePriority = 5; - -function markTaskErrored(task, ms) { -} - -/* eslint-disable no-var */ -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 - -var maxSigned31BitInt = 1073741823; // Times out immediately - -var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - -var USER_BLOCKING_PRIORITY_TIMEOUT = 250; -var NORMAL_PRIORITY_TIMEOUT = 5000; -var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - -var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap - -var taskQueue = []; -var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - -var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. -var currentTask = null; -var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. - -var isPerformingWork = false; -var isHostCallbackScheduled = false; -var isHostTimeoutScheduled = false; - -function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } -} - -function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } -} - -function flushWork(hasTimeRemaining, initialTime) { - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = getCurrentTime(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod code path. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - } -} - -function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (typeof callback === 'function') { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = getCurrentTime(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - } else { - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } -} - -function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } -} - -function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } -} - -function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; -} - -function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = getCurrentTime(); - var startTime; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - } else { - startTime = currentTime; - } - - var timeout; - - switch (priorityLevel) { - case ImmediatePriority: - timeout = IMMEDIATE_PRIORITY_TIMEOUT; - break; - - case UserBlockingPriority: - timeout = USER_BLOCKING_PRIORITY_TIMEOUT; - break; - - case IdlePriority: - timeout = IDLE_PRIORITY_TIMEOUT; - break; - - case LowPriority: - timeout = LOW_PRIORITY_TIMEOUT; - break; - - case NormalPriority: - default: - timeout = NORMAL_PRIORITY_TIMEOUT; - break; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; -} - -function unstable_pauseExecution() { -} - -function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } -} - -function unstable_getFirstCallbackNode() { - return peek(taskQueue); -} - -function unstable_cancelCallback(task) { - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; -} - -function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; -} - -var unstable_requestPaint = requestPaint; -var unstable_Profiling = null; - -exports.unstable_IdlePriority = IdlePriority; -exports.unstable_ImmediatePriority = ImmediatePriority; -exports.unstable_LowPriority = LowPriority; -exports.unstable_NormalPriority = NormalPriority; -exports.unstable_Profiling = unstable_Profiling; -exports.unstable_UserBlockingPriority = UserBlockingPriority; -exports.unstable_advanceTime = unstable_advanceTime; -exports.unstable_cancelCallback = unstable_cancelCallback; -exports.unstable_clearYields = unstable_clearYields; -exports.unstable_continueExecution = unstable_continueExecution; -exports.unstable_flushAll = unstable_flushAll; -exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting; -exports.unstable_flushExpired = unstable_flushExpired; -exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields; -exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint; -exports.unstable_forceFrameRate = forceFrameRate; -exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; -exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; -exports.unstable_next = unstable_next; -exports.unstable_now = getCurrentTime; -exports.unstable_pauseExecution = unstable_pauseExecution; -exports.unstable_requestPaint = unstable_requestPaint; -exports.unstable_runWithPriority = unstable_runWithPriority; -exports.unstable_scheduleCallback = unstable_scheduleCallback; -exports.unstable_shouldYield = shouldYieldToHost; -exports.unstable_wrapCallback = unstable_wrapCallback; -exports.unstable_yieldValue = unstable_yieldValue; - })(); -} diff --git a/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js b/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js deleted file mode 100644 index d9bb788ff9c9c..0000000000000 --- a/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/** @license React v0.20.2 - * scheduler-unstable_mock.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. - */ -'use strict';var f=0,g=null,h=null,k=-1,l=null,m=-1,n=!1,p=!1,q=!1,r=!1;function t(){return-1!==m&&null!==l&&l.length>=m||r&&q?n=!0:!1}function x(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;p=!0;try{var b=!0;do b=a(!0,f);while(b);b||(g=null);return!0}finally{p=!1}}else return!1}function z(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0A(v,c))void 0!==y&&0>A(y,v)?(a[d]=y,a[w]=c,d=w):(a[d]=v,a[u]=c,d=u);else if(void 0!==y&&0>A(y,c))a[d]=y,a[w]=c,d=w;else break a}}return b}return null}function A(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var D=[],E=[],F=1,G=null,H=3,I=!1,J=!1,K=!1; -function L(a){for(var b=B(E);null!==b;){if(null===b.callback)C(E);else if(b.startTime<=a)C(E),b.sortIndex=b.expirationTime,z(D,b);else break;b=B(E)}}function M(a){K=!1;L(a);if(!J)if(null!==B(D))J=!0,g=N;else{var b=B(E);null!==b&&(a=b.startTime-a,h=M,k=f+a)}} -function N(a,b){J=!1;K&&(K=!1,h=null,k=-1);I=!0;var c=H;try{L(b);for(G=B(D);null!==G&&(!(G.expirationTime>b)||a&&!t());){var d=G.callback;if("function"===typeof d){G.callback=null;H=G.priorityLevel;var e=d(G.expirationTime<=b);b=f;"function"===typeof e?G.callback=e:G===B(D)&&C(D);L(b)}else C(D);G=B(D)}if(null!==G)var u=!0;else{var v=B(E);if(null!==v){var w=v.startTime-b;h=M;k=f+w}u=!1}return u}finally{G=null,H=c,I=!1}}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1; -exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_advanceTime=function(a){"disabledLog"!==console.log.name&&(f+=a,null!==h&&k<=f&&(h(f),k=-1,h=null))};exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_clearYields=function(){if(null===l)return[];var a=l;l=null;return a};exports.unstable_continueExecution=function(){J||I||(J=!0,g=N)}; -exports.unstable_flushAll=function(){if(null!==l)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");x();if(null!==l)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};exports.unstable_flushAllWithoutAsserting=x; -exports.unstable_flushExpired=function(){if(p)throw Error("Already flushing work.");if(null!==g){p=!0;try{g(!1,f)||(g=null)}finally{p=!1}}};exports.unstable_flushNumberOfYields=function(a){if(p)throw Error("Already flushing work.");if(null!==g){var b=g;m=a;p=!0;try{a=!0;do a=b(!0,f);while(a&&!n);a||(g=null)}finally{m=-1,p=n=!1}}}; -exports.unstable_flushUntilNextPaint=function(){if(p)throw Error("Already flushing work.");if(null!==g){var a=g;r=!0;q=!1;p=!0;try{var b=!0;do b=a(!0,f);while(b&&!n);b||(g=null)}finally{p=n=r=!1}}};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return H};exports.unstable_getFirstCallbackNode=function(){return B(D)};exports.unstable_next=function(a){switch(H){case 1:case 2:case 3:var b=3;break;default:b=H}var c=H;H=b;try{return a()}finally{H=c}}; -exports.unstable_now=function(){return f};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){q=!0};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=H;H=a;try{return b()}finally{H=c}}; -exports.unstable_scheduleCallback=function(a,b,c){var d=f;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0d?(a.sortIndex=c,z(E,a),null===B(D)&&a===B(E)&&(K?(h=null,k=-1):K=!0,h=M,k=f+(c-d))):(a.sortIndex=e,z(D,a),J||I||(J=!0,g=N));return a};exports.unstable_shouldYield=t; -exports.unstable_wrapCallback=function(a){var b=H;return function(){var c=H;H=b;try{return a.apply(this,arguments)}finally{H=c}}};exports.unstable_yieldValue=function(a){"disabledLog"!==console.log.name&&(null===l?l=[a]:l.push(a))}; diff --git a/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js b/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js deleted file mode 100644 index a7f2edd4d5344..0000000000000 --- a/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +++ /dev/null @@ -1,206 +0,0 @@ -/** @license React v0.20.2 - * scheduler-unstable_post_task.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -// TODO: Use symbols? -var ImmediatePriority = 1; -var UserBlockingPriority = 2; -var NormalPriority = 3; -var LowPriority = 4; -var IdlePriority = 5; - -var perf = window.performance; -var setTimeout = window.setTimeout; // Use experimental Chrome Scheduler postTask API. - -var scheduler = global.scheduler; -var getCurrentTime = perf.now.bind(perf); -var unstable_now = getCurrentTime; // Scheduler periodically yields in case there is other work on the main -// thread, like user events. By default, it yields multiple times per frame. -// It does not attempt to align with frame boundaries, since most tasks don't -// need to be frame aligned; for those that do, use requestAnimationFrame. - -var yieldInterval = 5; -var deadline = 0; -var currentPriorityLevel_DEPRECATED = NormalPriority; // `isInputPending` is not available. Since we have no way of knowing if -// there's pending input, always yield at the end of the frame. - -function unstable_shouldYield() { - return getCurrentTime() >= deadline; -} -function unstable_requestPaint() {// Since we yield every frame regardless, `requestPaint` has no effect. -} -function unstable_scheduleCallback(priorityLevel, callback, options) { - var postTaskPriority; - - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - postTaskPriority = 'user-blocking'; - break; - - case LowPriority: - case NormalPriority: - postTaskPriority = 'user-visible'; - break; - - case IdlePriority: - postTaskPriority = 'background'; - break; - - default: - postTaskPriority = 'user-visible'; - break; - } - - var controller = new TaskController(); - var postTaskOptions = { - priority: postTaskPriority, - delay: typeof options === 'object' && options !== null ? options.delay : 0, - signal: controller.signal - }; - var node = { - _controller: controller - }; - scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, callback), postTaskOptions).catch(handleAbortError); - return node; -} - -function runTask(priorityLevel, postTaskPriority, node, callback) { - deadline = getCurrentTime() + yieldInterval; - - try { - currentPriorityLevel_DEPRECATED = priorityLevel; - var _didTimeout_DEPRECATED = false; - var result = callback(_didTimeout_DEPRECATED); - - if (typeof result === 'function') { - // Assume this is a continuation - var continuation = result; - var continuationController = new TaskController(); - var continuationOptions = { - priority: postTaskPriority, - signal: continuationController.signal - }; // Update the original callback node's controller, since even though we're - // posting a new task, conceptually it's the same one. - - node._controller = continuationController; - scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, continuation), continuationOptions).catch(handleAbortError); - } - } catch (error) { - // We're inside a `postTask` promise. If we don't handle this error, then it - // will trigger an "Unhandled promise rejection" error. We don't want that, - // but we do want the default error reporting behavior that normal - // (non-Promise) tasks get for unhandled errors. - // - // So we'll re-throw the error inside a regular browser task. - setTimeout(function () { - throw error; - }); - } finally { - currentPriorityLevel_DEPRECATED = NormalPriority; - } -} - -function handleAbortError(error) {// Abort errors are an implementation detail. We don't expose the - // TaskController to the user, nor do we expose the promise that is returned - // from `postTask`. So we should suppress them, since there's no way for the - // user to handle them. -} - -function unstable_cancelCallback(node) { - var controller = node._controller; - controller.abort(); -} -function unstable_runWithPriority(priorityLevel, callback) { - var previousPriorityLevel = currentPriorityLevel_DEPRECATED; - currentPriorityLevel_DEPRECATED = priorityLevel; - - try { - return callback(); - } finally { - currentPriorityLevel_DEPRECATED = previousPriorityLevel; - } -} -function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel_DEPRECATED; -} -function unstable_next(callback) { - var priorityLevel; - - switch (currentPriorityLevel_DEPRECATED) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel_DEPRECATED; - break; - } - - var previousPriorityLevel = currentPriorityLevel_DEPRECATED; - currentPriorityLevel_DEPRECATED = priorityLevel; - - try { - return callback(); - } finally { - currentPriorityLevel_DEPRECATED = previousPriorityLevel; - } -} -function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel_DEPRECATED; - return function () { - var previousPriorityLevel = currentPriorityLevel_DEPRECATED; - currentPriorityLevel_DEPRECATED = parentPriorityLevel; - - try { - return callback(); - } finally { - currentPriorityLevel_DEPRECATED = previousPriorityLevel; - } - }; -} -function unstable_forceFrameRate() {} -function unstable_pauseExecution() {} -function unstable_continueExecution() {} -function unstable_getFirstCallbackNode() { - return null; -} // Currently no profiling build - -var unstable_Profiling = null; - -exports.unstable_IdlePriority = IdlePriority; -exports.unstable_ImmediatePriority = ImmediatePriority; -exports.unstable_LowPriority = LowPriority; -exports.unstable_NormalPriority = NormalPriority; -exports.unstable_Profiling = unstable_Profiling; -exports.unstable_UserBlockingPriority = UserBlockingPriority; -exports.unstable_cancelCallback = unstable_cancelCallback; -exports.unstable_continueExecution = unstable_continueExecution; -exports.unstable_forceFrameRate = unstable_forceFrameRate; -exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; -exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; -exports.unstable_next = unstable_next; -exports.unstable_now = unstable_now; -exports.unstable_pauseExecution = unstable_pauseExecution; -exports.unstable_requestPaint = unstable_requestPaint; -exports.unstable_runWithPriority = unstable_runWithPriority; -exports.unstable_scheduleCallback = unstable_scheduleCallback; -exports.unstable_shouldYield = unstable_shouldYield; -exports.unstable_wrapCallback = unstable_wrapCallback; - })(); -} diff --git a/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js b/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js deleted file mode 100644 index 001489373703e..0000000000000 --- a/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @license React v0.20.2 - * scheduler-unstable_post_task.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. - */ -'use strict';var a=window.performance,g=window.setTimeout,h=global.scheduler,k=a.now.bind(a),l=0,m=3;function p(c,d,b,f){l=k()+5;try{m=c;var e=f(!1);if("function"===typeof e){var n=new TaskController,r={priority:d,signal:n.signal};b._controller=n;h.postTask(p.bind(null,c,d,b,e),r).catch(q)}}catch(t){g(function(){throw t;})}finally{m=3}}function q(){}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3; -exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(c){c._controller.abort()};exports.unstable_continueExecution=function(){};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return m};exports.unstable_getFirstCallbackNode=function(){return null};exports.unstable_next=function(c){switch(m){case 1:case 2:case 3:var d=3;break;default:d=m}var b=m;m=d;try{return c()}finally{m=b}}; -exports.unstable_now=k;exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(c,d){var b=m;m=c;try{return d()}finally{m=b}}; -exports.unstable_scheduleCallback=function(c,d,b){switch(c){case 1:case 2:var f="user-blocking";break;case 4:case 3:f="user-visible";break;case 5:f="background";break;default:f="user-visible"}var e=new TaskController;b={priority:f,delay:"object"===typeof b&&null!==b?b.delay:0,signal:e.signal};e={_controller:e};h.postTask(p.bind(null,c,f,e,d),b).catch(q);return e};exports.unstable_shouldYield=function(){return k()>=l}; -exports.unstable_wrapCallback=function(c){var d=m;return function(){var b=m;m=d;try{return c()}finally{m=b}}}; diff --git a/node_modules/scheduler/cjs/scheduler.development.js b/node_modules/scheduler/cjs/scheduler.development.js deleted file mode 100644 index 200e838e75006..0000000000000 --- a/node_modules/scheduler/cjs/scheduler.development.js +++ /dev/null @@ -1,646 +0,0 @@ -/** @license React v0.20.2 - * scheduler.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. - */ - -'use strict'; - -if (process.env.NODE_ENV !== "production") { - (function() { -'use strict'; - -var enableSchedulerDebugging = false; -var enableProfiling = false; - -var requestHostCallback; -var requestHostTimeout; -var cancelHostTimeout; -var requestPaint; -var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; - -if (hasPerformanceNow) { - var localPerformance = performance; - - exports.unstable_now = function () { - return localPerformance.now(); - }; -} else { - var localDate = Date; - var initialTime = localDate.now(); - - exports.unstable_now = function () { - return localDate.now() - initialTime; - }; -} - -if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive -// implementation using setTimeout. -typeof window === 'undefined' || // Check if MessageChannel is supported, too. -typeof MessageChannel !== 'function') { - // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore, - // fallback to a naive implementation. - var _callback = null; - var _timeoutID = null; - - var _flushCallback = function () { - if (_callback !== null) { - try { - var currentTime = exports.unstable_now(); - var hasRemainingTime = true; - - _callback(hasRemainingTime, currentTime); - - _callback = null; - } catch (e) { - setTimeout(_flushCallback, 0); - throw e; - } - } - }; - - requestHostCallback = function (cb) { - if (_callback !== null) { - // Protect against re-entrancy. - setTimeout(requestHostCallback, 0, cb); - } else { - _callback = cb; - setTimeout(_flushCallback, 0); - } - }; - - requestHostTimeout = function (cb, ms) { - _timeoutID = setTimeout(cb, ms); - }; - - cancelHostTimeout = function () { - clearTimeout(_timeoutID); - }; - - exports.unstable_shouldYield = function () { - return false; - }; - - requestPaint = exports.unstable_forceFrameRate = function () {}; -} else { - // Capture local references to native APIs, in case a polyfill overrides them. - var _setTimeout = window.setTimeout; - var _clearTimeout = window.clearTimeout; - - if (typeof console !== 'undefined') { - // TODO: Scheduler no longer requires these methods to be polyfilled. But - // maybe we want to continue warning if they don't exist, to preserve the - // option to rely on it in the future? - var requestAnimationFrame = window.requestAnimationFrame; - var cancelAnimationFrame = window.cancelAnimationFrame; - - if (typeof requestAnimationFrame !== 'function') { - // Using console['error'] to evade Babel and ESLint - console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); - } - - if (typeof cancelAnimationFrame !== 'function') { - // Using console['error'] to evade Babel and ESLint - console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); - } - } - - var isMessageLoopRunning = false; - var scheduledHostCallback = null; - var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main - // thread, like user events. By default, it yields multiple times per frame. - // It does not attempt to align with frame boundaries, since most tasks don't - // need to be frame aligned; for those that do, use requestAnimationFrame. - - var yieldInterval = 5; - var deadline = 0; // TODO: Make this configurable - - { - // `isInputPending` is not available. Since we have no way of knowing if - // there's pending input, always yield at the end of the frame. - exports.unstable_shouldYield = function () { - return exports.unstable_now() >= deadline; - }; // Since we yield every frame regardless, `requestPaint` has no effect. - - - requestPaint = function () {}; - } - - exports.unstable_forceFrameRate = function (fps) { - if (fps < 0 || fps > 125) { - // Using console['error'] to evade Babel and ESLint - console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); - return; - } - - if (fps > 0) { - yieldInterval = Math.floor(1000 / fps); - } else { - // reset the framerate - yieldInterval = 5; - } - }; - - var performWorkUntilDeadline = function () { - if (scheduledHostCallback !== null) { - var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync - // cycle. This means there's always time remaining at the beginning of - // the message event. - - deadline = currentTime + yieldInterval; - var hasTimeRemaining = true; - - try { - var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); - - if (!hasMoreWork) { - isMessageLoopRunning = false; - scheduledHostCallback = null; - } else { - // If there's more work, schedule the next message event at the end - // of the preceding one. - port.postMessage(null); - } - } catch (error) { - // If a scheduler task throws, exit the current browser task so the - // error can be observed. - port.postMessage(null); - throw error; - } - } else { - isMessageLoopRunning = false; - } // Yielding to the browser will give it a chance to paint, so we can - }; - - var channel = new MessageChannel(); - var port = channel.port2; - channel.port1.onmessage = performWorkUntilDeadline; - - requestHostCallback = function (callback) { - scheduledHostCallback = callback; - - if (!isMessageLoopRunning) { - isMessageLoopRunning = true; - port.postMessage(null); - } - }; - - requestHostTimeout = function (callback, ms) { - taskTimeoutID = _setTimeout(function () { - callback(exports.unstable_now()); - }, ms); - }; - - cancelHostTimeout = function () { - _clearTimeout(taskTimeoutID); - - taskTimeoutID = -1; - }; -} - -function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); -} -function peek(heap) { - var first = heap[0]; - return first === undefined ? null : first; -} -function pop(heap) { - var first = heap[0]; - - if (first !== undefined) { - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } else { - return null; - } -} - -function siftUp(heap, node, i) { - var index = i; - - while (true) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (parent !== undefined && compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } -} - -function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - - while (index < length) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (left !== undefined && compare(left, node) < 0) { - if (right !== undefined && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (right !== undefined && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } -} - -function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; -} - -// TODO: Use symbols? -var ImmediatePriority = 1; -var UserBlockingPriority = 2; -var NormalPriority = 3; -var LowPriority = 4; -var IdlePriority = 5; - -function markTaskErrored(task, ms) { -} - -/* eslint-disable no-var */ -// Math.pow(2, 30) - 1 -// 0b111111111111111111111111111111 - -var maxSigned31BitInt = 1073741823; // Times out immediately - -var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - -var USER_BLOCKING_PRIORITY_TIMEOUT = 250; -var NORMAL_PRIORITY_TIMEOUT = 5000; -var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - -var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap - -var taskQueue = []; -var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - -var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. -var currentTask = null; -var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. - -var isPerformingWork = false; -var isHostCallbackScheduled = false; -var isHostTimeoutScheduled = false; - -function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } -} - -function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } -} - -function flushWork(hasTimeRemaining, initialTime) { - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = exports.unstable_now(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod code path. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - } -} - -function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || exports.unstable_shouldYield())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (typeof callback === 'function') { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = exports.unstable_now(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - } else { - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } -} - -function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } -} - -function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } -} - -function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; -} - -function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = exports.unstable_now(); - var startTime; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - } else { - startTime = currentTime; - } - - var timeout; - - switch (priorityLevel) { - case ImmediatePriority: - timeout = IMMEDIATE_PRIORITY_TIMEOUT; - break; - - case UserBlockingPriority: - timeout = USER_BLOCKING_PRIORITY_TIMEOUT; - break; - - case IdlePriority: - timeout = IDLE_PRIORITY_TIMEOUT; - break; - - case LowPriority: - timeout = LOW_PRIORITY_TIMEOUT; - break; - - case NormalPriority: - default: - timeout = NORMAL_PRIORITY_TIMEOUT; - break; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; -} - -function unstable_pauseExecution() { -} - -function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } -} - -function unstable_getFirstCallbackNode() { - return peek(taskQueue); -} - -function unstable_cancelCallback(task) { - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; -} - -function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; -} - -var unstable_requestPaint = requestPaint; -var unstable_Profiling = null; - -exports.unstable_IdlePriority = IdlePriority; -exports.unstable_ImmediatePriority = ImmediatePriority; -exports.unstable_LowPriority = LowPriority; -exports.unstable_NormalPriority = NormalPriority; -exports.unstable_Profiling = unstable_Profiling; -exports.unstable_UserBlockingPriority = UserBlockingPriority; -exports.unstable_cancelCallback = unstable_cancelCallback; -exports.unstable_continueExecution = unstable_continueExecution; -exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; -exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; -exports.unstable_next = unstable_next; -exports.unstable_pauseExecution = unstable_pauseExecution; -exports.unstable_requestPaint = unstable_requestPaint; -exports.unstable_runWithPriority = unstable_runWithPriority; -exports.unstable_scheduleCallback = unstable_scheduleCallback; -exports.unstable_wrapCallback = unstable_wrapCallback; - })(); -} diff --git a/node_modules/scheduler/cjs/scheduler.production.min.js b/node_modules/scheduler/cjs/scheduler.production.min.js deleted file mode 100644 index 15bb77f55a51f..0000000000000 --- a/node_modules/scheduler/cjs/scheduler.production.min.js +++ /dev/null @@ -1,20 +0,0 @@ -/** @license React v0.20.2 - * scheduler.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. - */ -'use strict';var f,g,h,k;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}} -if("undefined"===typeof window||"function"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0))};g=function(a,b){u=setTimeout(a,b)};h=function(){clearTimeout(u)};exports.unstable_shouldYield=function(){return!1};k=exports.unstable_forceFrameRate=function(){}}else{var x=window.setTimeout,y=window.clearTimeout;if("undefined"!==typeof console){var z= -window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof z&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>= -E};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1; -function T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}} -function V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if("function"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5; -exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)}; -exports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}}; -exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a}; -exports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}}; diff --git a/node_modules/scheduler/index.js b/node_modules/scheduler/index.js deleted file mode 100644 index 77770b0c219e2..0000000000000 --- a/node_modules/scheduler/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); -} else { - module.exports = require('./cjs/scheduler.development.js'); -} diff --git a/node_modules/scheduler/node_modules/.bin/loose-envify b/node_modules/scheduler/node_modules/.bin/loose-envify deleted file mode 120000 index 50f14c0b8217e..0000000000000 --- a/node_modules/scheduler/node_modules/.bin/loose-envify +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../node_modules/loose-envify/cli.js \ No newline at end of file diff --git a/node_modules/scheduler/package.json b/node_modules/scheduler/package.json deleted file mode 100644 index ed0265079892b..0000000000000 --- a/node_modules/scheduler/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "scheduler", - "version": "0.20.2", - "description": "Cooperative scheduler for the browser environment.", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/facebook/react.git", - "directory": "packages/scheduler" - }, - "license": "MIT", - "keywords": [ - "react" - ], - "bugs": { - "url": "https://github.com/facebook/react/issues" - }, - "homepage": "https://reactjs.org/", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - }, - "files": [ - "LICENSE", - "README.md", - "build-info.json", - "index.js", - "tracing.js", - "tracing-profiling.js", - "unstable_mock.js", - "unstable_post_task.js", - "cjs/", - "umd/" - ], - "browserify": { - "transform": [ - "loose-envify" - ] - } -} diff --git a/node_modules/scheduler/tracing-profiling.js b/node_modules/scheduler/tracing-profiling.js deleted file mode 100644 index cb2d20c025226..0000000000000 --- a/node_modules/scheduler/tracing-profiling.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler-tracing.profiling.min.js'); -} else { - module.exports = require('./cjs/scheduler-tracing.development.js'); -} diff --git a/node_modules/scheduler/tracing.js b/node_modules/scheduler/tracing.js deleted file mode 100644 index 1e318bd901b5d..0000000000000 --- a/node_modules/scheduler/tracing.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler-tracing.production.min.js'); -} else { - module.exports = require('./cjs/scheduler-tracing.development.js'); -} diff --git a/node_modules/scheduler/umd/scheduler-tracing.development.js b/node_modules/scheduler/umd/scheduler-tracing.development.js deleted file mode 100644 index a81bf8fe2f98d..0000000000000 --- a/node_modules/scheduler/umd/scheduler-tracing.development.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @license React - * - * 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. - */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.SchedulerTracing = factory(global)); -})(this, function(global) { - function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( - this, - arguments - ); - } - - function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( - this, - arguments - ); - } - - function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( - this, - arguments - ); - } - - function unstable_subscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( - this, - arguments - ); - } - - function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( - this, - arguments - ); - } - - function unstable_unsubscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( - this, - arguments - ); - } - - function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_clear: unstable_clear, - unstable_getCurrent: unstable_getCurrent, - unstable_getThreadID: unstable_getThreadID, - unstable_subscribe: unstable_subscribe, - unstable_trace: unstable_trace, - unstable_unsubscribe: unstable_unsubscribe, - unstable_wrap: unstable_wrap, - }); -}); diff --git a/node_modules/scheduler/umd/scheduler-tracing.production.min.js b/node_modules/scheduler/umd/scheduler-tracing.production.min.js deleted file mode 100644 index a81bf8fe2f98d..0000000000000 --- a/node_modules/scheduler/umd/scheduler-tracing.production.min.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @license React - * - * 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. - */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.SchedulerTracing = factory(global)); -})(this, function(global) { - function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( - this, - arguments - ); - } - - function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( - this, - arguments - ); - } - - function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( - this, - arguments - ); - } - - function unstable_subscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( - this, - arguments - ); - } - - function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( - this, - arguments - ); - } - - function unstable_unsubscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( - this, - arguments - ); - } - - function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_clear: unstable_clear, - unstable_getCurrent: unstable_getCurrent, - unstable_getThreadID: unstable_getThreadID, - unstable_subscribe: unstable_subscribe, - unstable_trace: unstable_trace, - unstable_unsubscribe: unstable_unsubscribe, - unstable_wrap: unstable_wrap, - }); -}); diff --git a/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js b/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js deleted file mode 100644 index a81bf8fe2f98d..0000000000000 --- a/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @license React - * - * 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. - */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.SchedulerTracing = factory(global)); -})(this, function(global) { - function unstable_clear() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_clear.apply( - this, - arguments - ); - } - - function unstable_getCurrent() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getCurrent.apply( - this, - arguments - ); - } - - function unstable_getThreadID() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_getThreadID.apply( - this, - arguments - ); - } - - function unstable_subscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_subscribe.apply( - this, - arguments - ); - } - - function unstable_trace() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_trace.apply( - this, - arguments - ); - } - - function unstable_unsubscribe() { - // eslint-disable-next-line max-len - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_unsubscribe.apply( - this, - arguments - ); - } - - function unstable_wrap() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing.unstable_wrap.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_clear: unstable_clear, - unstable_getCurrent: unstable_getCurrent, - unstable_getThreadID: unstable_getThreadID, - unstable_subscribe: unstable_subscribe, - unstable_trace: unstable_trace, - unstable_unsubscribe: unstable_unsubscribe, - unstable_wrap: unstable_wrap, - }); -}); diff --git a/node_modules/scheduler/umd/scheduler-unstable_mock.development.js b/node_modules/scheduler/umd/scheduler-unstable_mock.development.js deleted file mode 100644 index add6fa40c47ad..0000000000000 --- a/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +++ /dev/null @@ -1,664 +0,0 @@ -/** @license React v0.20.2 - * scheduler-unstable_mock.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. - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.SchedulerMock = {})); -}(this, (function (exports) { 'use strict'; - - var enableSchedulerDebugging = false; - var enableProfiling = false; - - var currentTime = 0; - var scheduledCallback = null; - var scheduledTimeout = null; - var timeoutTime = -1; - var yieldedValues = null; - var expectedNumberOfYields = -1; - var didStop = false; - var isFlushing = false; - var needsPaint = false; - var shouldYieldForPaint = false; - function requestHostCallback(callback) { - scheduledCallback = callback; - } - function requestHostTimeout(callback, ms) { - scheduledTimeout = callback; - timeoutTime = currentTime + ms; - } - function cancelHostTimeout() { - scheduledTimeout = null; - timeoutTime = -1; - } - function shouldYieldToHost() { - if (expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { - // We yielded at least as many values as expected. Stop flushing. - didStop = true; - return true; - } - - return false; - } - function getCurrentTime() { - return currentTime; - } - function forceFrameRate() {// No-op - } - - function unstable_flushNumberOfYields(count) { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - expectedNumberOfYields = count; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork && !didStop); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - expectedNumberOfYields = -1; - didStop = false; - isFlushing = false; - } - } - } - function unstable_flushUntilNextPaint() { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - shouldYieldForPaint = true; - needsPaint = false; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork && !didStop); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - shouldYieldForPaint = false; - didStop = false; - isFlushing = false; - } - } - } - function unstable_flushExpired() { - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - isFlushing = true; - - try { - var hasMoreWork = scheduledCallback(false, currentTime); - - if (!hasMoreWork) { - scheduledCallback = null; - } - } finally { - isFlushing = false; - } - } - } - function unstable_flushAllWithoutAsserting() { - // Returns false if no work was flushed. - if (isFlushing) { - throw new Error('Already flushing work.'); - } - - if (scheduledCallback !== null) { - var cb = scheduledCallback; - isFlushing = true; - - try { - var hasMoreWork = true; - - do { - hasMoreWork = cb(true, currentTime); - } while (hasMoreWork); - - if (!hasMoreWork) { - scheduledCallback = null; - } - - return true; - } finally { - isFlushing = false; - } - } else { - return false; - } - } - function unstable_clearYields() { - if (yieldedValues === null) { - return []; - } - - var values = yieldedValues; - yieldedValues = null; - return values; - } - function unstable_flushAll() { - if (yieldedValues !== null) { - throw new Error('Log is not empty. Assert on the log of yielded values before ' + 'flushing additional work.'); - } - - unstable_flushAllWithoutAsserting(); - - if (yieldedValues !== null) { - throw new Error('While flushing work, something yielded a value. Use an ' + 'assertion helper to assert on the log of yielded values, e.g. ' + 'expect(Scheduler).toFlushAndYield([...])'); - } - } - function unstable_yieldValue(value) { - // eslint-disable-next-line react-internal/no-production-logging - if (console.log.name === 'disabledLog') { - // If console.log has been patched, we assume we're in render - // replaying and we ignore any values yielding in the second pass. - return; - } - - if (yieldedValues === null) { - yieldedValues = [value]; - } else { - yieldedValues.push(value); - } - } - function unstable_advanceTime(ms) { - // eslint-disable-next-line react-internal/no-production-logging - if (console.log.name === 'disabledLog') { - // If console.log has been patched, we assume we're in render - // replaying and we ignore any time advancing in the second pass. - return; - } - - currentTime += ms; - - if (scheduledTimeout !== null && timeoutTime <= currentTime) { - scheduledTimeout(currentTime); - timeoutTime = -1; - scheduledTimeout = null; - } - } - function requestPaint() { - needsPaint = true; - } - - function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); - } - function peek(heap) { - var first = heap[0]; - return first === undefined ? null : first; - } - function pop(heap) { - var first = heap[0]; - - if (first !== undefined) { - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } else { - return null; - } - } - - function siftUp(heap, node, i) { - var index = i; - - while (true) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (parent !== undefined && compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } - } - - function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - - while (index < length) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (left !== undefined && compare(left, node) < 0) { - if (right !== undefined && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (right !== undefined && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } - } - - function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; - } - - // TODO: Use symbols? - var ImmediatePriority = 1; - var UserBlockingPriority = 2; - var NormalPriority = 3; - var LowPriority = 4; - var IdlePriority = 5; - - function markTaskErrored(task, ms) { - } - - /* eslint-disable no-var */ - // Math.pow(2, 30) - 1 - // 0b111111111111111111111111111111 - - var maxSigned31BitInt = 1073741823; // Times out immediately - - var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - - var USER_BLOCKING_PRIORITY_TIMEOUT = 250; - var NORMAL_PRIORITY_TIMEOUT = 5000; - var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - - var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap - - var taskQueue = []; - var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - - var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. - var currentTask = null; - var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. - - var isPerformingWork = false; - var isHostCallbackScheduled = false; - var isHostTimeoutScheduled = false; - - function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } - } - - function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } - } - - function flushWork(hasTimeRemaining, initialTime) { - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = getCurrentTime(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod code path. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - } - } - - function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (typeof callback === 'function') { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = getCurrentTime(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - } else { - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } - } - - function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; - } - - function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = getCurrentTime(); - var startTime; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - } else { - startTime = currentTime; - } - - var timeout; - - switch (priorityLevel) { - case ImmediatePriority: - timeout = IMMEDIATE_PRIORITY_TIMEOUT; - break; - - case UserBlockingPriority: - timeout = USER_BLOCKING_PRIORITY_TIMEOUT; - break; - - case IdlePriority: - timeout = IDLE_PRIORITY_TIMEOUT; - break; - - case LowPriority: - timeout = LOW_PRIORITY_TIMEOUT; - break; - - case NormalPriority: - default: - timeout = NORMAL_PRIORITY_TIMEOUT; - break; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; - } - - function unstable_pauseExecution() { - } - - function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - function unstable_getFirstCallbackNode() { - return peek(taskQueue); - } - - function unstable_cancelCallback(task) { - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; - } - - function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; - } - - var unstable_requestPaint = requestPaint; - var unstable_Profiling = null; - - exports.unstable_IdlePriority = IdlePriority; - exports.unstable_ImmediatePriority = ImmediatePriority; - exports.unstable_LowPriority = LowPriority; - exports.unstable_NormalPriority = NormalPriority; - exports.unstable_Profiling = unstable_Profiling; - exports.unstable_UserBlockingPriority = UserBlockingPriority; - exports.unstable_advanceTime = unstable_advanceTime; - exports.unstable_cancelCallback = unstable_cancelCallback; - exports.unstable_clearYields = unstable_clearYields; - exports.unstable_continueExecution = unstable_continueExecution; - exports.unstable_flushAll = unstable_flushAll; - exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting; - exports.unstable_flushExpired = unstable_flushExpired; - exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields; - exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint; - exports.unstable_forceFrameRate = forceFrameRate; - exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; - exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; - exports.unstable_next = unstable_next; - exports.unstable_now = getCurrentTime; - exports.unstable_pauseExecution = unstable_pauseExecution; - exports.unstable_requestPaint = unstable_requestPaint; - exports.unstable_runWithPriority = unstable_runWithPriority; - exports.unstable_scheduleCallback = unstable_scheduleCallback; - exports.unstable_shouldYield = shouldYieldToHost; - exports.unstable_wrapCallback = unstable_wrapCallback; - exports.unstable_yieldValue = unstable_yieldValue; - -}))); diff --git a/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js b/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js deleted file mode 100644 index a8221dda68100..0000000000000 --- a/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @license React v0.20.2 - * scheduler-unstable_mock.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. - */ -(function(){'use strict';(function(a,v){"object"===typeof exports&&"undefined"!==typeof module?v(exports):"function"===typeof define&&define.amd?define(["exports"],v):(a=a||self,v(a.SchedulerMock={}))})(this,function(a){function v(){return-1!==y&&null!==k&&k.length>=y||C&&D?r=!0:!1}function I(){if(f)throw Error("Already flushing work.");if(null!==e){var b=e;f=!0;try{var h=!0;do h=b(!0,g);while(h);h||(e=null);return!0}finally{f=!1}}else return!1}function E(b,h){var c=b.length;b.push(h);a:for(;;){var a=c-1>>>1, -w=b[a];if(void 0!==w&&0z(e,c))void 0!==f&&0>z(f,e)?(b[a]=f,b[g]=c,a=g):(b[a]=e,b[d]=c,a=d);else if(void 0!==f&&0>z(f,c))b[a]=f,b[g]=c,a=g;else break a}}return h}return null}function z(b,h){var a=b.sortIndex-h.sortIndex;return 0!==a?a:b.id-h.id}function F(b){for(var a= -m(p);null!==a;){if(null===a.callback)A(p);else if(a.startTime<=b)A(p),a.sortIndex=a.expirationTime,E(n,a);else break;a=m(p)}}function G(b){x=!1;F(b);if(!t)if(null!==m(n))t=!0,e=H;else{var a=m(p);null!==a&&(b=a.startTime-b,q=G,u=g+b)}}function H(b,a){t=!1;x&&(x=!1,q=null,u=-1);B=!0;var c=d;try{F(a);for(l=m(n);null!==l&&(!(l.expirationTime>a)||b&&!v());){var h=l.callback;if("function"===typeof h){l.callback=null;d=l.priorityLevel;var e=h(l.expirationTime<=a);a=g;"function"===typeof e?l.callback=e:l=== -m(n)&&A(n);F(a)}else A(n);l=m(n)}if(null!==l)var f=!0;else{var k=m(p);if(null!==k){var r=k.startTime-a;q=G;u=g+r}f=!1}return f}finally{l=null,d=c,B=!1}}var g=0,e=null,q=null,u=-1,k=null,y=-1,r=!1,f=!1,D=!1,C=!1,n=[],p=[],J=1,l=null,d=3,B=!1,t=!1,x=!1;a.unstable_IdlePriority=5;a.unstable_ImmediatePriority=1;a.unstable_LowPriority=4;a.unstable_NormalPriority=3;a.unstable_Profiling=null;a.unstable_UserBlockingPriority=2;a.unstable_advanceTime=function(b){"disabledLog"!==console.log.name&&(g+=b,null!== -q&&u<=g&&(q(g),u=-1,q=null))};a.unstable_cancelCallback=function(b){b.callback=null};a.unstable_clearYields=function(){if(null===k)return[];var b=k;k=null;return b};a.unstable_continueExecution=function(){t||B||(t=!0,e=H)};a.unstable_flushAll=function(){if(null!==k)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");I();if(null!==k)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"); -};a.unstable_flushAllWithoutAsserting=I;a.unstable_flushExpired=function(){if(f)throw Error("Already flushing work.");if(null!==e){f=!0;try{e(!1,g)||(e=null)}finally{f=!1}}};a.unstable_flushNumberOfYields=function(b){if(f)throw Error("Already flushing work.");if(null!==e){var a=e;y=b;f=!0;try{b=!0;do b=a(!0,g);while(b&&!r);b||(e=null)}finally{y=-1,f=r=!1}}};a.unstable_flushUntilNextPaint=function(){if(f)throw Error("Already flushing work.");if(null!==e){var b=e;C=!0;D=!1;f=!0;try{var a=!0;do a=b(!0, -g);while(a&&!r);a||(e=null)}finally{f=r=C=!1}}};a.unstable_forceFrameRate=function(){};a.unstable_getCurrentPriorityLevel=function(){return d};a.unstable_getFirstCallbackNode=function(){return m(n)};a.unstable_next=function(b){switch(d){case 1:case 2:case 3:var a=3;break;default:a=d}var c=d;d=a;try{return b()}finally{d=c}};a.unstable_now=function(){return g};a.unstable_pauseExecution=function(){};a.unstable_requestPaint=function(){D=!0};a.unstable_runWithPriority=function(a,e){switch(a){case 1:case 2:case 3:case 4:case 5:break; -default:a=3}var b=d;d=a;try{return e()}finally{d=b}};a.unstable_scheduleCallback=function(a,f,c){var b=g;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0b?(a.sortIndex=c,E(p,a),null===m(n)&&a===m(p)&&(x?(q=null,u=-1):x=!0,q=G,u=g+(c-b))):(a.sortIndex=d,E(n,a),t||B||(t=!0, -e=H));return a};a.unstable_shouldYield=v;a.unstable_wrapCallback=function(a){var b=d;return function(){var c=d;d=b;try{return a.apply(this,arguments)}finally{d=c}}};a.unstable_yieldValue=function(a){"disabledLog"!==console.log.name&&(null===k?k=[a]:k.push(a))}}); -})(); diff --git a/node_modules/scheduler/umd/scheduler.development.js b/node_modules/scheduler/umd/scheduler.development.js deleted file mode 100644 index b960dc91132e7..0000000000000 --- a/node_modules/scheduler/umd/scheduler.development.js +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @license React - * - * 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. - */ - -/* eslint-disable max-len */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Scheduler = factory(global)); -})(this, function(global) { - function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( - this, - arguments - ); - } - - function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( - this, - arguments - ); - } - - function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( - this, - arguments - ); - } - - function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( - this, - arguments - ); - } - - function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( - this, - arguments - ); - } - - function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( - this, - arguments - ); - } - - function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( - this, - arguments - ); - } - - function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( - this, - arguments - ); - } - - function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( - this, - arguments - ); - } - - function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( - this, - arguments - ); - } - - function unstable_pauseExecution() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_pauseExecution.apply( - this, - arguments - ); - } - - function unstable_continueExecution() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_continueExecution.apply( - this, - arguments - ); - } - - function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_now: unstable_now, - unstable_scheduleCallback: unstable_scheduleCallback, - unstable_cancelCallback: unstable_cancelCallback, - unstable_shouldYield: unstable_shouldYield, - unstable_requestPaint: unstable_requestPaint, - unstable_runWithPriority: unstable_runWithPriority, - unstable_next: unstable_next, - unstable_wrapCallback: unstable_wrapCallback, - unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, - unstable_continueExecution: unstable_continueExecution, - unstable_pauseExecution: unstable_pauseExecution, - unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, - unstable_forceFrameRate: unstable_forceFrameRate, - get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_IdlePriority; - }, - get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_ImmediatePriority; - }, - get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_LowPriority; - }, - get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_NormalPriority; - }, - get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_UserBlockingPriority; - }, - get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_Profiling; - }, - }); -}); diff --git a/node_modules/scheduler/umd/scheduler.production.min.js b/node_modules/scheduler/umd/scheduler.production.min.js deleted file mode 100644 index 0c2584331b847..0000000000000 --- a/node_modules/scheduler/umd/scheduler.production.min.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * @license React - * - * 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. - */ - -/* eslint-disable max-len */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Scheduler = factory(global)); -})(this, function(global) { - function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( - this, - arguments - ); - } - - function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( - this, - arguments - ); - } - - function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( - this, - arguments - ); - } - - function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( - this, - arguments - ); - } - - function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( - this, - arguments - ); - } - - function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( - this, - arguments - ); - } - - function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( - this, - arguments - ); - } - - function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( - this, - arguments - ); - } - - function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( - this, - arguments - ); - } - - function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( - this, - arguments - ); - } - - function unstable_pauseExecution() { - return undefined; - } - - function unstable_continueExecution() { - return undefined; - } - - function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_now: unstable_now, - unstable_scheduleCallback: unstable_scheduleCallback, - unstable_cancelCallback: unstable_cancelCallback, - unstable_shouldYield: unstable_shouldYield, - unstable_requestPaint: unstable_requestPaint, - unstable_runWithPriority: unstable_runWithPriority, - unstable_next: unstable_next, - unstable_wrapCallback: unstable_wrapCallback, - unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, - unstable_continueExecution: unstable_continueExecution, - unstable_pauseExecution: unstable_pauseExecution, - unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, - unstable_forceFrameRate: unstable_forceFrameRate, - get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_IdlePriority; - }, - get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_ImmediatePriority; - }, - get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_LowPriority; - }, - get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_NormalPriority; - }, - get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_UserBlockingPriority; - }, - get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_Profiling; - }, - }); -}); diff --git a/node_modules/scheduler/umd/scheduler.profiling.min.js b/node_modules/scheduler/umd/scheduler.profiling.min.js deleted file mode 100644 index 0c2584331b847..0000000000000 --- a/node_modules/scheduler/umd/scheduler.profiling.min.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * @license React - * - * 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. - */ - -/* eslint-disable max-len */ - -'use strict'; - -(function(global, factory) { - // eslint-disable-next-line no-unused-expressions - typeof exports === 'object' && typeof module !== 'undefined' - ? (module.exports = factory(require('react'))) - : typeof define === 'function' && define.amd // eslint-disable-line no-undef - ? define(['react'], factory) // eslint-disable-line no-undef - : (global.Scheduler = factory(global)); -})(this, function(global) { - function unstable_now() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( - this, - arguments - ); - } - - function unstable_scheduleCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_scheduleCallback.apply( - this, - arguments - ); - } - - function unstable_cancelCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_cancelCallback.apply( - this, - arguments - ); - } - - function unstable_shouldYield() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_shouldYield.apply( - this, - arguments - ); - } - - function unstable_requestPaint() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_requestPaint.apply( - this, - arguments - ); - } - - function unstable_runWithPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_runWithPriority.apply( - this, - arguments - ); - } - - function unstable_next() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_next.apply( - this, - arguments - ); - } - - function unstable_wrapCallback() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_wrapCallback.apply( - this, - arguments - ); - } - - function unstable_getCurrentPriorityLevel() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getCurrentPriorityLevel.apply( - this, - arguments - ); - } - - function unstable_getFirstCallbackNode() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_getFirstCallbackNode.apply( - this, - arguments - ); - } - - function unstable_pauseExecution() { - return undefined; - } - - function unstable_continueExecution() { - return undefined; - } - - function unstable_forceFrameRate() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_forceFrameRate.apply( - this, - arguments - ); - } - - return Object.freeze({ - unstable_now: unstable_now, - unstable_scheduleCallback: unstable_scheduleCallback, - unstable_cancelCallback: unstable_cancelCallback, - unstable_shouldYield: unstable_shouldYield, - unstable_requestPaint: unstable_requestPaint, - unstable_runWithPriority: unstable_runWithPriority, - unstable_next: unstable_next, - unstable_wrapCallback: unstable_wrapCallback, - unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, - unstable_continueExecution: unstable_continueExecution, - unstable_pauseExecution: unstable_pauseExecution, - unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, - unstable_forceFrameRate: unstable_forceFrameRate, - get unstable_IdlePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_IdlePriority; - }, - get unstable_ImmediatePriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_ImmediatePriority; - }, - get unstable_LowPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_LowPriority; - }, - get unstable_NormalPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_NormalPriority; - }, - get unstable_UserBlockingPriority() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_UserBlockingPriority; - }, - get unstable_Profiling() { - return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED - .Scheduler.unstable_Profiling; - }, - }); -}); diff --git a/node_modules/scheduler/unstable_mock.js b/node_modules/scheduler/unstable_mock.js deleted file mode 100644 index e72ea3186f005..0000000000000 --- a/node_modules/scheduler/unstable_mock.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler-unstable_mock.production.min.js'); -} else { - module.exports = require('./cjs/scheduler-unstable_mock.development.js'); -} diff --git a/node_modules/scheduler/unstable_post_task.js b/node_modules/scheduler/unstable_post_task.js deleted file mode 100644 index 62ecbd5a072bc..0000000000000 --- a/node_modules/scheduler/unstable_post_task.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler-unstable_post_task.production.min.js'); -} else { - module.exports = require('./cjs/scheduler-unstable_post_task.development.js'); -} diff --git a/node_modules/semver/LICENSE b/node_modules/semver/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/semver/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/semver/README.md b/node_modules/semver/README.md deleted file mode 100644 index df54e7a093896..0000000000000 --- a/node_modules/semver/README.md +++ /dev/null @@ -1,568 +0,0 @@ -semver(1) -- The semantic versioner for npm -=========================================== - -## Install - -```bash -npm install semver -```` - -## Usage - -As a node module: - -```js -const semver = require('semver') - -semver.valid('1.2.3') // '1.2.3' -semver.valid('a.b.c') // null -semver.clean(' =v1.2.3 ') // '1.2.3' -semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true -semver.gt('1.2.3', '9.8.7') // false -semver.lt('1.2.3', '9.8.7') // true -semver.minVersion('>=1.0.0') // '1.0.0' -semver.valid(semver.coerce('v2')) // '2.0.0' -semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' -``` - -You can also just load the module for the function that you care about, if -you'd like to minimize your footprint. - -```js -// load the whole API at once in a single object -const semver = require('semver') - -// or just load the bits you need -// all of them listed here, just pick and choose what you want - -// classes -const SemVer = require('semver/classes/semver') -const Comparator = require('semver/classes/comparator') -const Range = require('semver/classes/range') - -// functions for working with versions -const semverParse = require('semver/functions/parse') -const semverValid = require('semver/functions/valid') -const semverClean = require('semver/functions/clean') -const semverInc = require('semver/functions/inc') -const semverDiff = require('semver/functions/diff') -const semverMajor = require('semver/functions/major') -const semverMinor = require('semver/functions/minor') -const semverPatch = require('semver/functions/patch') -const semverPrerelease = require('semver/functions/prerelease') -const semverCompare = require('semver/functions/compare') -const semverRcompare = require('semver/functions/rcompare') -const semverCompareLoose = require('semver/functions/compare-loose') -const semverCompareBuild = require('semver/functions/compare-build') -const semverSort = require('semver/functions/sort') -const semverRsort = require('semver/functions/rsort') - -// low-level comparators between versions -const semverGt = require('semver/functions/gt') -const semverLt = require('semver/functions/lt') -const semverEq = require('semver/functions/eq') -const semverNeq = require('semver/functions/neq') -const semverGte = require('semver/functions/gte') -const semverLte = require('semver/functions/lte') -const semverCmp = require('semver/functions/cmp') -const semverCoerce = require('semver/functions/coerce') - -// working with ranges -const semverSatisfies = require('semver/functions/satisfies') -const semverMaxSatisfying = require('semver/ranges/max-satisfying') -const semverMinSatisfying = require('semver/ranges/min-satisfying') -const semverToComparators = require('semver/ranges/to-comparators') -const semverMinVersion = require('semver/ranges/min-version') -const semverValidRange = require('semver/ranges/valid') -const semverOutside = require('semver/ranges/outside') -const semverGtr = require('semver/ranges/gtr') -const semverLtr = require('semver/ranges/ltr') -const semverIntersects = require('semver/ranges/intersects') -const simplifyRange = require('semver/ranges/simplify') -const rangeSubset = require('semver/ranges/subset') -``` - -As a command-line utility: - -``` -$ semver -h - -A JavaScript implementation of the https://semver.org/ specification -Copyright Isaac Z. Schlueter - -Usage: semver [options] [ [...]] -Prints valid versions sorted by SemVer precedence - -Options: --r --range - Print versions that match the specified range. - --i --increment [] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. - ---preid - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. - --l --loose - Interpret versions and ranges loosely - --p --include-prerelease - Always include prerelease versions in range matching - --c --coerce - Coerce a string into SemVer if possible - (does not imply --loose) - ---rtl - Coerce version strings right to left - ---ltr - Coerce version strings left to right (default) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions. - -If no satisfying versions are found, then exits failure. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them. -``` - -## Versions - -A "version" is described by the `v2.0.0` specification found at -. - -A leading `"="` or `"v"` character is stripped off and ignored. - -## Ranges - -A `version range` is a set of `comparators` which specify versions -that satisfy the range. - -A `comparator` is composed of an `operator` and a `version`. The set -of primitive `operators` is: - -* `<` Less than -* `<=` Less than or equal to -* `>` Greater than -* `>=` Greater than or equal to -* `=` Equal. If no operator is specified, then equality is assumed, - so this operator is optional, but MAY be included. - -For example, the comparator `>=1.2.7` would match the versions -`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` -or `1.1.0`. - -Comparators can be joined by whitespace to form a `comparator set`, -which is satisfied by the **intersection** of all of the comparators -it includes. - -A range is composed of one or more comparator sets, joined by `||`. A -version matches a range if and only if every comparator in at least -one of the `||`-separated comparator sets is satisfied by the version. - -For example, the range `>=1.2.7 <1.3.0` would match the versions -`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, -or `1.1.0`. - -The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, -`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. - -### Prerelease Tags - -If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then -it will only be allowed to satisfy comparator sets if at least one -comparator with the same `[major, minor, patch]` tuple also has a -prerelease tag. - -For example, the range `>1.2.3-alpha.3` would be allowed to match the -version `1.2.3-alpha.7`, but it would *not* be satisfied by -`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater -than" `1.2.3-alpha.3` according to the SemVer sort rules. The version -range only accepts prerelease tags on the `1.2.3` version. The -version `3.4.5` *would* satisfy the range, because it does not have a -prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. - -The purpose for this behavior is twofold. First, prerelease versions -frequently are updated very quickly, and contain many breaking changes -that are (by the author's design) not yet fit for public consumption. -Therefore, by default, they are excluded from range matching -semantics. - -Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use *that specific* set of -alpha/beta/rc versions. By including a prerelease tag in the range, -the user is indicating that they are aware of the risk. However, it -is still not appropriate to assume that they have opted into taking a -similar risk on the *next* set of prerelease versions. - -Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the `includePrerelease` flag on the options -object to any -[functions](https://github.com/npm/node-semver#functions) that do -range matching. - -#### Prerelease Identifiers - -The method `.inc` takes an additional `identifier` string argument that -will append the value of the string as a prerelease identifier: - -```javascript -semver.inc('1.2.3', 'prerelease', 'beta') -// '1.2.4-beta.0' -``` - -command-line example: - -```bash -$ semver 1.2.3 -i prerelease --preid beta -1.2.4-beta.0 -``` - -Which then can be used to increment further: - -```bash -$ semver 1.2.4-beta.0 -i prerelease -1.2.4-beta.1 -``` - -### Advanced Range Syntax - -Advanced range syntax desugars to primitive comparators in -deterministic ways. - -Advanced ranges may be combined in the same way as primitive -comparators using white space or `||`. - -#### Hyphen Ranges `X.Y.Z - A.B.C` - -Specifies an inclusive set. - -* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` - -If a partial version is provided as the first version in the inclusive -range, then the missing pieces are replaced with zeroes. - -* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` - -If a partial version is provided as the second version in the -inclusive range, then all versions that start with the supplied parts -of the tuple are accepted, but nothing that would be greater than the -provided tuple parts. - -* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0` -* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0` - -#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` - -Any of `X`, `x`, or `*` may be used to "stand in" for one of the -numeric values in the `[major, minor, patch]` tuple. - -* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless - `includePrerelease` is specified, in which case any version at all - satisfies) -* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version) -* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions) - -A partial version range is treated as an X-Range, so the special -character is in fact optional. - -* `""` (empty string) := `*` := `>=0.0.0` -* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0` -* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0` - -#### Tilde Ranges `~1.2.3` `~1.2` `~1` - -Allows patch-level changes if a minor version is specified on the -comparator. Allows minor-level changes if not. - -* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0` -* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`) -* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`) -* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0` -* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`) -* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`) -* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. - -#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` - -Allows changes that do not modify the left-most non-zero element in the -`[major, minor, patch]` tuple. In other words, this allows patch and -minor updates for versions `1.0.0` and above, patch updates for -versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. - -Many authors treat a `0.x` version as if the `x` were the major -"breaking-change" indicator. - -Caret ranges are ideal when an author may make breaking changes -between `0.2.4` and `0.3.0` releases, which is a common practice. -However, it presumes that there will *not* be breaking changes between -`0.2.4` and `0.2.5`. It allows for changes that are presumed to be -additive (but non-breaking), according to commonly observed practices. - -* `^1.2.3` := `>=1.2.3 <2.0.0-0` -* `^0.2.3` := `>=0.2.3 <0.3.0-0` -* `^0.0.3` := `>=0.0.3 <0.0.4-0` -* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. -* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the - `0.0.3` version *only* will be allowed, if they are greater than or - equal to `beta`. So, `0.0.3-pr.2` would be allowed. - -When parsing caret ranges, a missing `patch` value desugars to the -number `0`, but will allow flexibility within that value, even if the -major and minor versions are both `0`. - -* `^1.2.x` := `>=1.2.0 <2.0.0-0` -* `^0.0.x` := `>=0.0.0 <0.1.0-0` -* `^0.0` := `>=0.0.0 <0.1.0-0` - -A missing `minor` and `patch` values will desugar to zero, but also -allow flexibility within those values, even if the major version is -zero. - -* `^1.x` := `>=1.0.0 <2.0.0-0` -* `^0.x` := `>=0.0.0 <1.0.0-0` - -### Range Grammar - -Putting all this together, here is a Backus-Naur grammar for ranges, -for the benefit of parser authors: - -```bnf -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ -``` - -## Functions - -All methods and classes take a final `options` object argument. All -options in this object are `false` by default. The options supported -are: - -- `loose` Be more forgiving about not-quite-valid semver strings. - (Any resulting output will always be 100% strict compliant, of - course.) For backwards compatibility reasons, if the `options` - argument is a boolean value instead of an object, it is interpreted - to be the `loose` param. -- `includePrerelease` Set to suppress the [default - behavior](https://github.com/npm/node-semver#prerelease-tags) of - excluding prerelease tagged versions from ranges unless they are - explicitly opted into. - -Strict-mode Comparators and Ranges will be strict about the SemVer -strings that they parse. - -* `valid(v)`: Return the parsed version, or null if it's not valid. -* `inc(v, release)`: Return the version incremented by the release - type (`major`, `premajor`, `minor`, `preminor`, `patch`, - `prepatch`, or `prerelease`), or null if it's not valid - * `premajor` in one call will bump the version up to the next major - version and down to a prerelease of that major version. - `preminor`, and `prepatch` work the same way. - * If called from a non-prerelease version, the `prerelease` will work the - same as `prepatch`. It increments the patch version, then makes a - prerelease. If the input version is already a prerelease it simply - increments it. -* `prerelease(v)`: Returns an array of prerelease components, or null - if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` -* `major(v)`: Return the major version number. -* `minor(v)`: Return the minor version number. -* `patch(v)`: Return the patch version number. -* `intersects(r1, r2, loose)`: Return true if the two supplied ranges - or comparators intersect. -* `parse(v)`: Attempt to parse a string as a semantic version, returning either - a `SemVer` object or `null`. - -### Comparison - -* `gt(v1, v2)`: `v1 > v2` -* `gte(v1, v2)`: `v1 >= v2` -* `lt(v1, v2)`: `v1 < v2` -* `lte(v1, v2)`: `v1 <= v2` -* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, - even if they're not the exact same string. You already know how to - compare strings. -* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. -* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call - the corresponding function above. `"==="` and `"!=="` do simple - string comparison, but are included for completeness. Throws if an - invalid comparison string is provided. -* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions - in descending order when passed to `Array.sort()`. -* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions - are equal. Sorts in ascending order if passed to `Array.sort()`. - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `diff(v1, v2)`: Returns difference between two versions by the release type - (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), - or null if the versions are the same. - -### Comparators - -* `intersects(comparator)`: Return true if the comparators intersect - -### Ranges - -* `validRange(range)`: Return the valid range or null if it's not valid -* `satisfies(version, range)`: Return true if the version satisfies the - range. -* `maxSatisfying(versions, range)`: Return the highest version in the list - that satisfies the range, or `null` if none of them do. -* `minSatisfying(versions, range)`: Return the lowest version in the list - that satisfies the range, or `null` if none of them do. -* `minVersion(range)`: Return the lowest version that can possibly match - the given range. -* `gtr(version, range)`: Return `true` if version is greater than all the - versions possible in the range. -* `ltr(version, range)`: Return `true` if version is less than all the - versions possible in the range. -* `outside(version, range, hilo)`: Return true if the version is outside - the bounds of the range in either the high or low direction. The - `hilo` argument must be either the string `'>'` or `'<'`. (This is - the function called by `gtr` and `ltr`.) -* `intersects(range)`: Return true if any of the ranges comparators intersect -* `simplifyRange(versions, range)`: Return a "simplified" range that - matches the same items in `versions` list as the range specified. Note - that it does *not* guarantee that it would match the same versions in all - cases, only for the set of versions provided. This is useful when - generating ranges by joining together multiple versions with `||` - programmatically, to provide the user with something a bit more - ergonomic. If the provided range is shorter in string-length than the - generated range, then that is returned. -* `subset(subRange, superRange)`: Return `true` if the `subRange` range is - entirely contained by the `superRange` range. - -Note that, since ranges may be non-contiguous, a version might not be -greater than a range, less than a range, *or* satisfy a range! For -example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` -until `2.0.0`, so the version `1.2.10` would not be greater than the -range (because `2.0.1` satisfies, which is higher), nor less than the -range (since `1.2.8` satisfies, which is lower), and it also does not -satisfy the range. - -If you want to know if a version satisfies or does not satisfy a -range, use the `satisfies(version, range)` function. - -### Coercion - -* `coerce(version, options)`: Coerces a string to semver if possible - -This aims to provide a very forgiving translation of a non-semver string to -semver. It looks for the first digit in a string, and consumes all -remaining characters which satisfy at least a partial semver (e.g., `1`, -`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer -versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All -surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes -`3.4.0`). Only text which lacks digits will fail coercion (`version one` -is not valid). The maximum length for any semver component considered for -coercion is 16 characters; longer components will be ignored -(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any -semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value -components are invalid (`9999999999999999.4.7.4` is likely invalid). - -If the `options.rtl` flag is set, then `coerce` will return the right-most -coercible tuple that does not share an ending index with a longer coercible -tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not -`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of -any other overlapping SemVer tuple. - -### Clean - -* `clean(version)`: Clean a string to be a valid semver if possible - -This will return a cleaned and trimmed semver version. If the provided -version is not valid a null will be returned. This does not work for -ranges. - -ex. -* `s.clean(' = v 2.1.5foo')`: `null` -* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean(' = v 2.1.5-foo')`: `null` -* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean('=v2.1.5')`: `'2.1.5'` -* `s.clean(' =v2.1.5')`: `2.1.5` -* `s.clean(' 2.1.5 ')`: `'2.1.5'` -* `s.clean('~1.0.0')`: `null` - -## Exported Modules - - - -You may pull in just the part of this semver utility that you need, if you -are sensitive to packing and tree-shaking concerns. The main -`require('semver')` export uses getter functions to lazily load the parts -of the API that are used. - -The following modules are available: - -* `require('semver')` -* `require('semver/classes')` -* `require('semver/classes/comparator')` -* `require('semver/classes/range')` -* `require('semver/classes/semver')` -* `require('semver/functions/clean')` -* `require('semver/functions/cmp')` -* `require('semver/functions/coerce')` -* `require('semver/functions/compare')` -* `require('semver/functions/compare-build')` -* `require('semver/functions/compare-loose')` -* `require('semver/functions/diff')` -* `require('semver/functions/eq')` -* `require('semver/functions/gt')` -* `require('semver/functions/gte')` -* `require('semver/functions/inc')` -* `require('semver/functions/lt')` -* `require('semver/functions/lte')` -* `require('semver/functions/major')` -* `require('semver/functions/minor')` -* `require('semver/functions/neq')` -* `require('semver/functions/parse')` -* `require('semver/functions/patch')` -* `require('semver/functions/prerelease')` -* `require('semver/functions/rcompare')` -* `require('semver/functions/rsort')` -* `require('semver/functions/satisfies')` -* `require('semver/functions/sort')` -* `require('semver/functions/valid')` -* `require('semver/ranges/gtr')` -* `require('semver/ranges/intersects')` -* `require('semver/ranges/ltr')` -* `require('semver/ranges/max-satisfying')` -* `require('semver/ranges/min-satisfying')` -* `require('semver/ranges/min-version')` -* `require('semver/ranges/outside')` -* `require('semver/ranges/to-comparators')` -* `require('semver/ranges/valid')` diff --git a/node_modules/semver/bin/semver.js b/node_modules/semver/bin/semver.js deleted file mode 100755 index 8d1b55720e0ab..0000000000000 --- a/node_modules/semver/bin/semver.js +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env node -// Standalone semver comparison program. -// Exits successfully and prints matching version(s) if -// any supplied version is valid and passes all tests. - -const argv = process.argv.slice(2) - -let versions = [] - -const range = [] - -let inc = null - -const version = require('../package.json').version - -let loose = false - -let includePrerelease = false - -let coerce = false - -let rtl = false - -let identifier - -const semver = require('../') - -let reverse = false - -let options = {} - -const main = () => { - if (!argv.length) { - return help() - } - while (argv.length) { - let a = argv.shift() - const indexOfEqualSign = a.indexOf('=') - if (indexOfEqualSign !== -1) { - const value = a.slice(indexOfEqualSign + 1) - a = a.slice(0, indexOfEqualSign) - argv.unshift(value) - } - switch (a) { - case '-rv': case '-rev': case '--rev': case '--reverse': - reverse = true - break - case '-l': case '--loose': - loose = true - break - case '-p': case '--include-prerelease': - includePrerelease = true - break - case '-v': case '--version': - versions.push(argv.shift()) - break - case '-i': case '--inc': case '--increment': - switch (argv[0]) { - case 'major': case 'minor': case 'patch': case 'prerelease': - case 'premajor': case 'preminor': case 'prepatch': - inc = argv.shift() - break - default: - inc = 'patch' - break - } - break - case '--preid': - identifier = argv.shift() - break - case '-r': case '--range': - range.push(argv.shift()) - break - case '-c': case '--coerce': - coerce = true - break - case '--rtl': - rtl = true - break - case '--ltr': - rtl = false - break - case '-h': case '--help': case '-?': - return help() - default: - versions.push(a) - break - } - } - - options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } - - versions = versions.map((v) => { - return coerce ? (semver.coerce(v, options) || { version: v }).version : v - }).filter((v) => { - return semver.valid(v) - }) - if (!versions.length) { - return fail() - } - if (inc && (versions.length !== 1 || range.length)) { - return failInc() - } - - for (let i = 0, l = range.length; i < l; i++) { - versions = versions.filter((v) => { - return semver.satisfies(v, range[i], options) - }) - if (!versions.length) { - return fail() - } - } - return success(versions) -} - -const failInc = () => { - console.error('--inc can only be used on a single version with no range') - fail() -} - -const fail = () => process.exit(1) - -const success = () => { - const compare = reverse ? 'rcompare' : 'compare' - versions.sort((a, b) => { - return semver[compare](a, b, options) - }).map((v) => { - return semver.clean(v, options) - }).map((v) => { - return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach((v, i, _) => { - console.log(v) - }) -} - -const help = () => console.log( -`SemVer ${version} - -A JavaScript implementation of the https://semver.org/ specification -Copyright Isaac Z. Schlueter - -Usage: semver [options] [ [...]] -Prints valid versions sorted by SemVer precedence - -Options: --r --range - Print versions that match the specified range. - --i --increment [] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. - ---preid - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. - --l --loose - Interpret versions and ranges loosely - --p --include-prerelease - Always include prerelease versions in range matching - --c --coerce - Coerce a string into SemVer if possible - (does not imply --loose) - ---rtl - Coerce version strings right to left - ---ltr - Coerce version strings left to right (default) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions. - -If no satisfying versions are found, then exits failure. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them.`) - -main() diff --git a/node_modules/semver/classes/comparator.js b/node_modules/semver/classes/comparator.js deleted file mode 100644 index 62cd204d9b796..0000000000000 --- a/node_modules/semver/classes/comparator.js +++ /dev/null @@ -1,136 +0,0 @@ -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY - } - - constructor (comp, options) { - options = parseOptions(options) - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) - } - - parse (comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const m = comp.match(r) - - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } - - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } - } - - toString () { - return this.value - } - - test (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - return cmp(version, this.operator, this.semver, this.options) - } - - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false, - } - } - - if (this.operator === '') { - if (this.value === '') { - return true - } - return new Range(comp.value, options).test(this.value) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - return new Range(this.value, options).test(comp.semver) - } - - const sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - const sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - const sameSemVer = this.semver.version === comp.semver.version - const differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - const oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<') - const oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>') - - return ( - sameDirectionIncreasing || - sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || - oppositeDirectionsGreaterThan - ) - } -} - -module.exports = Comparator - -const parseOptions = require('../internal/parse-options') -const { re, t } = require('../internal/re') -const cmp = require('../functions/cmp') -const debug = require('../internal/debug') -const SemVer = require('./semver') -const Range = require('./range') diff --git a/node_modules/semver/classes/index.js b/node_modules/semver/classes/index.js deleted file mode 100644 index 5e3f5c9b19cef..0000000000000 --- a/node_modules/semver/classes/index.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - SemVer: require('./semver.js'), - Range: require('./range.js'), - Comparator: require('./comparator.js'), -} diff --git a/node_modules/semver/classes/range.js b/node_modules/semver/classes/range.js deleted file mode 100644 index 7dc24bc714b02..0000000000000 --- a/node_modules/semver/classes/range.js +++ /dev/null @@ -1,519 +0,0 @@ -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - options = parseOptions(options) - - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First, split based on boolean or || - this.raw = range - this.set = range - .split('||') - // map the range to a 2d array of comparators - .map(r => this.parseRange(r.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) - - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${range}`) - } - - // if we have any that are not the null set, throw out null sets. - if (this.set.length > 1) { - // keep the first one, in case they're all null sets - const first = this.set[0] - this.set = this.set.filter(c => !isNullSet(c[0])) - if (this.set.length === 0) { - this.set = [first] - } else if (this.set.length > 1) { - // if we have any that are *, then the range is just * - for (const c of this.set) { - if (c.length === 1 && isAny(c[0])) { - this.set = [c] - break - } - } - } - } - - this.format() - } - - format () { - this.range = this.set - .map((comps) => { - return comps.join(' ').trim() - }) - .join('||') - .trim() - return this.range - } - - toString () { - return this.range - } - - parseRange (range) { - range = range.trim() - - // memoize range parsing for performance. - // this is a very hot path, and fully deterministic. - const memoOpts = Object.keys(this.options).join(',') - const memoKey = `parseRange:${memoOpts}:${range}` - const cached = cache.get(memoKey) - if (cached) { - return cached - } - - const loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - let rangeList = range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - // >=0.0.0 is equivalent to * - .map(comp => replaceGTE0(comp, this.options)) - - if (loose) { - // in loose mode, throw out any that are not valid comparators - rangeList = rangeList.filter(comp => { - debug('loose invalid filter', comp, this.options) - return !!comp.match(re[t.COMPARATORLOOSE]) - }) - } - debug('range list', rangeList) - - // if any comparators are the null set, then replace with JUST null set - // if more than one comparator, remove any * comparators - // also, don't include the same comparator more than once - const rangeMap = new Map() - const comparators = rangeList.map(comp => new Comparator(comp, this.options)) - for (const comp of comparators) { - if (isNullSet(comp)) { - return [comp] - } - rangeMap.set(comp.value, comp) - } - if (rangeMap.size > 1 && rangeMap.has('')) { - rangeMap.delete('') - } - - const result = [...rangeMap.values()] - cache.set(memoKey, result) - return result - } - - intersects (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some((thisComparators) => { - return ( - isSatisfiable(thisComparators, options) && - range.set.some((rangeComparators) => { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) - } - - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false - } -} -module.exports = Range - -const LRU = require('lru-cache') -const cache = new LRU({ max: 1000 }) - -const parseOptions = require('../internal/parse-options') -const Comparator = require('./comparator') -const debug = require('../internal/debug') -const SemVer = require('./semver') -const { - re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace, -} = require('../internal/re') - -const isNullSet = c => c.value === '<0.0.0-0' -const isAny = c => c.value === '' - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const isSatisfiable = (comparators, options) => { - let result = true - const remainingComparators = comparators.slice() - let testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options) - }) - - testComparator = remainingComparators.pop() - } - - return result -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const parseComparator = (comp, options) => { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -const replaceTildes = (comp, options) => - comp.trim().split(/\s+/).map((c) => { - return replaceTilde(c, options) - }).join(' ') - -const replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, (_, M, m, p, pr) => { - debug('tilde', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` - } else if (pr) { - debug('replaceTilde pr', pr) - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } else { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -const replaceCarets = (comp, options) => - comp.trim().split(/\s+/).map((c) => { - return replaceCaret(c, options) - }).join(' ') - -const replaceCaret = (comp, options) => { - debug('caret', comp, options) - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - const z = options.includePrerelease ? '-0' : '' - return comp.replace(r, (_, M, m, p, pr) => { - debug('caret', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` - } else if (isX(p)) { - if (M === '0') { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${+M + 1}.0.0-0` - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p - }${z} <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p - }${z} <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p - } <${+M + 1}.0.0-0` - } - } - - debug('caret return', ret) - return ret - }) -} - -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map((c) => { - return replaceXRange(c, options) - }).join(' ') -} - -const replaceXRange = (comp, options) => { - comp = comp.trim() - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - const xM = isX(M) - const xm = xM || isX(m) - const xp = xm || isX(p) - const anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - if (gtlt === '<') { - pr = '-0' - } - - ret = `${gtlt + M}.${m}.${p}${pr}` - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` - } else if (xp) { - ret = `>=${M}.${m}.0${pr - } <${M}.${+m + 1}.0-0` - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') -} - -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp.trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const hyphenReplace = incPr => ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) => { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? '-0' : ''}` - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` - } else if (fpr) { - from = `>=${from}` - } else { - from = `>=${from}${incPr ? '-0' : ''}` - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0` - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0` - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}` - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0` - } else { - to = `<=${to}` - } - - return (`${from} ${to}`).trim() -} - -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (let i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === Comparator.ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} diff --git a/node_modules/semver/classes/semver.js b/node_modules/semver/classes/semver.js deleted file mode 100644 index af62955194793..0000000000000 --- a/node_modules/semver/classes/semver.js +++ /dev/null @@ -1,287 +0,0 @@ -const debug = require('../internal/debug') -const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') -const { re, t } = require('../internal/re') - -const parseOptions = require('../internal/parse-options') -const { compareIdentifiers } = require('../internal/identifiers') -class SemVer { - constructor (version, options) { - options = parseOptions(options) - - if (version instanceof SemVer) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid Version: ${version}`) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease - - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() - } - - format () { - this.version = `${this.major}.${this.minor}.${this.patch}` - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}` - } - return this.version - } - - toString () { - return this.version - } - - compare (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer(other, this.options) - } - - if (other.version === this.version) { - return 0 - } - - return this.compareMain(other) || this.comparePre(other) - } - - compareMain (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) - } - - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - compareBuild (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - let i = 0 - do { - const a = this.build[i] - const b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - let i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (compareIdentifiers(this.prerelease[0], identifier) === 0) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error(`invalid increment argument: ${release}`) - } - this.format() - this.raw = this.version - return this - } -} - -module.exports = SemVer diff --git a/node_modules/semver/functions/clean.js b/node_modules/semver/functions/clean.js deleted file mode 100644 index 811fe6b82cb73..0000000000000 --- a/node_modules/semver/functions/clean.js +++ /dev/null @@ -1,6 +0,0 @@ -const parse = require('./parse') -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} -module.exports = clean diff --git a/node_modules/semver/functions/cmp.js b/node_modules/semver/functions/cmp.js deleted file mode 100644 index 40119094747dd..0000000000000 --- a/node_modules/semver/functions/cmp.js +++ /dev/null @@ -1,52 +0,0 @@ -const eq = require('./eq') -const neq = require('./neq') -const gt = require('./gt') -const gte = require('./gte') -const lt = require('./lt') -const lte = require('./lte') - -const cmp = (a, op, b, loose) => { - switch (op) { - case '===': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a === b - - case '!==': - if (typeof a === 'object') { - a = a.version - } - if (typeof b === 'object') { - b = b.version - } - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError(`Invalid operator: ${op}`) - } -} -module.exports = cmp diff --git a/node_modules/semver/functions/coerce.js b/node_modules/semver/functions/coerce.js deleted file mode 100644 index 2e01452fddad6..0000000000000 --- a/node_modules/semver/functions/coerce.js +++ /dev/null @@ -1,52 +0,0 @@ -const SemVer = require('../classes/semver') -const parse = require('./parse') -const { re, t } = require('../internal/re') - -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - let match = null - if (!options.rtl) { - match = version.match(re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - let next - while ((next = re[t.COERCERTL].exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 - } - - if (match === null) { - return null - } - - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) -} -module.exports = coerce diff --git a/node_modules/semver/functions/compare-build.js b/node_modules/semver/functions/compare-build.js deleted file mode 100644 index 9eb881bef0fdd..0000000000000 --- a/node_modules/semver/functions/compare-build.js +++ /dev/null @@ -1,7 +0,0 @@ -const SemVer = require('../classes/semver') -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} -module.exports = compareBuild diff --git a/node_modules/semver/functions/compare-loose.js b/node_modules/semver/functions/compare-loose.js deleted file mode 100644 index 4881fbe00250c..0000000000000 --- a/node_modules/semver/functions/compare-loose.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose diff --git a/node_modules/semver/functions/compare.js b/node_modules/semver/functions/compare.js deleted file mode 100644 index 748b7afa514a9..0000000000000 --- a/node_modules/semver/functions/compare.js +++ /dev/null @@ -1,5 +0,0 @@ -const SemVer = require('../classes/semver') -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) - -module.exports = compare diff --git a/node_modules/semver/functions/diff.js b/node_modules/semver/functions/diff.js deleted file mode 100644 index 87200ef3b88e8..0000000000000 --- a/node_modules/semver/functions/diff.js +++ /dev/null @@ -1,23 +0,0 @@ -const parse = require('./parse') -const eq = require('./eq') - -const diff = (version1, version2) => { - if (eq(version1, version2)) { - return null - } else { - const v1 = parse(version1) - const v2 = parse(version2) - const hasPre = v1.prerelease.length || v2.prerelease.length - const prefix = hasPre ? 'pre' : '' - const defaultResult = hasPre ? 'prerelease' : '' - for (const key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} -module.exports = diff diff --git a/node_modules/semver/functions/eq.js b/node_modules/semver/functions/eq.js deleted file mode 100644 index 271fed976f34a..0000000000000 --- a/node_modules/semver/functions/eq.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq diff --git a/node_modules/semver/functions/gt.js b/node_modules/semver/functions/gt.js deleted file mode 100644 index d9b2156d8b56c..0000000000000 --- a/node_modules/semver/functions/gt.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt diff --git a/node_modules/semver/functions/gte.js b/node_modules/semver/functions/gte.js deleted file mode 100644 index 5aeaa634707a0..0000000000000 --- a/node_modules/semver/functions/gte.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte diff --git a/node_modules/semver/functions/inc.js b/node_modules/semver/functions/inc.js deleted file mode 100644 index 62d1da2c4093b..0000000000000 --- a/node_modules/semver/functions/inc.js +++ /dev/null @@ -1,18 +0,0 @@ -const SemVer = require('../classes/semver') - -const inc = (version, release, options, identifier) => { - if (typeof (options) === 'string') { - identifier = options - options = undefined - } - - try { - return new SemVer( - version instanceof SemVer ? version.version : version, - options - ).inc(release, identifier).version - } catch (er) { - return null - } -} -module.exports = inc diff --git a/node_modules/semver/functions/lt.js b/node_modules/semver/functions/lt.js deleted file mode 100644 index b440ab7d4212d..0000000000000 --- a/node_modules/semver/functions/lt.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt diff --git a/node_modules/semver/functions/lte.js b/node_modules/semver/functions/lte.js deleted file mode 100644 index 6dcc956505584..0000000000000 --- a/node_modules/semver/functions/lte.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte diff --git a/node_modules/semver/functions/major.js b/node_modules/semver/functions/major.js deleted file mode 100644 index 4283165e9d271..0000000000000 --- a/node_modules/semver/functions/major.js +++ /dev/null @@ -1,3 +0,0 @@ -const SemVer = require('../classes/semver') -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major diff --git a/node_modules/semver/functions/minor.js b/node_modules/semver/functions/minor.js deleted file mode 100644 index 57b3455f827ba..0000000000000 --- a/node_modules/semver/functions/minor.js +++ /dev/null @@ -1,3 +0,0 @@ -const SemVer = require('../classes/semver') -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor diff --git a/node_modules/semver/functions/neq.js b/node_modules/semver/functions/neq.js deleted file mode 100644 index f944c01576973..0000000000000 --- a/node_modules/semver/functions/neq.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq diff --git a/node_modules/semver/functions/parse.js b/node_modules/semver/functions/parse.js deleted file mode 100644 index a66663aa5918f..0000000000000 --- a/node_modules/semver/functions/parse.js +++ /dev/null @@ -1,33 +0,0 @@ -const { MAX_LENGTH } = require('../internal/constants') -const { re, t } = require('../internal/re') -const SemVer = require('../classes/semver') - -const parseOptions = require('../internal/parse-options') -const parse = (version, options) => { - options = parseOptions(options) - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - const r = options.loose ? re[t.LOOSE] : re[t.FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -module.exports = parse diff --git a/node_modules/semver/functions/patch.js b/node_modules/semver/functions/patch.js deleted file mode 100644 index 63afca2524fca..0000000000000 --- a/node_modules/semver/functions/patch.js +++ /dev/null @@ -1,3 +0,0 @@ -const SemVer = require('../classes/semver') -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch diff --git a/node_modules/semver/functions/prerelease.js b/node_modules/semver/functions/prerelease.js deleted file mode 100644 index 06aa13248ae65..0000000000000 --- a/node_modules/semver/functions/prerelease.js +++ /dev/null @@ -1,6 +0,0 @@ -const parse = require('./parse') -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} -module.exports = prerelease diff --git a/node_modules/semver/functions/rcompare.js b/node_modules/semver/functions/rcompare.js deleted file mode 100644 index 0ac509e79dc8c..0000000000000 --- a/node_modules/semver/functions/rcompare.js +++ /dev/null @@ -1,3 +0,0 @@ -const compare = require('./compare') -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare diff --git a/node_modules/semver/functions/rsort.js b/node_modules/semver/functions/rsort.js deleted file mode 100644 index 82404c5cfe026..0000000000000 --- a/node_modules/semver/functions/rsort.js +++ /dev/null @@ -1,3 +0,0 @@ -const compareBuild = require('./compare-build') -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort diff --git a/node_modules/semver/functions/satisfies.js b/node_modules/semver/functions/satisfies.js deleted file mode 100644 index 50af1c199b6ca..0000000000000 --- a/node_modules/semver/functions/satisfies.js +++ /dev/null @@ -1,10 +0,0 @@ -const Range = require('../classes/range') -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} -module.exports = satisfies diff --git a/node_modules/semver/functions/sort.js b/node_modules/semver/functions/sort.js deleted file mode 100644 index 4d10917aba8e5..0000000000000 --- a/node_modules/semver/functions/sort.js +++ /dev/null @@ -1,3 +0,0 @@ -const compareBuild = require('./compare-build') -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort diff --git a/node_modules/semver/functions/valid.js b/node_modules/semver/functions/valid.js deleted file mode 100644 index f27bae10731c0..0000000000000 --- a/node_modules/semver/functions/valid.js +++ /dev/null @@ -1,6 +0,0 @@ -const parse = require('./parse') -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid diff --git a/node_modules/semver/index.js b/node_modules/semver/index.js deleted file mode 100644 index 57e2ae649479b..0000000000000 --- a/node_modules/semver/index.js +++ /dev/null @@ -1,48 +0,0 @@ -// just pre-load all the stuff that index.js lazily exports -const internalRe = require('./internal/re') -module.exports = { - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: require('./internal/constants').SEMVER_SPEC_VERSION, - SemVer: require('./classes/semver'), - compareIdentifiers: require('./internal/identifiers').compareIdentifiers, - rcompareIdentifiers: require('./internal/identifiers').rcompareIdentifiers, - parse: require('./functions/parse'), - valid: require('./functions/valid'), - clean: require('./functions/clean'), - inc: require('./functions/inc'), - diff: require('./functions/diff'), - major: require('./functions/major'), - minor: require('./functions/minor'), - patch: require('./functions/patch'), - prerelease: require('./functions/prerelease'), - compare: require('./functions/compare'), - rcompare: require('./functions/rcompare'), - compareLoose: require('./functions/compare-loose'), - compareBuild: require('./functions/compare-build'), - sort: require('./functions/sort'), - rsort: require('./functions/rsort'), - gt: require('./functions/gt'), - lt: require('./functions/lt'), - eq: require('./functions/eq'), - neq: require('./functions/neq'), - gte: require('./functions/gte'), - lte: require('./functions/lte'), - cmp: require('./functions/cmp'), - coerce: require('./functions/coerce'), - Comparator: require('./classes/comparator'), - Range: require('./classes/range'), - satisfies: require('./functions/satisfies'), - toComparators: require('./ranges/to-comparators'), - maxSatisfying: require('./ranges/max-satisfying'), - minSatisfying: require('./ranges/min-satisfying'), - minVersion: require('./ranges/min-version'), - validRange: require('./ranges/valid'), - outside: require('./ranges/outside'), - gtr: require('./ranges/gtr'), - ltr: require('./ranges/ltr'), - intersects: require('./ranges/intersects'), - simplifyRange: require('./ranges/simplify'), - subset: require('./ranges/subset'), -} diff --git a/node_modules/semver/internal/constants.js b/node_modules/semver/internal/constants.js deleted file mode 100644 index 4f0de59b56949..0000000000000 --- a/node_modules/semver/internal/constants.js +++ /dev/null @@ -1,17 +0,0 @@ -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' - -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || -/* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 - -module.exports = { - SEMVER_SPEC_VERSION, - MAX_LENGTH, - MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH, -} diff --git a/node_modules/semver/internal/debug.js b/node_modules/semver/internal/debug.js deleted file mode 100644 index 1c00e1369aa2a..0000000000000 --- a/node_modules/semver/internal/debug.js +++ /dev/null @@ -1,9 +0,0 @@ -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} - -module.exports = debug diff --git a/node_modules/semver/internal/identifiers.js b/node_modules/semver/internal/identifiers.js deleted file mode 100644 index e612d0a3d8361..0000000000000 --- a/node_modules/semver/internal/identifiers.js +++ /dev/null @@ -1,23 +0,0 @@ -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) - -module.exports = { - compareIdentifiers, - rcompareIdentifiers, -} diff --git a/node_modules/semver/internal/parse-options.js b/node_modules/semver/internal/parse-options.js deleted file mode 100644 index bbd9ec77a3ff4..0000000000000 --- a/node_modules/semver/internal/parse-options.js +++ /dev/null @@ -1,11 +0,0 @@ -// parse out just the options we care about so we always get a consistent -// obj with keys in a consistent order. -const opts = ['includePrerelease', 'loose', 'rtl'] -const parseOptions = options => - !options ? {} - : typeof options !== 'object' ? { loose: true } - : opts.filter(k => options[k]).reduce((o, k) => { - o[k] = true - return o - }, {}) -module.exports = parseOptions diff --git a/node_modules/semver/internal/re.js b/node_modules/semver/internal/re.js deleted file mode 100644 index ed88398a9dbf5..0000000000000 --- a/node_modules/semver/internal/re.js +++ /dev/null @@ -1,182 +0,0 @@ -const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants') -const debug = require('./debug') -exports = module.exports = {} - -// The actual regexps go on exports.re -const re = exports.re = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 - -const createToken = (name, value, isGlobal) => { - const index = R++ - debug(name, index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) - -createToken('FULL', `^${src[t.FULLPLAIN]}$`) - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - -createToken('GTLT', '((?:<|>)?=?)') - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) - -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCE', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:$|[^\\d])`) -createToken('COERCERTL', src[t.COERCE], true) - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) - -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) - -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json deleted file mode 100644 index 7898f5902cb73..0000000000000 --- a/node_modules/semver/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "semver", - "version": "7.3.7", - "description": "The semantic version parser used by npm.", - "main": "index.js", - "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "lint": "eslint \"**/*.js\"", - "postlint": "template-oss-check", - "lintfix": "npm run lint -- --fix", - "prepublishOnly": "git push origin --follow-tags", - "posttest": "npm run lint", - "template-oss-apply": "template-oss-apply --force" - }, - "devDependencies": { - "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.3.2", - "tap": "^16.0.0" - }, - "license": "ISC", - "repository": { - "type": "git", - "url": "https://github.com/npm/node-semver.git" - }, - "bin": { - "semver": "bin/semver.js" - }, - "files": [ - "bin/", - "classes/", - "functions/", - "internal/", - "ranges/", - "index.js", - "preload.js", - "range.bnf" - ], - "tap": { - "check-coverage": true, - "coverage-map": "map.js" - }, - "engines": { - "node": ">=10" - }, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "author": "GitHub Inc.", - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.3.2", - "engines": ">=10", - "ciVersions": [ - "10.0.0", - "10.x", - "12.x", - "14.x", - "16.x" - ], - "distPaths": [ - "bin/", - "classes/", - "functions/", - "internal/", - "ranges/", - "index.js", - "preload.js", - "range.bnf" - ] - } -} diff --git a/node_modules/semver/preload.js b/node_modules/semver/preload.js deleted file mode 100644 index 947cd4f7917ff..0000000000000 --- a/node_modules/semver/preload.js +++ /dev/null @@ -1,2 +0,0 @@ -// XXX remove in v8 or beyond -module.exports = require('./index.js') diff --git a/node_modules/semver/range.bnf b/node_modules/semver/range.bnf deleted file mode 100644 index d4c6ae0d76c9a..0000000000000 --- a/node_modules/semver/range.bnf +++ /dev/null @@ -1,16 +0,0 @@ -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | [1-9] ( [0-9] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/semver/ranges/gtr.js b/node_modules/semver/ranges/gtr.js deleted file mode 100644 index db7e35599dd56..0000000000000 --- a/node_modules/semver/ranges/gtr.js +++ /dev/null @@ -1,4 +0,0 @@ -// Determine if version is greater than all the versions possible in the range. -const outside = require('./outside') -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr diff --git a/node_modules/semver/ranges/intersects.js b/node_modules/semver/ranges/intersects.js deleted file mode 100644 index 3d1a6f31dfbe0..0000000000000 --- a/node_modules/semver/ranges/intersects.js +++ /dev/null @@ -1,7 +0,0 @@ -const Range = require('../classes/range') -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} -module.exports = intersects diff --git a/node_modules/semver/ranges/ltr.js b/node_modules/semver/ranges/ltr.js deleted file mode 100644 index 528a885ebdfcd..0000000000000 --- a/node_modules/semver/ranges/ltr.js +++ /dev/null @@ -1,4 +0,0 @@ -const outside = require('./outside') -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr diff --git a/node_modules/semver/ranges/max-satisfying.js b/node_modules/semver/ranges/max-satisfying.js deleted file mode 100644 index 6e3d993c67860..0000000000000 --- a/node_modules/semver/ranges/max-satisfying.js +++ /dev/null @@ -1,25 +0,0 @@ -const SemVer = require('../classes/semver') -const Range = require('../classes/range') - -const maxSatisfying = (versions, range, options) => { - let max = null - let maxSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} -module.exports = maxSatisfying diff --git a/node_modules/semver/ranges/min-satisfying.js b/node_modules/semver/ranges/min-satisfying.js deleted file mode 100644 index 9b60974e2253a..0000000000000 --- a/node_modules/semver/ranges/min-satisfying.js +++ /dev/null @@ -1,24 +0,0 @@ -const SemVer = require('../classes/semver') -const Range = require('../classes/range') -const minSatisfying = (versions, range, options) => { - let min = null - let minSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} -module.exports = minSatisfying diff --git a/node_modules/semver/ranges/min-version.js b/node_modules/semver/ranges/min-version.js deleted file mode 100644 index 350e1f78368ea..0000000000000 --- a/node_modules/semver/ranges/min-version.js +++ /dev/null @@ -1,61 +0,0 @@ -const SemVer = require('../classes/semver') -const Range = require('../classes/range') -const gt = require('../functions/gt') - -const minVersion = (range, loose) => { - range = new Range(range, loose) - - let minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - - let setMin = null - comparators.forEach((comparator) => { - // Clone to avoid manipulating the comparator's semver object. - const compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!setMin || gt(compver, setMin)) { - setMin = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) - } - }) - if (setMin && (!minver || gt(minver, setMin))) { - minver = setMin - } - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} -module.exports = minVersion diff --git a/node_modules/semver/ranges/outside.js b/node_modules/semver/ranges/outside.js deleted file mode 100644 index ae99b10a5b9e6..0000000000000 --- a/node_modules/semver/ranges/outside.js +++ /dev/null @@ -1,80 +0,0 @@ -const SemVer = require('../classes/semver') -const Comparator = require('../classes/comparator') -const { ANY } = Comparator -const Range = require('../classes/range') -const satisfies = require('../functions/satisfies') -const gt = require('../functions/gt') -const lt = require('../functions/lt') -const lte = require('../functions/lte') -const gte = require('../functions/gte') - -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) - - let gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisfies the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - - let high = null - let low = null - - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -module.exports = outside diff --git a/node_modules/semver/ranges/simplify.js b/node_modules/semver/ranges/simplify.js deleted file mode 100644 index 618d5b6273551..0000000000000 --- a/node_modules/semver/ranges/simplify.js +++ /dev/null @@ -1,47 +0,0 @@ -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = require('../functions/satisfies.js') -const compare = require('../functions/compare.js') -module.exports = (versions, range, options) => { - const set = [] - let first = null - let prev = null - const v = versions.sort((a, b) => compare(a, b, options)) - for (const version of v) { - const included = satisfies(version, range, options) - if (included) { - prev = version - if (!first) { - first = version - } - } else { - if (prev) { - set.push([first, prev]) - } - prev = null - first = null - } - } - if (first) { - set.push([first, null]) - } - - const ranges = [] - for (const [min, max] of set) { - if (min === max) { - ranges.push(min) - } else if (!max && min === v[0]) { - ranges.push('*') - } else if (!max) { - ranges.push(`>=${min}`) - } else if (min === v[0]) { - ranges.push(`<=${max}`) - } else { - ranges.push(`${min} - ${max}`) - } - } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range -} diff --git a/node_modules/semver/ranges/subset.js b/node_modules/semver/ranges/subset.js deleted file mode 100644 index e0dea43c2b6a8..0000000000000 --- a/node_modules/semver/ranges/subset.js +++ /dev/null @@ -1,244 +0,0 @@ -const Range = require('../classes/range.js') -const Comparator = require('../classes/comparator.js') -const { ANY } = Comparator -const satisfies = require('../functions/satisfies.js') -const compare = require('../functions/compare.js') - -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a null set, OR -// - Every simple range `r1, r2, ...` which is not a null set is a subset of -// some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else if in prerelease mode, return false -// - else replace c with `[>=0.0.0]` -// - If C is only the ANY comparator -// - if in prerelease mode, return true -// - else replace C with `[>=0.0.0]` -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If any C is a = range, and GT or LT are set, return false -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT.semver is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the GT.semver tuple, return false -// - If LT -// - If LT.semver is greater than any < or <= comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If GT.semver has a prerelease, and not in prerelease mode -// - If no C has a prerelease and the LT.semver tuple, return false -// - Else return true - -const subset = (sub, dom, options = {}) => { - if (sub === dom) { - return true - } - - sub = new Range(sub, options) - dom = new Range(dom, options) - let sawNonNull = false - - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options) - sawNonNull = sawNonNull || isSub !== null - if (isSub) { - continue OUTER - } - } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) { - return false - } - } - return true -} - -const simpleSubset = (sub, dom, options) => { - if (sub === dom) { - return true - } - - if (sub.length === 1 && sub[0].semver === ANY) { - if (dom.length === 1 && dom[0].semver === ANY) { - return true - } else if (options.includePrerelease) { - sub = [new Comparator('>=0.0.0-0')] - } else { - sub = [new Comparator('>=0.0.0')] - } - } - - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true - } else { - dom = [new Comparator('>=0.0.0')] - } - } - - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') { - gt = higherGT(gt, c, options) - } else if (c.operator === '<' || c.operator === '<=') { - lt = lowerLT(lt, c, options) - } else { - eqSet.add(c.semver) - } - } - - if (eqSet.size > 1) { - return null - } - - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) { - return null - } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { - return null - } - } - - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null - } - - if (lt && !satisfies(eq, String(lt), options)) { - return null - } - - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false - } - } - - return true - } - - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && - lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false - } - - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomGTPre.major && - c.semver.minor === needDomGTPre.minor && - c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false - } - } - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) { - return false - } - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { - return false - } - } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomLTPre.major && - c.semver.minor === needDomLTPre.minor && - c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false - } - } - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) { - return false - } - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { - return false - } - } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false - } - } - - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false - } - - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false - } - - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) { - return false - } - - return true -} - -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a -} - -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a -} - -module.exports = subset diff --git a/node_modules/semver/ranges/to-comparators.js b/node_modules/semver/ranges/to-comparators.js deleted file mode 100644 index 6c8bc7e6f15a4..0000000000000 --- a/node_modules/semver/ranges/to-comparators.js +++ /dev/null @@ -1,8 +0,0 @@ -const Range = require('../classes/range') - -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - -module.exports = toComparators diff --git a/node_modules/semver/ranges/valid.js b/node_modules/semver/ranges/valid.js deleted file mode 100644 index 365f35689d358..0000000000000 --- a/node_modules/semver/ranges/valid.js +++ /dev/null @@ -1,11 +0,0 @@ -const Range = require('../classes/range') -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange diff --git a/node_modules/sisteransi/license b/node_modules/sisteransi/license deleted file mode 100644 index 13dc83c134675..0000000000000 --- a/node_modules/sisteransi/license +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Terkel Gjervig Nielsen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/sisteransi/package.json b/node_modules/sisteransi/package.json deleted file mode 100755 index e342d6684a711..0000000000000 --- a/node_modules/sisteransi/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "sisteransi", - "version": "1.0.0", - "description": "ANSI escape codes for some terminal swag", - "main": "src/index.js", - "license": "MIT", - "author": { - "name": "Terkel Gjervig", - "email": "terkel@terkel.com", - "url": "https://terkel.com" - }, - "scripts": { - "test": "tape test/*.js | tap-spec" - }, - "repository": { - "type": "git", - "url": "https://github.com/terkelg/sisteransi" - }, - "files": [ - "src" - ], - "keywords": [ - "ansi", - "escape codes", - "escape", - "terminal", - "style" - ], - "devDependencies": { - "tap-spec": "^5.0.0", - "tape": "^4.9.0" - } -} diff --git a/node_modules/sisteransi/readme.md b/node_modules/sisteransi/readme.md deleted file mode 100755 index d10b68403eece..0000000000000 --- a/node_modules/sisteransi/readme.md +++ /dev/null @@ -1,105 +0,0 @@ -# sister ANSI [![Version](https://img.shields.io/npm/v/sisteransi.svg)](https://www.npmjs.com/package/sisteransi) [![Build Status](https://travis-ci.org/terkelg/sisteransi.svg?branch=master)](https://travis-ci.org/terkelg/sisteransi) [![Downloads](https://img.shields.io/npm/dm/sisteransi.svg)](https://www.npmjs.com/package/sisteransi) - -> Ansi escape codes faster than you can say "[Bam bam](https://www.youtube.com/watch?v=OcaPu9JPenU)". - -## Installation - -``` -npm install sisteransi -``` - - -## Usage - -```js -const ansi = require('sisteransi'); -// or const { cursor } = require('sisteransi'); - -const p = str => process.stdout.write(str); - -// move cursor to 2, 1 -p(ansi.cursor.to(2, 1)); - -// to up, one down -p(ansi.cursor.up(2)+ansi.cursor.down(1)); -``` - -## API - -### cursor - -#### to(x, y) -Set the absolute position of the cursor. `x0` `y0` is the top left of the screen. - -#### move(x, y) -Set the position of the cursor relative to its current position. - -#### up(count = 1) -Move cursor up a specific amount of rows. Default is `1`. - -#### down(count = 1) -Move cursor down a specific amount of rows. Default is `1`. - -#### forward(count = 1) -Move cursor forward a specific amount of rows. Default is `1`. - -#### backward(count = 1) -Move cursor backward a specific amount of rows. Default is `1`. - -#### nextLine(count = 1) -Move cursor to the next line a specific amount of lines. Default is `1`. - -#### prevLine(count = 1) -Move cursor to the previous a specific amount of lines. Default is `1`. - -#### left -Move cursor to the left side. - -#### hide -Hide cursor. - -#### show -Show cursor. - - -### scroll - -#### up(count = 1) -Scroll display up a specific amount of lines. Default to `1`. - -#### down(count = 1) -Scroll display down a specific amount of lines. Default to `1`. - - -### erase - -#### screen -Erase the screen and move the cursor the top left position. - -#### up(count = 1) -Erase the screen from the current line up to the top of the screen. Default to `1`. - -#### down(count = 2) -Erase the screen from the current line down to the bottom of the screen. Default to `1`. - -#### line -Erase the entire current line. - -#### lineEnd -Erase from the current cursor position to the end of the current line. - -#### lineStart -Erase from the current cursor position to the start of the current line. - -#### lines(count) -Erase from the current cursor position up the specified amount of rows. - - -## Credit - -This is a fork of [ansi-escapes](https://github.com/sindresorhus/ansi-escapes). - - -## License - -MIT © [Terkel Gjervig](https://terkel.com) diff --git a/node_modules/sisteransi/src/index.js b/node_modules/sisteransi/src/index.js deleted file mode 100644 index 1b2c0770b43cc..0000000000000 --- a/node_modules/sisteransi/src/index.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -const ESC = '\u001B['; -const clear = '\u0007'; -const beep = '\u0007'; - -const cursor = { - to(x, y) { - if (!y) return `${ESC}${x + 1}G`; - return `${ESC}${y + 1};${x + 1}H`; - }, - move(x, y) { - let ret = ''; - - if (x < 0) ret += `${ESC}${-x}D`; - else if (x > 0) ret += `${ESC}${x}C`; - - if (y < 0) ret += `${ESC}${-y}A`; - else if (y > 0) ret += `${ESC}${y}B`; - - return ret; - }, - up: (count = 1) => `${ESC}${count}A`, - down: (count = 1) => `${ESC}${count}B`, - forward: (count = 1) => `${ESC}${count}C`, - backward: (count = 1) => `${ESC}${count}D`, - nextLine: (count = 1) => `${ESC}E`.repeat(count), - prevLine: (count = 1) => `${ESC}F`.repeat(count), - left: `${ESC}G`, - hide: `${ESC}?25l`, - show: `${ESC}?25h` -} - -const scroll = { - up: (count = 1) => `${ESC}S`.repeat(count), - down: (count = 1) => `${ESC}T`.repeat(count) -} - -const erase = { - screen: `${ESC}2J`, - up: (count = 1) => `${ESC}1J`.repeat(count), - down: (count = 1) => `${ESC}J`.repeat(count), - line: `${ESC}2K`, - lineEnd: `${ESC}K`, - lineStart: `${ESC}1K`, - lines(count) { - let clear = ''; - for (let i = 0; i < count; i++) - clear += this.line + (i < count - 1 ? cursor.up() : ''); - if (count) - clear += cursor.left; - return clear; - } -} - -module.exports = { cursor, scroll, erase, beep, clear }; diff --git a/node_modules/stack-utils/index.js b/node_modules/stack-utils/index.js deleted file mode 100644 index c0f6acfc4abe6..0000000000000 --- a/node_modules/stack-utils/index.js +++ /dev/null @@ -1,334 +0,0 @@ -'use strict'; - -const escapeStringRegexp = require('escape-string-regexp'); - -const natives = [].concat( - require('module').builtinModules, - 'bootstrap_node', - 'node', -).map(n => new RegExp(`(?:\\(${n}\\.js:\\d+:\\d+\\)$|^\\s*at ${n}\\.js:\\d+:\\d+$)`)); - -natives.push( - /\(internal\/[^:]+:\d+:\d+\)$/, - /\s*at internal\/[^:]+:\d+:\d+$/, - /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/ -); - -class StackUtils { - constructor (opts) { - opts = { - ignoredPackages: [], - ...opts - }; - - if ('internals' in opts === false) { - opts.internals = StackUtils.nodeInternals(); - } - - if ('cwd' in opts === false) { - opts.cwd = process.cwd() - } - - this._cwd = opts.cwd.replace(/\\/g, '/'); - this._internals = [].concat( - opts.internals, - ignoredPackagesRegExp(opts.ignoredPackages) - ); - - this._wrapCallSite = opts.wrapCallSite || false; - } - - static nodeInternals () { - return [...natives]; - } - - clean (stack, indent = 0) { - indent = ' '.repeat(indent); - - if (!Array.isArray(stack)) { - stack = stack.split('\n'); - } - - if (!(/^\s*at /.test(stack[0])) && (/^\s*at /.test(stack[1]))) { - stack = stack.slice(1); - } - - let outdent = false; - let lastNonAtLine = null; - const result = []; - - stack.forEach(st => { - st = st.replace(/\\/g, '/'); - - if (this._internals.some(internal => internal.test(st))) { - return; - } - - const isAtLine = /^\s*at /.test(st); - - if (outdent) { - st = st.trimEnd().replace(/^(\s+)at /, '$1'); - } else { - st = st.trim(); - if (isAtLine) { - st = st.slice(3); - } - } - - st = st.replace(`${this._cwd}/`, ''); - - if (st) { - if (isAtLine) { - if (lastNonAtLine) { - result.push(lastNonAtLine); - lastNonAtLine = null; - } - - result.push(st); - } else { - outdent = true; - lastNonAtLine = st; - } - } - }); - - return result.map(line => `${indent}${line}\n`).join(''); - } - - captureString (limit, fn = this.captureString) { - if (typeof limit === 'function') { - fn = limit; - limit = Infinity; - } - - const {stackTraceLimit} = Error; - if (limit) { - Error.stackTraceLimit = limit; - } - - const obj = {}; - - Error.captureStackTrace(obj, fn); - const {stack} = obj; - Error.stackTraceLimit = stackTraceLimit; - - return this.clean(stack); - } - - capture (limit, fn = this.capture) { - if (typeof limit === 'function') { - fn = limit; - limit = Infinity; - } - - const {prepareStackTrace, stackTraceLimit} = Error; - Error.prepareStackTrace = (obj, site) => { - if (this._wrapCallSite) { - return site.map(this._wrapCallSite); - } - - return site; - }; - - if (limit) { - Error.stackTraceLimit = limit; - } - - const obj = {}; - Error.captureStackTrace(obj, fn); - const { stack } = obj; - Object.assign(Error, {prepareStackTrace, stackTraceLimit}); - - return stack; - } - - at (fn = this.at) { - const [site] = this.capture(1, fn); - - if (!site) { - return {}; - } - - const res = { - line: site.getLineNumber(), - column: site.getColumnNumber() - }; - - setFile(res, site.getFileName(), this._cwd); - - if (site.isConstructor()) { - res.constructor = true; - } - - if (site.isEval()) { - res.evalOrigin = site.getEvalOrigin(); - } - - // Node v10 stopped with the isNative() on callsites, apparently - /* istanbul ignore next */ - if (site.isNative()) { - res.native = true; - } - - let typename; - try { - typename = site.getTypeName(); - } catch (_) { - } - - if (typename && typename !== 'Object' && typename !== '[object Object]') { - res.type = typename; - } - - const fname = site.getFunctionName(); - if (fname) { - res.function = fname; - } - - const meth = site.getMethodName(); - if (meth && fname !== meth) { - res.method = meth; - } - - return res; - } - - parseLine (line) { - const match = line && line.match(re); - if (!match) { - return null; - } - - const ctor = match[1] === 'new'; - let fname = match[2]; - const evalOrigin = match[3]; - const evalFile = match[4]; - const evalLine = Number(match[5]); - const evalCol = Number(match[6]); - let file = match[7]; - const lnum = match[8]; - const col = match[9]; - const native = match[10] === 'native'; - const closeParen = match[11] === ')'; - let method; - - const res = {}; - - if (lnum) { - res.line = Number(lnum); - } - - if (col) { - res.column = Number(col); - } - - if (closeParen && file) { - // make sure parens are balanced - // if we have a file like "asdf) [as foo] (xyz.js", then odds are - // that the fname should be += " (asdf) [as foo]" and the file - // should be just "xyz.js" - // walk backwards from the end to find the last unbalanced ( - let closes = 0; - for (let i = file.length - 1; i > 0; i--) { - if (file.charAt(i) === ')') { - closes++; - } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') { - closes--; - if (closes === -1 && file.charAt(i - 1) === ' ') { - const before = file.slice(0, i - 1); - const after = file.slice(i + 1); - file = after; - fname += ` (${before}`; - break; - } - } - } - } - - if (fname) { - const methodMatch = fname.match(methodRe); - if (methodMatch) { - fname = methodMatch[1]; - method = methodMatch[2]; - } - } - - setFile(res, file, this._cwd); - - if (ctor) { - res.constructor = true; - } - - if (evalOrigin) { - res.evalOrigin = evalOrigin; - res.evalLine = evalLine; - res.evalColumn = evalCol; - res.evalFile = evalFile && evalFile.replace(/\\/g, '/'); - } - - if (native) { - res.native = true; - } - - if (fname) { - res.function = fname; - } - - if (method && fname !== method) { - res.method = method; - } - - return res; - } -} - -function setFile (result, filename, cwd) { - if (filename) { - filename = filename.replace(/\\/g, '/'); - if (filename.startsWith(`${cwd}/`)) { - filename = filename.slice(cwd.length + 1); - } - - result.file = filename; - } -} - -function ignoredPackagesRegExp(ignoredPackages) { - if (ignoredPackages.length === 0) { - return []; - } - - const packages = ignoredPackages.map(mod => escapeStringRegexp(mod)); - - return new RegExp(`[\/\\\\]node_modules[\/\\\\](?:${packages.join('|')})[\/\\\\][^:]+:\\d+:\\d+`) -} - -const re = new RegExp( - '^' + - // Sometimes we strip out the ' at' because it's noisy - '(?:\\s*at )?' + - // $1 = ctor if 'new' - '(?:(new) )?' + - // $2 = function name (can be literally anything) - // May contain method at the end as [as xyz] - '(?:(.*?) \\()?' + - // (eval at (file.js:1:1), - // $3 = eval origin - // $4:$5:$6 are eval file/line/col, but not normally reported - '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' + - // file:line:col - // $7:$8:$9 - // $10 = 'native' if native - '(?:(.+?):(\\d+):(\\d+)|(native))' + - // maybe close the paren, then end - // if $11 is ), then we only allow balanced parens in the filename - // any imbalance is placed on the fname. This is a heuristic, and - // bound to be incorrect in some edge cases. The bet is that - // having weird characters in method names is more common than - // having weird characters in filenames, which seems reasonable. - '(\\)?)$' -); - -const methodRe = /^(.*?) \[as (.*?)\]$/; - -module.exports = StackUtils; diff --git a/node_modules/stack-utils/license b/node_modules/stack-utils/license deleted file mode 100644 index 28441ca9f5e9f..0000000000000 --- a/node_modules/stack-utils/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Isaac Z. Schlueter , James Talmage (github.com/jamestalmage), and Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/stack-utils/package.json b/node_modules/stack-utils/package.json deleted file mode 100644 index e43ba60140a2e..0000000000000 --- a/node_modules/stack-utils/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "stack-utils", - "version": "2.0.2", - "description": "Captures and cleans stack traces", - "license": "MIT", - "repository": "tapjs/stack-utils", - "author": { - "name": "James Talmage", - "email": "james@talmage.io", - "url": "github.com/jamestalmage" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "tap --no-esm --100", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "files": [ - "index.js" - ], - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "devDependencies": { - "bluebird": "^3.7.2", - "coveralls": "^3.0.9", - "nested-error-stacks": "^2.1.0", - "pify": "^4.0.1", - "q": "^1.5.1", - "tap": "=14.10.2-unbundled" - } -} diff --git a/node_modules/stack-utils/readme.md b/node_modules/stack-utils/readme.md deleted file mode 100644 index c91f9d05362d7..0000000000000 --- a/node_modules/stack-utils/readme.md +++ /dev/null @@ -1,143 +0,0 @@ -# stack-utils - -> Captures and cleans stack traces. - -[![Linux Build](https://travis-ci.org/tapjs/stack-utils.svg?branch=master)](https://travis-ci.org/tapjs/stack-utils) [![Build status](https://ci.appveyor.com/api/projects/status/fb9i157knoixe3iq/branch/master?svg=true)](https://ci.appveyor.com/project/jamestalmage/stack-utils-oiw96/branch/master) [![Coverage](https://coveralls.io/repos/tapjs/stack-utils/badge.svg?branch=master&service=github)](https://coveralls.io/github/tapjs/stack-utils?branch=master) - - -Extracted from `lib/stack.js` in the [`node-tap` project](https://github.com/tapjs/node-tap) - -## Install - -``` -$ npm install --save stack-utils -``` - - -## Usage - -```js -const StackUtils = require('stack-utils'); -const stack = new StackUtils({cwd: process.cwd(), internals: StackUtils.nodeInternals()}); - -console.log(stack.clean(new Error().stack)); -// outputs a beautified stack trace -``` - - -## API - - -### new StackUtils([options]) - -Creates a new `stackUtils` instance. - -#### options - -##### internals - -Type: `array` of `RegularExpression`s - -A set of regular expressions that match internal stack stack trace lines which should be culled from the stack trace. -The default is `StackUtils.nodeInternals()`, this can be disabled by setting `[]` or appended using -`StackUtils.nodeInternals().concat(additionalRegExp)`. See also `ignoredPackages`. - -##### ignoredPackages - -Type: `array` of `string`s - -An array of npm modules to be culled from the stack trace. This list will mapped to regular -expressions and merged with the `internals`. - -Default `''`. - -##### cwd - -Type: `string` - -The path to the current working directory. File names in the stack trace will be shown relative to this directory. - -##### wrapCallSite - -Type: `function(CallSite)` - -A mapping function for manipulating CallSites before processing. The first argument is a CallSite instance, and the function should return a modified CallSite. This is useful for providing source map support. - - -### StackUtils.nodeInternals() - -Returns an array of regular expressions that be used to cull lines from the stack trace that reference common Node.js internal files. - - -### stackUtils.clean(stack, indent = 0) - -Cleans up a stack trace by deleting any lines that match the `internals` passed to the constructor, and shortening file names relative to `cwd`. - -Returns a `string` with the cleaned up stack (always terminated with a `\n` newline character). -Spaces at the start of each line are trimmed, indentation can be added by setting `indent` to the desired number of spaces. - -#### stack - -*Required* -Type: `string` or an `array` of `string`s - - -### stackUtils.capture([limit], [startStackFunction]) - -Captures the current stack trace, returning an array of `CallSite`s. There are good overviews of the available CallSite methods [here](https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces), and [here](https://github.com/sindresorhus/callsites#api). - -#### limit - -Type: `number` -Default: `Infinity` - -Limits the number of lines returned by dropping all lines in excess of the limit. This removes lines from the stack trace. - -#### startStackFunction - -Type: `function` - -The function where the stack trace should start. The first line of the stack trace will be the function that called `startStackFunction`. This removes lines from the end of the stack trace. - - -### stackUtils.captureString([limit], [startStackFunction]) - -Captures the current stack trace, cleans it using `stackUtils.clean(stack)`, and returns a string with the cleaned stack trace. It takes the same arguments as `stackUtils.capture`. - - -### stackUtils.at([startStackFunction]) - -Captures the first line of the stack trace (or the first line after `startStackFunction` if supplied), and returns a `CallSite` like object that is serialization friendly (properties are actual values instead of getter functions). - -The available properties are: - - - `line`: `number` - - `column`: `number` - - `file`: `string` - - `constructor`: `boolean` - - `evalOrigin`: `string` - - `native`: `boolean` - - `type`: `string` - - `function`: `string` - - `method`: `string` - -### stackUtils.parseLine(line) - -Parses a `string` (which should be a single line from a stack trace), and generates an object with the following properties: - - - `line`: `number` - - `column`: `number` - - `file`: `string` - - `constructor`: `boolean` - - `evalOrigin`: `string` - - `evalLine`: `number` - - `evalColumn`: `number` - - `evalFile`: `string` - - `native`: `boolean` - - `function`: `string` - - `method`: `string` - - -## License - -MIT © [Isaac Z. Schlueter](http://github.com/isaacs), [James Talmage](http://github.com/jamestalmage) diff --git a/node_modules/wrap-ansi/index.js b/node_modules/wrap-ansi/index.js deleted file mode 100755 index a6e54431b6444..0000000000000 --- a/node_modules/wrap-ansi/index.js +++ /dev/null @@ -1,186 +0,0 @@ -'use strict'; -const stringWidth = require('string-width'); -const stripAnsi = require('strip-ansi'); -const ansiStyles = require('ansi-styles'); - -const ESCAPES = new Set([ - '\u001B', - '\u009B' -]); - -const END_CODE = 39; - -const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; - -// Calculate the length of words split on ' ', ignoring -// the extra characters added by ansi escape codes -const wordLengths = string => string.split(' ').map(character => stringWidth(character)); - -// Wrap a long word across multiple rows -// Ansi escape codes do not count towards length -const wrapWord = (rows, word, columns) => { - const characters = [...word]; - - let isInsideEscape = false; - let visible = stringWidth(stripAnsi(rows[rows.length - 1])); - - for (const [index, character] of characters.entries()) { - const characterLength = stringWidth(character); - - if (visible + characterLength <= columns) { - rows[rows.length - 1] += character; - } else { - rows.push(character); - visible = 0; - } - - if (ESCAPES.has(character)) { - isInsideEscape = true; - } else if (isInsideEscape && character === 'm') { - isInsideEscape = false; - continue; - } - - if (isInsideEscape) { - continue; - } - - visible += characterLength; - - if (visible === columns && index < characters.length - 1) { - rows.push(''); - visible = 0; - } - } - - // It's possible that the last row we copy over is only - // ansi escape characters, handle this edge-case - if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { - rows[rows.length - 2] += rows.pop(); - } -}; - -// Trims spaces from a string ignoring invisible sequences -const stringVisibleTrimSpacesRight = str => { - const words = str.split(' '); - let last = words.length; - - while (last > 0) { - if (stringWidth(words[last - 1]) > 0) { - break; - } - - last--; - } - - if (last === words.length) { - return str; - } - - return words.slice(0, last).join(' ') + words.slice(last).join(''); -}; - -// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode -// -// 'hard' will never allow a string to take up more than columns characters -// -// 'soft' allows long words to expand past the column length -const exec = (string, columns, options = {}) => { - if (options.trim !== false && string.trim() === '') { - return ''; - } - - let pre = ''; - let ret = ''; - let escapeCode; - - const lengths = wordLengths(string); - let rows = ['']; - - for (const [index, word] of string.split(' ').entries()) { - if (options.trim !== false) { - rows[rows.length - 1] = rows[rows.length - 1].trimLeft(); - } - - let rowLength = stringWidth(rows[rows.length - 1]); - - if (index !== 0) { - if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { - // If we start with a new word but the current row length equals the length of the columns, add a new row - rows.push(''); - rowLength = 0; - } - - if (rowLength > 0 || options.trim === false) { - rows[rows.length - 1] += ' '; - rowLength++; - } - } - - // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' - if (options.hard && lengths[index] > columns) { - const remainingColumns = (columns - rowLength); - const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); - const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); - if (breaksStartingNextLine < breaksStartingThisLine) { - rows.push(''); - } - - wrapWord(rows, word, columns); - continue; - } - - if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { - if (options.wordWrap === false && rowLength < columns) { - wrapWord(rows, word, columns); - continue; - } - - rows.push(''); - } - - if (rowLength + lengths[index] > columns && options.wordWrap === false) { - wrapWord(rows, word, columns); - continue; - } - - rows[rows.length - 1] += word; - } - - if (options.trim !== false) { - rows = rows.map(stringVisibleTrimSpacesRight); - } - - pre = rows.join('\n'); - - for (const [index, character] of [...pre].entries()) { - ret += character; - - if (ESCAPES.has(character)) { - const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4))); - escapeCode = code === END_CODE ? null : code; - } - - const code = ansiStyles.codes.get(Number(escapeCode)); - - if (escapeCode && code) { - if (pre[index + 1] === '\n') { - ret += wrapAnsi(code); - } else if (character === '\n') { - ret += wrapAnsi(escapeCode); - } - } - } - - return ret; -}; - -// For each newline, invoke the method separately -module.exports = (string, columns, options) => { - return String(string) - .normalize() - .replace(/\r\n/g, '\n') - .split('\n') - .map(line => exec(line, columns, options)) - .join('\n'); -}; diff --git a/node_modules/wrap-ansi/license b/node_modules/wrap-ansi/license deleted file mode 100644 index e7af2f77107d7..0000000000000 --- a/node_modules/wrap-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/wrap-ansi/package.json b/node_modules/wrap-ansi/package.json deleted file mode 100644 index 1d57c9f14272d..0000000000000 --- a/node_modules/wrap-ansi/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "wrap-ansi", - "version": "6.2.0", - "description": "Wordwrap a string with ANSI escape codes", - "license": "MIT", - "repository": "chalk/wrap-ansi", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && nyc ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "wrap", - "break", - "wordwrap", - "wordbreak", - "linewrap", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "devDependencies": { - "ava": "^2.1.0", - "chalk": "^2.4.2", - "coveralls": "^3.0.3", - "has-ansi": "^3.0.0", - "nyc": "^14.1.1", - "xo": "^0.24.0" - } -} diff --git a/node_modules/wrap-ansi/readme.md b/node_modules/wrap-ansi/readme.md deleted file mode 100644 index d81a4d515f5ba..0000000000000 --- a/node_modules/wrap-ansi/readme.md +++ /dev/null @@ -1,97 +0,0 @@ -# wrap-ansi [![Build Status](https://travis-ci.org/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.org/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master) - -> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) - - -## Install - -``` -$ npm install wrap-ansi -``` - - -## Usage - -```js -const chalk = require('chalk'); -const wrapAnsi = require('wrap-ansi'); - -const input = 'The quick brown ' + chalk.red('fox jumped over ') + - 'the lazy ' + chalk.green('dog and then ran away with the unicorn.'); - -console.log(wrapAnsi(input, 20)); -``` - - - - -## API - -### wrapAnsi(string, columns, options?) - -Wrap words to the specified column width. - -#### string - -Type: `string` - -String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`. - -#### columns - -Type: `number` - -Number of columns to wrap the text to. - -#### options - -Type: `object` - -##### hard - -Type: `boolean`
-Default: `false` - -By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width. - -##### wordWrap - -Type: `boolean`
-Default: `true` - -By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary. - -##### trim - -Type: `boolean`
-Default: `true` - -Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim. - - -## Related - -- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes -- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right -- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures. - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) -- [Benjamin Coe](https://github.com/bcoe) - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/node_modules/write-file-atomic/CHANGELOG.md b/node_modules/write-file-atomic/CHANGELOG.md deleted file mode 100644 index d1a6c1b862baa..0000000000000 --- a/node_modules/write-file-atomic/CHANGELOG.md +++ /dev/null @@ -1,32 +0,0 @@ -# 3.0.0 - -* Implement options.tmpfileCreated callback. -* Drop Node.js 6, modernize code, return Promise from async function. -* Support write TypedArray's like in node fs.writeFile. -* Remove graceful-fs dependency. - -# 2.4.3 - -* Ignore errors raised by `fs.closeSync` when cleaning up after a write - error. - -# 2.4.2 - -* A pair of patches to fix some fd leaks. We would leak fds with sync use - when errors occured and with async use any time fsync was not in use. (#34) - -# 2.4.1 - -* Fix a bug where `signal-exit` instances would be leaked. This was fixed when addressing #35. - -# 2.4.0 - -## Features - -* Allow chown and mode options to be set to false to disable the defaulting behavior. (#20) -* Support passing encoding strings in options slot for compat with Node.js API. (#31) -* Add support for running inside of worker threads (#37) - -## Fixes - -* Remove unneeded call when returning success (#36) diff --git a/node_modules/write-file-atomic/LICENSE b/node_modules/write-file-atomic/LICENSE deleted file mode 100644 index 95e65a7706e0e..0000000000000 --- a/node_modules/write-file-atomic/LICENSE +++ /dev/null @@ -1,6 +0,0 @@ -Copyright (c) 2015, Rebecca Turner - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - diff --git a/node_modules/write-file-atomic/README.md b/node_modules/write-file-atomic/README.md deleted file mode 100644 index caea79956f858..0000000000000 --- a/node_modules/write-file-atomic/README.md +++ /dev/null @@ -1,72 +0,0 @@ -write-file-atomic ------------------ - -This is an extension for node's `fs.writeFile` that makes its operation -atomic and allows you set ownership (uid/gid of the file). - -### var writeFileAtomic = require('write-file-atomic')
writeFileAtomic(filename, data, [options], [callback]) - -* filename **String** -* data **String** | **Buffer** -* options **Object** | **String** - * chown **Object** default, uid & gid of existing file, if any - * uid **Number** - * gid **Number** - * encoding **String** | **Null** default = 'utf8' - * fsync **Boolean** default = true - * mode **Number** default, from existing file, if any - * tmpfileCreated **Function** called when the tmpfile is created -* callback **Function** - -Atomically and asynchronously writes data to a file, replacing the file if it already -exists. data can be a string or a buffer. - -The file is initially named `filename + "." + murmurhex(__filename, process.pid, ++invocations)`. -Note that `require('worker_threads').threadId` is used in addition to `process.pid` if running inside of a worker thread. -If writeFile completes successfully then, if passed the **chown** option it will change -the ownership of the file. Finally it renames the file back to the filename you specified. If -it encounters errors at any of these steps it will attempt to unlink the temporary file and then -pass the error back to the caller. -If multiple writes are concurrently issued to the same file, the write operations are put into a queue and serialized in the order they were called, using Promises. Writes to different files are still executed in parallel. - -If provided, the **chown** option requires both **uid** and **gid** properties or else -you'll get an error. If **chown** is not specified it will default to using -the owner of the previous file. To prevent chown from being ran you can -also pass `false`, in which case the file will be created with the current user's credentials. - -If **mode** is not specified, it will default to using the permissions from -an existing file, if any. Expicitly setting this to `false` remove this default, resulting -in a file created with the system default permissions. - -If options is a String, it's assumed to be the **encoding** option. The **encoding** option is ignored if **data** is a buffer. It defaults to 'utf8'. - -If the **fsync** option is **false**, writeFile will skip the final fsync call. - -If the **tmpfileCreated** option is specified it will be called with the name of the tmpfile when created. - -Example: - -```javascript -writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}, function (err) { - if (err) throw err; - console.log('It\'s saved!'); -}); -``` - -This function also supports async/await: - -```javascript -(async () => { - try { - await writeFileAtomic('message.txt', 'Hello Node', {chown:{uid:100,gid:50}}); - console.log('It\'s saved!'); - } catch (err) { - console.error(err); - process.exit(1); - } -})(); -``` - -### var writeFileAtomicSync = require('write-file-atomic').sync
writeFileAtomicSync(filename, data, [options]) - -The synchronous version of **writeFileAtomic**. diff --git a/node_modules/write-file-atomic/index.js b/node_modules/write-file-atomic/index.js deleted file mode 100644 index df5b72a14f74a..0000000000000 --- a/node_modules/write-file-atomic/index.js +++ /dev/null @@ -1,259 +0,0 @@ -'use strict' -module.exports = writeFile -module.exports.sync = writeFileSync -module.exports._getTmpname = getTmpname // for testing -module.exports._cleanupOnExit = cleanupOnExit - -const fs = require('fs') -const MurmurHash3 = require('imurmurhash') -const onExit = require('signal-exit') -const path = require('path') -const isTypedArray = require('is-typedarray') -const typedArrayToBuffer = require('typedarray-to-buffer') -const { promisify } = require('util') -const activeFiles = {} - -// if we run inside of a worker_thread, `process.pid` is not unique -/* istanbul ignore next */ -const threadId = (function getId () { - try { - const workerThreads = require('worker_threads') - - /// if we are in main thread, this is set to `0` - return workerThreads.threadId - } catch (e) { - // worker_threads are not available, fallback to 0 - return 0 - } -})() - -let invocations = 0 -function getTmpname (filename) { - return filename + '.' + - MurmurHash3(__filename) - .hash(String(process.pid)) - .hash(String(threadId)) - .hash(String(++invocations)) - .result() -} - -function cleanupOnExit (tmpfile) { - return () => { - try { - fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) - } catch (_) {} - } -} - -function serializeActiveFile (absoluteName) { - return new Promise(resolve => { - // make a queue if it doesn't already exist - if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [] - - activeFiles[absoluteName].push(resolve) // add this job to the queue - if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one - }) -} - -// https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L315-L342 -function isChownErrOk (err) { - if (err.code === 'ENOSYS') { - return true - } - - const nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (err.code === 'EINVAL' || err.code === 'EPERM') { - return true - } - } - - return false -} - -async function writeFileAsync (filename, data, options = {}) { - if (typeof options === 'string') { - options = { encoding: options } - } - - let fd - let tmpfile - /* istanbul ignore next -- The closure only gets called when onExit triggers */ - const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) - const absoluteName = path.resolve(filename) - - try { - await serializeActiveFile(absoluteName) - const truename = await promisify(fs.realpath)(filename).catch(() => filename) - tmpfile = getTmpname(truename) - - if (!options.mode || !options.chown) { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - const stats = await promisify(fs.stat)(truename).catch(() => {}) - if (stats) { - if (options.mode == null) { - options.mode = stats.mode - } - - if (options.chown == null && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - } - } - - fd = await promisify(fs.open)(tmpfile, 'w', options.mode) - if (options.tmpfileCreated) { - await options.tmpfileCreated(tmpfile) - } - if (isTypedArray(data)) { - data = typedArrayToBuffer(data) - } - if (Buffer.isBuffer(data)) { - await promisify(fs.write)(fd, data, 0, data.length, 0) - } else if (data != null) { - await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8')) - } - - if (options.fsync !== false) { - await promisify(fs.fsync)(fd) - } - - await promisify(fs.close)(fd) - fd = null - - if (options.chown) { - await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid).catch(err => { - if (!isChownErrOk(err)) { - throw err - } - }) - } - - if (options.mode) { - await promisify(fs.chmod)(tmpfile, options.mode).catch(err => { - if (!isChownErrOk(err)) { - throw err - } - }) - } - - await promisify(fs.rename)(tmpfile, truename) - } finally { - if (fd) { - await promisify(fs.close)(fd).catch( - /* istanbul ignore next */ - () => {} - ) - } - removeOnExitHandler() - await promisify(fs.unlink)(tmpfile).catch(() => {}) - activeFiles[absoluteName].shift() // remove the element added by serializeSameFile - if (activeFiles[absoluteName].length > 0) { - activeFiles[absoluteName][0]() // start next job if one is pending - } else delete activeFiles[absoluteName] - } -} - -function writeFile (filename, data, options, callback) { - if (options instanceof Function) { - callback = options - options = {} - } - - const promise = writeFileAsync(filename, data, options) - if (callback) { - promise.then(callback, callback) - } - - return promise -} - -function writeFileSync (filename, data, options) { - if (typeof options === 'string') options = { encoding: options } - else if (!options) options = {} - try { - filename = fs.realpathSync(filename) - } catch (ex) { - // it's ok, it'll happen on a not yet existing file - } - const tmpfile = getTmpname(filename) - - if (!options.mode || !options.chown) { - // Either mode or chown is not explicitly set - // Default behavior is to copy it from original file - try { - const stats = fs.statSync(filename) - options = Object.assign({}, options) - if (!options.mode) { - options.mode = stats.mode - } - if (!options.chown && process.getuid) { - options.chown = { uid: stats.uid, gid: stats.gid } - } - } catch (ex) { - // ignore stat errors - } - } - - let fd - const cleanup = cleanupOnExit(tmpfile) - const removeOnExitHandler = onExit(cleanup) - - let threw = true - try { - fd = fs.openSync(tmpfile, 'w', options.mode || 0o666) - if (options.tmpfileCreated) { - options.tmpfileCreated(tmpfile) - } - if (isTypedArray(data)) { - data = typedArrayToBuffer(data) - } - if (Buffer.isBuffer(data)) { - fs.writeSync(fd, data, 0, data.length, 0) - } else if (data != null) { - fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) - } - if (options.fsync !== false) { - fs.fsyncSync(fd) - } - - fs.closeSync(fd) - fd = null - - if (options.chown) { - try { - fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) - } catch (err) { - if (!isChownErrOk(err)) { - throw err - } - } - } - - if (options.mode) { - try { - fs.chmodSync(tmpfile, options.mode) - } catch (err) { - if (!isChownErrOk(err)) { - throw err - } - } - } - - fs.renameSync(tmpfile, filename) - threw = false - } finally { - if (fd) { - try { - fs.closeSync(fd) - } catch (ex) { - // ignore close errors at this stage, error may have closed fd already. - } - } - removeOnExitHandler() - if (threw) { - cleanup() - } - } -} diff --git a/node_modules/write-file-atomic/package.json b/node_modules/write-file-atomic/package.json deleted file mode 100644 index 98a29a053453a..0000000000000 --- a/node_modules/write-file-atomic/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "write-file-atomic", - "version": "3.0.3", - "description": "Write files in an atomic fashion w/configurable ownership", - "main": "index.js", - "scripts": { - "test": "tap", - "posttest": "npm run lint", - "lint": "standard", - "postlint": "rimraf chowncopy good nochmod nochown nofsync nofsyncopt noopen norename \"norename nounlink\" nowrite", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" - }, - "repository": { - "type": "git", - "url": "git://github.com/npm/write-file-atomic.git" - }, - "keywords": [ - "writeFile", - "atomic" - ], - "author": "Rebecca Turner (http://re-becca.org)", - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/write-file-atomic/issues" - }, - "homepage": "https://github.com/npm/write-file-atomic", - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - }, - "devDependencies": { - "mkdirp": "^0.5.1", - "require-inject": "^1.4.4", - "rimraf": "^2.6.3", - "standard": "^14.3.1", - "tap": "^14.10.6" - }, - "files": [ - "index.js" - ], - "tap": { - "100": true - } -} diff --git a/node_modules/yargs-parser/CHANGELOG.md b/node_modules/yargs-parser/CHANGELOG.md deleted file mode 100644 index d91dc516769ae..0000000000000 --- a/node_modules/yargs-parser/CHANGELOG.md +++ /dev/null @@ -1,601 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16) - - -### Bug Fixes - -* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e)) - -### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26) - - -### Bug Fixes - -* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13)) - -### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16) - - -### Bug Fixes - -* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential -prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2)) - -## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07) - - -### Features - -* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f)) - -## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02) - - -### ⚠ BREAKING CHANGES - -* the narg count is now enforced when parsing arrays. - -### Features - -* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c)) - -## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01) - - -### Features - -* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb)) - -### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29) - - -### Bug Fixes - -* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba)) - -## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10) - - -### ⚠ BREAKING CHANGES - -* this reverts parsing behavior of booleans to that of yargs@14 -* objects used during parsing are now created with a null -prototype. There may be some scenarios where this change in behavior -leaks externally. - -### Features - -* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5)) -* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732)) - - -### Bug Fixes - -* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346)) -* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c)) -* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de)) -* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5)) - -## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01) - - -### ⚠ BREAKING CHANGES - -* populate error if incompatible narg/count or array/count options are used (#191) - -### Features - -* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0)) -* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9)) - - -### Reverts - -* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf)) - -## [15.0.0](https://github.com/yargs/yargs-parser/compare/v14.0.0...v15.0.0) (2019-10-07) - - -### Features - -* rework `collect-unknown-options` into `unknown-options-as-args`, providing more comprehensive functionality ([ef771ca](https://github.com/yargs/yargs-parser/commit/ef771ca)) - - -### BREAKING CHANGES - -* rework `collect-unknown-options` into `unknown-options-as-args`, providing more comprehensive functionality - - - -## [14.0.0](https://github.com/yargs/yargs-parser/compare/v13.1.1...v14.0.0) (2019-09-06) - - -### Bug Fixes - -* boolean arrays with default values ([#185](https://github.com/yargs/yargs-parser/issues/185)) ([7d42572](https://github.com/yargs/yargs-parser/commit/7d42572)) -* boolean now behaves the same as other array types ([#184](https://github.com/yargs/yargs-parser/issues/184)) ([17ca3bd](https://github.com/yargs/yargs-parser/commit/17ca3bd)) -* eatNargs() for 'opt.narg === 0' and boolean typed options ([#188](https://github.com/yargs/yargs-parser/issues/188)) ([c5a1db0](https://github.com/yargs/yargs-parser/commit/c5a1db0)) -* maybeCoerceNumber now takes precedence over coerce return value ([#182](https://github.com/yargs/yargs-parser/issues/182)) ([2f26436](https://github.com/yargs/yargs-parser/commit/2f26436)) -* take into account aliases when appending arrays from config object ([#199](https://github.com/yargs/yargs-parser/issues/199)) ([f8a2d3f](https://github.com/yargs/yargs-parser/commit/f8a2d3f)) - - -### Features - -* add configuration option to "collect-unknown-options" ([#181](https://github.com/yargs/yargs-parser/issues/181)) ([7909cc4](https://github.com/yargs/yargs-parser/commit/7909cc4)) -* maybeCoerceNumber() now takes into account arrays ([#187](https://github.com/yargs/yargs-parser/issues/187)) ([31c204b](https://github.com/yargs/yargs-parser/commit/31c204b)) - - -### BREAKING CHANGES - -* unless "parse-numbers" is set to "false", arrays of numeric strings are now parsed as numbers, rather than strings. -* we have dropped the broken "defaulted" functionality; we would like to revisit adding this in the future. -* maybeCoerceNumber now takes precedence over coerce return value (#182) - - - -### [13.1.1](https://www.github.com/yargs/yargs-parser/compare/v13.1.0...v13.1.1) (2019-06-10) - - -### Bug Fixes - -* convert values to strings when tokenizing ([#167](https://www.github.com/yargs/yargs-parser/issues/167)) ([57b7883](https://www.github.com/yargs/yargs-parser/commit/57b7883)) -* nargs should allow duplicates when duplicate-arguments-array=false ([#164](https://www.github.com/yargs/yargs-parser/issues/164)) ([47ccb0b](https://www.github.com/yargs/yargs-parser/commit/47ccb0b)) -* should populate "_" when given config with "short-option-groups" false ([#179](https://www.github.com/yargs/yargs-parser/issues/179)) ([6055974](https://www.github.com/yargs/yargs-parser/commit/6055974)) - -## [13.1.0](https://github.com/yargs/yargs-parser/compare/v13.0.0...v13.1.0) (2019-05-05) - - -### Features - -* add `strip-aliased` and `strip-dashed` configuration options. ([#172](https://github.com/yargs/yargs-parser/issues/172)) ([a3936aa](https://github.com/yargs/yargs-parser/commit/a3936aa)) -* support boolean which do not consume next argument. ([#171](https://github.com/yargs/yargs-parser/issues/171)) ([0ae7fcb](https://github.com/yargs/yargs-parser/commit/0ae7fcb)) - - - - -# [13.0.0](https://github.com/yargs/yargs-parser/compare/v12.0.0...v13.0.0) (2019-02-02) - - -### Features - -* don't coerce number from string with leading '0' or '+' ([#158](https://github.com/yargs/yargs-parser/issues/158)) ([18d0fd5](https://github.com/yargs/yargs-parser/commit/18d0fd5)) - - -### BREAKING CHANGES - -* options with leading '+' or '0' now parse as strings - - - - -# [12.0.0](https://github.com/yargs/yargs-parser/compare/v11.1.1...v12.0.0) (2019-01-29) - - -### Bug Fixes - -* better handling of quoted strings ([#153](https://github.com/yargs/yargs-parser/issues/153)) ([2fb71b2](https://github.com/yargs/yargs-parser/commit/2fb71b2)) - - -### Features - -* default value is now used if no right-hand value provided for numbers/strings ([#156](https://github.com/yargs/yargs-parser/issues/156)) ([5a7c46a](https://github.com/yargs/yargs-parser/commit/5a7c46a)) - - -### BREAKING CHANGES - -* a flag with no right-hand value no longer populates defaulted options with `undefined`. -* quotes at beginning and endings of strings are not removed during parsing. - - - - -## [11.1.1](https://github.com/yargs/yargs-parser/compare/v11.1.0...v11.1.1) (2018-11-19) - - -### Bug Fixes - -* ensure empty string is added into argv._ ([#140](https://github.com/yargs/yargs-parser/issues/140)) ([79cda98](https://github.com/yargs/yargs-parser/commit/79cda98)) - - -### Reverts - -* make requiresArg work in conjunction with arrays ([#136](https://github.com/yargs/yargs-parser/issues/136)) ([f4a3063](https://github.com/yargs/yargs-parser/commit/f4a3063)) - - - - -# [11.1.0](https://github.com/yargs/yargs-parser/compare/v11.0.0...v11.1.0) (2018-11-10) - - -### Bug Fixes - -* handling of one char alias ([#139](https://github.com/yargs/yargs-parser/issues/139)) ([ee56e31](https://github.com/yargs/yargs-parser/commit/ee56e31)) - - -### Features - -* add halt-at-non-option configuration option ([#130](https://github.com/yargs/yargs-parser/issues/130)) ([a849fce](https://github.com/yargs/yargs-parser/commit/a849fce)) - - - - -# [11.0.0](https://github.com/yargs/yargs-parser/compare/v10.1.0...v11.0.0) (2018-10-06) - - -### Bug Fixes - -* flatten-duplicate-arrays:false for more than 2 arrays ([#128](https://github.com/yargs/yargs-parser/issues/128)) ([2bc395f](https://github.com/yargs/yargs-parser/commit/2bc395f)) -* hyphenated flags combined with dot notation broke parsing ([#131](https://github.com/yargs/yargs-parser/issues/131)) ([dc788da](https://github.com/yargs/yargs-parser/commit/dc788da)) -* make requiresArg work in conjunction with arrays ([#136](https://github.com/yargs/yargs-parser/issues/136)) ([77ae1d4](https://github.com/yargs/yargs-parser/commit/77ae1d4)) - - -### Chores - -* update dependencies ([6dc42a1](https://github.com/yargs/yargs-parser/commit/6dc42a1)) - - -### Features - -* also add camelCase array options ([#125](https://github.com/yargs/yargs-parser/issues/125)) ([08c0117](https://github.com/yargs/yargs-parser/commit/08c0117)) -* array.type can now be provided, supporting coercion ([#132](https://github.com/yargs/yargs-parser/issues/132)) ([4b8cfce](https://github.com/yargs/yargs-parser/commit/4b8cfce)) - - -### BREAKING CHANGES - -* drops Node 4 support -* the argv object is now populated differently (correctly) when hyphens and dot notation are used in conjunction. - - - - -# [10.1.0](https://github.com/yargs/yargs-parser/compare/v10.0.0...v10.1.0) (2018-06-29) - - -### Features - -* add `set-placeholder-key` configuration ([#123](https://github.com/yargs/yargs-parser/issues/123)) ([19386ee](https://github.com/yargs/yargs-parser/commit/19386ee)) - - - - -# [10.0.0](https://github.com/yargs/yargs-parser/compare/v9.0.2...v10.0.0) (2018-04-04) - - -### Bug Fixes - -* do not set boolean flags if not defined in `argv` ([#119](https://github.com/yargs/yargs-parser/issues/119)) ([f6e6599](https://github.com/yargs/yargs-parser/commit/f6e6599)) - - -### BREAKING CHANGES - -* `boolean` flags defined without a `default` value will now behave like other option type and won't be set in the parsed results when the user doesn't set the corresponding CLI arg. - -Previous behavior: -```js -var parse = require('yargs-parser'); - -parse('--flag', {boolean: ['flag']}); -// => { _: [], flag: true } - -parse('--no-flag', {boolean: ['flag']}); -// => { _: [], flag: false } - -parse('', {boolean: ['flag']}); -// => { _: [], flag: false } -``` - -New behavior: -```js -var parse = require('yargs-parser'); - -parse('--flag', {boolean: ['flag']}); -// => { _: [], flag: true } - -parse('--no-flag', {boolean: ['flag']}); -// => { _: [], flag: false } - -parse('', {boolean: ['flag']}); -// => { _: [] } => flag not set similarly to other option type -``` - - - - -## [9.0.2](https://github.com/yargs/yargs-parser/compare/v9.0.1...v9.0.2) (2018-01-20) - - -### Bug Fixes - -* nargs was still aggressively consuming too many arguments ([9b28aad](https://github.com/yargs/yargs-parser/commit/9b28aad)) - - - - -## [9.0.1](https://github.com/yargs/yargs-parser/compare/v9.0.0...v9.0.1) (2018-01-20) - - -### Bug Fixes - -* nargs was consuming too many arguments ([4fef206](https://github.com/yargs/yargs-parser/commit/4fef206)) - - - - -# [9.0.0](https://github.com/yargs/yargs-parser/compare/v8.1.0...v9.0.0) (2018-01-20) - - -### Features - -* narg arguments no longer consume flag arguments ([#114](https://github.com/yargs/yargs-parser/issues/114)) ([60bb9b3](https://github.com/yargs/yargs-parser/commit/60bb9b3)) - - -### BREAKING CHANGES - -* arguments of form --foo, -abc, will no longer be consumed by nargs - - - - -# [8.1.0](https://github.com/yargs/yargs-parser/compare/v8.0.0...v8.1.0) (2017-12-20) - - -### Bug Fixes - -* allow null config values ([#108](https://github.com/yargs/yargs-parser/issues/108)) ([d8b14f9](https://github.com/yargs/yargs-parser/commit/d8b14f9)) -* ensure consistent parsing of dot-notation arguments ([#102](https://github.com/yargs/yargs-parser/issues/102)) ([c9bd79c](https://github.com/yargs/yargs-parser/commit/c9bd79c)) -* implement [@antoniom](https://github.com/antoniom)'s fix for camel-case expansion ([3087e1d](https://github.com/yargs/yargs-parser/commit/3087e1d)) -* only run coercion functions once, despite aliases. ([#76](https://github.com/yargs/yargs-parser/issues/76)) ([#103](https://github.com/yargs/yargs-parser/issues/103)) ([507aaef](https://github.com/yargs/yargs-parser/commit/507aaef)) -* scientific notation circumvented bounds check ([#110](https://github.com/yargs/yargs-parser/issues/110)) ([3571f57](https://github.com/yargs/yargs-parser/commit/3571f57)) -* tokenizer should ignore spaces at the beginning of the argString ([#106](https://github.com/yargs/yargs-parser/issues/106)) ([f34ead9](https://github.com/yargs/yargs-parser/commit/f34ead9)) - - -### Features - -* make combining arrays a configurable option ([#111](https://github.com/yargs/yargs-parser/issues/111)) ([c8bf536](https://github.com/yargs/yargs-parser/commit/c8bf536)) -* merge array from arguments with array from config ([#83](https://github.com/yargs/yargs-parser/issues/83)) ([806ddd6](https://github.com/yargs/yargs-parser/commit/806ddd6)) - - - - -# [8.0.0](https://github.com/yargs/yargs-parser/compare/v7.0.0...v8.0.0) (2017-10-05) - - -### Bug Fixes - -* Ignore multiple spaces between arguments. ([#100](https://github.com/yargs/yargs-parser/issues/100)) ([d137227](https://github.com/yargs/yargs-parser/commit/d137227)) - - -### Features - -* allow configuration of prefix for boolean negation ([#94](https://github.com/yargs/yargs-parser/issues/94)) ([00bde7d](https://github.com/yargs/yargs-parser/commit/00bde7d)) -* reworking how numbers are parsed ([#104](https://github.com/yargs/yargs-parser/issues/104)) ([fba00eb](https://github.com/yargs/yargs-parser/commit/fba00eb)) - - -### BREAKING CHANGES - -* strings that fail `Number.isSafeInteger()` are no longer coerced into numbers. - - - - -# [7.0.0](https://github.com/yargs/yargs-parser/compare/v6.0.1...v7.0.0) (2017-05-02) - - -### Chores - -* revert populate-- logic ([#91](https://github.com/yargs/yargs-parser/issues/91)) ([6003e6d](https://github.com/yargs/yargs-parser/commit/6003e6d)) - - -### BREAKING CHANGES - -* populate-- now defaults to false. - - - - -## [6.0.1](https://github.com/yargs/yargs-parser/compare/v6.0.0...v6.0.1) (2017-05-01) - - -### Bug Fixes - -* default '--' to undefined when not provided; this is closer to the array API ([#90](https://github.com/yargs/yargs-parser/issues/90)) ([4e739cc](https://github.com/yargs/yargs-parser/commit/4e739cc)) - - - - -# [6.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v6.0.0) (2017-05-01) - - -### Bug Fixes - -* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f)) -* parsing hints should apply for dot notation keys ([#86](https://github.com/yargs/yargs-parser/issues/86)) ([3e47d62](https://github.com/yargs/yargs-parser/commit/3e47d62)) - - -### Chores - -* upgrade to newest version of camelcase ([#87](https://github.com/yargs/yargs-parser/issues/87)) ([f1903aa](https://github.com/yargs/yargs-parser/commit/f1903aa)) - - -### Features - -* add -- option which allows arguments after the -- flag to be returned separated from positional arguments ([#84](https://github.com/yargs/yargs-parser/issues/84)) ([2572ca8](https://github.com/yargs/yargs-parser/commit/2572ca8)) -* when parsing stops, we now populate "--" by default ([#88](https://github.com/yargs/yargs-parser/issues/88)) ([cd666db](https://github.com/yargs/yargs-parser/commit/cd666db)) - - -### BREAKING CHANGES - -* rather than placing arguments in "_", when parsing is stopped via "--"; we now populate an array called "--" by default. -* camelcase now requires Node 4+. -* environment variables will now override config files (args, env, config-file, config-object) - - - - -# [5.0.0](https://github.com/yargs/yargs-parser/compare/v4.2.1...v5.0.0) (2017-02-18) - - -### Bug Fixes - -* environment variables should take precedence over config file ([#81](https://github.com/yargs/yargs-parser/issues/81)) ([76cee1f](https://github.com/yargs/yargs-parser/commit/76cee1f)) - - -### BREAKING CHANGES - -* environment variables will now override config files (args, env, config-file, config-object) - - - - -## [4.2.1](https://github.com/yargs/yargs-parser/compare/v4.2.0...v4.2.1) (2017-01-02) - - -### Bug Fixes - -* flatten/duplicate regression ([#75](https://github.com/yargs/yargs-parser/issues/75)) ([68d68a0](https://github.com/yargs/yargs-parser/commit/68d68a0)) - - - - -# [4.2.0](https://github.com/yargs/yargs-parser/compare/v4.1.0...v4.2.0) (2016-12-01) - - -### Bug Fixes - -* inner objects in configs had their keys appended to top-level key when dot-notation was disabled ([#72](https://github.com/yargs/yargs-parser/issues/72)) ([0b1b5f9](https://github.com/yargs/yargs-parser/commit/0b1b5f9)) - - -### Features - -* allow multiple arrays to be provided, rather than always combining ([#71](https://github.com/yargs/yargs-parser/issues/71)) ([0f0fb2d](https://github.com/yargs/yargs-parser/commit/0f0fb2d)) - - - - -# [4.1.0](https://github.com/yargs/yargs-parser/compare/v4.0.2...v4.1.0) (2016-11-07) - - -### Features - -* apply coercions to default options ([#65](https://github.com/yargs/yargs-parser/issues/65)) ([c79052b](https://github.com/yargs/yargs-parser/commit/c79052b)) -* handle dot notation boolean options ([#63](https://github.com/yargs/yargs-parser/issues/63)) ([02c3545](https://github.com/yargs/yargs-parser/commit/02c3545)) - - - - -## [4.0.2](https://github.com/yargs/yargs-parser/compare/v4.0.1...v4.0.2) (2016-09-30) - - -### Bug Fixes - -* whoops, let's make the assign not change the Object key order ([29d069a](https://github.com/yargs/yargs-parser/commit/29d069a)) - - - - -## [4.0.1](https://github.com/yargs/yargs-parser/compare/v4.0.0...v4.0.1) (2016-09-30) - - -### Bug Fixes - -* lodash.assign was deprecated ([#59](https://github.com/yargs/yargs-parser/issues/59)) ([5e7eb11](https://github.com/yargs/yargs-parser/commit/5e7eb11)) - - - - -# [4.0.0](https://github.com/yargs/yargs-parser/compare/v3.2.0...v4.0.0) (2016-09-26) - - -### Bug Fixes - -* coerce should be applied to the final objects and arrays created ([#57](https://github.com/yargs/yargs-parser/issues/57)) ([4ca69da](https://github.com/yargs/yargs-parser/commit/4ca69da)) - - -### BREAKING CHANGES - -* coerce is no longer applied to individual arguments in an implicit array. - - - - -# [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13) - - -### Features - -* coerce full array instead of each element ([#51](https://github.com/yargs/yargs-parser/issues/51)) ([cc4dc56](https://github.com/yargs/yargs-parser/commit/cc4dc56)) - - - - -# [3.1.0](https://github.com/yargs/yargs-parser/compare/v3.0.0...v3.1.0) (2016-08-09) - - -### Bug Fixes - -* address pkgConf parsing bug outlined in [#37](https://github.com/yargs/yargs-parser/issues/37) ([#45](https://github.com/yargs/yargs-parser/issues/45)) ([be76ee6](https://github.com/yargs/yargs-parser/commit/be76ee6)) -* better parsing of negative values ([#44](https://github.com/yargs/yargs-parser/issues/44)) ([2e43692](https://github.com/yargs/yargs-parser/commit/2e43692)) -* check aliases when guessing defaults for arguments fixes [#41](https://github.com/yargs/yargs-parser/issues/41) ([#43](https://github.com/yargs/yargs-parser/issues/43)) ([f3e4616](https://github.com/yargs/yargs-parser/commit/f3e4616)) - - -### Features - -* added coerce option, for providing specialized argument parsing ([#42](https://github.com/yargs/yargs-parser/issues/42)) ([7b49cd2](https://github.com/yargs/yargs-parser/commit/7b49cd2)) - - - - -# [3.0.0](https://github.com/yargs/yargs-parser/compare/v2.4.1...v3.0.0) (2016-08-07) - - -### Bug Fixes - -* parsing issue with numeric character in group of options ([#19](https://github.com/yargs/yargs-parser/issues/19)) ([f743236](https://github.com/yargs/yargs-parser/commit/f743236)) -* upgraded lodash.assign ([5d7fdf4](https://github.com/yargs/yargs-parser/commit/5d7fdf4)) - -### BREAKING CHANGES - -* subtle change to how values are parsed in a group of single-character arguments. -* _first released in 3.1.0, better handling of negative values should be considered a breaking change._ - - - - -## [2.4.1](https://github.com/yargs/yargs-parser/compare/v2.4.0...v2.4.1) (2016-07-16) - - -### Bug Fixes - -* **count:** do not increment a default value ([#39](https://github.com/yargs/yargs-parser/issues/39)) ([b04a189](https://github.com/yargs/yargs-parser/commit/b04a189)) - - - - -# [2.4.0](https://github.com/yargs/yargs-parser/compare/v2.3.0...v2.4.0) (2016-04-11) - - -### Features - -* **environment:** Support nested options in environment variables ([#26](https://github.com/yargs/yargs-parser/issues/26)) thanks [@elas7](https://github.com/elas7) \o/ ([020778b](https://github.com/yargs/yargs-parser/commit/020778b)) - - - - -# [2.3.0](https://github.com/yargs/yargs-parser/compare/v2.2.0...v2.3.0) (2016-04-09) - - -### Bug Fixes - -* **boolean:** fix for boolean options with non boolean defaults (#20) ([2dbe86b](https://github.com/yargs/yargs-parser/commit/2dbe86b)), closes [(#20](https://github.com/(/issues/20) -* **package:** remove tests from tarball ([0353c0d](https://github.com/yargs/yargs-parser/commit/0353c0d)) -* **parsing:** handle calling short option with an empty string as the next value. ([a867165](https://github.com/yargs/yargs-parser/commit/a867165)) -* boolean flag when next value contains the strings 'true' or 'false'. ([69941a6](https://github.com/yargs/yargs-parser/commit/69941a6)) -* update dependencies; add standard-version bin for next release (#24) ([822d9d5](https://github.com/yargs/yargs-parser/commit/822d9d5)) - -### Features - -* **configuration:** Allow to pass configuration objects to yargs-parser ([0780900](https://github.com/yargs/yargs-parser/commit/0780900)) -* **normalize:** allow normalize to work with arrays ([e0eaa1a](https://github.com/yargs/yargs-parser/commit/e0eaa1a)) diff --git a/node_modules/yargs-parser/LICENSE.txt b/node_modules/yargs-parser/LICENSE.txt deleted file mode 100644 index 836440bef7cf1..0000000000000 --- a/node_modules/yargs-parser/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2016, Contributors - -Permission to use, copy, modify, and/or distribute this software -for any purpose with or without fee is hereby granted, provided -that the above copyright notice and this permission notice -appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/yargs-parser/README.md b/node_modules/yargs-parser/README.md deleted file mode 100644 index bae61c2a7d690..0000000000000 --- a/node_modules/yargs-parser/README.md +++ /dev/null @@ -1,449 +0,0 @@ -# yargs-parser - -[![Build Status](https://travis-ci.org/yargs/yargs-parser.svg)](https://travis-ci.org/yargs/yargs-parser) -[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser) -[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) - - -The mighty option parser used by [yargs](https://github.com/yargs/yargs). - -visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions. - - - -## Example - -```sh -npm i yargs-parser --save -``` - -```js -var argv = require('yargs-parser')(process.argv.slice(2)) -console.log(argv) -``` - -```sh -node example.js --foo=33 --bar hello -{ _: [], foo: 33, bar: 'hello' } -``` - -_or parse a string!_ - -```js -var argv = require('yargs-parser')('--foo=99 --bar=33') -console.log(argv) -``` - -```sh -{ _: [], foo: 99, bar: 33 } -``` - -Convert an array of mixed types before passing to `yargs-parser`: - -```js -var parse = require('yargs-parser') -parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string -parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings -``` - -## API - -### require('yargs-parser')(args, opts={}) - -Parses command line arguments returning a simple mapping of keys and values. - -**expects:** - -* `args`: a string or array of strings representing the options to parse. -* `opts`: provide a set of hints indicating how `args` should be parsed: - * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`. - * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
- Indicate that keys should be parsed as an array and coerced to booleans / numbers:
- `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`. - * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`. - * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided - (or throws an error). For arrays the function is called only once for the entire array:
- `{coerce: {foo: function (arg) {return modifiedArg}}}`. - * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed). - * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:
- `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`. - * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)). - * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`. - * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`. - * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed. - * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`. - * `opts.normalize`: `path.normalize()` will be applied to values set to this key. - * `opts.number`: keys should be treated as numbers. - * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`). - -**returns:** - -* `obj`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. - -### require('yargs-parser').detailed(args, opts={}) - -Parses a command line string, returning detailed information required by the -yargs engine. - -**expects:** - -* `args`: a string or array of strings representing options to parse. -* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`. - -**returns:** - -* `argv`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. -* `error`: populated with an error object if an exception occurred during parsing. -* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`. -* `newAliases`: any new aliases added via camel-case expansion: - * `boolean`: `{ fooBar: true }` -* `defaulted`: any new argument created by `opts.default`, no aliases included. - * `boolean`: `{ foo: true }` -* `configuration`: given by default settings and `opts.configuration`. - - - -### Configuration - -The yargs-parser applies several automated transformations on the keys provided -in `args`. These features can be turned on and off using the `configuration` field -of `opts`. - -```js -var parsed = parser(['--no-dice'], { - configuration: { - 'boolean-negation': false - } -}) -``` - -### short option groups - -* default: `true`. -* key: `short-option-groups`. - -Should a group of short-options be treated as boolean flags? - -```sh -node example.js -abc -{ _: [], a: true, b: true, c: true } -``` - -_if disabled:_ - -```sh -node example.js -abc -{ _: [], abc: true } -``` - -### camel-case expansion - -* default: `true`. -* key: `camel-case-expansion`. - -Should hyphenated arguments be expanded into camel-case aliases? - -```sh -node example.js --foo-bar -{ _: [], 'foo-bar': true, fooBar: true } -``` - -_if disabled:_ - -```sh -node example.js --foo-bar -{ _: [], 'foo-bar': true } -``` - -### dot-notation - -* default: `true` -* key: `dot-notation` - -Should keys that contain `.` be treated as objects? - -```sh -node example.js --foo.bar -{ _: [], foo: { bar: true } } -``` - -_if disabled:_ - -```sh -node example.js --foo.bar -{ _: [], "foo.bar": true } -``` - -### parse numbers - -* default: `true` -* key: `parse-numbers` - -Should keys that look like numbers be treated as such? - -```sh -node example.js --foo=99.3 -{ _: [], foo: 99.3 } -``` - -_if disabled:_ - -```sh -node example.js --foo=99.3 -{ _: [], foo: "99.3" } -``` - -### boolean negation - -* default: `true` -* key: `boolean-negation` - -Should variables prefixed with `--no` be treated as negations? - -```sh -node example.js --no-foo -{ _: [], foo: false } -``` - -_if disabled:_ - -```sh -node example.js --no-foo -{ _: [], "no-foo": true } -``` - -### combine arrays - -* default: `false` -* key: `combine-arrays` - -Should arrays be combined when provided by both command line arguments and -a configuration file. - -### duplicate arguments array - -* default: `true` -* key: `duplicate-arguments-array` - -Should arguments be coerced into an array when duplicated: - -```sh -node example.js -x 1 -x 2 -{ _: [], x: [1, 2] } -``` - -_if disabled:_ - -```sh -node example.js -x 1 -x 2 -{ _: [], x: 2 } -``` - -### flatten duplicate arrays - -* default: `true` -* key: `flatten-duplicate-arrays` - -Should array arguments be coerced into a single array when duplicated: - -```sh -node example.js -x 1 2 -x 3 4 -{ _: [], x: [1, 2, 3, 4] } -``` - -_if disabled:_ - -```sh -node example.js -x 1 2 -x 3 4 -{ _: [], x: [[1, 2], [3, 4]] } -``` - -### greedy arrays - -* default: `true` -* key: `greedy-arrays` - -Should arrays consume more than one positional argument following their flag. - -```sh -node example --arr 1 2 -{ _[], arr: [1, 2] } -``` - -_if disabled:_ - -```sh -node example --arr 1 2 -{ _[2], arr: [1] } -``` - -**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.** - -### nargs eats options - -* default: `false` -* key: `nargs-eats-options` - -Should nargs consume dash options as well as positional arguments. - -### negation prefix - -* default: `no-` -* key: `negation-prefix` - -The prefix to use for negated boolean variables. - -```sh -node example.js --no-foo -{ _: [], foo: false } -``` - -_if set to `quux`:_ - -```sh -node example.js --quuxfoo -{ _: [], foo: false } -``` - -### populate -- - -* default: `false`. -* key: `populate--` - -Should unparsed flags be stored in `--` or `_`. - -_If disabled:_ - -```sh -node example.js a -b -- x y -{ _: [ 'a', 'x', 'y' ], b: true } -``` - -_If enabled:_ - -```sh -node example.js a -b -- x y -{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true } -``` - -### set placeholder key - -* default: `false`. -* key: `set-placeholder-key`. - -Should a placeholder be added for keys not set via the corresponding CLI argument? - -_If disabled:_ - -```sh -node example.js -a 1 -c 2 -{ _: [], a: 1, c: 2 } -``` - -_If enabled:_ - -```sh -node example.js -a 1 -c 2 -{ _: [], a: 1, b: undefined, c: 2 } -``` - -### halt at non-option - -* default: `false`. -* key: `halt-at-non-option`. - -Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line. - -_If disabled:_ - -```sh -node example.js -a run b -x y -{ _: [ 'b' ], a: 'run', x: 'y' } -``` - -_If enabled:_ - -```sh -node example.js -a run b -x y -{ _: [ 'b', '-x', 'y' ], a: 'run' } -``` - -### strip aliased - -* default: `false` -* key: `strip-aliased` - -Should aliases be removed before returning results? - -_If disabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 } -``` - -_If enabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -### strip dashed - -* default: `false` -* key: `strip-dashed` - -Should dashed keys be removed before returning results? This option has no effect if -`camel-case-expansion` is disabled. - -_If disabled:_ - -```sh -node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -_If enabled:_ - -```sh -node example.js --test-field 1 -{ _: [], testField: 1 } -``` - -### unknown options as args - -* default: `false` -* key: `unknown-options-as-args` - -Should unknown options be treated like regular arguments? An unknown option is one that is not -configured in `opts`. - -_If disabled_ - -```sh -node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true } -``` - -_If enabled_ - -```sh -node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' } -``` - -## Special Thanks - -The yargs project evolves from optimist and minimist. It owes its -existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/ - -## License - -ISC diff --git a/node_modules/yargs-parser/index.js b/node_modules/yargs-parser/index.js deleted file mode 100644 index c14c1fc753c8a..0000000000000 --- a/node_modules/yargs-parser/index.js +++ /dev/null @@ -1,1032 +0,0 @@ -const camelCase = require('camelcase') -const decamelize = require('decamelize') -const path = require('path') -const tokenizeArgString = require('./lib/tokenize-arg-string') -const util = require('util') - -function parse (args, opts) { - opts = Object.assign(Object.create(null), opts) - // allow a string argument to be passed in rather - // than an argv array. - args = tokenizeArgString(args) - - // aliases might have transitive relationships, normalize this. - const aliases = combineAliases(Object.assign(Object.create(null), opts.alias)) - const configuration = Object.assign({ - 'boolean-negation': true, - 'camel-case-expansion': true, - 'combine-arrays': false, - 'dot-notation': true, - 'duplicate-arguments-array': true, - 'flatten-duplicate-arrays': true, - 'greedy-arrays': true, - 'halt-at-non-option': false, - 'nargs-eats-options': false, - 'negation-prefix': 'no-', - 'parse-numbers': true, - 'populate--': false, - 'set-placeholder-key': false, - 'short-option-groups': true, - 'strip-aliased': false, - 'strip-dashed': false, - 'unknown-options-as-args': false - }, opts.configuration) - const defaults = Object.assign(Object.create(null), opts.default) - const configObjects = opts.configObjects || [] - const envPrefix = opts.envPrefix - const notFlagsOption = configuration['populate--'] - const notFlagsArgv = notFlagsOption ? '--' : '_' - const newAliases = Object.create(null) - const defaulted = Object.create(null) - // allow a i18n handler to be passed in, default to a fake one (util.format). - const __ = opts.__ || util.format - const flags = { - aliases: Object.create(null), - arrays: Object.create(null), - bools: Object.create(null), - strings: Object.create(null), - numbers: Object.create(null), - counts: Object.create(null), - normalize: Object.create(null), - configs: Object.create(null), - nargs: Object.create(null), - coercions: Object.create(null), - keys: [] - } - const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/ - const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)') - - ;[].concat(opts.array).filter(Boolean).forEach(function (opt) { - const key = opt.key || opt - - // assign to flags[bools|strings|numbers] - const assignment = Object.keys(opt).map(function (key) { - return ({ - boolean: 'bools', - string: 'strings', - number: 'numbers' - })[key] - }).filter(Boolean).pop() - - // assign key to be coerced - if (assignment) { - flags[assignment][key] = true - } - - flags.arrays[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.boolean).filter(Boolean).forEach(function (key) { - flags.bools[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.number).filter(Boolean).forEach(function (key) { - flags.numbers[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.count).filter(Boolean).forEach(function (key) { - flags.counts[key] = true - flags.keys.push(key) - }) - - ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) { - flags.normalize[key] = true - flags.keys.push(key) - }) - - Object.keys(opts.narg || {}).forEach(function (k) { - flags.nargs[k] = opts.narg[k] - flags.keys.push(k) - }) - - Object.keys(opts.coerce || {}).forEach(function (k) { - flags.coercions[k] = opts.coerce[k] - flags.keys.push(k) - }) - - if (Array.isArray(opts.config) || typeof opts.config === 'string') { - ;[].concat(opts.config).filter(Boolean).forEach(function (key) { - flags.configs[key] = true - }) - } else { - Object.keys(opts.config || {}).forEach(function (k) { - flags.configs[k] = opts.config[k] - }) - } - - // create a lookup table that takes into account all - // combinations of aliases: {f: ['foo'], foo: ['f']} - extendAliases(opts.key, aliases, opts.default, flags.arrays) - - // apply default values to all aliases. - Object.keys(defaults).forEach(function (key) { - (flags.aliases[key] || []).forEach(function (alias) { - defaults[alias] = defaults[key] - }) - }) - - let error = null - checkConfiguration() - - let notFlags = [] - - const argv = Object.assign(Object.create(null), { _: [] }) - // TODO(bcoe): for the first pass at removing object prototype we didn't - // remove all prototypes from objects returned by this API, we might want - // to gradually move towards doing so. - const argvReturn = {} - - for (let i = 0; i < args.length; i++) { - const arg = args[i] - let broken - let key - let letters - let m - let next - let value - - // any unknown option (except for end-of-options, "--") - if (arg !== '--' && isUnknownOptionAsArg(arg)) { - argv._.push(arg) - // -- separated by = - } else if (arg.match(/^--.+=/) || ( - !configuration['short-option-groups'] && arg.match(/^-.+=/) - )) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - m = arg.match(/^--?([^=]+)=([\s\S]*)$/) - - // arrays format = '--f=a b c' - if (checkAllAliases(m[1], flags.arrays)) { - i = eatArray(i, m[1], args, m[2]) - } else if (checkAllAliases(m[1], flags.nargs) !== false) { - // nargs format = '--f=monkey washing cat' - i = eatNargs(i, m[1], args, m[2]) - } else { - setArg(m[1], m[2]) - } - } else if (arg.match(negatedBoolean) && configuration['boolean-negation']) { - key = arg.match(negatedBoolean)[1] - setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false) - - // -- separated by space. - } else if (arg.match(/^--.+/) || ( - !configuration['short-option-groups'] && arg.match(/^-[^-]+/) - )) { - key = arg.match(/^--?(.+)/)[1] - - if (checkAllAliases(key, flags.arrays)) { - // array format = '--foo a b c' - i = eatArray(i, key, args) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '--foo a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args) - } else { - next = args[i + 1] - - if (next !== undefined && (!next.match(/^-/) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else if (/^(true|false)$/.test(next)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } - - // dot-notation flag separated by '='. - } else if (arg.match(/^-.\..+=/)) { - m = arg.match(/^-([^=]+)=([\s\S]*)$/) - setArg(m[1], m[2]) - - // dot-notation flag separated by space. - } else if (arg.match(/^-.\..+/) && !arg.match(negative)) { - next = args[i + 1] - key = arg.match(/^-(.\..+)/)[1] - - if (next !== undefined && !next.match(/^-/) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } else if (arg.match(/^-[^-]+/) && !arg.match(negative)) { - letters = arg.slice(1, -1).split('') - broken = false - - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2) - - if (letters[j + 1] && letters[j + 1] === '=') { - value = arg.slice(j + 3) - key = letters[j] - - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f=a b c' - i = eatArray(i, key, args, value) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f=monkey washing cat' - i = eatNargs(i, key, args, value) - } else { - setArg(key, value) - } - - broken = true - break - } - - if (next === '-') { - setArg(letters[j], next) - continue - } - - // current letter is an alphabetic character and next value is a number - if (/[A-Za-z]/.test(letters[j]) && - /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next) - broken = true - break - } - - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], next) - broken = true - break - } else { - setArg(letters[j], defaultValue(letters[j])) - } - } - - key = arg.slice(-1)[0] - - if (!broken && key !== '-') { - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f a b c' - i = eatArray(i, key, args) - } else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args) - } else { - next = args[i + 1] - - if (next !== undefined && (!/^(-|--)[^-]/.test(next) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next) - i++ - } else if (/^(true|false)$/.test(next)) { - setArg(key, next) - i++ - } else { - setArg(key, defaultValue(key)) - } - } - } - } else if (arg.match(/^-[0-9]$/) && - arg.match(negative) && - checkAllAliases(arg.slice(1), flags.bools)) { - // single-digit boolean alias, e.g: xargs -0 - key = arg.slice(1) - setArg(key, defaultValue(key)) - } else if (arg === '--') { - notFlags = args.slice(i + 1) - break - } else if (configuration['halt-at-non-option']) { - notFlags = args.slice(i) - break - } else { - argv._.push(maybeCoerceNumber('_', arg)) - } - } - - // order of precedence: - // 1. command line arg - // 2. value from env var - // 3. value from config file - // 4. value from config objects - // 5. configured default value - applyEnvVars(argv, true) // special case: check env vars that point to config file - applyEnvVars(argv, false) - setConfig(argv) - setConfigObjects() - applyDefaultsAndAliases(argv, flags.aliases, defaults, true) - applyCoercions(argv) - if (configuration['set-placeholder-key']) setPlaceholderKeys(argv) - - // for any counts either not in args or without an explicit default, set to 0 - Object.keys(flags.counts).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) setArg(key, 0) - }) - - // '--' defaults to undefined. - if (notFlagsOption && notFlags.length) argv[notFlagsArgv] = [] - notFlags.forEach(function (key) { - argv[notFlagsArgv].push(key) - }) - - if (configuration['camel-case-expansion'] && configuration['strip-dashed']) { - Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => { - delete argv[key] - }) - } - - if (configuration['strip-aliased']) { - ;[].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => { - if (configuration['camel-case-expansion']) { - delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')] - } - - delete argv[alias] - }) - } - - // how many arguments should we consume, based - // on the nargs option? - function eatNargs (i, key, args, argAfterEqualSign) { - let ii - let toEat = checkAllAliases(key, flags.nargs) - // NaN has a special meaning for the array type, indicating that one or - // more values are expected. - toEat = isNaN(toEat) ? 1 : toEat - - if (toEat === 0) { - if (!isUndefined(argAfterEqualSign)) { - error = Error(__('Argument unexpected for: %s', key)) - } - setArg(key, defaultValue(key)) - return i - } - - let available = isUndefined(argAfterEqualSign) ? 0 : 1 - if (configuration['nargs-eats-options']) { - // classic behavior, yargs eats positional and dash arguments. - if (args.length - (i + 1) + available < toEat) { - error = Error(__('Not enough arguments following: %s', key)) - } - available = toEat - } else { - // nargs will not consume flag arguments, e.g., -abc, --foo, - // and terminates when one is observed. - for (ii = i + 1; ii < args.length; ii++) { - if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii])) available++ - else break - } - if (available < toEat) error = Error(__('Not enough arguments following: %s', key)) - } - - let consumed = Math.min(available, toEat) - if (!isUndefined(argAfterEqualSign) && consumed > 0) { - setArg(key, argAfterEqualSign) - consumed-- - } - for (ii = i + 1; ii < (consumed + i + 1); ii++) { - setArg(key, args[ii]) - } - - return (i + consumed) - } - - // if an option is an array, eat all non-hyphenated arguments - // following it... YUM! - // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"] - function eatArray (i, key, args, argAfterEqualSign) { - let argsToSet = [] - let next = argAfterEqualSign || args[i + 1] - // If both array and nargs are configured, enforce the nargs count: - const nargsCount = checkAllAliases(key, flags.nargs) - - if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) { - argsToSet.push(true) - } else if (isUndefined(next) || - (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) { - // for keys without value ==> argsToSet remains an empty [] - // set user default value, if available - if (defaults[key] !== undefined) { - const defVal = defaults[key] - argsToSet = Array.isArray(defVal) ? defVal : [defVal] - } - } else { - // value in --option=value is eaten as is - if (!isUndefined(argAfterEqualSign)) { - argsToSet.push(processValue(key, argAfterEqualSign)) - } - for (let ii = i + 1; ii < args.length; ii++) { - if ((!configuration['greedy-arrays'] && argsToSet.length > 0) || - (nargsCount && argsToSet.length >= nargsCount)) break - next = args[ii] - if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) break - i = ii - argsToSet.push(processValue(key, next)) - } - } - - // If both array and nargs are configured, create an error if less than - // nargs positionals were found. NaN has special meaning, indicating - // that at least one value is required (more are okay). - if ((nargsCount && argsToSet.length < nargsCount) || - (isNaN(nargsCount) && argsToSet.length === 0)) { - error = Error(__('Not enough arguments following: %s', key)) - } - - setArg(key, argsToSet) - return i - } - - function setArg (key, val) { - if (/-/.test(key) && configuration['camel-case-expansion']) { - const alias = key.split('.').map(function (prop) { - return camelCase(prop) - }).join('.') - addNewAlias(key, alias) - } - - const value = processValue(key, val) - const splitKey = key.split('.') - setKey(argv, splitKey, value) - - // handle populating aliases of the full key - if (flags.aliases[key]) { - flags.aliases[key].forEach(function (x) { - x = x.split('.') - setKey(argv, x, value) - }) - } - - // handle populating aliases of the first element of the dot-notation key - if (splitKey.length > 1 && configuration['dot-notation']) { - ;(flags.aliases[splitKey[0]] || []).forEach(function (x) { - x = x.split('.') - - // expand alias with nested objects in key - const a = [].concat(splitKey) - a.shift() // nuke the old key. - x = x.concat(a) - - // populate alias only if is not already an alias of the full key - // (already populated above) - if (!(flags.aliases[key] || []).includes(x.join('.'))) { - setKey(argv, x, value) - } - }) - } - - // Set normalize getter and setter when key is in 'normalize' but isn't an array - if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) { - const keys = [key].concat(flags.aliases[key] || []) - keys.forEach(function (key) { - Object.defineProperty(argvReturn, key, { - enumerable: true, - get () { - return val - }, - set (value) { - val = typeof value === 'string' ? path.normalize(value) : value - } - }) - }) - } - } - - function addNewAlias (key, alias) { - if (!(flags.aliases[key] && flags.aliases[key].length)) { - flags.aliases[key] = [alias] - newAliases[alias] = true - } - if (!(flags.aliases[alias] && flags.aliases[alias].length)) { - addNewAlias(alias, key) - } - } - - function processValue (key, val) { - // strings may be quoted, clean this up as we assign values. - if (typeof val === 'string' && - (val[0] === "'" || val[0] === '"') && - val[val.length - 1] === val[0] - ) { - val = val.substring(1, val.length - 1) - } - - // handle parsing boolean arguments --foo=true --bar false. - if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { - if (typeof val === 'string') val = val === 'true' - } - - let value = Array.isArray(val) - ? val.map(function (v) { return maybeCoerceNumber(key, v) }) - : maybeCoerceNumber(key, val) - - // increment a count given as arg (either no value or value parsed as boolean) - if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) { - value = increment - } - - // Set normalized value when key is in 'normalize' and in 'arrays' - if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) { - if (Array.isArray(val)) value = val.map(path.normalize) - else value = path.normalize(val) - } - return value - } - - function maybeCoerceNumber (key, value) { - if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) { - const shouldCoerceNumber = isNumber(value) && configuration['parse-numbers'] && ( - Number.isSafeInteger(Math.floor(value)) - ) - if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) value = Number(value) - } - return value - } - - // set args from config.json file, this should be - // applied last so that defaults can be applied. - function setConfig (argv) { - const configLookup = Object.create(null) - - // expand defaults/aliases, in-case any happen to reference - // the config.json file. - applyDefaultsAndAliases(configLookup, flags.aliases, defaults) - - Object.keys(flags.configs).forEach(function (configKey) { - const configPath = argv[configKey] || configLookup[configKey] - if (configPath) { - try { - let config = null - const resolvedConfigPath = path.resolve(process.cwd(), configPath) - - if (typeof flags.configs[configKey] === 'function') { - try { - config = flags.configs[configKey](resolvedConfigPath) - } catch (e) { - config = e - } - if (config instanceof Error) { - error = config - return - } - } else { - config = require(resolvedConfigPath) - } - - setConfigObject(config) - } catch (ex) { - if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath)) - } - } - }) - } - - // set args from config object. - // it recursively checks nested objects. - function setConfigObject (config, prev) { - Object.keys(config).forEach(function (key) { - const value = config[key] - const fullKey = prev ? prev + '.' + key : key - - // if the value is an inner object and we have dot-notation - // enabled, treat inner objects in config the same as - // heavily nested dot notations (foo.bar.apple). - if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) { - // if the value is an object but not an array, check nested object - setConfigObject(value, fullKey) - } else { - // setting arguments via CLI takes precedence over - // values within the config file. - if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) { - setArg(fullKey, value) - } - } - }) - } - - // set all config objects passed in opts - function setConfigObjects () { - if (typeof configObjects === 'undefined') return - configObjects.forEach(function (configObject) { - setConfigObject(configObject) - }) - } - - function applyEnvVars (argv, configOnly) { - if (typeof envPrefix === 'undefined') return - - const prefix = typeof envPrefix === 'string' ? envPrefix : '' - Object.keys(process.env).forEach(function (envVar) { - if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) { - // get array of nested keys and convert them to camel case - const keys = envVar.split('__').map(function (key, i) { - if (i === 0) { - key = key.substring(prefix.length) - } - return camelCase(key) - }) - - if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) { - setArg(keys.join('.'), process.env[envVar]) - } - } - }) - } - - function applyCoercions (argv) { - let coerce - const applied = new Set() - Object.keys(argv).forEach(function (key) { - if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases - coerce = checkAllAliases(key, flags.coercions) - if (typeof coerce === 'function') { - try { - const value = maybeCoerceNumber(key, coerce(argv[key])) - ;([].concat(flags.aliases[key] || [], key)).forEach(ali => { - applied.add(ali) - argv[ali] = value - }) - } catch (err) { - error = err - } - } - } - }) - } - - function setPlaceholderKeys (argv) { - flags.keys.forEach((key) => { - // don't set placeholder keys for dot notation options 'foo.bar'. - if (~key.indexOf('.')) return - if (typeof argv[key] === 'undefined') argv[key] = undefined - }) - return argv - } - - function applyDefaultsAndAliases (obj, aliases, defaults, canLog = false) { - Object.keys(defaults).forEach(function (key) { - if (!hasKey(obj, key.split('.'))) { - setKey(obj, key.split('.'), defaults[key]) - if (canLog) defaulted[key] = true - - ;(aliases[key] || []).forEach(function (x) { - if (hasKey(obj, x.split('.'))) return - setKey(obj, x.split('.'), defaults[key]) - }) - } - }) - } - - function hasKey (obj, keys) { - let o = obj - - if (!configuration['dot-notation']) keys = [keys.join('.')] - - keys.slice(0, -1).forEach(function (key) { - o = (o[key] || {}) - }) - - const key = keys[keys.length - 1] - - if (typeof o !== 'object') return false - else return key in o - } - - function setKey (obj, keys, value) { - let o = obj - - if (!configuration['dot-notation']) keys = [keys.join('.')] - - keys.slice(0, -1).forEach(function (key, index) { - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - key = sanitizeKey(key) - - if (typeof o === 'object' && o[key] === undefined) { - o[key] = {} - } - - if (typeof o[key] !== 'object' || Array.isArray(o[key])) { - // ensure that o[key] is an array, and that the last item is an empty object. - if (Array.isArray(o[key])) { - o[key].push({}) - } else { - o[key] = [o[key], {}] - } - - // we want to update the empty object at the end of the o[key] array, so set o to that object - o = o[key][o[key].length - 1] - } else { - o = o[key] - } - }) - - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - const key = sanitizeKey(keys[keys.length - 1]) - - const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays) - const isValueArray = Array.isArray(value) - let duplicate = configuration['duplicate-arguments-array'] - - // nargs has higher priority than duplicate - if (!duplicate && checkAllAliases(key, flags.nargs)) { - duplicate = true - if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) { - o[key] = undefined - } - } - - if (value === increment) { - o[key] = increment(o[key]) - } else if (Array.isArray(o[key])) { - if (duplicate && isTypeArray && isValueArray) { - o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]) - } else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) { - o[key] = value - } else { - o[key] = o[key].concat([value]) - } - } else if (o[key] === undefined && isTypeArray) { - o[key] = isValueArray ? value : [value] - } else if (duplicate && !( - o[key] === undefined || - checkAllAliases(key, flags.counts) || - checkAllAliases(key, flags.bools) - )) { - o[key] = [o[key], value] - } else { - o[key] = value - } - } - - // extend the aliases list with inferred aliases. - function extendAliases (...args) { - args.forEach(function (obj) { - Object.keys(obj || {}).forEach(function (key) { - // short-circuit if we've already added a key - // to the aliases array, for example it might - // exist in both 'opts.default' and 'opts.key'. - if (flags.aliases[key]) return - - flags.aliases[key] = [].concat(aliases[key] || []) - // For "--option-name", also set argv.optionName - flags.aliases[key].concat(key).forEach(function (x) { - if (/-/.test(x) && configuration['camel-case-expansion']) { - const c = camelCase(x) - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c) - newAliases[c] = true - } - } - }) - // For "--optionName", also set argv['option-name'] - flags.aliases[key].concat(key).forEach(function (x) { - if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) { - const c = decamelize(x, '-') - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c) - newAliases[c] = true - } - } - }) - flags.aliases[key].forEach(function (x) { - flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) { - return x !== y - })) - }) - }) - }) - } - - // return the 1st set flag for any of a key's aliases (or false if no flag set) - function checkAllAliases (key, flag) { - const toCheck = [].concat(flags.aliases[key] || [], key) - const keys = Object.keys(flag) - const setAlias = toCheck.find(key => keys.includes(key)) - return setAlias ? flag[setAlias] : false - } - - function hasAnyFlag (key) { - const toCheck = [].concat(Object.keys(flags).map(k => flags[k])) - return toCheck.some(function (flag) { - return Array.isArray(flag) ? flag.includes(key) : flag[key] - }) - } - - function hasFlagsMatching (arg, ...patterns) { - const toCheck = [].concat(...patterns) - return toCheck.some(function (pattern) { - const match = arg.match(pattern) - return match && hasAnyFlag(match[1]) - }) - } - - // based on a simplified version of the short flag group parsing logic - function hasAllShortFlags (arg) { - // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group - if (arg.match(negative) || !arg.match(/^-[^-]+/)) { return false } - let hasAllFlags = true - let next - const letters = arg.slice(1).split('') - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2) - - if (!hasAnyFlag(letters[j])) { - hasAllFlags = false - break - } - - if ((letters[j + 1] && letters[j + 1] === '=') || - next === '-' || - (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) || - (letters[j + 1] && letters[j + 1].match(/\W/))) { - break - } - } - return hasAllFlags - } - - function isUnknownOptionAsArg (arg) { - return configuration['unknown-options-as-args'] && isUnknownOption(arg) - } - - function isUnknownOption (arg) { - // ignore negative numbers - if (arg.match(negative)) { return false } - // if this is a short option group and all of them are configured, it isn't unknown - if (hasAllShortFlags(arg)) { return false } - // e.g. '--count=2' - const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/ - // e.g. '-a' or '--arg' - const normalFlag = /^-+([^=]+?)$/ - // e.g. '-a-' - const flagEndingInHyphen = /^-+([^=]+?)-$/ - // e.g. '-abc123' - const flagEndingInDigits = /^-+([^=]+?\d+)$/ - // e.g. '-a/usr/local' - const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/ - // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method - return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters) - } - - // make a best effor to pick a default value - // for an option based on name and type. - function defaultValue (key) { - if (!checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts) && - `${key}` in defaults) { - return defaults[key] - } else { - return defaultForType(guessType(key)) - } - } - - // return a default value, given the type of a flag., - // e.g., key of type 'string' will default to '', rather than 'true'. - function defaultForType (type) { - const def = { - boolean: true, - string: '', - number: undefined, - array: [] - } - - return def[type] - } - - // given a flag, enforce a default type. - function guessType (key) { - let type = 'boolean' - if (checkAllAliases(key, flags.strings)) type = 'string' - else if (checkAllAliases(key, flags.numbers)) type = 'number' - else if (checkAllAliases(key, flags.bools)) type = 'boolean' - else if (checkAllAliases(key, flags.arrays)) type = 'array' - return type - } - - function isNumber (x) { - if (x === null || x === undefined) return false - // if loaded from config, may already be a number. - if (typeof x === 'number') return true - // hexadecimal. - if (/^0x[0-9a-f]+$/i.test(x)) return true - // don't treat 0123 as a number; as it drops the leading '0'. - if (x.length > 1 && x[0] === '0') return false - return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x) - } - - function isUndefined (num) { - return num === undefined - } - - // check user configuration settings for inconsistencies - function checkConfiguration () { - // count keys should not be set as array/narg - Object.keys(flags.counts).find(key => { - if (checkAllAliases(key, flags.arrays)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key)) - return true - } else if (checkAllAliases(key, flags.nargs)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key)) - return true - } - }) - } - - return { - argv: Object.assign(argvReturn, argv), - error: error, - aliases: Object.assign({}, flags.aliases), - newAliases: Object.assign({}, newAliases), - defaulted: Object.assign({}, defaulted), - configuration: configuration - } -} - -// if any aliases reference each other, we should -// merge them together. -function combineAliases (aliases) { - const aliasArrays = [] - const combined = Object.create(null) - let change = true - - // turn alias lookup hash {key: ['alias1', 'alias2']} into - // a simple array ['key', 'alias1', 'alias2'] - Object.keys(aliases).forEach(function (key) { - aliasArrays.push( - [].concat(aliases[key], key) - ) - }) - - // combine arrays until zero changes are - // made in an iteration. - while (change) { - change = false - for (let i = 0; i < aliasArrays.length; i++) { - for (let ii = i + 1; ii < aliasArrays.length; ii++) { - const intersect = aliasArrays[i].filter(function (v) { - return aliasArrays[ii].indexOf(v) !== -1 - }) - - if (intersect.length) { - aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]) - aliasArrays.splice(ii, 1) - change = true - break - } - } - } - } - - // map arrays back to the hash-lookup (de-dupe while - // we're at it). - aliasArrays.forEach(function (aliasArray) { - aliasArray = aliasArray.filter(function (v, i, self) { - return self.indexOf(v) === i - }) - combined[aliasArray.pop()] = aliasArray - }) - - return combined -} - -// this function should only be called when a count is given as an arg -// it is NOT called to set a default value -// thus we can start the count at 1 instead of 0 -function increment (orig) { - return orig !== undefined ? orig + 1 : 1 -} - -function Parser (args, opts) { - const result = parse(args.slice(), opts) - return result.argv -} - -// parse arguments and return detailed -// meta information, aliases, etc. -Parser.detailed = function (args, opts) { - return parse(args.slice(), opts) -} - -// TODO(bcoe): in the next major version of yargs, switch to -// Object.create(null) for dot notation: -function sanitizeKey (key) { - if (key === '__proto__') return '___proto___' - return key -} - -module.exports = Parser diff --git a/node_modules/yargs-parser/lib/tokenize-arg-string.js b/node_modules/yargs-parser/lib/tokenize-arg-string.js deleted file mode 100644 index 260c67c1823f8..0000000000000 --- a/node_modules/yargs-parser/lib/tokenize-arg-string.js +++ /dev/null @@ -1,40 +0,0 @@ -// take an un-split argv string and tokenize it. -module.exports = function (argString) { - if (Array.isArray(argString)) { - return argString.map(e => typeof e !== 'string' ? e + '' : e) - } - - argString = argString.trim() - - let i = 0 - let prevC = null - let c = null - let opening = null - const args = [] - - for (let ii = 0; ii < argString.length; ii++) { - prevC = c - c = argString.charAt(ii) - - // split on spaces unless we're in quotes. - if (c === ' ' && !opening) { - if (!(prevC === ' ')) { - i++ - } - continue - } - - // don't split the string if we're in matching - // opening or closing single and double quotes. - if (c === opening) { - opening = null - } else if ((c === "'" || c === '"') && !opening) { - opening = c - } - - if (!args[i]) args[i] = '' - args[i] += c - } - - return args -} diff --git a/node_modules/yargs-parser/node_modules/camelcase/index.d.ts b/node_modules/yargs-parser/node_modules/camelcase/index.d.ts deleted file mode 100644 index 58f2069adc52b..0000000000000 --- a/node_modules/yargs-parser/node_modules/camelcase/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -declare namespace camelcase { - interface Options { - /** - Uppercase the first character: `foo-bar` → `FooBar`. - - @default false - */ - readonly pascalCase?: boolean; - } -} - -declare const camelcase: { - /** - Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`. - - @param input - String to convert to camel case. - - @example - ``` - import camelCase = require('camelcase'); - - camelCase('foo-bar'); - //=> 'fooBar' - - camelCase('foo_bar'); - //=> 'fooBar' - - camelCase('Foo-Bar'); - //=> 'fooBar' - - camelCase('Foo-Bar', {pascalCase: true}); - //=> 'FooBar' - - camelCase('--foo.bar', {pascalCase: false}); - //=> 'fooBar' - - camelCase('foo bar'); - //=> 'fooBar' - - console.log(process.argv[3]); - //=> '--foo-bar' - camelCase(process.argv[3]); - //=> 'fooBar' - - camelCase(['foo', 'bar']); - //=> 'fooBar' - - camelCase(['__foo__', '--bar'], {pascalCase: true}); - //=> 'FooBar' - ``` - */ - (input: string | ReadonlyArray, options?: camelcase.Options): string; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function camelcase( - // input: string | ReadonlyArray, - // options?: camelcase.Options - // ): string; - // export = camelcase; - default: typeof camelcase; -}; - -export = camelcase; diff --git a/node_modules/yargs-parser/node_modules/camelcase/index.js b/node_modules/yargs-parser/node_modules/camelcase/index.js deleted file mode 100644 index 579f99b47f772..0000000000000 --- a/node_modules/yargs-parser/node_modules/camelcase/index.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character; - } - } - - return string; -}; - -const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = Object.assign({ - pascalCase: false - }, options); - - const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x; - - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } - - if (input.length === 0) { - return ''; - } - - if (input.length === 1) { - return options.pascalCase ? input.toUpperCase() : input.toLowerCase(); - } - - const hasUpperCase = input !== input.toLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } - - input = input - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()) - .replace(/\d+(\w|$)/g, m => m.toUpperCase()); - - return postProcess(input); -}; - -module.exports = camelCase; -// TODO: Remove this for the next major release -module.exports.default = camelCase; diff --git a/node_modules/yargs-parser/node_modules/camelcase/license b/node_modules/yargs-parser/node_modules/camelcase/license deleted file mode 100644 index e7af2f77107d7..0000000000000 --- a/node_modules/yargs-parser/node_modules/camelcase/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/yargs-parser/node_modules/camelcase/package.json b/node_modules/yargs-parser/node_modules/camelcase/package.json deleted file mode 100644 index fbdbaaa75651d..0000000000000 --- a/node_modules/yargs-parser/node_modules/camelcase/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "camelcase", - "version": "5.3.1", - "description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`", - "license": "MIT", - "repository": "sindresorhus/camelcase", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "camelcase", - "camel-case", - "camel", - "case", - "dash", - "hyphen", - "dot", - "underscore", - "separator", - "string", - "text", - "convert", - "pascalcase", - "pascal-case" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/node_modules/yargs-parser/node_modules/camelcase/readme.md b/node_modules/yargs-parser/node_modules/camelcase/readme.md deleted file mode 100644 index fde27261b2a82..0000000000000 --- a/node_modules/yargs-parser/node_modules/camelcase/readme.md +++ /dev/null @@ -1,99 +0,0 @@ -# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase) - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - ---- - -
- - Get professional support for 'camelcase' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- ---- - -## Install - -``` -$ npm install camelcase -``` - - -## Usage - -```js -const camelCase = require('camelcase'); - -camelCase('foo-bar'); -//=> 'fooBar' - -camelCase('foo_bar'); -//=> 'fooBar' - -camelCase('Foo-Bar'); -//=> 'fooBar' - -camelCase('Foo-Bar', {pascalCase: true}); -//=> 'FooBar' - -camelCase('--foo.bar', {pascalCase: false}); -//=> 'fooBar' - -camelCase('foo bar'); -//=> 'fooBar' - -console.log(process.argv[3]); -//=> '--foo-bar' -camelCase(process.argv[3]); -//=> 'fooBar' - -camelCase(['foo', 'bar']); -//=> 'fooBar' - -camelCase(['__foo__', '--bar'], {pascalCase: true}); -//=> 'FooBar' -``` - - -## API - -### camelCase(input, [options]) - -#### input - -Type: `string` `string[]` - -String to convert to camel case. - -#### options - -Type: `Object` - -##### pascalCase - -Type: `boolean`
-Default: `false` - -Uppercase the first character: `foo-bar` → `FooBar` - - -## Security - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. - - -## Related - -- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module -- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase -- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string -- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/yargs-parser/package.json b/node_modules/yargs-parser/package.json deleted file mode 100644 index 636ff1761ca34..0000000000000 --- a/node_modules/yargs-parser/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "yargs-parser", - "version": "18.1.3", - "description": "the mighty option parser used by yargs", - "main": "index.js", - "scripts": { - "fix": "standard --fix", - "test": "c8 --reporter=text --reporter=html mocha test/*.js", - "posttest": "standard", - "coverage": "c8 report --check-coverage check-coverage --lines=100 --branches=97 --statements=100" - }, - "repository": { - "type": "git", - "url": "https://github.com/yargs/yargs-parser.git" - }, - "keywords": [ - "argument", - "parser", - "yargs", - "command", - "cli", - "parsing", - "option", - "args", - "argument" - ], - "author": "Ben Coe ", - "license": "ISC", - "devDependencies": { - "c8": "^7.0.1", - "chai": "^4.2.0", - "mocha": "^7.0.0", - "standard": "^14.3.1" - }, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "files": [ - "lib", - "index.js" - ], - "engines": { - "node": ">=6" - } -} diff --git a/node_modules/yargs/CHANGELOG.md b/node_modules/yargs/CHANGELOG.md deleted file mode 100644 index a010cf34fa7cd..0000000000000 --- a/node_modules/yargs/CHANGELOG.md +++ /dev/null @@ -1,420 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## [15.4.0](https://www.github.com/yargs/yargs/compare/v15.3.1...v15.4.0) (2020-06-30) - - -### Features - -* adds deprecation option for commands ([027a636](https://www.github.com/yargs/yargs/commit/027a6365b737e13116811a8ef43670196e1fa00a)) -* support array of examples ([#1682](https://www.github.com/yargs/yargs/issues/1682)) ([225ab82](https://www.github.com/yargs/yargs/commit/225ab8271938bed3a48d23175f3d580ce8cd1306)) - - -### Bug Fixes - -* **docs:** describe usage of `.check()` in more detail ([932cd11](https://www.github.com/yargs/yargs/commit/932cd1177e93f5cc99edfe57a4028e30717bf8fb)) -* **i18n:** Japanese translation phrasing ([#1619](https://www.github.com/yargs/yargs/issues/1619)) ([0894175](https://www.github.com/yargs/yargs/commit/089417550ef5a5b8ce3578dd2a989191300b64cd)) -* **strict mode:** report default command unknown arguments ([#1626](https://www.github.com/yargs/yargs/issues/1626)) ([69f29a9](https://www.github.com/yargs/yargs/commit/69f29a9cd429d4bb99481238305390107ac75b02)) -* **usage:** translate 'options' group only when displaying help ([#1600](https://www.github.com/yargs/yargs/issues/1600)) ([e60b39b](https://www.github.com/yargs/yargs/commit/e60b39b9d3a912c06db43f87c86ba894142b6c1c)) - - -### Reverts - -* Revert "chore(deps): update dependency eslint to v7 (#1656)" (#1673) ([34949f8](https://www.github.com/yargs/yargs/commit/34949f89ee7cdf88f7b315659df4b5f62f714842)), closes [#1656](https://www.github.com/yargs/yargs/issues/1656) [#1673](https://www.github.com/yargs/yargs/issues/1673) - -### [15.3.1](https://www.github.com/yargs/yargs/compare/v15.3.0...v15.3.1) (2020-03-16) - - -### Bug Fixes - -* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential -prototype pollution vulnerability. This was reported by the Snyk Security Research Team. ([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2)) - -## [15.3.0](https://www.github.com/yargs/yargs/compare/v15.2.0...v15.3.0) (2020-03-08) - - -### Features - -* **yargs-parser:** introduce single-digit boolean aliases ([#1576](https://www.github.com/yargs/yargs/issues/1576)) ([3af7f04](https://www.github.com/yargs/yargs/commit/3af7f04cdbfcbd4b3f432aca5144d43f21958c39)) -* add usage for single-digit boolean aliases ([#1580](https://www.github.com/yargs/yargs/issues/1580)) ([6014e39](https://www.github.com/yargs/yargs/commit/6014e39bca3a1e8445aa0fb2a435f6181e344c45)) - - -### Bug Fixes - -* address ambiguity between nargs of 1 and requiresArg ([#1572](https://www.github.com/yargs/yargs/issues/1572)) ([a5edc32](https://www.github.com/yargs/yargs/commit/a5edc328ecb3f90d1ba09cfe70a0040f68adf50a)) - -## [15.2.0](https://www.github.com/yargs/yargs/compare/v15.1.0...v15.2.0) (2020-03-01) - - -### ⚠ BREAKING CHANGES - -* **deps:** yargs-parser@17.0.0 no longer implicitly creates arrays out of boolean -arguments when duplicates are provided - -### Features - -* **completion:** takes negated flags into account when boolean-negation is set ([#1509](https://www.github.com/yargs/yargs/issues/1509)) ([7293ad5](https://www.github.com/yargs/yargs/commit/7293ad50d20ea0fb7dd1ac9b925e90e1bd95dea8)) -* **deps:** pull in yargs-parser@17.0.0 ([#1553](https://www.github.com/yargs/yargs/issues/1553)) ([b9409da](https://www.github.com/yargs/yargs/commit/b9409da199ebca515a848489c206b807fab2e65d)) -* deprecateOption ([#1559](https://www.github.com/yargs/yargs/issues/1559)) ([8aae333](https://www.github.com/yargs/yargs/commit/8aae3332251d09fa136db17ef4a40d83fa052bc4)) -* display appropriate $0 for electron apps ([#1536](https://www.github.com/yargs/yargs/issues/1536)) ([d0e4379](https://www.github.com/yargs/yargs/commit/d0e437912917d6a66bb5128992fa2f566a5f830b)) -* introduces strictCommands() subset of strict mode ([#1540](https://www.github.com/yargs/yargs/issues/1540)) ([1d4cca3](https://www.github.com/yargs/yargs/commit/1d4cca395a98b395e6318f0505fc73bef8b01350)) -* **deps:** yargs-parser with 'greedy-array' configuration ([#1569](https://www.github.com/yargs/yargs/issues/1569)) ([a03a320](https://www.github.com/yargs/yargs/commit/a03a320dbf5c0ce33d829a857fc04a651c0bb53e)) - - -### Bug Fixes - -* help always displayed for the first command parsed having an async handler ([#1535](https://www.github.com/yargs/yargs/issues/1535)) ([d585b30](https://www.github.com/yargs/yargs/commit/d585b303a43746201b05c9c9fda94a444634df33)) -* **deps:** fix enumeration for normalized path arguments ([#1567](https://www.github.com/yargs/yargs/issues/1567)) ([0b5b1b0](https://www.github.com/yargs/yargs/commit/0b5b1b0e5f4f9baf393c48e9cc2bc85c1b67a47a)) -* **locales:** only translate default option group name ([acc16de](https://www.github.com/yargs/yargs/commit/acc16de6b846ea7332db753646a9cec76b589162)) -* **locales:** remove extra space in French for 'default' ([#1564](https://www.github.com/yargs/yargs/issues/1564)) ([ecfc2c4](https://www.github.com/yargs/yargs/commit/ecfc2c474575c6cdbc6d273c94c13181bd1dbaa6)) -* **translations:** add French translation for unknown command ([#1563](https://www.github.com/yargs/yargs/issues/1563)) ([18b0b75](https://www.github.com/yargs/yargs/commit/18b0b752424bf560271e670ff95a0f90c8386787)) -* **translations:** fix pluralization in error messages. ([#1557](https://www.github.com/yargs/yargs/issues/1557)) ([94fa38c](https://www.github.com/yargs/yargs/commit/94fa38cbab8d86943e87bf41d368ed56dffa6835)) -* **yargs:** correct support of bundled electron apps ([#1554](https://www.github.com/yargs/yargs/issues/1554)) ([a0b61ac](https://www.github.com/yargs/yargs/commit/a0b61ac21e2b554aa73dbf1a66d4a7af94047c2f)) - -## [15.1.0](https://www.github.com/yargs/yargs/compare/v15.0.2...v15.1.0) (2020-01-02) - - -### Features - -* **lang:** add Finnish localization (language code fi) ([222c8fe](https://www.github.com/yargs/yargs/commit/222c8fef2e2ad46e314c337dec96940f896bec35)) -* complete short options with a single dash ([#1507](https://www.github.com/yargs/yargs/issues/1507)) ([99011ab](https://www.github.com/yargs/yargs/commit/99011ab5ba90232506ece0a17e59e2001a1ab562)) -* onFinishCommand handler ([#1473](https://www.github.com/yargs/yargs/issues/1473)) ([fe380cd](https://www.github.com/yargs/yargs/commit/fe380cd356aa33aef0449facd59c22cab8930ac9)) - - -### Bug Fixes - -* getCompletion() was not working for options ([#1495](https://www.github.com/yargs/yargs/issues/1495)) ([463feb2](https://www.github.com/yargs/yargs/commit/463feb2870158eb9df670222b0f0a40a05cf18d0)) -* misspelling of package.json `engines` field ([0891d0e](https://www.github.com/yargs/yargs/commit/0891d0ed35b30c83a6d9e9f6a5c5f84d13c546a0)) -* populate positionals when unknown-options-as-args is set ([#1508](https://www.github.com/yargs/yargs/issues/1508)) ([bb0f2eb](https://www.github.com/yargs/yargs/commit/bb0f2eb996fa4e19d330b31a01c2036cafa99a7e)), closes [#1444](https://www.github.com/yargs/yargs/issues/1444) -* show 2 dashes on help for single digit option key or alias ([#1493](https://www.github.com/yargs/yargs/issues/1493)) ([63b3dd3](https://www.github.com/yargs/yargs/commit/63b3dd31a455d428902220c1992ae930e18aff5c)) -* **docs:** use recommended cjs import syntax for ts examples ([#1513](https://www.github.com/yargs/yargs/issues/1513)) ([f9a18bf](https://www.github.com/yargs/yargs/commit/f9a18bfd624a5013108084f690cd8a1de794c430)) - -### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19) - - -### Bug Fixes - -* temporary fix for libraries that call Object.freeze() ([#1483](https://www.github.com/yargs/yargs/issues/1483)) ([99c2dc8](https://www.github.com/yargs/yargs/commit/99c2dc850e67c606644f8b0c0bca1a59c87dcbcd)) - -### [15.0.1](https://www.github.com/yargs/yargs/compare/v15.0.0...v15.0.1) (2019-11-16) - - -### Bug Fixes - -* **deps:** cliui, find-up, and string-width, all drop Node 6 support ([#1479](https://www.github.com/yargs/yargs/issues/1479)) ([6a9ebe2](https://www.github.com/yargs/yargs/commit/6a9ebe2d955e3e979e76c07ffbb1c17fef64cb49)) - -## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10) - - -### ⚠ BREAKING CHANGES - -* **deps:** yargs-parser now throws on invalid combinations of config (#1470) -* yargs-parser@16.0.0 drops support for Node 6 -* drop Node 6 support (#1461) -* remove package.json-based parserConfiguration (#1460) - -### Features - -* **deps:** yargs-parser now throws on invalid combinations of config ([#1470](https://www.github.com/yargs/yargs/issues/1470)) ([c10c38c](https://www.github.com/yargs/yargs/commit/c10c38cca04298f96b55a7e374a9a134abefffa7)) -* expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee)) - - -### Bug Fixes - -* **docs:** TypeScript import to prevent a future major release warning ([#1441](https://www.github.com/yargs/yargs/issues/1441)) ([b1b156a](https://www.github.com/yargs/yargs/commit/b1b156a3eb4ddd6803fbbd56c611a77919293000)) -* stop-parse was not being respected by commands ([#1459](https://www.github.com/yargs/yargs/issues/1459)) ([12c82e6](https://www.github.com/yargs/yargs/commit/12c82e62663e928148a7ee2f51629aa26a0f9bb2)) -* update to yargs-parser with fix for array default values ([#1463](https://www.github.com/yargs/yargs/issues/1463)) ([ebee59d](https://www.github.com/yargs/yargs/commit/ebee59d9022da538410e69a5c025019ed46d13d2)) -* **docs:** update boolean description and examples in docs ([#1474](https://www.github.com/yargs/yargs/issues/1474)) ([afd5b48](https://www.github.com/yargs/yargs/commit/afd5b4871bfeb90d58351ac56c5c44a83ef033e6)) - - -### Miscellaneous Chores - -* drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d)) - - -### Code Refactoring - -* remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51)) - -## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07) - - -### Bug Fixes - -* async middleware was called twice ([#1422](https://github.com/yargs/yargs/issues/1422)) ([9a42b63](https://github.com/yargs/yargs/commit/9a42b63)) -* fix promise check to accept any spec conform object ([#1424](https://github.com/yargs/yargs/issues/1424)) ([0be43d2](https://github.com/yargs/yargs/commit/0be43d2)) -* groups were not being maintained for nested commands ([#1430](https://github.com/yargs/yargs/issues/1430)) ([d38650e](https://github.com/yargs/yargs/commit/d38650e)) -* **docs:** broken markdown link ([#1426](https://github.com/yargs/yargs/issues/1426)) ([236e24e](https://github.com/yargs/yargs/commit/236e24e)) -* support merging deeply nested configuration ([#1423](https://github.com/yargs/yargs/issues/1423)) ([bae66fe](https://github.com/yargs/yargs/commit/bae66fe)) - - -### Features - -* **deps:** introduce yargs-parser with support for unknown-options-as-args ([#1440](https://github.com/yargs/yargs/issues/1440)) ([4d21520](https://github.com/yargs/yargs/commit/4d21520)) - -## [14.1.0](https://github.com/yargs/yargs/compare/v14.0.0...v14.1.0) (2019-09-06) - - -### Bug Fixes - -* **docs:** fix incorrect parserConfiguration documentation ([2a99124](https://github.com/yargs/yargs/commit/2a99124)) -* detect zsh when zsh isnt run as a login prompt ([#1395](https://github.com/yargs/yargs/issues/1395)) ([8792d13](https://github.com/yargs/yargs/commit/8792d13)) -* populate correct value on yargs.parsed and stop warning on access ([#1412](https://github.com/yargs/yargs/issues/1412)) ([bb0eb52](https://github.com/yargs/yargs/commit/bb0eb52)) -* showCompletionScript was logging script twice ([#1388](https://github.com/yargs/yargs/issues/1388)) ([07c8537](https://github.com/yargs/yargs/commit/07c8537)) -* strict() should not ignore hyphenated arguments ([#1414](https://github.com/yargs/yargs/issues/1414)) ([b774b5e](https://github.com/yargs/yargs/commit/b774b5e)) -* **docs:** formalize existing callback argument to showHelp ([#1386](https://github.com/yargs/yargs/issues/1386)) ([d217764](https://github.com/yargs/yargs/commit/d217764)) - - -### Features - -* make it possible to merge configurations when extending other config. ([#1411](https://github.com/yargs/yargs/issues/1411)) ([5d7ad98](https://github.com/yargs/yargs/commit/5d7ad98)) - -## [14.0.0](https://github.com/yargs/yargs/compare/v13.3.0...v14.0.0) (2019-07-30) - - -### ⚠ BREAKING CHANGES - -* we now only officially support yargs.$0 parameter and discourage direct access to yargs.parsed -* previously to this fix methods like `yargs.getOptions()` contained the state of the last command to execute. -* do not allow additional positionals in strict mode - -### Bug Fixes - -* calling parse multiple times now appropriately maintains state ([#1137](https://github.com/yargs/yargs/issues/1137)) ([#1369](https://github.com/yargs/yargs/issues/1369)) ([026b151](https://github.com/yargs/yargs/commit/026b151)) -* prefer user supplied script name in usage ([#1383](https://github.com/yargs/yargs/issues/1383)) ([28c74b9](https://github.com/yargs/yargs/commit/28c74b9)) -* **deps:** use decamelize from npm instead of vendored copy ([#1377](https://github.com/yargs/yargs/issues/1377)) ([015eeb9](https://github.com/yargs/yargs/commit/015eeb9)) -* **examples:** fix usage-options.js to reflect current API ([#1375](https://github.com/yargs/yargs/issues/1375)) ([6e5b76b](https://github.com/yargs/yargs/commit/6e5b76b)) -* do not allow additional positionals in strict mode ([35d777c](https://github.com/yargs/yargs/commit/35d777c)) -* properties accessed on singleton now reflect current state of instance ([#1366](https://github.com/yargs/yargs/issues/1366)) ([409d35b](https://github.com/yargs/yargs/commit/409d35b)) -* tolerate null prototype for config objects with `extends` ([#1376](https://github.com/yargs/yargs/issues/1376)) ([3d26d11](https://github.com/yargs/yargs/commit/3d26d11)), closes [#1372](https://github.com/yargs/yargs/issues/1372) -* yargs.parsed now populated before returning, when yargs.parse() called with no args (#1382) ([e3981fd](https://github.com/yargs/yargs/commit/e3981fd)), closes [#1382](https://github.com/yargs/yargs/issues/1382) - -### Features - -* adds support for multiple epilog messages ([#1384](https://github.com/yargs/yargs/issues/1384)) ([07a5554](https://github.com/yargs/yargs/commit/07a5554)) -* allow completionCommand to be set via showCompletionScript ([#1385](https://github.com/yargs/yargs/issues/1385)) ([5562853](https://github.com/yargs/yargs/commit/5562853)) - -## [13.3.0](https://www.github.com/yargs/yargs/compare/v13.2.4...v13.3.0) (2019-06-10) - - -### Bug Fixes - -* **deps:** yargs-parser update addressing several parsing bugs ([#1357](https://www.github.com/yargs/yargs/issues/1357)) ([e230d5b](https://www.github.com/yargs/yargs/commit/e230d5b)) - - -### Features - -* **i18n:** swap out os-locale dependency for simple inline implementation ([#1356](https://www.github.com/yargs/yargs/issues/1356)) ([4dfa19b](https://www.github.com/yargs/yargs/commit/4dfa19b)) -* support defaultDescription for positional arguments ([812048c](https://www.github.com/yargs/yargs/commit/812048c)) - -### [13.2.4](https://github.com/yargs/yargs/compare/v13.2.3...v13.2.4) (2019-05-13) - - -### Bug Fixes - -* **i18n:** rename unclear 'implication failed' to 'missing dependent arguments' ([#1317](https://github.com/yargs/yargs/issues/1317)) ([bf46813](https://github.com/yargs/yargs/commit/bf46813)) - - - -### [13.2.3](https://github.com/yargs/yargs/compare/v13.2.2...v13.2.3) (2019-05-05) - - -### Bug Fixes - -* **deps:** upgrade cliui for compatibility with latest chalk. ([#1330](https://github.com/yargs/yargs/issues/1330)) ([b20db65](https://github.com/yargs/yargs/commit/b20db65)) -* address issues with dutch translation ([#1316](https://github.com/yargs/yargs/issues/1316)) ([0295132](https://github.com/yargs/yargs/commit/0295132)) - - -### Tests - -* accept differently formatted output ([#1327](https://github.com/yargs/yargs/issues/1327)) ([c294d1b](https://github.com/yargs/yargs/commit/c294d1b)) - - - -## [13.2.2](https://github.com/yargs/yargs/compare/v13.2.1...v13.2.2) (2019-03-06) - - - -## [13.2.1](https://github.com/yargs/yargs/compare/v13.2.0...v13.2.1) (2019-02-18) - - -### Bug Fixes - -* add zsh script to files array ([3180224](https://github.com/yargs/yargs/commit/3180224)) -* support options/sub-commands in zsh completion ([0a96394](https://github.com/yargs/yargs/commit/0a96394)) - - -# [13.2.0](https://github.com/yargs/yargs/compare/v13.1.0...v13.2.0) (2019-02-15) - - -### Features - -* zsh auto completion ([#1292](https://github.com/yargs/yargs/issues/1292)) ([16c5d25](https://github.com/yargs/yargs/commit/16c5d25)), closes [#1156](https://github.com/yargs/yargs/issues/1156) - - - -# [13.1.0](https://github.com/yargs/yargs/compare/v13.0.0...v13.1.0) (2019-02-12) - - -### Features - -* add applyBeforeValidation, for applying sync middleware before validation ([5be206a](https://github.com/yargs/yargs/commit/5be206a)) - - - - -# [13.0.0](https://github.com/yargs/yargs/compare/v12.0.5...v13.0.0) (2019-02-02) - - -### Bug Fixes - -* **deps:** Update os-locale to avoid security vulnerability ([#1270](https://github.com/yargs/yargs/issues/1270)) ([27bf739](https://github.com/yargs/yargs/commit/27bf739)) -* **validation:** Use the error as a message when none exists otherwise ([#1268](https://github.com/yargs/yargs/issues/1268)) ([0510fe6](https://github.com/yargs/yargs/commit/0510fe6)) -* better bash path completion ([#1272](https://github.com/yargs/yargs/issues/1272)) ([da75ea2](https://github.com/yargs/yargs/commit/da75ea2)) -* middleware added multiple times due to reference bug ([#1282](https://github.com/yargs/yargs/issues/1282)) ([64af518](https://github.com/yargs/yargs/commit/64af518)) - - -### Chores - -* ~drop Node 6 from testing matrix ([#1287](https://github.com/yargs/yargs/issues/1287)) ([ef16792](https://github.com/yargs/yargs/commit/ef16792))~ - * _opting to not drop Node 6 support until April, [see](https://github.com/nodejs/Release)._ -* update dependencies ([#1284](https://github.com/yargs/yargs/issues/1284)) ([f25de4f](https://github.com/yargs/yargs/commit/f25de4f)) - - -### Features - -* Add `.parserConfiguration()` method, deprecating package.json config ([#1262](https://github.com/yargs/yargs/issues/1262)) ([3c6869a](https://github.com/yargs/yargs/commit/3c6869a)) -* adds config option for sorting command output ([#1256](https://github.com/yargs/yargs/issues/1256)) ([6916ce9](https://github.com/yargs/yargs/commit/6916ce9)) -* options/positionals with leading '+' and '0' no longer parse as numbers ([#1286](https://github.com/yargs/yargs/issues/1286)) ([e9dc3aa](https://github.com/yargs/yargs/commit/e9dc3aa)) -* support promises in middleware ([f3a4e4f](https://github.com/yargs/yargs/commit/f3a4e4f)) - - -### BREAKING CHANGES - -* options with leading '+' or '0' now parse as strings -* dropping Node 6 which hits end of life in April 2019 -* see [yargs-parser@12.0.0 CHANGELOG](https://github.com/yargs/yargs-parser/blob/master/CHANGELOG.md#breaking-changes) -* we now warn if the yargs stanza package.json is used. - - - - -## [12.0.5](https://github.com/yargs/yargs/compare/v12.0.4...v12.0.5) (2018-11-19) - - -### Bug Fixes - -* allows camel-case, variadic arguments, and strict mode to be combined ([#1247](https://github.com/yargs/yargs/issues/1247)) ([eacc035](https://github.com/yargs/yargs/commit/eacc035)) - - - - -## [12.0.4](https://github.com/yargs/yargs/compare/v12.0.3...v12.0.4) (2018-11-10) - - -### Bug Fixes - -* don't load config when processing positionals ([5d0dc92](https://github.com/yargs/yargs/commit/5d0dc92)) - - - - -## [12.0.3](https://github.com/yargs/yargs/compare/v12.0.2...v12.0.3) (2018-10-06) - - -### Bug Fixes - -* $0 contains first arg in bundled electron apps ([#1206](https://github.com/yargs/yargs/issues/1206)) ([567820b](https://github.com/yargs/yargs/commit/567820b)) -* accept single function for middleware ([66fd6f7](https://github.com/yargs/yargs/commit/66fd6f7)), closes [#1214](https://github.com/yargs/yargs/issues/1214) [#1214](https://github.com/yargs/yargs/issues/1214) -* hide `hidden` options from help output even if they are in a group ([#1221](https://github.com/yargs/yargs/issues/1221)) ([da54028](https://github.com/yargs/yargs/commit/da54028)) -* improve Norwegian Bokmål translations ([#1208](https://github.com/yargs/yargs/issues/1208)) ([a458fa4](https://github.com/yargs/yargs/commit/a458fa4)) -* improve Norwegian Nynorsk translations ([#1207](https://github.com/yargs/yargs/issues/1207)) ([d422eb5](https://github.com/yargs/yargs/commit/d422eb5)) - - - - -## [12.0.2](https://github.com/yargs/yargs/compare/v12.0.1...v12.0.2) (2018-09-04) - - -### Bug Fixes - -* middleware should work regardless of when method is called ([664b265](https://github.com/yargs/yargs/commit/664b265)), closes [#1178](https://github.com/yargs/yargs/issues/1178) -* translation not working when using __ with a single parameter ([#1183](https://github.com/yargs/yargs/issues/1183)) ([f449aea](https://github.com/yargs/yargs/commit/f449aea)) -* upgrade os-locale to version that addresses license issue ([#1195](https://github.com/yargs/yargs/issues/1195)) ([efc0970](https://github.com/yargs/yargs/commit/efc0970)) - - - - -## [12.0.1](https://github.com/yargs/yargs/compare/v12.0.0...v12.0.1) (2018-06-29) - - - - -# [12.0.0](https://github.com/yargs/yargs/compare/v11.1.0...v12.0.0) (2018-06-26) - - -### Bug Fixes - -* .argv and .parse() now invoke identical code path ([#1126](https://github.com/yargs/yargs/issues/1126)) ([f13ebf4](https://github.com/yargs/yargs/commit/f13ebf4)) -* remove the trailing white spaces from the help output ([#1090](https://github.com/yargs/yargs/issues/1090)) ([3f0746c](https://github.com/yargs/yargs/commit/3f0746c)) -* **completion:** Avoid default command and recommendations during completion ([#1123](https://github.com/yargs/yargs/issues/1123)) ([036e7c5](https://github.com/yargs/yargs/commit/036e7c5)) - - -### Chores - -* test Node.js 6, 8 and 10 ([#1160](https://github.com/yargs/yargs/issues/1160)) ([84f9d2b](https://github.com/yargs/yargs/commit/84f9d2b)) -* upgrade to version of yargs-parser that does not populate value for unset boolean ([#1104](https://github.com/yargs/yargs/issues/1104)) ([d4705f4](https://github.com/yargs/yargs/commit/d4705f4)) - - -### Features - -* add support for global middleware, useful for shared tasks like metrics ([#1119](https://github.com/yargs/yargs/issues/1119)) ([9d71ac7](https://github.com/yargs/yargs/commit/9d71ac7)) -* allow setting scriptName $0 ([#1143](https://github.com/yargs/yargs/issues/1143)) ([a2f2eae](https://github.com/yargs/yargs/commit/a2f2eae)) -* remove `setPlaceholderKeys` ([#1105](https://github.com/yargs/yargs/issues/1105)) ([6ee2c82](https://github.com/yargs/yargs/commit/6ee2c82)) - - -### BREAKING CHANGES - -* Options absent from `argv` (not set via CLI argument) are now absent from the parsed result object rather than being set with `undefined` -* drop Node 4 from testing matrix, such that we'll gradually start drifting away from supporting Node 4. -* yargs-parser does not populate 'false' when boolean flag is not passed -* tests that assert against help output will need to be updated - - - - -# [11.1.0](https://github.com/yargs/yargs/compare/v11.0.0...v11.1.0) (2018-03-04) - - -### Bug Fixes - -* choose correct config directory when require.main does not exist ([#1056](https://github.com/yargs/yargs/issues/1056)) ([a04678c](https://github.com/yargs/yargs/commit/a04678c)) - - -### Features - -* allow hidden options to be displayed with --show-hidden ([#1061](https://github.com/yargs/yargs/issues/1061)) ([ea862ae](https://github.com/yargs/yargs/commit/ea862ae)) -* extend *.rc files in addition to json ([#1080](https://github.com/yargs/yargs/issues/1080)) ([11691a6](https://github.com/yargs/yargs/commit/11691a6)) - - - - -# [11.0.0](https://github.com/yargs/yargs/compare/v10.1.2...v11.0.0) (2018-01-22) - - -### Bug Fixes - -* Set implicit nargs=1 when type=number requiresArg=true ([#1050](https://github.com/yargs/yargs/issues/1050)) ([2b56812](https://github.com/yargs/yargs/commit/2b56812)) - - -### Features - -* requiresArg is now simply an alias for nargs(1) ([#1054](https://github.com/yargs/yargs/issues/1054)) ([a3ddacc](https://github.com/yargs/yargs/commit/a3ddacc)) - - -### BREAKING CHANGES - -* requiresArg now has significantly different error output, matching nargs. - -[Historical Versions](/docs/CHANGELOG-historical.md) diff --git a/node_modules/yargs/LICENSE b/node_modules/yargs/LICENSE deleted file mode 100644 index b0145ca0b03bd..0000000000000 --- a/node_modules/yargs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/yargs/README.md b/node_modules/yargs/README.md deleted file mode 100644 index 0db992b1aaa92..0000000000000 --- a/node_modules/yargs/README.md +++ /dev/null @@ -1,140 +0,0 @@ -

- -

-

Yargs

-

- Yargs be a node.js library fer hearties tryin' ter parse optstrings -

- -
- -[![Build Status][travis-image]][travis-url] -[![NPM version][npm-image]][npm-url] -[![js-standard-style][standard-image]][standard-url] -[![Coverage][coverage-image]][coverage-url] -[![Conventional Commits][conventional-commits-image]][conventional-commits-url] -[![Slack][slack-image]][slack-url] - -## Description : -Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. - -It gives you: - -* commands and (grouped) options (`my-program.js serve --port=5000`). -* a dynamically generated help menu based on your arguments. - -> - -* bash-completion shortcuts for commands and options. -* and [tons more](/docs/api.md). - -## Installation - -Stable version: -```bash -npm i yargs -``` - -Bleeding edge version with the most recent features: -```bash -npm i yargs@next -``` - -## Usage : - -### Simple Example - -```javascript -#!/usr/bin/env node -const {argv} = require('yargs') - -if (argv.ships > 3 && argv.distance < 53.5) { - console.log('Plunder more riffiwobbles!') -} else { - console.log('Retreat from the xupptumblers!') -} -``` - -```bash -$ ./plunder.js --ships=4 --distance=22 -Plunder more riffiwobbles! - -$ ./plunder.js --ships 12 --distance 98.7 -Retreat from the xupptumblers! -``` - -### Complex Example - -```javascript -#!/usr/bin/env node -require('yargs') // eslint-disable-line - .command('serve [port]', 'start the server', (yargs) => { - yargs - .positional('port', { - describe: 'port to bind on', - default: 5000 - }) - }, (argv) => { - if (argv.verbose) console.info(`start server on :${argv.port}`) - serve(argv.port) - }) - .option('verbose', { - alias: 'v', - type: 'boolean', - description: 'Run with verbose logging' - }) - .argv -``` - -Run the example above with `--help` to see the help for the application. - -## TypeScript - -yargs has type definitions at [@types/yargs][type-definitions]. - -``` -npm i @types/yargs --save-dev -``` - -See usage examples in [docs](/docs/typescript.md). - -## Webpack - -See usage examples of yargs with webpack in [docs](/docs/webpack.md). - -## Community : - -Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com). - -## Documentation : - -### Table of Contents - -* [Yargs' API](/docs/api.md) -* [Examples](/docs/examples.md) -* [Parsing Tricks](/docs/tricks.md) - * [Stop the Parser](/docs/tricks.md#stop) - * [Negating Boolean Arguments](/docs/tricks.md#negate) - * [Numbers](/docs/tricks.md#numbers) - * [Arrays](/docs/tricks.md#arrays) - * [Objects](/docs/tricks.md#objects) - * [Quotes](/docs/tricks.md#quotes) -* [Advanced Topics](/docs/advanced.md) - * [Composing Your App Using Commands](/docs/advanced.md#commands) - * [Building Configurable CLI Apps](/docs/advanced.md#configuration) - * [Customizing Yargs' Parser](/docs/advanced.md#customizing) -* [Contributing](/contributing.md) - -[travis-url]: https://travis-ci.org/yargs/yargs -[travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg -[npm-url]: https://www.npmjs.com/package/yargs -[npm-image]: https://img.shields.io/npm/v/yargs.svg -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: http://standardjs.com/ -[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg -[conventional-commits-url]: https://conventionalcommits.org/ -[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg -[slack-url]: http://devtoolscommunity.herokuapp.com -[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs -[coverage-image]: https://img.shields.io/nycrc/yargs/yargs -[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc diff --git a/node_modules/yargs/build/lib/apply-extends.d.ts b/node_modules/yargs/build/lib/apply-extends.d.ts deleted file mode 100644 index 5a9aca77019e0..0000000000000 --- a/node_modules/yargs/build/lib/apply-extends.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Dictionary } from './common-types'; -export declare function applyExtends(config: Dictionary, cwd: string, mergeExtends?: boolean): Dictionary; diff --git a/node_modules/yargs/build/lib/apply-extends.js b/node_modules/yargs/build/lib/apply-extends.js deleted file mode 100644 index 005734a07ecf1..0000000000000 --- a/node_modules/yargs/build/lib/apply-extends.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.applyExtends = void 0; -const fs = require("fs"); -const path = require("path"); -const yerror_1 = require("./yerror"); -let previouslyVisitedConfigs = []; -function checkForCircularExtends(cfgPath) { - if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) { - throw new yerror_1.YError(`Circular extended configurations: '${cfgPath}'.`); - } -} -function getPathToDefaultConfig(cwd, pathToExtend) { - return path.resolve(cwd, pathToExtend); -} -function mergeDeep(config1, config2) { - const target = {}; - function isObject(obj) { - return obj && typeof obj === 'object' && !Array.isArray(obj); - } - Object.assign(target, config1); - for (const key of Object.keys(config2)) { - if (isObject(config2[key]) && isObject(target[key])) { - target[key] = mergeDeep(config1[key], config2[key]); - } - else { - target[key] = config2[key]; - } - } - return target; -} -function applyExtends(config, cwd, mergeExtends = false) { - let defaultConfig = {}; - if (Object.prototype.hasOwnProperty.call(config, 'extends')) { - if (typeof config.extends !== 'string') - return defaultConfig; - const isPath = /\.json|\..*rc$/.test(config.extends); - let pathToDefault = null; - if (!isPath) { - try { - pathToDefault = require.resolve(config.extends); - } - catch (err) { - // most likely this simply isn't a module. - } - } - else { - pathToDefault = getPathToDefaultConfig(cwd, config.extends); - } - // maybe the module uses key for some other reason, - // err on side of caution. - if (!pathToDefault && !isPath) - return config; - if (!pathToDefault) - throw new yerror_1.YError(`Unable to find extended config '${config.extends}' in '${cwd}'.`); - checkForCircularExtends(pathToDefault); - previouslyVisitedConfigs.push(pathToDefault); - defaultConfig = isPath ? JSON.parse(fs.readFileSync(pathToDefault, 'utf8')) : require(config.extends); - delete config.extends; - defaultConfig = applyExtends(defaultConfig, path.dirname(pathToDefault), mergeExtends); - } - previouslyVisitedConfigs = []; - return mergeExtends ? mergeDeep(defaultConfig, config) : Object.assign({}, defaultConfig, config); -} -exports.applyExtends = applyExtends; diff --git a/node_modules/yargs/build/lib/argsert.d.ts b/node_modules/yargs/build/lib/argsert.d.ts deleted file mode 100644 index 6f7a83f506ed6..0000000000000 --- a/node_modules/yargs/build/lib/argsert.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function argsert(callerArguments: any[], length?: number): void; -export declare function argsert(expected: string, callerArguments: any[], length?: number): void; diff --git a/node_modules/yargs/build/lib/argsert.js b/node_modules/yargs/build/lib/argsert.js deleted file mode 100644 index 40cb091a89dec..0000000000000 --- a/node_modules/yargs/build/lib/argsert.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.argsert = void 0; -const yerror_1 = require("./yerror"); -const parse_command_1 = require("./parse-command"); -const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']; -function argsert(arg1, arg2, arg3) { - function parseArgs() { - return typeof arg1 === 'object' - ? [{ demanded: [], optional: [] }, arg1, arg2] - : [parse_command_1.parseCommand(`cmd ${arg1}`), arg2, arg3]; - } - // TODO: should this eventually raise an exception. - try { - // preface the argument description with "cmd", so - // that we can run it through yargs' command parser. - let position = 0; - let [parsed, callerArguments, length] = parseArgs(); - const args = [].slice.call(callerArguments); - while (args.length && args[args.length - 1] === undefined) - args.pop(); - length = length || args.length; - if (length < parsed.demanded.length) { - throw new yerror_1.YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`); - } - const totalCommands = parsed.demanded.length + parsed.optional.length; - if (length > totalCommands) { - throw new yerror_1.YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`); - } - parsed.demanded.forEach((demanded) => { - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, demanded.cmd, position); - position += 1; - }); - parsed.optional.forEach((optional) => { - if (args.length === 0) - return; - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, optional.cmd, position); - position += 1; - }); - } - catch (err) { - console.warn(err.stack); - } -} -exports.argsert = argsert; -function guessType(arg) { - if (Array.isArray(arg)) { - return 'array'; - } - else if (arg === null) { - return 'null'; - } - return typeof arg; -} -function argumentTypeError(observedType, allowedTypes, position) { - throw new yerror_1.YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`); -} diff --git a/node_modules/yargs/build/lib/command.d.ts b/node_modules/yargs/build/lib/command.d.ts deleted file mode 100644 index 9db6ab5e9545c..0000000000000 --- a/node_modules/yargs/build/lib/command.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// -import { Dictionary } from './common-types'; -import { Middleware } from './middleware'; -import { Positional } from './parse-command'; -import { RequireDirectoryOptions } from 'require-directory'; -import { UsageInstance } from './usage'; -import { ValidationInstance } from './validation'; -import { YargsInstance, Options, OptionDefinition, Context, Arguments, DetailedArguments } from './yargs'; -export declare function command(yargs: YargsInstance, usage: UsageInstance, validation: ValidationInstance, globalMiddleware?: Middleware[]): CommandInstance; -/** Instance of the command module. */ -export interface CommandInstance { - addDirectory(dir: string, context: Context, req: NodeRequireFunction, callerFile: string, opts?: RequireDirectoryOptions): void; - addHandler(handler: CommandHandlerDefinition): void; - addHandler(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): void; - cmdToParseOptions(cmdString: string): Positionals; - freeze(): void; - getCommandHandlers(): Dictionary; - getCommands(): string[]; - hasDefaultCommand(): boolean; - reset(): CommandInstance; - runCommand(command: string | null, yargs: YargsInstance, parsed: DetailedArguments, commandIndex?: number): Arguments | Promise; - runDefaultBuilderOn(yargs: YargsInstance): void; - unfreeze(): void; -} -export interface CommandHandlerDefinition extends Partial> { - aliases?: string[]; - builder?: CommandBuilder | CommandBuilderDefinition; - command?: string | string[]; - desc?: CommandHandler['description']; - describe?: CommandHandler['description']; -} -export declare function isCommandHandlerDefinition(cmd: string | string[] | CommandHandlerDefinition): cmd is CommandHandlerDefinition; -export interface CommandBuilderDefinition { - builder?: CommandBuilder; - deprecated?: boolean; - handler: CommandHandlerCallback; - middlewares?: Middleware[]; -} -export declare function isCommandBuilderDefinition(builder?: CommandBuilder | CommandBuilderDefinition): builder is CommandBuilderDefinition; -export interface CommandHandlerCallback { - (argv: Arguments): any; -} -export interface CommandHandler { - builder: CommandBuilder; - demanded: Positional[]; - deprecated?: boolean; - description?: string | false; - handler: CommandHandlerCallback; - middlewares: Middleware[]; - optional: Positional[]; - original: string; -} -export declare type CommandBuilder = CommandBuilderCallback | Dictionary; -interface CommandBuilderCallback { - (y: YargsInstance): YargsInstance | void; -} -export declare function isCommandBuilderCallback(builder: CommandBuilder): builder is CommandBuilderCallback; -interface Positionals extends Pick { - demand: Dictionary; -} -export interface FinishCommandHandler { - (handlerResult: any): any; -} -export {}; diff --git a/node_modules/yargs/build/lib/command.js b/node_modules/yargs/build/lib/command.js deleted file mode 100644 index d90c4559a78b4..0000000000000 --- a/node_modules/yargs/build/lib/command.js +++ /dev/null @@ -1,416 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCommandBuilderCallback = exports.isCommandBuilderDefinition = exports.isCommandHandlerDefinition = exports.command = void 0; -const common_types_1 = require("./common-types"); -const is_promise_1 = require("./is-promise"); -const middleware_1 = require("./middleware"); -const parse_command_1 = require("./parse-command"); -const path = require("path"); -const util_1 = require("util"); -const yargs_1 = require("./yargs"); -const requireDirectory = require("require-directory"); -const whichModule = require("which-module"); -const Parser = require("yargs-parser"); -const DEFAULT_MARKER = /(^\*)|(^\$0)/; -// handles parsing positional arguments, -// and populating argv with said positional -// arguments. -function command(yargs, usage, validation, globalMiddleware = []) { - const self = {}; - let handlers = {}; - let aliasMap = {}; - let defaultCommand; - self.addHandler = function addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) { - let aliases = []; - const middlewares = middleware_1.commandMiddlewareFactory(commandMiddleware); - handler = handler || (() => { }); - if (Array.isArray(cmd)) { - aliases = cmd.slice(1); - cmd = cmd[0]; - } - else if (isCommandHandlerDefinition(cmd)) { - let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd); - if (cmd.aliases) - command = [].concat(command).concat(cmd.aliases); - self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated); - return; - } - // allow a module to be provided instead of separate builder and handler - if (isCommandBuilderDefinition(builder)) { - self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated); - return; - } - // parse positionals out of cmd string - const parsedCommand = parse_command_1.parseCommand(cmd); - // remove positional args from aliases only - aliases = aliases.map(alias => parse_command_1.parseCommand(alias).cmd); - // check for default and filter out '*'' - let isDefault = false; - const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => { - if (DEFAULT_MARKER.test(c)) { - isDefault = true; - return false; - } - return true; - }); - // standardize on $0 for default command. - if (parsedAliases.length === 0 && isDefault) - parsedAliases.push('$0'); - // shift cmd and aliases after filtering out '*' - if (isDefault) { - parsedCommand.cmd = parsedAliases[0]; - aliases = parsedAliases.slice(1); - cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd); - } - // populate aliasMap - aliases.forEach((alias) => { - aliasMap[alias] = parsedCommand.cmd; - }); - if (description !== false) { - usage.command(cmd, description, isDefault, aliases, deprecated); - } - handlers[parsedCommand.cmd] = { - original: cmd, - description, - handler, - builder: builder || {}, - middlewares, - deprecated, - demanded: parsedCommand.demanded, - optional: parsedCommand.optional - }; - if (isDefault) - defaultCommand = handlers[parsedCommand.cmd]; - }; - self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) { - opts = opts || {}; - // disable recursion to support nested directories of subcommands - if (typeof opts.recurse !== 'boolean') - opts.recurse = false; - // exclude 'json', 'coffee' from require-directory defaults - if (!Array.isArray(opts.extensions)) - opts.extensions = ['js']; - // allow consumer to define their own visitor function - const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o; - // call addHandler via visitor function - opts.visit = function visit(obj, joined, filename) { - const visited = parentVisit(obj, joined, filename); - // allow consumer to skip modules with their own visitor - if (visited) { - // check for cyclic reference - // each command file path should only be seen once per execution - if (~context.files.indexOf(joined)) - return visited; - // keep track of visited files in context.files - context.files.push(joined); - self.addHandler(visited); - } - return visited; - }; - requireDirectory({ require: req, filename: callerFile }, dir, opts); - }; - // lookup module object from require()d command and derive name - // if module was not require()d and no name given, throw error - function moduleName(obj) { - const mod = whichModule(obj); - if (!mod) - throw new Error(`No command name given for module: ${util_1.inspect(obj)}`); - return commandFromFilename(mod.filename); - } - // derive command name from filename - function commandFromFilename(filename) { - return path.basename(filename, path.extname(filename)); - } - function extractDesc({ describe, description, desc }) { - for (const test of [describe, description, desc]) { - if (typeof test === 'string' || test === false) - return test; - common_types_1.assertNotStrictEqual(test, true); - } - return false; - } - self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap)); - self.getCommandHandlers = () => handlers; - self.hasDefaultCommand = () => !!defaultCommand; - self.runCommand = function runCommand(command, yargs, parsed, commandIndex) { - let aliases = parsed.aliases; - const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand; - const currentContext = yargs.getContext(); - let numFiles = currentContext.files.length; - const parentCommands = currentContext.commands.slice(); - // what does yargs look like after the builder is run? - let innerArgv = parsed.argv; - let positionalMap = {}; - if (command) { - currentContext.commands.push(command); - currentContext.fullCommands.push(commandHandler.original); - } - const builder = commandHandler.builder; - if (isCommandBuilderCallback(builder)) { - // a function can be provided, which builds - // up a yargs chain and possibly returns it. - const builderOutput = builder(yargs.reset(parsed.aliases)); - const innerYargs = yargs_1.isYargsInstance(builderOutput) ? builderOutput : yargs; - if (shouldUpdateUsage(innerYargs)) { - innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); - } - innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); - aliases = innerYargs.parsed.aliases; - } - else if (isCommandBuilderOptionDefinitions(builder)) { - // as a short hand, an object can instead be provided, specifying - // the options that a command takes. - const innerYargs = yargs.reset(parsed.aliases); - if (shouldUpdateUsage(innerYargs)) { - innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); - } - Object.keys(commandHandler.builder).forEach((key) => { - innerYargs.option(key, builder[key]); - }); - innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); - aliases = innerYargs.parsed.aliases; - } - if (!yargs._hasOutput()) { - positionalMap = populatePositionals(commandHandler, innerArgv, currentContext); - } - const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares); - middleware_1.applyMiddleware(innerArgv, yargs, middlewares, true); - // we apply validation post-hoc, so that custom - // checks get passed populated positional arguments. - if (!yargs._hasOutput()) { - yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command); - } - if (commandHandler.handler && !yargs._hasOutput()) { - yargs._setHasOutput(); - // to simplify the parsing of positionals in commands, - // we temporarily populate '--' rather than _, with arguments - const populateDoubleDash = !!yargs.getOptions().configuration['populate--']; - if (!populateDoubleDash) - yargs._copyDoubleDash(innerArgv); - innerArgv = middleware_1.applyMiddleware(innerArgv, yargs, middlewares, false); - let handlerResult; - if (is_promise_1.isPromise(innerArgv)) { - handlerResult = innerArgv.then(argv => commandHandler.handler(argv)); - } - else { - handlerResult = commandHandler.handler(innerArgv); - } - const handlerFinishCommand = yargs.getHandlerFinishCommand(); - if (is_promise_1.isPromise(handlerResult)) { - yargs.getUsageInstance().cacheHelpMessage(); - handlerResult - .then(value => { - if (handlerFinishCommand) { - handlerFinishCommand(value); - } - }) - .catch(error => { - try { - yargs.getUsageInstance().fail(null, error); - } - catch (err) { - // fail's throwing would cause an unhandled rejection. - } - }) - .then(() => { - yargs.getUsageInstance().clearCachedHelpMessage(); - }); - } - else { - if (handlerFinishCommand) { - handlerFinishCommand(handlerResult); - } - } - } - if (command) { - currentContext.commands.pop(); - currentContext.fullCommands.pop(); - } - numFiles = currentContext.files.length - numFiles; - if (numFiles > 0) - currentContext.files.splice(numFiles * -1, numFiles); - return innerArgv; - }; - function shouldUpdateUsage(yargs) { - return !yargs.getUsageInstance().getUsageDisabled() && - yargs.getUsageInstance().getUsage().length === 0; - } - function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) { - const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original; - const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c); }); - pc.push(c); - return `$0 ${pc.join(' ')}`; - } - self.runDefaultBuilderOn = function (yargs) { - common_types_1.assertNotStrictEqual(defaultCommand, undefined); - if (shouldUpdateUsage(yargs)) { - // build the root-level command string from the default string. - const commandString = DEFAULT_MARKER.test(defaultCommand.original) - ? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 '); - yargs.getUsageInstance().usage(commandString, defaultCommand.description); - } - const builder = defaultCommand.builder; - if (isCommandBuilderCallback(builder)) { - builder(yargs); - } - else { - Object.keys(builder).forEach((key) => { - yargs.option(key, builder[key]); - }); - } - }; - // transcribe all positional arguments "command [apple]" - // onto argv. - function populatePositionals(commandHandler, argv, context) { - argv._ = argv._.slice(context.commands.length); // nuke the current commands - const demanded = commandHandler.demanded.slice(0); - const optional = commandHandler.optional.slice(0); - const positionalMap = {}; - validation.positionalCount(demanded.length, argv._.length); - while (demanded.length) { - const demand = demanded.shift(); - populatePositional(demand, argv, positionalMap); - } - while (optional.length) { - const maybe = optional.shift(); - populatePositional(maybe, argv, positionalMap); - } - argv._ = context.commands.concat(argv._); - postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original)); - return positionalMap; - } - function populatePositional(positional, argv, positionalMap) { - const cmd = positional.cmd[0]; - if (positional.variadic) { - positionalMap[cmd] = argv._.splice(0).map(String); - } - else { - if (argv._.length) - positionalMap[cmd] = [String(argv._.shift())]; - } - } - // we run yargs-parser against the positional arguments - // applying the same parsing logic used for flags. - function postProcessPositionals(argv, positionalMap, parseOptions) { - // combine the parsing hints we've inferred from the command - // string with explicitly configured parsing hints. - const options = Object.assign({}, yargs.getOptions()); - options.default = Object.assign(parseOptions.default, options.default); - for (const key of Object.keys(parseOptions.alias)) { - options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]); - } - options.array = options.array.concat(parseOptions.array); - delete options.config; // don't load config when processing positionals. - const unparsed = []; - Object.keys(positionalMap).forEach((key) => { - positionalMap[key].map((value) => { - if (options.configuration['unknown-options-as-args']) - options.key[key] = true; - unparsed.push(`--${key}`); - unparsed.push(value); - }); - }); - // short-circuit parse. - if (!unparsed.length) - return; - const config = Object.assign({}, options.configuration, { - 'populate--': true - }); - const parsed = Parser.detailed(unparsed, Object.assign({}, options, { - configuration: config - })); - if (parsed.error) { - yargs.getUsageInstance().fail(parsed.error.message, parsed.error); - } - else { - // only copy over positional keys (don't overwrite - // flag arguments that were already parsed). - const positionalKeys = Object.keys(positionalMap); - Object.keys(positionalMap).forEach((key) => { - positionalKeys.push(...parsed.aliases[key]); - }); - Object.keys(parsed.argv).forEach((key) => { - if (positionalKeys.indexOf(key) !== -1) { - // any new aliases need to be placed in positionalMap, which - // is used for validation. - if (!positionalMap[key]) - positionalMap[key] = parsed.argv[key]; - argv[key] = parsed.argv[key]; - } - }); - } - } - self.cmdToParseOptions = function (cmdString) { - const parseOptions = { - array: [], - default: {}, - alias: {}, - demand: {} - }; - const parsed = parse_command_1.parseCommand(cmdString); - parsed.demanded.forEach((d) => { - const [cmd, ...aliases] = d.cmd; - if (d.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - parseOptions.demand[cmd] = true; - }); - parsed.optional.forEach((o) => { - const [cmd, ...aliases] = o.cmd; - if (o.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - }); - return parseOptions; - }; - self.reset = () => { - handlers = {}; - aliasMap = {}; - defaultCommand = undefined; - return self; - }; - // used by yargs.parse() to freeze - // the state of commands such that - // we can apply .parse() multiple times - // with the same yargs instance. - const frozens = []; - self.freeze = () => { - frozens.push({ - handlers, - aliasMap, - defaultCommand - }); - }; - self.unfreeze = () => { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - handlers, - aliasMap, - defaultCommand - } = frozen); - }; - return self; -} -exports.command = command; -function isCommandHandlerDefinition(cmd) { - return typeof cmd === 'object'; -} -exports.isCommandHandlerDefinition = isCommandHandlerDefinition; -function isCommandBuilderDefinition(builder) { - return typeof builder === 'object' && - !!builder.builder && - typeof builder.handler === 'function'; -} -exports.isCommandBuilderDefinition = isCommandBuilderDefinition; -function isCommandBuilderCallback(builder) { - return typeof builder === 'function'; -} -exports.isCommandBuilderCallback = isCommandBuilderCallback; -function isCommandBuilderOptionDefinitions(builder) { - return typeof builder === 'object'; -} diff --git a/node_modules/yargs/build/lib/common-types.d.ts b/node_modules/yargs/build/lib/common-types.d.ts deleted file mode 100644 index f83c0dd05c92f..0000000000000 --- a/node_modules/yargs/build/lib/common-types.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * An object whose all properties have the same type. - */ -export declare type Dictionary = { - [key: string]: T; -}; -/** - * Returns the keys of T that match Dictionary and are not arrays. - */ -export declare type DictionaryKeyof = Exclude>, KeyOf>; -/** - * Returns the keys of T that match U. - */ -export declare type KeyOf = Exclude<{ - [K in keyof T]: T[K] extends U ? K : never; -}[keyof T], undefined>; -/** - * An array whose first element is not undefined. - */ -export declare type NotEmptyArray = [T, ...T[]]; -/** - * Returns the type of a Dictionary or array values. - */ -export declare type ValueOf = T extends (infer U)[] ? U : T[keyof T]; -/** - * Typing wrapper around assert.notStrictEqual() - */ -export declare function assertNotStrictEqual(actual: T | N, expected: N, message?: string | Error): asserts actual is Exclude; -/** - * Asserts actual is a single key, not a key array or a key map. - */ -export declare function assertSingleKey(actual: string | string[] | Dictionary): asserts actual is string; -/** - * Typing wrapper around Object.keys() - */ -export declare function objectKeys(object: T): (keyof T)[]; diff --git a/node_modules/yargs/build/lib/common-types.js b/node_modules/yargs/build/lib/common-types.js deleted file mode 100644 index 3064cbf49d038..0000000000000 --- a/node_modules/yargs/build/lib/common-types.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.objectKeys = exports.assertSingleKey = exports.assertNotStrictEqual = void 0; -const assert_1 = require("assert"); -/** - * Typing wrapper around assert.notStrictEqual() - */ -function assertNotStrictEqual(actual, expected, message) { - assert_1.notStrictEqual(actual, expected, message); -} -exports.assertNotStrictEqual = assertNotStrictEqual; -/** - * Asserts actual is a single key, not a key array or a key map. - */ -function assertSingleKey(actual) { - assert_1.strictEqual(typeof actual, 'string'); -} -exports.assertSingleKey = assertSingleKey; -/** - * Typing wrapper around Object.keys() - */ -function objectKeys(object) { - return Object.keys(object); -} -exports.objectKeys = objectKeys; diff --git a/node_modules/yargs/build/lib/completion-templates.d.ts b/node_modules/yargs/build/lib/completion-templates.d.ts deleted file mode 100644 index 67bcd3032d6df..0000000000000 --- a/node_modules/yargs/build/lib/completion-templates.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const completionShTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word=\"${COMP_WORDS[COMP_CWORD]}\"\n args=(\"${COMP_WORDS[@]}\")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions \"${args[@]}\")\n\n COMPREPLY=( $(compgen -W \"${type_list}\" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o default -F _yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n"; -export declare const completionZshTemplate = "###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$'\n' reply=($(COMP_CWORD=\"$((CURRENT-1))\" COMP_LINE=\"$BUFFER\" COMP_POINT=\"$CURSOR\" {{app_path}} --get-yargs-completions \"${words[@]}\"))\n IFS=$si\n _describe 'values' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n"; diff --git a/node_modules/yargs/build/lib/completion-templates.js b/node_modules/yargs/build/lib/completion-templates.js deleted file mode 100644 index 3ee0e0685d215..0000000000000 --- a/node_modules/yargs/build/lib/completion-templates.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.completionZshTemplate = exports.completionShTemplate = void 0; -exports.completionShTemplate = `###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o default -F _yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; -exports.completionZshTemplate = `###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; diff --git a/node_modules/yargs/build/lib/completion.d.ts b/node_modules/yargs/build/lib/completion.d.ts deleted file mode 100644 index 176a91b5005d2..0000000000000 --- a/node_modules/yargs/build/lib/completion.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CommandInstance } from './command'; -import { UsageInstance } from './usage'; -import { YargsInstance } from './yargs'; -import { Arguments, DetailedArguments } from 'yargs-parser'; -export declare function completion(yargs: YargsInstance, usage: UsageInstance, command: CommandInstance): CompletionInstance; -/** Instance of the completion module. */ -export interface CompletionInstance { - completionKey: string; - generateCompletionScript($0: string, cmd: string): string; - getCompletion(args: string[], done: (completions: string[]) => any): any; - registerFunction(fn: CompletionFunction): void; - setParsed(parsed: DetailedArguments): void; -} -export declare type CompletionFunction = SyncCompletionFunction | AsyncCompletionFunction; -interface SyncCompletionFunction { - (current: string, argv: Arguments): string[] | Promise; -} -interface AsyncCompletionFunction { - (current: string, argv: Arguments, done: (completions: string[]) => any): any; -} -export {}; diff --git a/node_modules/yargs/build/lib/completion.js b/node_modules/yargs/build/lib/completion.js deleted file mode 100644 index d65925ab8fe77..0000000000000 --- a/node_modules/yargs/build/lib/completion.js +++ /dev/null @@ -1,135 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.completion = void 0; -const command_1 = require("./command"); -const templates = require("./completion-templates"); -const is_promise_1 = require("./is-promise"); -const parse_command_1 = require("./parse-command"); -const path = require("path"); -const common_types_1 = require("./common-types"); -// add bash completions to your -// yargs-powered applications. -function completion(yargs, usage, command) { - const self = { - completionKey: 'get-yargs-completions' - }; - let aliases; - self.setParsed = function setParsed(parsed) { - aliases = parsed.aliases; - }; - const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) || - (process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1); - // get a list of completion commands. - // 'args' is the array of strings from the line to be completed - self.getCompletion = function getCompletion(args, done) { - const completions = []; - const current = args.length ? args[args.length - 1] : ''; - const argv = yargs.parse(args, true); - const parentCommands = yargs.getContext().commands; - // a custom completion function can be provided - // to completion(). - function runCompletionFunction(argv) { - common_types_1.assertNotStrictEqual(completionFunction, null); - if (isSyncCompletionFunction(completionFunction)) { - const result = completionFunction(current, argv); - // promise based completion function. - if (is_promise_1.isPromise(result)) { - return result.then((list) => { - process.nextTick(() => { done(list); }); - }).catch((err) => { - process.nextTick(() => { throw err; }); - }); - } - // synchronous completion function. - return done(result); - } - else { - // asynchronous completion function - return completionFunction(current, argv, (completions) => { - done(completions); - }); - } - } - if (completionFunction) { - return is_promise_1.isPromise(argv) ? argv.then(runCompletionFunction) : runCompletionFunction(argv); - } - const handlers = command.getCommandHandlers(); - for (let i = 0, ii = args.length; i < ii; ++i) { - if (handlers[args[i]] && handlers[args[i]].builder) { - const builder = handlers[args[i]].builder; - if (command_1.isCommandBuilderCallback(builder)) { - const y = yargs.reset(); - builder(y); - return y.argv; - } - } - } - if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) { - usage.getCommands().forEach((usageCommand) => { - const commandName = parse_command_1.parseCommand(usageCommand[0]).cmd; - if (args.indexOf(commandName) === -1) { - if (!zshShell) { - completions.push(commandName); - } - else { - const desc = usageCommand[1] || ''; - completions.push(commandName.replace(/:/g, '\\:') + ':' + desc); - } - } - }); - } - if (current.match(/^-/) || (current === '' && completions.length === 0)) { - const descs = usage.getDescriptions(); - const options = yargs.getOptions(); - Object.keys(options.key).forEach((key) => { - const negable = !!options.configuration['boolean-negation'] && options.boolean.includes(key); - // If the key and its aliases aren't in 'args', add the key to 'completions' - let keyAndAliases = [key].concat(aliases[key] || []); - if (negable) - keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`)); - function completeOptionKey(key) { - const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1); - if (notInArgs) { - const startsByTwoDashes = (s) => /^--/.test(s); - const isShortOption = (s) => /^[^0-9]$/.test(s); - const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'; - if (!zshShell) { - completions.push(dashes + key); - } - else { - const desc = descs[key] || ''; - completions.push(dashes + `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`); - } - } - } - completeOptionKey(key); - if (negable && !!options.default[key]) - completeOptionKey(`no-${key}`); - }); - } - done(completions); - }; - // generate the completion script to add to your .bashrc. - self.generateCompletionScript = function generateCompletionScript($0, cmd) { - let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate; - const name = path.basename($0); - // add ./to applications not yet installed as bin. - if ($0.match(/\.js$/)) - $0 = `./${$0}`; - script = script.replace(/{{app_name}}/g, name); - script = script.replace(/{{completion_command}}/g, cmd); - return script.replace(/{{app_path}}/g, $0); - }; - // register a function to perform your own custom - // completions., this function can be either - // synchrnous or asynchronous. - let completionFunction = null; - self.registerFunction = (fn) => { - completionFunction = fn; - }; - return self; -} -exports.completion = completion; -function isSyncCompletionFunction(completionFunction) { - return completionFunction.length < 3; -} diff --git a/node_modules/yargs/build/lib/is-promise.d.ts b/node_modules/yargs/build/lib/is-promise.d.ts deleted file mode 100644 index 19b5566b5d7d9..0000000000000 --- a/node_modules/yargs/build/lib/is-promise.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isPromise(maybePromise: T | Promise): maybePromise is Promise; diff --git a/node_modules/yargs/build/lib/is-promise.js b/node_modules/yargs/build/lib/is-promise.js deleted file mode 100644 index c24f9a865cade..0000000000000 --- a/node_modules/yargs/build/lib/is-promise.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isPromise = void 0; -function isPromise(maybePromise) { - return !!maybePromise && - !!maybePromise.then && - (typeof maybePromise.then === 'function'); -} -exports.isPromise = isPromise; diff --git a/node_modules/yargs/build/lib/levenshtein.d.ts b/node_modules/yargs/build/lib/levenshtein.d.ts deleted file mode 100644 index 08b6b7f58016f..0000000000000 --- a/node_modules/yargs/build/lib/levenshtein.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function levenshtein(a: string, b: string): number; diff --git a/node_modules/yargs/build/lib/levenshtein.js b/node_modules/yargs/build/lib/levenshtein.js deleted file mode 100644 index 84c0831f1a35a..0000000000000 --- a/node_modules/yargs/build/lib/levenshtein.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -/* -Copyright (c) 2011 Andrei Mackenzie - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.levenshtein = void 0; -// levenshtein distance algorithm, pulled from Andrei Mackenzie's MIT licensed. -// gist, which can be found here: https://gist.github.com/andrei-m/982927 -// Compute the edit distance between the two given strings -function levenshtein(a, b) { - if (a.length === 0) - return b.length; - if (b.length === 0) - return a.length; - const matrix = []; - // increment along the first column of each row - let i; - for (i = 0; i <= b.length; i++) { - matrix[i] = [i]; - } - // increment each column in the first row - let j; - for (j = 0; j <= a.length; j++) { - matrix[0][j] = j; - } - // Fill in the rest of the matrix - for (i = 1; i <= b.length; i++) { - for (j = 1; j <= a.length; j++) { - if (b.charAt(i - 1) === a.charAt(j - 1)) { - matrix[i][j] = matrix[i - 1][j - 1]; - } - else { - matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution - Math.min(matrix[i][j - 1] + 1, // insertion - matrix[i - 1][j] + 1)); // deletion - } - } - } - return matrix[b.length][a.length]; -} -exports.levenshtein = levenshtein; diff --git a/node_modules/yargs/build/lib/middleware.d.ts b/node_modules/yargs/build/lib/middleware.d.ts deleted file mode 100644 index 8fa7c34f1d144..0000000000000 --- a/node_modules/yargs/build/lib/middleware.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { YargsInstance, Arguments } from './yargs'; -export declare function globalMiddlewareFactory(globalMiddleware: Middleware[], context: T): (callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean) => T; -export declare function commandMiddlewareFactory(commandMiddleware?: MiddlewareCallback[]): Middleware[]; -export declare function applyMiddleware(argv: Arguments | Promise, yargs: YargsInstance, middlewares: Middleware[], beforeValidation: boolean): Arguments | Promise; -export interface MiddlewareCallback { - (argv: Arguments, yargs: YargsInstance): Partial | Promise>; -} -export interface Middleware extends MiddlewareCallback { - applyBeforeValidation: boolean; -} diff --git a/node_modules/yargs/build/lib/middleware.js b/node_modules/yargs/build/lib/middleware.js deleted file mode 100644 index e93b6d277508c..0000000000000 --- a/node_modules/yargs/build/lib/middleware.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.applyMiddleware = exports.commandMiddlewareFactory = exports.globalMiddlewareFactory = void 0; -const argsert_1 = require("./argsert"); -const is_promise_1 = require("./is-promise"); -function globalMiddlewareFactory(globalMiddleware, context) { - return function (callback, applyBeforeValidation = false) { - argsert_1.argsert(' [boolean]', [callback, applyBeforeValidation], arguments.length); - if (Array.isArray(callback)) { - for (let i = 0; i < callback.length; i++) { - if (typeof callback[i] !== 'function') { - throw Error('middleware must be a function'); - } - callback[i].applyBeforeValidation = applyBeforeValidation; - } - Array.prototype.push.apply(globalMiddleware, callback); - } - else if (typeof callback === 'function') { - callback.applyBeforeValidation = applyBeforeValidation; - globalMiddleware.push(callback); - } - return context; - }; -} -exports.globalMiddlewareFactory = globalMiddlewareFactory; -function commandMiddlewareFactory(commandMiddleware) { - if (!commandMiddleware) - return []; - return commandMiddleware.map(middleware => { - middleware.applyBeforeValidation = false; - return middleware; - }); -} -exports.commandMiddlewareFactory = commandMiddlewareFactory; -function applyMiddleware(argv, yargs, middlewares, beforeValidation) { - const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true'); - return middlewares - .reduce((acc, middleware) => { - if (middleware.applyBeforeValidation !== beforeValidation) { - return acc; - } - if (is_promise_1.isPromise(acc)) { - return acc - .then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)])) - .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj)); - } - else { - const result = middleware(acc, yargs); - if (beforeValidation && is_promise_1.isPromise(result)) - throw beforeValidationError; - return is_promise_1.isPromise(result) - ? result.then(middlewareObj => Object.assign(acc, middlewareObj)) - : Object.assign(acc, result); - } - }, argv); -} -exports.applyMiddleware = applyMiddleware; diff --git a/node_modules/yargs/build/lib/obj-filter.d.ts b/node_modules/yargs/build/lib/obj-filter.d.ts deleted file mode 100644 index 031ae289e774f..0000000000000 --- a/node_modules/yargs/build/lib/obj-filter.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function objFilter(original?: T, filter?: (k: keyof T, v: T[keyof T]) => boolean): T; diff --git a/node_modules/yargs/build/lib/obj-filter.js b/node_modules/yargs/build/lib/obj-filter.js deleted file mode 100644 index 790f9478a5a3e..0000000000000 --- a/node_modules/yargs/build/lib/obj-filter.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.objFilter = void 0; -const common_types_1 = require("./common-types"); -function objFilter(original = {}, filter = () => true) { - const obj = {}; - common_types_1.objectKeys(original).forEach((key) => { - if (filter(key, original[key])) { - obj[key] = original[key]; - } - }); - return obj; -} -exports.objFilter = objFilter; diff --git a/node_modules/yargs/build/lib/parse-command.d.ts b/node_modules/yargs/build/lib/parse-command.d.ts deleted file mode 100644 index fc578369207b9..0000000000000 --- a/node_modules/yargs/build/lib/parse-command.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NotEmptyArray } from './common-types'; -export declare function parseCommand(cmd: string): ParsedCommand; -export interface ParsedCommand { - cmd: string; - demanded: Positional[]; - optional: Positional[]; -} -export interface Positional { - cmd: NotEmptyArray; - variadic: boolean; -} diff --git a/node_modules/yargs/build/lib/parse-command.js b/node_modules/yargs/build/lib/parse-command.js deleted file mode 100644 index aaf2327271cdb..0000000000000 --- a/node_modules/yargs/build/lib/parse-command.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseCommand = void 0; -function parseCommand(cmd) { - const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' '); - const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/); - const bregex = /\.*[\][<>]/g; - const firstCommand = splitCommand.shift(); - if (!firstCommand) - throw new Error(`No command found in: ${cmd}`); - const parsedCommand = { - cmd: firstCommand.replace(bregex, ''), - demanded: [], - optional: [] - }; - splitCommand.forEach((cmd, i) => { - let variadic = false; - cmd = cmd.replace(/\s/g, ''); - if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) - variadic = true; - if (/^\[/.test(cmd)) { - parsedCommand.optional.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic - }); - } - else { - parsedCommand.demanded.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic - }); - } - }); - return parsedCommand; -} -exports.parseCommand = parseCommand; diff --git a/node_modules/yargs/build/lib/process-argv.d.ts b/node_modules/yargs/build/lib/process-argv.d.ts deleted file mode 100644 index 18fd43b9c0ca1..0000000000000 --- a/node_modules/yargs/build/lib/process-argv.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function getProcessArgvWithoutBin(): string[]; -export declare function getProcessArgvBin(): string; diff --git a/node_modules/yargs/build/lib/process-argv.js b/node_modules/yargs/build/lib/process-argv.js deleted file mode 100644 index a9201dd70c384..0000000000000 --- a/node_modules/yargs/build/lib/process-argv.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getProcessArgvBin = exports.getProcessArgvWithoutBin = void 0; -function getProcessArgvBinIndex() { - // The binary name is the first command line argument for: - // - bundled Electron apps: bin argv1 argv2 ... argvn - if (isBundledElectronApp()) - return 0; - // or the second one (default) for: - // - standard node apps: node bin.js argv1 argv2 ... argvn - // - unbundled Electron apps: electron bin.js argv1 arg2 ... argvn - return 1; -} -function isBundledElectronApp() { - // process.defaultApp is either set by electron in an electron unbundled app, or undefined - // see https://github.com/electron/electron/blob/master/docs/api/process.md#processdefaultapp-readonly - return isElectronApp() && !process.defaultApp; -} -function isElectronApp() { - // process.versions.electron is either set by electron, or undefined - // see https://github.com/electron/electron/blob/master/docs/api/process.md#processversionselectron-readonly - return !!process.versions.electron; -} -function getProcessArgvWithoutBin() { - return process.argv.slice(getProcessArgvBinIndex() + 1); -} -exports.getProcessArgvWithoutBin = getProcessArgvWithoutBin; -function getProcessArgvBin() { - return process.argv[getProcessArgvBinIndex()]; -} -exports.getProcessArgvBin = getProcessArgvBin; diff --git a/node_modules/yargs/build/lib/usage.d.ts b/node_modules/yargs/build/lib/usage.d.ts deleted file mode 100644 index d9dd1fa7b5141..0000000000000 --- a/node_modules/yargs/build/lib/usage.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Dictionary } from './common-types'; -import { YargsInstance } from './yargs'; -import { YError } from './yerror'; -import { Y18N } from 'y18n'; -export declare function usage(yargs: YargsInstance, y18n: Y18N): UsageInstance; -/** Instance of the usage module. */ -export interface UsageInstance { - cacheHelpMessage(): void; - clearCachedHelpMessage(): void; - command(cmd: string, description: string | undefined, isDefault: boolean, aliases: string[], deprecated?: boolean): void; - deferY18nLookup(str: string): string; - describe(keys: string | string[] | Dictionary, desc?: string): void; - epilog(msg: string): void; - example(cmd: string, description?: string): void; - fail(msg?: string | null, err?: YError | string): void; - failFn(f: FailureFunction): void; - freeze(): void; - functionDescription(fn: { - name?: string; - }): string; - getCommands(): [string, string, boolean, string[], boolean][]; - getDescriptions(): Dictionary; - getPositionalGroupName(): string; - getUsage(): [string, string][]; - getUsageDisabled(): boolean; - help(): string; - reset(localLookup: Dictionary): UsageInstance; - showHelp(level: 'error' | 'log' | ((message: string) => void)): void; - showHelpOnFail(enabled?: boolean | string, message?: string): UsageInstance; - showVersion(): void; - stringifiedValues(values?: any[], separator?: string): string; - unfreeze(): void; - usage(msg: string | null, description?: string | false): UsageInstance; - version(ver: any): void; - wrap(cols: number | null | undefined): void; -} -export interface FailureFunction { - (msg: string | undefined | null, err: YError | string | undefined, usage: UsageInstance): void; -} -export interface FrozenUsageInstance { - failMessage: string | undefined | null; - failureOutput: boolean; - usages: [string, string][]; - usageDisabled: boolean; - epilogs: string[]; - examples: [string, string][]; - commands: [string, string, boolean, string[], boolean][]; - descriptions: Dictionary; -} diff --git a/node_modules/yargs/build/lib/usage.js b/node_modules/yargs/build/lib/usage.js deleted file mode 100644 index 73f7b2448badc..0000000000000 --- a/node_modules/yargs/build/lib/usage.js +++ /dev/null @@ -1,540 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.usage = void 0; -// this file handles outputting usage instructions, -// failures, etc. keeps logging in one place. -const common_types_1 = require("./common-types"); -const obj_filter_1 = require("./obj-filter"); -const path = require("path"); -const yerror_1 = require("./yerror"); -const decamelize = require("decamelize"); -const setBlocking = require("set-blocking"); -const stringWidth = require("string-width"); -function usage(yargs, y18n) { - const __ = y18n.__; - const self = {}; - // methods for ouputting/building failure message. - const fails = []; - self.failFn = function failFn(f) { - fails.push(f); - }; - let failMessage = null; - let showHelpOnFail = true; - self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) { - function parseFunctionArgs() { - return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2]; - } - const [enabled, message] = parseFunctionArgs(); - failMessage = message; - showHelpOnFail = enabled; - return self; - }; - let failureOutput = false; - self.fail = function fail(msg, err) { - const logger = yargs._getLoggerInstance(); - if (fails.length) { - for (let i = fails.length - 1; i >= 0; --i) { - fails[i](msg, err, self); - } - } - else { - if (yargs.getExitProcess()) - setBlocking(true); - // don't output failure message more than once - if (!failureOutput) { - failureOutput = true; - if (showHelpOnFail) { - yargs.showHelp('error'); - logger.error(); - } - if (msg || err) - logger.error(msg || err); - if (failMessage) { - if (msg || err) - logger.error(''); - logger.error(failMessage); - } - } - err = err || new yerror_1.YError(msg); - if (yargs.getExitProcess()) { - return yargs.exit(1); - } - else if (yargs._hasParseCallback()) { - return yargs.exit(1, err); - } - else { - throw err; - } - } - }; - // methods for ouputting/building help (usage) message. - let usages = []; - let usageDisabled = false; - self.usage = (msg, description) => { - if (msg === null) { - usageDisabled = true; - usages = []; - return self; - } - usageDisabled = false; - usages.push([msg, description || '']); - return self; - }; - self.getUsage = () => { - return usages; - }; - self.getUsageDisabled = () => { - return usageDisabled; - }; - self.getPositionalGroupName = () => { - return __('Positionals:'); - }; - let examples = []; - self.example = (cmd, description) => { - examples.push([cmd, description || '']); - }; - let commands = []; - self.command = function command(cmd, description, isDefault, aliases, deprecated = false) { - // the last default wins, so cancel out any previously set default - if (isDefault) { - commands = commands.map((cmdArray) => { - cmdArray[2] = false; - return cmdArray; - }); - } - commands.push([cmd, description || '', isDefault, aliases, deprecated]); - }; - self.getCommands = () => commands; - let descriptions = {}; - self.describe = function describe(keyOrKeys, desc) { - if (Array.isArray(keyOrKeys)) { - keyOrKeys.forEach((k) => { - self.describe(k, desc); - }); - } - else if (typeof keyOrKeys === 'object') { - Object.keys(keyOrKeys).forEach((k) => { - self.describe(k, keyOrKeys[k]); - }); - } - else { - descriptions[keyOrKeys] = desc; - } - }; - self.getDescriptions = () => descriptions; - let epilogs = []; - self.epilog = (msg) => { - epilogs.push(msg); - }; - let wrapSet = false; - let wrap; - self.wrap = (cols) => { - wrapSet = true; - wrap = cols; - }; - function getWrap() { - if (!wrapSet) { - wrap = windowWidth(); - wrapSet = true; - } - return wrap; - } - const deferY18nLookupPrefix = '__yargsString__:'; - self.deferY18nLookup = str => deferY18nLookupPrefix + str; - self.help = function help() { - if (cachedHelpMessage) - return cachedHelpMessage; - normalizeAliases(); - // handle old demanded API - const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0); - const demandedOptions = yargs.getDemandedOptions(); - const demandedCommands = yargs.getDemandedCommands(); - const deprecatedOptions = yargs.getDeprecatedOptions(); - const groups = yargs.getGroups(); - const options = yargs.getOptions(); - let keys = []; - keys = keys.concat(Object.keys(descriptions)); - keys = keys.concat(Object.keys(demandedOptions)); - keys = keys.concat(Object.keys(demandedCommands)); - keys = keys.concat(Object.keys(options.default)); - keys = keys.filter(filterHiddenOptions); - keys = Object.keys(keys.reduce((acc, key) => { - if (key !== '_') - acc[key] = true; - return acc; - }, {})); - const theWrap = getWrap(); - const ui = require('cliui')({ - width: theWrap, - wrap: !!theWrap - }); - // the usage string. - if (!usageDisabled) { - if (usages.length) { - // user-defined usage. - usages.forEach((usage) => { - ui.div(`${usage[0].replace(/\$0/g, base$0)}`); - if (usage[1]) { - ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }); - } - }); - ui.div(); - } - else if (commands.length) { - let u = null; - // demonstrate how commands are used. - if (demandedCommands._) { - u = `${base$0} <${__('command')}>\n`; - } - else { - u = `${base$0} [${__('command')}]\n`; - } - ui.div(`${u}`); - } - } - // your application's commands, i.e., non-option - // arguments populated in '_'. - if (commands.length) { - ui.div(__('Commands:')); - const context = yargs.getContext(); - const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''; - if (yargs.getParserConfiguration()['sort-commands'] === true) { - commands = commands.sort((a, b) => a[0].localeCompare(b[0])); - } - commands.forEach((command) => { - const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands. - ui.span({ - text: commandString, - padding: [0, 2, 0, 2], - width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4 - }, { text: command[1] }); - const hints = []; - if (command[2]) - hints.push(`[${__('default')}]`); - if (command[3] && command[3].length) { - hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`); - } - if (command[4]) { - if (typeof command[4] === 'string') { - hints.push(`[${__('deprecated: %s', command[4])}]`); - } - else { - hints.push(`[${__('deprecated')}]`); - } - } - if (hints.length) { - ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' }); - } - else { - ui.div(); - } - }); - ui.div(); - } - // perform some cleanup on the keys array, making it - // only include top-level keys not their aliases. - const aliasKeys = (Object.keys(options.alias) || []) - .concat(Object.keys(yargs.parsed.newAliases) || []); - keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)); - // populate 'Options:' group with any keys that have not - // explicitly had a group set. - const defaultGroup = __('Options:'); - if (!groups[defaultGroup]) - groups[defaultGroup] = []; - addUngroupedKeys(keys, options.alias, groups, defaultGroup); - // display 'Options:' table along with any custom tables: - Object.keys(groups).forEach((groupName) => { - if (!groups[groupName].length) - return; - // if we've grouped the key 'f', but 'f' aliases 'foobar', - // normalizedKeys should contain only 'foobar'. - const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => { - if (~aliasKeys.indexOf(key)) - return key; - for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { - if (~(options.alias[aliasKey] || []).indexOf(key)) - return aliasKey; - } - return key; - }); - if (normalizedKeys.length < 1) - return; - ui.div(groupName); - // actually generate the switches string --foo, -f, --bar. - const switches = normalizedKeys.reduce((acc, key) => { - acc[key] = [key].concat(options.alias[key] || []) - .map(sw => { - // for the special positional group don't - // add '--' or '-' prefix. - if (groupName === self.getPositionalGroupName()) - return sw; - else { - return ( - // matches yargs-parser logic in which single-digits - // aliases declared with a boolean type are now valid - /^[0-9]$/.test(sw) - ? ~options.boolean.indexOf(key) ? '-' : '--' - : sw.length > 1 ? '--' : '-') + sw; - } - }) - .join(', '); - return acc; - }, {}); - normalizedKeys.forEach((key) => { - const kswitch = switches[key]; - let desc = descriptions[key] || ''; - let type = null; - if (~desc.lastIndexOf(deferY18nLookupPrefix)) - desc = __(desc.substring(deferY18nLookupPrefix.length)); - if (~options.boolean.indexOf(key)) - type = `[${__('boolean')}]`; - if (~options.count.indexOf(key)) - type = `[${__('count')}]`; - if (~options.string.indexOf(key)) - type = `[${__('string')}]`; - if (~options.normalize.indexOf(key)) - type = `[${__('string')}]`; - if (~options.array.indexOf(key)) - type = `[${__('array')}]`; - if (~options.number.indexOf(key)) - type = `[${__('number')}]`; - const deprecatedExtra = (deprecated) => typeof deprecated === 'string' - ? `[${__('deprecated: %s', deprecated)}]` - : `[${__('deprecated')}]`; - const extra = [ - (key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null, - type, - (key in demandedOptions) ? `[${__('required')}]` : null, - options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null, - defaultString(options.default[key], options.defaultDescription[key]) - ].filter(Boolean).join(' '); - ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc); - if (extra) - ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }); - else - ui.div(); - }); - ui.div(); - }); - // describe some common use-cases for your application. - if (examples.length) { - ui.div(__('Examples:')); - examples.forEach((example) => { - example[0] = example[0].replace(/\$0/g, base$0); - }); - examples.forEach((example) => { - if (example[1] === '') { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2] - }); - } - else { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2], - width: maxWidth(examples, theWrap) + 4 - }, { - text: example[1] - }); - } - }); - ui.div(); - } - // the usage string. - if (epilogs.length > 0) { - const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n'); - ui.div(`${e}\n`); - } - // Remove the trailing white spaces - return ui.toString().replace(/\s*$/, ''); - }; - // return the maximum width of a string - // in the left-hand column of a table. - function maxWidth(table, theWrap, modifier) { - let width = 0; - // table might be of the form [leftColumn], - // or {key: leftColumn} - if (!Array.isArray(table)) { - table = Object.values(table).map(v => [v]); - } - table.forEach((v) => { - width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width); - }); - // if we've enabled 'wrap' we should limit - // the max-width of the left-column. - if (theWrap) - width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10)); - return width; - } - // make sure any options set for aliases, - // are copied to the keys being aliased. - function normalizeAliases() { - // handle old demanded API - const demandedOptions = yargs.getDemandedOptions(); - const options = yargs.getOptions(); - (Object.keys(options.alias) || []).forEach((key) => { - options.alias[key].forEach((alias) => { - // copy descriptions. - if (descriptions[alias]) - self.describe(key, descriptions[alias]); - // copy demanded. - if (alias in demandedOptions) - yargs.demandOption(key, demandedOptions[alias]); - // type messages. - if (~options.boolean.indexOf(alias)) - yargs.boolean(key); - if (~options.count.indexOf(alias)) - yargs.count(key); - if (~options.string.indexOf(alias)) - yargs.string(key); - if (~options.normalize.indexOf(alias)) - yargs.normalize(key); - if (~options.array.indexOf(alias)) - yargs.array(key); - if (~options.number.indexOf(alias)) - yargs.number(key); - }); - }); - } - // if yargs is executing an async handler, we take a snapshot of the - // help message to display on failure: - let cachedHelpMessage; - self.cacheHelpMessage = function () { - cachedHelpMessage = this.help(); - }; - // however this snapshot must be cleared afterwards - // not to be be used by next calls to parse - self.clearCachedHelpMessage = function () { - cachedHelpMessage = undefined; - }; - // given a set of keys, place any keys that are - // ungrouped under the 'Options:' grouping. - function addUngroupedKeys(keys, aliases, groups, defaultGroup) { - let groupedKeys = []; - let toCheck = null; - Object.keys(groups).forEach((group) => { - groupedKeys = groupedKeys.concat(groups[group]); - }); - keys.forEach((key) => { - toCheck = [key].concat(aliases[key]); - if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) { - groups[defaultGroup].push(key); - } - }); - return groupedKeys; - } - function filterHiddenOptions(key) { - return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt]; - } - self.showHelp = (level) => { - const logger = yargs._getLoggerInstance(); - if (!level) - level = 'error'; - const emit = typeof level === 'function' ? level : logger[level]; - emit(self.help()); - }; - self.functionDescription = (fn) => { - const description = fn.name ? decamelize(fn.name, '-') : __('generated-value'); - return ['(', description, ')'].join(''); - }; - self.stringifiedValues = function stringifiedValues(values, separator) { - let string = ''; - const sep = separator || ', '; - const array = [].concat(values); - if (!values || !array.length) - return string; - array.forEach((value) => { - if (string.length) - string += sep; - string += JSON.stringify(value); - }); - return string; - }; - // format the default-value-string displayed in - // the right-hand column. - function defaultString(value, defaultDescription) { - let string = `[${__('default:')} `; - if (value === undefined && !defaultDescription) - return null; - if (defaultDescription) { - string += defaultDescription; - } - else { - switch (typeof value) { - case 'string': - string += `"${value}"`; - break; - case 'object': - string += JSON.stringify(value); - break; - default: - string += value; - } - } - return `${string}]`; - } - // guess the width of the console window, max-width 80. - function windowWidth() { - const maxWidth = 80; - // CI is not a TTY - /* c8 ignore next 2 */ - if (typeof process === 'object' && process.stdout && process.stdout.columns) { - return Math.min(maxWidth, process.stdout.columns); - } - else { - return maxWidth; - } - } - // logic for displaying application version. - let version = null; - self.version = (ver) => { - version = ver; - }; - self.showVersion = () => { - const logger = yargs._getLoggerInstance(); - logger.log(version); - }; - self.reset = function reset(localLookup) { - // do not reset wrap here - // do not reset fails here - failMessage = null; - failureOutput = false; - usages = []; - usageDisabled = false; - epilogs = []; - examples = []; - commands = []; - descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions - }); - }; - self.unfreeze = function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions - } = frozen); - }; - return self; -} -exports.usage = usage; diff --git a/node_modules/yargs/build/lib/validation.d.ts b/node_modules/yargs/build/lib/validation.d.ts deleted file mode 100644 index e2d78548dbbf2..0000000000000 --- a/node_modules/yargs/build/lib/validation.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Dictionary } from './common-types'; -import { UsageInstance } from './usage'; -import { YargsInstance, Arguments } from './yargs'; -import { DetailedArguments } from 'yargs-parser'; -import { Y18N } from 'y18n'; -export declare function validation(yargs: YargsInstance, usage: UsageInstance, y18n: Y18N): ValidationInstance; -/** Instance of the validation module. */ -export interface ValidationInstance { - check(f: CustomCheck['func'], global: boolean): void; - conflicting(argv: Arguments): void; - conflicts(key: string | Dictionary, value?: string | string[]): void; - customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void; - freeze(): void; - getConflicting(): Dictionary<(string | undefined)[]>; - getImplied(): Dictionary; - implications(argv: Arguments): void; - implies(key: string | Dictionary, value?: KeyOrPos | KeyOrPos[]): void; - isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean; - limitedChoices(argv: Arguments): void; - nonOptionCount(argv: Arguments): void; - positionalCount(required: number, observed: number): void; - recommendCommands(cmd: string, potentialCommands: string[]): void; - requiredArguments(argv: Arguments): void; - reset(localLookup: Dictionary): ValidationInstance; - unfreeze(): void; - unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void; - unknownCommands(argv: Arguments): boolean; -} -interface CustomCheck { - func: (argv: Arguments, aliases: DetailedArguments['aliases']) => any; - global: boolean; -} -export declare type KeyOrPos = string | number; -export {}; diff --git a/node_modules/yargs/build/lib/validation.js b/node_modules/yargs/build/lib/validation.js deleted file mode 100644 index 60c5e43b45d4f..0000000000000 --- a/node_modules/yargs/build/lib/validation.js +++ /dev/null @@ -1,330 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validation = void 0; -const argsert_1 = require("./argsert"); -const common_types_1 = require("./common-types"); -const levenshtein_1 = require("./levenshtein"); -const obj_filter_1 = require("./obj-filter"); -const specialKeys = ['$0', '--', '_']; -// validation-type-stuff, missing params, -// bad implications, custom checks. -function validation(yargs, usage, y18n) { - const __ = y18n.__; - const __n = y18n.__n; - const self = {}; - // validate appropriate # of non-option - // arguments were provided, i.e., '_'. - self.nonOptionCount = function nonOptionCount(argv) { - const demandedCommands = yargs.getDemandedCommands(); - // don't count currently executing commands - const _s = argv._.length - yargs.getContext().commands.length; - if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) { - if (_s < demandedCommands._.min) { - if (demandedCommands._.minMsg !== undefined) { - usage.fail( - // replace $0 with observed, $1 with expected. - demandedCommands._.minMsg - ? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString()) - : null); - } - else { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s, demandedCommands._.min)); - } - } - else if (_s > demandedCommands._.max) { - if (demandedCommands._.maxMsg !== undefined) { - usage.fail( - // replace $0 with observed, $1 with expected. - demandedCommands._.maxMsg - ? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString()) - : null); - } - else { - usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s, demandedCommands._.max)); - } - } - } - }; - // validate the appropriate # of - // positional arguments were provided: - self.positionalCount = function positionalCount(required, observed) { - if (observed < required) { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed, required)); - } - }; - // make sure all the required arguments are present. - self.requiredArguments = function requiredArguments(argv) { - const demandedOptions = yargs.getDemandedOptions(); - let missing = null; - for (const key of Object.keys(demandedOptions)) { - if (!Object.prototype.hasOwnProperty.call(argv, key) || typeof argv[key] === 'undefined') { - missing = missing || {}; - missing[key] = demandedOptions[key]; - } - } - if (missing) { - const customMsgs = []; - for (const key of Object.keys(missing)) { - const msg = missing[key]; - if (msg && customMsgs.indexOf(msg) < 0) { - customMsgs.push(msg); - } - } - const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''; - usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg)); - } - }; - // check for unknown arguments (strict-mode). - self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand) { - const commandKeys = yargs.getCommandInstance().getCommands(); - const unknown = []; - const currentContext = yargs.getContext(); - Object.keys(argv).forEach((key) => { - if (specialKeys.indexOf(key) === -1 && - !Object.prototype.hasOwnProperty.call(positionalMap, key) && - !Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) && - !self.isValidAndSomeAliasIsNotNew(key, aliases)) { - unknown.push(key); - } - }); - if ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand) { - argv._.slice(currentContext.commands.length).forEach((key) => { - if (commandKeys.indexOf(key) === -1) { - unknown.push(key); - } - }); - } - if (unknown.length > 0) { - usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', '))); - } - }; - self.unknownCommands = function unknownCommands(argv) { - const commandKeys = yargs.getCommandInstance().getCommands(); - const unknown = []; - const currentContext = yargs.getContext(); - if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) { - argv._.slice(currentContext.commands.length).forEach((key) => { - if (commandKeys.indexOf(key) === -1) { - unknown.push(key); - } - }); - } - if (unknown.length > 0) { - usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', '))); - return true; - } - else { - return false; - } - }; - // check for a key that is not an alias, or for which every alias is new, - // implying that it was invented by the parser, e.g., during camelization - self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) { - if (!Object.prototype.hasOwnProperty.call(aliases, key)) { - return false; - } - const newAliases = yargs.parsed.newAliases; - for (const a of [key, ...aliases[key]]) { - if (!Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]) { - return true; - } - } - return false; - }; - // validate arguments limited to enumerated choices - self.limitedChoices = function limitedChoices(argv) { - const options = yargs.getOptions(); - const invalid = {}; - if (!Object.keys(options.choices).length) - return; - Object.keys(argv).forEach((key) => { - if (specialKeys.indexOf(key) === -1 && - Object.prototype.hasOwnProperty.call(options.choices, key)) { - [].concat(argv[key]).forEach((value) => { - // TODO case-insensitive configurability - if (options.choices[key].indexOf(value) === -1 && - value !== undefined) { - invalid[key] = (invalid[key] || []).concat(value); - } - }); - } - }); - const invalidKeys = Object.keys(invalid); - if (!invalidKeys.length) - return; - let msg = __('Invalid values:'); - invalidKeys.forEach((key) => { - msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`; - }); - usage.fail(msg); - }; - // custom checks, added using the `check` option on yargs. - let checks = []; - self.check = function check(f, global) { - checks.push({ - func: f, - global - }); - }; - self.customChecks = function customChecks(argv, aliases) { - for (let i = 0, f; (f = checks[i]) !== undefined; i++) { - const func = f.func; - let result = null; - try { - result = func(argv, aliases); - } - catch (err) { - usage.fail(err.message ? err.message : err, err); - continue; - } - if (!result) { - usage.fail(__('Argument check failed: %s', func.toString())); - } - else if (typeof result === 'string' || result instanceof Error) { - usage.fail(result.toString(), result); - } - } - }; - // check implications, argument foo implies => argument bar. - let implied = {}; - self.implies = function implies(key, value) { - argsert_1.argsert(' [array|number|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.implies(k, key[k]); - }); - } - else { - yargs.global(key); - if (!implied[key]) { - implied[key] = []; - } - if (Array.isArray(value)) { - value.forEach((i) => self.implies(key, i)); - } - else { - common_types_1.assertNotStrictEqual(value, undefined); - implied[key].push(value); - } - } - }; - self.getImplied = function getImplied() { - return implied; - }; - function keyExists(argv, val) { - // convert string '1' to number 1 - const num = Number(val); - val = isNaN(num) ? val : num; - if (typeof val === 'number') { - // check length of argv._ - val = argv._.length >= val; - } - else if (val.match(/^--no-.+/)) { - // check if key/value doesn't exist - val = val.match(/^--no-(.+)/)[1]; - val = !argv[val]; - } - else { - // check if key/value exists - val = argv[val]; - } - return val; - } - self.implications = function implications(argv) { - const implyFail = []; - Object.keys(implied).forEach((key) => { - const origKey = key; - (implied[key] || []).forEach((value) => { - let key = origKey; - const origValue = value; - key = keyExists(argv, key); - value = keyExists(argv, value); - if (key && !value) { - implyFail.push(` ${origKey} -> ${origValue}`); - } - }); - }); - if (implyFail.length) { - let msg = `${__('Implications failed:')}\n`; - implyFail.forEach((value) => { - msg += (value); - }); - usage.fail(msg); - } - }; - let conflicting = {}; - self.conflicts = function conflicts(key, value) { - argsert_1.argsert(' [array|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.conflicts(k, key[k]); - }); - } - else { - yargs.global(key); - if (!conflicting[key]) { - conflicting[key] = []; - } - if (Array.isArray(value)) { - value.forEach((i) => self.conflicts(key, i)); - } - else { - conflicting[key].push(value); - } - } - }; - self.getConflicting = () => conflicting; - self.conflicting = function conflictingFn(argv) { - Object.keys(argv).forEach((key) => { - if (conflicting[key]) { - conflicting[key].forEach((value) => { - // we default keys to 'undefined' that have been configured, we should not - // apply conflicting check unless they are a value other than 'undefined'. - if (value && argv[key] !== undefined && argv[value] !== undefined) { - usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); - } - }); - } - }); - }; - self.recommendCommands = function recommendCommands(cmd, potentialCommands) { - const threshold = 3; // if it takes more than three edits, let's move on. - potentialCommands = potentialCommands.sort((a, b) => b.length - a.length); - let recommended = null; - let bestDistance = Infinity; - for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) { - const d = levenshtein_1.levenshtein(cmd, candidate); - if (d <= threshold && d < bestDistance) { - bestDistance = d; - recommended = candidate; - } - } - if (recommended) - usage.fail(__('Did you mean %s?', recommended)); - }; - self.reset = function reset(localLookup) { - implied = obj_filter_1.objFilter(implied, k => !localLookup[k]); - conflicting = obj_filter_1.objFilter(conflicting, k => !localLookup[k]); - checks = checks.filter(c => c.global); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - implied, - checks, - conflicting - }); - }; - self.unfreeze = function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - ({ - implied, - checks, - conflicting - } = frozen); - }; - return self; -} -exports.validation = validation; diff --git a/node_modules/yargs/build/lib/yargs.d.ts b/node_modules/yargs/build/lib/yargs.d.ts deleted file mode 100644 index 8e6e27cd95a20..0000000000000 --- a/node_modules/yargs/build/lib/yargs.d.ts +++ /dev/null @@ -1,274 +0,0 @@ -/// -import { CommandInstance, CommandHandler, CommandBuilderDefinition, CommandBuilder, CommandHandlerCallback, FinishCommandHandler } from './command'; -import { Dictionary } from './common-types'; -import { Arguments as ParserArguments, DetailedArguments as ParserDetailedArguments, Configuration as ParserConfiguration, Options as ParserOptions, ConfigCallback, CoerceCallback } from 'yargs-parser'; -import { YError } from './yerror'; -import { UsageInstance, FailureFunction } from './usage'; -import { CompletionFunction } from './completion'; -import { ValidationInstance, KeyOrPos } from './validation'; -import { Y18N } from 'y18n'; -import { MiddlewareCallback, Middleware } from './middleware'; -import { RequireDirectoryOptions } from 'require-directory'; -export declare function Yargs(processArgs?: string | string[], cwd?: string, parentRequire?: NodeRequire): YargsInstance; -export declare function rebase(base: string, dir: string): string; -/** Instance of the yargs module. */ -export interface YargsInstance { - $0: string; - argv: Arguments; - customScriptName: boolean; - parsed: DetailedArguments | false; - _copyDoubleDash>(argv: T): T; - _getLoggerInstance(): LoggerInstance; - _getParseContext(): Object; - _hasOutput(): boolean; - _hasParseCallback(): boolean; - _parseArgs: { - (args: null, shortCircuit: null, _calledFromCommand: boolean, commandIndex?: number): Arguments | Promise; - (args: string | string[], shortCircuit?: boolean): Arguments | Promise; - }; - _runValidation(argv: Arguments, aliases: Dictionary, positionalMap: Dictionary, parseErrors: Error | null, isDefaultCommand?: boolean): void; - _setHasOutput(): void; - addHelpOpt: { - (opt?: string | false): YargsInstance; - (opt?: string, msg?: string): YargsInstance; - }; - addShowHiddenOpt: { - (opt?: string | false): YargsInstance; - (opt?: string, msg?: string): YargsInstance; - }; - alias: { - (keys: string | string[], aliases: string | string[]): YargsInstance; - (keyAliases: Dictionary): YargsInstance; - }; - array(keys: string | string[]): YargsInstance; - boolean(keys: string | string[]): YargsInstance; - check(f: (argv: Arguments, aliases: Dictionary) => any, _global?: boolean): YargsInstance; - choices: { - (keys: string | string[], choices: string | string[]): YargsInstance; - (keyChoices: Dictionary): YargsInstance; - }; - coerce: { - (keys: string | string[], coerceCallback: CoerceCallback): YargsInstance; - (keyCoerceCallbacks: Dictionary): YargsInstance; - }; - command(cmd: string | string[], description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback, commandMiddleware?: Middleware[], deprecated?: boolean): YargsInstance; - commandDir(dir: string, opts?: RequireDirectoryOptions): YargsInstance; - completion: { - (cmd?: string, fn?: CompletionFunction): YargsInstance; - (cmd?: string, desc?: string | false, fn?: CompletionFunction): YargsInstance; - }; - config: { - (config: Dictionary): YargsInstance; - (keys?: string | string[], configCallback?: ConfigCallback): YargsInstance; - (keys?: string | string[], msg?: string, configCallback?: ConfigCallback): YargsInstance; - }; - conflicts: { - (key: string, conflictsWith: string | string[]): YargsInstance; - (keyConflicts: Dictionary): YargsInstance; - }; - count(keys: string | string[]): YargsInstance; - default: { - (key: string, value: any, defaultDescription?: string): YargsInstance; - (keys: string[], value: Exclude): YargsInstance; - (keys: Dictionary): YargsInstance; - }; - defaults: YargsInstance['default']; - demand: { - (min: number, max?: number | string, msg?: string): YargsInstance; - (keys: string | string[], msg?: string | true): YargsInstance; - (keys: string | string[], max: string[], msg?: string | true): YargsInstance; - (keyMsgs: Dictionary): YargsInstance; - (keyMsgs: Dictionary, max: string[], msg?: string): YargsInstance; - }; - demandCommand(): YargsInstance; - demandCommand(min: number, minMsg?: string): YargsInstance; - demandCommand(min: number, max: number, minMsg?: string | null, maxMsg?: string | null): YargsInstance; - demandOption: { - (keys: string | string[], msg?: string): YargsInstance; - (keyMsgs: Dictionary): YargsInstance; - }; - deprecateOption(option: string, message?: string | boolean): YargsInstance; - describe: { - (keys: string | string[], description?: string): YargsInstance; - (keyDescriptions: Dictionary): YargsInstance; - }; - detectLocale(detect: boolean): YargsInstance; - env(prefix?: string | false): YargsInstance; - epilog: YargsInstance['epilogue']; - epilogue(msg: string): YargsInstance; - example(cmd: string | [string, string?][], description?: string): YargsInstance; - exit(code: number, err?: YError | string): void; - exitProcess(enabled: boolean): YargsInstance; - fail(f: FailureFunction): YargsInstance; - getCommandInstance(): CommandInstance; - getCompletion(args: string[], done: (completions: string[]) => any): void; - getContext(): Context; - getDemandedCommands(): Options['demandedCommands']; - getDemandedOptions(): Options['demandedOptions']; - getDeprecatedOptions(): Options['deprecatedOptions']; - getDetectLocale(): boolean; - getExitProcess(): boolean; - getGroups(): Dictionary; - getHandlerFinishCommand(): FinishCommandHandler | null; - getOptions(): Options; - getParserConfiguration(): Configuration; - getStrict(): boolean; - getStrictCommands(): boolean; - getUsageInstance(): UsageInstance; - getValidationInstance(): ValidationInstance; - global(keys: string | string[], global?: boolean): YargsInstance; - group(keys: string | string[], groupName: string): YargsInstance; - help: YargsInstance['addHelpOpt']; - hide(key: string): YargsInstance; - implies: { - (key: string, implication: KeyOrPos | KeyOrPos[]): YargsInstance; - (keyImplications: Dictionary): YargsInstance; - }; - locale: { - (): string; - (locale: string): YargsInstance; - }; - middleware(callback: MiddlewareCallback | MiddlewareCallback[], applyBeforeValidation?: boolean): YargsInstance; - nargs: { - (keys: string | string[], nargs: number): YargsInstance; - (keyNargs: Dictionary): YargsInstance; - }; - normalize(keys: string | string[]): YargsInstance; - number(keys: string | string[]): YargsInstance; - onFinishCommand(f: FinishCommandHandler): YargsInstance; - option: { - (key: string, optionDefinition: OptionDefinition): YargsInstance; - (keyOptionDefinitions: Dictionary): YargsInstance; - }; - options: YargsInstance['option']; - parse: { - (): Arguments | Promise; - (args: string | string[], context: object, parseCallback?: ParseCallback): Arguments | Promise; - (args: string | string[], parseCallback: ParseCallback): Arguments | Promise; - (args: string | string[], shortCircuit: boolean): Arguments | Promise; - }; - parserConfiguration(config: Configuration): YargsInstance; - pkgConf(key: string, rootPath?: string): YargsInstance; - positional(key: string, positionalDefinition: PositionalDefinition): YargsInstance; - recommendCommands(recommend: boolean): YargsInstance; - require: YargsInstance['demand']; - required: YargsInstance['demand']; - requiresArg(keys: string | string[] | Dictionary): YargsInstance; - reset(aliases?: DetailedArguments['aliases']): YargsInstance; - resetOptions(aliases?: DetailedArguments['aliases']): YargsInstance; - scriptName(scriptName: string): YargsInstance; - showCompletionScript($0?: string, cmd?: string): YargsInstance; - showHelp(level: 'error' | 'log' | ((message: string) => void)): YargsInstance; - showHelpOnFail: { - (message?: string): YargsInstance; - (enabled: boolean, message: string): YargsInstance; - }; - showHidden: YargsInstance['addShowHiddenOpt']; - skipValidation(keys: string | string[]): YargsInstance; - strict(enable?: boolean): YargsInstance; - strictCommands(enable?: boolean): YargsInstance; - string(key: string | string[]): YargsInstance; - terminalWidth(): number | null; - updateStrings(obj: Dictionary): YargsInstance; - updateLocale: YargsInstance['updateStrings']; - usage: { - (msg: string | null): YargsInstance; - (msg: string, description: CommandHandler['description'], builder?: CommandBuilderDefinition | CommandBuilder, handler?: CommandHandlerCallback): YargsInstance; - }; - version: { - (ver?: string | false): YargsInstance; - (key?: string, ver?: string): YargsInstance; - (key?: string, msg?: string, ver?: string): YargsInstance; - }; - wrap(cols: number | null | undefined): YargsInstance; -} -export declare function isYargsInstance(y: YargsInstance | void): y is YargsInstance; -/** Yargs' context. */ -export interface Context { - commands: string[]; - files: string[]; - fullCommands: string[]; -} -declare type LoggerInstance = Pick; -export interface Options extends ParserOptions { - __: Y18N['__']; - alias: Dictionary; - array: string[]; - boolean: string[]; - choices: Dictionary; - config: Dictionary; - configObjects: Dictionary[]; - configuration: Configuration; - count: string[]; - defaultDescription: Dictionary; - demandedCommands: Dictionary<{ - min: number; - max: number; - minMsg?: string | null; - maxMsg?: string | null; - }>; - demandedOptions: Dictionary; - deprecatedOptions: Dictionary; - hiddenOptions: string[]; - /** Manually set keys */ - key: Dictionary; - local: string[]; - normalize: string[]; - number: string[]; - showHiddenOpt: string; - skipValidation: string[]; - string: string[]; -} -export interface Configuration extends Partial { - /** Should a config object be deep-merged with the object config it extends? */ - 'deep-merge-config'?: boolean; - /** Should commands be sorted in help? */ - 'sort-commands'?: boolean; -} -export interface OptionDefinition { - alias?: string | string[]; - array?: boolean; - boolean?: boolean; - choices?: string | string[]; - coerce?: CoerceCallback; - config?: boolean; - configParser?: ConfigCallback; - conflicts?: string | string[]; - count?: boolean; - default?: any; - defaultDescription?: string; - deprecate?: string | boolean; - deprecated?: OptionDefinition['deprecate']; - desc?: string; - describe?: OptionDefinition['desc']; - description?: OptionDefinition['desc']; - demand?: string | true; - demandOption?: OptionDefinition['demand']; - global?: boolean; - group?: string; - hidden?: boolean; - implies?: string | number | KeyOrPos[]; - nargs?: number; - normalize?: boolean; - number?: boolean; - require?: OptionDefinition['demand']; - required?: OptionDefinition['demand']; - requiresArg?: boolean; - skipValidation?: boolean; - string?: boolean; - type?: 'array' | 'boolean' | 'count' | 'number' | 'string'; -} -interface PositionalDefinition extends Pick { - type?: 'boolean' | 'number' | 'string'; -} -interface ParseCallback { - (err: YError | string | undefined | null, argv: Arguments | Promise, output: string): void; -} -export interface Arguments extends ParserArguments { - /** The script name or node command */ - $0: string; -} -export interface DetailedArguments extends ParserDetailedArguments { - argv: Arguments; -} -export {}; diff --git a/node_modules/yargs/build/lib/yargs.js b/node_modules/yargs/build/lib/yargs.js deleted file mode 100644 index 316f3d6edfa3a..0000000000000 --- a/node_modules/yargs/build/lib/yargs.js +++ /dev/null @@ -1,1190 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isYargsInstance = exports.rebase = exports.Yargs = void 0; -const command_1 = require("./command"); -const common_types_1 = require("./common-types"); -const yerror_1 = require("./yerror"); -const usage_1 = require("./usage"); -const argsert_1 = require("./argsert"); -const fs = require("fs"); -const completion_1 = require("./completion"); -const path = require("path"); -const validation_1 = require("./validation"); -const obj_filter_1 = require("./obj-filter"); -const apply_extends_1 = require("./apply-extends"); -const middleware_1 = require("./middleware"); -const processArgv = require("./process-argv"); -const is_promise_1 = require("./is-promise"); -const Parser = require("yargs-parser"); -const y18nFactory = require("y18n"); -const setBlocking = require("set-blocking"); -const findUp = require("find-up"); -const requireMainFilename = require("require-main-filename"); -function Yargs(processArgs = [], cwd = process.cwd(), parentRequire = require) { - const self = {}; - let command; - let completion = null; - let groups = {}; - const globalMiddleware = []; - let output = ''; - const preservedGroups = {}; - let usage; - let validation; - let handlerFinishCommand = null; - const y18n = y18nFactory({ - directory: path.resolve(__dirname, '../../locales'), - updateFiles: false - }); - self.middleware = middleware_1.globalMiddlewareFactory(globalMiddleware, self); - self.scriptName = function (scriptName) { - self.customScriptName = true; - self.$0 = scriptName; - return self; - }; - // ignore the node bin, specify this in your - // bin file with #!/usr/bin/env node - let default$0; - if (/\b(node|iojs|electron)(\.exe)?$/.test(process.argv[0])) { - default$0 = process.argv.slice(1, 2); - } - else { - default$0 = process.argv.slice(0, 1); - } - self.$0 = default$0 - .map(x => { - const b = rebase(cwd, x); - return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x; - }) - .join(' ').trim(); - if (process.env._ !== undefined && processArgv.getProcessArgvBin() === process.env._) { - self.$0 = process.env._.replace(`${path.dirname(process.execPath)}/`, ''); - } - // use context object to keep track of resets, subcommand execution, etc - // submodules should modify and check the state of context as necessary - const context = { resets: -1, commands: [], fullCommands: [], files: [] }; - self.getContext = () => context; - // puts yargs back into an initial state. any keys - // that have been set to "global" will not be reset - // by this action. - let options; - self.resetOptions = self.reset = function resetOptions(aliases = {}) { - context.resets++; - options = options || {}; - // put yargs back into an initial state, this - // logic is used to build a nested command - // hierarchy. - const tmpOptions = {}; - tmpOptions.local = options.local ? options.local : []; - tmpOptions.configObjects = options.configObjects ? options.configObjects : []; - // if a key has been explicitly set as local, - // we should reset it before passing options to command. - const localLookup = {}; - tmpOptions.local.forEach((l) => { - localLookup[l] = true; - (aliases[l] || []).forEach((a) => { - localLookup[a] = true; - }); - }); - // add all groups not set to local to preserved groups - Object.assign(preservedGroups, Object.keys(groups).reduce((acc, groupName) => { - const keys = groups[groupName].filter(key => !(key in localLookup)); - if (keys.length > 0) { - acc[groupName] = keys; - } - return acc; - }, {})); - // groups can now be reset - groups = {}; - const arrayOptions = [ - 'array', 'boolean', 'string', 'skipValidation', - 'count', 'normalize', 'number', - 'hiddenOptions' - ]; - const objectOptions = [ - 'narg', 'key', 'alias', 'default', 'defaultDescription', - 'config', 'choices', 'demandedOptions', 'demandedCommands', 'coerce', - 'deprecatedOptions' - ]; - arrayOptions.forEach(k => { - tmpOptions[k] = (options[k] || []).filter(k => !localLookup[k]); - }); - objectOptions.forEach((k) => { - tmpOptions[k] = obj_filter_1.objFilter(options[k], k => !localLookup[k]); - }); - tmpOptions.envPrefix = options.envPrefix; - options = tmpOptions; - // if this is the first time being executed, create - // instances of all our helpers -- otherwise just reset. - usage = usage ? usage.reset(localLookup) : usage_1.usage(self, y18n); - validation = validation ? validation.reset(localLookup) : validation_1.validation(self, usage, y18n); - command = command ? command.reset() : command_1.command(self, usage, validation, globalMiddleware); - if (!completion) - completion = completion_1.completion(self, usage, command); - completionCommand = null; - output = ''; - exitError = null; - hasOutput = false; - self.parsed = false; - return self; - }; - self.resetOptions(); - // temporary hack: allow "freezing" of reset-able state for parse(msg, cb) - const frozens = []; - function freeze() { - frozens.push({ - options, - configObjects: options.configObjects.slice(0), - exitProcess, - groups, - strict, - strictCommands, - completionCommand, - output, - exitError, - hasOutput, - parsed: self.parsed, - parseFn, - parseContext, - handlerFinishCommand - }); - usage.freeze(); - validation.freeze(); - command.freeze(); - } - function unfreeze() { - const frozen = frozens.pop(); - common_types_1.assertNotStrictEqual(frozen, undefined); - let configObjects; - ({ - options, - configObjects, - exitProcess, - groups, - output, - exitError, - hasOutput, - parsed: self.parsed, - strict, - strictCommands, - completionCommand, - parseFn, - parseContext, - handlerFinishCommand - } = frozen); - options.configObjects = configObjects; - usage.unfreeze(); - validation.unfreeze(); - command.unfreeze(); - } - self.boolean = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('boolean', keys); - return self; - }; - self.array = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('array', keys); - return self; - }; - self.number = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('number', keys); - return self; - }; - self.normalize = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('normalize', keys); - return self; - }; - self.count = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('count', keys); - return self; - }; - self.string = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('string', keys); - return self; - }; - self.requiresArg = function (keys) { - // the 2nd paramter [number] in the argsert the assertion is mandatory - // as populateParserHintSingleValueDictionary recursively calls requiresArg - // with Nan as a 2nd parameter, although we ignore it - argsert_1.argsert(' [number]', [keys], arguments.length); - // If someone configures nargs at the same time as requiresArg, - // nargs should take precedent, - // see: https://github.com/yargs/yargs/pull/1572 - // TODO: make this work with aliases, using a check similar to - // checkAllAliases() in yargs-parser. - if (typeof keys === 'string' && options.narg[keys]) { - return self; - } - else { - populateParserHintSingleValueDictionary(self.requiresArg, 'narg', keys, NaN); - } - return self; - }; - self.skipValidation = function (keys) { - argsert_1.argsert('', [keys], arguments.length); - populateParserHintArray('skipValidation', keys); - return self; - }; - function populateParserHintArray(type, keys) { - keys = [].concat(keys); - keys.forEach((key) => { - key = sanitizeKey(key); - options[type].push(key); - }); - } - self.nargs = function (key, value) { - argsert_1.argsert(' [number]', [key, value], arguments.length); - populateParserHintSingleValueDictionary(self.nargs, 'narg', key, value); - return self; - }; - self.choices = function (key, value) { - argsert_1.argsert(' [string|array]', [key, value], arguments.length); - populateParserHintArrayDictionary(self.choices, 'choices', key, value); - return self; - }; - self.alias = function (key, value) { - argsert_1.argsert(' [string|array]', [key, value], arguments.length); - populateParserHintArrayDictionary(self.alias, 'alias', key, value); - return self; - }; - // TODO: actually deprecate self.defaults. - self.default = self.defaults = function (key, value, defaultDescription) { - argsert_1.argsert(' [*] [string]', [key, value, defaultDescription], arguments.length); - if (defaultDescription) { - common_types_1.assertSingleKey(key); - options.defaultDescription[key] = defaultDescription; - } - if (typeof value === 'function') { - common_types_1.assertSingleKey(key); - if (!options.defaultDescription[key]) - options.defaultDescription[key] = usage.functionDescription(value); - value = value.call(); - } - populateParserHintSingleValueDictionary(self.default, 'default', key, value); - return self; - }; - self.describe = function (key, desc) { - argsert_1.argsert(' [string]', [key, desc], arguments.length); - setKey(key, true); - usage.describe(key, desc); - return self; - }; - function setKey(key, set) { - populateParserHintSingleValueDictionary(setKey, 'key', key, set); - return self; - } - function demandOption(keys, msg) { - argsert_1.argsert(' [string]', [keys, msg], arguments.length); - populateParserHintSingleValueDictionary(self.demandOption, 'demandedOptions', keys, msg); - return self; - } - self.demandOption = demandOption; - self.coerce = function (keys, value) { - argsert_1.argsert(' [function]', [keys, value], arguments.length); - populateParserHintSingleValueDictionary(self.coerce, 'coerce', keys, value); - return self; - }; - function populateParserHintSingleValueDictionary(builder, type, key, value) { - populateParserHintDictionary(builder, type, key, value, (type, key, value) => { - options[type][key] = value; - }); - } - function populateParserHintArrayDictionary(builder, type, key, value) { - populateParserHintDictionary(builder, type, key, value, (type, key, value) => { - options[type][key] = (options[type][key] || []).concat(value); - }); - } - function populateParserHintDictionary(builder, type, key, value, singleKeyHandler) { - if (Array.isArray(key)) { - // an array of keys with one value ['x', 'y', 'z'], function parse () {} - key.forEach((k) => { - builder(k, value); - }); - } - else if (((key) => typeof key === 'object')(key)) { - // an object of key value pairs: {'x': parse () {}, 'y': parse() {}} - for (const k of common_types_1.objectKeys(key)) { - builder(k, key[k]); - } - } - else { - singleKeyHandler(type, sanitizeKey(key), value); - } - } - function sanitizeKey(key) { - if (key === '__proto__') - return '___proto___'; - return key; - } - function deleteFromParserHintObject(optionKey) { - // delete from all parsing hints: - // boolean, array, key, alias, etc. - common_types_1.objectKeys(options).forEach((hintKey) => { - // configObjects is not a parsing hint array - if (((key) => key === 'configObjects')(hintKey)) - return; - const hint = options[hintKey]; - if (Array.isArray(hint)) { - if (~hint.indexOf(optionKey)) - hint.splice(hint.indexOf(optionKey), 1); - } - else if (typeof hint === 'object') { - delete hint[optionKey]; - } - }); - // now delete the description from usage.js. - delete usage.getDescriptions()[optionKey]; - } - self.config = function config(key = 'config', msg, parseFn) { - argsert_1.argsert('[object|string] [string|function] [function]', [key, msg, parseFn], arguments.length); - // allow a config object to be provided directly. - if ((typeof key === 'object') && !Array.isArray(key)) { - key = apply_extends_1.applyExtends(key, cwd, self.getParserConfiguration()['deep-merge-config']); - options.configObjects = (options.configObjects || []).concat(key); - return self; - } - // allow for a custom parsing function. - if (typeof msg === 'function') { - parseFn = msg; - msg = undefined; - } - self.describe(key, msg || usage.deferY18nLookup('Path to JSON config file')); - (Array.isArray(key) ? key : [key]).forEach((k) => { - options.config[k] = parseFn || true; - }); - return self; - }; - self.example = function (cmd, description) { - argsert_1.argsert(' [string]', [cmd, description], arguments.length); - if (Array.isArray(cmd)) { - cmd.forEach((exampleParams) => self.example(...exampleParams)); - } - else { - usage.example(cmd, description); - } - return self; - }; - self.command = function (cmd, description, builder, handler, middlewares, deprecated) { - argsert_1.argsert(' [string|boolean] [function|object] [function] [array] [boolean|string]', [cmd, description, builder, handler, middlewares, deprecated], arguments.length); - command.addHandler(cmd, description, builder, handler, middlewares, deprecated); - return self; - }; - self.commandDir = function (dir, opts) { - argsert_1.argsert(' [object]', [dir, opts], arguments.length); - const req = parentRequire || require; - command.addDirectory(dir, self.getContext(), req, require('get-caller-file')(), opts); - return self; - }; - // TODO: deprecate self.demand in favor of - // .demandCommand() .demandOption(). - self.demand = self.required = self.require = function demand(keys, max, msg) { - // you can optionally provide a 'max' key, - // which will raise an exception if too many '_' - // options are provided. - if (Array.isArray(max)) { - max.forEach((key) => { - common_types_1.assertNotStrictEqual(msg, true); - demandOption(key, msg); - }); - max = Infinity; - } - else if (typeof max !== 'number') { - msg = max; - max = Infinity; - } - if (typeof keys === 'number') { - common_types_1.assertNotStrictEqual(msg, true); - self.demandCommand(keys, max, msg, msg); - } - else if (Array.isArray(keys)) { - keys.forEach((key) => { - common_types_1.assertNotStrictEqual(msg, true); - demandOption(key, msg); - }); - } - else { - if (typeof msg === 'string') { - demandOption(keys, msg); - } - else if (msg === true || typeof msg === 'undefined') { - demandOption(keys); - } - } - return self; - }; - self.demandCommand = function demandCommand(min = 1, max, minMsg, maxMsg) { - argsert_1.argsert('[number] [number|string] [string|null|undefined] [string|null|undefined]', [min, max, minMsg, maxMsg], arguments.length); - if (typeof max !== 'number') { - minMsg = max; - max = Infinity; - } - self.global('_', false); - options.demandedCommands._ = { - min, - max, - minMsg, - maxMsg - }; - return self; - }; - self.getDemandedOptions = () => { - argsert_1.argsert([], 0); - return options.demandedOptions; - }; - self.getDemandedCommands = () => { - argsert_1.argsert([], 0); - return options.demandedCommands; - }; - self.deprecateOption = function deprecateOption(option, message) { - argsert_1.argsert(' [string|boolean]', [option, message], arguments.length); - options.deprecatedOptions[option] = message; - return self; - }; - self.getDeprecatedOptions = () => { - argsert_1.argsert([], 0); - return options.deprecatedOptions; - }; - self.implies = function (key, value) { - argsert_1.argsert(' [number|string|array]', [key, value], arguments.length); - validation.implies(key, value); - return self; - }; - self.conflicts = function (key1, key2) { - argsert_1.argsert(' [string|array]', [key1, key2], arguments.length); - validation.conflicts(key1, key2); - return self; - }; - self.usage = function (msg, description, builder, handler) { - argsert_1.argsert(' [string|boolean] [function|object] [function]', [msg, description, builder, handler], arguments.length); - if (description !== undefined) { - common_types_1.assertNotStrictEqual(msg, null); - // .usage() can be used as an alias for defining - // a default command. - if ((msg || '').match(/^\$0( |$)/)) { - return self.command(msg, description, builder, handler); - } - else { - throw new yerror_1.YError('.usage() description must start with $0 if being used as alias for .command()'); - } - } - else { - usage.usage(msg); - return self; - } - }; - self.epilogue = self.epilog = function (msg) { - argsert_1.argsert('', [msg], arguments.length); - usage.epilog(msg); - return self; - }; - self.fail = function (f) { - argsert_1.argsert('', [f], arguments.length); - usage.failFn(f); - return self; - }; - self.onFinishCommand = function (f) { - argsert_1.argsert('', [f], arguments.length); - handlerFinishCommand = f; - return self; - }; - self.getHandlerFinishCommand = () => handlerFinishCommand; - self.check = function (f, _global) { - argsert_1.argsert(' [boolean]', [f, _global], arguments.length); - validation.check(f, _global !== false); - return self; - }; - self.global = function global(globals, global) { - argsert_1.argsert(' [boolean]', [globals, global], arguments.length); - globals = [].concat(globals); - if (global !== false) { - options.local = options.local.filter(l => globals.indexOf(l) === -1); - } - else { - globals.forEach((g) => { - if (options.local.indexOf(g) === -1) - options.local.push(g); - }); - } - return self; - }; - self.pkgConf = function pkgConf(key, rootPath) { - argsert_1.argsert(' [string]', [key, rootPath], arguments.length); - let conf = null; - // prefer cwd to require-main-filename in this method - // since we're looking for e.g. "nyc" config in nyc consumer - // rather than "yargs" config in nyc (where nyc is the main filename) - const obj = pkgUp(rootPath || cwd); - // If an object exists in the key, add it to options.configObjects - if (obj[key] && typeof obj[key] === 'object') { - conf = apply_extends_1.applyExtends(obj[key], rootPath || cwd, self.getParserConfiguration()['deep-merge-config']); - options.configObjects = (options.configObjects || []).concat(conf); - } - return self; - }; - const pkgs = {}; - function pkgUp(rootPath) { - const npath = rootPath || '*'; - if (pkgs[npath]) - return pkgs[npath]; - let obj = {}; - try { - let startDir = rootPath || requireMainFilename(parentRequire); - // When called in an environment that lacks require.main.filename, such as a jest test runner, - // startDir is already process.cwd(), and should not be shortened. - // Whether or not it is _actually_ a directory (e.g., extensionless bin) is irrelevant, find-up handles it. - if (!rootPath && path.extname(startDir)) { - startDir = path.dirname(startDir); - } - const pkgJsonPath = findUp.sync('package.json', { - cwd: startDir - }); - common_types_1.assertNotStrictEqual(pkgJsonPath, undefined); - obj = JSON.parse(fs.readFileSync(pkgJsonPath).toString()); - } - catch (noop) { } - pkgs[npath] = obj || {}; - return pkgs[npath]; - } - let parseFn = null; - let parseContext = null; - self.parse = function parse(args, shortCircuit, _parseFn) { - argsert_1.argsert('[string|array] [function|boolean|object] [function]', [args, shortCircuit, _parseFn], arguments.length); - freeze(); - if (typeof args === 'undefined') { - const argv = self._parseArgs(processArgs); - const tmpParsed = self.parsed; - unfreeze(); - // TODO: remove this compatibility hack when we release yargs@15.x: - self.parsed = tmpParsed; - return argv; - } - // a context object can optionally be provided, this allows - // additional information to be passed to a command handler. - if (typeof shortCircuit === 'object') { - parseContext = shortCircuit; - shortCircuit = _parseFn; - } - // by providing a function as a second argument to - // parse you can capture output that would otherwise - // default to printing to stdout/stderr. - if (typeof shortCircuit === 'function') { - parseFn = shortCircuit; - shortCircuit = false; - } - // completion short-circuits the parsing process, - // skipping validation, etc. - if (!shortCircuit) - processArgs = args; - if (parseFn) - exitProcess = false; - const parsed = self._parseArgs(args, !!shortCircuit); - completion.setParsed(self.parsed); - if (parseFn) - parseFn(exitError, parsed, output); - unfreeze(); - return parsed; - }; - self._getParseContext = () => parseContext || {}; - self._hasParseCallback = () => !!parseFn; - self.option = self.options = function option(key, opt) { - argsert_1.argsert(' [object]', [key, opt], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach((k) => { - self.options(k, key[k]); - }); - } - else { - if (typeof opt !== 'object') { - opt = {}; - } - options.key[key] = true; // track manually set keys. - if (opt.alias) - self.alias(key, opt.alias); - const deprecate = opt.deprecate || opt.deprecated; - if (deprecate) { - self.deprecateOption(key, deprecate); - } - const demand = opt.demand || opt.required || opt.require; - // A required option can be specified via "demand: true". - if (demand) { - self.demand(key, demand); - } - if (opt.demandOption) { - self.demandOption(key, typeof opt.demandOption === 'string' ? opt.demandOption : undefined); - } - if (opt.conflicts) { - self.conflicts(key, opt.conflicts); - } - if ('default' in opt) { - self.default(key, opt.default); - } - if (opt.implies !== undefined) { - self.implies(key, opt.implies); - } - if (opt.nargs !== undefined) { - self.nargs(key, opt.nargs); - } - if (opt.config) { - self.config(key, opt.configParser); - } - if (opt.normalize) { - self.normalize(key); - } - if (opt.choices) { - self.choices(key, opt.choices); - } - if (opt.coerce) { - self.coerce(key, opt.coerce); - } - if (opt.group) { - self.group(key, opt.group); - } - if (opt.boolean || opt.type === 'boolean') { - self.boolean(key); - if (opt.alias) - self.boolean(opt.alias); - } - if (opt.array || opt.type === 'array') { - self.array(key); - if (opt.alias) - self.array(opt.alias); - } - if (opt.number || opt.type === 'number') { - self.number(key); - if (opt.alias) - self.number(opt.alias); - } - if (opt.string || opt.type === 'string') { - self.string(key); - if (opt.alias) - self.string(opt.alias); - } - if (opt.count || opt.type === 'count') { - self.count(key); - } - if (typeof opt.global === 'boolean') { - self.global(key, opt.global); - } - if (opt.defaultDescription) { - options.defaultDescription[key] = opt.defaultDescription; - } - if (opt.skipValidation) { - self.skipValidation(key); - } - const desc = opt.describe || opt.description || opt.desc; - self.describe(key, desc); - if (opt.hidden) { - self.hide(key); - } - if (opt.requiresArg) { - self.requiresArg(key); - } - } - return self; - }; - self.getOptions = () => options; - self.positional = function (key, opts) { - argsert_1.argsert(' ', [key, opts], arguments.length); - if (context.resets === 0) { - throw new yerror_1.YError(".positional() can only be called in a command's builder function"); - } - // .positional() only supports a subset of the configuration - // options available to .option(). - const supportedOpts = ['default', 'defaultDescription', 'implies', 'normalize', - 'choices', 'conflicts', 'coerce', 'type', 'describe', - 'desc', 'description', 'alias']; - opts = obj_filter_1.objFilter(opts, (k, v) => { - let accept = supportedOpts.indexOf(k) !== -1; - // type can be one of string|number|boolean. - if (k === 'type' && ['string', 'number', 'boolean'].indexOf(v) === -1) - accept = false; - return accept; - }); - // copy over any settings that can be inferred from the command string. - const fullCommand = context.fullCommands[context.fullCommands.length - 1]; - const parseOptions = fullCommand ? command.cmdToParseOptions(fullCommand) : { - array: [], - alias: {}, - default: {}, - demand: {} - }; - common_types_1.objectKeys(parseOptions).forEach((pk) => { - const parseOption = parseOptions[pk]; - if (Array.isArray(parseOption)) { - if (parseOption.indexOf(key) !== -1) - opts[pk] = true; - } - else { - if (parseOption[key] && !(pk in opts)) - opts[pk] = parseOption[key]; - } - }); - self.group(key, usage.getPositionalGroupName()); - return self.option(key, opts); - }; - self.group = function group(opts, groupName) { - argsert_1.argsert(' ', [opts, groupName], arguments.length); - const existing = preservedGroups[groupName] || groups[groupName]; - if (preservedGroups[groupName]) { - // we now only need to track this group name in groups. - delete preservedGroups[groupName]; - } - const seen = {}; - groups[groupName] = (existing || []).concat(opts).filter((key) => { - if (seen[key]) - return false; - return (seen[key] = true); - }); - return self; - }; - // combine explicit and preserved groups. explicit groups should be first - self.getGroups = () => Object.assign({}, groups, preservedGroups); - // as long as options.envPrefix is not undefined, - // parser will apply env vars matching prefix to argv - self.env = function (prefix) { - argsert_1.argsert('[string|boolean]', [prefix], arguments.length); - if (prefix === false) - delete options.envPrefix; - else - options.envPrefix = prefix || ''; - return self; - }; - self.wrap = function (cols) { - argsert_1.argsert('', [cols], arguments.length); - usage.wrap(cols); - return self; - }; - let strict = false; - self.strict = function (enabled) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - strict = enabled !== false; - return self; - }; - self.getStrict = () => strict; - let strictCommands = false; - self.strictCommands = function (enabled) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - strictCommands = enabled !== false; - return self; - }; - self.getStrictCommands = () => strictCommands; - let parserConfig = {}; - self.parserConfiguration = function parserConfiguration(config) { - argsert_1.argsert('', [config], arguments.length); - parserConfig = config; - return self; - }; - self.getParserConfiguration = () => parserConfig; - self.showHelp = function (level) { - argsert_1.argsert('[string|function]', [level], arguments.length); - if (!self.parsed) - self._parseArgs(processArgs); // run parser, if it has not already been executed. - if (command.hasDefaultCommand()) { - context.resets++; // override the restriction on top-level positoinals. - command.runDefaultBuilderOn(self); - } - usage.showHelp(level); - return self; - }; - let versionOpt = null; - self.version = function version(opt, msg, ver) { - const defaultVersionOpt = 'version'; - argsert_1.argsert('[boolean|string] [string] [string]', [opt, msg, ver], arguments.length); - // nuke the key previously configured - // to return version #. - if (versionOpt) { - deleteFromParserHintObject(versionOpt); - usage.version(undefined); - versionOpt = null; - } - if (arguments.length === 0) { - ver = guessVersion(); - opt = defaultVersionOpt; - } - else if (arguments.length === 1) { - if (opt === false) { // disable default 'version' key. - return self; - } - ver = opt; - opt = defaultVersionOpt; - } - else if (arguments.length === 2) { - ver = msg; - msg = undefined; - } - versionOpt = typeof opt === 'string' ? opt : defaultVersionOpt; - msg = msg || usage.deferY18nLookup('Show version number'); - usage.version(ver || undefined); - self.boolean(versionOpt); - self.describe(versionOpt, msg); - return self; - }; - function guessVersion() { - const obj = pkgUp(); - return obj.version || 'unknown'; - } - let helpOpt = null; - self.addHelpOpt = self.help = function addHelpOpt(opt, msg) { - const defaultHelpOpt = 'help'; - argsert_1.argsert('[string|boolean] [string]', [opt, msg], arguments.length); - // nuke the key previously configured - // to return help. - if (helpOpt) { - deleteFromParserHintObject(helpOpt); - helpOpt = null; - } - if (arguments.length === 1) { - if (opt === false) - return self; - } - // use arguments, fallback to defaults for opt and msg - helpOpt = typeof opt === 'string' ? opt : defaultHelpOpt; - self.boolean(helpOpt); - self.describe(helpOpt, msg || usage.deferY18nLookup('Show help')); - return self; - }; - const defaultShowHiddenOpt = 'show-hidden'; - options.showHiddenOpt = defaultShowHiddenOpt; - self.addShowHiddenOpt = self.showHidden = function addShowHiddenOpt(opt, msg) { - argsert_1.argsert('[string|boolean] [string]', [opt, msg], arguments.length); - if (arguments.length === 1) { - if (opt === false) - return self; - } - const showHiddenOpt = typeof opt === 'string' ? opt : defaultShowHiddenOpt; - self.boolean(showHiddenOpt); - self.describe(showHiddenOpt, msg || usage.deferY18nLookup('Show hidden options')); - options.showHiddenOpt = showHiddenOpt; - return self; - }; - self.hide = function hide(key) { - argsert_1.argsert('', [key], arguments.length); - options.hiddenOptions.push(key); - return self; - }; - self.showHelpOnFail = function showHelpOnFail(enabled, message) { - argsert_1.argsert('[boolean|string] [string]', [enabled, message], arguments.length); - usage.showHelpOnFail(enabled, message); - return self; - }; - var exitProcess = true; - self.exitProcess = function (enabled = true) { - argsert_1.argsert('[boolean]', [enabled], arguments.length); - exitProcess = enabled; - return self; - }; - self.getExitProcess = () => exitProcess; - var completionCommand = null; - self.completion = function (cmd, desc, fn) { - argsert_1.argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length); - // a function to execute when generating - // completions can be provided as the second - // or third argument to completion. - if (typeof desc === 'function') { - fn = desc; - desc = undefined; - } - // register the completion command. - completionCommand = cmd || completionCommand || 'completion'; - if (!desc && desc !== false) { - desc = 'generate completion script'; - } - self.command(completionCommand, desc); - // a function can be provided - if (fn) - completion.registerFunction(fn); - return self; - }; - self.showCompletionScript = function ($0, cmd) { - argsert_1.argsert('[string] [string]', [$0, cmd], arguments.length); - $0 = $0 || self.$0; - _logger.log(completion.generateCompletionScript($0, cmd || completionCommand || 'completion')); - return self; - }; - self.getCompletion = function (args, done) { - argsert_1.argsert(' ', [args, done], arguments.length); - completion.getCompletion(args, done); - }; - self.locale = function (locale) { - argsert_1.argsert('[string]', [locale], arguments.length); - if (!locale) { - guessLocale(); - return y18n.getLocale(); - } - detectLocale = false; - y18n.setLocale(locale); - return self; - }; - self.updateStrings = self.updateLocale = function (obj) { - argsert_1.argsert('', [obj], arguments.length); - detectLocale = false; - y18n.updateLocale(obj); - return self; - }; - let detectLocale = true; - self.detectLocale = function (detect) { - argsert_1.argsert('', [detect], arguments.length); - detectLocale = detect; - return self; - }; - self.getDetectLocale = () => detectLocale; - var hasOutput = false; - var exitError = null; - // maybe exit, always capture - // context about why we wanted to exit. - self.exit = (code, err) => { - hasOutput = true; - exitError = err; - if (exitProcess) - process.exit(code); - }; - // we use a custom logger that buffers output, - // so that we can print to non-CLIs, e.g., chat-bots. - const _logger = { - log(...args) { - if (!self._hasParseCallback()) - console.log(...args); - hasOutput = true; - if (output.length) - output += '\n'; - output += args.join(' '); - }, - error(...args) { - if (!self._hasParseCallback()) - console.error(...args); - hasOutput = true; - if (output.length) - output += '\n'; - output += args.join(' '); - } - }; - self._getLoggerInstance = () => _logger; - // has yargs output an error our help - // message in the current execution context. - self._hasOutput = () => hasOutput; - self._setHasOutput = () => { - hasOutput = true; - }; - let recommendCommands; - self.recommendCommands = function (recommend = true) { - argsert_1.argsert('[boolean]', [recommend], arguments.length); - recommendCommands = recommend; - return self; - }; - self.getUsageInstance = () => usage; - self.getValidationInstance = () => validation; - self.getCommandInstance = () => command; - self.terminalWidth = () => { - argsert_1.argsert([], 0); - return typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null; - }; - Object.defineProperty(self, 'argv', { - get: () => self._parseArgs(processArgs), - enumerable: true - }); - self._parseArgs = function parseArgs(args, shortCircuit, _calledFromCommand, commandIndex) { - let skipValidation = !!_calledFromCommand; - args = args || processArgs; - options.__ = y18n.__; - options.configuration = self.getParserConfiguration(); - const populateDoubleDash = !!options.configuration['populate--']; - const config = Object.assign({}, options.configuration, { - 'populate--': true - }); - const parsed = Parser.detailed(args, Object.assign({}, options, { - configuration: config - })); - let argv = parsed.argv; - if (parseContext) - argv = Object.assign({}, argv, parseContext); - const aliases = parsed.aliases; - argv.$0 = self.$0; - self.parsed = parsed; - try { - guessLocale(); // guess locale lazily, so that it can be turned off in chain. - // while building up the argv object, there - // are two passes through the parser. If completion - // is being performed short-circuit on the first pass. - if (shortCircuit) { - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - } - // if there's a handler associated with a - // command defer processing to it. - if (helpOpt) { - // consider any multi-char helpOpt alias as a valid help command - // unless all helpOpt aliases are single-char - // note that parsed.aliases is a normalized bidirectional map :) - const helpCmds = [helpOpt] - .concat(aliases[helpOpt] || []) - .filter(k => k.length > 1); - // check if help should trigger and strip it from _. - if (~helpCmds.indexOf(argv._[argv._.length - 1])) { - argv._.pop(); - argv[helpOpt] = true; - } - } - const handlerKeys = command.getCommands(); - const requestCompletions = completion.completionKey in argv; - const skipRecommendation = argv[helpOpt] || requestCompletions; - const skipDefaultCommand = skipRecommendation && (handlerKeys.length > 1 || handlerKeys[0] !== '$0'); - if (argv._.length) { - if (handlerKeys.length) { - let firstUnknownCommand; - for (let i = (commandIndex || 0), cmd; argv._[i] !== undefined; i++) { - cmd = String(argv._[i]); - if (~handlerKeys.indexOf(cmd) && cmd !== completionCommand) { - // commands are executed using a recursive algorithm that executes - // the deepest command first; we keep track of the position in the - // argv._ array that is currently being executed. - const innerArgv = command.runCommand(cmd, self, parsed, i + 1); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - else if (!firstUnknownCommand && cmd !== completionCommand) { - firstUnknownCommand = cmd; - break; - } - } - // run the default command, if defined - if (command.hasDefaultCommand() && !skipDefaultCommand) { - const innerArgv = command.runCommand(null, self, parsed); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - // recommend a command if recommendCommands() has - // been enabled, and no commands were found to execute - if (recommendCommands && firstUnknownCommand && !skipRecommendation) { - validation.recommendCommands(firstUnknownCommand, handlerKeys); - } - } - // generate a completion script for adding to ~/.bashrc. - if (completionCommand && ~argv._.indexOf(completionCommand) && !requestCompletions) { - if (exitProcess) - setBlocking(true); - self.showCompletionScript(); - self.exit(0); - } - } - else if (command.hasDefaultCommand() && !skipDefaultCommand) { - const innerArgv = command.runCommand(null, self, parsed); - return populateDoubleDash ? innerArgv : self._copyDoubleDash(innerArgv); - } - // we must run completions first, a user might - // want to complete the --help or --version option. - if (requestCompletions) { - if (exitProcess) - setBlocking(true); - // we allow for asynchronous completions, - // e.g., loading in a list of commands from an API. - args = [].concat(args); - const completionArgs = args.slice(args.indexOf(`--${completion.completionKey}`) + 1); - completion.getCompletion(completionArgs, (completions) => { - ; - (completions || []).forEach((completion) => { - _logger.log(completion); - }); - self.exit(0); - }); - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - } - // Handle 'help' and 'version' options - // if we haven't already output help! - if (!hasOutput) { - Object.keys(argv).forEach((key) => { - if (key === helpOpt && argv[key]) { - if (exitProcess) - setBlocking(true); - skipValidation = true; - self.showHelp('log'); - self.exit(0); - } - else if (key === versionOpt && argv[key]) { - if (exitProcess) - setBlocking(true); - skipValidation = true; - usage.showVersion(); - self.exit(0); - } - }); - } - // Check if any of the options to skip validation were provided - if (!skipValidation && options.skipValidation.length > 0) { - skipValidation = Object.keys(argv).some(key => options.skipValidation.indexOf(key) >= 0 && argv[key] === true); - } - // If the help or version options where used and exitProcess is false, - // or if explicitly skipped, we won't run validations. - if (!skipValidation) { - if (parsed.error) - throw new yerror_1.YError(parsed.error.message); - // if we're executed via bash completion, don't - // bother with validation. - if (!requestCompletions) { - self._runValidation(argv, aliases, {}, parsed.error); - } - } - } - catch (err) { - if (err instanceof yerror_1.YError) - usage.fail(err.message, err); - else - throw err; - } - return (populateDoubleDash || _calledFromCommand) ? argv : self._copyDoubleDash(argv); - }; - // to simplify the parsing of positionals in commands, - // we temporarily populate '--' rather than _, with arguments - // after the '--' directive. After the parse, we copy these back. - self._copyDoubleDash = function (argv) { - if (is_promise_1.isPromise(argv) || !argv._ || !argv['--']) - return argv; - argv._.push.apply(argv._, argv['--']); - // TODO(bcoe): refactor command parsing such that this delete is not - // necessary: https://github.com/yargs/yargs/issues/1482 - try { - delete argv['--']; - } - catch (_err) { } - return argv; - }; - self._runValidation = function runValidation(argv, aliases, positionalMap, parseErrors, isDefaultCommand = false) { - if (parseErrors) - throw new yerror_1.YError(parseErrors.message); - validation.nonOptionCount(argv); - validation.requiredArguments(argv); - let failedStrictCommands = false; - if (strictCommands) { - failedStrictCommands = validation.unknownCommands(argv); - } - if (strict && !failedStrictCommands) { - validation.unknownArguments(argv, aliases, positionalMap, isDefaultCommand); - } - validation.customChecks(argv, aliases); - validation.limitedChoices(argv); - validation.implications(argv); - validation.conflicting(argv); - }; - function guessLocale() { - if (!detectLocale) - return; - const locale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en_US'; - self.locale(locale.replace(/[.:].*/, '')); - } - // an app should almost always have --version and --help, - // if you *really* want to disable this use .help(false)/.version(false). - self.help(); - self.version(); - return self; -} -exports.Yargs = Yargs; -// rebase an absolute path to a relative one with respect to a base directory -// exported for tests -function rebase(base, dir) { - return path.relative(base, dir); -} -exports.rebase = rebase; -function isYargsInstance(y) { - return !!y && (typeof y._parseArgs === 'function'); -} -exports.isYargsInstance = isYargsInstance; diff --git a/node_modules/yargs/build/lib/yerror.d.ts b/node_modules/yargs/build/lib/yerror.d.ts deleted file mode 100644 index 024d0c7a3899d..0000000000000 --- a/node_modules/yargs/build/lib/yerror.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare class YError extends Error { - name: string; - constructor(msg?: string | null); -} diff --git a/node_modules/yargs/build/lib/yerror.js b/node_modules/yargs/build/lib/yerror.js deleted file mode 100644 index 0fa146e564609..0000000000000 --- a/node_modules/yargs/build/lib/yerror.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.YError = void 0; -class YError extends Error { - constructor(msg) { - super(msg || 'yargs error'); - this.name = 'YError'; - Error.captureStackTrace(this, YError); - } -} -exports.YError = YError; diff --git a/node_modules/yargs/index.js b/node_modules/yargs/index.js deleted file mode 100644 index 7dc62de9966da..0000000000000 --- a/node_modules/yargs/index.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' -// classic singleton yargs API, to use yargs -// without running as a singleton do: -// require('yargs/yargs')(process.argv.slice(2)) -const yargs = require('./yargs') -const processArgv = require('./build/lib/process-argv') - -Argv(processArgv.getProcessArgvWithoutBin()) - -module.exports = Argv - -function Argv (processArgs, cwd) { - const argv = yargs(processArgs, cwd, require) - singletonify(argv) - return argv -} - -/* Hack an instance of Argv with process.argv into Argv - so people can do - require('yargs')(['--beeble=1','-z','zizzle']).argv - to parse a list of args and - require('yargs').argv - to get a parsed version of process.argv. -*/ -function singletonify (inst) { - Object.keys(inst).forEach((key) => { - if (key === 'argv') { - Argv.__defineGetter__(key, inst.__lookupGetter__(key)) - } else if (typeof inst[key] === 'function') { - Argv[key] = inst[key].bind(inst) - } else { - Argv.__defineGetter__('$0', () => { - return inst.$0 - }) - Argv.__defineGetter__('parsed', () => { - return inst.parsed - }) - } - }) -} diff --git a/node_modules/yargs/locales/be.json b/node_modules/yargs/locales/be.json deleted file mode 100644 index e28fa30139366..0000000000000 --- a/node_modules/yargs/locales/be.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Каманды:", - "Options:": "Опцыі:", - "Examples:": "Прыклады:", - "boolean": "булевы тып", - "count": "падлік", - "string": "радковы тып", - "number": "лік", - "array": "масіў", - "required": "неабходна", - "default": "па змаўчанні", - "default:": "па змаўчанні:", - "choices:": "магчымасці:", - "aliases:": "аліасы:", - "generated-value": "згенераванае значэнне", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s", - "other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s", - "other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s" - }, - "Missing argument value: %s": { - "one": "Не хапае значэння аргументу: %s", - "other": "Не хапае значэнняў аргументаў: %s" - }, - "Missing required argument: %s": { - "one": "Не хапае неабходнага аргументу: %s", - "other": "Не хапае неабходных аргументаў: %s" - }, - "Unknown argument: %s": { - "one": "Невядомы аргумент: %s", - "other": "Невядомыя аргументы: %s" - }, - "Invalid values:": "Несапраўдныя значэння:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Дадзенае значэнне: %s, Магчымасці: %s", - "Argument check failed: %s": "Праверка аргументаў не ўдалася: %s", - "Implications failed:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:", - "Not enough arguments following: %s": "Недастаткова наступных аргументаў: %s", - "Invalid JSON config file: %s": "Несапраўдны файл канфігурацыі JSON: %s", - "Path to JSON config file": "Шлях да файла канфігурацыі JSON", - "Show help": "Паказаць дапамогу", - "Show version number": "Паказаць нумар версіі", - "Did you mean %s?": "Вы мелі на ўвазе %s?" -} diff --git a/node_modules/yargs/locales/de.json b/node_modules/yargs/locales/de.json deleted file mode 100644 index dc73ec3f02073..0000000000000 --- a/node_modules/yargs/locales/de.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Kommandos:", - "Options:": "Optionen:", - "Examples:": "Beispiele:", - "boolean": "boolean", - "count": "Zähler", - "string": "string", - "number": "Zahl", - "array": "array", - "required": "erforderlich", - "default": "Standard", - "default:": "Standard:", - "choices:": "Möglichkeiten:", - "aliases:": "Aliase:", - "generated-value": "Generierter-Wert", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt", - "other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt", - "other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt" - }, - "Missing argument value: %s": { - "one": "Fehlender Argumentwert: %s", - "other": "Fehlende Argumentwerte: %s" - }, - "Missing required argument: %s": { - "one": "Fehlendes Argument: %s", - "other": "Fehlende Argumente: %s" - }, - "Unknown argument: %s": { - "one": "Unbekanntes Argument: %s", - "other": "Unbekannte Argumente: %s" - }, - "Invalid values:": "Unzulässige Werte:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s", - "Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s", - "Implications failed:": "Fehlende abhängige Argumente:", - "Not enough arguments following: %s": "Nicht genügend Argumente nach: %s", - "Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s", - "Path to JSON config file": "Pfad zur JSON-Config Datei", - "Show help": "Hilfe anzeigen", - "Show version number": "Version anzeigen", - "Did you mean %s?": "Meintest du %s?" -} diff --git a/node_modules/yargs/locales/en.json b/node_modules/yargs/locales/en.json deleted file mode 100644 index d794947dccba5..0000000000000 --- a/node_modules/yargs/locales/en.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "Commands:", - "Options:": "Options:", - "Examples:": "Examples:", - "boolean": "boolean", - "count": "count", - "string": "string", - "number": "number", - "array": "array", - "required": "required", - "default": "default", - "default:": "default:", - "choices:": "choices:", - "aliases:": "aliases:", - "generated-value": "generated-value", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Not enough non-option arguments: got %s, need at least %s", - "other": "Not enough non-option arguments: got %s, need at least %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Too many non-option arguments: got %s, maximum of %s", - "other": "Too many non-option arguments: got %s, maximum of %s" - }, - "Missing argument value: %s": { - "one": "Missing argument value: %s", - "other": "Missing argument values: %s" - }, - "Missing required argument: %s": { - "one": "Missing required argument: %s", - "other": "Missing required arguments: %s" - }, - "Unknown argument: %s": { - "one": "Unknown argument: %s", - "other": "Unknown arguments: %s" - }, - "Invalid values:": "Invalid values:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", - "Argument check failed: %s": "Argument check failed: %s", - "Implications failed:": "Missing dependent arguments:", - "Not enough arguments following: %s": "Not enough arguments following: %s", - "Invalid JSON config file: %s": "Invalid JSON config file: %s", - "Path to JSON config file": "Path to JSON config file", - "Show help": "Show help", - "Show version number": "Show version number", - "Did you mean %s?": "Did you mean %s?", - "Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive", - "Positionals:": "Positionals:", - "command": "command", - "deprecated": "deprecated", - "deprecated: %s": "deprecated: %s" -} diff --git a/node_modules/yargs/locales/es.json b/node_modules/yargs/locales/es.json deleted file mode 100644 index d77b4616a211f..0000000000000 --- a/node_modules/yargs/locales/es.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opciones:", - "Examples:": "Ejemplos:", - "boolean": "booleano", - "count": "cuenta", - "string": "cadena de caracteres", - "number": "número", - "array": "tabla", - "required": "requerido", - "default": "defecto", - "default:": "defecto:", - "choices:": "selección:", - "aliases:": "alias:", - "generated-value": "valor-generado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s", - "other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s", - "other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s" - }, - "Missing argument value: %s": { - "one": "Falta argumento: %s", - "other": "Faltan argumentos: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento requerido: %s", - "other": "Faltan argumentos requeridos: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconocido: %s", - "other": "Argumentos desconocidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s", - "Argument check failed: %s": "Verificación de argumento ha fallado: %s", - "Implications failed:": "Implicaciones fallidas:", - "Not enough arguments following: %s": "No hay suficientes argumentos después de: %s", - "Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s", - "Path to JSON config file": "Ruta al archivo de configuración JSON", - "Show help": "Muestra ayuda", - "Show version number": "Muestra número de versión", - "Did you mean %s?": "Quisiste decir %s?" -} diff --git a/node_modules/yargs/locales/fi.json b/node_modules/yargs/locales/fi.json deleted file mode 100644 index 0728c578453e1..0000000000000 --- a/node_modules/yargs/locales/fi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Komennot:", - "Options:": "Valinnat:", - "Examples:": "Esimerkkejä:", - "boolean": "totuusarvo", - "count": "lukumäärä", - "string": "merkkijono", - "number": "numero", - "array": "taulukko", - "required": "pakollinen", - "default": "oletusarvo", - "default:": "oletusarvo:", - "choices:": "vaihtoehdot:", - "aliases:": "aliakset:", - "generated-value": "generoitu-arvo", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s", - "other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s", - "other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s" - }, - "Missing argument value: %s": { - "one": "Argumentin arvo puuttuu: %s", - "other": "Argumentin arvot puuttuvat: %s" - }, - "Missing required argument: %s": { - "one": "Pakollinen argumentti puuttuu: %s", - "other": "Pakollisia argumentteja puuttuu: %s" - }, - "Unknown argument: %s": { - "one": "Tuntematon argumenttn: %s", - "other": "Tuntemattomia argumentteja: %s" - }, - "Invalid values:": "Virheelliset arvot:", - "Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s", - "Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s", - "Implications failed:": "Riippuvia argumentteja puuttuu:", - "Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s", - "Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s", - "Path to JSON config file": "JSON-asetustiedoston polku", - "Show help": "Näytä ohje", - "Show version number": "Näytä versionumero", - "Did you mean %s?": "Tarkoititko %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat", - "Positionals:": "Sijaintiparametrit:", - "command": "komento" -} diff --git a/node_modules/yargs/locales/fr.json b/node_modules/yargs/locales/fr.json deleted file mode 100644 index edd743f0c9420..0000000000000 --- a/node_modules/yargs/locales/fr.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Commands:": "Commandes :", - "Options:": "Options :", - "Examples:": "Exemples :", - "boolean": "booléen", - "count": "compteur", - "string": "chaîne de caractères", - "number": "nombre", - "array": "tableau", - "required": "requis", - "default": "défaut", - "default:": "défaut :", - "choices:": "choix :", - "aliases:": "alias :", - "generated-value": "valeur générée", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s", - "other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Trop d'arguments (hors options) : reçu %s, maximum de %s", - "other": "Trop d'arguments (hors options) : reçus %s, maximum de %s" - }, - "Missing argument value: %s": { - "one": "Argument manquant : %s", - "other": "Arguments manquants : %s" - }, - "Missing required argument: %s": { - "one": "Argument requis manquant : %s", - "other": "Arguments requis manquants : %s" - }, - "Unknown argument: %s": { - "one": "Argument inconnu : %s", - "other": "Arguments inconnus : %s" - }, - "Unknown command: %s": { - "one": "Commande inconnue : %s", - "other": "Commandes inconnues : %s" - }, - "Invalid values:": "Valeurs invalides :", - "Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s", - "Argument check failed: %s": "Echec de la vérification de l'argument : %s", - "Implications failed:": "Arguments dépendants manquants :", - "Not enough arguments following: %s": "Pas assez d'arguments après : %s", - "Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s", - "Path to JSON config file": "Chemin du fichier de configuration JSON", - "Show help": "Affiche l'aide", - "Show version number": "Affiche le numéro de version", - "Did you mean %s?": "Vouliez-vous dire %s ?", - "Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs", - "Positionals:": "Arguments positionnels :", - "command": "commande" -} diff --git a/node_modules/yargs/locales/hi.json b/node_modules/yargs/locales/hi.json deleted file mode 100644 index a9de77cce1546..0000000000000 --- a/node_modules/yargs/locales/hi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "आदेश:", - "Options:": "विकल्प:", - "Examples:": "उदाहरण:", - "boolean": "सत्यता", - "count": "संख्या", - "string": "वर्णों का तार ", - "number": "अंक", - "array": "सरणी", - "required": "आवश्यक", - "default": "डिफॉल्ट", - "default:": "डिफॉल्ट:", - "choices:": "विकल्प:", - "aliases:": "उपनाम:", - "generated-value": "उत्पन्न-मूल्य", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है", - "other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य", - "other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य" - }, - "Missing argument value: %s": { - "one": "कुछ तर्को के मूल्य गुम हैं: %s", - "other": "कुछ तर्को के मूल्य गुम हैं: %s" - }, - "Missing required argument: %s": { - "one": "आवश्यक तर्क गुम हैं: %s", - "other": "आवश्यक तर्क गुम हैं: %s" - }, - "Unknown argument: %s": { - "one": "अज्ञात तर्क प्राप्त: %s", - "other": "अज्ञात तर्क प्राप्त: %s" - }, - "Invalid values:": "अमान्य मूल्य:", - "Argument: %s, Given: %s, Choices: %s": "तर्क: %s, प्राप्त: %s, विकल्प: %s", - "Argument check failed: %s": "तर्क जांच विफल: %s", - "Implications failed:": "दिए गए तर्क के लिए अतिरिक्त तर्क की अपेक्षा है:", - "Not enough arguments following: %s": "निम्नलिखित के बाद पर्याप्त तर्क नहीं प्राप्त: %s", - "Invalid JSON config file: %s": "अमान्य JSON config फाइल: %s", - "Path to JSON config file": "JSON config फाइल का पथ", - "Show help": "सहायता दिखाएँ", - "Show version number": "Version संख्या दिखाएँ", - "Did you mean %s?": "क्या आपका मतलब है %s?", - "Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं", - "Positionals:": "स्थानीय:", - "command": "आदेश" -} diff --git a/node_modules/yargs/locales/hu.json b/node_modules/yargs/locales/hu.json deleted file mode 100644 index 21492d05a7c84..0000000000000 --- a/node_modules/yargs/locales/hu.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Parancsok:", - "Options:": "Opciók:", - "Examples:": "Példák:", - "boolean": "boolean", - "count": "számláló", - "string": "szöveg", - "number": "szám", - "array": "tömb", - "required": "kötelező", - "default": "alapértelmezett", - "default:": "alapértelmezett:", - "choices:": "lehetőségek:", - "aliases:": "aliaszok:", - "generated-value": "generált-érték", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell", - "other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet", - "other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet" - }, - "Missing argument value: %s": { - "one": "Hiányzó argumentum érték: %s", - "other": "Hiányzó argumentum értékek: %s" - }, - "Missing required argument: %s": { - "one": "Hiányzó kötelező argumentum: %s", - "other": "Hiányzó kötelező argumentumok: %s" - }, - "Unknown argument: %s": { - "one": "Ismeretlen argumentum: %s", - "other": "Ismeretlen argumentumok: %s" - }, - "Invalid values:": "Érvénytelen érték:", - "Argument: %s, Given: %s, Choices: %s": "Argumentum: %s, Megadott: %s, Lehetőségek: %s", - "Argument check failed: %s": "Argumentum ellenőrzés sikertelen: %s", - "Implications failed:": "Implikációk sikertelenek:", - "Not enough arguments following: %s": "Nem elég argumentum követi: %s", - "Invalid JSON config file: %s": "Érvénytelen JSON konfigurációs file: %s", - "Path to JSON config file": "JSON konfigurációs file helye", - "Show help": "Súgo megjelenítése", - "Show version number": "Verziószám megjelenítése", - "Did you mean %s?": "Erre gondoltál %s?" -} diff --git a/node_modules/yargs/locales/id.json b/node_modules/yargs/locales/id.json deleted file mode 100644 index 125867cbb0eed..0000000000000 --- a/node_modules/yargs/locales/id.json +++ /dev/null @@ -1,50 +0,0 @@ - -{ - "Commands:": "Perintah:", - "Options:": "Pilihan:", - "Examples:": "Contoh:", - "boolean": "boolean", - "count": "jumlah", - "number": "nomor", - "string": "string", - "array": "larik", - "required": "diperlukan", - "default": "bawaan", - "default:": "bawaan:", - "aliases:": "istilah lain:", - "choices:": "pilihan:", - "generated-value": "nilai-yang-dihasilkan", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumen wajib kurang: hanya %s, minimal %s", - "other": "Argumen wajib kurang: hanya %s, minimal %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Terlalu banyak argumen wajib: ada %s, maksimal %s", - "other": "Terlalu banyak argumen wajib: ada %s, maksimal %s" - }, - "Missing argument value: %s": { - "one": "Kurang argumen: %s", - "other": "Kurang argumen: %s" - }, - "Missing required argument: %s": { - "one": "Kurang argumen wajib: %s", - "other": "Kurang argumen wajib: %s" - }, - "Unknown argument: %s": { - "one": "Argumen tak diketahui: %s", - "other": "Argumen tak diketahui: %s" - }, - "Invalid values:": "Nilai-nilai tidak valid:", - "Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s", - "Argument check failed: %s": "Pemeriksaan argument gagal: %s", - "Implications failed:": "Implikasi gagal:", - "Not enough arguments following: %s": "Kurang argumen untuk: %s", - "Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s", - "Path to JSON config file": "Alamat berkas konfigurasi JSON", - "Show help": "Lihat bantuan", - "Show version number": "Lihat nomor versi", - "Did you mean %s?": "Maksud Anda: %s?", - "Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif", - "Positionals:": "Posisional-posisional:", - "command": "perintah" -} diff --git a/node_modules/yargs/locales/it.json b/node_modules/yargs/locales/it.json deleted file mode 100644 index fde575618817a..0000000000000 --- a/node_modules/yargs/locales/it.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandi:", - "Options:": "Opzioni:", - "Examples:": "Esempi:", - "boolean": "booleano", - "count": "contatore", - "string": "stringa", - "number": "numero", - "array": "vettore", - "required": "richiesto", - "default": "predefinito", - "default:": "predefinito:", - "choices:": "scelte:", - "aliases:": "alias:", - "generated-value": "valore generato", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s", - "other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s", - "other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s" - }, - "Missing argument value: %s": { - "one": "Argomento mancante: %s", - "other": "Argomenti mancanti: %s" - }, - "Missing required argument: %s": { - "one": "Argomento richiesto mancante: %s", - "other": "Argomenti richiesti mancanti: %s" - }, - "Unknown argument: %s": { - "one": "Argomento sconosciuto: %s", - "other": "Argomenti sconosciuti: %s" - }, - "Invalid values:": "Valori non validi:", - "Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s", - "Argument check failed: %s": "Controllo dell'argomento fallito: %s", - "Implications failed:": "Argomenti dipendenti mancanti:", - "Not enough arguments following: %s": "Argomenti insufficienti dopo: %s", - "Invalid JSON config file: %s": "File di configurazione JSON non valido: %s", - "Path to JSON config file": "Percorso del file di configurazione JSON", - "Show help": "Mostra la schermata di aiuto", - "Show version number": "Mostra il numero di versione", - "Did you mean %s?": "Intendi forse %s?" -} diff --git a/node_modules/yargs/locales/ja.json b/node_modules/yargs/locales/ja.json deleted file mode 100644 index 3954ae68f895c..0000000000000 --- a/node_modules/yargs/locales/ja.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "コマンド:", - "Options:": "オプション:", - "Examples:": "例:", - "boolean": "真偽", - "count": "カウント", - "string": "文字列", - "number": "数値", - "array": "配列", - "required": "必須", - "default": "デフォルト", - "default:": "デフォルト:", - "choices:": "選択してください:", - "aliases:": "エイリアス:", - "generated-value": "生成された値", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:", - "other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:", - "other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:" - }, - "Missing argument value: %s": { - "one": "引数の値が見つかりません: %s", - "other": "引数の値が見つかりません: %s" - }, - "Missing required argument: %s": { - "one": "必須の引数が見つかりません: %s", - "other": "必須の引数が見つかりません: %s" - }, - "Unknown argument: %s": { - "one": "未知の引数です: %s", - "other": "未知の引数です: %s" - }, - "Invalid values:": "不正な値です:", - "Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s", - "Argument check failed: %s": "引数のチェックに失敗しました: %s", - "Implications failed:": "オプションの組み合わせで不正が生じました:", - "Not enough arguments following: %s": "次の引数が不足しています。: %s", - "Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s", - "Path to JSON config file": "JSONの設定ファイルまでのpath", - "Show help": "ヘルプを表示", - "Show version number": "バージョンを表示", - "Did you mean %s?": "もしかして %s?", - "Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません", - "Positionals:": "位置:", - "command": "コマンド", - "deprecated": "非推奨", - "deprecated: %s": "非推奨: %s" -} diff --git a/node_modules/yargs/locales/ko.json b/node_modules/yargs/locales/ko.json deleted file mode 100644 index e3187eafd8940..0000000000000 --- a/node_modules/yargs/locales/ko.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "명령:", - "Options:": "옵션:", - "Examples:": "예시:", - "boolean": "여부", - "count": "개수", - "string": "문자열", - "number": "숫자", - "array": "배열", - "required": "필수", - "default": "기본", - "default:": "기본:", - "choices:": "선택:", - "aliases:": "별칭:", - "generated-value": "생성된 값", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다", - "other": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다", - "other": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다" - }, - "Missing argument value: %s": { - "one": "인자값을 받지 못했습니다: %s", - "other": "인자값들을 받지 못했습니다: %s" - }, - "Missing required argument: %s": { - "one": "필수 인자를 받지 못했습니다: %s", - "other": "필수 인자들을 받지 못했습니다: %s" - }, - "Unknown argument: %s": { - "one": "알 수 없는 인자입니다: %s", - "other": "알 수 없는 인자들입니다: %s" - }, - "Invalid values:": "잘못된 값입니다:", - "Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s", - "Argument check failed: %s": "유효하지 않은 인자입니다: %s", - "Implications failed:": "옵션의 조합이 잘못되었습니다:", - "Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s", - "Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s", - "Path to JSON config file": "JSON 설정파일 경로", - "Show help": "도움말을 보여줍니다", - "Show version number": "버전 넘버를 보여줍니다", - "Did you mean %s?": "찾고계신게 %s입니까?", - "Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다", - "Positionals:": "위치:", - "command": "명령" -} diff --git a/node_modules/yargs/locales/nb.json b/node_modules/yargs/locales/nb.json deleted file mode 100644 index 6f410ed09d052..0000000000000 --- a/node_modules/yargs/locales/nb.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoer:", - "Options:": "Alternativer:", - "Examples:": "Eksempler:", - "boolean": "boolsk", - "count": "antall", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "valg:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s", - "other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s", - "other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Mangler argument verdi: %s", - "other": "Mangler argument verdier: %s" - }, - "Missing required argument: %s": { - "one": "Mangler obligatorisk argument: %s", - "other": "Mangler obligatoriske argumenter: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjente argumenter: %s" - }, - "Invalid values:": "Ugyldige verdier:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s", - "Argument check failed: %s": "Argumentsjekk mislyktes: %s", - "Implications failed:": "Konsekvensene mislyktes:", - "Not enough arguments following: %s": "Ikke nok følgende argumenter: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/nl.json b/node_modules/yargs/locales/nl.json deleted file mode 100644 index 9ff95c5594cb5..0000000000000 --- a/node_modules/yargs/locales/nl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Commando's:", - "Options:": "Opties:", - "Examples:": "Voorbeelden:", - "boolean": "booleaans", - "count": "aantal", - "string": "string", - "number": "getal", - "array": "lijst", - "required": "verplicht", - "default": "standaard", - "default:": "standaard:", - "choices:": "keuzes:", - "aliases:": "aliassen:", - "generated-value": "gegenereerde waarde", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig", - "other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s", - "other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s" - }, - "Missing argument value: %s": { - "one": "Missende argumentwaarde: %s", - "other": "Missende argumentwaarden: %s" - }, - "Missing required argument: %s": { - "one": "Missend verplicht argument: %s", - "other": "Missende verplichte argumenten: %s" - }, - "Unknown argument: %s": { - "one": "Onbekend argument: %s", - "other": "Onbekende argumenten: %s" - }, - "Invalid values:": "Ongeldige waarden:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s", - "Argument check failed: %s": "Argumentcontrole mislukt: %s", - "Implications failed:": "Ontbrekende afhankelijke argumenten:", - "Not enough arguments following: %s": "Niet genoeg argumenten na: %s", - "Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s", - "Path to JSON config file": "Pad naar JSON-config-bestand", - "Show help": "Toon help", - "Show version number": "Toon versienummer", - "Did you mean %s?": "Bedoelde u misschien %s?", - "Arguments %s and %s are mutually exclusive": "Argumenten %s en %s kunnen niet tegelijk gebruikt worden", - "Positionals:": "Positie-afhankelijke argumenten", - "command": "commando" -} diff --git a/node_modules/yargs/locales/nn.json b/node_modules/yargs/locales/nn.json deleted file mode 100644 index 24479ac946cea..0000000000000 --- a/node_modules/yargs/locales/nn.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoar:", - "Options:": "Alternativ:", - "Examples:": "Døme:", - "boolean": "boolsk", - "count": "mengd", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "val:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s", - "other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s", - "other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Manglar argumentverdi: %s", - "other": "Manglar argumentverdiar: %s" - }, - "Missing required argument: %s": { - "one": "Manglar obligatorisk argument: %s", - "other": "Manglar obligatoriske argument: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjende argument: %s" - }, - "Invalid values:": "Ugyldige verdiar:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gjeve: %s, Val: %s", - "Argument check failed: %s": "Argumentsjekk mislukkast: %s", - "Implications failed:": "Konsekvensane mislukkast:", - "Not enough arguments following: %s": "Ikkje nok fylgjande argument: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/pirate.json b/node_modules/yargs/locales/pirate.json deleted file mode 100644 index dcb5cb75377d7..0000000000000 --- a/node_modules/yargs/locales/pirate.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Commands:": "Choose yer command:", - "Options:": "Options for me hearties!", - "Examples:": "Ex. marks the spot:", - "required": "requi-yar-ed", - "Missing required argument: %s": { - "one": "Ye be havin' to set the followin' argument land lubber: %s", - "other": "Ye be havin' to set the followin' arguments land lubber: %s" - }, - "Show help": "Parlay this here code of conduct", - "Show version number": "'Tis the version ye be askin' fer", - "Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench" -} diff --git a/node_modules/yargs/locales/pl.json b/node_modules/yargs/locales/pl.json deleted file mode 100644 index a41d4bd50f5b1..0000000000000 --- a/node_modules/yargs/locales/pl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Polecenia:", - "Options:": "Opcje:", - "Examples:": "Przykłady:", - "boolean": "boolean", - "count": "ilość", - "string": "ciąg znaków", - "number": "liczba", - "array": "tablica", - "required": "wymagany", - "default": "domyślny", - "default:": "domyślny:", - "choices:": "dostępne:", - "aliases:": "aliasy:", - "generated-value": "wygenerowana-wartość", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s", - "other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s", - "other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s" - }, - "Missing argument value: %s": { - "one": "Brak wartości dla argumentu: %s", - "other": "Brak wartości dla argumentów: %s" - }, - "Missing required argument: %s": { - "one": "Brak wymaganego argumentu: %s", - "other": "Brak wymaganych argumentów: %s" - }, - "Unknown argument: %s": { - "one": "Nieznany argument: %s", - "other": "Nieznane argumenty: %s" - }, - "Invalid values:": "Nieprawidłowe wartości:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s", - "Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s", - "Implications failed:": "Założenia nie zostały spełnione:", - "Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s", - "Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s", - "Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON", - "Show help": "Pokaż pomoc", - "Show version number": "Pokaż numer wersji", - "Did you mean %s?": "Czy chodziło Ci o %s?", - "Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają", - "Positionals:": "Pozycyjne:", - "command": "polecenie" -} diff --git a/node_modules/yargs/locales/pt.json b/node_modules/yargs/locales/pt.json deleted file mode 100644 index 0c8ac99c82f4a..0000000000000 --- a/node_modules/yargs/locales/pt.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "boolean", - "count": "contagem", - "string": "cadeia de caracteres", - "number": "número", - "array": "arranjo", - "required": "requerido", - "default": "padrão", - "default:": "padrão:", - "choices:": "escolhas:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s", - "other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s", - "Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s", - "Path to JSON config file": "Caminho para o arquivo de configuração em JSON", - "Show help": "Mostra ajuda", - "Show version number": "Mostra número de versão", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos" -} diff --git a/node_modules/yargs/locales/pt_BR.json b/node_modules/yargs/locales/pt_BR.json deleted file mode 100644 index eae1ec60d2bde..0000000000000 --- a/node_modules/yargs/locales/pt_BR.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "booleano", - "count": "contagem", - "string": "string", - "number": "número", - "array": "array", - "required": "obrigatório", - "default:": "padrão:", - "choices:": "opções:", - "aliases:": "sinônimos:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos: recebido %s, máximo de %s", - "other": "Excesso de argumentos: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s", - "Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s", - "Path to JSON config file": "Caminho para o arquivo JSON de configuração", - "Show help": "Exibe ajuda", - "Show version number": "Exibe a versão", - "Did you mean %s?": "Você quis dizer %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos", - "Positionals:": "Posicionais:", - "command": "comando" -} diff --git a/node_modules/yargs/locales/ru.json b/node_modules/yargs/locales/ru.json deleted file mode 100644 index 5f7f76810e9ba..0000000000000 --- a/node_modules/yargs/locales/ru.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Команды:", - "Options:": "Опции:", - "Examples:": "Примеры:", - "boolean": "булевый тип", - "count": "подсчет", - "string": "строковой тип", - "number": "число", - "array": "массив", - "required": "необходимо", - "default": "по умолчанию", - "default:": "по умолчанию:", - "choices:": "возможности:", - "aliases:": "алиасы:", - "generated-value": "генерированное значение", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s", - "other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s", - "other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s" - }, - "Missing argument value: %s": { - "one": "Не хватает значения аргумента: %s", - "other": "Не хватает значений аргументов: %s" - }, - "Missing required argument: %s": { - "one": "Не хватает необходимого аргумента: %s", - "other": "Не хватает необходимых аргументов: %s" - }, - "Unknown argument: %s": { - "one": "Неизвестный аргумент: %s", - "other": "Неизвестные аргументы: %s" - }, - "Invalid values:": "Недействительные значения:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s", - "Argument check failed: %s": "Проверка аргументов не удалась: %s", - "Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:", - "Not enough arguments following: %s": "Недостаточно следующих аргументов: %s", - "Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s", - "Path to JSON config file": "Путь к файлу конфигурации JSON", - "Show help": "Показать помощь", - "Show version number": "Показать номер версии", - "Did you mean %s?": "Вы имели в виду %s?" -} diff --git a/node_modules/yargs/locales/th.json b/node_modules/yargs/locales/th.json deleted file mode 100644 index 33b048e2a9275..0000000000000 --- a/node_modules/yargs/locales/th.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "คอมมาน", - "Options:": "ออฟชั่น", - "Examples:": "ตัวอย่าง", - "boolean": "บูลีน", - "count": "นับ", - "string": "สตริง", - "number": "ตัวเลข", - "array": "อาเรย์", - "required": "จำเป็น", - "default": "ค่าเริ่มต้", - "default:": "ค่าเริ่มต้น", - "choices:": "ตัวเลือก", - "aliases:": "เอเลียส", - "generated-value": "ค่าที่ถูกสร้างขึ้น", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า", - "other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า", - "other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า" - }, - "Missing argument value: %s": { - "one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s", - "other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s" - }, - "Missing required argument: %s": { - "one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s", - "other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s" - }, - "Unknown argument: %s": { - "one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s", - "other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s" - }, - "Invalid values:": "ค่าไม่ถูกต้อง:", - "Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s", - "Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s", - "Implications failed:": "Implications ไม่สำเร็จ:", - "Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s", - "Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s", - "Path to JSON config file": "พาทไฟล์คอนฟิค JSON", - "Show help": "ขอความช่วยเหลือ", - "Show version number": "แสดงตัวเลขเวอร์ชั่น", - "Did you mean %s?": "คุณหมายถึง %s?" -} diff --git a/node_modules/yargs/locales/tr.json b/node_modules/yargs/locales/tr.json deleted file mode 100644 index 0d0d2ccd8fa58..0000000000000 --- a/node_modules/yargs/locales/tr.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Komutlar:", - "Options:": "Seçenekler:", - "Examples:": "Örnekler:", - "boolean": "boolean", - "count": "sayı", - "string": "string", - "number": "numara", - "array": "array", - "required": "zorunlu", - "default": "varsayılan", - "default:": "varsayılan:", - "choices:": "seçimler:", - "aliases:": "takma adlar:", - "generated-value": "oluşturulan-değer", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli", - "other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s", - "other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s" - }, - "Missing argument value: %s": { - "one": "Eksik argüman değeri: %s", - "other": "Eksik argüman değerleri: %s" - }, - "Missing required argument: %s": { - "one": "Eksik zorunlu argüman: %s", - "other": "Eksik zorunlu argümanlar: %s" - }, - "Unknown argument: %s": { - "one": "Bilinmeyen argüman: %s", - "other": "Bilinmeyen argümanlar: %s" - }, - "Invalid values:": "Geçersiz değerler:", - "Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s", - "Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s", - "Implications failed:": "Sonuçlar başarısız oldu:", - "Not enough arguments following: %s": "%s için yeterli argüman bulunamadı", - "Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s", - "Path to JSON config file": "JSON yapılandırma dosya konumu", - "Show help": "Yardım detaylarını göster", - "Show version number": "Versiyon detaylarını göster", - "Did you mean %s?": "Bunu mu demek istediniz: %s?", - "Positionals:": "Sıralılar:", - "command": "komut" -} diff --git a/node_modules/yargs/locales/zh_CN.json b/node_modules/yargs/locales/zh_CN.json deleted file mode 100644 index 257d26babccd7..0000000000000 --- a/node_modules/yargs/locales/zh_CN.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "选项:", - "Examples:": "示例:", - "boolean": "布尔", - "count": "计数", - "string": "字符串", - "number": "数字", - "array": "数组", - "required": "必需", - "default": "默认值", - "default:": "默认值:", - "choices:": "可选值:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个", - "other": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个", - "other": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个" - }, - "Missing argument value: %s": { - "one": "没有给此选项指定值:%s", - "other": "没有给这些选项指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必须的选项:%s", - "other": "缺少这些必须的选项:%s" - }, - "Unknown argument: %s": { - "one": "无法识别的选项:%s", - "other": "无法识别这些选项:%s" - }, - "Invalid values:": "无效的选项值:", - "Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s", - "Argument check failed: %s": "选项值验证失败:%s", - "Implications failed:": "缺少依赖的选项:", - "Not enough arguments following: %s": "没有提供足够的值给此选项:%s", - "Invalid JSON config file: %s": "无效的 JSON 配置文件:%s", - "Path to JSON config file": "JSON 配置文件的路径", - "Show help": "显示帮助信息", - "Show version number": "显示版本号", - "Did you mean %s?": "是指 %s?", - "Arguments %s and %s are mutually exclusive" : "选项 %s 和 %s 是互斥的", - "Positionals:": "位置:", - "command": "命令" -} diff --git a/node_modules/yargs/locales/zh_TW.json b/node_modules/yargs/locales/zh_TW.json deleted file mode 100644 index e3c7bcf4e3944..0000000000000 --- a/node_modules/yargs/locales/zh_TW.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "選項:", - "Examples:": "例:", - "boolean": "布林", - "count": "次數", - "string": "字串", - "number": "數字", - "array": "陣列", - "required": "必須", - "default": "預設值", - "default:": "預設值:", - "choices:": "可選值:", - "aliases:": "別名:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個", - "other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個", - "other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個" - }, - "Missing argument value: %s": { - "one": "此引數無指定值:%s", - "other": "這些引數無指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必須的引數:%s", - "other": "缺少這些必須的引數:%s" - }, - "Unknown argument: %s": { - "one": "未知的引數:%s", - "other": "未知的這些引數:%s" - }, - "Invalid values:": "無效的選項值:", - "Argument: %s, Given: %s, Choices: %s": "引數名稱: %s, 傳入的值: %s, 可選的值:%s", - "Argument check failed: %s": "引數驗證失敗:%s", - "Implications failed:": "缺少依賴的選項:", - "Not enough arguments following: %s": "沒有提供足夠的值給此引數:%s", - "Invalid JSON config file: %s": "無效的 JSON 設置文件:%s", - "Path to JSON config file": "JSON 設置文件的路徑", - "Show help": "顯示說明", - "Show version number": "顯示版本", - "Did you mean %s?": "是指 %s?", - "Arguments %s and %s are mutually exclusive" : "引數 %s 和 %s 是互斥的" -} diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json deleted file mode 100644 index dc3018aee4cff..0000000000000 --- a/node_modules/yargs/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "yargs", - "version": "15.4.1", - "description": "yargs the modern, pirate-themed, successor to optimist.", - "main": "./index.js", - "contributors": [ - { - "name": "Yargs Contributors", - "url": "https://github.com/yargs/yargs/graphs/contributors" - } - ], - "files": [ - "index.js", - "yargs.js", - "build", - "locales", - "LICENSE" - ], - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "devDependencies": { - "@types/chai": "^4.2.11", - "@types/decamelize": "^1.2.0", - "@types/mocha": "^7.0.2", - "@types/node": "^10.0.3", - "@typescript-eslint/eslint-plugin": "^3.0.0", - "@typescript-eslint/parser": "^3.0.0", - "c8": "^7.0.0", - "chai": "^4.2.0", - "chalk": "^4.0.0", - "coveralls": "^3.0.9", - "cpr": "^3.0.1", - "cross-spawn": "^7.0.0", - "es6-promise": "^4.2.5", - "eslint": "^6.8.0", - "eslint-plugin-import": "^2.20.1", - "eslint-plugin-node": "^11.0.0", - "gts": "^2.0.0-alpha.4", - "hashish": "0.0.4", - "mocha": "^7.0.0", - "rimraf": "^3.0.2", - "standardx": "^5.0.0", - "typescript": "^3.7.0", - "which": "^2.0.0", - "yargs-test-extends": "^1.0.1" - }, - "scripts": { - "fix": "standardx --fix && standardx --fix **/*.ts", - "posttest": "npm run check", - "test": "c8 mocha --require ./test/before.js --timeout=12000 --check-leaks", - "coverage": "c8 report --check-coverage", - "check": "standardx && standardx **/*.ts", - "compile": "rimraf build && tsc", - "prepare": "npm run compile", - "pretest": "npm run compile -- -p tsconfig.test.json" - }, - "repository": { - "type": "git", - "url": "https://github.com/yargs/yargs.git" - }, - "homepage": "https://yargs.js.org/", - "standardx": { - "ignore": [ - "build", - "**/example/**" - ] - }, - "keywords": [ - "argument", - "args", - "option", - "parser", - "parsing", - "cli", - "command" - ], - "license": "MIT", - "engines": { - "node": ">=8" - } -} diff --git a/node_modules/yargs/yargs.js b/node_modules/yargs/yargs.js deleted file mode 100644 index 93e8059ef75f5..0000000000000 --- a/node_modules/yargs/yargs.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict' - -// an async function fails early in Node.js versions prior to 8. -async function requiresNode8OrGreater () {} -requiresNode8OrGreater() - -const { Yargs, rebase } = require('./build/lib/yargs') -const Parser = require('yargs-parser') - -exports = module.exports = Yargs -exports.rebase = rebase - -// allow consumers to directly use the version of yargs-parser used by yargs -exports.Parser = Parser