~royston/codsen

bea9ec0741865a747c8d0231dd079b1fca290c4a — Roy Revelt 18 days ago c64fe2d
chore: build the latest
220 files changed, 4804 insertions(+), 20270 deletions(-)

M .eslintrc.json
M package.json
M packages/.lectrc.json
M packages/array-includes-with-glob/package.json
M packages/array-of-arrays-into-ast/README.md
M packages/array-of-arrays-into-ast/rollup.config.js
M packages/arrayiffy-if-string/src/main.ts
M packages/ast-deep-contains/test/test.js
M packages/ast-monkey-traverse/dist/ast-monkey-traverse.cjs.js
M packages/ast-monkey-traverse/dist/ast-monkey-traverse.dev.umd.js
M packages/ast-monkey-traverse/dist/ast-monkey-traverse.esm.js
M packages/ast-monkey-traverse/dist/ast-monkey-traverse.mjs
M packages/ast-monkey-traverse/dist/ast-monkey-traverse.umd.js
M packages/ast-monkey-traverse/examples/_quickTake.js
M packages/ast-monkey-traverse/examples/compatible-with-object-path.js
M packages/ast-monkey-traverse/examples/stopping.js
M packages/ast-monkey-traverse/package.json
M packages/ast-monkey-traverse/src/main.ts
M packages/ast-monkey-traverse/test/test.js
M packages/ast-monkey-traverse/types/main.d.ts
M packages/ast-monkey-util/examples/_quickTake.js
M packages/ast-monkey/coverage/coverage-summary.json
M packages/ast-monkey/dist/ast-monkey.cjs.js
M packages/ast-monkey/dist/ast-monkey.dev.umd.js
M packages/ast-monkey/dist/ast-monkey.esm.js
M packages/ast-monkey/dist/ast-monkey.mjs
M packages/ast-monkey/dist/ast-monkey.umd.js
M packages/ast-monkey/src/main.ts
M packages/ast-monkey/test/find.js
M packages/ast-monkey/types/main.d.ts
M packages/check-types-mini/README.md
M packages/check-types-mini/coverage/coverage-summary.json
M packages/check-types-mini/dist/check-types-mini.cjs.js
M packages/check-types-mini/dist/check-types-mini.dev.umd.js
M packages/check-types-mini/dist/check-types-mini.esm.js
M packages/check-types-mini/dist/check-types-mini.mjs
M packages/check-types-mini/dist/check-types-mini.umd.js
M packages/check-types-mini/package.json
M packages/check-types-mini/rollup.config.js
M packages/check-types-mini/src/main.ts
M packages/check-types-mini/types/main.d.ts
D packages/chlu-cli/.npmignore
D packages/chlu-cli/.prettierignore
D packages/chlu-cli/CHANGELOG.md
D packages/chlu-cli/README.md
D packages/chlu-cli/chlu_adds_missing_diff_links.gif
D packages/chlu-cli/cli.js
D packages/chlu-cli/coverage/coverage-summary.json
D packages/chlu-cli/feature1.gif
D packages/chlu-cli/media/0_idea.png
D packages/chlu-cli/media/features_comp.png
D packages/chlu-cli/media/features_comp.psd
D packages/chlu-cli/package.json
D packages/chlu-cli/test/test.js
D packages/chlu/.npmignore
D packages/chlu/.prettierignore
D packages/chlu/CHANGELOG.md
D packages/chlu/README.md
D packages/chlu/coverage/coverage-summary.json
D packages/chlu/dist/chlu.cjs.js
D packages/chlu/dist/chlu.dev.umd.js
D packages/chlu/dist/chlu.esm.js
D packages/chlu/dist/chlu.umd.js
D packages/chlu/examples/_quickTake.js
D packages/chlu/examples/api.json
D packages/chlu/package.json
D packages/chlu/perf/check.js
D packages/chlu/perf/historical.json
D packages/chlu/rollup.config.js
D packages/chlu/src/main.js
D packages/chlu/src/util.js
D packages/chlu/test/es5.js
D packages/chlu/test/fixtures/01_asc_order_wrong_package_changelog.expected.md
D packages/chlu/test/fixtures/01_asc_order_wrong_package_changelog.md
D packages/chlu/test/fixtures/01_asc_order_wrong_package_package.json
D packages/chlu/test/fixtures/02_asc_order_correct_package_changelog.expected.md
D packages/chlu/test/fixtures/02_asc_order_correct_package_changelog.md
D packages/chlu/test/fixtures/02_asc_order_correct_package_package.json
D packages/chlu/test/fixtures/03_no_footer_links_changelog.expected.md
D packages/chlu/test/fixtures/03_no_footer_links_changelog.md
D packages/chlu/test/fixtures/03_no_footer_links_package.json
D packages/chlu/test/fixtures/04_desc_order_wrong_package_changelog.expected.md
D packages/chlu/test/fixtures/04_desc_order_wrong_package_changelog.md
D packages/chlu/test/fixtures/04_desc_order_wrong_package_package.json
D packages/chlu/test/fixtures/05_desc_order_correct_package_changelog.expected.md
D packages/chlu/test/fixtures/05_desc_order_correct_package_changelog.md
D packages/chlu/test/fixtures/05_desc_order_correct_package_package.json
D packages/chlu/test/fixtures/06_not_linked_titles_changelog.expected.md
D packages/chlu/test/fixtures/06_not_linked_titles_changelog.md
D packages/chlu/test/fixtures/06_not_linked_titles_package.json
D packages/chlu/test/fixtures/07_gitlab_package_json_changelog.expected.md
D packages/chlu/test/fixtures/07_gitlab_package_json_changelog.md
D packages/chlu/test/fixtures/07_gitlab_package_json_package.json
D packages/chlu/test/fixtures/08_mid_links_missing_changelog.expected.md
D packages/chlu/test/fixtures/08_mid_links_missing_changelog.md
D packages/chlu/test/fixtures/08_mid_links_missing_package.json
D packages/chlu/test/fixtures/09_tight_spacing_changelog.expected.md
D packages/chlu/test/fixtures/09_tight_spacing_changelog.md
D packages/chlu/test/fixtures/09_tight_spacing_package.json
D packages/chlu/test/fixtures/10_redundant_links_changelog.expected.md
D packages/chlu/test/fixtures/10_redundant_links_changelog.md
D packages/chlu/test/fixtures/10_redundant_links_package.json
D packages/chlu/test/fixtures/11_wrong_dates_changelog.expected.md
D packages/chlu/test/fixtures/11_wrong_dates_changelog.md
D packages/chlu/test/fixtures/11_wrong_dates_package.json
D packages/chlu/test/fixtures/12_wrong_footer_link_versions_changelog.expected.md
D packages/chlu/test/fixtures/12_wrong_footer_link_versions_changelog.md
D packages/chlu/test/fixtures/12_wrong_footer_link_versions_package.json
D packages/chlu/test/fixtures/13_real_world_changelog.expected.md
D packages/chlu/test/fixtures/13_real_world_changelog.md
D packages/chlu/test/fixtures/13_real_world_package.json
D packages/chlu/test/fixtures/14_slashes_changelog.expected.md
D packages/chlu/test/fixtures/14_slashes_changelog.md
D packages/chlu/test/fixtures/14_slashes_package.json
D packages/chlu/test/fixtures/15_bad_date_changelog.expected.md
D packages/chlu/test/fixtures/15_bad_date_changelog.md
D packages/chlu/test/fixtures/15_bad_date_package.json
D packages/chlu/test/fixtures/16_git_tags_changelog.expected.md
D packages/chlu/test/fixtures/16_git_tags_changelog.md
D packages/chlu/test/fixtures/16_git_tags_package.json
D packages/chlu/test/fixtures/17_chlu_cli_changelog.expected.md
D packages/chlu/test/fixtures/17_chlu_cli_changelog.md
D packages/chlu/test/fixtures/17_chlu_cli_package.json
D packages/chlu/test/test-end2end.js
D packages/chlu/test/test-util.js
M packages/codsen-parser/package.json
M packages/codsen-tokenizer/package.json
M packages/csv-sort-cli/package.json
M packages/detect-is-it-html-or-xhtml/package.json
M packages/detergent/package.json
M packages/email-all-chars-within-ascii-cli/cli.js
M packages/email-all-chars-within-ascii-cli/package.json
M packages/email-comb/package.json
M packages/email-homey/.npmignore
M packages/email-homey/package.json
A packages/email-homey/rollup.config.js
A packages/email-homey/tsconfig.json
M packages/emlint/package.json
M packages/eslint-plugin-row-num/package.json
M packages/eslint-plugin-test-num/package.json
M packages/generate-atomic-css-cli/package.json
M packages/generate-atomic-css/package.json
M packages/gulp-email-remove-unused-css/package.json
M packages/helga/test/test.js
M packages/html-crush/package.json
M packages/html-entities-not-email-friendly/package.json
M packages/html-img-alt/examples/_quickTake.js
M packages/html-img-alt/package.json
M packages/html-table-patcher/package.json
M packages/js-row-num-cli/.npmignore
M packages/js-row-num-cli/cli.js
M packages/js-row-num-cli/package.json
A packages/js-row-num-cli/rollup.config.js
A packages/js-row-num-cli/tsconfig.json
M packages/json-comb-core/package.json
R packages/json-comb-core/src/{main.js => main.ts}
M packages/json-comb/package.json
M packages/json-sort-cli/package.json
M packages/lect/.npmignore
M packages/lect/README.md
M packages/lect/cli.js
M packages/lect/coverage/coverage-summary.json
M packages/lect/package.json
M packages/lect/src/examples.js
M packages/lect/src/npmIgnore.js
M packages/lect/src/pack.js
M packages/lect/src/rollupConfig.js
M packages/lerna-clean-changelogs-cli/package.json
M packages/lerna-clean-changelogs/examples/_quickTake.js
M packages/lerna-clean-changelogs/package.json
M packages/lerna-link-dep/package.json
M packages/object-no-new-keys/examples/_quickTake.js
M packages/object-no-new-keys/package.json
M packages/object-set-all-values-to/examples/_quickTake.js
M packages/object-set-all-values-to/package.json
M packages/ranges-push/dist/ranges-push.cjs.js
M packages/ranges-push/dist/ranges-push.dev.umd.js
M packages/ranges-push/dist/ranges-push.esm.js
M packages/ranges-push/dist/ranges-push.mjs
M packages/ranges-push/dist/ranges-push.umd.js
M packages/ranges-push/src/main.ts
M packages/ranges-push/types/main.d.ts
M packages/ranges-sort/src/main.ts
M packages/string-find-heads-tails/README.md
M packages/string-find-heads-tails/dist/string-find-heads-tails.dev.umd.js
M packages/string-find-heads-tails/dist/string-find-heads-tails.umd.js
M packages/string-find-heads-tails/package.json
M packages/string-left-right/src/main.ts
M packages/string-left-right/types/main.d.ts
M packages/string-match-left-right/README.md
M packages/string-match-left-right/dist/string-match-left-right.mjs
M packages/string-match-left-right/dist/string-match-left-right.umd.js
M packages/string-match-left-right/package.json
M packages/string-match-left-right/rollup.config.js
M packages/string-match-left-right/src/main.ts
M packages/string-match-left-right/test/cb.js
M packages/string-match-left-right/types/main.d.ts
M packages/string-process-comma-separated/package.json
M packages/string-process-comma-separated/src/main.ts
M packages/string-process-comma-separated/types/main.d.ts
M packages/string-remove-widows/.npmignore
M packages/string-remove-widows/README.md
M packages/string-remove-widows/coverage/coverage-summary.json
M packages/string-remove-widows/dist/string-remove-widows.cjs.js
M packages/string-remove-widows/dist/string-remove-widows.dev.umd.js
M packages/string-remove-widows/dist/string-remove-widows.esm.js
A packages/string-remove-widows/dist/string-remove-widows.mjs
M packages/string-remove-widows/dist/string-remove-widows.umd.js
M packages/string-remove-widows/examples/_quickTake.js
M packages/string-remove-widows/package.json
M packages/string-remove-widows/rollup.config.js
M packages/string-remove-widows/test/convertEntities.js
A packages/string-remove-widows/tsconfig.json
M packages/stristri/examples/_quickTake.js
M packages/stristri/package.json
M packages/test-mixer/src/main.ts
M packages/update-versions/package.json
M packages/util-nonempty/examples/_quickTake.js
A scripts/common.ts
A scripts/list-ts.js
M .eslintrc.json => .eslintrc.json +10 -33
@@ 4,23 4,17 @@
    "node": true
  },
  "extends": [
    "airbnb/base",
    "eslint:recommended",
    "plugin:prettier/recommended",
    "plugin:import/errors",
    "plugin:import/warnings",
    "plugin:row-num/recommended",
    "plugin:test-num/recommended"
    "plugin:@typescript-eslint/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 11,
    "sourceType": "module"
  },
  "plugins": ["row-num", "test-num"],
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "ignorePatterns": [
    "**/eslint-plugin-row-num/rules/utils/**",
    "**/dist/**",
    "**/tap/**"
    "**/tap/**",
    "**/types/**"
  ],
  "rules": {
    "array-callback-return": 0,


@@ 32,7 26,6 @@
        "checkLoops": false
      }
    ],
    "import/prefer-default-export": 0,
    "no-bitwise": 0,
    "no-else-return": "error",
    "no-inner-declarations": "error",


@@ 42,34 35,15 @@
    "no-use-before-define": ["error", { "functions": false }],
    "no-param-reassign": 0,
    "no-plusplus": 0,
    "import/no-extraneous-dependencies": [
      "error",
      {
        "devDependencies": [
          "**/rollup.config.js",
          "**/test/**",
          "**/t-util/**",
          "**/*test.js",
          "**/*.spec.js",
          "**/perf/**",
          "scripts/run-perf*.js"
        ]
      }
    ],
    "no-restricted-syntax": 0,
    "no-unneeded-ternary": "error",
    "no-useless-return": "error",
    "no-var": "error",
    "one-var": [
      "error",
      "never"
    ],
    "one-var": ["error", "never"],
    "prefer-arrow-callback": "error",
    "prefer-const": "error",
    "prefer-destructuring": 0,
    "prefer-template": "error",
    "row-num/correct-row-num": "error",
    "test-num/correct-test-num": "error",
    "strict": "error",
    "symbol-description": "error",
    "yoda": [


@@ 78,6 52,9 @@
      {
        "exceptRange": true
      }
    ]
    ],
    "@typescript-eslint/no-var-requires": 0,
    "@typescript-eslint/no-explicit-any": 0,
    "@typescript-eslint/no-empty-function": 0
  }
}

M package.json => package.json +4 -4
@@ 34,20 34,20 @@
    "test:only": "FORCE_COLOR=1 lerna run unittest --stream --concurrency 1 && npm run readme:generate && npm run info",
    "test:examples": "FORCE_COLOR=1 lerna run test:examples",
    "wipe": "rm package-lock.json || true && rm -rf node_modules && FORCE_COLOR=1 npx lerna clean -y",
    "graph": "lerna-dependency-graph -f 'png' -o './deps-graph.png'"
    "graph": "lerna-dependency-graph -f 'png' -o './deps-graph.png'",
    "todo": "node ./scripts/list-ts.js"
  },
  "browserslist": "> 0.25%, not dead",
  "dependencies": {},
  "devDependencies": {
    "@typescript-eslint/parser": "^4.11.0",
    "@typescript-eslint/eslint-plugin": "^4.11.0",
    "benchmark": "^2.1.4",
    "commitizen": "^4.2.2",
    "cz-conventional-changelog": "^3.3.0",
    "edit-package-json": "^0.2.3",
    "eslint": "^7.15.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-airbnb-base": "^14.2.1",
    "eslint-config-prettier": "^7.0.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-no-unsanitized": "^3.1.4",
    "eslint-plugin-prettier": "^3.3.0",
    "eslint-plugin-row-num": "^1.3.2",

M packages/.lectrc.json => packages/.lectrc.json +5 -4
@@ 184,8 184,9 @@
      "@rollup/plugin-typescript": "^8.1.0",
      "@types/node": "^13.13.4",
      "@types/tap": "^14.10.1",
      "@typescript-eslint/parser": "^4.11.0",
      "@typescript-eslint/eslint-plugin": "^4.11.0",
      "eslint": "^7.15.0",
      "fs-extra": "^9.0.1",
      "lect": "^0.15.1",
      "rollup": "^2.35.1",
      "rollup-plugin-ascii": "^0.0.3",


@@ 230,7 231,7 @@
      "devunittest": "npm run dev && ./node_modules/.bin/tap --only -R 'base' && npm run clean_cov",
      "format": "npm run lect && npm run prettier && npm run lint",
      "lect": "lect",
      "lint": "../../node_modules/eslint/bin/eslint.js \"**/*.js\" --fix --config \"../../.eslintrc.json\" --quiet",
      "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --fix --config \"../../.eslintrc.json\" --quiet",
      "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
      "republish": "npm publish || :",
      "tap": "tap",


@@ 245,7 246,7 @@
      "devunittest": "npm run dev && ./node_modules/.bin/tap --only -R 'base' && npm run tsd && npm run clean_cov",
      "format": "npm run lect && npm run prettier && npm run lint",
      "lect": "lect",
      "lint": "../../node_modules/eslint/bin/eslint.js \"**/*.js\" --fix --config \"../../.eslintrc.json\" --quiet",
      "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
      "perf": "node perf/check",
      "prepare": "npm run build",
      "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",


@@ 256,7 257,7 @@
      "pretest": "npm run build",
      "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
      "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
      "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && npm run tsd && npm run clean_cov && npm run perf",
      "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && tsc --noEmit && npm run tsd && npm run clean_cov && npm run perf",
      "version": "npm run build && git add .",
      "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
      "clean_types": "../../scripts/cleanTypes.js"

M packages/array-includes-with-glob/package.json => packages/array-includes-with-glob/package.json +1 -1
@@ 39,7 39,7 @@
    "devunittest": "npm run dev && ./node_modules/.bin/tap --only -R 'base' && npm run tsd && npm run clean_cov",
    "format": "npm run lect && npm run prettier && npm run lint",
    "lect": "lect",
    "lint": "../../node_modules/eslint/bin/eslint.js \"**/*.js\" --fix --config \"../../.eslintrc.json\" --quiet",
    "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
    "perf": "node perf/check",
    "prepare": "npm run build",
    "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",

M packages/array-of-arrays-into-ast/README.md => packages/array-of-arrays-into-ast/README.md +2 -0
@@ 61,4 61,6 @@ MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors


<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">


M packages/array-of-arrays-into-ast/rollup.config.js => packages/array-of-arrays-into-ast/rollup.config.js +1 -3
@@ 120,9 120,7 @@ export default (commandLineArgs) => {
    // CommonJS
    {
      input: "src/main.ts",
      output: [
        { dir: "./", entryFileNames: pkg.main, format: "cjs", indent: false },
      ],
      output: [{ dir: "./", entryFileNames: pkg.main, format: "cjs", indent: false }],
      external: makeExternalPredicate([
        ...Object.keys(pkg.dependencies || {}),
        ...Object.keys(pkg.peerDependencies || {}),

M packages/arrayiffy-if-string/src/main.ts => packages/arrayiffy-if-string/src/main.ts +4 -2
@@ 1,11 1,13 @@
/* eslint @typescript-eslint/explicit-module-boundary-types: 0 */

// If a non-empty string is given, put it into an array.
// If an empty string is given, return an empty array.
// Bypass everything else.

// type signature overloading
function arrayiffy(something: string): [string];
function arrayiffy(something: any): any;
function arrayiffy(something: string | any): [string] | any {
function arrayiffy(something: string): [];
function arrayiffy(something: any): any {
  if (typeof something === "string") {
    if (something.length) {
      return [something];

M packages/ast-deep-contains/test/test.js => packages/ast-deep-contains/test/test.js +1 -1
@@ 152,7 152,7 @@ tap.test(
  }
);

tap.only(
tap.test(
  `06 - ${`\u001b[${34}m${`basics`}\u001b[${39}m`} - arrays with objects, opts.skipContainers=on (default)`,
  (t) => {
    const gathered = [];

M packages/ast-monkey-traverse/dist/ast-monkey-traverse.cjs.js => packages/ast-monkey-traverse/dist/ast-monkey-traverse.cjs.js +1 -1
@@ 12,7 12,7 @@
Object.defineProperty(exports, '__esModule', { value: true });

var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
var clone = require('lodash.clone');
var clone = require('lodash.clonedeep');
var isObj = require('lodash.isplainobject');
var astMonkeyUtil = require('ast-monkey-util');


M packages/ast-monkey-traverse/dist/ast-monkey-traverse.dev.umd.js => packages/ast-monkey-traverse/dist/ast-monkey-traverse.dev.umd.js +15 -23
@@ 77,7 77,7 @@ function createCommonjsModule(fn) {
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
var lodash_clone = createCommonjsModule(function (module, exports) {
var lodash_clonedeep = createCommonjsModule(function (module, exports) {
  /** Used as the size to enable large array optimizations. */
  var LARGE_ARRAY_SIZE = 200;
  /** Used to stand-in for `undefined` hash values. */


@@ 1532,35 1532,27 @@ var lodash_clone = createCommonjsModule(function (module, exports) {
    return '';
  }
  /**
   * Creates a shallow clone of `value`.
   *
   * **Note:** This method is loosely based on the
   * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
   * and supports cloning arrays, array buffers, booleans, date objects, maps,
   * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
   * arrays. The own enumerable properties of `arguments` objects are cloned
   * as plain objects. An empty object is returned for uncloneable values such
   * as error objects, functions, DOM nodes, and WeakMaps.
   * This method is like `_.clone` except that it recursively clones `value`.
   *
   * @static
   * @memberOf _
   * @since 0.1.0
   * @since 1.0.0
   * @category Lang
   * @param {*} value The value to clone.
   * @returns {*} Returns the cloned value.
   * @see _.cloneDeep
   * @param {*} value The value to recursively clone.
   * @returns {*} Returns the deep cloned value.
   * @see _.clone
   * @example
   *
   * var objects = [{ 'a': 1 }, { 'b': 2 }];
   *
   * var shallow = _.clone(objects);
   * console.log(shallow[0] === objects[0]);
   * // => true
   * var deep = _.cloneDeep(objects);
   * console.log(deep[0] === objects[0]);
   * // => false
   */


  function clone(value) {
    return baseClone(value, false, true);
  function cloneDeep(value) {
    return baseClone(value, true, true);
  }
  /**
   * Performs a


@@ 1918,7 1910,7 @@ var lodash_clone = createCommonjsModule(function (module, exports) {
    return false;
  }

  module.exports = clone;
  module.exports = cloneDeep;
});

/**


@@ 2111,7 2103,7 @@ function traverse(tree1, cb1) {
  //

  function traverseInner(treeOriginal, callback, originalInnerObj, stop) {
    var tree = lodash_clone(treeOriginal);
    var tree = lodash_clonedeep(treeOriginal);
    var res;

    var innerObj = _objectSpread2({


@@ 2132,7 2124,7 @@ function traverse(tree1, cb1) {
        var path = innerObj.path ? innerObj.path + "." + i : "" + i;

        if (tree[i] !== undefined) {
          innerObj.parent = lodash_clone(tree);
          innerObj.parent = lodash_clonedeep(tree);
          innerObj.parentType = "array";
          innerObj.parentKey = parent(path); // innerObj.path = `${innerObj.path}[${i}]`



@@ 2166,7 2158,7 @@ function traverse(tree1, cb1) {
          innerObj.topmostKey = key;
        }

        innerObj.parent = lodash_clone(tree);
        innerObj.parent = lodash_clonedeep(tree);
        innerObj.parentType = "object";
        innerObj.parentKey = parent(_path);
        res = traverseInner(callback(key, tree[key], _objectSpread2(_objectSpread2({}, innerObj), {}, {

M packages/ast-monkey-traverse/dist/ast-monkey-traverse.esm.js => packages/ast-monkey-traverse/dist/ast-monkey-traverse.esm.js +3 -1
@@ 7,12 7,14 @@
 * Homepage: https://codsen.com/os/ast-monkey-traverse/
 */

import clone from 'lodash.clone';
import clone from 'lodash.clonedeep';
import isObj from 'lodash.isplainobject';
import { parent } from 'ast-monkey-util';

var version = "1.13.1";

/* eslint @typescript-eslint/explicit-module-boundary-types:0 */

function traverse(tree1, cb1) {
  const stop2 = {
    now: false

M packages/ast-monkey-traverse/dist/ast-monkey-traverse.mjs => packages/ast-monkey-traverse/dist/ast-monkey-traverse.mjs +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/ast-monkey-traverse/
 */

import t from"lodash.clone";import e from"lodash.isplainobject";import{parent as o}from"ast-monkey-util";var r="1.13.1";function n(r,n){return function r(n,p,a,i){const l=t(n);let h;const s={depth:-1,path:"",...a};if(s.depth+=1,Array.isArray(l))for(let e=0,n=l.length;n>e&&!i.now;e++){const n=s.path?`${s.path}.${e}`:""+e;void 0!==l[e]?(s.parent=t(l),s.parentType="array",s.parentKey=o(n),h=r(p(l[e],void 0,{...s,path:n},i),p,{...s,path:n},i),Number.isNaN(h)&&l.length>e?(l.splice(e,1),e-=1):l[e]=h):l.splice(e,1)}else if(e(l))for(const e in l){if(i.now&&null!=e)break;const n=s.path?`${s.path}.${e}`:e;0===s.depth&&null!=e&&(s.topmostKey=e),s.parent=t(l),s.parentType="object",s.parentKey=o(n),h=r(p(e,l[e],{...s,path:n},i),p,{...s,path:n},i),Number.isNaN(h)?delete l[e]:l[e]=h}return l}(r,n,{},{now:!1})}export{n as traverse,r as version};
import t from"lodash.clonedeep";import e from"lodash.isplainobject";import{parent as o}from"ast-monkey-util";var p="1.13.1";function r(p,r){return function p(r,n,a,i){const l=t(r);let h;const s={depth:-1,path:"",...a};if(s.depth+=1,Array.isArray(l))for(let e=0,r=l.length;r>e&&!i.now;e++){const r=s.path?`${s.path}.${e}`:""+e;void 0!==l[e]?(s.parent=t(l),s.parentType="array",s.parentKey=o(r),h=p(n(l[e],void 0,{...s,path:r},i),n,{...s,path:r},i),Number.isNaN(h)&&l.length>e?(l.splice(e,1),e-=1):l[e]=h):l.splice(e,1)}else if(e(l))for(const e in l){if(i.now&&null!=e)break;const r=s.path?`${s.path}.${e}`:e;0===s.depth&&null!=e&&(s.topmostKey=e),s.parent=t(l),s.parentType="object",s.parentKey=o(r),h=p(n(e,l[e],{...s,path:r},i),n,{...s,path:r},i),Number.isNaN(h)?delete l[e]:l[e]=h}return l}(p,r,{},{now:!1})}export{r as traverse,p as version};

M packages/ast-monkey-traverse/dist/ast-monkey-traverse.umd.js => packages/ast-monkey-traverse/dist/ast-monkey-traverse.umd.js +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/ast-monkey-traverse/
 */

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astMonkeyTraverse={})}(this,(function(t){"use strict";function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var n=1;arguments.length>n;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var c=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){var r="__lodash_hash_undefined__",n=9007199254740991,c="[object Arguments]",u="[object Boolean]",a="[object Date]",i="[object Function]",f="[object GeneratorFunction]",s="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",d="[object WeakMap]",j="[object ArrayBuffer]",g="[object DataView]",O="[object Float32Array]",w="[object Float64Array]",m="[object Int8Array]",A="[object Int16Array]",P="[object Int32Array]",x="[object Uint8Array]",S="[object Uint8ClampedArray]",T="[object Uint16Array]",E="[object Uint32Array]",k=/\w*$/,I=/^\[object .+?Constructor\]$/,$=/^(?:0|[1-9]\d*)$/,D={};D[c]=D["[object Array]"]=D[j]=D[g]=D[u]=D[a]=D[O]=D[w]=D[m]=D[A]=D[P]=D[s]=D[l]=D[p]=D[h]=D[b]=D[v]=D[_]=D[x]=D[S]=D[T]=D[E]=!0,D["[object Error]"]=D[i]=D[d]=!1;var F="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof o&&o&&o.Object===Object&&o||F||Function("return this")(),M=e&&!e.nodeType&&e,B=M&&t&&!t.nodeType&&t,U=B&&B.exports===M;function K(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,c=t?t.length:0;for(n&&c&&(r=t[++o]);++o<c;)r=e(r,t[o],o,t);return r}function C(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function L(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function V(t,e){return function(r){return t(e(r))}}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,q=Array.prototype,H=Function.prototype,J=Object.prototype,Q=N["__core-js_shared__"],X=(G=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Y=H.toString,Z=J.hasOwnProperty,tt=J.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=U?N.Buffer:void 0,nt=N.Symbol,ot=N.Uint8Array,ct=V(Object.getPrototypeOf,Object),ut=Object.create,at=J.propertyIsEnumerable,it=q.splice,ft=Object.getOwnPropertySymbols,st=rt?rt.isBuffer:void 0,lt=V(Object.keys,Object),pt=Bt(N,"DataView"),yt=Bt(N,"Map"),ht=Bt(N,"Promise"),bt=Bt(N,"Set"),vt=Bt(N,"WeakMap"),_t=Bt(Object,"create"),dt=Ct(pt),jt=Ct(yt),gt=Ct(ht),Ot=Ct(bt),wt=Ct(vt),mt=nt?nt.prototype:void 0,At=mt?mt.valueOf:void 0;function Pt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new xt(t)}function Et(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==c)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var u in t)!e&&!Z.call(t,u)||o&&("length"==u||Rt(u,n))||r.push(u);return r}function kt(t,e,r){var n=t[e];Z.call(t,e)&&Lt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function It(t,e){for(var r=t.length;r--;)if(Lt(t[r][0],e))return r;return-1}function $t(t,e,r,n,o,y,d){var I;if(n&&(I=y?n(t,o,y,d):n(t)),void 0!==I)return I;if(!Ht(t))return t;var $=Vt(t);if($){if(I=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,I)}else{var F=Kt(t),N=F==i||F==f;if(Gt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(F==p||F==c||N&&!y){if(C(t))return y?t:{};if(I=function(t){return"function"!=typeof t.constructor||zt(t)?{}:(e=ct(t),Ht(e)?ut(e):{});var e}(N?{}:t),!e)return function(t,e){return Nt(t,Ut(t),e)}(t,function(t,e){return t&&Nt(e,Jt(e),t)}(I,t))}else{if(!D[F])return y?t:{};I=function(t,e,r,n){var o=t.constructor;switch(e){case j:return Ft(t);case u:case a:return new o(+t);case g:return function(t,e){var r=e?Ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case O:case w:case m:case A:case P:case x:case S:case T:case E:return function(t,e){var r=e?Ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case s:return function(t,e,r){return z(e?r(L(t),!0):L(t),K,new t.constructor)}(t,n,r);case l:case v:return new o(t);case h:return function(t){var e=new t.constructor(t.source,k.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return function(t,e,r){return z(e?r(W(t),!0):W(t),R,new t.constructor)}(t,n,r);case _:return c=t,At?Object(At.call(c)):{}}var c}(t,F,$t,e)}}d||(d=new Tt);var M=d.get(t);if(M)return M;if(d.set(t,I),!$)var B=r?function(t){return function(t,e,r){var n=e(t);return Vt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Jt,Ut)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(B||t,(function(o,c){B&&(o=t[c=o]),kt(I,c,$t(o,e,r,n,c,t,d))})),I}function Dt(t){return!(!Ht(t)||(e=t,X&&X in e))&&(qt(t)||C(t)?et:I).test(Ct(t));var e}function Ft(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Nt(t,e,r,n){r||(r={});for(var o=-1,c=e.length;++o<c;){var u=e[o],a=n?n(r[u],t[u],u,r,t):void 0;kt(r,u,void 0===a?t[u]:a)}return r}function Mt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Bt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Dt(r)?r:void 0}Pt.prototype.clear=function(){this.__data__=_t?_t(null):{}},Pt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Pt.prototype.get=function(t){var e=this.__data__;if(_t){var n=e[t];return n===r?void 0:n}return Z.call(e,t)?e[t]:void 0},Pt.prototype.has=function(t){var e=this.__data__;return _t?void 0!==e[t]:Z.call(e,t)},Pt.prototype.set=function(t,e){return this.__data__[t]=_t&&void 0===e?r:e,this},xt.prototype.clear=function(){this.__data__=[]},xt.prototype.delete=function(t){var e=this.__data__,r=It(e,t);return r>=0&&(r==e.length-1?e.pop():it.call(e,r,1),!0)},xt.prototype.get=function(t){var e=this.__data__,r=It(e,t);return 0>r?void 0:e[r][1]},xt.prototype.has=function(t){return It(this.__data__,t)>-1},xt.prototype.set=function(t,e){var r=this.__data__,n=It(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},St.prototype.clear=function(){this.__data__={hash:new Pt,map:new(yt||xt),string:new Pt}},St.prototype.delete=function(t){return Mt(this,t).delete(t)},St.prototype.get=function(t){return Mt(this,t).get(t)},St.prototype.has=function(t){return Mt(this,t).has(t)},St.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new xt},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof xt){var n=r.__data__;if(!yt||199>n.length)return n.push([t,e]),this;r=this.__data__=new St(n)}return r.set(t,e),this};var Ut=ft?V(ft,Object):function(){return[]},Kt=function(t){return tt.call(t)};function Rt(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||$.test(t))&&t>-1&&t%1==0&&e>t}function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Ct(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Lt(t,e){return t===e||t!=t&&e!=e}(pt&&Kt(new pt(new ArrayBuffer(1)))!=g||yt&&Kt(new yt)!=s||ht&&Kt(ht.resolve())!=y||bt&&Kt(new bt)!=b||vt&&Kt(new vt)!=d)&&(Kt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Ct(r):void 0;if(n)switch(n){case dt:return g;case jt:return s;case gt:return y;case Ot:return b;case wt:return d}return e});var Vt=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&n>=t}(t.length)&&!qt(t)}var Gt=st||function(){return!1};function qt(t){var e=Ht(t)?tt.call(t):"";return e==i||e==f}function Ht(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?Et(t):function(t){if(!zt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return $t(t,!1,!0)}}));var u,a,i=Object.prototype,f=Function.prototype.toString,s=i.hasOwnProperty,l=f.call(Object),p=i.toString,y=(u=Object.getPrototypeOf,a=Object,function(t){return u(a(t))});var h=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=p.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=y(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&f.call(r)==l};function b(t){if(t.includes(".")){var e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(var r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}t.traverse=function(t,e){return function t(e,r,o,u){var a,i=c(e),f=n({depth:-1,path:""},o);if(f.depth+=1,Array.isArray(i))for(var s=0,l=i.length;l>s&&!u.now;s++){var p=f.path?f.path+"."+s:""+s;void 0!==i[s]?(f.parent=c(i),f.parentType="array",f.parentKey=b(p),a=t(r(i[s],void 0,n(n({},f),{},{path:p}),u),r,n(n({},f),{},{path:p}),u),Number.isNaN(a)&&i.length>s?(i.splice(s,1),s-=1):i[s]=a):i.splice(s,1)}else if(h(i))for(var y in i){if(u.now&&null!=y)break;var v=f.path?f.path+"."+y:y;0===f.depth&&null!=y&&(f.topmostKey=y),f.parent=c(i),f.parentType="object",f.parentKey=b(v),a=t(r(y,i[y],n(n({},f),{},{path:v}),u),r,n(n({},f),{},{path:v}),u),Number.isNaN(a)?delete i[y]:i[y]=a}return i}(t,e,{},{now:!1})},t.version="1.13.1",Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).astMonkeyTraverse={})}(this,(function(t){"use strict";function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var n=1;arguments.length>n;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var c=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){var r="__lodash_hash_undefined__",n=9007199254740991,c="[object Arguments]",u="[object Boolean]",a="[object Date]",i="[object Function]",f="[object GeneratorFunction]",s="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",b="[object Set]",v="[object String]",_="[object Symbol]",d="[object WeakMap]",j="[object ArrayBuffer]",g="[object DataView]",O="[object Float32Array]",w="[object Float64Array]",m="[object Int8Array]",A="[object Int16Array]",P="[object Int32Array]",x="[object Uint8Array]",S="[object Uint8ClampedArray]",T="[object Uint16Array]",E="[object Uint32Array]",k=/\w*$/,I=/^\[object .+?Constructor\]$/,$=/^(?:0|[1-9]\d*)$/,D={};D[c]=D["[object Array]"]=D[j]=D[g]=D[u]=D[a]=D[O]=D[w]=D[m]=D[A]=D[P]=D[s]=D[l]=D[p]=D[h]=D[b]=D[v]=D[_]=D[x]=D[S]=D[T]=D[E]=!0,D["[object Error]"]=D[i]=D[d]=!1;var F="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof o&&o&&o.Object===Object&&o||F||Function("return this")(),M=e&&!e.nodeType&&e,B=M&&t&&!t.nodeType&&t,U=B&&B.exports===M;function K(t,e){return t.set(e[0],e[1]),t}function R(t,e){return t.add(e),t}function z(t,e,r,n){var o=-1,c=t?t.length:0;for(n&&c&&(r=t[++o]);++o<c;)r=e(r,t[o],o,t);return r}function C(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function L(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function V(t,e){return function(r){return t(e(r))}}function W(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var G,q=Array.prototype,H=Function.prototype,J=Object.prototype,Q=N["__core-js_shared__"],X=(G=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",Y=H.toString,Z=J.hasOwnProperty,tt=J.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=U?N.Buffer:void 0,nt=N.Symbol,ot=N.Uint8Array,ct=V(Object.getPrototypeOf,Object),ut=Object.create,at=J.propertyIsEnumerable,it=q.splice,ft=Object.getOwnPropertySymbols,st=rt?rt.isBuffer:void 0,lt=V(Object.keys,Object),pt=Bt(N,"DataView"),yt=Bt(N,"Map"),ht=Bt(N,"Promise"),bt=Bt(N,"Set"),vt=Bt(N,"WeakMap"),_t=Bt(Object,"create"),dt=Ct(pt),jt=Ct(yt),gt=Ct(ht),Ot=Ct(bt),wt=Ct(vt),mt=nt?nt.prototype:void 0,At=mt?mt.valueOf:void 0;function Pt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){this.__data__=new xt(t)}function Et(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==c)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var u in t)!e&&!Z.call(t,u)||o&&("length"==u||Rt(u,n))||r.push(u);return r}function kt(t,e,r){var n=t[e];Z.call(t,e)&&Lt(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function It(t,e){for(var r=t.length;r--;)if(Lt(t[r][0],e))return r;return-1}function $t(t,e,r,n,o,y,d){var I;if(n&&(I=y?n(t,o,y,d):n(t)),void 0!==I)return I;if(!Ht(t))return t;var $=Vt(t);if($){if(I=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,I)}else{var F=Kt(t),N=F==i||F==f;if(Gt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(F==p||F==c||N&&!y){if(C(t))return y?t:{};if(I=function(t){return"function"!=typeof t.constructor||zt(t)?{}:(e=ct(t),Ht(e)?ut(e):{});var e}(N?{}:t),!e)return function(t,e){return Nt(t,Ut(t),e)}(t,function(t,e){return t&&Nt(e,Jt(e),t)}(I,t))}else{if(!D[F])return y?t:{};I=function(t,e,r,n){var o=t.constructor;switch(e){case j:return Ft(t);case u:case a:return new o(+t);case g:return function(t,e){var r=e?Ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case O:case w:case m:case A:case P:case x:case S:case T:case E:return function(t,e){var r=e?Ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case s:return function(t,e,r){return z(e?r(L(t),!0):L(t),K,new t.constructor)}(t,n,r);case l:case v:return new o(t);case h:return function(t){var e=new t.constructor(t.source,k.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return function(t,e,r){return z(e?r(W(t),!0):W(t),R,new t.constructor)}(t,n,r);case _:return c=t,At?Object(At.call(c)):{}}var c}(t,F,$t,e)}}d||(d=new Tt);var M=d.get(t);if(M)return M;if(d.set(t,I),!$)var B=r?function(t){return function(t,e,r){var n=e(t);return Vt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Jt,Ut)}(t):Jt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}(B||t,(function(o,c){B&&(o=t[c=o]),kt(I,c,$t(o,e,r,n,c,t,d))})),I}function Dt(t){return!(!Ht(t)||(e=t,X&&X in e))&&(qt(t)||C(t)?et:I).test(Ct(t));var e}function Ft(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Nt(t,e,r,n){r||(r={});for(var o=-1,c=e.length;++o<c;){var u=e[o],a=n?n(r[u],t[u],u,r,t):void 0;kt(r,u,void 0===a?t[u]:a)}return r}function Mt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Bt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Dt(r)?r:void 0}Pt.prototype.clear=function(){this.__data__=_t?_t(null):{}},Pt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Pt.prototype.get=function(t){var e=this.__data__;if(_t){var n=e[t];return n===r?void 0:n}return Z.call(e,t)?e[t]:void 0},Pt.prototype.has=function(t){var e=this.__data__;return _t?void 0!==e[t]:Z.call(e,t)},Pt.prototype.set=function(t,e){return this.__data__[t]=_t&&void 0===e?r:e,this},xt.prototype.clear=function(){this.__data__=[]},xt.prototype.delete=function(t){var e=this.__data__,r=It(e,t);return r>=0&&(r==e.length-1?e.pop():it.call(e,r,1),!0)},xt.prototype.get=function(t){var e=this.__data__,r=It(e,t);return 0>r?void 0:e[r][1]},xt.prototype.has=function(t){return It(this.__data__,t)>-1},xt.prototype.set=function(t,e){var r=this.__data__,n=It(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},St.prototype.clear=function(){this.__data__={hash:new Pt,map:new(yt||xt),string:new Pt}},St.prototype.delete=function(t){return Mt(this,t).delete(t)},St.prototype.get=function(t){return Mt(this,t).get(t)},St.prototype.has=function(t){return Mt(this,t).has(t)},St.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new xt},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof xt){var n=r.__data__;if(!yt||199>n.length)return n.push([t,e]),this;r=this.__data__=new St(n)}return r.set(t,e),this};var Ut=ft?V(ft,Object):function(){return[]},Kt=function(t){return tt.call(t)};function Rt(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||$.test(t))&&t>-1&&t%1==0&&e>t}function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Ct(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Lt(t,e){return t===e||t!=t&&e!=e}(pt&&Kt(new pt(new ArrayBuffer(1)))!=g||yt&&Kt(new yt)!=s||ht&&Kt(ht.resolve())!=y||bt&&Kt(new bt)!=b||vt&&Kt(new vt)!=d)&&(Kt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Ct(r):void 0;if(n)switch(n){case dt:return g;case jt:return s;case gt:return y;case Ot:return b;case wt:return d}return e});var Vt=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&n>=t}(t.length)&&!qt(t)}var Gt=st||function(){return!1};function qt(t){var e=Ht(t)?tt.call(t):"";return e==i||e==f}function Ht(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?Et(t):function(t){if(!zt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return $t(t,!0,!0)}}));var u,a,i=Object.prototype,f=Function.prototype.toString,s=i.hasOwnProperty,l=f.call(Object),p=i.toString,y=(u=Object.getPrototypeOf,a=Object,function(t){return u(a(t))});var h=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=p.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=y(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&f.call(r)==l};function b(t){if(t.includes(".")){var e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(var r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}t.traverse=function(t,e){return function t(e,r,o,u){var a,i=c(e),f=n({depth:-1,path:""},o);if(f.depth+=1,Array.isArray(i))for(var s=0,l=i.length;l>s&&!u.now;s++){var p=f.path?f.path+"."+s:""+s;void 0!==i[s]?(f.parent=c(i),f.parentType="array",f.parentKey=b(p),a=t(r(i[s],void 0,n(n({},f),{},{path:p}),u),r,n(n({},f),{},{path:p}),u),Number.isNaN(a)&&i.length>s?(i.splice(s,1),s-=1):i[s]=a):i.splice(s,1)}else if(h(i))for(var y in i){if(u.now&&null!=y)break;var v=f.path?f.path+"."+y:y;0===f.depth&&null!=y&&(f.topmostKey=y),f.parent=c(i),f.parentType="object",f.parentKey=b(v),a=t(r(y,i[y],n(n({},f),{},{path:v}),u),r,n(n({},f),{},{path:v}),u),Number.isNaN(a)?delete i[y]:i[y]=a}return i}(t,e,{},{now:!1})},t.version="1.13.1",Object.defineProperty(t,"__esModule",{value:!0})}));

M packages/ast-monkey-traverse/examples/_quickTake.js => packages/ast-monkey-traverse/examples/_quickTake.js +0 -2
@@ 1,5 1,3 @@
/* eslint import/extensions:0 */

// Quick Take

import { strict as assert } from "assert";

M packages/ast-monkey-traverse/examples/compatible-with-object-path.js => packages/ast-monkey-traverse/examples/compatible-with-object-path.js +0 -2
@@ 1,5 1,3 @@
/* eslint import/extensions:0, import/no-extraneous-dependencies:0 */

// Compatible With `object-path`

import { strict as assert } from "assert";

M packages/ast-monkey-traverse/examples/stopping.js => packages/ast-monkey-traverse/examples/stopping.js +0 -2
@@ 1,5 1,3 @@
/* eslint import/extensions:0 */

// Stop

import { strict as assert } from "assert";

M packages/ast-monkey-traverse/package.json => packages/ast-monkey-traverse/package.json +8 -7
@@ 46,7 46,7 @@
    "devunittest": "npm run dev && ./node_modules/.bin/tap --only -R 'base' && npm run tsd && npm run clean_cov",
    "format": "npm run lect && npm run prettier && npm run lint",
    "lect": "lect",
    "lint": "../../node_modules/eslint/bin/eslint.js \"**/*.js\" --fix --config \"../../.eslintrc.json\" --quiet",
    "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
    "perf": "node perf/check",
    "prepare": "npm run build",
    "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",


@@ 57,7 57,7 @@
    "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
    "tsc": "tsc",
    "tsd": "test ! -f index.d.ts || tsd",
    "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && npm run tsd && npm run clean_cov && npm run perf",
    "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && tsc --noEmit && npm run tsd && npm run clean_cov && npm run perf",
    "version": "npm run build && git add ."
  },
  "tap": {


@@ 80,17 80,16 @@
    "req": "{ traverse }",
    "various": {
      "devDependencies": [
        "object-path",
        "@types/lodash.isplainobject",
        "lodash.isequal",
        "@types/lodash.clone",
        "@types/lodash.isplainobject"
        "object-path"
      ]
    }
  },
  "dependencies": {
    "@babel/runtime": "^7.9.2",
    "ast-monkey-util": "^1.2.0",
    "lodash.clone": "^4.5.0",
    "lodash.clonedeep": "^4.5.0",
    "lodash.isplainobject": "^4.0.6"
  },
  "devDependencies": {


@@ 113,10 112,12 @@
    "@rollup/plugin-replace": "^2.3.4",
    "@rollup/plugin-strip": "^2.0.0",
    "@rollup/plugin-typescript": "^8.1.0",
    "@types/lodash.clone": "^4.5.6",
    "@types/lodash.clonedeep": "^4.5.6",
    "@types/lodash.isplainobject": "^4.0.6",
    "@types/node": "^13.13.4",
    "@types/tap": "^14.10.1",
    "@typescript-eslint/eslint-plugin": "^4.11.0",
    "@typescript-eslint/parser": "^4.11.0",
    "eslint": "^7.15.0",
    "fs-extra": "^9.0.1",
    "lect": "^0.15.1",

M packages/ast-monkey-traverse/src/main.ts => packages/ast-monkey-traverse/src/main.ts +19 -12
@@ 1,4 1,6 @@
import clone from "lodash.clone";
/* eslint @typescript-eslint/explicit-module-boundary-types:0 */

import clone from "lodash.clonedeep";
import isObj from "lodash.isplainobject";
import { parent } from "ast-monkey-util";
import { version } from "../package.json";


@@ 8,17 10,17 @@ interface Stop {
}

interface InnerObj {
  depth?: number;
  path?: string;
  topmostKey?: string;
  parent?: any;
  parentType?: string;
  parentKey?: string | null;
  depth: number;
  path: string;
  topmostKey: string;
  parent: any;
  parentType: string;
  parentKey: string | null;
}

type Callback = (key: string, val: any, innerObj: InnerObj, stop: Stop) => any;

function traverse(tree1: any, cb1: Callback) {
function traverse(tree1: any, cb1: Callback): any {
  const stop2: Stop = { now: false };
  //
  // traverseInner() needs a wrapper to shield the last two input args from the outside


@@ 26,9 28,9 @@ function traverse(tree1: any, cb1: Callback) {
  function traverseInner(
    treeOriginal: any,
    callback: Callback,
    originalInnerObj: InnerObj,
    originalInnerObj: Partial<InnerObj>,
    stop: Stop
  ) {
  ): any {
    console.log(`015 ======= traverseInner() =======`);
    const tree: any = clone(treeOriginal);



@@ 66,7 68,12 @@ function traverse(tree1: any, cb1: Callback) {
          );
          // innerObj.path = `${innerObj.path}[${i}]`
          res = traverseInner(
            callback(tree[i], undefined, { ...innerObj, path }, stop),
            callback(
              tree[i],
              undefined,
              { ...innerObj, path } as InnerObj,
              stop
            ),
            callback,
            { ...innerObj, path },
            stop


@@ 121,7 128,7 @@ function traverse(tree1: any, cb1: Callback) {
          )}`
        );
        res = traverseInner(
          callback(key, tree[key], { ...innerObj, path }, stop),
          callback(key, tree[key], { ...innerObj, path } as InnerObj, stop),
          callback,
          { ...innerObj, path },
          stop

M packages/ast-monkey-traverse/test/test.js => packages/ast-monkey-traverse/test/test.js +43 -2
@@ 285,10 285,51 @@ tap.test(
    const gathered = [];
    traverse(input, (key1, val1, innerObj) => {
      const current = val1 !== undefined ? val1 : key1;
      gathered.push(innerObj.path);
      gathered.push(innerObj);
      return current;
    });
    t.strictSame(gathered, ["a", "b", "b.c"], "09");
    t.strictSame(
      gathered,
      [
        {
          depth: 0,
          path: "a",
          topmostKey: "a",
          parent: {
            a: "1",
            b: {
              c: "2",
            },
          },
          parentType: "object",
          parentKey: null,
        },
        {
          depth: 0,
          path: "b",
          topmostKey: "b",
          parent: {
            a: "1",
            b: {
              c: "2",
            },
          },
          parentType: "object",
          parentKey: null,
        },
        {
          depth: 1,
          path: "b.c",
          topmostKey: "b",
          parent: {
            c: "2",
          },
          parentType: "object",
          parentKey: "b",
        },
      ],
      "09"
    );
    t.end();
  }
);

M packages/ast-monkey-traverse/types/main.d.ts => packages/ast-monkey-traverse/types/main.d.ts +6 -6
@@ 3,12 3,12 @@ interface Stop {
    now: boolean;
}
interface InnerObj {
    depth?: number;
    path?: string;
    topmostKey?: string;
    parent?: any;
    parentType?: string;
    parentKey?: string | null;
    depth: number;
    path: string;
    topmostKey: string;
    parent: any;
    parentType: string;
    parentKey: string | null;
}
declare type Callback = (key: string, val: any, innerObj: InnerObj, stop: Stop) => any;
declare function traverse(tree1: any, cb1: Callback): any;

M packages/ast-monkey-util/examples/_quickTake.js => packages/ast-monkey-util/examples/_quickTake.js +1 -1
@@ 1,4 1,4 @@
/* eslint import/extensions:0 */


// Quick Take


M packages/ast-monkey/coverage/coverage-summary.json => packages/ast-monkey/coverage/coverage-summary.json +1 -1
@@ 1,1 1,1 @@
{"total":{"lines":{"total":120,"covered":116,"skipped":0,"pct":96.67},"statements":{"total":120,"covered":116,"skipped":0,"pct":96.67},"functions":{"total":12,"covered":12,"skipped":0,"pct":100},"branches":{"total":146,"covered":142,"skipped":0,"pct":97.26}}}
\ No newline at end of file
{"total":{"lines":{"total":120,"covered":116,"skipped":0,"pct":96.67},"statements":{"total":120,"covered":116,"skipped":0,"pct":96.67},"functions":{"total":12,"covered":12,"skipped":0,"pct":100},"branches":{"total":144,"covered":140,"skipped":0,"pct":97.22}}}
\ No newline at end of file

M packages/ast-monkey/dist/ast-monkey.cjs.js => packages/ast-monkey/dist/ast-monkey.cjs.js +1 -1
@@ 148,7 148,7 @@ function monkey(originalInput, originalOpts) {
  }

  if (opts.mode === "find") {
    return findings.length > 0 ? findings : null;
    return findings;
  }

  return input;

M packages/ast-monkey/dist/ast-monkey.dev.umd.js => packages/ast-monkey/dist/ast-monkey.dev.umd.js +1 -1
@@ 5891,7 5891,7 @@ function monkey(originalInput, originalOpts) {
  }

  if (opts.mode === "find") {
    return findings.length > 0 ? findings : null;
    return findings;
  }

  return input;

M packages/ast-monkey/dist/ast-monkey.esm.js => packages/ast-monkey/dist/ast-monkey.esm.js +1 -1
@@ 140,7 140,7 @@ function monkey(originalInput, originalOpts) {
  }

  if (opts.mode === "find") {
    return findings.length > 0 ? findings : null;
    return findings;
  }

  return input;

M packages/ast-monkey/dist/ast-monkey.mjs => packages/ast-monkey/dist/ast-monkey.mjs +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/ast-monkey/
 */

import{arrObjOrBoth as e}from"util-array-object-or-both";import{checkTypesMini as n}from"check-types-mini";import{compare as r}from"ast-compare";import{traverse as t}from"ast-monkey-traverse";export{traverse}from"ast-monkey-traverse";var o="7.12.1";function i(e){return null!=e}function a(e){return void 0!==e}function s(e,n){return typeof e==typeof n&&!!r(e,n,{matchStrictly:!0,useWildcards:!0})}function d(e){return e&&"object"==typeof e&&!Array.isArray(e)}function l(e,n){if(!i(e))throw new Error("ast-monkey/main.js/monkey(): [THROW_ID_01] Please provide an input");const r={...n},o={count:0,gatherPath:[],finding:null},d=[];let l=!1,m=!1;i(r.key)&&!a(r.val)&&(l=!0),!i(r.key)&&a(r.val)&&(m=!0);let y=e;return"arrayFirstOnly"===r.mode&&Array.isArray(y)&&y.length>0&&(y=[y[0]]),y=t(y,((e,n,t)=>{let y;if(o.count+=1,o.gatherPath.length=t.depth,o.gatherPath.push(o.count),"get"===r.mode)o.count===r.index&&(a(n)?(o.finding={},o.finding[e]=n):o.finding=e);else if("find"===r.mode||"del"===r.mode){if(!("any"===r.only||"array"===r.only&&void 0===n||"object"===r.only&&void 0!==n)||!(l&&s(e,r.key)||m&&s(n,r.val)||!l&&!m&&s(e,r.key)&&s(n,r.val)))return void 0!==n?n:e;if("find"!==r.mode)return NaN;y={index:o.count,key:e,val:n,path:[...o.gatherPath]},d.push(y)}return"set"===r.mode&&o.count===r.index?r.val:"drop"===r.mode&&o.count===r.index?NaN:"arrayFirstOnly"===r.mode?a(n)&&Array.isArray(n)?[n[0]]:i(e)&&Array.isArray(e)?[e[0]]:void 0!==n?n:e:void 0!==n?n:e})),"get"===r.mode?o.finding:"find"===r.mode?d.length>0?d:null:y}function m(r,t){if(!i(r))throw new Error("ast-monkey/main.js/find(): [THROW_ID_02] Please provide the input");if(!d(t)||void 0===t.key&&void 0===t.val)throw new Error("ast-monkey/main.js/find(): [THROW_ID_03] Please provide opts.key or opts.val");const o={...t};return n(o,null,{schema:{key:["null","string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/get(): [THROW_ID_04*]"}),o.only="string"==typeof o.only&&o.only.length>0?e(o.only,{optsVarName:"opts.only",msg:"ast-monkey/find(): [THROW_ID_05*]"}):"any",l(r,{...o,mode:"find"})}function y(e,n){if(!i(e))throw new Error("ast-monkey/main.js/get(): [THROW_ID_06] Please provide the input");if(!d(n))throw new Error("ast-monkey/main.js/get(): [THROW_ID_07] Please provide the opts");if(!i(n.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_08] Please provide opts.index");const r={...n};if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error(`ast-monkey/main.js/get(): [THROW_ID_11] opts.index must be a natural number. It was given as: ${r.index} (type ${typeof r.index})`);return l(e,{...r,mode:"get"})}function p(e,r){if(!i(e))throw new Error("ast-monkey/main.js/set(): [THROW_ID_12] Please provide the input");if(!d(r))throw new Error("ast-monkey/main.js/set(): [THROW_ID_13] Please provide the input");if(!i(r.key)&&!a(r.val))throw new Error("ast-monkey/main.js/set(): [THROW_ID_14] Please provide opts.val");if(!i(r.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_15] Please provide opts.index");const t={...r};if("string"==typeof t.index&&/^\d*$/.test(t.index))t.index=+t.index;else if(!Number.isInteger(t.index))throw new Error(`ast-monkey/main.js/set(): [THROW_ID_17] opts.index must be a natural number. It was given as: ${t.index}`);return i(t.key)&&!a(t.val)&&(t.val=t.key),n(t,null,{schema:{key:[null,"string"],val:"any",index:"number"},msg:"ast-monkey/set(): [THROW_ID_18*]"}),l(e,{...t,mode:"set"})}function u(e,n){if(!i(e))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_19] Please provide the input");if(!d(n))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_20] Please provide the input");if(!i(n.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_21] Please provide opts.index");const r={...n};if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error(`ast-monkey/main.js/drop(): [THROW_ID_23] opts.index must be a natural number. It was given as: ${r.index}`);return l(e,{...r,mode:"drop"})}function f(r,t){if(!i(r))throw new Error("ast-monkey/main.js/del(): [THROW_ID_26] Please provide the input");if(!d(t))throw new Error("ast-monkey/main.js/del(): [THROW_ID_27] Please provide the opts object");if(!i(t.key)&&!a(t.val))throw new Error("ast-monkey/main.js/del(): [THROW_ID_28] Please provide opts.key or opts.val");const o={...t};return n(o,null,{schema:{key:[null,"string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/drop(): [THROW_ID_29*]"}),o.only="string"==typeof o.only&&o.only.length>0?e(o.only,{msg:"ast-monkey/del(): [THROW_ID_30*]",optsVarName:"opts.only"}):"any",l(r,{...o,mode:"del"})}function h(e){if(!i(e))throw new Error("ast-monkey/main.js/arrayFirstOnly(): [THROW_ID_31] Please provide the input");return l(e,{mode:"arrayFirstOnly"})}export{h as arrayFirstOnly,f as del,u as drop,m as find,y as get,p as set,o as version};
import{arrObjOrBoth as e}from"util-array-object-or-both";import{checkTypesMini as n}from"check-types-mini";import{compare as r}from"ast-compare";import{traverse as t}from"ast-monkey-traverse";export{traverse}from"ast-monkey-traverse";var o="7.12.1";function i(e){return null!=e}function a(e){return void 0!==e}function s(e,n){return typeof e==typeof n&&!!r(e,n,{matchStrictly:!0,useWildcards:!0})}function d(e){return e&&"object"==typeof e&&!Array.isArray(e)}function l(e,n){if(!i(e))throw new Error("ast-monkey/main.js/monkey(): [THROW_ID_01] Please provide an input");const r={...n},o={count:0,gatherPath:[],finding:null},d=[];let l=!1,m=!1;i(r.key)&&!a(r.val)&&(l=!0),!i(r.key)&&a(r.val)&&(m=!0);let y=e;return"arrayFirstOnly"===r.mode&&Array.isArray(y)&&y.length>0&&(y=[y[0]]),y=t(y,((e,n,t)=>{let y;if(o.count+=1,o.gatherPath.length=t.depth,o.gatherPath.push(o.count),"get"===r.mode)o.count===r.index&&(a(n)?(o.finding={},o.finding[e]=n):o.finding=e);else if("find"===r.mode||"del"===r.mode){if(!("any"===r.only||"array"===r.only&&void 0===n||"object"===r.only&&void 0!==n)||!(l&&s(e,r.key)||m&&s(n,r.val)||!l&&!m&&s(e,r.key)&&s(n,r.val)))return void 0!==n?n:e;if("find"!==r.mode)return NaN;y={index:o.count,key:e,val:n,path:[...o.gatherPath]},d.push(y)}return"set"===r.mode&&o.count===r.index?r.val:"drop"===r.mode&&o.count===r.index?NaN:"arrayFirstOnly"===r.mode?a(n)&&Array.isArray(n)?[n[0]]:i(e)&&Array.isArray(e)?[e[0]]:void 0!==n?n:e:void 0!==n?n:e})),"get"===r.mode?o.finding:"find"===r.mode?d:y}function m(r,t){if(!i(r))throw new Error("ast-monkey/main.js/find(): [THROW_ID_02] Please provide the input");if(!d(t)||void 0===t.key&&void 0===t.val)throw new Error("ast-monkey/main.js/find(): [THROW_ID_03] Please provide opts.key or opts.val");const o={...t};return n(o,null,{schema:{key:["null","string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/get(): [THROW_ID_04*]"}),o.only="string"==typeof o.only&&o.only.length>0?e(o.only,{optsVarName:"opts.only",msg:"ast-monkey/find(): [THROW_ID_05*]"}):"any",l(r,{...o,mode:"find"})}function y(e,n){if(!i(e))throw new Error("ast-monkey/main.js/get(): [THROW_ID_06] Please provide the input");if(!d(n))throw new Error("ast-monkey/main.js/get(): [THROW_ID_07] Please provide the opts");if(!i(n.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_08] Please provide opts.index");const r={...n};if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error(`ast-monkey/main.js/get(): [THROW_ID_11] opts.index must be a natural number. It was given as: ${r.index} (type ${typeof r.index})`);return l(e,{...r,mode:"get"})}function p(e,r){if(!i(e))throw new Error("ast-monkey/main.js/set(): [THROW_ID_12] Please provide the input");if(!d(r))throw new Error("ast-monkey/main.js/set(): [THROW_ID_13] Please provide the input");if(!i(r.key)&&!a(r.val))throw new Error("ast-monkey/main.js/set(): [THROW_ID_14] Please provide opts.val");if(!i(r.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_15] Please provide opts.index");const t={...r};if("string"==typeof t.index&&/^\d*$/.test(t.index))t.index=+t.index;else if(!Number.isInteger(t.index))throw new Error(`ast-monkey/main.js/set(): [THROW_ID_17] opts.index must be a natural number. It was given as: ${t.index}`);return i(t.key)&&!a(t.val)&&(t.val=t.key),n(t,null,{schema:{key:[null,"string"],val:"any",index:"number"},msg:"ast-monkey/set(): [THROW_ID_18*]"}),l(e,{...t,mode:"set"})}function u(e,n){if(!i(e))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_19] Please provide the input");if(!d(n))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_20] Please provide the input");if(!i(n.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_21] Please provide opts.index");const r={...n};if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error(`ast-monkey/main.js/drop(): [THROW_ID_23] opts.index must be a natural number. It was given as: ${r.index}`);return l(e,{...r,mode:"drop"})}function f(r,t){if(!i(r))throw new Error("ast-monkey/main.js/del(): [THROW_ID_26] Please provide the input");if(!d(t))throw new Error("ast-monkey/main.js/del(): [THROW_ID_27] Please provide the opts object");if(!i(t.key)&&!a(t.val))throw new Error("ast-monkey/main.js/del(): [THROW_ID_28] Please provide opts.key or opts.val");const o={...t};return n(o,null,{schema:{key:[null,"string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/drop(): [THROW_ID_29*]"}),o.only="string"==typeof o.only&&o.only.length>0?e(o.only,{msg:"ast-monkey/del(): [THROW_ID_30*]",optsVarName:"opts.only"}):"any",l(r,{...o,mode:"del"})}function h(e){if(!i(e))throw new Error("ast-monkey/main.js/arrayFirstOnly(): [THROW_ID_31] Please provide the input");return l(e,{mode:"arrayFirstOnly"})}export{h as arrayFirstOnly,f as del,u as drop,m as find,y as get,p as set,o as version};

M packages/ast-monkey/dist/ast-monkey.umd.js => packages/ast-monkey/dist/ast-monkey.umd.js +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/ast-monkey/
 */

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).astMonkey={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var a=1/0,u=9007199254740991,s=17976931348623157e292,c=NaN,f="[object Arguments]",l="[object Function]",y="[object GeneratorFunction]",p="[object String]",h="[object Symbol]",g=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=/^(?:0|[1-9]\d*)$/,_=parseInt;function w(e){return e!=e}function j(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}(t,(function(t){return e[t]}))}var O,A,S=Object.prototype,k=S.hasOwnProperty,T=S.toString,P=S.propertyIsEnumerable,x=(O=Object.keys,A=Object,function(e){return O(A(e))}),I=Math.max;function W(e,t){var r=M(e)||function(e){return function(e){return R(e)&&D(e)}(e)&&k.call(e,"callee")&&(!P.call(e,"callee")||T.call(e)==f)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!t&&!k.call(e,i)||o&&("length"==i||N(i,n))||r.push(i);return r}function E(e){if((t=e)!==("function"==typeof(r=t&&t.constructor)&&r.prototype||S))return x(e);var t,r,n=[];for(var o in Object(e))k.call(e,o)&&"constructor"!=o&&n.push(o);return n}function N(e,t){return!!(t=null==t?u:t)&&("number"==typeof e||b.test(e))&&e>-1&&e%1==0&&e<t}var M=Array.isArray;function D(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}(e.length)&&!function(e){var t=H(e)?T.call(e):"";return t==l||t==y}(e)}function H(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}var F=function(e,t,r,n){var o;e=D(e)?e:(o=e)?j(o,function(e){return D(e)?W(e):E(e)}(o)):[],r=r&&!n?function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||R(e)&&T.call(e)==h}(e))return c;if(H(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=H(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(g,"");var r=v.test(e);return r||m.test(e)?_(e.slice(2),r?2:8):d.test(e)?c:+e}(e))===a||e===-1/0){return(e<0?-1:1)*s}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var i=e.length;return r<0&&(r=I(i+r,0)),function(e){return"string"==typeof e||!M(e)&&R(e)&&T.call(e)==p}(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,w,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,t,r)>-1};function L(e,t){var r=n(n({},{msg:"",optsVarName:"given variable"}),t);if(r&&r.msg&&r.msg.length>0&&(r.msg=r.msg.trim()+" "),"given variable"!==r.optsVarName&&(r.optsVarName='variable "'+r.optsVarName+'"'),F(["object","objects","obj","ob","o"],e.toLowerCase().trim()))return"object";if(F(["array","arrays","arr","aray","arr","a"],e.toLowerCase().trim()))return"array";if(F(["any","all","everything","both","either","each","whatever","whatevs","e"],e.toLowerCase().trim()))return"any";throw new TypeError(r.msg+"The "+r.optsVarName+" was customised to an unrecognised value: "+e+". Please check it against the API documentation.")}var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var C=V((function(e,t){e.exports=function(){var e="function"==typeof Promise,t="object"==typeof self?self:$,r="undefined"!=typeof Symbol,n="undefined"!=typeof Map,o="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,a="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=r&&void 0!==Symbol.iterator,c=r&&void 0!==Symbol.toStringTag,f=o&&"function"==typeof Set.prototype.entries,l=n&&"function"==typeof Map.prototype.entries,y=f&&Object.getPrototypeOf((new Set).entries()),p=l&&Object.getPrototypeOf((new Map).entries()),h=s&&"function"==typeof Array.prototype[Symbol.iterator],g=h&&Object.getPrototypeOf([][Symbol.iterator]()),d=s&&"function"==typeof String.prototype[Symbol.iterator],v=d&&Object.getPrototypeOf(""[Symbol.iterator]()),m=8,b=-1;function _(r){var s=typeof r;if("object"!==s)return s;if(null===r)return"null";if(r===t)return"global";if(Array.isArray(r)&&(!1===c||!(Symbol.toStringTag in r)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&r===window.location)return"Location";if("object"==typeof window.document&&r===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&r===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&r===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&r instanceof window.HTMLElement){if("BLOCKQUOTE"===r.tagName)return"HTMLQuoteElement";if("TD"===r.tagName)return"HTMLTableDataCellElement";if("TH"===r.tagName)return"HTMLTableHeaderCellElement"}}var f=c&&r[Symbol.toStringTag];if("string"==typeof f)return f;var l=Object.getPrototypeOf(r);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":e&&l===Promise.prototype?"Promise":o&&l===Set.prototype?"Set":n&&l===Map.prototype?"Map":a&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":n&&l===p?"Map Iterator":o&&l===y?"Set Iterator":h&&l===g?"Array Iterator":d&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(r).slice(m,b)}return _}()}));function J(e,t,r){if(t!=t)return function(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,B,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}function K(e,t,r,n){for(var o=r-1,i=e.length;++o<i;)if(n(e[o],t))return o;return-1}function B(e){return e!=e}var U=Array.prototype.splice;function z(e,t,r,n){var o=n?K:J,i=-1,a=t.length,u=e;for(e===t&&(t=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(t)),r&&(u=function(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}(e,function(e){return function(t){return e(t)}}(r)));++i<a;)for(var s=0,c=t[i],f=r?r(c):c;(s=o(u,f,s,n))>-1;)u!==e&&U.call(u,s,1),U.call(e,s,1);return e}var q=function(e,t){return e&&e.length&&t&&t.length?z(e,t):e},G=V((function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",u="[object Function]",s="[object GeneratorFunction]",c="[object Map]",f="[object Number]",l="[object Object]",y="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",d="[object Symbol]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",_="[object Float32Array]",w="[object Float64Array]",j="[object Int8Array]",O="[object Int16Array]",A="[object Int32Array]",S="[object Uint8Array]",k="[object Uint8ClampedArray]",T="[object Uint16Array]",P="[object Uint32Array]",x=/\w*$/,I=/^\[object .+?Constructor\]$/,W=/^(?:0|[1-9]\d*)$/,E={};E[o]=E["[object Array]"]=E[m]=E[b]=E[i]=E[a]=E[_]=E[w]=E[j]=E[O]=E[A]=E[c]=E[f]=E[l]=E[p]=E[h]=E[g]=E[d]=E[S]=E[k]=E[T]=E[P]=!0,E["[object Error]"]=E[u]=E[v]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,M="object"==typeof $&&$&&$.Object===Object&&$||N||Function("return this")(),D=t&&!t.nodeType&&t,H=D&&e&&!e.nodeType&&e,R=H&&H.exports===D;function F(e,t){return e.set(t[0],t[1]),e}function L(e,t){return e.add(t),e}function V(e,t,r,n){var o=-1,i=e?e.length:0;for(n&&i&&(r=e[++o]);++o<i;)r=t(r,e[o],o,e);return r}function C(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function J(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function K(e,t){return function(r){return e(t(r))}}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var U,z=Array.prototype,q=Function.prototype,G=Object.prototype,Q=M["__core-js_shared__"],X=(U=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Y=q.toString,Z=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=R?M.Buffer:void 0,ne=M.Symbol,oe=M.Uint8Array,ie=K(Object.getPrototypeOf,Object),ae=Object.create,ue=G.propertyIsEnumerable,se=z.splice,ce=Object.getOwnPropertySymbols,fe=re?re.isBuffer:void 0,le=K(Object.keys,Object),ye=Re(M,"DataView"),pe=Re(M,"Map"),he=Re(M,"Promise"),ge=Re(M,"Set"),de=Re(M,"WeakMap"),ve=Re(Object,"create"),me=Ce(ye),be=Ce(pe),_e=Ce(he),we=Ce(ge),je=Ce(de),Oe=ne?ne.prototype:void 0,Ae=Oe?Oe.valueOf:void 0;function Se(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ke(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Pe(e){this.__data__=new ke(e)}function xe(e,t){var r=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Be(e)}(e)&&Z.call(e,"callee")&&(!ue.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var a in e)!t&&!Z.call(e,a)||i&&("length"==a||$e(a,n))||r.push(a);return r}function Ie(e,t,r){var n=e[t];Z.call(e,t)&&Je(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function We(e,t){for(var r=e.length;r--;)if(Je(e[r][0],t))return r;return-1}function Ee(e,t,r,n,y,v,I){var W;if(n&&(W=v?n(e,y,v,I):n(e)),void 0!==W)return W;if(!qe(e))return e;var N=Ke(e);if(N){if(W=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,W)}else{var M=Le(e),D=M==u||M==s;if(Ue(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(M==l||M==o||D&&!v){if(C(e))return v?e:{};if(W=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ie(e),qe(t)?ae(t):{});var t}(D?{}:e),!t)return function(e,t){return De(e,Fe(e),t)}(e,function(e,t){return e&&De(t,Ge(t),e)}(W,e))}else{if(!E[M])return v?e:{};W=function(e,t,r,n){var o=e.constructor;switch(t){case m:return Me(e);case i:case a:return new o(+e);case b:return function(e,t){var r=t?Me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case _:case w:case j:case O:case A:case S:case k:case T:case P:return function(e,t){var r=t?Me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case c:return function(e,t,r){return V(t?r(J(e),!0):J(e),F,new e.constructor)}(e,n,r);case f:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,x.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,r){return V(t?r(B(e),!0):B(e),L,new e.constructor)}(e,n,r);case d:return u=e,Ae?Object(Ae.call(u)):{}}var u}(e,M,Ee,t)}}I||(I=new Pe);var H=I.get(e);if(H)return H;if(I.set(e,W),!N)var R=r?function(e){return function(e,t,r){var n=t(e);return Ke(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,Ge,Fe)}(e):Ge(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(R||e,(function(o,i){R&&(o=e[i=o]),Ie(W,i,Ee(o,t,r,n,i,e,I))})),W}function Ne(e){return!(!qe(e)||function(e){return!!X&&X in e}(e))&&(ze(e)||C(e)?te:I).test(Ce(e))}function Me(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function De(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o<i;){var a=t[o],u=n?n(r[a],e[a],a,r,e):void 0;Ie(r,a,void 0===u?e[a]:u)}return r}function He(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ne(r)?r:void 0}Se.prototype.clear=function(){this.__data__=ve?ve(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ve){var n=t[e];return n===r?void 0:n}return Z.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},ke.prototype.clear=function(){this.__data__=[]},ke.prototype.delete=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():se.call(t,r,1),!0)},ke.prototype.get=function(e){var t=this.__data__,r=We(t,e);return r<0?void 0:t[r][1]},ke.prototype.has=function(e){return We(this.__data__,e)>-1},ke.prototype.set=function(e,t){var r=this.__data__,n=We(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Te.prototype.clear=function(){this.__data__={hash:new Se,map:new(pe||ke),string:new Se}},Te.prototype.delete=function(e){return He(this,e).delete(e)},Te.prototype.get=function(e){return He(this,e).get(e)},Te.prototype.has=function(e){return He(this,e).has(e)},Te.prototype.set=function(e,t){return He(this,e).set(e,t),this},Pe.prototype.clear=function(){this.__data__=new ke},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ke){var n=r.__data__;if(!pe||n.length<199)return n.push([e,t]),this;r=this.__data__=new Te(n)}return r.set(e,t),this};var Fe=ce?K(ce,Object):function(){return[]},Le=function(e){return ee.call(e)};function $e(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||W.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function Ce(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Je(e,t){return e===t||e!=e&&t!=t}(ye&&Le(new ye(new ArrayBuffer(1)))!=b||pe&&Le(new pe)!=c||he&&Le(he.resolve())!=y||ge&&Le(new ge)!=h||de&&Le(new de)!=v)&&(Le=function(e){var t=ee.call(e),r=t==l?e.constructor:void 0,n=r?Ce(r):void 0;if(n)switch(n){case me:return b;case be:return c;case _e:return y;case we:return h;case je:return v}return t});var Ke=Array.isArray;function Be(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!ze(e)}var Ue=fe||function(){return!1};function ze(e){var t=qe(e)?ee.call(e):"";return t==u||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return Be(e)?xe(e):function(e){if(!Ve(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Ee(e,!0,!0)}}));var Q=Object.prototype,X=Function.prototype.toString,Y=Q.hasOwnProperty,Z=X.call(Object),ee=Q.toString,te=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object);var re=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=ee.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=te(e);if(null===t)return!0;var r=Y.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&X.call(r)==Z};function ne(e){if(e.includes(".")){var t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(var r=t-1;r--;)if("."===e[r])return e.slice(r+1,t)}return null}function oe(e,t){return function e(t,r,o,i){var a,u=G(t),s=n({depth:-1,path:""},o);if(s.depth+=1,Array.isArray(u))for(var c=0,f=u.length;c<f&&!i.now;c++){var l=s.path?s.path+"."+c:""+c;void 0!==u[c]?(s.parent=G(u),s.parentType="array",s.parentKey=ne(l),a=e(r(u[c],void 0,n(n({},s),{},{path:l}),i),r,n(n({},s),{},{path:l}),i),Number.isNaN(a)&&c<u.length?(u.splice(c,1),c-=1):u[c]=a):u.splice(c,1)}else if(re(u))for(var y in u){if(i.now&&null!=y)break;var p=s.path?s.path+"."+y:y;0===s.depth&&null!=y&&(s.topmostKey=y),s.parent=G(u),s.parentType="object",s.parentKey=ne(p),a=e(r(y,u[y],n(n({},s),{},{path:p}),i),r,n(n({},s),{},{path:p}),i),Number.isNaN(a)?delete u[y]:u[y]=a}return u}(e,t,{},{now:!1})}var ie="__lodash_hash_undefined__",ae=9007199254740991,ue=/^\[object .+?Constructor\]$/,se="object"==typeof self&&self&&self.Object===Object&&self,ce="object"==typeof $&&$&&$.Object===Object&&$||se||Function("return this")();function fe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function le(e,t){return!!(e?e.length:0)&&function(e,t,r){if(t!=t)return function(e,t,r,n){var o=e.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,he,r);var n=r-1,o=e.length;for(;++n<o;)if(e[n]===t)return n;return-1}(e,t,0)>-1}function ye(e,t,r){for(var n=-1,o=e?e.length:0;++n<o;)if(r(t,e[n]))return!0;return!1}function pe(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}function he(e){return e!=e}function ge(e){return function(t){return e(t)}}function de(e,t){return e.has(t)}var ve,me=Array.prototype,be=Function.prototype,_e=Object.prototype,we=ce["__core-js_shared__"],je=(ve=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+ve:"",Oe=be.toString,Ae=_e.hasOwnProperty,Se=_e.toString,ke=RegExp("^"+Oe.call(Ae).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Te=me.splice,Pe=Math.max,xe=Math.min,Ie=$e(ce,"Map"),We=$e(Object,"create");function Ee(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ne(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Me(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function De(e){var t=-1,r=e?e.length:0;for(this.__data__=new Me;++t<r;)this.add(e[t])}function He(e,t){for(var r,n,o=e.length;o--;)if((r=e[o][0])===(n=t)||r!=r&&n!=n)return o;return-1}function Re(e){return!(!Ce(e)||function(e){return!!je&&je in e}(e))&&(Ve(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?ke:ue).test(function(e){if(null!=e){try{return Oe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Fe(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ae}(e.length)&&!Ve(e)}(e)}(e)?e:[]}function Le(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function $e(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Re(r)?r:void 0}function Ve(e){var t=Ce(e)?Se.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function Ce(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}Ee.prototype.clear=function(){this.__data__=We?We(null):{}},Ee.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ee.prototype.get=function(e){var t=this.__data__;if(We){var r=t[e];return r===ie?void 0:r}return Ae.call(t,e)?t[e]:void 0},Ee.prototype.has=function(e){var t=this.__data__;return We?void 0!==t[e]:Ae.call(t,e)},Ee.prototype.set=function(e,t){return this.__data__[e]=We&&void 0===t?ie:t,this},Ne.prototype.clear=function(){this.__data__=[]},Ne.prototype.delete=function(e){var t=this.__data__,r=He(t,e);return!(r<0)&&(r==t.length-1?t.pop():Te.call(t,r,1),!0)},Ne.prototype.get=function(e){var t=this.__data__,r=He(t,e);return r<0?void 0:t[r][1]},Ne.prototype.has=function(e){return He(this.__data__,e)>-1},Ne.prototype.set=function(e,t){var r=this.__data__,n=He(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Me.prototype.clear=function(){this.__data__={hash:new Ee,map:new(Ie||Ne),string:new Ee}},Me.prototype.delete=function(e){return Le(this,e).delete(e)},Me.prototype.get=function(e){return Le(this,e).get(e)},Me.prototype.has=function(e){return Le(this,e).has(e)},Me.prototype.set=function(e,t){return Le(this,e).set(e,t),this},De.prototype.add=De.prototype.push=function(e){return this.__data__.set(e,ie),this},De.prototype.has=function(e){return this.__data__.has(e)};var Je=function(e,t){return t=Pe(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=Pe(r.length-t,0),i=Array(o);++n<o;)i[n]=r[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=r[n];return a[t]=i,fe(e,this,a)}}((function(e){var t=pe(e,Fe);return t.length&&t[0]===e[0]?function(e,t,r){for(var n=r?ye:le,o=e[0].length,i=e.length,a=i,u=Array(i),s=1/0,c=[];a--;){var f=e[a];a&&t&&(f=pe(f,ge(t))),s=xe(f.length,s),u[a]=!r&&(t||o>=120&&f.length>=120)?new De(a&&f):void 0}f=e[0];var l=-1,y=u[0];e:for(;++l<o&&c.length<s;){var p=f[l],h=t?t(p):p;if(p=r||0!==p?p:0,!(y?de(y,h):n(c,h,r))){for(a=i;--a;){var g=u[a];if(!(g?de(g,h):n(e[a],h,r)))continue e}y&&y.push(h),c.push(p)}}return c}(t):[]}));function Ke(e){return"string"==typeof e?e.length?[e]:[]:e}var Be=V((function(e){e.exports=function(){var e=Object.prototype.toString;function t(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function r(e){if(!e)return!0;if(i(e)&&0===e.length)return!0;if("string"!=typeof e){for(var r in e)if(t(e,r))return!1;return!0}return!1}function n(t){return e.call(t)}function o(e){return"object"==typeof e&&"[object Object]"===n(e)}var i=Array.isArray||function(t){return"[object Array]"===e.call(t)};function a(e){return"boolean"==typeof e||"[object Boolean]"===n(e)}function u(e){var t=parseInt(e);return t.toString()===e?t:e}function s(e){var n,s=function e(t){return Object.keys(e).reduce((function(r,n){return"create"===n||"function"==typeof e[n]&&(r[n]=e[n].bind(e,t)),r}),{})};function c(e,t){if(n(e,t))return e[t]}function f(t,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return t;if("string"==typeof r)return f(t,r.split(".").map(u),n,o);var i=r[0],a=c(t,i);if(e.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw new Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(t[i]=n),a):(void 0===a&&(t[i]="number"==typeof r[1]?[]:{}),f(t[i],r.slice(1),n,o))}return n=(e=e||{}).includeInheritedProps?function(){return!0}:function(e,r){return"number"==typeof r&&Array.isArray(e)||t(e,r)},s.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;o<n.length;o++){var a=u(n[o]);if(!("number"==typeof a&&i(r)&&a<r.length||(e.includeInheritedProps?a in Object(r):t(r,a))))return!1;r=r[a]}return!0},s.ensureExists=function(e,t,r){return f(e,t,r,!0)},s.set=function(e,t,r,n){return f(e,t,r,n)},s.insert=function(e,t,r,n){var o=s.get(e,t);n=~~n,i(o)||s.set(e,t,o=[]),o.splice(n,0,r)},s.empty=function(e,t){var u,c;if(!r(t)&&null!=e&&(u=s.get(e,t))){if("string"==typeof u)return s.set(e,t,"");if(a(u))return s.set(e,t,!1);if("number"==typeof u)return s.set(e,t,0);if(i(u))u.length=0;else{if(!o(u))return s.set(e,t,null);for(c in u)n(u,c)&&delete u[c]}}},s.push=function(e,t){var r=s.get(e,t);i(r)||s.set(e,t,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},s.coalesce=function(e,t,r){for(var n,o=0,i=t.length;o<i;o++)if(void 0!==(n=s.get(e,t[o])))return n;return r},s.get=function(e,t,r){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return r;if("string"==typeof t)return s.get(e,t.split("."),r);var n=u(t[0]),o=c(e,n);return void 0===o?r:1===t.length?o:s.get(e[n],t.slice(1),r)},s.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(r(t))return e;if("string"==typeof t)return s.del(e,t.split("."));var o=u(t[0]);return n(e,o)?1!==t.length?s.del(e[o],t.slice(1)):(i(e)?e.splice(o,1):delete e[o],e):e},s}var c=s();return c.create=s,c.withInheritedProps=s({includeInheritedProps:!0}),c}()})),Ue=new Map;function ze(e,t){t=n({caseSensitive:!1},t);var r=e+JSON.stringify(t);if(Ue.has(r))return Ue.get(r);var o="!"===e[0];o&&(e=e.slice(1)),e=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e).replace(/\\\*/g,"[\\s\\S]*");var i=new RegExp("^"+e+"$",t.caseSensitive?"":"i");return i.negated=o,Ue.set(r,i),i}var qe=function(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Expected two arrays, got "+typeof e+" "+typeof t);if(0===t.length)return e;var n="!"===t[0][0];t=t.map((function(e){return ze(e,r)}));for(var o,a=[],u=i(e);!(o=u()).done;){for(var s,c=o.value,f=n,l=i(t);!(s=l()).done;){var y=s.value;y.test(c)&&(f=!y.negated)}f&&a.push(c)}return a};qe.isMatch=function(e,t,r){var n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];return n.some((function(e){return o.every((function(t){var n=ze(t,r),o=n.test(e);return n.negated?!o:o}))}))};var Ge={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function Qe(e,t,r){return function(e,t,r){function o(e){return null!=e}function i(e){return"Object"===C(e)}function a(e,t){return t=Ke(t),Array.from(e).filter((function(e){return!t.some((function(t){return qe.isMatch(e,t,{caseSensitive:!0})}))}))}var u=Object.prototype.hasOwnProperty,s=["any","anything","every","everything","all","whatever","whatevs"];if(!o(e))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");var c=n(n({},Ge),r);if(c.ignoreKeys=!o(c.ignoreKeys)||"string"!=typeof c.ignoreKeys&&!Array.isArray(c.ignoreKeys)?[]:Ke(c.ignoreKeys),c.ignorePaths=!o(c.ignorePaths)||"string"!=typeof c.ignorePaths&&!Array.isArray(c.ignorePaths)?[]:Ke(c.ignorePaths),c.acceptArraysIgnore=!o(c.acceptArraysIgnore)||"string"!=typeof c.acceptArraysIgnore&&!Array.isArray(c.acceptArraysIgnore)?[]:Ke(c.acceptArraysIgnore),c.msg=(""+c.msg).trim(),":"===c.msg[c.msg.length-1]&&(c.msg=c.msg.slice(0,c.msg.length-1).trim()),i(c.schema))Object.keys(c.schema).forEach((function(e){if(i(c.schema[e])){var t={};oe(c.schema[e],(function(r,n,o){var a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(t[e+"."+o.path]=a),a})),delete c.schema[e],c.schema=n(n({},c.schema),t)}})),Object.keys(c.schema).forEach((function(e){Array.isArray(c.schema[e])||(c.schema[e]=[c.schema[e]]),c.schema[e]=c.schema[e].map((function(e){return(""+e).toLowerCase().trim()}))}));else if(null!=c.schema)throw new Error("check-types-mini: opts.schema was customised to "+JSON.stringify(c.schema,null,0)+" which is not object but "+typeof c.schema);if(o(t)||(t={}),c.enforceStrictKeyset)if(o(c.schema)&&Object.keys(c.schema).length>0){if(t&&a(q(Object.keys(e),Object.keys(t).concat(Object.keys(c.schema))),c.ignoreKeys).length){var f=q(Object.keys(e),Object.keys(t).concat(Object.keys(c.schema)));throw new TypeError(c.msg+": "+c.optsVarName+".enforceStrictKeyset is on and the following key"+(f.length>1?"s":"")+" "+(f.length>1?"are":"is")+" not covered by schema and/or reference objects: "+f.join(", "))}}else{if(!(i(t)&&Object.keys(t).length>0))throw new TypeError(c.msg+": Both "+c.optsVarName+".schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!");if(0!==a(q(Object.keys(e),Object.keys(t)),c.ignoreKeys).length){var l=q(Object.keys(e),Object.keys(t));throw new TypeError(c.msg+": The input object has key"+(l.length>1?"s":"")+" which "+(l.length>1?"are":"is")+" not covered by the reference object: "+l.join(", "))}if(0!==a(q(Object.keys(t),Object.keys(e)),c.ignoreKeys).length){var y=q(Object.keys(t),Object.keys(e));throw new TypeError(c.msg+": The reference object has key"+(y.length>1?"s":"")+" which "+(y.length>1?"are":"is")+" not present in the input object: "+y.join(", "))}}var p=[];oe(e,(function(r,n,o){var a=n,f=r;if("array"===o.parentType&&(f=void 0,a=r),Array.isArray(p)&&p.length&&p.some((function(e){return o.path.startsWith(e)})))return a;if(f&&c.ignoreKeys.some((function(e){return qe.isMatch(f,e)})))return a;if(c.ignorePaths.some((function(e){return qe.isMatch(o.path,e)})))return a;var l=!(!i(a)&&!Array.isArray(a)&&Array.isArray(o.parent)),y=!1;i(c.schema)&&u.call(c.schema,o.path)&&(y=!0);var h=!1;if(i(t)&&Be.has(t,o.path)&&(h=!0),c.enforceStrictKeyset&&l&&!y&&!h)throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" is neither covered by reference object (second input argument), nor "+c.optsVarName+".schema! To stop this error, turn off "+c.optsVarName+".enforceStrictKeyset or provide some type reference (2nd argument or "+c.optsVarName+".schema).\n\nDebug info:\n\nobj = "+JSON.stringify(e,null,4)+"\n\nref = "+JSON.stringify(t,null,4)+"\n\ninnerObj = "+JSON.stringify(o,null,4)+"\n\nopts = "+JSON.stringify(c,null,4)+"\n\ncurrent = "+JSON.stringify(a,null,4)+"\n\n");if(y){var g=Ke(c.schema[o.path]).map((function(e){return(""+e).toLowerCase()}));if(Be.set(c.schema,o.path,g),Je(g,s).length)p.push(o.path);else if(!0!==a&&!1!==a&&!g.includes(C(a).toLowerCase())||(!0===a||!1===a)&&!g.includes(String(a))&&!g.includes("boolean")){if(!Array.isArray(a)||!c.acceptArrays)throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to "+("string"!==C(a)?'"':"")+JSON.stringify(a,null,0)+("string"!==C(a)?'"':"")+" (type: "+C(a).toLowerCase()+") which is not among the allowed types in schema (which is equal to "+JSON.stringify(g,null,0)+")");for(var d=0,v=a.length;d<v;d++)if(!g.includes(C(a[d]).toLowerCase()))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+"."+d+", the "+d+"th element (equal to "+JSON.stringify(a[d],null,0)+") is of a type "+C(a[d]).toLowerCase()+", but only the following are allowed by the "+c.optsVarName+".schema: "+g.join(", "))}}else if(t&&i(t)&&h){var m=Be.get(t,o.path);if(c.acceptArrays&&Array.isArray(a)&&!c.acceptArraysIgnore.includes(r)){if(!a.every((function(e){return C(e).toLowerCase()===C(t[r]).toLowerCase()})))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to be array, but not all of its elements are "+C(t[r]).toLowerCase()+"-type")}else if(C(a)!==C(m))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to "+("string"===C(a).toLowerCase()?"":'"')+JSON.stringify(a,null,0)+("string"===C(a).toLowerCase()?"":'"')+" which is not "+C(m).toLowerCase()+" but "+C(a).toLowerCase())}return a}))}(e,t,r)}function Xe(e){if("string"==typeof e)return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;var t=!0;return e=oe(e,(function(e,r,n,o){var i=void 0!==r?r:e;return"string"==typeof i&&i.trim()&&(t=!1,o.now=!0),i})),t}function Ye(e,t,r){var o,a,u,s,c=0,f=n(n({},{hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1}),r);if(f.hungryForWhitespace&&f.matchStrictly&&re(e)&&Xe(e)&&re(t)&&!Object.keys(t).length)return!0;if((!f.hungryForWhitespace||f.hungryForWhitespace&&!Xe(e)&&Xe(t))&&re(e)&&0!==Object.keys(e).length&&re(t)&&0===Object.keys(t).length||C(e)!==C(t)&&(!f.hungryForWhitespace||f.hungryForWhitespace&&!Xe(e)))return!1;if("string"==typeof e&&"string"==typeof t)return!!(f.hungryForWhitespace&&Xe(e)&&Xe(t))||(f.verboseWhenMismatches?e===t||"Given string "+t+" is not matched! We have "+e+" on the other end.":f.useWildcards?qe.isMatch(e,t,{caseSensitive:!0}):e===t);if(Array.isArray(e)&&Array.isArray(t)){if(f.hungryForWhitespace&&Xe(t)&&(!f.matchStrictly||f.matchStrictly&&e.length===t.length))return!0;if(!f.hungryForWhitespace&&t.length>e.length||f.matchStrictly&&t.length!==e.length)return!!f.verboseWhenMismatches&&"The length of a given array, "+JSON.stringify(t,null,4)+" is "+t.length+" but the length of an array on the other end, "+JSON.stringify(e,null,4)+" is "+e.length;if(0===t.length)return 0===e.length||!!f.verboseWhenMismatches&&"The given array has no elements, but the array on the other end, "+JSON.stringify(e,null,4)+" does have some";for(var l=0,y=t.length;l<y;l++){u=!1;for(var p=c,h=e.length;p<h;p++)if(c+=1,!0===Ye(e[p],t[l],f)){u=!0;break}if(!u)return!!f.verboseWhenMismatches&&"The given array "+JSON.stringify(t,null,4)+" is not a subset of an array on the other end, "+JSON.stringify(e,null,4)}}else{if(!re(e)||!re(t))return!(!(f.hungryForWhitespace&&Xe(e)&&Xe(t))||f.matchStrictly&&(!f.matchStrictly||(s=t,re(s)?Object.keys(s).length:!Array.isArray(s)&&"string"!=typeof s||s.length)))||e===t;if(o=new Set(Object.keys(t)),a=new Set(Object.keys(e)),f.matchStrictly&&o.size!==a.size){if(!f.verboseWhenMismatches)return!1;var g=new Set([].concat(o).filter((function(e){return!a.has(e)}))),d=g.size?" First object has unique keys: "+JSON.stringify(g,null,4)+".":"",v=new Set([].concat(a).filter((function(e){return!o.has(e)})));return"When matching strictly, we found that both objects have different amount of keys."+d+(v.size?" Second object has unique keys:\n        "+JSON.stringify(v,null,4)+".":"")}for(var m,b=function(){var r=m.value;if(!Object.prototype.hasOwnProperty.call(e,r))return!f.useWildcards||f.useWildcards&&!r.includes("*")?f.verboseWhenMismatches?{v:'The given object has key "'+r+'" which the other-one does not have.'}:{v:!1}:Object.keys(e).some((function(e){return qe.isMatch(e,r,{caseSensitive:!0})}))?{v:!0}:f.verboseWhenMismatches?{v:'The given object has key "'+r+'" which the other-one does not have.'}:{v:!1};if(null!=e[r]&&C(e[r])!==C(t[r])){if(!(Xe(e[r])&&Xe(t[r])&&f.hungryForWhitespace))return f.verboseWhenMismatches?{v:"The given key "+r+" is of a different type on both objects. On the first-one, it's "+C(t[r])+", on the second-one, it's "+C(e[r])}:{v:!1}}else if(!0!==Ye(e[r],t[r],f))return f.verboseWhenMismatches?{v:"The given piece "+JSON.stringify(t[r],null,4)+" and "+JSON.stringify(e[r],null,4)+" don't match."}:{v:!1}},_=i(o);!(m=_()).done;){var w=b();if("object"==typeof w)return w.v}}return!0}function Ze(e){return null!=e}function et(e){return void 0!==e}function tt(e,t){return typeof e==typeof t&&!!Ye(e,t,{matchStrictly:!0,useWildcards:!0})}function rt(e){return e&&"object"==typeof e&&!Array.isArray(e)}function nt(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/monkey(): [THROW_ID_01] Please provide an input");var r=n({},t),o={count:0,gatherPath:[],finding:null},i=[],a=!1,u=!1;Ze(r.key)&&!et(r.val)&&(a=!0),!Ze(r.key)&&et(r.val)&&(u=!0);var s=e;return"arrayFirstOnly"===r.mode&&Array.isArray(s)&&s.length>0&&(s=[s[0]]),s=oe(s,(function(e,t,n){var s;if(o.count+=1,o.gatherPath.length=n.depth,o.gatherPath.push(o.count),"get"===r.mode)o.count===r.index&&(et(t)?(o.finding={},o.finding[e]=t):o.finding=e);else if("find"===r.mode||"del"===r.mode){if(!("any"===r.only||"array"===r.only&&void 0===t||"object"===r.only&&void 0!==t)||!(a&&tt(e,r.key)||u&&tt(t,r.val)||!a&&!u&&tt(e,r.key)&&tt(t,r.val)))return void 0!==t?t:e;if("find"!==r.mode)return NaN;s={index:o.count,key:e,val:t,path:[].concat(o.gatherPath)},i.push(s)}return"set"===r.mode&&o.count===r.index?r.val:"drop"===r.mode&&o.count===r.index?NaN:"arrayFirstOnly"===r.mode?et(t)&&Array.isArray(t)?[t[0]]:Ze(e)&&Array.isArray(e)?[e[0]]:void 0!==t?t:e:void 0!==t?t:e})),"get"===r.mode?o.finding:"find"===r.mode?i.length>0?i:null:s}e.arrayFirstOnly=function(e){if(!Ze(e))throw new Error("ast-monkey/main.js/arrayFirstOnly(): [THROW_ID_31] Please provide the input");return nt(e,{mode:"arrayFirstOnly"})},e.del=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/del(): [THROW_ID_26] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/del(): [THROW_ID_27] Please provide the opts object");if(!Ze(t.key)&&!et(t.val))throw new Error("ast-monkey/main.js/del(): [THROW_ID_28] Please provide opts.key or opts.val");var r=n({},t);return Qe(r,null,{schema:{key:[null,"string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/drop(): [THROW_ID_29*]"}),r.only="string"==typeof r.only&&r.only.length>0?L(r.only,{msg:"ast-monkey/del(): [THROW_ID_30*]",optsVarName:"opts.only"}):"any",nt(e,n(n({},r),{},{mode:"del"}))},e.drop=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_19] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_20] Please provide the input");if(!Ze(t.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_21] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_23] opts.index must be a natural number. It was given as: "+r.index);return nt(e,n(n({},r),{},{mode:"drop"}))},e.find=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/find(): [THROW_ID_02] Please provide the input");if(!rt(t)||void 0===t.key&&void 0===t.val)throw new Error("ast-monkey/main.js/find(): [THROW_ID_03] Please provide opts.key or opts.val");var r=n({},t);return Qe(r,null,{schema:{key:["null","string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/get(): [THROW_ID_04*]"}),r.only="string"==typeof r.only&&r.only.length>0?L(r.only,{optsVarName:"opts.only",msg:"ast-monkey/find(): [THROW_ID_05*]"}):"any",nt(e,n(n({},r),{},{mode:"find"}))},e.get=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/get(): [THROW_ID_06] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/get(): [THROW_ID_07] Please provide the opts");if(!Ze(t.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_08] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_11] opts.index must be a natural number. It was given as: "+r.index+" (type "+typeof r.index+")");return nt(e,n(n({},r),{},{mode:"get"}))},e.set=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/set(): [THROW_ID_12] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/set(): [THROW_ID_13] Please provide the input");if(!Ze(t.key)&&!et(t.val))throw new Error("ast-monkey/main.js/set(): [THROW_ID_14] Please provide opts.val");if(!Ze(t.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_15] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_17] opts.index must be a natural number. It was given as: "+r.index);return Ze(r.key)&&!et(r.val)&&(r.val=r.key),Qe(r,null,{schema:{key:[null,"string"],val:"any",index:"number"},msg:"ast-monkey/set(): [THROW_ID_18*]"}),nt(e,n(n({},r),{},{mode:"set"}))},e.traverse=oe,e.version="7.12.1",Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).astMonkey={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){t(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var a=1/0,u=9007199254740991,s=17976931348623157e292,c=NaN,f="[object Arguments]",l="[object Function]",y="[object GeneratorFunction]",p="[object String]",h="[object Symbol]",g=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=/^(?:0|[1-9]\d*)$/,_=parseInt;function w(e){return e!=e}function j(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}(t,(function(t){return e[t]}))}var O,A,S=Object.prototype,k=S.hasOwnProperty,T=S.toString,P=S.propertyIsEnumerable,x=(O=Object.keys,A=Object,function(e){return O(A(e))}),I=Math.max;function W(e,t){var r=M(e)||function(e){return function(e){return R(e)&&D(e)}(e)&&k.call(e,"callee")&&(!P.call(e,"callee")||T.call(e)==f)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,o=!!n;for(var i in e)!t&&!k.call(e,i)||o&&("length"==i||N(i,n))||r.push(i);return r}function E(e){if((t=e)!==("function"==typeof(r=t&&t.constructor)&&r.prototype||S))return x(e);var t,r,n=[];for(var o in Object(e))k.call(e,o)&&"constructor"!=o&&n.push(o);return n}function N(e,t){return!!(t=null==t?u:t)&&("number"==typeof e||b.test(e))&&e>-1&&e%1==0&&e<t}var M=Array.isArray;function D(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}(e.length)&&!function(e){var t=H(e)?T.call(e):"";return t==l||t==y}(e)}function H(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}var F=function(e,t,r,n){var o;e=D(e)?e:(o=e)?j(o,function(e){return D(e)?W(e):E(e)}(o)):[],r=r&&!n?function(e){var t=function(e){if(!e)return 0===e?e:0;if((e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||R(e)&&T.call(e)==h}(e))return c;if(H(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=H(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(g,"");var r=v.test(e);return r||m.test(e)?_(e.slice(2),r?2:8):d.test(e)?c:+e}(e))===a||e===-1/0){return(e<0?-1:1)*s}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var i=e.length;return r<0&&(r=I(i+r,0)),function(e){return"string"==typeof e||!M(e)&&R(e)&&T.call(e)==p}(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,w,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}(e,t,r)>-1};function L(e,t){var r=n(n({},{msg:"",optsVarName:"given variable"}),t);if(r&&r.msg&&r.msg.length>0&&(r.msg=r.msg.trim()+" "),"given variable"!==r.optsVarName&&(r.optsVarName='variable "'+r.optsVarName+'"'),F(["object","objects","obj","ob","o"],e.toLowerCase().trim()))return"object";if(F(["array","arrays","arr","aray","arr","a"],e.toLowerCase().trim()))return"array";if(F(["any","all","everything","both","either","each","whatever","whatevs","e"],e.toLowerCase().trim()))return"any";throw new TypeError(r.msg+"The "+r.optsVarName+" was customised to an unrecognised value: "+e+". Please check it against the API documentation.")}var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var C=V((function(e,t){e.exports=function(){var e="function"==typeof Promise,t="object"==typeof self?self:$,r="undefined"!=typeof Symbol,n="undefined"!=typeof Map,o="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,a="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=r&&void 0!==Symbol.iterator,c=r&&void 0!==Symbol.toStringTag,f=o&&"function"==typeof Set.prototype.entries,l=n&&"function"==typeof Map.prototype.entries,y=f&&Object.getPrototypeOf((new Set).entries()),p=l&&Object.getPrototypeOf((new Map).entries()),h=s&&"function"==typeof Array.prototype[Symbol.iterator],g=h&&Object.getPrototypeOf([][Symbol.iterator]()),d=s&&"function"==typeof String.prototype[Symbol.iterator],v=d&&Object.getPrototypeOf(""[Symbol.iterator]()),m=8,b=-1;function _(r){var s=typeof r;if("object"!==s)return s;if(null===r)return"null";if(r===t)return"global";if(Array.isArray(r)&&(!1===c||!(Symbol.toStringTag in r)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&r===window.location)return"Location";if("object"==typeof window.document&&r===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&r===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&r===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&r instanceof window.HTMLElement){if("BLOCKQUOTE"===r.tagName)return"HTMLQuoteElement";if("TD"===r.tagName)return"HTMLTableDataCellElement";if("TH"===r.tagName)return"HTMLTableHeaderCellElement"}}var f=c&&r[Symbol.toStringTag];if("string"==typeof f)return f;var l=Object.getPrototypeOf(r);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":e&&l===Promise.prototype?"Promise":o&&l===Set.prototype?"Set":n&&l===Map.prototype?"Map":a&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":n&&l===p?"Map Iterator":o&&l===y?"Set Iterator":h&&l===g?"Array Iterator":d&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(r).slice(m,b)}return _}()}));function J(e,t,r){if(t!=t)return function(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,B,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}function K(e,t,r,n){for(var o=r-1,i=e.length;++o<i;)if(n(e[o],t))return o;return-1}function B(e){return e!=e}var U=Array.prototype.splice;function z(e,t,r,n){var o=n?K:J,i=-1,a=t.length,u=e;for(e===t&&(t=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(t)),r&&(u=function(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}(e,function(e){return function(t){return e(t)}}(r)));++i<a;)for(var s=0,c=t[i],f=r?r(c):c;(s=o(u,f,s,n))>-1;)u!==e&&U.call(u,s,1),U.call(e,s,1);return e}var q=function(e,t){return e&&e.length&&t&&t.length?z(e,t):e},G=V((function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",u="[object Function]",s="[object GeneratorFunction]",c="[object Map]",f="[object Number]",l="[object Object]",y="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",d="[object Symbol]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",_="[object Float32Array]",w="[object Float64Array]",j="[object Int8Array]",O="[object Int16Array]",A="[object Int32Array]",S="[object Uint8Array]",k="[object Uint8ClampedArray]",T="[object Uint16Array]",P="[object Uint32Array]",x=/\w*$/,I=/^\[object .+?Constructor\]$/,W=/^(?:0|[1-9]\d*)$/,E={};E[o]=E["[object Array]"]=E[m]=E[b]=E[i]=E[a]=E[_]=E[w]=E[j]=E[O]=E[A]=E[c]=E[f]=E[l]=E[p]=E[h]=E[g]=E[d]=E[S]=E[k]=E[T]=E[P]=!0,E["[object Error]"]=E[u]=E[v]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,M="object"==typeof $&&$&&$.Object===Object&&$||N||Function("return this")(),D=t&&!t.nodeType&&t,H=D&&e&&!e.nodeType&&e,R=H&&H.exports===D;function F(e,t){return e.set(t[0],t[1]),e}function L(e,t){return e.add(t),e}function V(e,t,r,n){var o=-1,i=e?e.length:0;for(n&&i&&(r=e[++o]);++o<i;)r=t(r,e[o],o,e);return r}function C(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function J(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function K(e,t){return function(r){return e(t(r))}}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var U,z=Array.prototype,q=Function.prototype,G=Object.prototype,Q=M["__core-js_shared__"],X=(U=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Y=q.toString,Z=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=R?M.Buffer:void 0,ne=M.Symbol,oe=M.Uint8Array,ie=K(Object.getPrototypeOf,Object),ae=Object.create,ue=G.propertyIsEnumerable,se=z.splice,ce=Object.getOwnPropertySymbols,fe=re?re.isBuffer:void 0,le=K(Object.keys,Object),ye=Re(M,"DataView"),pe=Re(M,"Map"),he=Re(M,"Promise"),ge=Re(M,"Set"),de=Re(M,"WeakMap"),ve=Re(Object,"create"),me=Ce(ye),be=Ce(pe),_e=Ce(he),we=Ce(ge),je=Ce(de),Oe=ne?ne.prototype:void 0,Ae=Oe?Oe.valueOf:void 0;function Se(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ke(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Pe(e){this.__data__=new ke(e)}function xe(e,t){var r=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Be(e)}(e)&&Z.call(e,"callee")&&(!ue.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var a in e)!t&&!Z.call(e,a)||i&&("length"==a||$e(a,n))||r.push(a);return r}function Ie(e,t,r){var n=e[t];Z.call(e,t)&&Je(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function We(e,t){for(var r=e.length;r--;)if(Je(e[r][0],t))return r;return-1}function Ee(e,t,r,n,y,v,I){var W;if(n&&(W=v?n(e,y,v,I):n(e)),void 0!==W)return W;if(!qe(e))return e;var N=Ke(e);if(N){if(W=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,W)}else{var M=Le(e),D=M==u||M==s;if(Ue(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(M==l||M==o||D&&!v){if(C(e))return v?e:{};if(W=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ie(e),qe(t)?ae(t):{});var t}(D?{}:e),!t)return function(e,t){return De(e,Fe(e),t)}(e,function(e,t){return e&&De(t,Ge(t),e)}(W,e))}else{if(!E[M])return v?e:{};W=function(e,t,r,n){var o=e.constructor;switch(t){case m:return Me(e);case i:case a:return new o(+e);case b:return function(e,t){var r=t?Me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case _:case w:case j:case O:case A:case S:case k:case T:case P:return function(e,t){var r=t?Me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case c:return function(e,t,r){return V(t?r(J(e),!0):J(e),F,new e.constructor)}(e,n,r);case f:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,x.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,r){return V(t?r(B(e),!0):B(e),L,new e.constructor)}(e,n,r);case d:return u=e,Ae?Object(Ae.call(u)):{}}var u}(e,M,Ee,t)}}I||(I=new Pe);var H=I.get(e);if(H)return H;if(I.set(e,W),!N)var R=r?function(e){return function(e,t,r){var n=t(e);return Ke(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,Ge,Fe)}(e):Ge(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(R||e,(function(o,i){R&&(o=e[i=o]),Ie(W,i,Ee(o,t,r,n,i,e,I))})),W}function Ne(e){return!(!qe(e)||function(e){return!!X&&X in e}(e))&&(ze(e)||C(e)?te:I).test(Ce(e))}function Me(e){var t=new e.constructor(e.byteLength);return new oe(t).set(new oe(e)),t}function De(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o<i;){var a=t[o],u=n?n(r[a],e[a],a,r,e):void 0;Ie(r,a,void 0===u?e[a]:u)}return r}function He(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ne(r)?r:void 0}Se.prototype.clear=function(){this.__data__=ve?ve(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ve){var n=t[e];return n===r?void 0:n}return Z.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},ke.prototype.clear=function(){this.__data__=[]},ke.prototype.delete=function(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():se.call(t,r,1),!0)},ke.prototype.get=function(e){var t=this.__data__,r=We(t,e);return r<0?void 0:t[r][1]},ke.prototype.has=function(e){return We(this.__data__,e)>-1},ke.prototype.set=function(e,t){var r=this.__data__,n=We(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Te.prototype.clear=function(){this.__data__={hash:new Se,map:new(pe||ke),string:new Se}},Te.prototype.delete=function(e){return He(this,e).delete(e)},Te.prototype.get=function(e){return He(this,e).get(e)},Te.prototype.has=function(e){return He(this,e).has(e)},Te.prototype.set=function(e,t){return He(this,e).set(e,t),this},Pe.prototype.clear=function(){this.__data__=new ke},Pe.prototype.delete=function(e){return this.__data__.delete(e)},Pe.prototype.get=function(e){return this.__data__.get(e)},Pe.prototype.has=function(e){return this.__data__.has(e)},Pe.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ke){var n=r.__data__;if(!pe||n.length<199)return n.push([e,t]),this;r=this.__data__=new Te(n)}return r.set(e,t),this};var Fe=ce?K(ce,Object):function(){return[]},Le=function(e){return ee.call(e)};function $e(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||W.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function Ce(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Je(e,t){return e===t||e!=e&&t!=t}(ye&&Le(new ye(new ArrayBuffer(1)))!=b||pe&&Le(new pe)!=c||he&&Le(he.resolve())!=y||ge&&Le(new ge)!=h||de&&Le(new de)!=v)&&(Le=function(e){var t=ee.call(e),r=t==l?e.constructor:void 0,n=r?Ce(r):void 0;if(n)switch(n){case me:return b;case be:return c;case _e:return y;case we:return h;case je:return v}return t});var Ke=Array.isArray;function Be(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!ze(e)}var Ue=fe||function(){return!1};function ze(e){var t=qe(e)?ee.call(e):"";return t==u||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return Be(e)?xe(e):function(e){if(!Ve(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Ee(e,!0,!0)}}));var Q=Object.prototype,X=Function.prototype.toString,Y=Q.hasOwnProperty,Z=X.call(Object),ee=Q.toString,te=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object);var re=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=ee.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=te(e);if(null===t)return!0;var r=Y.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&X.call(r)==Z};function ne(e){if(e.includes(".")){var t=e.lastIndexOf(".");if(!e.slice(0,t).includes("."))return e.slice(0,t);for(var r=t-1;r--;)if("."===e[r])return e.slice(r+1,t)}return null}function oe(e,t){return function e(t,r,o,i){var a,u=G(t),s=n({depth:-1,path:""},o);if(s.depth+=1,Array.isArray(u))for(var c=0,f=u.length;c<f&&!i.now;c++){var l=s.path?s.path+"."+c:""+c;void 0!==u[c]?(s.parent=G(u),s.parentType="array",s.parentKey=ne(l),a=e(r(u[c],void 0,n(n({},s),{},{path:l}),i),r,n(n({},s),{},{path:l}),i),Number.isNaN(a)&&c<u.length?(u.splice(c,1),c-=1):u[c]=a):u.splice(c,1)}else if(re(u))for(var y in u){if(i.now&&null!=y)break;var p=s.path?s.path+"."+y:y;0===s.depth&&null!=y&&(s.topmostKey=y),s.parent=G(u),s.parentType="object",s.parentKey=ne(p),a=e(r(y,u[y],n(n({},s),{},{path:p}),i),r,n(n({},s),{},{path:p}),i),Number.isNaN(a)?delete u[y]:u[y]=a}return u}(e,t,{},{now:!1})}var ie="__lodash_hash_undefined__",ae=9007199254740991,ue=/^\[object .+?Constructor\]$/,se="object"==typeof self&&self&&self.Object===Object&&self,ce="object"==typeof $&&$&&$.Object===Object&&$||se||Function("return this")();function fe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function le(e,t){return!!(e?e.length:0)&&function(e,t,r){if(t!=t)return function(e,t,r,n){var o=e.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}(e,he,r);var n=r-1,o=e.length;for(;++n<o;)if(e[n]===t)return n;return-1}(e,t,0)>-1}function ye(e,t,r){for(var n=-1,o=e?e.length:0;++n<o;)if(r(t,e[n]))return!0;return!1}function pe(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}function he(e){return e!=e}function ge(e){return function(t){return e(t)}}function de(e,t){return e.has(t)}var ve,me=Array.prototype,be=Function.prototype,_e=Object.prototype,we=ce["__core-js_shared__"],je=(ve=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+ve:"",Oe=be.toString,Ae=_e.hasOwnProperty,Se=_e.toString,ke=RegExp("^"+Oe.call(Ae).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Te=me.splice,Pe=Math.max,xe=Math.min,Ie=$e(ce,"Map"),We=$e(Object,"create");function Ee(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ne(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Me(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function De(e){var t=-1,r=e?e.length:0;for(this.__data__=new Me;++t<r;)this.add(e[t])}function He(e,t){for(var r,n,o=e.length;o--;)if((r=e[o][0])===(n=t)||r!=r&&n!=n)return o;return-1}function Re(e){return!(!Ce(e)||function(e){return!!je&&je in e}(e))&&(Ve(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?ke:ue).test(function(e){if(null!=e){try{return Oe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function Fe(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=ae}(e.length)&&!Ve(e)}(e)}(e)?e:[]}function Le(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function $e(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Re(r)?r:void 0}function Ve(e){var t=Ce(e)?Se.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}function Ce(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}Ee.prototype.clear=function(){this.__data__=We?We(null):{}},Ee.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ee.prototype.get=function(e){var t=this.__data__;if(We){var r=t[e];return r===ie?void 0:r}return Ae.call(t,e)?t[e]:void 0},Ee.prototype.has=function(e){var t=this.__data__;return We?void 0!==t[e]:Ae.call(t,e)},Ee.prototype.set=function(e,t){return this.__data__[e]=We&&void 0===t?ie:t,this},Ne.prototype.clear=function(){this.__data__=[]},Ne.prototype.delete=function(e){var t=this.__data__,r=He(t,e);return!(r<0)&&(r==t.length-1?t.pop():Te.call(t,r,1),!0)},Ne.prototype.get=function(e){var t=this.__data__,r=He(t,e);return r<0?void 0:t[r][1]},Ne.prototype.has=function(e){return He(this.__data__,e)>-1},Ne.prototype.set=function(e,t){var r=this.__data__,n=He(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Me.prototype.clear=function(){this.__data__={hash:new Ee,map:new(Ie||Ne),string:new Ee}},Me.prototype.delete=function(e){return Le(this,e).delete(e)},Me.prototype.get=function(e){return Le(this,e).get(e)},Me.prototype.has=function(e){return Le(this,e).has(e)},Me.prototype.set=function(e,t){return Le(this,e).set(e,t),this},De.prototype.add=De.prototype.push=function(e){return this.__data__.set(e,ie),this},De.prototype.has=function(e){return this.__data__.has(e)};var Je=function(e,t){return t=Pe(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=Pe(r.length-t,0),i=Array(o);++n<o;)i[n]=r[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=r[n];return a[t]=i,fe(e,this,a)}}((function(e){var t=pe(e,Fe);return t.length&&t[0]===e[0]?function(e,t,r){for(var n=r?ye:le,o=e[0].length,i=e.length,a=i,u=Array(i),s=1/0,c=[];a--;){var f=e[a];a&&t&&(f=pe(f,ge(t))),s=xe(f.length,s),u[a]=!r&&(t||o>=120&&f.length>=120)?new De(a&&f):void 0}f=e[0];var l=-1,y=u[0];e:for(;++l<o&&c.length<s;){var p=f[l],h=t?t(p):p;if(p=r||0!==p?p:0,!(y?de(y,h):n(c,h,r))){for(a=i;--a;){var g=u[a];if(!(g?de(g,h):n(e[a],h,r)))continue e}y&&y.push(h),c.push(p)}}return c}(t):[]}));function Ke(e){return"string"==typeof e?e.length?[e]:[]:e}var Be=V((function(e){e.exports=function(){var e=Object.prototype.toString;function t(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function r(e){if(!e)return!0;if(i(e)&&0===e.length)return!0;if("string"!=typeof e){for(var r in e)if(t(e,r))return!1;return!0}return!1}function n(t){return e.call(t)}function o(e){return"object"==typeof e&&"[object Object]"===n(e)}var i=Array.isArray||function(t){return"[object Array]"===e.call(t)};function a(e){return"boolean"==typeof e||"[object Boolean]"===n(e)}function u(e){var t=parseInt(e);return t.toString()===e?t:e}function s(e){var n,s=function e(t){return Object.keys(e).reduce((function(r,n){return"create"===n||"function"==typeof e[n]&&(r[n]=e[n].bind(e,t)),r}),{})};function c(e,t){if(n(e,t))return e[t]}function f(t,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return t;if("string"==typeof r)return f(t,r.split(".").map(u),n,o);var i=r[0],a=c(t,i);if(e.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw new Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(t[i]=n),a):(void 0===a&&(t[i]="number"==typeof r[1]?[]:{}),f(t[i],r.slice(1),n,o))}return n=(e=e||{}).includeInheritedProps?function(){return!0}:function(e,r){return"number"==typeof r&&Array.isArray(e)||t(e,r)},s.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;o<n.length;o++){var a=u(n[o]);if(!("number"==typeof a&&i(r)&&a<r.length||(e.includeInheritedProps?a in Object(r):t(r,a))))return!1;r=r[a]}return!0},s.ensureExists=function(e,t,r){return f(e,t,r,!0)},s.set=function(e,t,r,n){return f(e,t,r,n)},s.insert=function(e,t,r,n){var o=s.get(e,t);n=~~n,i(o)||s.set(e,t,o=[]),o.splice(n,0,r)},s.empty=function(e,t){var u,c;if(!r(t)&&null!=e&&(u=s.get(e,t))){if("string"==typeof u)return s.set(e,t,"");if(a(u))return s.set(e,t,!1);if("number"==typeof u)return s.set(e,t,0);if(i(u))u.length=0;else{if(!o(u))return s.set(e,t,null);for(c in u)n(u,c)&&delete u[c]}}},s.push=function(e,t){var r=s.get(e,t);i(r)||s.set(e,t,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},s.coalesce=function(e,t,r){for(var n,o=0,i=t.length;o<i;o++)if(void 0!==(n=s.get(e,t[o])))return n;return r},s.get=function(e,t,r){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return r;if("string"==typeof t)return s.get(e,t.split("."),r);var n=u(t[0]),o=c(e,n);return void 0===o?r:1===t.length?o:s.get(e[n],t.slice(1),r)},s.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(r(t))return e;if("string"==typeof t)return s.del(e,t.split("."));var o=u(t[0]);return n(e,o)?1!==t.length?s.del(e[o],t.slice(1)):(i(e)?e.splice(o,1):delete e[o],e):e},s}var c=s();return c.create=s,c.withInheritedProps=s({includeInheritedProps:!0}),c}()})),Ue=new Map;function ze(e,t){t=n({caseSensitive:!1},t);var r=e+JSON.stringify(t);if(Ue.has(r))return Ue.get(r);var o="!"===e[0];o&&(e=e.slice(1)),e=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e).replace(/\\\*/g,"[\\s\\S]*");var i=new RegExp("^"+e+"$",t.caseSensitive?"":"i");return i.negated=o,Ue.set(r,i),i}var qe=function(e,t,r){if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Expected two arrays, got "+typeof e+" "+typeof t);if(0===t.length)return e;var n="!"===t[0][0];t=t.map((function(e){return ze(e,r)}));for(var o,a=[],u=i(e);!(o=u()).done;){for(var s,c=o.value,f=n,l=i(t);!(s=l()).done;){var y=s.value;y.test(c)&&(f=!y.negated)}f&&a.push(c)}return a};qe.isMatch=function(e,t,r){var n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];return n.some((function(e){return o.every((function(t){var n=ze(t,r),o=n.test(e);return n.negated?!o:o}))}))};var Ge={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function Qe(e,t,r){return function(e,t,r){function o(e){return null!=e}function i(e){return"Object"===C(e)}function a(e,t){return t=Ke(t),Array.from(e).filter((function(e){return!t.some((function(t){return qe.isMatch(e,t,{caseSensitive:!0})}))}))}var u=Object.prototype.hasOwnProperty,s=["any","anything","every","everything","all","whatever","whatevs"];if(!o(e))throw new Error("check-types-mini: [THROW_ID_01] First argument is missing!");var c=n(n({},Ge),r);if(c.ignoreKeys=!o(c.ignoreKeys)||"string"!=typeof c.ignoreKeys&&!Array.isArray(c.ignoreKeys)?[]:Ke(c.ignoreKeys),c.ignorePaths=!o(c.ignorePaths)||"string"!=typeof c.ignorePaths&&!Array.isArray(c.ignorePaths)?[]:Ke(c.ignorePaths),c.acceptArraysIgnore=!o(c.acceptArraysIgnore)||"string"!=typeof c.acceptArraysIgnore&&!Array.isArray(c.acceptArraysIgnore)?[]:Ke(c.acceptArraysIgnore),c.msg=(""+c.msg).trim(),":"===c.msg[c.msg.length-1]&&(c.msg=c.msg.slice(0,c.msg.length-1).trim()),i(c.schema))Object.keys(c.schema).forEach((function(e){if(i(c.schema[e])){var t={};oe(c.schema[e],(function(r,n,o){var a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(t[e+"."+o.path]=a),a})),delete c.schema[e],c.schema=n(n({},c.schema),t)}})),Object.keys(c.schema).forEach((function(e){Array.isArray(c.schema[e])||(c.schema[e]=[c.schema[e]]),c.schema[e]=c.schema[e].map((function(e){return(""+e).toLowerCase().trim()}))}));else if(null!=c.schema)throw new Error("check-types-mini: opts.schema was customised to "+JSON.stringify(c.schema,null,0)+" which is not object but "+typeof c.schema);if(o(t)||(t={}),c.enforceStrictKeyset)if(o(c.schema)&&Object.keys(c.schema).length>0){if(t&&a(q(Object.keys(e),Object.keys(t).concat(Object.keys(c.schema))),c.ignoreKeys).length){var f=q(Object.keys(e),Object.keys(t).concat(Object.keys(c.schema)));throw new TypeError(c.msg+": "+c.optsVarName+".enforceStrictKeyset is on and the following key"+(f.length>1?"s":"")+" "+(f.length>1?"are":"is")+" not covered by schema and/or reference objects: "+f.join(", "))}}else{if(!(i(t)&&Object.keys(t).length>0))throw new TypeError(c.msg+": Both "+c.optsVarName+".schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!");if(0!==a(q(Object.keys(e),Object.keys(t)),c.ignoreKeys).length){var l=q(Object.keys(e),Object.keys(t));throw new TypeError(c.msg+": The input object has key"+(l.length>1?"s":"")+" which "+(l.length>1?"are":"is")+" not covered by the reference object: "+l.join(", "))}if(0!==a(q(Object.keys(t),Object.keys(e)),c.ignoreKeys).length){var y=q(Object.keys(t),Object.keys(e));throw new TypeError(c.msg+": The reference object has key"+(y.length>1?"s":"")+" which "+(y.length>1?"are":"is")+" not present in the input object: "+y.join(", "))}}var p=[];oe(e,(function(r,n,o){var a=n,f=r;if("array"===o.parentType&&(f=void 0,a=r),Array.isArray(p)&&p.length&&p.some((function(e){return o.path.startsWith(e)})))return a;if(f&&c.ignoreKeys.some((function(e){return qe.isMatch(f,e)})))return a;if(c.ignorePaths.some((function(e){return qe.isMatch(o.path,e)})))return a;var l=!(!i(a)&&!Array.isArray(a)&&Array.isArray(o.parent)),y=!1;i(c.schema)&&u.call(c.schema,o.path)&&(y=!0);var h=!1;if(i(t)&&Be.has(t,o.path)&&(h=!0),c.enforceStrictKeyset&&l&&!y&&!h)throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" is neither covered by reference object (second input argument), nor "+c.optsVarName+".schema! To stop this error, turn off "+c.optsVarName+".enforceStrictKeyset or provide some type reference (2nd argument or "+c.optsVarName+".schema).\n\nDebug info:\n\nobj = "+JSON.stringify(e,null,4)+"\n\nref = "+JSON.stringify(t,null,4)+"\n\ninnerObj = "+JSON.stringify(o,null,4)+"\n\nopts = "+JSON.stringify(c,null,4)+"\n\ncurrent = "+JSON.stringify(a,null,4)+"\n\n");if(y){var g=Ke(c.schema[o.path]).map((function(e){return(""+e).toLowerCase()}));if(Be.set(c.schema,o.path,g),Je(g,s).length)p.push(o.path);else if(!0!==a&&!1!==a&&!g.includes(C(a).toLowerCase())||(!0===a||!1===a)&&!g.includes(String(a))&&!g.includes("boolean")){if(!Array.isArray(a)||!c.acceptArrays)throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to "+("string"!==C(a)?'"':"")+JSON.stringify(a,null,0)+("string"!==C(a)?'"':"")+" (type: "+C(a).toLowerCase()+") which is not among the allowed types in schema (which is equal to "+JSON.stringify(g,null,0)+")");for(var d=0,v=a.length;d<v;d++)if(!g.includes(C(a[d]).toLowerCase()))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+"."+d+", the "+d+"th element (equal to "+JSON.stringify(a[d],null,0)+") is of a type "+C(a[d]).toLowerCase()+", but only the following are allowed by the "+c.optsVarName+".schema: "+g.join(", "))}}else if(t&&i(t)&&h){var m=Be.get(t,o.path);if(c.acceptArrays&&Array.isArray(a)&&!c.acceptArraysIgnore.includes(r)){if(!a.every((function(e){return C(e).toLowerCase()===C(t[r]).toLowerCase()})))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to be array, but not all of its elements are "+C(t[r]).toLowerCase()+"-type")}else if(C(a)!==C(m))throw new TypeError(c.msg+": "+c.optsVarName+"."+o.path+" was customised to "+("string"===C(a).toLowerCase()?"":'"')+JSON.stringify(a,null,0)+("string"===C(a).toLowerCase()?"":'"')+" which is not "+C(m).toLowerCase()+" but "+C(a).toLowerCase())}return a}))}(e,t,r)}function Xe(e){if("string"==typeof e)return!e.trim();if(!["object","string"].includes(typeof e)||!e)return!1;var t=!0;return e=oe(e,(function(e,r,n,o){var i=void 0!==r?r:e;return"string"==typeof i&&i.trim()&&(t=!1,o.now=!0),i})),t}function Ye(e,t,r){var o,a,u,s,c=0,f=n(n({},{hungryForWhitespace:!1,matchStrictly:!1,verboseWhenMismatches:!1,useWildcards:!1}),r);if(f.hungryForWhitespace&&f.matchStrictly&&re(e)&&Xe(e)&&re(t)&&!Object.keys(t).length)return!0;if((!f.hungryForWhitespace||f.hungryForWhitespace&&!Xe(e)&&Xe(t))&&re(e)&&0!==Object.keys(e).length&&re(t)&&0===Object.keys(t).length||C(e)!==C(t)&&(!f.hungryForWhitespace||f.hungryForWhitespace&&!Xe(e)))return!1;if("string"==typeof e&&"string"==typeof t)return!!(f.hungryForWhitespace&&Xe(e)&&Xe(t))||(f.verboseWhenMismatches?e===t||"Given string "+t+" is not matched! We have "+e+" on the other end.":f.useWildcards?qe.isMatch(e,t,{caseSensitive:!0}):e===t);if(Array.isArray(e)&&Array.isArray(t)){if(f.hungryForWhitespace&&Xe(t)&&(!f.matchStrictly||f.matchStrictly&&e.length===t.length))return!0;if(!f.hungryForWhitespace&&t.length>e.length||f.matchStrictly&&t.length!==e.length)return!!f.verboseWhenMismatches&&"The length of a given array, "+JSON.stringify(t,null,4)+" is "+t.length+" but the length of an array on the other end, "+JSON.stringify(e,null,4)+" is "+e.length;if(0===t.length)return 0===e.length||!!f.verboseWhenMismatches&&"The given array has no elements, but the array on the other end, "+JSON.stringify(e,null,4)+" does have some";for(var l=0,y=t.length;l<y;l++){u=!1;for(var p=c,h=e.length;p<h;p++)if(c+=1,!0===Ye(e[p],t[l],f)){u=!0;break}if(!u)return!!f.verboseWhenMismatches&&"The given array "+JSON.stringify(t,null,4)+" is not a subset of an array on the other end, "+JSON.stringify(e,null,4)}}else{if(!re(e)||!re(t))return!(!(f.hungryForWhitespace&&Xe(e)&&Xe(t))||f.matchStrictly&&(!f.matchStrictly||(s=t,re(s)?Object.keys(s).length:!Array.isArray(s)&&"string"!=typeof s||s.length)))||e===t;if(o=new Set(Object.keys(t)),a=new Set(Object.keys(e)),f.matchStrictly&&o.size!==a.size){if(!f.verboseWhenMismatches)return!1;var g=new Set([].concat(o).filter((function(e){return!a.has(e)}))),d=g.size?" First object has unique keys: "+JSON.stringify(g,null,4)+".":"",v=new Set([].concat(a).filter((function(e){return!o.has(e)})));return"When matching strictly, we found that both objects have different amount of keys."+d+(v.size?" Second object has unique keys:\n        "+JSON.stringify(v,null,4)+".":"")}for(var m,b=function(){var r=m.value;if(!Object.prototype.hasOwnProperty.call(e,r))return!f.useWildcards||f.useWildcards&&!r.includes("*")?f.verboseWhenMismatches?{v:'The given object has key "'+r+'" which the other-one does not have.'}:{v:!1}:Object.keys(e).some((function(e){return qe.isMatch(e,r,{caseSensitive:!0})}))?{v:!0}:f.verboseWhenMismatches?{v:'The given object has key "'+r+'" which the other-one does not have.'}:{v:!1};if(null!=e[r]&&C(e[r])!==C(t[r])){if(!(Xe(e[r])&&Xe(t[r])&&f.hungryForWhitespace))return f.verboseWhenMismatches?{v:"The given key "+r+" is of a different type on both objects. On the first-one, it's "+C(t[r])+", on the second-one, it's "+C(e[r])}:{v:!1}}else if(!0!==Ye(e[r],t[r],f))return f.verboseWhenMismatches?{v:"The given piece "+JSON.stringify(t[r],null,4)+" and "+JSON.stringify(e[r],null,4)+" don't match."}:{v:!1}},_=i(o);!(m=_()).done;){var w=b();if("object"==typeof w)return w.v}}return!0}function Ze(e){return null!=e}function et(e){return void 0!==e}function tt(e,t){return typeof e==typeof t&&!!Ye(e,t,{matchStrictly:!0,useWildcards:!0})}function rt(e){return e&&"object"==typeof e&&!Array.isArray(e)}function nt(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/monkey(): [THROW_ID_01] Please provide an input");var r=n({},t),o={count:0,gatherPath:[],finding:null},i=[],a=!1,u=!1;Ze(r.key)&&!et(r.val)&&(a=!0),!Ze(r.key)&&et(r.val)&&(u=!0);var s=e;return"arrayFirstOnly"===r.mode&&Array.isArray(s)&&s.length>0&&(s=[s[0]]),s=oe(s,(function(e,t,n){var s;if(o.count+=1,o.gatherPath.length=n.depth,o.gatherPath.push(o.count),"get"===r.mode)o.count===r.index&&(et(t)?(o.finding={},o.finding[e]=t):o.finding=e);else if("find"===r.mode||"del"===r.mode){if(!("any"===r.only||"array"===r.only&&void 0===t||"object"===r.only&&void 0!==t)||!(a&&tt(e,r.key)||u&&tt(t,r.val)||!a&&!u&&tt(e,r.key)&&tt(t,r.val)))return void 0!==t?t:e;if("find"!==r.mode)return NaN;s={index:o.count,key:e,val:t,path:[].concat(o.gatherPath)},i.push(s)}return"set"===r.mode&&o.count===r.index?r.val:"drop"===r.mode&&o.count===r.index?NaN:"arrayFirstOnly"===r.mode?et(t)&&Array.isArray(t)?[t[0]]:Ze(e)&&Array.isArray(e)?[e[0]]:void 0!==t?t:e:void 0!==t?t:e})),"get"===r.mode?o.finding:"find"===r.mode?i:s}e.arrayFirstOnly=function(e){if(!Ze(e))throw new Error("ast-monkey/main.js/arrayFirstOnly(): [THROW_ID_31] Please provide the input");return nt(e,{mode:"arrayFirstOnly"})},e.del=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/del(): [THROW_ID_26] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/del(): [THROW_ID_27] Please provide the opts object");if(!Ze(t.key)&&!et(t.val))throw new Error("ast-monkey/main.js/del(): [THROW_ID_28] Please provide opts.key or opts.val");var r=n({},t);return Qe(r,null,{schema:{key:[null,"string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/drop(): [THROW_ID_29*]"}),r.only="string"==typeof r.only&&r.only.length>0?L(r.only,{msg:"ast-monkey/del(): [THROW_ID_30*]",optsVarName:"opts.only"}):"any",nt(e,n(n({},r),{},{mode:"del"}))},e.drop=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_19] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_20] Please provide the input");if(!Ze(t.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_21] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/drop(): [THROW_ID_23] opts.index must be a natural number. It was given as: "+r.index);return nt(e,n(n({},r),{},{mode:"drop"}))},e.find=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/find(): [THROW_ID_02] Please provide the input");if(!rt(t)||void 0===t.key&&void 0===t.val)throw new Error("ast-monkey/main.js/find(): [THROW_ID_03] Please provide opts.key or opts.val");var r=n({},t);return Qe(r,null,{schema:{key:["null","string"],val:"any",only:["undefined","null","string"]},msg:"ast-monkey/get(): [THROW_ID_04*]"}),r.only="string"==typeof r.only&&r.only.length>0?L(r.only,{optsVarName:"opts.only",msg:"ast-monkey/find(): [THROW_ID_05*]"}):"any",nt(e,n(n({},r),{},{mode:"find"}))},e.get=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/get(): [THROW_ID_06] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/get(): [THROW_ID_07] Please provide the opts");if(!Ze(t.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_08] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/get(): [THROW_ID_11] opts.index must be a natural number. It was given as: "+r.index+" (type "+typeof r.index+")");return nt(e,n(n({},r),{},{mode:"get"}))},e.set=function(e,t){if(!Ze(e))throw new Error("ast-monkey/main.js/set(): [THROW_ID_12] Please provide the input");if(!rt(t))throw new Error("ast-monkey/main.js/set(): [THROW_ID_13] Please provide the input");if(!Ze(t.key)&&!et(t.val))throw new Error("ast-monkey/main.js/set(): [THROW_ID_14] Please provide opts.val");if(!Ze(t.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_15] Please provide opts.index");var r=n({},t);if("string"==typeof r.index&&/^\d*$/.test(r.index))r.index=+r.index;else if(!Number.isInteger(r.index))throw new Error("ast-monkey/main.js/set(): [THROW_ID_17] opts.index must be a natural number. It was given as: "+r.index);return Ze(r.key)&&!et(r.val)&&(r.val=r.key),Qe(r,null,{schema:{key:[null,"string"],val:"any",index:"number"},msg:"ast-monkey/set(): [THROW_ID_18*]"}),nt(e,n(n({},r),{},{mode:"set"}))},e.traverse=oe,e.version="7.12.1",Object.defineProperty(e,"__esModule",{value:!0})}));

M packages/ast-monkey/src/main.ts => packages/ast-monkey/src/main.ts +13 -17
@@ 14,6 14,12 @@ interface InternalOpts {
  index?: number;
  mode: "find" | "get" | "set" | "drop" | "del" | "arrayFirstOnly";
}
interface Finding {
  index: number;
  key: string;
  val: any;
  path: number[];
}
function existy(x: any): boolean {
  return x != null;
}


@@ 56,12 62,6 @@ function monkey(originalInput: JsonValue, originalOpts: InternalOpts) {
  }
  const data: Data = { count: 0, gatherPath: [], finding: null };

  interface Finding {
    index: number;
    key: string;
    val: any;
    path: number[];
  }
  const findings: Finding[] = [];

  let ko = false; // key only


@@ 153,7 153,7 @@ function monkey(originalInput: JsonValue, originalOpts: InternalOpts) {
    return data.finding;
  }
  if (opts.mode === "find") {
    return findings.length > 0 ? findings : null;
    return findings;
  }
  return input;
}


@@ 164,9 164,9 @@ function monkey(originalInput: JsonValue, originalOpts: InternalOpts) {
interface FindOpts {
  key: null | string;
  val: any;
  only: undefined | null | "any" | "array" | "object";
  only?: undefined | null | "any" | "array" | "object";
}
function find(input: JsonValue, originalOpts: FindOpts): null | number[] {
function find(input: JsonValue, originalOpts: FindOpts): Finding[] {
  if (!existy(input)) {
    throw new Error(
      "ast-monkey/main.js/find(): [THROW_ID_02] Please provide the input"


@@ 201,10 201,8 @@ function find(input: JsonValue, originalOpts: FindOpts): null | number[] {
}

interface GetOpts {
  key: null | string;
  val: any;
  index: number; // obligatory for get()
  only: undefined | null | "any" | "array" | "object";
  only?: undefined | null | "any" | "array" | "object";
}
function get(input: JsonValue, originalOpts: GetOpts): GetOpts {
  if (!existy(input)) {


@@ 239,7 237,7 @@ interface SetOpts {
  key: null | string;
  val: any;
  index: number; // obligatory for get()
  only: undefined | null | "any" | "array" | "object";
  only?: undefined | null | "any" | "array" | "object";
}
function set(input: JsonValue, originalOpts: SetOpts): JsonValue {
  if (!existy(input)) {


@@ 285,10 283,8 @@ function set(input: JsonValue, originalOpts: SetOpts): JsonValue {
}

interface DropOpts {
  key: null | string;
  val: any;
  index: number; // obligatory for get()
  only: undefined | null | "any" | "array" | "object";
  only?: undefined | null | "any" | "array" | "object";
}
function drop(input: JsonValue, originalOpts: DropOpts): JsonValue {
  if (!existy(input)) {


@@ 320,7 316,7 @@ function drop(input: JsonValue, originalOpts: DropOpts): JsonValue {
interface DelOpts {
  key: null | string;
  val: any;
  only: undefined | null | "any" | "array" | "object";
  only?: undefined | null | "any" | "array" | "object";
}
function del(input: JsonValue, originalOpts: DelOpts): JsonValue {
  if (!existy(input)) {

M packages/ast-monkey/test/find.js => packages/ast-monkey/test/find.js +9 -17
@@ 39,11 39,7 @@ tap.test("01.pt1 - finds by key in a simple object #1", (t) => {
  t.strictSame(find(input, { key: "a" }), intended, "01.02");

  // null would mean actual null being there (which is not), so it's not going to find any:
  t.strictSame(
    find(input, { key: "a", val: null }),
    null, // <---- !!!! null means no findings !!!!
    "01.03"
  );
  t.strictSame(find(input, { key: "a", val: null }), [], "01.03");
  t.end();
});



@@ 83,11 79,7 @@ tap.test("02.pt2 - finds by key in a simple object, with glob", (t) => {
  t.strictSame(find(input, { key: "a*" }), intended, "02.02");

  // null would mean actual null being there (which is not), so it's not going to find any:
  t.strictSame(
    find(input, { key: "a*", val: null }),
    null, // <---- !!!! null means no findings !!!!
    "02.03"
  );
  t.strictSame(find(input, { key: "a*", val: null }), [], "02.03");
  t.end();
});



@@ 106,7 98,7 @@ tap.test("03.pt1 - finds by key in a simple object #2", (t) => {
    },
  ];
  // second arg hardcoded null - won't find any because input has no null's:
  t.strictSame(find(input, { key: "b", val: null }), null, "03.01");
  t.strictSame(find(input, { key: "b", val: null }), [], "03.01");

  // absence of the second arg:
  t.strictSame(find(input, { key: "b" }), intended, "03.02");


@@ 139,7 131,7 @@ tap.test("04.pt2 - finds by key in a simple object, with glob", (t) => {
    },
  ];
  // second arg hardcoded null - won't find any because input has no null's:
  t.strictSame(find(input, { key: "b*", val: null }), null, "04.01");
  t.strictSame(find(input, { key: "b*", val: null }), [], "04.01");

  // absence of the second arg:
  t.strictSame(find(input, { key: "b*" }), intended, "04.02");


@@ 157,7 149,7 @@ tap.test("05.pt1 - does not find by key in a simple object", (t) => {
  };
  const key = "z";
  const actual = find(input, { key });
  const intended = null;
  const intended = [];

  t.strictSame(actual, intended, "05");
  t.end();


@@ 171,7 163,7 @@ tap.test("06.pt2 - does not find by key in a simple object, with glob", (t) => {
  };
  const key = "z*";
  const actual = find(input, { key });
  const intended = null;
  const intended = [];

  t.strictSame(actual, intended, "06");
  t.end();


@@ 295,7 287,7 @@ tap.test("13.pt1 - does not find by key in simple arrays", (t) => {
  const input = ["a", [["b"], "c"]];
  const key = "d";
  const actual = find(input, { key });
  const intended = null;
  const intended = [];
  t.strictSame(actual, intended, "13");
  t.end();
});


@@ 304,7 296,7 @@ tap.test("14.pt2 - does not find by key in simple arrays, with globs", (t) => {
  const input = ["a", [["b"], "c"]];
  const key = "lexicographer*";
  const actual = find(input, { key });
  const intended = null;
  const intended = [];
  t.strictSame(actual, intended, "14");
  t.end();
});


@@ 523,7 515,7 @@ tap.test(
    // ---------------------------
    t.strictSame(
      find(input, { key: "d", val: null }),
      null,
      [],
      "23.01 - Null is a valid value! It's not found in the input!"
    );
    // ---------------------------

M packages/ast-monkey/types/main.d.ts => packages/ast-monkey/types/main.d.ts +12 -10
@@ 1,37 1,39 @@
import { traverse } from "ast-monkey-traverse";
import { JsonValue } from "type-fest";
import { version } from "../package.json";
interface Finding {
    index: number;
    key: string;
    val: any;
    path: number[];
}
interface FindOpts {
    key: null | string;
    val: any;
    only: undefined | null | "any" | "array" | "object";
    only?: undefined | null | "any" | "array" | "object";
}
declare function find(input: JsonValue, originalOpts: FindOpts): null | number[];
declare function find(input: JsonValue, originalOpts: FindOpts): Finding[];
interface GetOpts {
    key: null | string;
    val: any;
    index: number;
    only: undefined | null | "any" | "array" | "object";
    only?: undefined | null | "any" | "array" | "object";
}
declare function get(input: JsonValue, originalOpts: GetOpts): GetOpts;
interface SetOpts {
    key: null | string;
    val: any;
    index: number;
    only: undefined | null | "any" | "array" | "object";
    only?: undefined | null | "any" | "array" | "object";
}
declare function set(input: JsonValue, originalOpts: SetOpts): JsonValue;
interface DropOpts {
    key: null | string;
    val: any;
    index: number;
    only: undefined | null | "any" | "array" | "object";
    only?: undefined | null | "any" | "array" | "object";
}
declare function drop(input: JsonValue, originalOpts: DropOpts): JsonValue;
interface DelOpts {
    key: null | string;
    val: any;
    only: undefined | null | "any" | "array" | "object";
    only?: undefined | null | "any" | "array" | "object";
}
declare function del(input: JsonValue, originalOpts: DelOpts): JsonValue;
declare function arrayFirstOnly(input: JsonValue): JsonValue;

M packages/check-types-mini/README.md => packages/check-types-mini/README.md +3 -1
@@ 65,6 65,8 @@ Please [visit codsen.com](https://codsen.com/os/check-types-mini/) for a full de

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors
Copyright (c) 2010-2021 Roy Revelt and other contributors


<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">


M packages/check-types-mini/coverage/coverage-summary.json => packages/check-types-mini/coverage/coverage-summary.json +1 -1
@@ 1,1 1,1 @@
{"total":{"lines":{"total":97,"covered":97,"skipped":0,"pct":100},"statements":{"total":107,"covered":107,"skipped":0,"pct":100},"functions":{"total":17,"covered":17,"skipped":0,"pct":100},"branches":{"total":131,"covered":128,"skipped":0,"pct":97.71}}}
\ No newline at end of file
{"total":{"lines":{"total":97,"covered":97,"skipped":0,"pct":100},"statements":{"total":107,"covered":107,"skipped":0,"pct":100},"functions":{"total":17,"covered":17,"skipped":0,"pct":100},"branches":{"total":136,"covered":133,"skipped":0,"pct":97.79}}}
\ No newline at end of file

M packages/check-types-mini/dist/check-types-mini.cjs.js => packages/check-types-mini/dist/check-types-mini.cjs.js +3 -3
@@ 179,11 179,11 @@ function internalApi(obj, ref, originalOptions) {
  if (opts.enforceStrictKeyset) {

    if (existy(opts.schema) && Object.keys(opts.schema).length > 0) {
      if (pullAllWithGlob(pullAll__default['default'](Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
      if (ref && pullAllWithGlob(pullAll__default['default'](Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
        var keys = pullAll__default['default'](Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema)));
        throw new TypeError(opts.msg + ": " + opts.optsVarName + ".enforceStrictKeyset is on and the following key" + (keys.length > 1 ? "s" : "") + " " + (keys.length > 1 ? "are" : "is") + " not covered by schema and/or reference objects: " + keys.join(", "));
      }
    } else if (existy(ref) && Object.keys(ref).length > 0) {
    } else if (isObj(ref) && Object.keys(ref).length > 0) {
      if (pullAllWithGlob(pullAll__default['default'](Object.keys(obj), Object.keys(ref)), opts.ignoreKeys).length !== 0) {
        var _keys = pullAll__default['default'](Object.keys(obj), Object.keys(ref));



@@ 308,7 308,7 @@ function internalApi(obj, ref, originalOptions) {
      } else {
        ignoredPathsArr.push(innerObj.path);
      }
    } else if (refHasThisPathDefined) {
    } else if (ref && isObj(ref) && refHasThisPathDefined) {
      var compareTo = objectPath__default['default'].get(ref, innerObj.path);

      if (opts.acceptArrays && Array.isArray(current) && !opts.acceptArraysIgnore.includes(key)) {

M packages/check-types-mini/dist/check-types-mini.dev.umd.js => packages/check-types-mini/dist/check-types-mini.dev.umd.js +3 -3
@@ 4561,11 4561,11 @@ function internalApi(obj, ref, originalOptions) {
  if (opts.enforceStrictKeyset) {

    if (existy(opts.schema) && Object.keys(opts.schema).length > 0) {
      if (pullAllWithGlob(lodash_pullall(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
      if (ref && pullAllWithGlob(lodash_pullall(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
        var keys = lodash_pullall(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema)));
        throw new TypeError(opts.msg + ": " + opts.optsVarName + ".enforceStrictKeyset is on and the following key" + (keys.length > 1 ? "s" : "") + " " + (keys.length > 1 ? "are" : "is") + " not covered by schema and/or reference objects: " + keys.join(", "));
      }
    } else if (existy(ref) && Object.keys(ref).length > 0) {
    } else if (isObj(ref) && Object.keys(ref).length > 0) {
      if (pullAllWithGlob(lodash_pullall(Object.keys(obj), Object.keys(ref)), opts.ignoreKeys).length !== 0) {
        var _keys = lodash_pullall(Object.keys(obj), Object.keys(ref));



@@ 4690,7 4690,7 @@ function internalApi(obj, ref, originalOptions) {
      } else {
        ignoredPathsArr.push(innerObj.path);
      }
    } else if (refHasThisPathDefined) {
    } else if (ref && isObj(ref) && refHasThisPathDefined) {
      var compareTo = objectPath.get(ref, innerObj.path);

      if (opts.acceptArrays && Array.isArray(current) && !opts.acceptArraysIgnore.includes(key)) {

M packages/check-types-mini/dist/check-types-mini.esm.js => packages/check-types-mini/dist/check-types-mini.esm.js +3 -3
@@ 163,11 163,11 @@ function internalApi(obj, ref, originalOptions) {
  if (opts.enforceStrictKeyset) {

    if (existy(opts.schema) && Object.keys(opts.schema).length > 0) {
      if (pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
      if (ref && pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema))), opts.ignoreKeys).length) {
        const keys = pullAll(Object.keys(obj), Object.keys(ref).concat(Object.keys(opts.schema)));
        throw new TypeError(`${opts.msg}: ${opts.optsVarName}.enforceStrictKeyset is on and the following key${keys.length > 1 ? "s" : ""} ${keys.length > 1 ? "are" : "is"} not covered by schema and/or reference objects: ${keys.join(", ")}`);
      }
    } else if (existy(ref) && Object.keys(ref).length > 0) {
    } else if (isObj(ref) && Object.keys(ref).length > 0) {
      if (pullAllWithGlob(pullAll(Object.keys(obj), Object.keys(ref)), opts.ignoreKeys).length !== 0) {
        const keys = pullAll(Object.keys(obj), Object.keys(ref));
        throw new TypeError(`${opts.msg}: The input object has key${keys.length > 1 ? "s" : ""} which ${keys.length > 1 ? "are" : "is"} not covered by the reference object: ${keys.join(", ")}`);


@@ 287,7 287,7 @@ current = ${JSON.stringify(current, null, 4)}\n\n`);
      } else {
        ignoredPathsArr.push(innerObj.path);
      }
    } else if (refHasThisPathDefined) {
    } else if (ref && isObj(ref) && refHasThisPathDefined) {
      const compareTo = objectPath.get(ref, innerObj.path);

      if (opts.acceptArrays && Array.isArray(current) && !opts.acceptArraysIgnore.includes(key)) {

M packages/check-types-mini/dist/check-types-mini.mjs => packages/check-types-mini/dist/check-types-mini.mjs +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/check-types-mini/
 */

import e from"type-detect";import t from"lodash.pullall";import{traverse as r}from"ast-monkey-traverse";import s from"lodash.intersection";import{arrayiffy as o}from"arrayiffy-if-string";import n from"object-path";import a from"matcher";const i={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function c(c,h,y){return function(c,h,y){function m(e){return null!=e}function g(t){return"Object"===e(t)}function p(e,t){return t=o(t),Array.from(e).filter((e=>!t.some((t=>a.isMatch(e,t,{caseSensitive:!0})))))}const l=Object.prototype.hasOwnProperty,f=["any","anything","every","everything","all","whatever","whatevs"];if(!m(c))throw Error("check-types-mini: [THROW_ID_01] First argument is missing!");const $={...i,...y};if($.ignoreKeys=!m($.ignoreKeys)||"string"!=typeof $.ignoreKeys&&!Array.isArray($.ignoreKeys)?[]:o($.ignoreKeys),$.ignorePaths=!m($.ignorePaths)||"string"!=typeof $.ignorePaths&&!Array.isArray($.ignorePaths)?[]:o($.ignorePaths),$.acceptArraysIgnore=!m($.acceptArraysIgnore)||"string"!=typeof $.acceptArraysIgnore&&!Array.isArray($.acceptArraysIgnore)?[]:o($.acceptArraysIgnore),$.msg=(""+$.msg).trim(),":"===$.msg[$.msg.length-1]&&($.msg=$.msg.slice(0,$.msg.length-1).trim()),g($.schema))Object.keys($.schema).forEach((e=>{if(g($.schema[e])){const t={};r($.schema[e],((r,s,o)=>{const n=void 0!==s?s:r;return Array.isArray(n)||g(n)||(t[`${e}.${o.path}`]=n),n})),delete $.schema[e],$.schema={...$.schema,...t}}})),Object.keys($.schema).forEach((e=>{Array.isArray($.schema[e])||($.schema[e]=[$.schema[e]]),$.schema[e]=$.schema[e].map((e=>(""+e).toLowerCase().trim()))}));else if(null!=$.schema)throw Error(`check-types-mini: opts.schema was customised to ${JSON.stringify($.schema,null,0)} which is not object but ${typeof $.schema}`);if(m(h)||(h={}),$.enforceStrictKeyset)if(m($.schema)&&Object.keys($.schema).length>0){if(p(t(Object.keys(c),Object.keys(h).concat(Object.keys($.schema))),$.ignoreKeys).length){const e=t(Object.keys(c),Object.keys(h).concat(Object.keys($.schema)));throw new TypeError(`${$.msg}: ${$.optsVarName}.enforceStrictKeyset is on and the following key${e.length>1?"s":""} ${e.length>1?"are":"is"} not covered by schema and/or reference objects: ${e.join(", ")}`)}}else{if(!m(h)||0>=Object.keys(h).length)throw new TypeError(`${$.msg}: Both ${$.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);if(0!==p(t(Object.keys(c),Object.keys(h)),$.ignoreKeys).length){const e=t(Object.keys(c),Object.keys(h));throw new TypeError(`${$.msg}: The input object has key${e.length>1?"s":""} which ${e.length>1?"are":"is"} not covered by the reference object: ${e.join(", ")}`)}if(0!==p(t(Object.keys(h),Object.keys(c)),$.ignoreKeys).length){const e=t(Object.keys(h),Object.keys(c));throw new TypeError(`${$.msg}: The reference object has key${e.length>1?"s":""} which ${e.length>1?"are":"is"} not present in the input object: ${e.join(", ")}`)}}const u=[];r(c,((t,r,i)=>{let y=r,m=t;if("array"===i.parentType&&(m=void 0,y=t),Array.isArray(u)&&u.length&&u.some((e=>i.path.startsWith(e))))return y;if(m&&$.ignoreKeys.some((e=>a.isMatch(m,e))))return y;if($.ignorePaths.some((e=>a.isMatch(i.path,e))))return y;const p=!(!g(y)&&!Array.isArray(y)&&Array.isArray(i.parent));let w=!1;g($.schema)&&l.call($.schema,i.path)&&(w=!0);let b=!1;if(g(h)&&n.has(h,i.path)&&(b=!0),$.enforceStrictKeyset&&p&&!w&&!b)throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} is neither covered by reference object (second input argument), nor ${$.optsVarName}.schema! To stop this error, turn off ${$.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${$.optsVarName}.schema).\n\nDebug info:\n\nobj = ${JSON.stringify(c,null,4)}\n\nref = ${JSON.stringify(h,null,4)}\n\ninnerObj = ${JSON.stringify(i,null,4)}\n\nopts = ${JSON.stringify($,null,4)}\n\ncurrent = ${JSON.stringify(y,null,4)}\n\n`);if(w){const t=o($.schema[i.path]).map((e=>(""+e).toLowerCase()));if(n.set($.schema,i.path,t),s(t,f).length)u.push(i.path);else if(!0!==y&&!1!==y&&!t.includes(e(y).toLowerCase())||(!0===y||!1===y)&&!t.includes(y+"")&&!t.includes("boolean")){if(!Array.isArray(y)||!$.acceptArrays)throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to ${"string"!==e(y)?'"':""}${JSON.stringify(y,null,0)}${"string"!==e(y)?'"':""} (type: ${e(y).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(t,null,0)})`);for(let r=0,s=y.length;s>r;r++)if(!t.includes(e(y[r]).toLowerCase()))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path}.${r}, the ${r}th element (equal to ${JSON.stringify(y[r],null,0)}) is of a type ${e(y[r]).toLowerCase()}, but only the following are allowed by the ${$.optsVarName}.schema: ${t.join(", ")}`)}}else if(b){const r=n.get(h,i.path);if($.acceptArrays&&Array.isArray(y)&&!$.acceptArraysIgnore.includes(t)){if(!y.every((r=>e(r).toLowerCase()===e(h[t]).toLowerCase())))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to be array, but not all of its elements are ${e(h[t]).toLowerCase()}-type`)}else if(e(y)!==e(r))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to ${"string"===e(y).toLowerCase()?"":'"'}${JSON.stringify(y,null,0)}${"string"===e(y).toLowerCase()?"":'"'} which is not ${e(r).toLowerCase()} but ${e(y).toLowerCase()}`)}return y}))}(c,h,y)}export{c as checkTypesMini};
import e from"type-detect";import t from"lodash.pullall";import{traverse as r}from"ast-monkey-traverse";import s from"lodash.intersection";import{arrayiffy as o}from"arrayiffy-if-string";import n from"object-path";import a from"matcher";const i={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};function c(c,h,y){return function(c,h,y){function m(e){return null!=e}function g(t){return"Object"===e(t)}function p(e,t){return t=o(t),Array.from(e).filter((e=>!t.some((t=>a.isMatch(e,t,{caseSensitive:!0})))))}const l=Object.prototype.hasOwnProperty,f=["any","anything","every","everything","all","whatever","whatevs"];if(!m(c))throw Error("check-types-mini: [THROW_ID_01] First argument is missing!");const $={...i,...y};if($.ignoreKeys=!m($.ignoreKeys)||"string"!=typeof $.ignoreKeys&&!Array.isArray($.ignoreKeys)?[]:o($.ignoreKeys),$.ignorePaths=!m($.ignorePaths)||"string"!=typeof $.ignorePaths&&!Array.isArray($.ignorePaths)?[]:o($.ignorePaths),$.acceptArraysIgnore=!m($.acceptArraysIgnore)||"string"!=typeof $.acceptArraysIgnore&&!Array.isArray($.acceptArraysIgnore)?[]:o($.acceptArraysIgnore),$.msg=(""+$.msg).trim(),":"===$.msg[$.msg.length-1]&&($.msg=$.msg.slice(0,$.msg.length-1).trim()),g($.schema))Object.keys($.schema).forEach((e=>{if(g($.schema[e])){const t={};r($.schema[e],((r,s,o)=>{const n=void 0!==s?s:r;return Array.isArray(n)||g(n)||(t[`${e}.${o.path}`]=n),n})),delete $.schema[e],$.schema={...$.schema,...t}}})),Object.keys($.schema).forEach((e=>{Array.isArray($.schema[e])||($.schema[e]=[$.schema[e]]),$.schema[e]=$.schema[e].map((e=>(""+e).toLowerCase().trim()))}));else if(null!=$.schema)throw Error(`check-types-mini: opts.schema was customised to ${JSON.stringify($.schema,null,0)} which is not object but ${typeof $.schema}`);if(m(h)||(h={}),$.enforceStrictKeyset)if(m($.schema)&&Object.keys($.schema).length>0){if(h&&p(t(Object.keys(c),Object.keys(h).concat(Object.keys($.schema))),$.ignoreKeys).length){const e=t(Object.keys(c),Object.keys(h).concat(Object.keys($.schema)));throw new TypeError(`${$.msg}: ${$.optsVarName}.enforceStrictKeyset is on and the following key${e.length>1?"s":""} ${e.length>1?"are":"is"} not covered by schema and/or reference objects: ${e.join(", ")}`)}}else{if(!g(h)||0>=Object.keys(h).length)throw new TypeError(`${$.msg}: Both ${$.optsVarName}.schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!`);if(0!==p(t(Object.keys(c),Object.keys(h)),$.ignoreKeys).length){const e=t(Object.keys(c),Object.keys(h));throw new TypeError(`${$.msg}: The input object has key${e.length>1?"s":""} which ${e.length>1?"are":"is"} not covered by the reference object: ${e.join(", ")}`)}if(0!==p(t(Object.keys(h),Object.keys(c)),$.ignoreKeys).length){const e=t(Object.keys(h),Object.keys(c));throw new TypeError(`${$.msg}: The reference object has key${e.length>1?"s":""} which ${e.length>1?"are":"is"} not present in the input object: ${e.join(", ")}`)}}const u=[];r(c,((t,r,i)=>{let y=r,m=t;if("array"===i.parentType&&(m=void 0,y=t),Array.isArray(u)&&u.length&&u.some((e=>i.path.startsWith(e))))return y;if(m&&$.ignoreKeys.some((e=>a.isMatch(m,e))))return y;if($.ignorePaths.some((e=>a.isMatch(i.path,e))))return y;const p=!(!g(y)&&!Array.isArray(y)&&Array.isArray(i.parent));let w=!1;g($.schema)&&l.call($.schema,i.path)&&(w=!0);let b=!1;if(g(h)&&n.has(h,i.path)&&(b=!0),$.enforceStrictKeyset&&p&&!w&&!b)throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} is neither covered by reference object (second input argument), nor ${$.optsVarName}.schema! To stop this error, turn off ${$.optsVarName}.enforceStrictKeyset or provide some type reference (2nd argument or ${$.optsVarName}.schema).\n\nDebug info:\n\nobj = ${JSON.stringify(c,null,4)}\n\nref = ${JSON.stringify(h,null,4)}\n\ninnerObj = ${JSON.stringify(i,null,4)}\n\nopts = ${JSON.stringify($,null,4)}\n\ncurrent = ${JSON.stringify(y,null,4)}\n\n`);if(w){const t=o($.schema[i.path]).map((e=>(""+e).toLowerCase()));if(n.set($.schema,i.path,t),s(t,f).length)u.push(i.path);else if(!0!==y&&!1!==y&&!t.includes(e(y).toLowerCase())||(!0===y||!1===y)&&!t.includes(y+"")&&!t.includes("boolean")){if(!Array.isArray(y)||!$.acceptArrays)throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to ${"string"!==e(y)?'"':""}${JSON.stringify(y,null,0)}${"string"!==e(y)?'"':""} (type: ${e(y).toLowerCase()}) which is not among the allowed types in schema (which is equal to ${JSON.stringify(t,null,0)})`);for(let r=0,s=y.length;s>r;r++)if(!t.includes(e(y[r]).toLowerCase()))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path}.${r}, the ${r}th element (equal to ${JSON.stringify(y[r],null,0)}) is of a type ${e(y[r]).toLowerCase()}, but only the following are allowed by the ${$.optsVarName}.schema: ${t.join(", ")}`)}}else if(h&&g(h)&&b){const r=n.get(h,i.path);if($.acceptArrays&&Array.isArray(y)&&!$.acceptArraysIgnore.includes(t)){if(!y.every((r=>e(r).toLowerCase()===e(h[t]).toLowerCase())))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to be array, but not all of its elements are ${e(h[t]).toLowerCase()}-type`)}else if(e(y)!==e(r))throw new TypeError(`${$.msg}: ${$.optsVarName}.${i.path} was customised to ${"string"===e(y).toLowerCase()?"":'"'}${JSON.stringify(y,null,0)}${"string"===e(y).toLowerCase()?"":'"'} which is not ${e(r).toLowerCase()} but ${e(y).toLowerCase()}`)}return y}))}(c,h,y)}export{c as checkTypesMini};

M packages/check-types-mini/dist/check-types-mini.umd.js => packages/check-types-mini/dist/check-types-mini.umd.js +1 -1
@@ 7,4 7,4 @@
 * Homepage: https://codsen.com/os/check-types-mini/
 */

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).checkTypesMini={})}(this,(function(t){"use strict";function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var n=1;arguments.length>n;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function i(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return t.length>n?{done:!1,value:t[n++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t){var e={exports:{}};return t(e,e.exports),e.exports}var u=c((function(t,e){t.exports=function(){var t="function"==typeof Promise,e="object"==typeof self?self:a,r="undefined"!=typeof Symbol,n="undefined"!=typeof Map,o="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=r&&void 0!==Symbol.iterator,f=r&&void 0!==Symbol.toStringTag,l=o&&"function"==typeof Set.prototype.entries,p=n&&"function"==typeof Map.prototype.entries,y=l&&Object.getPrototypeOf((new Set).entries()),h=p&&Object.getPrototypeOf((new Map).entries()),g=s&&"function"==typeof Array.prototype[Symbol.iterator],v=g&&Object.getPrototypeOf([][Symbol.iterator]()),b=s&&"function"==typeof String.prototype[Symbol.iterator],d=b&&Object.getPrototypeOf(""[Symbol.iterator]()),_=8,m=-1;function j(r){var a=typeof r;if("object"!==a)return a;if(null===r)return"null";if(r===e)return"global";if(Array.isArray(r)&&(!1===f||!(Symbol.toStringTag in r)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&r===window.location)return"Location";if("object"==typeof window.document&&r===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&r===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&r===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&r instanceof window.HTMLElement){if("BLOCKQUOTE"===r.tagName)return"HTMLQuoteElement";if("TD"===r.tagName)return"HTMLTableDataCellElement";if("TH"===r.tagName)return"HTMLTableHeaderCellElement"}}var s=f&&r[Symbol.toStringTag];if("string"==typeof s)return s;var l=Object.getPrototypeOf(r);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":t&&l===Promise.prototype?"Promise":o&&l===Set.prototype?"Set":n&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":n&&l===h?"Map Iterator":o&&l===y?"Set Iterator":g&&l===v?"Array Iterator":b&&l===d?"String Iterator":null===l?"Object":Object.prototype.toString.call(r).slice(_,m)}return j}()}));function s(t,e,r){if(e!=e)return function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,l,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function f(t,e,r,n){for(var o=r-1,i=t.length;++o<i;)if(n(t[o],e))return o;return-1}function l(t){return t!=t}var p=Array.prototype.splice;function y(t,e,r,n){var o,i=n?f:s,a=-1,c=e.length,u=t;for(t===e&&(e=function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(e)),r&&(u=function(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}(t,(o=r,function(t){return o(t)})));++a<c;)for(var l=0,y=e[a],h=r?r(y):y;(l=i(u,h,l,n))>-1;)u!==t&&p.call(u,l,1),p.call(t,l,1);return t}var h=function(t,e){return t&&t.length&&e&&e.length?y(t,e):t},g=c((function(t,e){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Boolean]",c="[object Date]",u="[object Function]",s="[object GeneratorFunction]",f="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",g="[object Set]",v="[object String]",b="[object Symbol]",d="[object WeakMap]",_="[object ArrayBuffer]",m="[object DataView]",j="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",A="[object Int16Array]",S="[object Int32Array]",T="[object Uint8Array]",P="[object Uint8ClampedArray]",k="[object Uint16Array]",E="[object Uint32Array]",N=/\w*$/,M=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,I={};I[o]=I["[object Array]"]=I[_]=I[m]=I[i]=I[c]=I[j]=I[w]=I[O]=I[A]=I[S]=I[f]=I[l]=I[p]=I[h]=I[g]=I[v]=I[b]=I[T]=I[P]=I[k]=I[E]=!0,I["[object Error]"]=I[u]=I[d]=!1;var L="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof a&&a&&a.Object===Object&&a||L||Function("return this")(),K=e&&!e.nodeType&&e,$=K&&t&&!t.nodeType&&t,D=$&&$.exports===K;function V(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function J(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function W(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function H(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function R(t,e){return function(r){return t(e(r))}}function B(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var U,q=Array.prototype,z=Function.prototype,G=Object.prototype,Q=C["__core-js_shared__"],X=(U=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Y=z.toString,Z=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=D?C.Buffer:void 0,nt=C.Symbol,ot=C.Uint8Array,it=R(Object.getPrototypeOf,Object),at=Object.create,ct=G.propertyIsEnumerable,ut=q.splice,st=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=R(Object.keys,Object),pt=$t(C,"DataView"),yt=$t(C,"Map"),ht=$t(C,"Promise"),gt=$t(C,"Set"),vt=$t(C,"WeakMap"),bt=$t(Object,"create"),dt=Wt(pt),_t=Wt(yt),mt=Wt(ht),jt=Wt(gt),wt=Wt(vt),Ot=nt?nt.prototype:void 0,At=Ot?Ot.valueOf:void 0;function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Pt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){this.__data__=new Tt(t)}function Et(t,e){var r=Rt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Bt(t)}(t)&&Z.call(t,"callee")&&(!ct.call(t,"callee")||tt.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var a in t)!e&&!Z.call(t,a)||i&&("length"==a||Ft(a,n))||r.push(a);return r}function Nt(t,e,r){var n=t[e];Z.call(t,e)&&Ht(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Mt(t,e){for(var r=t.length;r--;)if(Ht(t[r][0],e))return r;return-1}function xt(t,e,r,n,a,y,d){var M;if(n&&(M=y?n(t,a,y,d):n(t)),void 0!==M)return M;if(!zt(t))return t;var x=Rt(t);if(x){if(M=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,M)}else{var L=Vt(t),C=L==u||L==s;if(Ut(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(L==p||L==o||C&&!y){if(W(t))return y?t:{};if(M=function(t){return"function"!=typeof t.constructor||Jt(t)?{}:(e=it(t),zt(e)?at(e):{});var e}(C?{}:t),!e)return function(t,e){return Ct(t,Dt(t),e)}(t,function(t,e){return t&&Ct(e,Gt(e),t)}(M,t))}else{if(!I[L])return y?t:{};M=function(t,e,r,n){var o=t.constructor;switch(e){case _:return Lt(t);case i:case c:return new o(+t);case m:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case j:case w:case O:case A:case S:case T:case P:case k:case E:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return J(e?r(H(t),!0):H(t),V,new t.constructor)}(t,n,r);case l:case v:return new o(t);case h:return function(t){var e=new t.constructor(t.source,N.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,r){return J(e?r(B(t),!0):B(t),F,new t.constructor)}(t,n,r);case b:return a=t,At?Object(At.call(a)):{}}var a}(t,L,xt,e)}}d||(d=new kt);var K=d.get(t);if(K)return K;if(d.set(t,M),!x)var $=r?function(t){return function(t,e,r){var n=e(t);return Rt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Gt,Dt)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}($||t,(function(o,i){$&&(o=t[i=o]),Nt(M,i,xt(o,e,r,n,i,t,d))})),M}function It(t){return!(!zt(t)||(e=t,X&&X in e))&&(qt(t)||W(t)?et:M).test(Wt(t));var e}function Lt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ct(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;Nt(r,a,void 0===c?t[a]:c)}return r}function Kt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function $t(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return It(r)?r:void 0}St.prototype.clear=function(){this.__data__=bt?bt(null):{}},St.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},St.prototype.get=function(t){var e=this.__data__;if(bt){var n=e[t];return n===r?void 0:n}return Z.call(e,t)?e[t]:void 0},St.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},St.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=Mt(e,t);return r>=0&&(r==e.length-1?e.pop():ut.call(e,r,1),!0)},Tt.prototype.get=function(t){var e=this.__data__,r=Mt(e,t);return 0>r?void 0:e[r][1]},Tt.prototype.has=function(t){return Mt(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Mt(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},Pt.prototype.clear=function(){this.__data__={hash:new St,map:new(yt||Tt),string:new St}},Pt.prototype.delete=function(t){return Kt(this,t).delete(t)},Pt.prototype.get=function(t){return Kt(this,t).get(t)},Pt.prototype.has=function(t){return Kt(this,t).has(t)},Pt.prototype.set=function(t,e){return Kt(this,t).set(t,e),this},kt.prototype.clear=function(){this.__data__=new Tt},kt.prototype.delete=function(t){return this.__data__.delete(t)},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!yt||199>n.length)return n.push([t,e]),this;r=this.__data__=new Pt(n)}return r.set(t,e),this};var Dt=st?R(st,Object):function(){return[]},Vt=function(t){return tt.call(t)};function Ft(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||x.test(t))&&t>-1&&t%1==0&&e>t}function Jt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Wt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ht(t,e){return t===e||t!=t&&e!=e}(pt&&Vt(new pt(new ArrayBuffer(1)))!=m||yt&&Vt(new yt)!=f||ht&&Vt(ht.resolve())!=y||gt&&Vt(new gt)!=g||vt&&Vt(new vt)!=d)&&(Vt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Wt(r):void 0;if(n)switch(n){case dt:return m;case _t:return f;case mt:return y;case jt:return g;case wt:return d}return e});var Rt=Array.isArray;function Bt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&n>=t}(t.length)&&!qt(t)}var Ut=ft||function(){return!1};function qt(t){var e=zt(t)?tt.call(t):"";return e==u||e==s}function zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Bt(t)?Et(t):function(t){if(!Jt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return xt(t,!0,!0)}}));var v,b,d=Object.prototype,_=Function.prototype.toString,m=d.hasOwnProperty,j=_.call(Object),w=d.toString,O=(v=Object.getPrototypeOf,b=Object,function(t){return v(b(t))});var A=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=w.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=O(t);if(null===e)return!0;var r=m.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&_.call(r)==j};function S(t){if(t.includes(".")){var e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(var r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}function T(t,e){return function t(e,r,o,i){var a,c=g(e),u=n({depth:-1,path:""},o);if(u.depth+=1,Array.isArray(c))for(var s=0,f=c.length;f>s&&!i.now;s++){var l=u.path?u.path+"."+s:""+s;void 0!==c[s]?(u.parent=g(c),u.parentType="array",u.parentKey=S(l),a=t(r(c[s],void 0,n(n({},u),{},{path:l}),i),r,n(n({},u),{},{path:l}),i),Number.isNaN(a)&&c.length>s?(c.splice(s,1),s-=1):c[s]=a):c.splice(s,1)}else if(A(c))for(var p in c){if(i.now&&null!=p)break;var y=u.path?u.path+"."+p:p;0===u.depth&&null!=p&&(u.topmostKey=p),u.parent=g(c),u.parentType="object",u.parentKey=S(y),a=t(r(p,c[p],n(n({},u),{},{path:y}),i),r,n(n({},u),{},{path:y}),i),Number.isNaN(a)?delete c[p]:c[p]=a}return c}(t,e,{},{now:!1})}var P="__lodash_hash_undefined__",k=9007199254740991,E=/^\[object .+?Constructor\]$/,N="object"==typeof self&&self&&self.Object===Object&&self,M="object"==typeof a&&a&&a.Object===Object&&a||N||Function("return this")();function x(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function I(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,K,r);var n=r-1,o=t.length;for(;++n<o;)if(t[n]===e)return n;return-1}(t,e,0)>-1}function L(t,e,r){for(var n=-1,o=t?t.length:0;++n<o;)if(r(e,t[n]))return!0;return!1}function C(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function K(t){return t!=t}function $(t){return function(e){return t(e)}}function D(t,e){return t.has(e)}var V,F=Array.prototype,J=Function.prototype,W=Object.prototype,H=M["__core-js_shared__"],R=(V=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",B=J.toString,U=W.hasOwnProperty,q=W.toString,z=RegExp("^"+B.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F.splice,Q=Math.max,X=Math.min,Y=ut(M,"Map"),Z=ut(Object,"create");function tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function et(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function nt(t){var e=-1,r=t?t.length:0;for(this.__data__=new rt;++e<r;)this.add(t[e])}function ot(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function it(t){return!(!ft(t)||function(t){return!!R&&R in t}(t))&&(st(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?z:E).test(function(t){if(null!=t){try{return B.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function at(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&k>=t}(t.length)&&!st(t)}(t)}(t)?t:[]}function ct(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function ut(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return it(r)?r:void 0}function st(t){var e=ft(t)?q.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}function ft(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}tt.prototype.clear=function(){this.__data__=Z?Z(null):{}},tt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},tt.prototype.get=function(t){var e=this.__data__;if(Z){var r=e[t];return r===P?void 0:r}return U.call(e,t)?e[t]:void 0},tt.prototype.has=function(t){var e=this.__data__;return Z?void 0!==e[t]:U.call(e,t)},tt.prototype.set=function(t,e){return this.__data__[t]=Z&&void 0===e?P:e,this},et.prototype.clear=function(){this.__data__=[]},et.prototype.delete=function(t){var e=this.__data__,r=ot(e,t);return r>=0&&(r==e.length-1?e.pop():G.call(e,r,1),!0)},et.prototype.get=function(t){var e=this.__data__,r=ot(e,t);return 0>r?void 0:e[r][1]},et.prototype.has=function(t){return ot(this.__data__,t)>-1},et.prototype.set=function(t,e){var r=this.__data__,n=ot(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},rt.prototype.clear=function(){this.__data__={hash:new tt,map:new(Y||et),string:new tt}},rt.prototype.delete=function(t){return ct(this,t).delete(t)},rt.prototype.get=function(t){return ct(this,t).get(t)},rt.prototype.has=function(t){return ct(this,t).has(t)},rt.prototype.set=function(t,e){return ct(this,t).set(t,e),this},nt.prototype.add=nt.prototype.push=function(t){return this.__data__.set(t,P),this},nt.prototype.has=function(t){return this.__data__.has(t)};var lt=function(t,e){return e=Q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,o=Q(r.length-e,0),i=Array(o);++n<o;)i[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=i,x(t,this,a)}}((function(t){var e=C(t,at);return e.length&&e[0]===t[0]?function(t,e,r){for(var n=r?L:I,o=t[0].length,i=t.length,a=i,c=Array(i),u=1/0,s=[];a--;){var f=t[a];a&&e&&(f=C(f,$(e))),u=X(f.length,u),c[a]=r||!e&&(120>o||120>f.length)?void 0:new nt(a&&f)}f=t[0];var l=-1,p=c[0];t:for(;++l<o&&u>s.length;){var y=f[l],h=e?e(y):y;if(y=r||0!==y?y:0,!(p?D(p,h):n(s,h,r))){for(a=i;--a;){var g=c[a];if(!(g?D(g,h):n(t[a],h,r)))continue t}p&&p.push(h),s.push(y)}}return s}(e):[]}));function pt(t){return"string"==typeof t?t.length?[t]:[]:t}var yt=c((function(t){t.exports=function(){var t=Object.prototype.toString;function e(t,e){return null!=t&&Object.prototype.hasOwnProperty.call(t,e)}function r(t){if(!t)return!0;if(i(t)&&0===t.length)return!0;if("string"!=typeof t){for(var r in t)if(e(t,r))return!1;return!0}return!1}function n(e){return t.call(e)}function o(t){return"object"==typeof t&&"[object Object]"===n(t)}var i=Array.isArray||function(e){return"[object Array]"===t.call(e)};function a(t){return"boolean"==typeof t||"[object Boolean]"===n(t)}function c(t){var e=parseInt(t);return""+e===t?e:t}function u(t){var n,u=function t(e){return Object.keys(t).reduce((function(r,n){return"create"===n||"function"==typeof t[n]&&(r[n]=t[n].bind(t,e)),r}),{})};function s(t,e){if(n(t,e))return t[e]}function f(e,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return e;if("string"==typeof r)return f(e,r.split(".").map(c),n,o);var i=r[0],a=s(e,i);if(t.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(e[i]=n),a):(void 0===a&&(e[i]="number"==typeof r[1]?[]:{}),f(e[i],r.slice(1),n,o))}return n=(t=t||{}).includeInheritedProps?function(){return!0}:function(t,r){return"number"==typeof r&&Array.isArray(t)||e(t,r)},u.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;n.length>o;o++){var a=c(n[o]);if(!("number"==typeof a&&i(r)&&r.length>a||(t.includeInheritedProps?a in Object(r):e(r,a))))return!1;r=r[a]}return!0},u.ensureExists=function(t,e,r){return f(t,e,r,!0)},u.set=function(t,e,r,n){return f(t,e,r,n)},u.insert=function(t,e,r,n){var o=u.get(t,e);n=~~n,i(o)||u.set(t,e,o=[]),o.splice(n,0,r)},u.empty=function(t,e){var c,s;if(!r(e)&&null!=t&&(c=u.get(t,e))){if("string"==typeof c)return u.set(t,e,"");if(a(c))return u.set(t,e,!1);if("number"==typeof c)return u.set(t,e,0);if(i(c))c.length=0;else{if(!o(c))return u.set(t,e,null);for(s in c)n(c,s)&&delete c[s]}}},u.push=function(t,e){var r=u.get(t,e);i(r)||u.set(t,e,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},u.coalesce=function(t,e,r){for(var n,o=0,i=e.length;i>o;o++)if(void 0!==(n=u.get(t,e[o])))return n;return r},u.get=function(t,e,r){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if(null==t)return r;if("string"==typeof e)return u.get(t,e.split("."),r);var n=c(e[0]),o=s(t,n);return void 0===o?r:1===e.length?o:u.get(t[n],e.slice(1),r)},u.del=function(t,e){if("number"==typeof e&&(e=[e]),null==t)return t;if(r(e))return t;if("string"==typeof e)return u.del(t,e.split("."));var o=c(e[0]);return n(t,o)?1!==e.length?u.del(t[o],e.slice(1)):(i(t)?t.splice(o,1):delete t[o],t):t},u}var s=u();return s.create=u,s.withInheritedProps=u({includeInheritedProps:!0}),s}()})),ht=new Map;function gt(t,e){e=n({caseSensitive:!1},e);var r=t+JSON.stringify(e);if(ht.has(r))return ht.get(r);var o="!"===t[0];o&&(t=t.slice(1)),t=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(t).replace(/\\\*/g,"[\\s\\S]*");var i=RegExp("^"+t+"$",e.caseSensitive?"":"i");return i.negated=o,ht.set(r,i),i}var vt=function(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Expected two arrays, got "+typeof t+" "+typeof e);if(0===e.length)return t;var n="!"===e[0][0];e=e.map((function(t){return gt(t,r)}));for(var o,a=[],c=i(t);!(o=c()).done;){for(var u,s=o.value,f=n,l=i(e);!(u=l()).done;){var p=u.value;p.test(s)&&(f=!p.negated)}f&&a.push(s)}return a};vt.isMatch=function(t,e,r){var n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[e];return n.some((function(t){return o.every((function(e){var n=gt(e,r),o=n.test(t);return n.negated?!o:o}))}))};var bt={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};t.checkTypesMini=function(t,e,r){return function(t,e,r){function o(t){return null!=t}function i(t){return"Object"===u(t)}function a(t,e){return e=pt(e),Array.from(t).filter((function(t){return!e.some((function(e){return vt.isMatch(t,e,{caseSensitive:!0})}))}))}var c=Object.prototype.hasOwnProperty,s=["any","anything","every","everything","all","whatever","whatevs"];if(!o(t))throw Error("check-types-mini: [THROW_ID_01] First argument is missing!");var f=n(n({},bt),r);if(f.ignoreKeys=!o(f.ignoreKeys)||"string"!=typeof f.ignoreKeys&&!Array.isArray(f.ignoreKeys)?[]:pt(f.ignoreKeys),f.ignorePaths=!o(f.ignorePaths)||"string"!=typeof f.ignorePaths&&!Array.isArray(f.ignorePaths)?[]:pt(f.ignorePaths),f.acceptArraysIgnore=!o(f.acceptArraysIgnore)||"string"!=typeof f.acceptArraysIgnore&&!Array.isArray(f.acceptArraysIgnore)?[]:pt(f.acceptArraysIgnore),f.msg=(""+f.msg).trim(),":"===f.msg[f.msg.length-1]&&(f.msg=f.msg.slice(0,f.msg.length-1).trim()),i(f.schema))Object.keys(f.schema).forEach((function(t){if(i(f.schema[t])){var e={};T(f.schema[t],(function(r,n,o){var a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(e[t+"."+o.path]=a),a})),delete f.schema[t],f.schema=n(n({},f.schema),e)}})),Object.keys(f.schema).forEach((function(t){Array.isArray(f.schema[t])||(f.schema[t]=[f.schema[t]]),f.schema[t]=f.schema[t].map((function(t){return(""+t).toLowerCase().trim()}))}));else if(null!=f.schema)throw Error("check-types-mini: opts.schema was customised to "+JSON.stringify(f.schema,null,0)+" which is not object but "+typeof f.schema);if(o(e)||(e={}),f.enforceStrictKeyset)if(o(f.schema)&&Object.keys(f.schema).length>0){if(a(h(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema))),f.ignoreKeys).length){var l=h(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema)));throw new TypeError(f.msg+": "+f.optsVarName+".enforceStrictKeyset is on and the following key"+(l.length>1?"s":"")+" "+(l.length>1?"are":"is")+" not covered by schema and/or reference objects: "+l.join(", "))}}else{if(!o(e)||0>=Object.keys(e).length)throw new TypeError(f.msg+": Both "+f.optsVarName+".schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!");if(0!==a(h(Object.keys(t),Object.keys(e)),f.ignoreKeys).length){var p=h(Object.keys(t),Object.keys(e));throw new TypeError(f.msg+": The input object has key"+(p.length>1?"s":"")+" which "+(p.length>1?"are":"is")+" not covered by the reference object: "+p.join(", "))}if(0!==a(h(Object.keys(e),Object.keys(t)),f.ignoreKeys).length){var y=h(Object.keys(e),Object.keys(t));throw new TypeError(f.msg+": The reference object has key"+(y.length>1?"s":"")+" which "+(y.length>1?"are":"is")+" not present in the input object: "+y.join(", "))}}var g=[];T(t,(function(r,n,o){var a=n,l=r;if("array"===o.parentType&&(l=void 0,a=r),Array.isArray(g)&&g.length&&g.some((function(t){return o.path.startsWith(t)})))return a;if(l&&f.ignoreKeys.some((function(t){return vt.isMatch(l,t)})))return a;if(f.ignorePaths.some((function(t){return vt.isMatch(o.path,t)})))return a;var p=!(!i(a)&&!Array.isArray(a)&&Array.isArray(o.parent)),y=!1;i(f.schema)&&c.call(f.schema,o.path)&&(y=!0);var h=!1;if(i(e)&&yt.has(e,o.path)&&(h=!0),f.enforceStrictKeyset&&p&&!y&&!h)throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" is neither covered by reference object (second input argument), nor "+f.optsVarName+".schema! To stop this error, turn off "+f.optsVarName+".enforceStrictKeyset or provide some type reference (2nd argument or "+f.optsVarName+".schema).\n\nDebug info:\n\nobj = "+JSON.stringify(t,null,4)+"\n\nref = "+JSON.stringify(e,null,4)+"\n\ninnerObj = "+JSON.stringify(o,null,4)+"\n\nopts = "+JSON.stringify(f,null,4)+"\n\ncurrent = "+JSON.stringify(a,null,4)+"\n\n");if(y){var v=pt(f.schema[o.path]).map((function(t){return(""+t).toLowerCase()}));if(yt.set(f.schema,o.path,v),lt(v,s).length)g.push(o.path);else if(!0!==a&&!1!==a&&!v.includes(u(a).toLowerCase())||(!0===a||!1===a)&&!v.includes(a+"")&&!v.includes("boolean")){if(!Array.isArray(a)||!f.acceptArrays)throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to "+("string"!==u(a)?'"':"")+JSON.stringify(a,null,0)+("string"!==u(a)?'"':"")+" (type: "+u(a).toLowerCase()+") which is not among the allowed types in schema (which is equal to "+JSON.stringify(v,null,0)+")");for(var b=0,d=a.length;d>b;b++)if(!v.includes(u(a[b]).toLowerCase()))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+"."+b+", the "+b+"th element (equal to "+JSON.stringify(a[b],null,0)+") is of a type "+u(a[b]).toLowerCase()+", but only the following are allowed by the "+f.optsVarName+".schema: "+v.join(", "))}}else if(h){var _=yt.get(e,o.path);if(f.acceptArrays&&Array.isArray(a)&&!f.acceptArraysIgnore.includes(r)){if(!a.every((function(t){return u(t).toLowerCase()===u(e[r]).toLowerCase()})))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to be array, but not all of its elements are "+u(e[r]).toLowerCase()+"-type")}else if(u(a)!==u(_))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to "+("string"===u(a).toLowerCase()?"":'"')+JSON.stringify(a,null,0)+("string"===u(a).toLowerCase()?"":'"')+" which is not "+u(_).toLowerCase()+" but "+u(a).toLowerCase())}return a}))}(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).checkTypesMini={})}(this,(function(t){"use strict";function e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var n=1;arguments.length>n;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function i(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return t.length>n?{done:!1,value:t[n++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=t[Symbol.iterator]()).next.bind(r)}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t){var e={exports:{}};return t(e,e.exports),e.exports}var u=c((function(t,e){t.exports=function(){var t="function"==typeof Promise,e="object"==typeof self?self:a,r="undefined"!=typeof Symbol,n="undefined"!=typeof Map,o="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,s=r&&void 0!==Symbol.iterator,f=r&&void 0!==Symbol.toStringTag,l=o&&"function"==typeof Set.prototype.entries,p=n&&"function"==typeof Map.prototype.entries,y=l&&Object.getPrototypeOf((new Set).entries()),h=p&&Object.getPrototypeOf((new Map).entries()),g=s&&"function"==typeof Array.prototype[Symbol.iterator],v=g&&Object.getPrototypeOf([][Symbol.iterator]()),b=s&&"function"==typeof String.prototype[Symbol.iterator],d=b&&Object.getPrototypeOf(""[Symbol.iterator]()),_=8,m=-1;function j(r){var a=typeof r;if("object"!==a)return a;if(null===r)return"null";if(r===e)return"global";if(Array.isArray(r)&&(!1===f||!(Symbol.toStringTag in r)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&r===window.location)return"Location";if("object"==typeof window.document&&r===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&r===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&r===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&r instanceof window.HTMLElement){if("BLOCKQUOTE"===r.tagName)return"HTMLQuoteElement";if("TD"===r.tagName)return"HTMLTableDataCellElement";if("TH"===r.tagName)return"HTMLTableHeaderCellElement"}}var s=f&&r[Symbol.toStringTag];if("string"==typeof s)return s;var l=Object.getPrototypeOf(r);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":t&&l===Promise.prototype?"Promise":o&&l===Set.prototype?"Set":n&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":n&&l===h?"Map Iterator":o&&l===y?"Set Iterator":g&&l===v?"Array Iterator":b&&l===d?"String Iterator":null===l?"Object":Object.prototype.toString.call(r).slice(_,m)}return j}()}));function s(t,e,r){if(e!=e)return function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,l,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function f(t,e,r,n){for(var o=r-1,i=t.length;++o<i;)if(n(t[o],e))return o;return-1}function l(t){return t!=t}var p=Array.prototype.splice;function y(t,e,r,n){var o,i=n?f:s,a=-1,c=e.length,u=t;for(t===e&&(e=function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(e)),r&&(u=function(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}(t,(o=r,function(t){return o(t)})));++a<c;)for(var l=0,y=e[a],h=r?r(y):y;(l=i(u,h,l,n))>-1;)u!==t&&p.call(u,l,1),p.call(t,l,1);return t}var h=function(t,e){return t&&t.length&&e&&e.length?y(t,e):t},g=c((function(t,e){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",i="[object Boolean]",c="[object Date]",u="[object Function]",s="[object GeneratorFunction]",f="[object Map]",l="[object Number]",p="[object Object]",y="[object Promise]",h="[object RegExp]",g="[object Set]",v="[object String]",b="[object Symbol]",d="[object WeakMap]",_="[object ArrayBuffer]",m="[object DataView]",j="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",A="[object Int16Array]",S="[object Int32Array]",T="[object Uint8Array]",P="[object Uint8ClampedArray]",k="[object Uint16Array]",E="[object Uint32Array]",N=/\w*$/,M=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,I={};I[o]=I["[object Array]"]=I[_]=I[m]=I[i]=I[c]=I[j]=I[w]=I[O]=I[A]=I[S]=I[f]=I[l]=I[p]=I[h]=I[g]=I[v]=I[b]=I[T]=I[P]=I[k]=I[E]=!0,I["[object Error]"]=I[u]=I[d]=!1;var L="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof a&&a&&a.Object===Object&&a||L||Function("return this")(),K=e&&!e.nodeType&&e,$=K&&t&&!t.nodeType&&t,D=$&&$.exports===K;function V(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function J(t,e,r,n){var o=-1,i=t?t.length:0;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}function W(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function H(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function R(t,e){return function(r){return t(e(r))}}function B(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var U,q=Array.prototype,z=Function.prototype,G=Object.prototype,Q=C["__core-js_shared__"],X=(U=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+U:"",Y=z.toString,Z=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=D?C.Buffer:void 0,nt=C.Symbol,ot=C.Uint8Array,it=R(Object.getPrototypeOf,Object),at=Object.create,ct=G.propertyIsEnumerable,ut=q.splice,st=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=R(Object.keys,Object),pt=$t(C,"DataView"),yt=$t(C,"Map"),ht=$t(C,"Promise"),gt=$t(C,"Set"),vt=$t(C,"WeakMap"),bt=$t(Object,"create"),dt=Wt(pt),_t=Wt(yt),mt=Wt(ht),jt=Wt(gt),wt=Wt(vt),Ot=nt?nt.prototype:void 0,At=Ot?Ot.valueOf:void 0;function St(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Pt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kt(t){this.__data__=new Tt(t)}function Et(t,e){var r=Rt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Bt(t)}(t)&&Z.call(t,"callee")&&(!ct.call(t,"callee")||tt.call(t)==o)}(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,i=!!n;for(var a in t)!e&&!Z.call(t,a)||i&&("length"==a||Ft(a,n))||r.push(a);return r}function Nt(t,e,r){var n=t[e];Z.call(t,e)&&Ht(n,r)&&(void 0!==r||e in t)||(t[e]=r)}function Mt(t,e){for(var r=t.length;r--;)if(Ht(t[r][0],e))return r;return-1}function xt(t,e,r,n,a,y,d){var M;if(n&&(M=y?n(t,a,y,d):n(t)),void 0!==M)return M;if(!zt(t))return t;var x=Rt(t);if(x){if(M=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,n=t.length;e||(e=Array(n));for(;++r<n;)e[r]=t[r];return e}(t,M)}else{var L=Vt(t),C=L==u||L==s;if(Ut(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(L==p||L==o||C&&!y){if(W(t))return y?t:{};if(M=function(t){return"function"!=typeof t.constructor||Jt(t)?{}:(e=it(t),zt(e)?at(e):{});var e}(C?{}:t),!e)return function(t,e){return Ct(t,Dt(t),e)}(t,function(t,e){return t&&Ct(e,Gt(e),t)}(M,t))}else{if(!I[L])return y?t:{};M=function(t,e,r,n){var o=t.constructor;switch(e){case _:return Lt(t);case i:case c:return new o(+t);case m:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,n);case j:case w:case O:case A:case S:case T:case P:case k:case E:return function(t,e){var r=e?Lt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,n);case f:return function(t,e,r){return J(e?r(H(t),!0):H(t),V,new t.constructor)}(t,n,r);case l:case v:return new o(t);case h:return function(t){var e=new t.constructor(t.source,N.exec(t));return e.lastIndex=t.lastIndex,e}(t);case g:return function(t,e,r){return J(e?r(B(t),!0):B(t),F,new t.constructor)}(t,n,r);case b:return a=t,At?Object(At.call(a)):{}}var a}(t,L,xt,e)}}d||(d=new kt);var K=d.get(t);if(K)return K;if(d.set(t,M),!x)var $=r?function(t){return function(t,e,r){var n=e(t);return Rt(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,Gt,Dt)}(t):Gt(t);return function(t,e){for(var r=-1,n=t?t.length:0;++r<n&&!1!==e(t[r],r,t););}($||t,(function(o,i){$&&(o=t[i=o]),Nt(M,i,xt(o,e,r,n,i,t,d))})),M}function It(t){return!(!zt(t)||(e=t,X&&X in e))&&(qt(t)||W(t)?et:M).test(Wt(t));var e}function Lt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Ct(t,e,r,n){r||(r={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;Nt(r,a,void 0===c?t[a]:c)}return r}function Kt(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function $t(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return It(r)?r:void 0}St.prototype.clear=function(){this.__data__=bt?bt(null):{}},St.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},St.prototype.get=function(t){var e=this.__data__;if(bt){var n=e[t];return n===r?void 0:n}return Z.call(e,t)?e[t]:void 0},St.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Z.call(e,t)},St.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?r:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=Mt(e,t);return r>=0&&(r==e.length-1?e.pop():ut.call(e,r,1),!0)},Tt.prototype.get=function(t){var e=this.__data__,r=Mt(e,t);return 0>r?void 0:e[r][1]},Tt.prototype.has=function(t){return Mt(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,n=Mt(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},Pt.prototype.clear=function(){this.__data__={hash:new St,map:new(yt||Tt),string:new St}},Pt.prototype.delete=function(t){return Kt(this,t).delete(t)},Pt.prototype.get=function(t){return Kt(this,t).get(t)},Pt.prototype.has=function(t){return Kt(this,t).has(t)},Pt.prototype.set=function(t,e){return Kt(this,t).set(t,e),this},kt.prototype.clear=function(){this.__data__=new Tt},kt.prototype.delete=function(t){return this.__data__.delete(t)},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var n=r.__data__;if(!yt||199>n.length)return n.push([t,e]),this;r=this.__data__=new Pt(n)}return r.set(t,e),this};var Dt=st?R(st,Object):function(){return[]},Vt=function(t){return tt.call(t)};function Ft(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||x.test(t))&&t>-1&&t%1==0&&e>t}function Jt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function Wt(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ht(t,e){return t===e||t!=t&&e!=e}(pt&&Vt(new pt(new ArrayBuffer(1)))!=m||yt&&Vt(new yt)!=f||ht&&Vt(ht.resolve())!=y||gt&&Vt(new gt)!=g||vt&&Vt(new vt)!=d)&&(Vt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,n=r?Wt(r):void 0;if(n)switch(n){case dt:return m;case _t:return f;case mt:return y;case jt:return g;case wt:return d}return e});var Rt=Array.isArray;function Bt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&n>=t}(t.length)&&!qt(t)}var Ut=ft||function(){return!1};function qt(t){var e=zt(t)?tt.call(t):"";return e==u||e==s}function zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Bt(t)?Et(t):function(t){if(!Jt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return xt(t,!0,!0)}}));var v,b,d=Object.prototype,_=Function.prototype.toString,m=d.hasOwnProperty,j=_.call(Object),w=d.toString,O=(v=Object.getPrototypeOf,b=Object,function(t){return v(b(t))});var A=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=w.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=O(t);if(null===e)return!0;var r=m.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&_.call(r)==j};function S(t){if(t.includes(".")){var e=t.lastIndexOf(".");if(!t.slice(0,e).includes("."))return t.slice(0,e);for(var r=e-1;r--;)if("."===t[r])return t.slice(r+1,e)}return null}function T(t,e){return function t(e,r,o,i){var a,c=g(e),u=n({depth:-1,path:""},o);if(u.depth+=1,Array.isArray(c))for(var s=0,f=c.length;f>s&&!i.now;s++){var l=u.path?u.path+"."+s:""+s;void 0!==c[s]?(u.parent=g(c),u.parentType="array",u.parentKey=S(l),a=t(r(c[s],void 0,n(n({},u),{},{path:l}),i),r,n(n({},u),{},{path:l}),i),Number.isNaN(a)&&c.length>s?(c.splice(s,1),s-=1):c[s]=a):c.splice(s,1)}else if(A(c))for(var p in c){if(i.now&&null!=p)break;var y=u.path?u.path+"."+p:p;0===u.depth&&null!=p&&(u.topmostKey=p),u.parent=g(c),u.parentType="object",u.parentKey=S(y),a=t(r(p,c[p],n(n({},u),{},{path:y}),i),r,n(n({},u),{},{path:y}),i),Number.isNaN(a)?delete c[p]:c[p]=a}return c}(t,e,{},{now:!1})}var P="__lodash_hash_undefined__",k=9007199254740991,E=/^\[object .+?Constructor\]$/,N="object"==typeof self&&self&&self.Object===Object&&self,M="object"==typeof a&&a&&a.Object===Object&&a||N||Function("return this")();function x(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function I(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,n){var o=t.length,i=r+(n?1:-1);for(;n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,K,r);var n=r-1,o=t.length;for(;++n<o;)if(t[n]===e)return n;return-1}(t,e,0)>-1}function L(t,e,r){for(var n=-1,o=t?t.length:0;++n<o;)if(r(e,t[n]))return!0;return!1}function C(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function K(t){return t!=t}function $(t){return function(e){return t(e)}}function D(t,e){return t.has(e)}var V,F=Array.prototype,J=Function.prototype,W=Object.prototype,H=M["__core-js_shared__"],R=(V=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",B=J.toString,U=W.hasOwnProperty,q=W.toString,z=RegExp("^"+B.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G=F.splice,Q=Math.max,X=Math.min,Y=ut(M,"Map"),Z=ut(Object,"create");function tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function et(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function nt(t){var e=-1,r=t?t.length:0;for(this.__data__=new rt;++e<r;)this.add(t[e])}function ot(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function it(t){return!(!ft(t)||function(t){return!!R&&R in t}(t))&&(st(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?z:E).test(function(t){if(null!=t){try{return B.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function at(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&k>=t}(t.length)&&!st(t)}(t)}(t)?t:[]}function ct(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function ut(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return it(r)?r:void 0}function st(t){var e=ft(t)?q.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}function ft(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}tt.prototype.clear=function(){this.__data__=Z?Z(null):{}},tt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},tt.prototype.get=function(t){var e=this.__data__;if(Z){var r=e[t];return r===P?void 0:r}return U.call(e,t)?e[t]:void 0},tt.prototype.has=function(t){var e=this.__data__;return Z?void 0!==e[t]:U.call(e,t)},tt.prototype.set=function(t,e){return this.__data__[t]=Z&&void 0===e?P:e,this},et.prototype.clear=function(){this.__data__=[]},et.prototype.delete=function(t){var e=this.__data__,r=ot(e,t);return r>=0&&(r==e.length-1?e.pop():G.call(e,r,1),!0)},et.prototype.get=function(t){var e=this.__data__,r=ot(e,t);return 0>r?void 0:e[r][1]},et.prototype.has=function(t){return ot(this.__data__,t)>-1},et.prototype.set=function(t,e){var r=this.__data__,n=ot(r,t);return 0>n?r.push([t,e]):r[n][1]=e,this},rt.prototype.clear=function(){this.__data__={hash:new tt,map:new(Y||et),string:new tt}},rt.prototype.delete=function(t){return ct(this,t).delete(t)},rt.prototype.get=function(t){return ct(this,t).get(t)},rt.prototype.has=function(t){return ct(this,t).has(t)},rt.prototype.set=function(t,e){return ct(this,t).set(t,e),this},nt.prototype.add=nt.prototype.push=function(t){return this.__data__.set(t,P),this},nt.prototype.has=function(t){return this.__data__.has(t)};var lt=function(t,e){return e=Q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,n=-1,o=Q(r.length-e,0),i=Array(o);++n<o;)i[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=i,x(t,this,a)}}((function(t){var e=C(t,at);return e.length&&e[0]===t[0]?function(t,e,r){for(var n=r?L:I,o=t[0].length,i=t.length,a=i,c=Array(i),u=1/0,s=[];a--;){var f=t[a];a&&e&&(f=C(f,$(e))),u=X(f.length,u),c[a]=r||!e&&(120>o||120>f.length)?void 0:new nt(a&&f)}f=t[0];var l=-1,p=c[0];t:for(;++l<o&&u>s.length;){var y=f[l],h=e?e(y):y;if(y=r||0!==y?y:0,!(p?D(p,h):n(s,h,r))){for(a=i;--a;){var g=c[a];if(!(g?D(g,h):n(t[a],h,r)))continue t}p&&p.push(h),s.push(y)}}return s}(e):[]}));function pt(t){return"string"==typeof t?t.length?[t]:[]:t}var yt=c((function(t){t.exports=function(){var t=Object.prototype.toString;function e(t,e){return null!=t&&Object.prototype.hasOwnProperty.call(t,e)}function r(t){if(!t)return!0;if(i(t)&&0===t.length)return!0;if("string"!=typeof t){for(var r in t)if(e(t,r))return!1;return!0}return!1}function n(e){return t.call(e)}function o(t){return"object"==typeof t&&"[object Object]"===n(t)}var i=Array.isArray||function(e){return"[object Array]"===t.call(e)};function a(t){return"boolean"==typeof t||"[object Boolean]"===n(t)}function c(t){var e=parseInt(t);return""+e===t?e:t}function u(t){var n,u=function t(e){return Object.keys(t).reduce((function(r,n){return"create"===n||"function"==typeof t[n]&&(r[n]=t[n].bind(t,e)),r}),{})};function s(t,e){if(n(t,e))return t[e]}function f(e,r,n,o){if("number"==typeof r&&(r=[r]),!r||0===r.length)return e;if("string"==typeof r)return f(e,r.split(".").map(c),n,o);var i=r[0],a=s(e,i);if(t.includeInheritedProps&&("__proto__"===i||"constructor"===i&&"function"==typeof a))throw Error("For security reasons, object's magic properties cannot be set");return 1===r.length?(void 0!==a&&o||(e[i]=n),a):(void 0===a&&(e[i]="number"==typeof r[1]?[]:{}),f(e[i],r.slice(1),n,o))}return n=(t=t||{}).includeInheritedProps?function(){return!0}:function(t,r){return"number"==typeof r&&Array.isArray(t)||e(t,r)},u.has=function(r,n){if("number"==typeof n?n=[n]:"string"==typeof n&&(n=n.split(".")),!n||0===n.length)return!!r;for(var o=0;n.length>o;o++){var a=c(n[o]);if(!("number"==typeof a&&i(r)&&r.length>a||(t.includeInheritedProps?a in Object(r):e(r,a))))return!1;r=r[a]}return!0},u.ensureExists=function(t,e,r){return f(t,e,r,!0)},u.set=function(t,e,r,n){return f(t,e,r,n)},u.insert=function(t,e,r,n){var o=u.get(t,e);n=~~n,i(o)||u.set(t,e,o=[]),o.splice(n,0,r)},u.empty=function(t,e){var c,s;if(!r(e)&&null!=t&&(c=u.get(t,e))){if("string"==typeof c)return u.set(t,e,"");if(a(c))return u.set(t,e,!1);if("number"==typeof c)return u.set(t,e,0);if(i(c))c.length=0;else{if(!o(c))return u.set(t,e,null);for(s in c)n(c,s)&&delete c[s]}}},u.push=function(t,e){var r=u.get(t,e);i(r)||u.set(t,e,r=[]),r.push.apply(r,Array.prototype.slice.call(arguments,2))},u.coalesce=function(t,e,r){for(var n,o=0,i=e.length;i>o;o++)if(void 0!==(n=u.get(t,e[o])))return n;return r},u.get=function(t,e,r){if("number"==typeof e&&(e=[e]),!e||0===e.length)return t;if(null==t)return r;if("string"==typeof e)return u.get(t,e.split("."),r);var n=c(e[0]),o=s(t,n);return void 0===o?r:1===e.length?o:u.get(t[n],e.slice(1),r)},u.del=function(t,e){if("number"==typeof e&&(e=[e]),null==t)return t;if(r(e))return t;if("string"==typeof e)return u.del(t,e.split("."));var o=c(e[0]);return n(t,o)?1!==e.length?u.del(t[o],e.slice(1)):(i(t)?t.splice(o,1):delete t[o],t):t},u}var s=u();return s.create=u,s.withInheritedProps=u({includeInheritedProps:!0}),s}()})),ht=new Map;function gt(t,e){e=n({caseSensitive:!1},e);var r=t+JSON.stringify(e);if(ht.has(r))return ht.get(r);var o="!"===t[0];o&&(t=t.slice(1)),t=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(t).replace(/\\\*/g,"[\\s\\S]*");var i=RegExp("^"+t+"$",e.caseSensitive?"":"i");return i.negated=o,ht.set(r,i),i}var vt=function(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Expected two arrays, got "+typeof t+" "+typeof e);if(0===e.length)return t;var n="!"===e[0][0];e=e.map((function(t){return gt(t,r)}));for(var o,a=[],c=i(t);!(o=c()).done;){for(var u,s=o.value,f=n,l=i(e);!(u=l()).done;){var p=u.value;p.test(s)&&(f=!p.negated)}f&&a.push(s)}return a};vt.isMatch=function(t,e,r){var n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[e];return n.some((function(t){return o.every((function(e){var n=gt(e,r),o=n.test(t);return n.negated?!o:o}))}))};var bt={ignoreKeys:[],ignorePaths:[],acceptArrays:!1,acceptArraysIgnore:[],enforceStrictKeyset:!0,schema:{},msg:"check-types-mini",optsVarName:"opts"};t.checkTypesMini=function(t,e,r){return function(t,e,r){function o(t){return null!=t}function i(t){return"Object"===u(t)}function a(t,e){return e=pt(e),Array.from(t).filter((function(t){return!e.some((function(e){return vt.isMatch(t,e,{caseSensitive:!0})}))}))}var c=Object.prototype.hasOwnProperty,s=["any","anything","every","everything","all","whatever","whatevs"];if(!o(t))throw Error("check-types-mini: [THROW_ID_01] First argument is missing!");var f=n(n({},bt),r);if(f.ignoreKeys=!o(f.ignoreKeys)||"string"!=typeof f.ignoreKeys&&!Array.isArray(f.ignoreKeys)?[]:pt(f.ignoreKeys),f.ignorePaths=!o(f.ignorePaths)||"string"!=typeof f.ignorePaths&&!Array.isArray(f.ignorePaths)?[]:pt(f.ignorePaths),f.acceptArraysIgnore=!o(f.acceptArraysIgnore)||"string"!=typeof f.acceptArraysIgnore&&!Array.isArray(f.acceptArraysIgnore)?[]:pt(f.acceptArraysIgnore),f.msg=(""+f.msg).trim(),":"===f.msg[f.msg.length-1]&&(f.msg=f.msg.slice(0,f.msg.length-1).trim()),i(f.schema))Object.keys(f.schema).forEach((function(t){if(i(f.schema[t])){var e={};T(f.schema[t],(function(r,n,o){var a=void 0!==n?n:r;return Array.isArray(a)||i(a)||(e[t+"."+o.path]=a),a})),delete f.schema[t],f.schema=n(n({},f.schema),e)}})),Object.keys(f.schema).forEach((function(t){Array.isArray(f.schema[t])||(f.schema[t]=[f.schema[t]]),f.schema[t]=f.schema[t].map((function(t){return(""+t).toLowerCase().trim()}))}));else if(null!=f.schema)throw Error("check-types-mini: opts.schema was customised to "+JSON.stringify(f.schema,null,0)+" which is not object but "+typeof f.schema);if(o(e)||(e={}),f.enforceStrictKeyset)if(o(f.schema)&&Object.keys(f.schema).length>0){if(e&&a(h(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema))),f.ignoreKeys).length){var l=h(Object.keys(t),Object.keys(e).concat(Object.keys(f.schema)));throw new TypeError(f.msg+": "+f.optsVarName+".enforceStrictKeyset is on and the following key"+(l.length>1?"s":"")+" "+(l.length>1?"are":"is")+" not covered by schema and/or reference objects: "+l.join(", "))}}else{if(!i(e)||0>=Object.keys(e).length)throw new TypeError(f.msg+": Both "+f.optsVarName+".schema and reference objects are missing! We don't have anything to match the keys as you requested via opts.enforceStrictKeyset!");if(0!==a(h(Object.keys(t),Object.keys(e)),f.ignoreKeys).length){var p=h(Object.keys(t),Object.keys(e));throw new TypeError(f.msg+": The input object has key"+(p.length>1?"s":"")+" which "+(p.length>1?"are":"is")+" not covered by the reference object: "+p.join(", "))}if(0!==a(h(Object.keys(e),Object.keys(t)),f.ignoreKeys).length){var y=h(Object.keys(e),Object.keys(t));throw new TypeError(f.msg+": The reference object has key"+(y.length>1?"s":"")+" which "+(y.length>1?"are":"is")+" not present in the input object: "+y.join(", "))}}var g=[];T(t,(function(r,n,o){var a=n,l=r;if("array"===o.parentType&&(l=void 0,a=r),Array.isArray(g)&&g.length&&g.some((function(t){return o.path.startsWith(t)})))return a;if(l&&f.ignoreKeys.some((function(t){return vt.isMatch(l,t)})))return a;if(f.ignorePaths.some((function(t){return vt.isMatch(o.path,t)})))return a;var p=!(!i(a)&&!Array.isArray(a)&&Array.isArray(o.parent)),y=!1;i(f.schema)&&c.call(f.schema,o.path)&&(y=!0);var h=!1;if(i(e)&&yt.has(e,o.path)&&(h=!0),f.enforceStrictKeyset&&p&&!y&&!h)throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" is neither covered by reference object (second input argument), nor "+f.optsVarName+".schema! To stop this error, turn off "+f.optsVarName+".enforceStrictKeyset or provide some type reference (2nd argument or "+f.optsVarName+".schema).\n\nDebug info:\n\nobj = "+JSON.stringify(t,null,4)+"\n\nref = "+JSON.stringify(e,null,4)+"\n\ninnerObj = "+JSON.stringify(o,null,4)+"\n\nopts = "+JSON.stringify(f,null,4)+"\n\ncurrent = "+JSON.stringify(a,null,4)+"\n\n");if(y){var v=pt(f.schema[o.path]).map((function(t){return(""+t).toLowerCase()}));if(yt.set(f.schema,o.path,v),lt(v,s).length)g.push(o.path);else if(!0!==a&&!1!==a&&!v.includes(u(a).toLowerCase())||(!0===a||!1===a)&&!v.includes(a+"")&&!v.includes("boolean")){if(!Array.isArray(a)||!f.acceptArrays)throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to "+("string"!==u(a)?'"':"")+JSON.stringify(a,null,0)+("string"!==u(a)?'"':"")+" (type: "+u(a).toLowerCase()+") which is not among the allowed types in schema (which is equal to "+JSON.stringify(v,null,0)+")");for(var b=0,d=a.length;d>b;b++)if(!v.includes(u(a[b]).toLowerCase()))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+"."+b+", the "+b+"th element (equal to "+JSON.stringify(a[b],null,0)+") is of a type "+u(a[b]).toLowerCase()+", but only the following are allowed by the "+f.optsVarName+".schema: "+v.join(", "))}}else if(e&&i(e)&&h){var _=yt.get(e,o.path);if(f.acceptArrays&&Array.isArray(a)&&!f.acceptArraysIgnore.includes(r)){if(!a.every((function(t){return u(t).toLowerCase()===u(e[r]).toLowerCase()})))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to be array, but not all of its elements are "+u(e[r]).toLowerCase()+"-type")}else if(u(a)!==u(_))throw new TypeError(f.msg+": "+f.optsVarName+"."+o.path+" was customised to "+("string"===u(a).toLowerCase()?"":'"')+JSON.stringify(a,null,0)+("string"===u(a).toLowerCase()?"":'"')+" which is not "+u(_).toLowerCase()+" but "+u(a).toLowerCase())}return a}))}(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})}));

M packages/check-types-mini/package.json => packages/check-types-mini/package.json +0 -1
@@ 112,7 112,6 @@
    "@typescript-eslint/eslint-plugin": "^4.11.0",
    "@typescript-eslint/parser": "^4.11.0",
    "eslint": "^7.15.0",
    "fs-extra": "^9.0.1",
    "lect": "^0.15.1",
    "rollup": "^2.35.1",
    "rollup-plugin-ascii": "^0.0.3",

M packages/check-types-mini/rollup.config.js => packages/check-types-mini/rollup.config.js +5 -7
@@ 68,8 68,8 @@ export default (commandLineArgs) => {
        terser({
          compress: {
            pure_getters: true,
            unsafe: true,
            unsafe_comps: true,
            unsafe: false,
            unsafe_comps: false,
            warnings: false,
          },
        }),


@@ 117,9 117,7 @@ export default (commandLineArgs) => {
    // CommonJS
    {
      input: "src/main.ts",
      output: [
        { dir: "./", entryFileNames: pkg.main, format: "cjs", indent: false },
      ],
      output: [{ dir: "./", entryFileNames: pkg.main, format: "cjs", indent: false }],
      external: makeExternalPredicate([
        ...Object.keys(pkg.dependencies || {}),
        ...Object.keys(pkg.peerDependencies || {}),


@@ 226,8 224,8 @@ export default (commandLineArgs) => {
        terser({
          compress: {
            pure_getters: true,
            unsafe: true,
            unsafe_comps: true,
            unsafe: false,
            unsafe_comps: false,
            warnings: false,
          },
        }),

M packages/check-types-mini/src/main.ts => packages/check-types-mini/src/main.ts +42 -59
@@ 6,7 6,7 @@ import { arrayiffy } from "arrayiffy-if-string";
import objectPath from "object-path";
import matcher from "matcher";

interface UnknownValueObj {
interface Obj {
  [key: string]: any;
}



@@ 16,7 16,7 @@ interface Opts {
  acceptArrays?: boolean;
  acceptArraysIgnore?: string | string[];
  enforceStrictKeyset?: boolean;
  schema?: UnknownValueObj;
  schema?: Obj;
  msg?: string;
  optsVarName?: string;
}


@@ 33,11 33,7 @@ const defaults: Opts = {
};

// fourth input argument is shielded from an external API:
function internalApi(
  obj: UnknownValueObj,
  ref: UnknownValueObj,
  originalOptions?: Opts
) {
function internalApi(obj: Obj, ref: Obj | null, originalOptions?: Opts) {
  //
  // Functions
  // =========


@@ 140,27 136,24 @@ function internalApi(
    //     option2: "whatever"
    //   }
    // }
    Object.keys(opts.schema as UnknownValueObj).forEach((oneKey) => {
      if (isObj((opts.schema as UnknownValueObj)[oneKey])) {
    Object.keys(opts.schema as Obj).forEach((oneKey) => {
      if (isObj((opts.schema as Obj)[oneKey])) {
        // 1. extract all unique AST branches leading to their tips
        const tempObj: UnknownValueObj = {};
        traverse(
          (opts.schema as UnknownValueObj)[oneKey],
          (key, val, innerObj) => {
            const current = val !== undefined ? val : key;
            console.log(
              `147 ${`\u001b[${33}m${`current`}\u001b[${39}m`} = ${JSON.stringify(
                current,
                null,
                4
              )} at ${innerObj.path}`
            );
            if (!Array.isArray(current) && !isObj(current)) {
              tempObj[`${oneKey}.${innerObj.path}`] = current;
            }
            return current;
        const tempObj: Obj = {};
        traverse((opts.schema as Obj)[oneKey], (key, val, innerObj) => {
          const current = val !== undefined ? val : key;
          console.log(
            `147 ${`\u001b[${33}m${`current`}\u001b[${39}m`} = ${JSON.stringify(
              current,
              null,
              4
            )} at ${innerObj.path}`
          );
          if (!Array.isArray(current) && !isObj(current)) {
            tempObj[`${oneKey}.${innerObj.path}`] = current;
          }
        );
          return current;
        });

        console.log(
          `160 FINAL ${`\u001b[${33}m${`tempObj`}\u001b[${39}m`} = ${JSON.stringify(


@@ 171,7 164,7 @@ function internalApi(
        );

        // 2. delete that key which leads to object:
        delete (opts.schema as UnknownValueObj)[oneKey];
        delete (opts.schema as Obj)[oneKey];

        // 3. merge in all paths-as-keys into schema opts object:
        opts.schema = { ...opts.schema, ...tempObj };


@@ 193,18 186,14 @@ function internalApi(
    //

    // 2. arrayiffy
    Object.keys(opts.schema as UnknownValueObj).forEach((oneKey) => {
      if (!Array.isArray((opts.schema as UnknownValueObj)[oneKey])) {
        (opts.schema as UnknownValueObj)[oneKey] = [
          (opts.schema as UnknownValueObj)[oneKey],
        ];
    Object.keys(opts.schema as Obj).forEach((oneKey) => {
      if (!Array.isArray((opts.schema as Obj)[oneKey])) {
        (opts.schema as Obj)[oneKey] = [(opts.schema as Obj)[oneKey]];
      }
      // then turn all keys into strings and trim and lowercase them:
      (opts.schema as UnknownValueObj)[
      (opts.schema as Obj)[oneKey] = (opts.schema as Obj)[
        oneKey
      ] = (opts.schema as UnknownValueObj)[oneKey].map((el: any) =>
        `${el}`.toLowerCase().trim()
      );
      ].map((el: any) => `${el}`.toLowerCase().trim());
    });
  } else if (opts.schema != null) {
    throw new Error(


@@ 243,15 232,13 @@ function internalApi(
    console.log(
      `240 so \u001b[${31}m${`opts.enforceStrictKeyset is ON`}\u001b[${39}m`
    );
    if (
      existy(opts.schema) &&
      Object.keys(opts.schema as UnknownValueObj).length > 0
    ) {
    if (existy(opts.schema) && Object.keys(opts.schema as Obj).length > 0) {
      if (
        ref &&
        pullAllWithGlob(
          pullAll(
            Object.keys(obj),
            Object.keys(ref).concat(Object.keys(opts.schema as UnknownValueObj))
            Object.keys(ref).concat(Object.keys(opts.schema as Obj))
          ),
          opts.ignoreKeys as string[]
        ).length


@@ 259,7 246,7 @@ function internalApi(
        console.log("271");
        const keys = pullAll(
          Object.keys(obj),
          Object.keys(ref).concat(Object.keys(opts.schema as UnknownValueObj))
          Object.keys(ref).concat(Object.keys(opts.schema as Obj))
        );
        throw new TypeError(
          `${opts.msg}: ${


@@ 271,14 258,14 @@ function internalApi(
          } not covered by schema and/or reference objects: ${keys.join(", ")}`
        );
      }
    } else if (existy(ref) && Object.keys(ref).length > 0) {
    } else if (isObj(ref) && Object.keys(ref as Obj).length > 0) {
      if (
        pullAllWithGlob(
          pullAll(Object.keys(obj), Object.keys(ref)),
          pullAll(Object.keys(obj), Object.keys(ref as Obj)),
          opts.ignoreKeys as string[]
        ).length !== 0
      ) {
        const keys = pullAll(Object.keys(obj), Object.keys(ref));
        const keys = pullAll(Object.keys(obj), Object.keys(ref as Obj));
        throw new TypeError(
          `${opts.msg}: The input object has key${
            keys.length > 1 ? "s" : ""


@@ 288,11 275,11 @@ function internalApi(
        );
      } else if (
        pullAllWithGlob(
          pullAll(Object.keys(ref), Object.keys(obj)),
          pullAll(Object.keys(ref as Obj), Object.keys(obj)),
          opts.ignoreKeys as string[]
        ).length !== 0
      ) {
        const keys = pullAll(Object.keys(ref), Object.keys(obj));
        const keys = pullAll(Object.keys(ref as Obj), Object.keys(obj));
        throw new TypeError(
          `${opts.msg}: The reference object has key${
            keys.length > 1 ? "s" : ""


@@ 521,7 508,7 @@ function internalApi(
    );

    let refHasThisPathDefined = false;
    if (isObj(ref) && objectPath.has(ref, innerObj.path)) {
    if (isObj(ref) && objectPath.has(ref as Obj, innerObj.path)) {
      refHasThisPathDefined = true;
    }
    console.log(


@@ 580,13 567,13 @@ current = ${JSON.stringify(current, null, 4)}\n\n`
      // be raw null/undefined, which would be arrayified and turned into string.
      console.log(
        `592 ${`\u001b[${33}m${`objectPath.get(opts.schema, innerObj.path)`}\u001b[${39}m`} = ${JSON.stringify(
          objectPath.get(opts.schema as UnknownValueObj, innerObj.path),
          objectPath.get(opts.schema as Obj, innerObj.path),
          null,
          4
        )}`
      );
      const currentKeysSchema = arrayiffy(
        (opts.schema as UnknownValueObj)[innerObj.path]
        (opts.schema as Obj)[innerObj.path]
      ).map((el: any) => `${el}`.toLowerCase());
      console.log(
        `602 ${`\u001b[${33}m${`currentKeysSchema`}\u001b[${39}m`} = ${JSON.stringify(


@@ 596,11 583,7 @@ current = ${JSON.stringify(current, null, 4)}\n\n`
        )}`
      );

      objectPath.set(
        opts.schema as UnknownValueObj,
        innerObj.path,
        currentKeysSchema
      );
      objectPath.set(opts.schema as Obj, innerObj.path, currentKeysSchema);

      // step 2. First check does our schema contain any blanket names, "any", "whatever" etc.
      if (!intersection(currentKeysSchema, NAMESFORANYTYPE).length) {


@@ 686,7 669,7 @@ current = ${JSON.stringify(current, null, 4)}\n\n`
          )}`
        );
      }
    } else if (refHasThisPathDefined) {
    } else if (ref && isObj(ref) && refHasThisPathDefined) {
      console.log(
        `\u001b[${31}m${`696 II. matching against ref.`}\u001b[${39}m`
      );


@@ 713,7 696,7 @@ current = ${JSON.stringify(current, null, 4)}\n\n`
      ) {
        console.log("720 2-1: check accept arrays");
        const allMatch = current.every(
          (el) => typ(el).toLowerCase() === typ(ref[key]).toLowerCase()
          (el) => typ(el).toLowerCase() === typ((ref as Obj)[key]).toLowerCase()
        );
        if (!allMatch) {
          throw new TypeError(


@@ 753,8 736,8 @@ current = ${JSON.stringify(current, null, 4)}\n\n`
}

function checkTypesMini(
  obj: UnknownValueObj,
  ref: UnknownValueObj,
  obj: Obj,
  ref: Obj | null,
  originalOptions?: Opts
): void {
  return internalApi(obj, ref, originalOptions);

M packages/check-types-mini/types/main.d.ts => packages/check-types-mini/types/main.d.ts +3 -3
@@ 1,4 1,4 @@
interface UnknownValueObj {
interface Obj {
    [key: string]: any;
}
interface Opts {


@@ 7,9 7,9 @@ interface Opts {
    acceptArrays?: boolean;
    acceptArraysIgnore?: string | string[];
    enforceStrictKeyset?: boolean;
    schema?: UnknownValueObj;
    schema?: Obj;
    msg?: string;
    optsVarName?: string;
}
declare function checkTypesMini(obj: UnknownValueObj, ref: UnknownValueObj, originalOptions?: Opts): void;
declare function checkTypesMini(obj: Obj, ref: Obj | null, originalOptions?: Opts): void;
export { checkTypesMini };

D packages/chlu-cli/.npmignore => packages/chlu-cli/.npmignore +0 -25
@@ 1,25 0,0 @@
# .... generated using www.npmjs.com/package/lect ....
#
#
#       __         ______     ______     ______  
#      /\ \       /\  ___\   /\  ___\   /\__  _\ 
#      \ \ \____  \ \  __\   \ \ \____  \/_/\ \/ 
#       \ \_____\  \ \_____\  \ \_____\    \ \_\ 
#        \/_____/   \/_____/   \/_____/     \/_/ 
#  
#

# folders:

.nyc_output
coverage
media
test

# files:

.npmignore
.prettierignore
chlu_adds_missing_diff_links.gif
feature1.gif
testStats.md

D packages/chlu-cli/.prettierignore => packages/chlu-cli/.prettierignore +0 -5
@@ 1,5 0,0 @@
dist/
test/fixtures
fixtures/
*.json
testStats.md

D packages/chlu-cli/CHANGELOG.md => packages/chlu-cli/CHANGELOG.md +0 -125
@@ 1,125 0,0 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 1.17.0 (2020-11-28)

Accidental version bump during migration to sourcehut. Sorry about that.

## 1.16.50 (2019-11-20)

### Bug Fixes

- update to the latest v4 meow api, fix aliases ([66fda3d](https://gitlab.com/codsen/codsen/commit/66fda3dc8973938f0b947cef684cc0c16c2d95ad))

## 1.16.38 (2019-08-15)

### Bug Fixes

- fix the CLI to make it read package.json files properly ([6caaffc](https://gitlab.com/codsen/codsen/commit/6caaffc))

## 1.16.0 (2019-01-20)

- ✨ Various documentation and setup tweaks after we migrated to monorepo
- ✨ Setup refresh: updated dependencies and all config files using automated tools

## 1.13.0 (2018-12-26)

- ✨ Add unit tests ([0692e46](https://gitlab.com/codsen/codsen/tree/master/packages/chlu-cli/commits/0692e46))
- ✨ Add atomic file writing ([82f1065](https://gitlab.com/codsen/codsen/tree/master/packages/chlu-cli/commits/82f1065))
- ✨ Add Bitbucket support ([ea95929](https://gitlab.com/codsen/codsen/tree/master/packages/chlu-cli/commits/ea95929))
- ✨ Now recognises Bitbucket and more ([d541303](https://gitlab.com/codsen/codsen/tree/master/packages/chlu-cli/commits/d541303))

## 1.12.0 (2018-10-14)

- ✨ Set up file writing to be atomic
- ✨ Updated all dependencies and restored unit test coverage tracking: reporting in terminal and coveralls.io

## 1.11.0 (2018-07-24)

- ✨ Added unit tests. Couldn't get the unit test coverage only for lines which get triggered when CLI fails to write because I can't programmatically trigger disk write failures. Otherwise, it's 100% coverage.

## 1.10.0 (2018-07-14)

- ✨ Migrated this repo to Bitbucket and made it to automatically detect and generate the correct Bitbucket links
- ✨ Tapped `fs-extra` and rewrote everything in Promises
- ✨ It taps the Git data (if available) to make the diff links more precise: the "from" tag's version is picked not from existing titles in changelog (where only minor releases are often mentioned) but from real, previous patch release (which can be done way later than the last release, mentioned in changelog). This means, diff link contents will have less info about meaningless maintenance (patch) updates.
- ✨ Alongside, developed and tapped the API's, `chlu` diff link correction.

## 1.9.0 (2018-05-03)

- ✨ Set up [Prettier](https://prettier.io)
- ✨ Removed `package.lock` and `.editorconfig`
- ✨ Wired Rollup to remove comments from non-dev builds. This means we can now leave the `console.log`s in the source code — Rollup will remove them during the builds.
- ✨ Stopped transpiling to ES5, dropped Babel and bumped the Node engines to `>=8`

## 1.8.0 (2017-09-24)

### Changed

- ✨ Removed JS Standard and swiched to raw ESLint on `airbnb-base` preset with config override to ban semicolons.
- ✨ Made all linting checks to pass
- ✨ Tweaked readme
- ✨ Added gif files to `npmignore` so they don't get `npm i`nstalled
- ✨ Updated bithound config to reflect the new setup

## 1.7.0 (2017-08-22)

### Added

- ✨ More badges to `readme`

### Updated

- ✨ Deps and `package.json`

## 1.6.0 (2017-07-23)

### Updated

- ✨ Updated to the latest API, adding recognition of the dates in titles in format `2014/04-15`

## 1.5.0 (2017-07-22)

### Updated

- ✨ Updated to the latest API, adding improved recognition of the titles
- ✨ Documentation with up-to-date author's name

### Added

- ✨ `npmignore`

## 1.4.0 (2017-06-29)

### Updated

Updated all dependencies

## 1.3.0 (2017-06-29)

### Added

Updated to the new version of the API package, CHLU, enabling new features:

- ✨ Improved algorithm, reducing the change of false positives when versions are mentioned within the text.

## 1.2.0 (2017-06-23)

### Added

Updated to the new version of the API package, CHLU, enabling new features:

- ✨ Automatic title linking
- ✨ Unused footer link removal

## 1.1.0 (2017-05-19)

### Added

- ✨ Set up the `update-notifier`

## 1.0.0 (2017-05-17)

- ✨ First public release

D packages/chlu-cli/README.md => packages/chlu-cli/README.md +0 -49
@@ 1,49 0,0 @@
# chlu-cli

> CH-ange-L-og U-pdate - Automatically fix errors in your changelog file

<div class="package-badges">
  <a href="https://www.npmjs.com/package/chlu-cli" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
  </a>
  <a href="https://codsen.com/os/chlu-cli" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
  </a>
  <a href="https://git.sr.ht/~royston/codsen/tree/master/packages/chlu-cli" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-sourcehut-blue?style=flat-square" alt="page on sourcehut">
  </a>
  <a href="https://npmcharts.com/compare/chlu-cli?interval=30" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/npm/dm/chlu-cli.svg?style=flat-square" alt="Downloads per month">
  </a>
  <a href="https://prettier.io" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg?style=flat-square" alt="Code style: prettier">
  </a>
  <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
  <a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
  </a>
</div>

## Install

```bash
npm i -g chlu-cli
```

Then, call it from the command line using keyword:

```bash
chlu
```

## Documentation

Please [visit codsen.com](https://codsen.com/os/chlu-cli/) for a full description of the API and examples.

## Licence

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors

<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">

D packages/chlu-cli/chlu_adds_missing_diff_links.gif => packages/chlu-cli/chlu_adds_missing_diff_links.gif +0 -0
D packages/chlu-cli/cli.js => packages/chlu-cli/cli.js +0 -120
@@ 1,120 0,0 @@
#!/usr/bin/env node

/* eslint no-console:0 */

const writeFileAtomic = require("write-file-atomic");
const updateNotifier = require("update-notifier");
const git = require("simple-git/promise");
const { promisify } = require("util");
const chlu = require("chlu");
const fs = require("fs-extra");
const path = require("path");
const meow = require("meow");

const { log } = console;
const messagePrefix = `\u001b[${90}m${"✨ chlu: "}\u001b[${39}m`;

const cli = meow(
  `
  Usage
    $ chlu

  Options
    --loud, -l  Enables logs in the console

  Example
    Just call it in the root, where your package.json is located
`,
  {
    flags: {
      loud: {
        type: "boolean",
        alias: "l",
        default: false,
      },
    },
  }
);
updateNotifier({ pkg: cli.pkg }).notify();

// getTags(dir)
// produces either null of a plain object, for example:
// {
//     "latest": "2018-05-03|v1.9.1",
//     "all": [
//         "2017-05-19|v1.1.0",
//         "2017-05-19|v1.1.1",
//         "2017-06-19|v1.1.2",
//     ]
// }

(async () => {
  //
  //                                1.

  let changelogData;
  try {
    changelogData = await fs.readFile(path.resolve("./changelog.md"), "utf8");
  } catch (e) {
    log(
      `${messagePrefix}[ID_1] Alas! We couldn't fetch the changelog.md:\n${e}`
    );
    process.exit(0);
  }

  //                                2.

  let packageData = null;
  try {
    packageData = await fs.readJson(path.resolve("package.json"));
  } catch (e) {
    if (cli.flags.loud) {
      log(
        `${messagePrefix}[ID_2] couldn't fetch the package.json. Will continue without.`
      );
    }
  }

  //                                3.

  let gitData = null;
  try {
    fs.accessSync("./.git");
    gitData = await git().tags({
      "--format": "%(creatordate:short)|%(refname:short)",
    });
  } catch (e) {
    if (cli.flags.loud) {
      log(
        `${messagePrefix}[ID_3] Couldn't fetch the Git data! Will continue without.`
      );
    }
  }

  //                                4.

  try {
    const contentToWrite = chlu(changelogData, gitData, packageData);
    // insurance against writing empty file:
    if (
      !contentToWrite ||
      typeof contentToWrite !== "string" ||
      !contentToWrite.length
    ) {
      process.exit(0);
    }
    await promisify(writeFileAtomic)(
      path.resolve("./changelog.md"),
      contentToWrite
    ).then(() => {
      if (cli.flags.loud) {
        log(`${messagePrefix} ${`\u001b[${32}m${`OK.`}\u001b[${39}m`}`);
      }
    });
  } catch (e) {
    log(
      `${messagePrefix}[ID_4] Alas! We couldn't write the changelog.md!\n${e}`
    );
    process.exit(0);
  }
})();

D packages/chlu-cli/coverage/coverage-summary.json => packages/chlu-cli/coverage/coverage-summary.json +0 -1
@@ 1,1 0,0 @@
{"total":{"lines":{"total":37,"covered":33,"skipped":0,"pct":89.19},"statements":{"total":37,"covered":33,"skipped":0,"pct":89.19},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"branches":{"total":11,"covered":10,"skipped":0,"pct":90.91}}}
\ No newline at end of file

D packages/chlu-cli/feature1.gif => packages/chlu-cli/feature1.gif +0 -0
D packages/chlu-cli/media/0_idea.png => packages/chlu-cli/media/0_idea.png +0 -0
D packages/chlu-cli/media/features_comp.png => packages/chlu-cli/media/features_comp.png +0 -0
D packages/chlu-cli/media/features_comp.psd => packages/chlu-cli/media/features_comp.psd +0 -0
D packages/chlu-cli/package.json => packages/chlu-cli/package.json +0 -125
@@ 1,125 0,0 @@
{
  "name": "chlu-cli",
  "version": "1.17.1",
  "description": "CH-ange-L-og U-pdate - Automatically fix errors in your changelog file",
  "keywords": [
    "automated",
    "automatically",
    "change",
    "changelog",
    "cli",
    "cli-app",
    "correct",
    "errors",
    "fix",
    "links",
    "log",
    "markdown",
    "missing",
    "tool",
    "update"
  ],
  "homepage": "https://codsen.com/os/chlu-cli/",
  "repository": "https://git.sr.ht/~royston/codsen",
  "license": "MIT",
  "author": {
    "name": "Roy Revelt",
    "email": "roy@codsen.com",
    "url": "https://codsen.com"
  },
  "bin": {
    "chlu": "cli.js"
  },
  "scripts": {
    "ci_test": "tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov && npm run format",
    "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
    "dev": "echo\"\"",
    "devunittest": "npm run dev && ./node_modules/.bin/tap --only -R 'base' && npm run clean_cov",
    "format": "npm run lect && npm run prettier && npm run lint",
    "lect": "lect",
    "lint": "../../node_modules/eslint/bin/eslint.js \"**/*.js\" --fix --config \"../../.eslintrc.json\" --quiet",
    "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
    "republish": "npm publish || :",
    "tap": "tap",
    "test": "npm run lint && npm run unittest && npm run format",
    "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md --reporter=terse && npm run clean_cov"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run format && npm test"
    }
  },
  "tap": {
    "coverage-report": [
      "json-summary",
      "text"
    ],
    "nyc-arg": [
      "--exclude=**/*.cjs.js",
      "--exclude=**/*.umd.js"
    ],
    "timeout": 0
  },
  "lect": {
    "defaultExported": false,
    "files": {
      "delete": [],
      "write_hard": [
        {
          "contents": "",
          "name": ""
        }
      ],
      "write_soft": [
        {
          "contents": "",
          "name": ""
        }
      ]
    },
    "licence": {
      "extras": [
        ""
      ]
    },
    "npmignore": {
      "badFiles": [],
      "badFolders": [],
      "goodFiles": [],
      "goodFolders": []
    },
    "various": {
      "devDependencies": [
        "execa"
      ]
    }
  },
  "dependencies": {
    "chlu": "^3.8.1",
    "fs-extra": "^9.0.1",
    "meow": "^8.0.0",
    "simple-git": "^2.27.0",
    "update-notifier": "^5.0.1",
    "write-file-atomic": "^3.0.3"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/plugin-proposal-class-properties": "^7.12.1",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
    "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
    "@babel/plugin-proposal-optional-chaining": "^7.12.7",
    "@babel/preset-env": "^7.12.10",
    "@rollup/plugin-babel": "^5.2.2",
    "@rollup/plugin-commonjs": "^17.0.0",
    "@rollup/plugin-json": "^4.1.0",
    "@rollup/plugin-node-resolve": "^11.0.1",
    "@rollup/plugin-strip": "^2.0.0",
    "eslint": "^7.15.0",
    "execa": "^5.0.0",
    "lect": "^0.15.1",
    "prettier": "^2.2.1",
    "tap": "^14.11.0",
    "tempy": "^1.0.0",
    "tsd": "^0.14.0"
  }
}
\ No newline at end of file

D packages/chlu-cli/test/test.js => packages/chlu-cli/test/test.js +0 -693
@@ 1,693 0,0 @@
import fs from "fs-extra";
import tap from "tap";
import path from "path";
import execa from "execa";
import tempy from "tempy";

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  1
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

tap.test("01 - there are no usable files at all", async (t) => {
  const tempFolder = tempy.directory();
  fs.ensureDirSync(path.resolve(tempFolder));
  const processedFileContents = fs
    .writeFile(path.join(tempFolder, "file.md"), "zzz")
    .then(() =>
      execa(`cd ${tempFolder} && ${path.join(__dirname, "../", "cli.js")}`, {
        shell: true,
      })
    )
    .then(() => fs.readFile(path.join(tempFolder, "file.md"), "utf8"))
    .catch((err) => t.fail(err));
  // confirm that the existing file is intact:
  t.strictSame(await processedFileContents, "zzz", "01");
  t.end();
});

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  2
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

tap.test(
  "02 - only changelog present in the root - default (not --loud)",
  async (t) => {
    const originalChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
`;

    const intendedChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/WRONG/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
[1.1.0]: https://github.com/codsen/WRONG/compare/v1.0.0...v1.1.0
`;

    // 1. fetch us an empty, random, temporary folder:

    // Re-route the test files into `temp/` folder instead for easier access when
    // troubleshooting. Just comment out one of two:
    const tempFolder = tempy.directory();
    // const tempFolder = "temp";
    fs.ensureDirSync(path.resolve(tempFolder));

    // 2. asynchronously write all test files
    const processedFileContents = fs
      .writeFile(path.join(tempFolder, "changelog.md"), originalChangelog)
      .then(() =>
        execa(`cd ${tempFolder} && ${path.join(__dirname, "../", "cli.js")}`, {
          shell: true,
        })
      )
      .then(() => fs.readFile(path.join(tempFolder, "changelog.md"), "utf8"))
      .catch((err) => t.fail(err));

    t.strictSame(await processedFileContents, intendedChangelog, "02");
    t.end();
  }
);

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  3
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

tap.test(
  "03 - package + changelog in the root - default (not --loud)",
  async (t) => {
    const originalChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
`;

    const intendedChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/correct-lib/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/correct-lib/compare/v1.1.1...v1.2.0
[1.1.0]: https://github.com/codsen/correct-lib/compare/v1.0.0...v1.1.0
`;

    const inputPackageJson = {
      name: "correct-lib",
      version: "1.3.0",
      description: "Does many fancy things",
      main: "index.js",
      scripts: {
        coverage: "nyc report --reporter=text-lcov | coveralls",
        precommit: "npm test",
        test: "standard && nyc --reporter=html --reporter=text ava",
      },
      repository: {
        type: "git",
        url: "https://github.com/codsen/correct-lib.git",
      },
      keywords: [],
      author: {
        name: "Roy Revelt",
        email: "roy@codsen.com",
        url: "codsen.com",
      },
      license: "MIT",
      bugs: {
        url: "https://github.com/codsen/correct-lib/issues",
      },
      homepage: "https://github.com/codsen/correct-lib#readme",
      dependencies: {},
      devDependencies: {},
    };

    // 1. fetch us an empty, random, temporary folder:

    // Re-route the test files into `temp/` folder instead for easier access when
    // troubleshooting. Just comment out one of two:
    const tempFolder = tempy.directory();
    // const tempFolder = "temp";
    fs.ensureDirSync(path.resolve(tempFolder));

    // 2. asynchronously write all test files
    const processedFileContents = fs
      .writeFile(path.join(tempFolder, "changelog.md"), originalChangelog)
      .then(() =>
        fs.writeJson(path.join(tempFolder, "package.json"), inputPackageJson, {
          spaces: 2,
        })
      )
      .then(() =>
        execa(`cd ${tempFolder} && ${path.join(__dirname, "../", "cli.js")}`, {
          shell: true,
        })
      )
      .then(() => fs.readFile(path.join(tempFolder, "changelog.md"), "utf8"))
      .catch((err) => t.fail(err));

    t.strictSame(await processedFileContents, intendedChangelog, "03");
    t.end();
  }
);

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  4
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

tap.test("04 - only changelog present in the root - loud", async (t) => {
  const originalChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
`;

  const intendedChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/WRONG/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
[1.1.0]: https://github.com/codsen/WRONG/compare/v1.0.0...v1.1.0
`;

  // 1. fetch us an empty, random, temporary folder:

  // Re-route the test files into `temp/` folder instead for easier access when
  // troubleshooting. Just comment out one of two:
  const tempFolder = tempy.directory();
  // const tempFolder = "temp";
  fs.ensureDirSync(path.resolve(tempFolder));

  // 2. asynchronously write all test files
  const processedFileContents = fs
    .writeFile(path.join(tempFolder, "changelog.md"), originalChangelog)
    .then(() =>
      execa(
        `cd ${tempFolder} && ${path.join(__dirname, "../", "cli.js")} --loud`,
        { shell: true }
      )
    )
    .then(() => fs.readFile(path.join(tempFolder, "changelog.md"), "utf8"))
    .catch((err) => t.fail(err));

  t.strictSame(await processedFileContents, intendedChangelog, "04");
  t.end();
});

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  5
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

tap.test("05 - package + changelog in the root - loud", async (t) => {
  const originalChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/WRONG/compare/v1.3.0...v1.4.0
[1.2.0]: https://github.com/codsen/WRONG/compare/v1.1.1...v1.2.0
`;

  const intendedChangelog = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/correct-lib/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/correct-lib/compare/v1.1.1...v1.2.0
[1.1.0]: https://github.com/codsen/correct-lib/compare/v1.0.0...v1.1.0
`;

  const inputPackageJson = {
    name: "correct-lib",
    version: "1.3.0",
    description: "Does many fancy things",
    main: "index.js",
    scripts: {
      coverage: "nyc report --reporter=text-lcov | coveralls",
      precommit: "npm test",
      test: "standard && nyc --reporter=html --reporter=text ava",
    },
    repository: {
      type: "git",
      url: "https://github.com/codsen/correct-lib.git",
    },
    keywords: [],
    author: {
      name: "Roy Revelt",
      email: "roy@codsen.com",
      url: "codsen.com",
    },
    license: "MIT",
    bugs: {
      url: "https://github.com/codsen/correct-lib/issues",
    },
    homepage: "https://github.com/codsen/correct-lib#readme",
    dependencies: {},
    devDependencies: {},
  };

  // 1. fetch us an empty, random, temporary folder:

  // Re-route the test files into `temp/` folder instead for easier access when
  // troubleshooting. Just comment out one of two:
  const tempFolder = tempy.directory();
  // const tempFolder = "temp";
  fs.ensureDirSync(path.resolve(tempFolder));

  // 2. asynchronously write all test files
  const processedFileContents = fs
    .writeFile(path.join(tempFolder, "changelog.md"), originalChangelog)
    .then(() =>
      fs.writeJson(path.join(tempFolder, "package.json"), inputPackageJson, {
        spaces: 2,
      })
    )
    .then(() =>
      execa(`cd ${tempFolder} && ${path.join(__dirname, "../", "cli.js")} -l`, {
        shell: true,
      })
    )
    .then(() => fs.readFile(path.join(tempFolder, "changelog.md"), "utf8"))
    .catch((err) => t.fail(err));

  t.strictSame(await processedFileContents, intendedChangelog, "05");
  t.end();
});

//                                  *
//                                  *
//                                  *
//                                  *
//                                  *
//
//                                  ?
//
//                                  *
//                                  *
//                                  *
//                                  *
//                                  *

D packages/chlu/.npmignore => packages/chlu/.npmignore +0 -26
@@ 1,26 0,0 @@
# .... generated using www.npmjs.com/package/lect ....
#
#
#       __         ______     ______     ______  
#      /\ \       /\  ___\   /\  ___\   /\__  _\ 
#      \ \ \____  \ \  __\   \ \ \____  \/_/\ \/ 
#       \ \_____\  \ \_____\  \ \_____\    \ \_\ 
#        \/_____/   \/_____/   \/_____/     \/_/ 
#  
#

# folders:

.nyc_output
coverage
perf
src
test

# files:

.npmignore
.prettierignore
ideas.md
rollup.config.js
testStats.md

D packages/chlu/.prettierignore => packages/chlu/.prettierignore +0 -5
@@ 1,5 0,0 @@
dist/
test/fixtures
fixtures/
*.json
testStats.md

D packages/chlu/CHANGELOG.md => packages/chlu/CHANGELOG.md +0 -127
@@ 1,127 0,0 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.8.0 (2020-11-28)

Accidental version bump during migration to sourcehut. Sorry about that.

## 3.7.46 (2019-10-05)

### Performance Improvements

- remove dependency lodash.reverse and switch to native ([121abc0](https://gitlab.com/codsen/codsen/commit/121abc0))

## 3.7.38 (2019-08-15)

### Bug Fixes

- remove accidentally added chlu-cli from deps ([d671eb9](https://gitlab.com/codsen/codsen/commit/d671eb9))

## 3.7.0 (2019-01-20)

- ✨ Various documentation and setup tweaks after we migrated to monorepo
- ✨ Setup refresh: updated dependencies and all config files using automated tools

## 3.3.0 (2018-12-26)

- ✨ Bitbucket support ([c3ff18e](https://gitlab.com/codsen/codsen/tree/master/packages/chlu/commits/c3ff18e))
- ✨ Support only changelog data, no package.json or git tags ([142b047](https://gitlab.com/codsen/codsen/tree/master/packages/chlu/commits/142b047))

## 3.2.0 (2018-10-14)

- ✨ Updated all dependencies and restored unit test coverage tracking: reporting in terminal and coveralls.io

## 3.1.0 (2018-06-14)

- ✨ Now we really support input with only `changelog.md` data (no package.json, no git tags data)

## 3.0.0 (2018-06-13)

API changes - new input argument - `gitTags` comes as 2nd, and existing arguments from 2nd (inclusive) onwards shift by one place further.
It's necessary so that we could accomodate the Git tag customisations.

- ✨ Provider: GitHub or BitBucket is extracted automatically from `package.json`. You probably noticed, BitBucket's versions in diff URL are backwards (later version goes first) and separator between versions is `%0D`. Not to mention different root.
- ✨ If the repo already has diff links in changelog but in a wrong provider's format (GitHub vs BitBucket, either way), `chlu` will reference the `package.json` and will correct the diff links automatically.
- ✨ If second (newly added) argument is provided, diffs will be rendered more precisely — namely, diff link will be calculated not from the release, last mentioned in the CHANGELOG, but from its last patch release. This is because between feature (minor/major) releases which get mentioned in CHANGELOG I produce numerous patch maintenance releases: updates, setup tweaks and whatnot which are not mentioned in CHANGELOG. Since those are not mentioned, diff link doesn't pick them up and up until now, it didn't even know they existed because Git info was not tapped. Until now, that is. We tapped Git data and [chlu-cli](https://www.npmjs.com/package/chlu-cli) will provide it to us when it will be "driving" the action.

## 2.10.0 (2018-05-03)

- ✨ Set up [Prettier](https://prettier.io)
- ✨ Removed `package.lock` and `.editorconfig`
- ✨ Wired Rollup to remove comments from non-dev builds. This means we can now leave the `console.log`s in the source code — Rollup will remove from production code.

## 2.9.0 (2018-03-10)

- ✨ Switched from deprecated `posthtml-ast-contains-only-empty-space` ([npm](https://www.npmjs.com/package/posthtml-ast-contains-only-empty-space), [GitLab](https://gitlab.com/codsen/codsen/tree/master/packages/posthtml-ast-contains-only-empty-space)) to fresh `ast-contains-only-empty-space` ([npm](https://www.npmjs.com/package/ast-contains-only-empty-space), [GitLab](https://gitlab.com/codsen/codsen/tree/master/packages/ast-contains-only-empty-space))
- ✨ Updated all dependencies
- 💥 Removing UMD build - nobody's gonna use this library in a browser

## 2.8.0 (2018-01-23)

- ✨ Test-fodder libraries' licences at the bottom of readme
- ✨ Updated all depdendencies

## 2.7.0 (2017-12-08)

- ✨ Set up Rollup and now we generate 3 flavours: CommonJS, UMD and ES Modules. Source is now in ES Modules.

## 2.6.0 (2017-11-27)

- ✨ Removed JS Standard and switched to raw ESLint on `airbnb-base` preset, with no-semicolons override.
- ✨ Since JS Standard is lagging on checks, I had to make some rebasing too.
- ✨ Tweaked the algorithm, specifically the part which identifies the titles (like `## 2.6.0 (2017-11-27)` above this bullet list, as opposed to the link lines in the footer). Now it's required for a title to have a `#` to be considered a title.

## 2.5.0 (2017-07-23)

- ✨ Now mixed marker dates such as `2014/04-20` are recognised. Updated unit tests accordingly. Thanks to [dehumanize-date](https://github.com/ForbesLindesay/dehumanize-date/commit/7b4a27477a2bfdb614a4eb74c7972d5eea529480) by [forbeslindsay](https://github.com/ForbesLindesay).

## 2.4.0 (2017-07-22)

- ✨ Now when date in title is unrecognised, cleaning of the title will still happen: letter "v" in front of version digits will be removed (if it exists), whatever-date will be trimmed out of usual separators like minus, dash etc and separated by a single minus-dash.
- ✨ Did I mention, new erroneous title format `## v0.3.17 / 2016-03-23` is recognised and fixed automatically? It's letter `v` and/or dash separating the version and date.
- ✨ Copyrights and licences in README mentioning real-life changelogs used in unit tests.
- ✨ All Lodash deps are now set to `*`, _the latest_.
- ✨ Removed bunch of irrelevant lines from unit test dummy package.json's
- ✨ Updated the documentation and licence with the up-to-date author name

## 2.3.0 (2017-07-04)

- ✨ Now supports `[YANKED]`, `YANKED`, `[yanked]` and `yanked` in the titles. Exactly as per [keepachangelog](http://keepachangelog.com/) spec.

## 2.2.0 (2017-06-29)

- ✨ Avoids false positives coming from semver pattern used within regular text
- ✨ Improved date extraction what will lead to less unrecognised dates in title

## 2.1.1 (2017-06-28)

- ✨ Added n-dash, m-dash, tab, comma, full stop and non-breaking space to the list of what's being trimmed after link titles. This means, bigger variation of non-standard titles would get recognised and there will be less chance that the remainder will not get recognised by `dehumanize-date`.

## 2.0.0 (2017-06-26)

- ✨ Merged getRepoInfo and setRepoInfo. This might prevent some bugs when both algorithms are not the same. I anticipate to improve getter/setter algorithms in the future and it's easier when both are within the same function. The only difference between getter and setter is presence of second argument - if it's not provided, it's get. If it is, it's set.
- ✨ Footer link versions within GitHub magic diff links are validated and fixed if necessary. Fixes in include wrong versions (before and/or after), missing or multiple letters `v` before version and complete rubbish within any of the parts of the footer link (like text instead of diff link's version, in the URL).
- ✨ Empty lines between footer versions are deleted.
- ✨ Added safeguards against some edge cases where footer links are broken but in a sneaky way similar to real-ones, like `[3.0.0.]: whatever`. Now they're recognised and removed (and new-ones, correct-ones are generated if needed).

## 1.3.0 (2017-06-23)

- ✨ Now GitHub magic diff links will be added for all titles except the smallest version-one.
- ✨ Chlu will remove unused footer links. For now, only the links from recognised headers are cleaned (what should cover all normal use cases compliant with keepachangelog.com).

## 1.2.0 (2017-05-19)

- ✨ If the empty row above footer links is missing, it will be added.

## 1.1.0 (2017-05-17)

- ✨ Added this changelog. Ha!
- ✨ Improved the algorithm of adding missing links, case when mid-range links are missing now leaves footer links in a correct order.
- ✨ Added more unit tests to maintain a total 100% coverage.
- ✨ Improved readme

## 1.0.0 (2017-05-16)

- 🌟 First public release

D packages/chlu/README.md => packages/chlu/README.md +0 -158
@@ 1,158 0,0 @@
# chlu

> CH-ange-L-og U-pdate - Automatically fix errors in your changelog file

<div class="package-badges">
  <a href="https://www.npmjs.com/package/chlu" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
  </a>
  <a href="https://codsen.com/os/chlu" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
  </a>
  <a href="https://git.sr.ht/~royston/codsen/tree/master/packages/chlu" rel="nofollow noreferrer noopener">
    <img src="https://img.shields.io/badge/-sourcehut-blue?style=flat-square" alt="page on sourcehut">
  </a>
  <a href="https://npmcharts.com/compare/chlu?interval=30" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/npm/dm/chlu.svg?style=flat-square" alt="Downloads per month">
  </a>
  <a href="https://prettier.io" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg?style=flat-square" alt="Code style: prettier">
  </a>
  <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
  <a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
    <img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
  </a>
</div>

## Install

```bash
npm i chlu
```

## Quick Take

```js
import { strict as assert } from "assert";
import chluLib from "chlu";

const original = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## 1.3.0 - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
`;

const expected = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/correct-lib/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/correct-lib/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/codsen/correct-lib/compare/v1.0.0...v1.1.0
`;

assert.equal(chluLib(original), expected);
```

## Documentation

Please [visit codsen.com](https://codsen.com/os/chlu/) for a full description of the API and examples.

## Licence

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors

Unit test #13 - uses changelog of **giu 0.13.4** to test automated error fixing, released under MIT License (MIT) Copyright © 2016-2018 Guillermo Grau Panea
Unit test #14 - uses changelog of **keystone 4.0.0-beta.5** to test automated error fixing, released under MIT License (MIT) Copyright © 2016 Jed Watson

<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">

D packages/chlu/coverage/coverage-summary.json => packages/chlu/coverage/coverage-summary.json +0 -1
@@ 1,1 0,0 @@
{"total":{"lines":{"total":371,"covered":325,"skipped":0,"pct":87.6},"statements":{"total":402,"covered":354,"skipped":0,"pct":88.06},"functions":{"total":46,"covered":43,"skipped":0,"pct":93.48},"branches":{"total":358,"covered":307,"skipped":0,"pct":85.75}}}
\ No newline at end of file

D packages/chlu/dist/chlu.cjs.js => packages/chlu/dist/chlu.cjs.js +0 -502
@@ 1,502 0,0 @@
/**
 * chlu
 * CH-ange-L-og U-pdate - Automatically fix errors in your changelog file
 * Version: 3.8.1
 * Author: Roy Revelt, Codsen Ltd
 * License: MIT
 * Homepage: https://codsen.com/os/chlu/
 */

'use strict';

var getPkgRepo = require('get-pkg-repo');
var semverCompare = require('semver-compare');
var empty = require('ast-contains-only-empty-space');
var clone = require('lodash.clonedeep');
var isObj = require('lodash.isplainobject');
var min = require('lodash.min');
var dd = require('dehumanize-date');
var trim = require('lodash.trim');
var easyReplace = require('easy-replace');
var emojiRegexLib = require('emoji-regex');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var getPkgRepo__default = /*#__PURE__*/_interopDefaultLegacy(getPkgRepo);
var semverCompare__default = /*#__PURE__*/_interopDefaultLegacy(semverCompare);
var empty__default = /*#__PURE__*/_interopDefaultLegacy(empty);
var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
var isObj__default = /*#__PURE__*/_interopDefaultLegacy(isObj);
var min__default = /*#__PURE__*/_interopDefaultLegacy(min);
var dd__default = /*#__PURE__*/_interopDefaultLegacy(dd);
var trim__default = /*#__PURE__*/_interopDefaultLegacy(trim);
var easyReplace__default = /*#__PURE__*/_interopDefaultLegacy(easyReplace);
var emojiRegexLib__default = /*#__PURE__*/_interopDefaultLegacy(emojiRegexLib);

function _typeof(obj) {
  "@babel/helpers - typeof";

  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function (obj) {
      return typeof obj;
    };
  } else {
    _typeof = function (obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }

  return _typeof(obj);
}

var emojiRegex = emojiRegexLib__default['default']();
var versionWithBracketsRegex = /\[v?\d+\.\d+(\.\d+)*\]/g;
var versionWithoutBracketsRegex = /v?\d+\.\d+(\.\d+)*/g;
var versionWithoutBracketsRegexNoVersion = /\d+\.\d+(\.\d+)*/g;
function existy(x) {
  return x != null;
}
function truthy(x) {
  return x !== false && existy(x);
}
function isStr(something) {
  return typeof something === "string";
}
function aContainsB(a, b) {
  if (!truthy(a) || !truthy(b)) {
    return false;
  }
  return a.indexOf(b) >= 0;
}
var isArr = Array.isArray;
function isFooterLink(str) {
  if (str === undefined) {
    return false;
  }
  if (!isStr(str)) {
    throw new TypeError("chlu/util.js/isFooterLink(): [THROW_ID_02] The input must be string");
  }
  return str.length > 0 && existy(str.match(versionWithBracketsRegex)) && aContainsB(str, "]:");
}
function isTitle(str) {
  if (str === undefined) {
    return false;
  }
  if (!isStr(str)) {
    throw new TypeError("chlu/util.js/isTitle(): [THROW_ID_01] The input must be string - it was given as ".concat(JSON.stringify(str, null, 4), " (").concat(_typeof(str), ")"));
  }
  var stringInFrontOfVersion;
  if (existy(str.match(versionWithoutBracketsRegex))) {
    stringInFrontOfVersion = str.split(str.match(versionWithoutBracketsRegex)[0]);
    if (stringInFrontOfVersion === null) {
      stringInFrontOfVersion = "";
    } else {
      stringInFrontOfVersion = stringInFrontOfVersion[0];
    }
  }
  return str.length > 0 && existy(str.match(versionWithoutBracketsRegex)) && !str.includes("http") && !str.includes("]:") && trim__default['default'](stringInFrontOfVersion, "[# \t") === "" && str.includes("#");
}
function getTitlesAndFooterLinks(linesArr) {
  var titles = [];
  var footerLinks = [];
  var i;
  var len;
  var temp;
  for (i = 0, len = linesArr.length; i < len; i++) {
    if (isTitle(linesArr[i])) {
      var firstEncounteredVersion = linesArr[i].match(versionWithoutBracketsRegexNoVersion)[0];
      titles.push({
        version: firstEncounteredVersion,
        rowNum: i,
        linked: existy(linesArr[i].match(versionWithBracketsRegex)),
        content: linesArr[i],
        beforeVersion: linesArr[i].split(firstEncounteredVersion)[0],
        afterVersion: linesArr[i].split(firstEncounteredVersion)[1]
      });
    } else if (isFooterLink(linesArr[i])) {
      temp = linesArr[i].match(versionWithBracketsRegex)[0];
      footerLinks.push({
        version: temp.substring(1, temp.length - 1),
        rowNum: i,
        content: linesArr[i]
      });
    }
  }
  return {
    titles: titles,
    footerLinks: footerLinks
  };
}
function getPreviousVersion(currVers, originalVersionsArr) {
  function prep() {
    var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
    if (str.startsWith("v")) {
      if (str[1] === ".") {
        return str.slice(2);
      }
      return str.slice(1);
    }
    return str;
  }
  if (arguments.length < 2) {
    throw new Error("chlu/util.js/getPreviousVersion(): [THROW_ID_03] There must be two arguments, string and an array.");
  }
  if (!isStr(currVers)) {
    throw new Error("chlu/util.js/getPreviousVersion(): [THROW_ID_04] The first argument must be string. Currently it's ".concat(_typeof(currVers)));
  } else {
    currVers = prep(currVers);
  }
  if (!isArr(originalVersionsArr)) {
    throw new Error("chlu/util.js/getPreviousVersion(): [THROW_ID_05] The second argument must be an array. Currently it's ".concat(_typeof(originalVersionsArr), " equal to:\nJSON.stringify(originalVersionsArr, null, 4)"));
  }
  var versionsArr = clone__default['default'](originalVersionsArr).map(function (val) {
    return prep(val);
  }).sort(semverCompare__default['default']);
  if (currVers === versionsArr[0]) {
    return null;
  }
  for (var i = 0, len = versionsArr.length; i < len; i++) {
    if (versionsArr[i] === currVers && existy(versionsArr[i - 1])) {
      return versionsArr[i - 1];
    }
  }
  throw new Error("chlu/util.js/getPreviousVersion(): [THROW_ID_06] The given version (".concat(currVers, ") is not in the versions array (").concat(JSON.stringify(versionsArr, null, 4), ")"));
}
function setRow(rowsArray, index, content) {
  var res = clone__default['default'](rowsArray);
  for (var i = 0, len = res.length; i < len; i++) {
    if (i === index) {
      res[i] = content;
    }
  }
  return res;
}
function getRow(rowsArray, index) {
  if (!existy(index) || !Number.isInteger(index)) {
    throw new TypeError("chlu/util.js/getRow(): [THROW_ID_07]: first input arg must be a natural number. Currently it's given as: ".concat(_typeof(index), " and equal: ").concat(JSON.stringify(index, null, 4)));
  }
  if (!existy(rowsArray) || !isArr(rowsArray)) {
    throw new TypeError("chlu/util.js/getRow(): [THROW_ID_08]: second input arg must be an rowsArrayay. Currently it's given as: ".concat(_typeof(rowsArray), " and equal: ").concat(JSON.stringify(rowsArray, null, 4)));
  }
  for (var i = 0, len = rowsArray.length; i < len; i++) {
    if (i === index) {
      return rowsArray[i];
    }
  }
  return null;
}
function getSetFooterLink(str) {
  var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var mode;
  if (_typeof(o) === "object" && o !== null && typeof o.mode === "string") {
    mode = o.mode;
  } else {
    mode = "get";
  }
  if (typeof str !== "string" || !str.includes("/")) {
    return null;
  }
  var split = str.split("/");
  var res = {};
  if (!o) {
    o = {};
    o.type = "github";
  } else if (!o.type) {
    o.type = "github";
  }
  var currentlyWeHaveLinkOfAType = str.includes("github") ? "github" : "bitbucket";
  for (var i = 0, len = split.length; i < len; i++) {
    if (split[i] === "github.com" || split[i] === "bitbucket.org") {
      res.user = existy(o.user) ? o.user : split[i + 1];
      res.project = existy(o.project) ? o.project : split[i + 2];
    } else if (split[i] === "compare") {
      if (split[i + 1].includes("...")) {
        var splitVersions = trim__default['default'](split[i + 1], "#diff").split("...");
        res.versBefore = existy(o.versBefore) ? o.versBefore : trim__default['default'](currentlyWeHaveLinkOfAType === "github" ? splitVersions[0] : splitVersions[1], "v");
        res.versAfter = existy(o.versAfter) ? o.versAfter : trim__default['default'](currentlyWeHaveLinkOfAType === "github" ? splitVersions[1] : splitVersions[0], "v");
      } else if (split[i + 1].includes("%0D")) {
        var _splitVersions = trim__default['default'](split[i + 1], "#diff").split("%0D");
        res.versBefore = existy(o.versBefore) ? o.versBefore : trim__default['default'](currentlyWeHaveLinkOfAType === "github" ? _splitVersions[0] : _splitVersions[1], "v");
        res.versAfter = existy(o.versAfter) ? o.versAfter : trim__default['default'](currentlyWeHaveLinkOfAType === "github" ? _splitVersions[1] : _splitVersions[0], "v");
      } else {
        return null;
      }
    } else if (i === 0) {
      res.version = existy(o.version) ? o.version : split[i].match(versionWithoutBracketsRegex)[0];
    }
  }
  if (mode === "get") {
    res.type = currentlyWeHaveLinkOfAType;
    return res;
  }
  if (o.type === "github") {
    return "[".concat(res.version, "]: https://github.com/").concat(res.user, "/").concat(res.project, "/compare/v").concat(res.versBefore, "...v").concat(res.versAfter);
  }
  if (o.type === "bitbucket") {
    return "[".concat(res.version, "]: https://bitbucket.org/").concat(res.user, "/").concat(res.project, "/branches/compare/v").concat(res.versAfter, "%0Dv").concat(res.versBefore, "#diff");
  }
}
function versionSort(a, b) {
  return semverCompare__default['default'](a.version, b.version);
}
function filterDate(someString) {
  var res = someString.trim();
  res = easyReplace__default['default'](res, {
    leftOutsideNot: "",
    leftOutside: "",
    leftMaybe: "[",
    searchFor: "YANKED",
    rightMaybe: "]",
    rightOutside: "",
    rightOutsideNot: "",
    i: {
      searchFor: true
    }
  });
  res = res.replace(".", " ");
  res = res.replace(",", " ");
  res = res.replace(";", " ");
  res = res.replace(emojiRegex, "");
  res = res.replace(/[ ]+/g, " ");
  res = trim__default['default'](res, "[](),.-/\\ \u2013\u2014\t\xA0");
  return res;
}

var isArr$1 = Array.isArray;
function existy$1(x) {
  return x != null;
}
function chlu(changelogContents, gitTags, packageJsonContents) {
  if (!arguments.length || !existy$1(changelogContents)) {
    return;
  }
  var processedGitTags;
  if (_typeof(gitTags) === "object" && gitTags !== null && !Array.isArray(gitTags) && existy$1(gitTags.latest)) {
    processedGitTags = {};
    processedGitTags.latest = gitTags.latest.split("|").map(function (val) {
      if (val[0] === "v") {
        return val.slice(1);
      }
      return val;
    });
    processedGitTags.all = {};
    processedGitTags.versionsOnly = [];
    if (isArr$1(gitTags.all)) {
      gitTags.all.sort().forEach(function (key) {
        processedGitTags.all[key.slice(12)] = key.slice(0, 10);
        processedGitTags.versionsOnly.push(key.slice(12));
      });
    }
  }
  var changelogMd = changelogContents;
  var packageJson;
  if (packageJsonContents) {
    var parsedContents;
    if (typeof packageJsonContents === "string") {
      try {
        parsedContents = JSON.parse(packageJsonContents);
      } catch (e) {
        throw new Error("chlu/main.js: [THROW_ID_04] Package JSON could not be parsed, JSON.parse gave error:\n".concat(e, "\n\nBy the way, we're talking about contents:\n").concat(JSON.stringify(packageJsonContents, null, 0), "\ntheir type is: \"").concat(_typeof(packageJsonContents), "\"").concat(typeof packageJsonContents === "string" ? " and its length is: ".concat(packageJsonContents.length) : ""));
      }
    } else if (isObj__default['default'](packageJsonContents)) {
      parsedContents = packageJsonContents;
    }
    try {
      packageJson = getPkgRepo__default['default'](parsedContents);
    } catch (e) {
      throw new Error("chlu/main.js: [THROW_ID_05] There was an error in get-pkg-repo:\n".concat(e, "\n\nBy the way, we're talking about contents:\n").concat(JSON.stringify(parsedContents, null, 4)));
    }
    if (packageJson && packageJson.type && packageJson.type !== "github" && packageJson.type !== "bitbucket") {
      throw new Error("chlu/main.js: [THROW_ID_01] Package JSON shows the library is neither GitHub nor BitBucket-based - ".concat(packageJson.type));
    }
  }
  var temp;
  var titles = [];
  var footerLinks = [];
  var newLinesArr = [];
  var linesArr = changelogMd.split(/\r?\n/);
  var titlesAndFooterLinks = getTitlesAndFooterLinks(linesArr);
  titles = titlesAndFooterLinks.titles;
  footerLinks = titlesAndFooterLinks.footerLinks;
  for (var i = 0, len = footerLinks.length; i < len; i++) {
    if (!existy$1(getSetFooterLink(footerLinks[i].content, {
      mode: "get"
    }))) {
      linesArr.splice(footerLinks[i].rowNum, 1);
    }
  }
  titlesAndFooterLinks = getTitlesAndFooterLinks(linesArr);
  titles = titlesAndFooterLinks.titles;
  footerLinks = titlesAndFooterLinks.footerLinks;
  var assumedPackageJsonType;
  var assumedPackageUser;
  var assumedPackageProject;
  if (!packageJson) {
    if (footerLinks[0] && footerLinks[0].content && footerLinks[0].content.includes("bitbucket.org")) {
      assumedPackageJsonType = "bitbucket";
    } else if (footerLinks[0] && footerLinks[0].content && footerLinks[0].content.includes("github.com")) {
      assumedPackageJsonType = "github";
    } else {
      throw new Error("chlu/main.js: [THROW_ID_02] Both package.json and Git data were missing and we had to rely on the first footer link to detect the type of repository: Github or Bitbucket. But we couldn't extract the first link from your changelog's footer!");
    }
    if (assumedPackageJsonType) {
      footerLinks[0].content.split("/").forEach(function (chunkOfLine, i, arr) {
        if (chunkOfLine.includes("bitbucket.org") || chunkOfLine.includes("github.com")) {
          if (arr.length > i + 2) {
            assumedPackageUser = arr[i + 1];
            assumedPackageProject = arr[i + 2];
          } else {
            throw new Error("chlu/main.js: [THROW_ID_03] We could not extract user and package from the footer link: \"".concat(footerLinks[0].content, "\""));
          }
        }
      });
    }
  }
  var sortedTitlesArray = titles.map(function (el) {
    return el.version;
  }).sort(semverCompare__default['default']);
  var unusedFooterLinks = footerLinks.filter(function (link) {
    return !titles.map(function (title) {
      return title.version;
    }).includes(link.version);
  });
  while (unusedFooterLinks.length > 0) {
    linesArr.splice(unusedFooterLinks[0].rowNum, 1);
    footerLinks = getTitlesAndFooterLinks(linesArr).footerLinks;
    unusedFooterLinks = footerLinks.filter(function (link) {
      return !titles.map(function (title) {
        return title.version;
      }).includes(link.version);
    });
  }
  var missingFooterLinks = [];
  var _loop = function _loop(_i, _len) {
    if (_len > 1 && titles[_i].version !== sortedTitlesArray[0]) {
      var linkFound = footerLinks.some(function (el) {
        return titles[_i].version === el.version;
      });
      if (!linkFound) {
        missingFooterLinks.push(titles[_i]);
      }
    }
  };
  for (var _i = 0, _len = titles.length; _i < _len; _i++) {
    _loop(_i, _len);
  }
  var ascendingFooterLinkCount = 0;
  var descendingFooterLinkCount = 0;
  if (footerLinks.length > 1) {
    for (var _i2 = 0, _len2 = footerLinks.length; _i2 < _len2 - 1; _i2++) {
      if (semverCompare__default['default'](footerLinks[_i2].version, footerLinks[_i2 + 1].version) === 1) {
        descendingFooterLinkCount += 1;
      } else {
        ascendingFooterLinkCount += 1;
      }
    }
  }
  var ascending = true;