From c727ec0be203201255fbcd41519dae2c1ee1f3c3 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Thu, 2 Jul 2020 21:01:11 -0300 Subject: [PATCH 01/47] Add initial files --- src/classes/Node.ts | 15 +++++++++++++++ src/functions/evaluationValue.ts | 4 ++++ src/index.ts | 12 ++++++++++++ src/mocks.ts | 3 +++ 4 files changed, 34 insertions(+) create mode 100644 src/classes/Node.ts create mode 100644 src/functions/evaluationValue.ts create mode 100644 src/mocks.ts diff --git a/src/classes/Node.ts b/src/classes/Node.ts new file mode 100644 index 0000000..3ce2c73 --- /dev/null +++ b/src/classes/Node.ts @@ -0,0 +1,15 @@ +class NodeInfo { + evaluationFunctionValue: number; + operation: string; // TODO: usar types/enum pra permitir somente operações válidas + state: number[][] // TODO: usar types/tuplas pra permitir somente números válidos + previousNode?: NodeInfo + + constructor(efValue: number, op: string, s: number[][], prev: NodeInfo){ + this.evaluationFunctionValue = efValue + this.operation = op + this.state = s + this.previousNode = prev + } +} + +export { NodeInfo } \ No newline at end of file diff --git a/src/functions/evaluationValue.ts b/src/functions/evaluationValue.ts new file mode 100644 index 0000000..1db6646 --- /dev/null +++ b/src/functions/evaluationValue.ts @@ -0,0 +1,4 @@ + +export default function calcHeuristicValue(){ + return 0; +} diff --git a/src/index.ts b/src/index.ts index e69de29..0b1b975 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1,12 @@ +import { NodeInfo } from "./classes/Node" + +import calcHeuristicValue from "./functions/evaluationValue"; + +frontier: Array(); + + +const initialState = [[4,5,8], [null,1,6], [7, 2, 3]]; + + + +console.log(initialState[1][0]); \ No newline at end of file diff --git a/src/mocks.ts b/src/mocks.ts new file mode 100644 index 0000000..35bc696 --- /dev/null +++ b/src/mocks.ts @@ -0,0 +1,3 @@ +const state = [[1,2,3], [4,5,6], [7, 8, null]]; + +console.log(state); From 15413370ea89c8ed2e1aa20794ef42101131fc85 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Thu, 2 Jul 2020 21:04:06 -0300 Subject: [PATCH 02/47] Remove unused lines from tsconfig --- tsconfig.json | 57 --------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 0bd0052..d953928 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,68 +1,11 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./dist", /* Redirect output structure to the directory. */ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ } From e6fffbc9ff64e17f19b2bb95c507fd1451e0bfcb Mon Sep 17 00:00:00 2001 From: Alexandre Date: Thu, 2 Jul 2020 22:01:17 -0300 Subject: [PATCH 03/47] Add mocha and chai --- package-lock.json | 913 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 7 +- tsconfig.json | 10 +- 3 files changed, 928 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d82349e..0caf656 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,12 +19,24 @@ "defer-to-connect": "^1.0.1" } }, + "@types/chai": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.11.tgz", + "integrity": "sha512-t7uW6eFafjO+qJ3BIV2gGUyZs27egcNRkUdalkud+Qa3+kg//f129iuOFivHDXQ+vnU3fDXuwgv0cqMCbcE8sw==", + "dev": true + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, + "@types/mocha": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-7.0.2.tgz", + "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==", + "dev": true + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -53,6 +65,12 @@ } } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, "ansi-regex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", @@ -79,6 +97,39 @@ "picomatch": "^2.0.4" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array.prototype.map": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", + "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "es-array-method-boxes-properly": "^1.0.0", + "is-string": "^1.0.4" + } + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -126,6 +177,18 @@ "fill-range": "^7.0.1" } }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -164,6 +227,20 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -191,6 +268,12 @@ } } }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, "chokidar": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", @@ -219,6 +302,30 @@ "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", "dev": true }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "clone-response": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", @@ -278,6 +385,12 @@ "ms": "^2.1.1" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -287,6 +400,15 @@ "mimic-response": "^1.0.0" } }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -299,6 +421,21 @@ "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", "dev": true }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, "dot-prop": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", @@ -329,12 +466,75 @@ "once": "^1.4.0" } }, + "es-abstract": { + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", + "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.0", + "is-regex": "^1.1.0", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, + "es-get-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", + "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", + "dev": true, + "requires": { + "es-abstract": "^1.17.4", + "has-symbols": "^1.0.1", + "is-arguments": "^1.0.4", + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-string": "^1.0.5", + "isarray": "^2.0.5" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escape-goat": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", "dev": true }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -344,6 +544,31 @@ "to-regex-range": "^5.0.1" } }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "fsevents": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", @@ -351,6 +576,24 @@ "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -360,6 +603,20 @@ "pump": "^3.0.0" } }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, "glob-parent": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", @@ -403,18 +660,45 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, "has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -439,12 +723,34 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, "ini": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -454,6 +760,18 @@ "binary-extensions": "^2.0.0" } }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + }, + "is-callable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "dev": true + }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -463,6 +781,12 @@ "ci-info": "^2.0.0" } }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -494,6 +818,12 @@ "is-path-inside": "^3.0.1" } }, + "is-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", + "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "dev": true + }, "is-npm": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", @@ -518,6 +848,36 @@ "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true }, + "is-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-set": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", + "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", + "dev": true + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -530,6 +890,44 @@ "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", "dev": true }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "iterate-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", + "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", + "dev": true + }, + "iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dev": true, + "requires": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + } + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -554,6 +952,67 @@ "package-json": "^6.3.0" } }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + } + } + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -577,6 +1036,12 @@ } } }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -598,6 +1063,87 @@ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, + "mocha": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", + "dev": true, + "requires": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.3.1", + "debug": "3.2.6", + "diff": "4.0.2", + "escape-string-regexp": "1.0.5", + "find-up": "4.1.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", + "minimatch": "3.0.4", + "ms": "2.1.2", + "object.assign": "4.1.0", + "promise.allsettled": "1.0.2", + "serialize-javascript": "3.0.0", + "strip-json-comments": "3.0.1", + "supports-color": "7.1.0", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.0.0", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" + }, + "dependencies": { + "chokidar": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", + "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.3.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "readdirp": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", + "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "dev": true, + "requires": { + "picomatch": "^2.0.7" + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -643,6 +1189,30 @@ "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "dev": true }, + "object-inspect": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -658,6 +1228,30 @@ "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "dev": true }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "package-json": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", @@ -678,6 +1272,24 @@ } } }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -690,6 +1302,19 @@ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", "dev": true }, + "promise.allsettled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", + "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "dev": true, + "requires": { + "array.prototype.map": "^1.0.1", + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "iterate-value": "^1.0.0" + } + }, "pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", @@ -754,6 +1379,18 @@ "rc": "^1.2.8" } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -786,12 +1423,46 @@ } } }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", + "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", @@ -832,6 +1503,26 @@ } } }, + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", @@ -886,6 +1577,25 @@ "nopt": "~1.0.10" } }, + "ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", @@ -972,6 +1682,57 @@ "prepend-http": "^2.0.0" } }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -981,6 +1742,60 @@ "string-width": "^4.0.0" } }, + "workerpool": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", + "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1004,6 +1819,104 @@ "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/package.json b/package.json index c960d53..03048ef 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,18 @@ "main": "dist/index.js", "dependencies": {}, "devDependencies": { + "@types/chai": "^4.2.11", + "@types/mocha": "^7.0.2", + "chai": "^4.2.0", + "mocha": "^8.0.1", "nodemon": "^2.0.4", + "ts-node": "^8.10.2", "typescript": "^3.9.6" }, "scripts": { "start:ts": "tsc --watch", "start:js": "nodemon ./dist/index.js", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "mocha --require ts-node/register --extensions ts,tsx --watch --watch-files src 'tests/**/*.{ts,tsx}'" }, "author": "Alexandre Kavalerski", "license": "MIT" diff --git a/tsconfig.json b/tsconfig.json index d953928..3ca5118 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,5 +8,13 @@ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + }, + "include":[ + "src/**/*.ts" + ], + "exclude": [ + "./tests/", + "./node_modules/", + "./dist/" + ] } From 2168e70fa17a762272a4a458e251f01d36dba092 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 00:02:57 -0300 Subject: [PATCH 04/47] Add State type --- src/classes/Node.ts | 8 +++++--- src/classes/State.ts | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/classes/State.ts diff --git a/src/classes/Node.ts b/src/classes/Node.ts index 3ce2c73..879cd96 100644 --- a/src/classes/Node.ts +++ b/src/classes/Node.ts @@ -1,10 +1,12 @@ +import { State } from "./State"; + class NodeInfo { evaluationFunctionValue: number; operation: string; // TODO: usar types/enum pra permitir somente operações válidas - state: number[][] // TODO: usar types/tuplas pra permitir somente números válidos - previousNode?: NodeInfo + state: State; + previousNode?: NodeInfo; - constructor(efValue: number, op: string, s: number[][], prev: NodeInfo){ + constructor(efValue: number, op: string, s: State, prev: NodeInfo){ this.evaluationFunctionValue = efValue this.operation = op this.state = s diff --git a/src/classes/State.ts b/src/classes/State.ts new file mode 100644 index 0000000..c42ab3b --- /dev/null +++ b/src/classes/State.ts @@ -0,0 +1,5 @@ +type StateItem = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | null; + +type State = [[StateItem, StateItem, StateItem], [StateItem, StateItem, StateItem], [StateItem, StateItem, StateItem]]; + +export { State, StateItem } \ No newline at end of file From 5fd9cea5deedf1693b92c5ab4d58118c8a34d822 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 00:04:11 -0300 Subject: [PATCH 05/47] Update index (remove not used code) --- src/index.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0b1b975..e69de29 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +0,0 @@ -import { NodeInfo } from "./classes/Node" - -import calcHeuristicValue from "./functions/evaluationValue"; - -frontier: Array(); - - -const initialState = [[4,5,8], [null,1,6], [7, 2, 3]]; - - - -console.log(initialState[1][0]); \ No newline at end of file From 8c48fc311cd7f397cd91168195c127de169e01d6 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 00:04:35 -0300 Subject: [PATCH 06/47] Add heuristic function with tests --- src/functions/evaluationValue.ts | 4 -- src/functions/heuristic.ts | 29 ++++++++++ tests/heuristic.spec.ts | 95 ++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 4 deletions(-) delete mode 100644 src/functions/evaluationValue.ts create mode 100644 src/functions/heuristic.ts create mode 100644 tests/heuristic.spec.ts diff --git a/src/functions/evaluationValue.ts b/src/functions/evaluationValue.ts deleted file mode 100644 index 1db6646..0000000 --- a/src/functions/evaluationValue.ts +++ /dev/null @@ -1,4 +0,0 @@ - -export default function calcHeuristicValue(){ - return 0; -} diff --git a/src/functions/heuristic.ts b/src/functions/heuristic.ts new file mode 100644 index 0000000..fff1396 --- /dev/null +++ b/src/functions/heuristic.ts @@ -0,0 +1,29 @@ +import { State, StateItem } from "../classes/State" + + +function calcHeuristicValue(actualState: State, goalState: State, gValue: number){ + return gValue + calcHValue(actualState, goalState); +} + +function calcHValue(actualState: State, goalState: State){ + let totalDistance = 0; + for (let line in actualState){ + for (let col in actualState[line]){ + totalDistance += calcDistanceOfItem(actualState[line][col], [Number(line), Number(col)], goalState); + } + } + return totalDistance; +} + +function calcDistanceOfItem(item: StateItem, itemPosition: number[], goalState: State): number{ + for (let line in goalState){ + let col = goalState[line].indexOf(item); + if(col > -1){ + const distance = Math.abs(itemPosition[0] - Number(line)) + Math.abs(itemPosition[1] - col); + return distance; + } + } + return 10; //TODO: Rever esse valor (ou tratamento diferente caso o item buscado não exista no estado objetivo) +} + +export { calcHeuristicValue, calcDistanceOfItem } \ No newline at end of file diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts new file mode 100644 index 0000000..855e89c --- /dev/null +++ b/tests/heuristic.spec.ts @@ -0,0 +1,95 @@ +import { expect } from 'chai'; +import { calcHeuristicValue, calcDistanceOfItem } from "../src/functions/heuristic"; +import { State, StateItem } from '../src/classes/State'; + +describe('Smoke Tests', () => { // the tests container + it('should exist calcHeuristicValue function', () => { + expect(calcHeuristicValue).to.exist; + }); + + it('should return a number when call calcHeuristicValue function', () => { + const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 0; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.be.a('number'); + }); + + it('should exist calcDistanceOfItem function', () => { + expect(calcDistanceOfItem).to.exist; + }); + + it('should return a number when call calcDistanceOfItem function', () => { + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const item = 2; + const itemPosition = [2,1]; + expect(calcDistanceOfItem(item, itemPosition, goalState)).to.be.a('number'); + }); +}); + +describe('Testing returns of calcDistanceOfItem', () => { + it('should return 2 when call calcDistanceOfItem', () => { + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const item: StateItem = 2; + const itemPosition = [2,1]; + expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(2); + }); + + it('should return 1 when call calcDistanceOfItem', () => { + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const item: StateItem = 5; + const itemPosition = [0,1]; + expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(1); + }); + + it('should return 3 when call calcDistanceOfItem', () => { + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const item: StateItem = null; + const itemPosition = [1,0]; + expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(3); + }); +}) + +describe('Testing returns of calcHeuristicValue', () => { + it('should return 14 when call calcHeuristicValue function', () => { + const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 0; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(14); + }); + + + it('should return 15 when call calcHeuristicValue function', () => { + const initialState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 1; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(15); + }); + + it('should return 15 when call calcHeuristicValue function', () => { + const initialState: State = [[4,5,8], [7,1,6], [null, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 1; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(15); + }); + + it('should return 13 when call calcHeuristicValue function', () => { + const initialState: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 1; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(13); + }); + + it('should return 14 when call calcHeuristicValue function', () => { + const initialState: State = [[4,null,8], [1,5,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 2; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(14); + }); + + it('should return 12 when call calcHeuristicValue function', () => { + const initialState: State = [[4,5,8], [1,2,6], [7, null, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const gValue = 2; + expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(12); + }); +}) \ No newline at end of file From f8f485bd9b6afefa9f115bc54b62a0d326c1dffb Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 11:03:13 -0300 Subject: [PATCH 07/47] Update describe --- tests/heuristic.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts index 855e89c..ed67ee8 100644 --- a/tests/heuristic.spec.ts +++ b/tests/heuristic.spec.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { calcHeuristicValue, calcDistanceOfItem } from "../src/functions/heuristic"; import { State, StateItem } from '../src/classes/State'; -describe('Smoke Tests', () => { // the tests container +describe('Heuristic Smoke Tests', () => { // the tests container it('should exist calcHeuristicValue function', () => { expect(calcHeuristicValue).to.exist; }); From 2feee6cb982363e414d21fe1c87c7a1bde92df4c Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 11:43:41 -0300 Subject: [PATCH 08/47] Update state (moved file to utils folder) --- src/classes/Node.ts | 2 +- src/functions/heuristic.ts | 2 +- src/{classes/State.ts => utils/state.ts} | 0 tests/heuristic.spec.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/{classes/State.ts => utils/state.ts} (100%) diff --git a/src/classes/Node.ts b/src/classes/Node.ts index 879cd96..23cb251 100644 --- a/src/classes/Node.ts +++ b/src/classes/Node.ts @@ -1,4 +1,4 @@ -import { State } from "./State"; +import { State } from "../utils/state"; class NodeInfo { evaluationFunctionValue: number; diff --git a/src/functions/heuristic.ts b/src/functions/heuristic.ts index fff1396..4acd30d 100644 --- a/src/functions/heuristic.ts +++ b/src/functions/heuristic.ts @@ -1,4 +1,4 @@ -import { State, StateItem } from "../classes/State" +import { State, StateItem } from "../utils/state" function calcHeuristicValue(actualState: State, goalState: State, gValue: number){ diff --git a/src/classes/State.ts b/src/utils/state.ts similarity index 100% rename from src/classes/State.ts rename to src/utils/state.ts diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts index ed67ee8..b607d44 100644 --- a/tests/heuristic.spec.ts +++ b/tests/heuristic.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { calcHeuristicValue, calcDistanceOfItem } from "../src/functions/heuristic"; -import { State, StateItem } from '../src/classes/State'; +import { State, StateItem } from '../src/utils/state'; describe('Heuristic Smoke Tests', () => { // the tests container it('should exist calcHeuristicValue function', () => { From dd8575fa725d072e9ed073b6d2845dd2b7eccb4a Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 11:44:41 -0300 Subject: [PATCH 09/47] Add operations enum --- src/utils/operations.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/utils/operations.ts diff --git a/src/utils/operations.ts b/src/utils/operations.ts new file mode 100644 index 0000000..d2cd401 --- /dev/null +++ b/src/utils/operations.ts @@ -0,0 +1,6 @@ +export enum operations { + up = 'UP_OPERATION', + right = 'RIGHT_OPERATION', + down = 'DOWN_OPERATION', + left = 'LEFT_OPERATION', +} \ No newline at end of file From f82824d31e70715057976f3d974e568186daba34 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 12:39:00 -0300 Subject: [PATCH 10/47] Add operations functions with tests --- src/functions/operations.ts | 49 +++++++++++++++++++++++++++++ tests/operations.spec.ts | 63 +++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 src/functions/operations.ts create mode 100644 tests/operations.spec.ts diff --git a/src/functions/operations.ts b/src/functions/operations.ts new file mode 100644 index 0000000..eb4bfb4 --- /dev/null +++ b/src/functions/operations.ts @@ -0,0 +1,49 @@ +import { State, StateItem } from "../utils/state"; +import { operations } from "../utils/operations"; + +function applyOperation(state: State, op: operations){ + if(op == operations.up){ + return moveUpOperation(state); + } + + return state; +} + +function moveUpOperation(state: State){ + const nullPosition = getPositionOfNullItem(state); //TODO: criar um type para ItemPosition + const newLinePosition = nullPosition[0] - 1; + if(newLinePosition >= 0){ + + const newState: State = [... state]; + const aux = state[newLinePosition][nullPosition[1]] + newState[newLinePosition][nullPosition[1]] = null; + newState[nullPosition[0]][nullPosition[1]] = aux; + return newState; + } +} + +function moveRightOperation(state: State){ + +} + +function moveDownOperation(state: State){ + +} + +function moveLeftOperation(state: State){ + +} + + + +function getPositionOfNullItem(state: State){ + for (let line in state){ + let col = state[line].indexOf(null); + if (col > -1){ + return [Number(line), Number(col)]; //TODO: criar um type para ItemPosition + } + } + throw new Error('Error: null item not found on state'); +} + +export { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } \ No newline at end of file diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts new file mode 100644 index 0000000..cd21f92 --- /dev/null +++ b/tests/operations.spec.ts @@ -0,0 +1,63 @@ +import { expect, Assertion, util } from 'chai'; +import { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } from "../src/functions/operations"; +import { State, StateItem } from "../src/utils/state"; +import { operations } from '../src/utils/operations'; + +describe('Smoke Tests', () => { + it('should exist applyOperation function', () => { + expect(applyOperation).to.exist; + }); + + it('should exist moveUpOperation function', () => { + expect(moveUpOperation).to.exist; + }); + + it('should exist moveRightOperation function', () => { + expect(moveRightOperation).to.exist; + }); + + it('should exist moveDownOperation function', () => { + expect(moveDownOperation).to.exist; + }); + + it('should exist moveLeftOperation function', () => { + expect(moveLeftOperation).to.exist; + }); + + it('should exist getPositionOfNullItem function', () => { + expect(getPositionOfNullItem).to.exist; + }); + + it('should return an Array when call applyOperation function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + expect(applyOperation(state, operations.up)).to.be.an('array'); + }); +}); + +describe('Testing returns of getPositionOfNullItem function', () => { + + it('should return [1,0] when call getPositionOfNullItem function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + expect(getPositionOfNullItem(state)).to.eql([1, 0]); + }); + + it('should return [2,1] when call getPositionOfNullItem function', () => { + const state: State = [[4,5,8], [3,1,6], [7, null, 2]]; + expect(getPositionOfNullItem(state)).to.eql([2, 1]); + }); + + it('should return [0,0] when call getPositionOfNullItem function', () => { + const state: State = [[null,5,8], [3,1,6], [7, 2, 4]]; + expect(getPositionOfNullItem(state)).to.eql([0, 0]); + }); +}); + +describe('Testing returns of applyOperation function', () => { + + it('should return correct state when call applyOperation function when using movUp operation', () => { + const actualState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const goalState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + expect(applyOperation(actualState, operations.up)).to.eql(goalState); + }); + +}); \ No newline at end of file From 69e0bf3ad373ec48be8d63bf0f352424a4cbe4a1 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 12:57:05 -0300 Subject: [PATCH 11/47] Add class StateItemPosition --- src/classes/StateItemPosition.ts | 10 ++++++++++ src/functions/heuristic.ts | 8 +++++--- src/functions/operations.ts | 13 +++++++------ tests/heuristic.spec.ts | 9 +++++---- tests/operations.spec.ts | 10 +++++++--- 5 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 src/classes/StateItemPosition.ts diff --git a/src/classes/StateItemPosition.ts b/src/classes/StateItemPosition.ts new file mode 100644 index 0000000..5a7c140 --- /dev/null +++ b/src/classes/StateItemPosition.ts @@ -0,0 +1,10 @@ + +export default class StateItemPosition { + line: number; + col: number; + + constructor(l: number, c: number){ + this.line = l; + this.col = c; + } +} \ No newline at end of file diff --git a/src/functions/heuristic.ts b/src/functions/heuristic.ts index 4acd30d..7166de4 100644 --- a/src/functions/heuristic.ts +++ b/src/functions/heuristic.ts @@ -1,4 +1,5 @@ import { State, StateItem } from "../utils/state" +import StateItemPosition from "../classes/StateItemPosition"; function calcHeuristicValue(actualState: State, goalState: State, gValue: number){ @@ -9,17 +10,18 @@ function calcHValue(actualState: State, goalState: State){ let totalDistance = 0; for (let line in actualState){ for (let col in actualState[line]){ - totalDistance += calcDistanceOfItem(actualState[line][col], [Number(line), Number(col)], goalState); + const itemPosition = new StateItemPosition(Number(line), Number(col)); + totalDistance += calcDistanceOfItem(actualState[line][col], itemPosition, goalState); } } return totalDistance; } -function calcDistanceOfItem(item: StateItem, itemPosition: number[], goalState: State): number{ +function calcDistanceOfItem(item: StateItem, itemPosition: StateItemPosition, goalState: State): number{ for (let line in goalState){ let col = goalState[line].indexOf(item); if(col > -1){ - const distance = Math.abs(itemPosition[0] - Number(line)) + Math.abs(itemPosition[1] - col); + const distance = Math.abs(itemPosition.line - Number(line)) + Math.abs(itemPosition.col - col); return distance; } } diff --git a/src/functions/operations.ts b/src/functions/operations.ts index eb4bfb4..e4f8b6b 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -1,5 +1,6 @@ import { State, StateItem } from "../utils/state"; import { operations } from "../utils/operations"; +import StateItemPosition from "../classes/StateItemPosition"; function applyOperation(state: State, op: operations){ if(op == operations.up){ @@ -10,14 +11,14 @@ function applyOperation(state: State, op: operations){ } function moveUpOperation(state: State){ - const nullPosition = getPositionOfNullItem(state); //TODO: criar um type para ItemPosition - const newLinePosition = nullPosition[0] - 1; + const nullPosition = getPositionOfNullItem(state); + const newLinePosition = nullPosition.line - 1; if(newLinePosition >= 0){ const newState: State = [... state]; - const aux = state[newLinePosition][nullPosition[1]] - newState[newLinePosition][nullPosition[1]] = null; - newState[nullPosition[0]][nullPosition[1]] = aux; + const aux = state[newLinePosition][nullPosition.col] + newState[newLinePosition][nullPosition.col] = null; + newState[nullPosition.line][nullPosition.col] = aux; return newState; } } @@ -40,7 +41,7 @@ function getPositionOfNullItem(state: State){ for (let line in state){ let col = state[line].indexOf(null); if (col > -1){ - return [Number(line), Number(col)]; //TODO: criar um type para ItemPosition + return new StateItemPosition(Number(line), Number(col)); } } throw new Error('Error: null item not found on state'); diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts index b607d44..be9a3de 100644 --- a/tests/heuristic.spec.ts +++ b/tests/heuristic.spec.ts @@ -1,6 +1,7 @@ import { expect } from 'chai'; import { calcHeuristicValue, calcDistanceOfItem } from "../src/functions/heuristic"; import { State, StateItem } from '../src/utils/state'; +import StateItemPosition from '../src/classes/StateItemPosition'; describe('Heuristic Smoke Tests', () => { // the tests container it('should exist calcHeuristicValue function', () => { @@ -21,7 +22,7 @@ describe('Heuristic Smoke Tests', () => { // the tests container it('should return a number when call calcDistanceOfItem function', () => { const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const item = 2; - const itemPosition = [2,1]; + const itemPosition = new StateItemPosition(2, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.be.a('number'); }); }); @@ -30,21 +31,21 @@ describe('Testing returns of calcDistanceOfItem', () => { it('should return 2 when call calcDistanceOfItem', () => { const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const item: StateItem = 2; - const itemPosition = [2,1]; + const itemPosition = new StateItemPosition(2, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(2); }); it('should return 1 when call calcDistanceOfItem', () => { const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const item: StateItem = 5; - const itemPosition = [0,1]; + const itemPosition = new StateItemPosition(0, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(1); }); it('should return 3 when call calcDistanceOfItem', () => { const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const item: StateItem = null; - const itemPosition = [1,0]; + const itemPosition = new StateItemPosition(1, 0); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(3); }); }) diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index cd21f92..356bba2 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -2,6 +2,7 @@ import { expect, Assertion, util } from 'chai'; import { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } from "../src/functions/operations"; import { State, StateItem } from "../src/utils/state"; import { operations } from '../src/utils/operations'; +import StateItemPosition from '../src/classes/StateItemPosition'; describe('Smoke Tests', () => { it('should exist applyOperation function', () => { @@ -38,17 +39,20 @@ describe('Testing returns of getPositionOfNullItem function', () => { it('should return [1,0] when call getPositionOfNullItem function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - expect(getPositionOfNullItem(state)).to.eql([1, 0]); + const expectedPosition = new StateItemPosition(1,0); + expect(getPositionOfNullItem(state)).to.eql(expectedPosition); }); it('should return [2,1] when call getPositionOfNullItem function', () => { const state: State = [[4,5,8], [3,1,6], [7, null, 2]]; - expect(getPositionOfNullItem(state)).to.eql([2, 1]); + const expectedPosition = new StateItemPosition(2,1); + expect(getPositionOfNullItem(state)).to.eql(expectedPosition); }); it('should return [0,0] when call getPositionOfNullItem function', () => { const state: State = [[null,5,8], [3,1,6], [7, 2, 4]]; - expect(getPositionOfNullItem(state)).to.eql([0, 0]); + const expectedPosition = new StateItemPosition(0,0); + expect(getPositionOfNullItem(state)).to.eql(expectedPosition); }); }); From 729d3b93df018e83f21c329b86f2f5efa74d6250 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 13:27:08 -0300 Subject: [PATCH 12/47] Add new operations functions with tests --- src/functions/operations.ts | 45 ++++++++++++++++++++++++++++++------- tests/operations.spec.ts | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/functions/operations.ts b/src/functions/operations.ts index e4f8b6b..92d98fb 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -5,6 +5,12 @@ import StateItemPosition from "../classes/StateItemPosition"; function applyOperation(state: State, op: operations){ if(op == operations.up){ return moveUpOperation(state); + } else if (op == operations.right){ + return moveRightOperation(state); + } else if(op == operations.down){ + return moveDownOperation(state); + } else if (op == operations.left){ + return moveLeftOperation(state); } return state; @@ -14,25 +20,38 @@ function moveUpOperation(state: State){ const nullPosition = getPositionOfNullItem(state); const newLinePosition = nullPosition.line - 1; if(newLinePosition >= 0){ - - const newState: State = [... state]; - const aux = state[newLinePosition][nullPosition.col] - newState[newLinePosition][nullPosition.col] = null; - newState[nullPosition.line][nullPosition.col] = aux; - return newState; + const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); + return changePositions(nullPosition, newPosition, state); } } function moveRightOperation(state: State){ - + const nullPosition = getPositionOfNullItem(state); + + const newColPosition = nullPosition.col + 1; + if(newColPosition <= 2){ + const newPosition = new StateItemPosition(nullPosition.line, newColPosition); + return changePositions(nullPosition, newPosition, state); + } } function moveDownOperation(state: State){ - + const nullPosition = getPositionOfNullItem(state); + const newLinePosition = nullPosition.line + 1; + if(newLinePosition <= 2){ + const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); + return changePositions(nullPosition, newPosition, state); + } } function moveLeftOperation(state: State){ + const nullPosition = getPositionOfNullItem(state); + const newColPosition = nullPosition.col - 1; + if(newColPosition >= 0){ + const newPosition = new StateItemPosition(nullPosition.line, newColPosition); + return changePositions(nullPosition, newPosition, state); + } } @@ -47,4 +66,14 @@ function getPositionOfNullItem(state: State){ throw new Error('Error: null item not found on state'); } +function changePositions(actualPosition: StateItemPosition, newPosition: StateItemPosition, state: State){ + const newState = [...state]; + const aux = state[newPosition.line][newPosition.col]; + + newState[newPosition.line][newPosition.col] = null; + newState[actualPosition.line][actualPosition.col] = aux; + + return newState +} + export { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } \ No newline at end of file diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index 356bba2..641f721 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -63,5 +63,47 @@ describe('Testing returns of applyOperation function', () => { const goalState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.up)).to.eql(goalState); }); + + it('should return correct state when call applyOperation function when using movUp operation', () => { + const actualState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const goalState: State = [[1,2,3], [4,5,null], [7, 8, 6]]; + expect(applyOperation(actualState, operations.up)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movRight operation', () => { + const actualState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const goalState: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + expect(applyOperation(actualState, operations.right)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movRight operation', () => { + const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[5,null,8], [4,1,6], [7, 2, 3]]; + expect(applyOperation(actualState, operations.right)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movDown operation', () => { + const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + expect(applyOperation(actualState, operations.down)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movDown operation', () => { + const actualState: State = [[1,2,3], [4,null,6], [7, 5, 8]]; + const goalState: State = [[1,2,3], [4,5,6], [7, null, 8]]; + expect(applyOperation(actualState, operations.down)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movLeft operation', () => { + const actualState: State = [[1,2,3], [4,null,6], [7, 5, 8]]; + const goalState: State = [[1,2,3], [null,4,6], [7, 5, 8]]; + expect(applyOperation(actualState, operations.left)).to.eql(goalState); + }); + + it('should return correct state when call applyOperation function when using movLeft operation', () => { + const actualState: State = [[5,8,null], [4,1,6], [7, 2, 3]]; + const goalState: State = [[5,null,8], [4,1,6], [7, 2, 3]]; + expect(applyOperation(actualState, operations.left)).to.eql(goalState); + }); }); \ No newline at end of file From d084d179f5d28456600858aee2d4a3d26fb62b42 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 13:30:07 -0300 Subject: [PATCH 13/47] Refactor applyOperation function --- src/functions/operations.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/functions/operations.ts b/src/functions/operations.ts index 92d98fb..a15000c 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -3,17 +3,20 @@ import { operations } from "../utils/operations"; import StateItemPosition from "../classes/StateItemPosition"; function applyOperation(state: State, op: operations){ - if(op == operations.up){ - return moveUpOperation(state); - } else if (op == operations.right){ - return moveRightOperation(state); - } else if(op == operations.down){ - return moveDownOperation(state); - } else if (op == operations.left){ - return moveLeftOperation(state); + switch (op){ + case operations.up: + return moveUpOperation(state); + break; + case operations.right: + return moveRightOperation(state); + break; + case operations.down: + return moveDownOperation(state); + break; + case operations.left: + return moveLeftOperation(state); + break; } - - return state; } function moveUpOperation(state: State){ @@ -55,7 +58,6 @@ function moveLeftOperation(state: State){ } - function getPositionOfNullItem(state: State){ for (let line in state){ let col = state[line].indexOf(null); From fecc2e7435126f9321d043201c7525fdedb4f143 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 14:25:51 -0300 Subject: [PATCH 14/47] Refactor Node class (start using operation enum) --- src/classes/Node.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/classes/Node.ts b/src/classes/Node.ts index 23cb251..f5cb0c3 100644 --- a/src/classes/Node.ts +++ b/src/classes/Node.ts @@ -1,12 +1,13 @@ import { State } from "../utils/state"; +import { operations } from "../utils/operations"; class NodeInfo { evaluationFunctionValue: number; - operation: string; // TODO: usar types/enum pra permitir somente operações válidas + operation: operations; state: State; previousNode?: NodeInfo; - constructor(efValue: number, op: string, s: State, prev: NodeInfo){ + constructor(efValue: number, op: operations, s: State, prev?: NodeInfo){ this.evaluationFunctionValue = efValue this.operation = op this.state = s From f5acf552c85f448b40ff59b4a4ed1fbdf2ddc7dd Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 14:26:14 -0300 Subject: [PATCH 15/47] Add operation none --- src/utils/operations.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/operations.ts b/src/utils/operations.ts index d2cd401..a75dd2e 100644 --- a/src/utils/operations.ts +++ b/src/utils/operations.ts @@ -3,4 +3,5 @@ export enum operations { right = 'RIGHT_OPERATION', down = 'DOWN_OPERATION', left = 'LEFT_OPERATION', + none = 'NONE', } \ No newline at end of file From 00d0b690d46bc8ffeb5a25f4ad09f70be0b5cc17 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 14:30:35 -0300 Subject: [PATCH 16/47] Update operations test file (add info to describe) --- tests/operations.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index 641f721..c0ee091 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -4,7 +4,7 @@ import { State, StateItem } from "../src/utils/state"; import { operations } from '../src/utils/operations'; import StateItemPosition from '../src/classes/StateItemPosition'; -describe('Smoke Tests', () => { +describe('Operations Smoke Tests', () => { it('should exist applyOperation function', () => { expect(applyOperation).to.exist; }); From 2811d144019f83b554c5906af96bc1ddf5ad7aad Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 15:17:47 -0300 Subject: [PATCH 17/47] Add node functions with tests (WIP) --- src/functions/node.ts | 17 ++++++++++++ tests/node.spec.ts | 61 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/functions/node.ts create mode 100644 tests/node.spec.ts diff --git a/src/functions/node.ts b/src/functions/node.ts new file mode 100644 index 0000000..90528c3 --- /dev/null +++ b/src/functions/node.ts @@ -0,0 +1,17 @@ +import { operations } from './../utils/operations'; +import { NodeInfo } from "../classes/Node" +import { State } from '../utils/state'; +import { calcHeuristicValue } from './heuristic'; + +function generateNodeList(node: NodeInfo, goalState: State, gValue: number){ + const s: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const n = new NodeInfo(1, operations.none, s); + return [n]; +} + +function generateNode(state: State, op: operations, goalState: State, gValue: number, previousNode?: NodeInfo){ + const heuristicValue = calcHeuristicValue(state, goalState, gValue); + return new NodeInfo(heuristicValue, op, state, previousNode); +} + +export { generateNodeList, generateNode } \ No newline at end of file diff --git a/tests/node.spec.ts b/tests/node.spec.ts new file mode 100644 index 0000000..b6b623d --- /dev/null +++ b/tests/node.spec.ts @@ -0,0 +1,61 @@ +import { operations } from './../src/utils/operations'; +import { expect } from 'chai'; +import { generateNodeList, generateNode } from "../src/functions/node"; +import { NodeInfo } from "../src/classes/Node"; +import { State } from '../src/utils/state'; + + +describe('Node Smoke Tests', () => { // the tests container + it('should exist generateNodeList function', () => { + expect(generateNodeList).to.exist; + }); + + it('should exist generateNode function', () => { + expect(generateNode).to.exist; + }); + + it('should return an Array when call generateNodeList function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const node: NodeInfo = new NodeInfo(14, operations.none, state); + const gValue = 0; + + expect(generateNodeList(node, state, gValue)).to.be.an('Array'); + }); + + it('should return a NodeInfo object when call generateNode function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const gValue = 0; + expect(generateNode(state, operations.none,state, gValue)).to.be.instanceOf(NodeInfo); + }); +}); + +describe('Testing returns of generateNode function', () => { + + it('should return this NodeInfo obj when call generateNode function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + + const expectedNode = new NodeInfo(14, operations.none, state); + const gValue = 0; + expect(generateNode(state, operations.none, finalState, gValue)).to.eql(expectedNode); + }); + + it('should return this NodeInfo obj when call generateNode function', () => { + const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + + const expectedNode = new NodeInfo(13, operations.left, state); + const gValue = 1; + expect(generateNode(state, operations.left, finalState, gValue)).to.eql(expectedNode); + }); + + it('should return this NodeInfo obj when call generateNode function', () => { + const state: State = [[4,5,8], [1,2,6], [7, 3, null]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + + const mockedPreviousNode = new NodeInfo(0, operations.none, state); + const expectedNode = new NodeInfo(13, operations.up, state, mockedPreviousNode); + const gValue = 3; + expect(generateNode(state, operations.up, finalState, gValue, mockedPreviousNode)).to.eql(expectedNode); + }); +}); \ No newline at end of file From f5ad4833c57f52068388bf64ffeaf516781e01d3 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 15:23:20 -0300 Subject: [PATCH 18/47] Refactor operations functions (return null when cannot apply) --- src/functions/operations.ts | 4 ++++ tests/operations.spec.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/functions/operations.ts b/src/functions/operations.ts index a15000c..cdd86ae 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -26,6 +26,7 @@ function moveUpOperation(state: State){ const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); return changePositions(nullPosition, newPosition, state); } + return null; } function moveRightOperation(state: State){ @@ -36,6 +37,7 @@ function moveRightOperation(state: State){ const newPosition = new StateItemPosition(nullPosition.line, newColPosition); return changePositions(nullPosition, newPosition, state); } + return null; } function moveDownOperation(state: State){ @@ -45,6 +47,7 @@ function moveDownOperation(state: State){ const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); return changePositions(nullPosition, newPosition, state); } + return null; } function moveLeftOperation(state: State){ @@ -55,6 +58,7 @@ function moveLeftOperation(state: State){ const newPosition = new StateItemPosition(nullPosition.line, newColPosition); return changePositions(nullPosition, newPosition, state); } + return null; } diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index c0ee091..2778831 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -105,5 +105,31 @@ describe('Testing returns of applyOperation function', () => { const goalState: State = [[5,null,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.left)).to.eql(goalState); }); +}); + +describe('Testing returns of applyOperation function when operation cannot be applied', () => { + + it('should return null when call applyOperation function using movUp operation', () => { + const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + + expect(applyOperation(actualState, operations.up)).to.eql(null); + }); + + it('should return null when call applyOperation function using movRight operation', () => { + const actualState: State = [[5,8,6], [4,1,null], [7, 2, 3]]; + expect(applyOperation(actualState, operations.right)).to.eql(null); + }); + + it('should return null when call applyOperation function using movDown operation', () => { + const actualState: State = [[5,8,6], [4,1,3], [7, null, 2]]; + + expect(applyOperation(actualState, operations.down)).to.eql(null); + }); + + it('should return null when call applyOperation function using movLeft operation', () => { + const actualState: State = [[5,8,6], [null,4,1], [7, 3, 2]]; + + expect(applyOperation(actualState, operations.left)).to.eql(null); + }); }); \ No newline at end of file From b8accf99e071b76be19312d6c39445d01607c173 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 16:43:58 -0300 Subject: [PATCH 19/47] Refactor and update operations functions --- src/functions/operations.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/functions/operations.ts b/src/functions/operations.ts index cdd86ae..3dc7306 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -19,7 +19,7 @@ function applyOperation(state: State, op: operations){ } } -function moveUpOperation(state: State){ +function moveUpOperation(state: State): State | null{ const nullPosition = getPositionOfNullItem(state); const newLinePosition = nullPosition.line - 1; if(newLinePosition >= 0){ @@ -29,7 +29,7 @@ function moveUpOperation(state: State){ return null; } -function moveRightOperation(state: State){ +function moveRightOperation(state: State): State | null{ const nullPosition = getPositionOfNullItem(state); const newColPosition = nullPosition.col + 1; @@ -40,7 +40,7 @@ function moveRightOperation(state: State){ return null; } -function moveDownOperation(state: State){ +function moveDownOperation(state: State): State | null{ const nullPosition = getPositionOfNullItem(state); const newLinePosition = nullPosition.line + 1; if(newLinePosition <= 2){ @@ -50,7 +50,7 @@ function moveDownOperation(state: State){ return null; } -function moveLeftOperation(state: State){ +function moveLeftOperation(state: State): State | null{ const nullPosition = getPositionOfNullItem(state); const newColPosition = nullPosition.col - 1; @@ -72,14 +72,24 @@ function getPositionOfNullItem(state: State){ throw new Error('Error: null item not found on state'); } -function changePositions(actualPosition: StateItemPosition, newPosition: StateItemPosition, state: State){ - const newState = [...state]; +function changePositions(actualPosition: StateItemPosition, newPosition: StateItemPosition, state: State): State{ + const newState: State = cloneState(state); //TODO: Encontrar uma estratégia otimizada pra clonar o array do estado const aux = state[newPosition.line][newPosition.col]; newState[newPosition.line][newPosition.col] = null; newState[actualPosition.line][actualPosition.col] = aux; - + return newState } +function cloneState(state: State){ + let newState: State = [[null, null, null], [null, null, null], [null, null, null]]; + for (let l in state){ + for (let c in state){ + newState[l][c] = state[l][c]; + } + } + return newState; +} + export { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } \ No newline at end of file From ab8935c757637adfb105621e433dc0f5951eea1a Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 16:45:08 -0300 Subject: [PATCH 20/47] Update node functions with tests --- src/functions/node.ts | 33 ++++++++++++++++++++++++++---- tests/node.spec.ts | 47 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/src/functions/node.ts b/src/functions/node.ts index 90528c3..92e48a0 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -2,14 +2,39 @@ import { operations } from './../utils/operations'; import { NodeInfo } from "../classes/Node" import { State } from '../utils/state'; import { calcHeuristicValue } from './heuristic'; +import { applyOperation } from './operations'; function generateNodeList(node: NodeInfo, goalState: State, gValue: number){ - const s: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const n = new NodeInfo(1, operations.none, s); - return [n]; + let childrenNodes: NodeInfo[] = []; + const childUp = generateAndTest(operations.up, node, goalState, gValue); + if (childUp){ + childrenNodes.push(childUp); + } + const childRight = generateAndTest(operations.right, node, goalState, gValue); + if (childRight){ + childrenNodes.push(childRight); + } + const childDown = generateAndTest(operations.down, node, goalState, gValue); + if (childDown){ + childrenNodes.push(childDown); + } + const childLeft = generateAndTest(operations.left, node, goalState, gValue); + if (childLeft){ + childrenNodes.push(childLeft); + } + + return childrenNodes.sort((a, b) => (a.evaluationFunctionValue < b.evaluationFunctionValue) ? -1 : 1); } -function generateNode(state: State, op: operations, goalState: State, gValue: number, previousNode?: NodeInfo){ +function generateAndTest(op: operations, node: NodeInfo, goalState: State, gValue: number): NodeInfo | null{ + const newState = applyOperation(node.state, op); + if(newState){ + return generateNode(newState, op, goalState, (gValue+1), node); + } + return null; +} + +function generateNode(state: State, op: operations, goalState: State, gValue: number, previousNode?: NodeInfo): NodeInfo{ const heuristicValue = calcHeuristicValue(state, goalState, gValue); return new NodeInfo(heuristicValue, op, state, previousNode); } diff --git a/tests/node.spec.ts b/tests/node.spec.ts index b6b623d..d673f09 100644 --- a/tests/node.spec.ts +++ b/tests/node.spec.ts @@ -58,4 +58,51 @@ describe('Testing returns of generateNode function', () => { const gValue = 3; expect(generateNode(state, operations.up, finalState, gValue, mockedPreviousNode)).to.eql(expectedNode); }); +}); + + +describe('Testing returns of generateNodeList function', () => { + + it('should return this NodeInfo array when call generateNodeList function', () => { + const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const rootNode = new NodeInfo(14, operations.none, state); + const gValue = 0; + + const stateChild1: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const expectedChild1 = new NodeInfo(15, operations.up, stateChild1, rootNode); + + const stateChild2: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const expectedChild2 = new NodeInfo(13, operations.right, stateChild2, rootNode); + + const stateChild3: State = [[4,5,8], [7,1,6], [null, 2, 3]]; + const expectedChild3 = new NodeInfo(15, operations.down, stateChild3, rootNode); + + const childrenList = [expectedChild2, expectedChild1 , expectedChild3]; + + expect(generateNodeList(rootNode, goalState, gValue)).to.eql(childrenList); + }); + + it('should return this NodeInfo array when call generateNodeList function', () => { + const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const rootNode = new NodeInfo(13, operations.right, state); + const gValue = 1; + + const stateChild1: State = [[4,null,8], [1,5,6], [7, 2, 3]]; + const expectedChild1 = new NodeInfo(14, operations.up, stateChild1, rootNode); + + const stateChild2: State = [[4,5,8], [1,6,null], [7, 2, 3]]; + const expectedChild2 = new NodeInfo(14, operations.right, stateChild2, rootNode); + + const stateChild3: State = [[4,5,8], [1,2,6], [7, null, 3]]; + const expectedChild3 = new NodeInfo(12, operations.down, stateChild3, rootNode); + + const stateChild4: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const expectedChild4 = new NodeInfo(16, operations.left, stateChild4, rootNode); + + const childrenList = [expectedChild3, expectedChild1, expectedChild2, expectedChild4]; + + expect(generateNodeList(rootNode, goalState, gValue)).to.eql(childrenList); + }); }); \ No newline at end of file From b0789294f7332fa8b7927ced6aeae73a47875eba Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 3 Jul 2020 23:18:49 -0300 Subject: [PATCH 21/47] Update generateNodeList function --- src/functions/node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions/node.ts b/src/functions/node.ts index 92e48a0..164b65c 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -4,7 +4,7 @@ import { State } from '../utils/state'; import { calcHeuristicValue } from './heuristic'; import { applyOperation } from './operations'; -function generateNodeList(node: NodeInfo, goalState: State, gValue: number){ +function generateNodeList(node: NodeInfo, goalState: State, gValue: number): NodeInfo[]{ let childrenNodes: NodeInfo[] = []; const childUp = generateAndTest(operations.up, node, goalState, gValue); if (childUp){ From e44bee17d640d3acbbc42d1771198be1379df9f3 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 00:07:55 -0300 Subject: [PATCH 22/47] Refactor Node class (using heuristicValue as an object) --- src/classes/HeuristicValue.ts | 13 +++++++ src/classes/Node.ts | 5 ++- src/functions/heuristic.ts | 7 +--- src/functions/node.ts | 18 +++++---- tests/heuristic.spec.ts | 29 ++++++-------- tests/node.spec.ts | 73 ++++++++++++++++++++--------------- 6 files changed, 81 insertions(+), 64 deletions(-) create mode 100644 src/classes/HeuristicValue.ts diff --git a/src/classes/HeuristicValue.ts b/src/classes/HeuristicValue.ts new file mode 100644 index 0000000..29aedcc --- /dev/null +++ b/src/classes/HeuristicValue.ts @@ -0,0 +1,13 @@ +export default class HeuristicValue { + g: number; + h: number; + + constructor(g: number, h: number){ + this.g = g; + this.h = h; + } + + get f(){ + return this.g + this.h; + } +} \ No newline at end of file diff --git a/src/classes/Node.ts b/src/classes/Node.ts index f5cb0c3..2734eb4 100644 --- a/src/classes/Node.ts +++ b/src/classes/Node.ts @@ -1,13 +1,14 @@ import { State } from "../utils/state"; import { operations } from "../utils/operations"; +import HeuristicValue from "./HeuristicValue"; class NodeInfo { - evaluationFunctionValue: number; + evaluationFunctionValue: HeuristicValue; operation: operations; state: State; previousNode?: NodeInfo; - constructor(efValue: number, op: operations, s: State, prev?: NodeInfo){ + constructor(efValue: HeuristicValue, op: operations, s: State, prev?: NodeInfo){ this.evaluationFunctionValue = efValue this.operation = op this.state = s diff --git a/src/functions/heuristic.ts b/src/functions/heuristic.ts index 7166de4..9fe531d 100644 --- a/src/functions/heuristic.ts +++ b/src/functions/heuristic.ts @@ -1,11 +1,6 @@ import { State, StateItem } from "../utils/state" import StateItemPosition from "../classes/StateItemPosition"; - -function calcHeuristicValue(actualState: State, goalState: State, gValue: number){ - return gValue + calcHValue(actualState, goalState); -} - function calcHValue(actualState: State, goalState: State){ let totalDistance = 0; for (let line in actualState){ @@ -28,4 +23,4 @@ function calcDistanceOfItem(item: StateItem, itemPosition: StateItemPosition, go return 10; //TODO: Rever esse valor (ou tratamento diferente caso o item buscado não exista no estado objetivo) } -export { calcHeuristicValue, calcDistanceOfItem } \ No newline at end of file +export { calcHValue, calcDistanceOfItem } \ No newline at end of file diff --git a/src/functions/node.ts b/src/functions/node.ts index 164b65c..058a67f 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -1,29 +1,30 @@ import { operations } from './../utils/operations'; import { NodeInfo } from "../classes/Node" import { State } from '../utils/state'; -import { calcHeuristicValue } from './heuristic'; +import { calcHValue } from './heuristic'; import { applyOperation } from './operations'; +import HeuristicValue from '../classes/HeuristicValue'; -function generateNodeList(node: NodeInfo, goalState: State, gValue: number): NodeInfo[]{ +function generateNodeList(node: NodeInfo, goalState: State): NodeInfo[]{ let childrenNodes: NodeInfo[] = []; - const childUp = generateAndTest(operations.up, node, goalState, gValue); + const childUp = generateAndTest(operations.up, node, goalState, node.evaluationFunctionValue.g); if (childUp){ childrenNodes.push(childUp); } - const childRight = generateAndTest(operations.right, node, goalState, gValue); + const childRight = generateAndTest(operations.right, node, goalState, node.evaluationFunctionValue.g); if (childRight){ childrenNodes.push(childRight); } - const childDown = generateAndTest(operations.down, node, goalState, gValue); + const childDown = generateAndTest(operations.down, node, goalState, node.evaluationFunctionValue.g); if (childDown){ childrenNodes.push(childDown); } - const childLeft = generateAndTest(operations.left, node, goalState, gValue); + const childLeft = generateAndTest(operations.left, node, goalState, node.evaluationFunctionValue.g); if (childLeft){ childrenNodes.push(childLeft); } - return childrenNodes.sort((a, b) => (a.evaluationFunctionValue < b.evaluationFunctionValue) ? -1 : 1); + return childrenNodes; } function generateAndTest(op: operations, node: NodeInfo, goalState: State, gValue: number): NodeInfo | null{ @@ -35,7 +36,8 @@ function generateAndTest(op: operations, node: NodeInfo, goalState: State, gValu } function generateNode(state: State, op: operations, goalState: State, gValue: number, previousNode?: NodeInfo): NodeInfo{ - const heuristicValue = calcHeuristicValue(state, goalState, gValue); + const hValue = calcHValue(state, goalState); + const heuristicValue = new HeuristicValue(gValue, hValue); return new NodeInfo(heuristicValue, op, state, previousNode); } diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts index be9a3de..19ebac6 100644 --- a/tests/heuristic.spec.ts +++ b/tests/heuristic.spec.ts @@ -1,18 +1,18 @@ import { expect } from 'chai'; -import { calcHeuristicValue, calcDistanceOfItem } from "../src/functions/heuristic"; +import { calcHValue, calcDistanceOfItem } from "../src/functions/heuristic"; import { State, StateItem } from '../src/utils/state'; import StateItemPosition from '../src/classes/StateItemPosition'; describe('Heuristic Smoke Tests', () => { // the tests container - it('should exist calcHeuristicValue function', () => { - expect(calcHeuristicValue).to.exist; + it('should exist calcHValue function', () => { + expect(calcHValue).to.exist; }); it('should return a number when call calcHeuristicValue function', () => { const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const gValue = 0; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.be.a('number'); + expect(calcHValue(initialState, goalState)).to.be.a('number'); }); it('should exist calcDistanceOfItem function', () => { @@ -50,47 +50,42 @@ describe('Testing returns of calcDistanceOfItem', () => { }); }) -describe('Testing returns of calcHeuristicValue', () => { - it('should return 14 when call calcHeuristicValue function', () => { +describe('Testing returns of calcHValue', () => { + it('should return 14 when call calcHValue function', () => { const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const gValue = 0; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(14); + expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 15 when call calcHeuristicValue function', () => { const initialState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const gValue = 1; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(15); + expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 15 when call calcHeuristicValue function', () => { const initialState: State = [[4,5,8], [7,1,6], [null, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const gValue = 1; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(15); + expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 13 when call calcHeuristicValue function', () => { const initialState: State = [[4,5,8], [1,null,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const gValue = 1; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(13); + expect(calcHValue(initialState, goalState)).to.equal(12); }); it('should return 14 when call calcHeuristicValue function', () => { const initialState: State = [[4,null,8], [1,5,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const gValue = 2; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(14); + expect(calcHValue(initialState, goalState)).to.equal(12); }); it('should return 12 when call calcHeuristicValue function', () => { const initialState: State = [[4,5,8], [1,2,6], [7, null, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const gValue = 2; - expect(calcHeuristicValue(initialState, goalState, gValue)).to.equal(12); + expect(calcHValue(initialState, goalState)).to.equal(10); }); }) \ No newline at end of file diff --git a/tests/node.spec.ts b/tests/node.spec.ts index d673f09..f7ef7cc 100644 --- a/tests/node.spec.ts +++ b/tests/node.spec.ts @@ -3,6 +3,7 @@ import { expect } from 'chai'; import { generateNodeList, generateNode } from "../src/functions/node"; import { NodeInfo } from "../src/classes/Node"; import { State } from '../src/utils/state'; +import HeuristicValue from '../src/classes/HeuristicValue'; describe('Node Smoke Tests', () => { // the tests container @@ -16,10 +17,10 @@ describe('Node Smoke Tests', () => { // the tests container it('should return an Array when call generateNodeList function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const node: NodeInfo = new NodeInfo(14, operations.none, state); - const gValue = 0; + const heuristicValue = new HeuristicValue(0, 14); + const node: NodeInfo = new NodeInfo(heuristicValue, operations.none, state); - expect(generateNodeList(node, state, gValue)).to.be.an('Array'); + expect(generateNodeList(node, state)).to.be.an('Array'); }); it('should return a NodeInfo object when call generateNode function', () => { @@ -34,8 +35,9 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const heuristicValue = new HeuristicValue(0, 14); - const expectedNode = new NodeInfo(14, operations.none, state); + const expectedNode = new NodeInfo(heuristicValue, operations.none, state); const gValue = 0; expect(generateNode(state, operations.none, finalState, gValue)).to.eql(expectedNode); }); @@ -43,8 +45,9 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const heuristicValue = new HeuristicValue(1, 12); - const expectedNode = new NodeInfo(13, operations.left, state); + const expectedNode = new NodeInfo(heuristicValue, operations.left, state); const gValue = 1; expect(generateNode(state, operations.left, finalState, gValue)).to.eql(expectedNode); }); @@ -52,9 +55,11 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [1,2,6], [7, 3, null]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - - const mockedPreviousNode = new NodeInfo(0, operations.none, state); - const expectedNode = new NodeInfo(13, operations.up, state, mockedPreviousNode); + const heuristicValuePrevious = new HeuristicValue(0, 0); + + const mockedPreviousNode = new NodeInfo(heuristicValuePrevious, operations.none, state); + const heuristicValueExpected = new HeuristicValue(3, 10); + const expectedNode = new NodeInfo(heuristicValueExpected, operations.up, state, mockedPreviousNode); const gValue = 3; expect(generateNode(state, operations.up, finalState, gValue, mockedPreviousNode)).to.eql(expectedNode); }); @@ -62,47 +67,53 @@ describe('Testing returns of generateNode function', () => { describe('Testing returns of generateNodeList function', () => { - it('should return this NodeInfo array when call generateNodeList function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const rootNode = new NodeInfo(14, operations.none, state); - const gValue = 0; - - const stateChild1: State = [[null,5,8], [4,1,6], [7, 2, 3]]; - const expectedChild1 = new NodeInfo(15, operations.up, stateChild1, rootNode); + const heuristicValueRoot = new HeuristicValue(0, 14); + const rootNode = new NodeInfo(heuristicValueRoot, operations.none, state); + const stateChild1: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const heuristicValue1 = new HeuristicValue(1, 14); + const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); + const stateChild2: State = [[4,5,8], [1,null,6], [7, 2, 3]]; - const expectedChild2 = new NodeInfo(13, operations.right, stateChild2, rootNode); - - const stateChild3: State = [[4,5,8], [7,1,6], [null, 2, 3]]; - const expectedChild3 = new NodeInfo(15, operations.down, stateChild3, rootNode); + const heuristicValue2 = new HeuristicValue(1, 12); + const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); - const childrenList = [expectedChild2, expectedChild1 , expectedChild3]; + const stateChild3: State = [[4,5,8], [7,1,6], [null, 2, 3]]; + const heuristicValue3 = new HeuristicValue(1, 14); + const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); - expect(generateNodeList(rootNode, goalState, gValue)).to.eql(childrenList); + const childrenList = [expectedChild1, expectedChild2 , expectedChild3]; + + expect(generateNodeList(rootNode, goalState)).to.eql(childrenList); }); - + it('should return this NodeInfo array when call generateNodeList function', () => { const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const rootNode = new NodeInfo(13, operations.right, state); - const gValue = 1; - + const heuristicValueRoot = new HeuristicValue(1, 12); + const rootNode = new NodeInfo(heuristicValueRoot, operations.right, state); + const stateChild1: State = [[4,null,8], [1,5,6], [7, 2, 3]]; - const expectedChild1 = new NodeInfo(14, operations.up, stateChild1, rootNode); + const heuristicValue1 = new HeuristicValue(2, 12); + const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); const stateChild2: State = [[4,5,8], [1,6,null], [7, 2, 3]]; - const expectedChild2 = new NodeInfo(14, operations.right, stateChild2, rootNode); + const heuristicValue2 = new HeuristicValue(2, 12); + const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); const stateChild3: State = [[4,5,8], [1,2,6], [7, null, 3]]; - const expectedChild3 = new NodeInfo(12, operations.down, stateChild3, rootNode); + const heuristicValue3 = new HeuristicValue(2, 10); + const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); const stateChild4: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const expectedChild4 = new NodeInfo(16, operations.left, stateChild4, rootNode); + const heuristicValue4 = new HeuristicValue(2, 14); + const expectedChild4 = new NodeInfo(heuristicValue4, operations.left, stateChild4, rootNode); - const childrenList = [expectedChild3, expectedChild1, expectedChild2, expectedChild4]; - - expect(generateNodeList(rootNode, goalState, gValue)).to.eql(childrenList); + const childrenList = [expectedChild1, expectedChild2, expectedChild3, expectedChild4]; + + expect(generateNodeList(rootNode, goalState)).to.eql(childrenList); }); }); \ No newline at end of file From fdcd119afed8109336f5ec2b7066af2e36337c94 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 00:08:18 -0300 Subject: [PATCH 23/47] Remove unused import --- tests/operations.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index 2778831..2ba0d60 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -1,4 +1,4 @@ -import { expect, Assertion, util } from 'chai'; +import { expect } from 'chai'; import { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } from "../src/functions/operations"; import { State, StateItem } from "../src/utils/state"; import { operations } from '../src/utils/operations'; From f58d4a0729fbdc59112f8d7d907d0b59d76dd990 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 15:20:46 -0300 Subject: [PATCH 24/47] Add state functions with tests (WIP) --- src/functions/state.ts | 36 +++++++++++++++ tests/state.spec.ts | 100 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 src/functions/state.ts create mode 100644 tests/state.spec.ts diff --git a/src/functions/state.ts b/src/functions/state.ts new file mode 100644 index 0000000..c298600 --- /dev/null +++ b/src/functions/state.ts @@ -0,0 +1,36 @@ +import { State } from "../utils/state"; + + +// Using this function because literal comparison between 2 types (state1 == state2) always return false +// TODO: melhorar formato de verificação +function areEqual(state1: State, state2: State){ + const equal = true; + for (let l in state1){ + for (let c in state1){ + if(!(state1[l][c] == state2[l][c])){ + return false; + } + } + } + return true; +} + +// TODO: melhorar formato de verificação +function includes(state: State, list: State[]){ + for (let s of list){ + if(areEqual(s, state)){ + return true; + } + } + return false; +} + +function readState(state: State){ + console.log('---------'); + for(let l of state){ + console.log(l); + } + console.log('---------'); +} + +export { areEqual, includes, readState } \ No newline at end of file diff --git a/tests/state.spec.ts b/tests/state.spec.ts new file mode 100644 index 0000000..c9d2a87 --- /dev/null +++ b/tests/state.spec.ts @@ -0,0 +1,100 @@ +import { expect } from 'chai'; +import { areEqual, includes } from '../src/functions/state'; +import { State } from '../src/utils/state'; + +describe('State Smoke Tests', () => { + it('Should exist areEqual function', () => { + expect(areEqual).to.exist; + }); + + it('Should return boolean when call areEqual function', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, 8, null]]; + expect(areEqual(state1, state2)).to.be.a('Boolean'); + }); + + it('Should exist includes function', () => { + expect(includes).to.exist; + }); + + it('Should return boolean when call includes function', () => { + const state: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const list: State[] = [state]; + expect(includes(state, list)).to.be.a('Boolean'); + }); +}); + +describe('Testing returns of areEqual function', () => { + it('Should return true', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, 8, null]]; + expect(areEqual(state1, state2)).to.eql(true); + }); + + it('Should return false', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + expect(areEqual(state1, state2)).to.eql(false); + }); + + it('Should return true', () => { + const state1: State = [[4,5,3], [2,1,6], [7, null, 8]]; + const state2: State = [[4,5,3], [2,1,6], [7, null, 8]]; + expect(areEqual(state1, state2)).to.eql(true); + }); + + it('Should return false', () => { + const state1: State = [[4,5,3], [null,5,6], [2, 7, 8]]; + const state2: State = [[4,1,3], [2,1,6], [7, 7, 8]]; + expect(areEqual(state1, state2)).to.eql(false); + }); +}); + + +describe('Testing returns of includes function', () => { + it('Should return true', () => { + const state: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const list: State[] = [state]; + expect(includes(state, list)).to.eql(true); + }); + + it('Should return false', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const list: State[] = [state1]; + expect(includes(state2, list)).to.eql(false); + }); + + it('Should return true', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const list: State[] = []; + list.push(state1); + list.push(state2); + expect(includes(state2, list)).to.eql(true); + }); + + it('Should return false', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const state3: State = [[1,2,5], [3,4,6], [7, null, 8]]; + const list: State[] = []; + list.push(state1); + list.push(state2); + expect(includes(state3, list)).to.eql(false); + }); + + it('Should return false', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const list: State[] = []; + expect(includes(state1, list)).to.eql(false); + }); + + it('Should return true', () => { + const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state1Copy: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const list: State[] = []; + list.push(state1); + expect(includes(state1Copy, list)).to.eql(true); + }); +}); \ No newline at end of file From ad45c373f9cd8f2804fc0abede46e8bb8e2090da Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 15:21:11 -0300 Subject: [PATCH 25/47] Update node functions (add readNode) --- src/functions/node.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/functions/node.ts b/src/functions/node.ts index 058a67f..6ccaaff 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -4,6 +4,7 @@ import { State } from '../utils/state'; import { calcHValue } from './heuristic'; import { applyOperation } from './operations'; import HeuristicValue from '../classes/HeuristicValue'; +import { readState } from './state'; function generateNodeList(node: NodeInfo, goalState: State): NodeInfo[]{ let childrenNodes: NodeInfo[] = []; @@ -41,4 +42,15 @@ function generateNode(state: State, op: operations, goalState: State, gValue: nu return new NodeInfo(heuristicValue, op, state, previousNode); } -export { generateNodeList, generateNode } \ No newline at end of file + +function readNode(node: NodeInfo): NodeInfo{ + readState(node.state); + if(node.previousNode){ + return readNode(node.previousNode); + } + else{ + return node; + } +} + +export { generateNodeList, generateNode, readNode } \ No newline at end of file From 4946b85a2383ba9544850dbaaf4a2732bbeed17d Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 15:29:58 -0300 Subject: [PATCH 26/47] Add run function to index (WIP - with rangeerror) --- src/index.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/index.ts b/src/index.ts index e69de29..f6f2b5f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -0,0 +1,42 @@ +import { operations } from './utils/operations'; +import { State } from "./utils/state"; +import { NodeInfo } from "./classes/Node"; +import { generateNodeList, generateNode, readNode } from './functions/node'; +import { areEqual, includes } from './functions/state'; + +const initialState: State = [[4,5,8], [5,4,6], [7, null, 8]]; +const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + +const firstNode = generateNode(initialState, operations.none, finalState, 0); + +let frontier: NodeInfo[] = [firstNode]; +let expandedStates: State[] = []; + + + +const finalNode = run(finalState, frontier, expandedStates); +readNode(finalNode); + +function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]): NodeInfo{ + const actualNode = frontier.shift(); + if(actualNode){ + if (areEqual(actualNode.state, goalState)){ + return actualNode; + } + else{ + if(!includes(actualNode.state, expandedStates)){ //Check if actual state wasn't already openned + const children = generateNodeList(actualNode, goalState); + for (let c of children){ + frontier.push(c); + } + expandedStates.push(actualNode.state); + } + + frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : 1); // Order frontier according to heuristic value of nodes + + return run(goalState, frontier, expandedStates); + } + }else{ + throw new Error('Empty frontier'); + } +} \ No newline at end of file From 087466592803f709a0d64a84421c2d3e8624d6a7 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 19:54:59 -0300 Subject: [PATCH 27/47] Update frontier sort method (using minor f and major g) --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index f6f2b5f..d50c270 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]): N expandedStates.push(actualNode.state); } - frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : 1); // Order frontier according to heuristic value of nodes + frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.g > b.evaluationFunctionValue.g) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes return run(goalState, frontier, expandedStates); } From b6f4be06b6f6afca353cb86e8ea1570ce0f3066a Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 19:58:36 -0300 Subject: [PATCH 28/47] Update index (WIP - solved rangeerror) --- src/index.ts | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/index.ts b/src/index.ts index d50c270..d260dd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import { NodeInfo } from "./classes/Node"; import { generateNodeList, generateNode, readNode } from './functions/node'; import { areEqual, includes } from './functions/state'; -const initialState: State = [[4,5,8], [5,4,6], [7, null, 8]]; +const initialState: State = [[1,2,3], [4,5,6], [7, null, 8]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const firstNode = generateNode(initialState, operations.none, finalState, 0); @@ -12,31 +12,32 @@ const firstNode = generateNode(initialState, operations.none, finalState, 0); let frontier: NodeInfo[] = [firstNode]; let expandedStates: State[] = []; - - const finalNode = run(finalState, frontier, expandedStates); -readNode(finalNode); +if(finalNode){ + readNode(finalNode); +} -function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]): NodeInfo{ - const actualNode = frontier.shift(); - if(actualNode){ - if (areEqual(actualNode.state, goalState)){ - return actualNode; - } - else{ - if(!includes(actualNode.state, expandedStates)){ //Check if actual state wasn't already openned - const children = generateNodeList(actualNode, goalState); - for (let c of children){ +function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ + let actualNode = frontier.shift(); + if(actualNode){ + while(!areEqual(actualNode.state, goalState)){ + const children = generateNodeList(actualNode, goalState); + for (let c of children){ + if(!includes(c.state, expandedStates)){//Only add to frontier states not openned yet frontier.push(c); + expandedStates.push(actualNode.state); } - expandedStates.push(actualNode.state); } - + frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.g > b.evaluationFunctionValue.g) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes - - return run(goalState, frontier, expandedStates); + + const aux = frontier.shift(); + if(aux){ + actualNode = aux; + }else{ + throw new Error('Empty frontier'); + } } - }else{ - throw new Error('Empty frontier'); + return actualNode; } } \ No newline at end of file From cf2d903f806a5ccc33bfd1d5e758c23242da940c Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 20:03:16 -0300 Subject: [PATCH 29/47] Add launch file (using debugger) --- .vscode/launch.json | 20 ++++++++++++++++++++ tsconfig.json | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1f359b3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\dist\\index.js", + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 3ca5118..8cd50a7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,8 @@ "strict": true, /* Enable all strict type-checking options. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + "sourceMap": true, }, "include":[ "src/**/*.ts" From 59f6052f1c16aedec111300a8cccbe377f7672af Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 22:27:58 -0300 Subject: [PATCH 30/47] Refactor frontier sort (mijor f and minor h) --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d260dd3..a7d30b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,8 @@ import { NodeInfo } from "./classes/Node"; import { generateNodeList, generateNode, readNode } from './functions/node'; import { areEqual, includes } from './functions/state'; -const initialState: State = [[1,2,3], [4,5,6], [7, null, 8]]; +// const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; +const initialState: State = [[1,2,3], [5,4,6], [7, null, 8]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; const firstNode = generateNode(initialState, operations.none, finalState, 0); @@ -29,7 +30,7 @@ function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ } } - frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.g > b.evaluationFunctionValue.g) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes + frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.h < b.evaluationFunctionValue.h) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes const aux = frontier.shift(); if(aux){ From 9a980a118feb4d761be4451061457adffe3fd612 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sat, 4 Jul 2020 22:28:43 -0300 Subject: [PATCH 31/47] Refactor heuristic value (add consistence to h value) --- src/classes/HeuristicValue.ts | 8 +++----- src/functions/node.ts | 7 ++++++- tests/node.spec.ts | 28 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/classes/HeuristicValue.ts b/src/classes/HeuristicValue.ts index 29aedcc..e393178 100644 --- a/src/classes/HeuristicValue.ts +++ b/src/classes/HeuristicValue.ts @@ -1,13 +1,11 @@ export default class HeuristicValue { g: number; h: number; + f: number; - constructor(g: number, h: number){ + constructor(g: number, h: number, f: number){ this.g = g; this.h = h; - } - - get f(){ - return this.g + this.h; + this.f = f; } } \ No newline at end of file diff --git a/src/functions/node.ts b/src/functions/node.ts index 6ccaaff..99612b6 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -38,7 +38,12 @@ function generateAndTest(op: operations, node: NodeInfo, goalState: State, gValu function generateNode(state: State, op: operations, goalState: State, gValue: number, previousNode?: NodeInfo): NodeInfo{ const hValue = calcHValue(state, goalState); - const heuristicValue = new HeuristicValue(gValue, hValue); + let heuristicValue = new HeuristicValue(gValue, hValue, (gValue + hValue)); + if(previousNode){ + if(heuristicValue.h > previousNode.evaluationFunctionValue.h){ + heuristicValue.f = previousNode.evaluationFunctionValue.f; //Add consistence to h value + } + } return new NodeInfo(heuristicValue, op, state, previousNode); } diff --git a/tests/node.spec.ts b/tests/node.spec.ts index f7ef7cc..cbecc4d 100644 --- a/tests/node.spec.ts +++ b/tests/node.spec.ts @@ -17,7 +17,7 @@ describe('Node Smoke Tests', () => { // the tests container it('should return an Array when call generateNodeList function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const heuristicValue = new HeuristicValue(0, 14); + const heuristicValue = new HeuristicValue(0, 14, 14); const node: NodeInfo = new NodeInfo(heuristicValue, operations.none, state); expect(generateNodeList(node, state)).to.be.an('Array'); @@ -35,7 +35,7 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const heuristicValue = new HeuristicValue(0, 14); + const heuristicValue = new HeuristicValue(0, 14, 14); const expectedNode = new NodeInfo(heuristicValue, operations.none, state); const gValue = 0; @@ -45,7 +45,7 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const heuristicValue = new HeuristicValue(1, 12); + const heuristicValue = new HeuristicValue(1, 12, 13); const expectedNode = new NodeInfo(heuristicValue, operations.left, state); const gValue = 1; @@ -55,10 +55,10 @@ describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { const state: State = [[4,5,8], [1,2,6], [7, 3, null]]; const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const heuristicValuePrevious = new HeuristicValue(0, 0); + const heuristicValuePrevious = new HeuristicValue(0, 0, 0); const mockedPreviousNode = new NodeInfo(heuristicValuePrevious, operations.none, state); - const heuristicValueExpected = new HeuristicValue(3, 10); + const heuristicValueExpected = new HeuristicValue(3, 10, 0); const expectedNode = new NodeInfo(heuristicValueExpected, operations.up, state, mockedPreviousNode); const gValue = 3; expect(generateNode(state, operations.up, finalState, gValue, mockedPreviousNode)).to.eql(expectedNode); @@ -70,19 +70,19 @@ describe('Testing returns of generateNodeList function', () => { it('should return this NodeInfo array when call generateNodeList function', () => { const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const heuristicValueRoot = new HeuristicValue(0, 14); + const heuristicValueRoot = new HeuristicValue(0, 14, 14); const rootNode = new NodeInfo(heuristicValueRoot, operations.none, state); const stateChild1: State = [[null,5,8], [4,1,6], [7, 2, 3]]; - const heuristicValue1 = new HeuristicValue(1, 14); + const heuristicValue1 = new HeuristicValue(1, 14, 15); const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); const stateChild2: State = [[4,5,8], [1,null,6], [7, 2, 3]]; - const heuristicValue2 = new HeuristicValue(1, 12); + const heuristicValue2 = new HeuristicValue(1, 12, 13); const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); const stateChild3: State = [[4,5,8], [7,1,6], [null, 2, 3]]; - const heuristicValue3 = new HeuristicValue(1, 14); + const heuristicValue3 = new HeuristicValue(1, 14, 15); const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); const childrenList = [expectedChild1, expectedChild2 , expectedChild3]; @@ -93,23 +93,23 @@ describe('Testing returns of generateNodeList function', () => { it('should return this NodeInfo array when call generateNodeList function', () => { const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const heuristicValueRoot = new HeuristicValue(1, 12); + const heuristicValueRoot = new HeuristicValue(1, 12, 13); const rootNode = new NodeInfo(heuristicValueRoot, operations.right, state); const stateChild1: State = [[4,null,8], [1,5,6], [7, 2, 3]]; - const heuristicValue1 = new HeuristicValue(2, 12); + const heuristicValue1 = new HeuristicValue(2, 12, 14); const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); const stateChild2: State = [[4,5,8], [1,6,null], [7, 2, 3]]; - const heuristicValue2 = new HeuristicValue(2, 12); + const heuristicValue2 = new HeuristicValue(2, 12, 14); const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); const stateChild3: State = [[4,5,8], [1,2,6], [7, null, 3]]; - const heuristicValue3 = new HeuristicValue(2, 10); + const heuristicValue3 = new HeuristicValue(2, 10, 12); const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); const stateChild4: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const heuristicValue4 = new HeuristicValue(2, 14); + const heuristicValue4 = new HeuristicValue(2, 14, 13); const expectedChild4 = new NodeInfo(heuristicValue4, operations.left, stateChild4, rootNode); const childrenList = [expectedChild1, expectedChild2, expectedChild3, expectedChild4]; From 5275a01a5f757b07a5854f729e87d7f42ffa79f9 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 17:35:40 -0300 Subject: [PATCH 32/47] Refactor generateNode function (using max f) --- src/functions/node.ts | 4 +++- tests/node.spec.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/functions/node.ts b/src/functions/node.ts index 99612b6..fbf789c 100644 --- a/src/functions/node.ts +++ b/src/functions/node.ts @@ -41,7 +41,9 @@ function generateNode(state: State, op: operations, goalState: State, gValue: nu let heuristicValue = new HeuristicValue(gValue, hValue, (gValue + hValue)); if(previousNode){ if(heuristicValue.h > previousNode.evaluationFunctionValue.h){ - heuristicValue.f = previousNode.evaluationFunctionValue.f; //Add consistence to h value + if(previousNode.evaluationFunctionValue.f > heuristicValue.f ){ + heuristicValue.f = previousNode.evaluationFunctionValue.f; //Add consistence to h value + } } } return new NodeInfo(heuristicValue, op, state, previousNode); diff --git a/tests/node.spec.ts b/tests/node.spec.ts index cbecc4d..dad29b6 100644 --- a/tests/node.spec.ts +++ b/tests/node.spec.ts @@ -58,7 +58,7 @@ describe('Testing returns of generateNode function', () => { const heuristicValuePrevious = new HeuristicValue(0, 0, 0); const mockedPreviousNode = new NodeInfo(heuristicValuePrevious, operations.none, state); - const heuristicValueExpected = new HeuristicValue(3, 10, 0); + const heuristicValueExpected = new HeuristicValue(3, 10, 13); const expectedNode = new NodeInfo(heuristicValueExpected, operations.up, state, mockedPreviousNode); const gValue = 3; expect(generateNode(state, operations.up, finalState, gValue, mockedPreviousNode)).to.eql(expectedNode); @@ -109,7 +109,7 @@ describe('Testing returns of generateNodeList function', () => { const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); const stateChild4: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const heuristicValue4 = new HeuristicValue(2, 14, 13); + const heuristicValue4 = new HeuristicValue(2, 14, 16); const expectedChild4 = new NodeInfo(heuristicValue4, operations.left, stateChild4, rootNode); const childrenList = [expectedChild1, expectedChild2, expectedChild3, expectedChild4]; From cbe34f44459493d1c577858c78fff527dffd3be3 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 17:56:51 -0300 Subject: [PATCH 33/47] Refactor StateItem type (using 0 instead of null) --- src/functions/operations.ts | 18 +++++----- src/utils/state.ts | 2 +- tests/heuristic.spec.ts | 38 ++++++++++----------- tests/node.spec.ts | 38 ++++++++++----------- tests/operations.spec.ts | 68 ++++++++++++++++++------------------- tests/state.spec.ts | 42 +++++++++++------------ 6 files changed, 103 insertions(+), 103 deletions(-) diff --git a/src/functions/operations.ts b/src/functions/operations.ts index 3dc7306..5f3fbc6 100644 --- a/src/functions/operations.ts +++ b/src/functions/operations.ts @@ -20,7 +20,7 @@ function applyOperation(state: State, op: operations){ } function moveUpOperation(state: State): State | null{ - const nullPosition = getPositionOfNullItem(state); + const nullPosition = getPositionOfBlankItem(state); const newLinePosition = nullPosition.line - 1; if(newLinePosition >= 0){ const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); @@ -30,7 +30,7 @@ function moveUpOperation(state: State): State | null{ } function moveRightOperation(state: State): State | null{ - const nullPosition = getPositionOfNullItem(state); + const nullPosition = getPositionOfBlankItem(state); const newColPosition = nullPosition.col + 1; if(newColPosition <= 2){ @@ -41,7 +41,7 @@ function moveRightOperation(state: State): State | null{ } function moveDownOperation(state: State): State | null{ - const nullPosition = getPositionOfNullItem(state); + const nullPosition = getPositionOfBlankItem(state); const newLinePosition = nullPosition.line + 1; if(newLinePosition <= 2){ const newPosition = new StateItemPosition(newLinePosition, nullPosition.col); @@ -51,7 +51,7 @@ function moveDownOperation(state: State): State | null{ } function moveLeftOperation(state: State): State | null{ - const nullPosition = getPositionOfNullItem(state); + const nullPosition = getPositionOfBlankItem(state); const newColPosition = nullPosition.col - 1; if(newColPosition >= 0){ @@ -62,9 +62,9 @@ function moveLeftOperation(state: State): State | null{ } -function getPositionOfNullItem(state: State){ +function getPositionOfBlankItem(state: State){ for (let line in state){ - let col = state[line].indexOf(null); + let col = state[line].indexOf(0); if (col > -1){ return new StateItemPosition(Number(line), Number(col)); } @@ -76,14 +76,14 @@ function changePositions(actualPosition: StateItemPosition, newPosition: StateIt const newState: State = cloneState(state); //TODO: Encontrar uma estratégia otimizada pra clonar o array do estado const aux = state[newPosition.line][newPosition.col]; - newState[newPosition.line][newPosition.col] = null; + newState[newPosition.line][newPosition.col] = 0; newState[actualPosition.line][actualPosition.col] = aux; return newState } function cloneState(state: State){ - let newState: State = [[null, null, null], [null, null, null], [null, null, null]]; + let newState: State = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; for (let l in state){ for (let c in state){ newState[l][c] = state[l][c]; @@ -92,4 +92,4 @@ function cloneState(state: State){ return newState; } -export { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } \ No newline at end of file +export { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfBlankItem } \ No newline at end of file diff --git a/src/utils/state.ts b/src/utils/state.ts index c42ab3b..e8c0b9a 100644 --- a/src/utils/state.ts +++ b/src/utils/state.ts @@ -1,4 +1,4 @@ -type StateItem = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | null; +type StateItem = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 0; type State = [[StateItem, StateItem, StateItem], [StateItem, StateItem, StateItem], [StateItem, StateItem, StateItem]]; diff --git a/tests/heuristic.spec.ts b/tests/heuristic.spec.ts index 19ebac6..849b3d1 100644 --- a/tests/heuristic.spec.ts +++ b/tests/heuristic.spec.ts @@ -9,8 +9,8 @@ describe('Heuristic Smoke Tests', () => { // the tests container }); it('should return a number when call calcHeuristicValue function', () => { - const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const gValue = 0; expect(calcHValue(initialState, goalState)).to.be.a('number'); }); @@ -20,7 +20,7 @@ describe('Heuristic Smoke Tests', () => { // the tests container }); it('should return a number when call calcDistanceOfItem function', () => { - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const item = 2; const itemPosition = new StateItemPosition(2, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.be.a('number'); @@ -29,22 +29,22 @@ describe('Heuristic Smoke Tests', () => { // the tests container describe('Testing returns of calcDistanceOfItem', () => { it('should return 2 when call calcDistanceOfItem', () => { - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const item: StateItem = 2; const itemPosition = new StateItemPosition(2, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(2); }); it('should return 1 when call calcDistanceOfItem', () => { - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const item: StateItem = 5; const itemPosition = new StateItemPosition(0, 1); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(1); }); it('should return 3 when call calcDistanceOfItem', () => { - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const item: StateItem = null; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const item: StateItem = 0; const itemPosition = new StateItemPosition(1, 0); expect(calcDistanceOfItem(item, itemPosition, goalState)).to.equal(3); }); @@ -52,40 +52,40 @@ describe('Testing returns of calcDistanceOfItem', () => { describe('Testing returns of calcHValue', () => { it('should return 14 when call calcHValue function', () => { - const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const gValue = 0; expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 15 when call calcHeuristicValue function', () => { - const initialState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[0,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 15 when call calcHeuristicValue function', () => { - const initialState: State = [[4,5,8], [7,1,6], [null, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,5,8], [7,1,6], [0, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(calcHValue(initialState, goalState)).to.equal(14); }); it('should return 13 when call calcHeuristicValue function', () => { - const initialState: State = [[4,5,8], [1,null,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,5,8], [1,0,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(calcHValue(initialState, goalState)).to.equal(12); }); it('should return 14 when call calcHeuristicValue function', () => { - const initialState: State = [[4,null,8], [1,5,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,0,8], [1,5,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(calcHValue(initialState, goalState)).to.equal(12); }); it('should return 12 when call calcHeuristicValue function', () => { - const initialState: State = [[4,5,8], [1,2,6], [7, null, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const initialState: State = [[4,5,8], [1,2,6], [7, 0, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(calcHValue(initialState, goalState)).to.equal(10); }); }) \ No newline at end of file diff --git a/tests/node.spec.ts b/tests/node.spec.ts index dad29b6..3440139 100644 --- a/tests/node.spec.ts +++ b/tests/node.spec.ts @@ -16,7 +16,7 @@ describe('Node Smoke Tests', () => { // the tests container }); it('should return an Array when call generateNodeList function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; const heuristicValue = new HeuristicValue(0, 14, 14); const node: NodeInfo = new NodeInfo(heuristicValue, operations.none, state); @@ -24,7 +24,7 @@ describe('Node Smoke Tests', () => { // the tests container }); it('should return a NodeInfo object when call generateNode function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; const gValue = 0; expect(generateNode(state, operations.none,state, gValue)).to.be.instanceOf(NodeInfo); }); @@ -33,8 +33,8 @@ describe('Node Smoke Tests', () => { // the tests container describe('Testing returns of generateNode function', () => { it('should return this NodeInfo obj when call generateNode function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const heuristicValue = new HeuristicValue(0, 14, 14); const expectedNode = new NodeInfo(heuristicValue, operations.none, state); @@ -43,8 +43,8 @@ describe('Testing returns of generateNode function', () => { }); it('should return this NodeInfo obj when call generateNode function', () => { - const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; - const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[4,5,8], [1,0,6], [7, 2, 3]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const heuristicValue = new HeuristicValue(1, 12, 13); const expectedNode = new NodeInfo(heuristicValue, operations.left, state); @@ -53,8 +53,8 @@ describe('Testing returns of generateNode function', () => { }); it('should return this NodeInfo obj when call generateNode function', () => { - const state: State = [[4,5,8], [1,2,6], [7, 3, null]]; - const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[4,5,8], [1,2,6], [7, 3, 0]]; + const finalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const heuristicValuePrevious = new HeuristicValue(0, 0, 0); const mockedPreviousNode = new NodeInfo(heuristicValuePrevious, operations.none, state); @@ -68,20 +68,20 @@ describe('Testing returns of generateNode function', () => { describe('Testing returns of generateNodeList function', () => { it('should return this NodeInfo array when call generateNodeList function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const heuristicValueRoot = new HeuristicValue(0, 14, 14); const rootNode = new NodeInfo(heuristicValueRoot, operations.none, state); - const stateChild1: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const stateChild1: State = [[0,5,8], [4,1,6], [7, 2, 3]]; const heuristicValue1 = new HeuristicValue(1, 14, 15); const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); - const stateChild2: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const stateChild2: State = [[4,5,8], [1,0,6], [7, 2, 3]]; const heuristicValue2 = new HeuristicValue(1, 12, 13); const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); - const stateChild3: State = [[4,5,8], [7,1,6], [null, 2, 3]]; + const stateChild3: State = [[4,5,8], [7,1,6], [0, 2, 3]]; const heuristicValue3 = new HeuristicValue(1, 14, 15); const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); @@ -91,24 +91,24 @@ describe('Testing returns of generateNodeList function', () => { }); it('should return this NodeInfo array when call generateNodeList function', () => { - const state: State = [[4,5,8], [1,null,6], [7, 2, 3]]; - const goalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[4,5,8], [1,0,6], [7, 2, 3]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const heuristicValueRoot = new HeuristicValue(1, 12, 13); const rootNode = new NodeInfo(heuristicValueRoot, operations.right, state); - const stateChild1: State = [[4,null,8], [1,5,6], [7, 2, 3]]; + const stateChild1: State = [[4,0,8], [1,5,6], [7, 2, 3]]; const heuristicValue1 = new HeuristicValue(2, 12, 14); const expectedChild1 = new NodeInfo(heuristicValue1, operations.up, stateChild1, rootNode); - const stateChild2: State = [[4,5,8], [1,6,null], [7, 2, 3]]; + const stateChild2: State = [[4,5,8], [1,6,0], [7, 2, 3]]; const heuristicValue2 = new HeuristicValue(2, 12, 14); const expectedChild2 = new NodeInfo(heuristicValue2, operations.right, stateChild2, rootNode); - const stateChild3: State = [[4,5,8], [1,2,6], [7, null, 3]]; + const stateChild3: State = [[4,5,8], [1,2,6], [7, 0, 3]]; const heuristicValue3 = new HeuristicValue(2, 10, 12); const expectedChild3 = new NodeInfo(heuristicValue3, operations.down, stateChild3, rootNode); - const stateChild4: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const stateChild4: State = [[4,5,8], [0,1,6], [7, 2, 3]]; const heuristicValue4 = new HeuristicValue(2, 14, 16); const expectedChild4 = new NodeInfo(heuristicValue4, operations.left, stateChild4, rootNode); diff --git a/tests/operations.spec.ts b/tests/operations.spec.ts index 2ba0d60..3c739fa 100644 --- a/tests/operations.spec.ts +++ b/tests/operations.spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfNullItem } from "../src/functions/operations"; +import { applyOperation, moveUpOperation, moveRightOperation, moveDownOperation, moveLeftOperation, getPositionOfBlankItem } from "../src/functions/operations"; import { State, StateItem } from "../src/utils/state"; import { operations } from '../src/utils/operations'; import StateItemPosition from '../src/classes/StateItemPosition'; @@ -25,84 +25,84 @@ describe('Operations Smoke Tests', () => { expect(moveLeftOperation).to.exist; }); - it('should exist getPositionOfNullItem function', () => { - expect(getPositionOfNullItem).to.exist; + it('should exist getPositionOfBlankItem function', () => { + expect(getPositionOfBlankItem).to.exist; }); it('should return an Array when call applyOperation function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; expect(applyOperation(state, operations.up)).to.be.an('array'); }); }); -describe('Testing returns of getPositionOfNullItem function', () => { +describe('Testing returns of getPositionOfBlankItem function', () => { - it('should return [1,0] when call getPositionOfNullItem function', () => { - const state: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + it('should return [1,0] when call getPositionOfBlankItem function', () => { + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; const expectedPosition = new StateItemPosition(1,0); - expect(getPositionOfNullItem(state)).to.eql(expectedPosition); + expect(getPositionOfBlankItem(state)).to.eql(expectedPosition); }); - it('should return [2,1] when call getPositionOfNullItem function', () => { - const state: State = [[4,5,8], [3,1,6], [7, null, 2]]; + it('should return [2,1] when call getPositionOfBlankItem function', () => { + const state: State = [[4,5,8], [3,1,6], [7, 0, 2]]; const expectedPosition = new StateItemPosition(2,1); - expect(getPositionOfNullItem(state)).to.eql(expectedPosition); + expect(getPositionOfBlankItem(state)).to.eql(expectedPosition); }); - it('should return [0,0] when call getPositionOfNullItem function', () => { - const state: State = [[null,5,8], [3,1,6], [7, 2, 4]]; + it('should return [0,0] when call getPositionOfBlankItem function', () => { + const state: State = [[0,5,8], [3,1,6], [7, 2, 4]]; const expectedPosition = new StateItemPosition(0,0); - expect(getPositionOfNullItem(state)).to.eql(expectedPosition); + expect(getPositionOfBlankItem(state)).to.eql(expectedPosition); }); }); describe('Testing returns of applyOperation function', () => { it('should return correct state when call applyOperation function when using movUp operation', () => { - const actualState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const goalState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const actualState: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const goalState: State = [[0,5,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.up)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movUp operation', () => { - const actualState: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const goalState: State = [[1,2,3], [4,5,null], [7, 8, 6]]; + const actualState: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const goalState: State = [[1,2,3], [4,5,0], [7, 8, 6]]; expect(applyOperation(actualState, operations.up)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movRight operation', () => { - const actualState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; - const goalState: State = [[4,5,8], [1,null,6], [7, 2, 3]]; + const actualState: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + const goalState: State = [[4,5,8], [1,0,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.right)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movRight operation', () => { - const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; - const goalState: State = [[5,null,8], [4,1,6], [7, 2, 3]]; + const actualState: State = [[0,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[5,0,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.right)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movDown operation', () => { - const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; - const goalState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; + const actualState: State = [[0,5,8], [4,1,6], [7, 2, 3]]; + const goalState: State = [[4,5,8], [0,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.down)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movDown operation', () => { - const actualState: State = [[1,2,3], [4,null,6], [7, 5, 8]]; - const goalState: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const actualState: State = [[1,2,3], [4,0,6], [7, 5, 8]]; + const goalState: State = [[1,2,3], [4,5,6], [7, 0, 8]]; expect(applyOperation(actualState, operations.down)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movLeft operation', () => { - const actualState: State = [[1,2,3], [4,null,6], [7, 5, 8]]; - const goalState: State = [[1,2,3], [null,4,6], [7, 5, 8]]; + const actualState: State = [[1,2,3], [4,0,6], [7, 5, 8]]; + const goalState: State = [[1,2,3], [0,4,6], [7, 5, 8]]; expect(applyOperation(actualState, operations.left)).to.eql(goalState); }); it('should return correct state when call applyOperation function when using movLeft operation', () => { - const actualState: State = [[5,8,null], [4,1,6], [7, 2, 3]]; - const goalState: State = [[5,null,8], [4,1,6], [7, 2, 3]]; + const actualState: State = [[5,8,0], [4,1,6], [7, 2, 3]]; + const goalState: State = [[5,0,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.left)).to.eql(goalState); }); }); @@ -110,25 +110,25 @@ describe('Testing returns of applyOperation function', () => { describe('Testing returns of applyOperation function when operation cannot be applied', () => { it('should return null when call applyOperation function using movUp operation', () => { - const actualState: State = [[null,5,8], [4,1,6], [7, 2, 3]]; + const actualState: State = [[0,5,8], [4,1,6], [7, 2, 3]]; expect(applyOperation(actualState, operations.up)).to.eql(null); }); it('should return null when call applyOperation function using movRight operation', () => { - const actualState: State = [[5,8,6], [4,1,null], [7, 2, 3]]; + const actualState: State = [[5,8,6], [4,1,0], [7, 2, 3]]; expect(applyOperation(actualState, operations.right)).to.eql(null); }); it('should return null when call applyOperation function using movDown operation', () => { - const actualState: State = [[5,8,6], [4,1,3], [7, null, 2]]; + const actualState: State = [[5,8,6], [4,1,3], [7, 0, 2]]; expect(applyOperation(actualState, operations.down)).to.eql(null); }); it('should return null when call applyOperation function using movLeft operation', () => { - const actualState: State = [[5,8,6], [null,4,1], [7, 3, 2]]; + const actualState: State = [[5,8,6], [0,4,1], [7, 3, 2]]; expect(applyOperation(actualState, operations.left)).to.eql(null); }); diff --git a/tests/state.spec.ts b/tests/state.spec.ts index c9d2a87..60bf704 100644 --- a/tests/state.spec.ts +++ b/tests/state.spec.ts @@ -8,8 +8,8 @@ describe('State Smoke Tests', () => { }); it('Should return boolean when call areEqual function', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(areEqual(state1, state2)).to.be.a('Boolean'); }); @@ -18,7 +18,7 @@ describe('State Smoke Tests', () => { }); it('Should return boolean when call includes function', () => { - const state: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const list: State[] = [state]; expect(includes(state, list)).to.be.a('Boolean'); }); @@ -26,25 +26,25 @@ describe('State Smoke Tests', () => { describe('Testing returns of areEqual function', () => { it('Should return true', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 8, 0]]; expect(areEqual(state1, state2)).to.eql(true); }); it('Should return false', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 0, 8]]; expect(areEqual(state1, state2)).to.eql(false); }); it('Should return true', () => { - const state1: State = [[4,5,3], [2,1,6], [7, null, 8]]; - const state2: State = [[4,5,3], [2,1,6], [7, null, 8]]; + const state1: State = [[4,5,3], [2,1,6], [7, 0, 8]]; + const state2: State = [[4,5,3], [2,1,6], [7, 0, 8]]; expect(areEqual(state1, state2)).to.eql(true); }); it('Should return false', () => { - const state1: State = [[4,5,3], [null,5,6], [2, 7, 8]]; + const state1: State = [[4,5,3], [0,5,6], [2, 7, 8]]; const state2: State = [[4,1,3], [2,1,6], [7, 7, 8]]; expect(areEqual(state1, state2)).to.eql(false); }); @@ -53,21 +53,21 @@ describe('Testing returns of areEqual function', () => { describe('Testing returns of includes function', () => { it('Should return true', () => { - const state: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const list: State[] = [state]; expect(includes(state, list)).to.eql(true); }); it('Should return false', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 0, 8]]; const list: State[] = [state1]; expect(includes(state2, list)).to.eql(false); }); it('Should return true', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 0, 8]]; const list: State[] = []; list.push(state1); list.push(state2); @@ -75,9 +75,9 @@ describe('Testing returns of includes function', () => { }); it('Should return false', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state2: State = [[1,2,3], [4,5,6], [7, null, 8]]; - const state3: State = [[1,2,5], [3,4,6], [7, null, 8]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state2: State = [[1,2,3], [4,5,6], [7, 0, 8]]; + const state3: State = [[1,2,5], [3,4,6], [7, 0, 8]]; const list: State[] = []; list.push(state1); list.push(state2); @@ -85,14 +85,14 @@ describe('Testing returns of includes function', () => { }); it('Should return false', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const list: State[] = []; expect(includes(state1, list)).to.eql(false); }); it('Should return true', () => { - const state1: State = [[1,2,3], [4,5,6], [7, 8, null]]; - const state1Copy: State = [[1,2,3], [4,5,6], [7, 8, null]]; + const state1: State = [[1,2,3], [4,5,6], [7, 8, 0]]; + const state1Copy: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const list: State[] = []; list.push(state1); expect(includes(state1Copy, list)).to.eql(true); From c05d29c6f2b29e46cd36230b979480245c723d24 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 19:04:37 -0300 Subject: [PATCH 34/47] Update state functions with tests (Add isSolvable function) --- src/functions/state.ts | 34 ++++++++++++++++++++++++++-- tests/state.spec.ts | 51 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/src/functions/state.ts b/src/functions/state.ts index c298600..e42e2e0 100644 --- a/src/functions/state.ts +++ b/src/functions/state.ts @@ -1,4 +1,4 @@ -import { State } from "../utils/state"; +import { State, StateItem } from "../utils/state"; // Using this function because literal comparison between 2 types (state1 == state2) always return false @@ -25,6 +25,36 @@ function includes(state: State, list: State[]){ return false; } +function isSolvable(state: State){ + return quantityOfInversions(state) % 2 === 0; +} + +function quantityOfInversions(state: State): number{ + const stateList = convertStateInArray(state); + let inversions = 0; + for(let i in stateList){ + for (let j = Number(i)+1; j < stateList.length; j ++){ + if(stateList[i] > stateList[j]){ + inversions++; + } + } + } + return inversions; +} + +//TODO: Melhorar a forma de fazer isso +function convertStateInArray(state: State): StateItem[]{ + let stateList: StateItem[] = []; + for(let l in state){ + for (let c in state[l]){ + if(state[l][c] !== 0){// Do not consider 0 when counting inversions + stateList.push(state[l][c]); + } + } + } + return stateList; +} + function readState(state: State){ console.log('---------'); for(let l of state){ @@ -33,4 +63,4 @@ function readState(state: State){ console.log('---------'); } -export { areEqual, includes, readState } \ No newline at end of file +export { areEqual, includes, readState, isSolvable } \ No newline at end of file diff --git a/tests/state.spec.ts b/tests/state.spec.ts index 60bf704..4b45f3a 100644 --- a/tests/state.spec.ts +++ b/tests/state.spec.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { areEqual, includes } from '../src/functions/state'; +import { areEqual, includes, isSolvable } from '../src/functions/state'; import { State } from '../src/utils/state'; describe('State Smoke Tests', () => { @@ -16,12 +16,21 @@ describe('State Smoke Tests', () => { it('Should exist includes function', () => { expect(includes).to.exist; }); - + it('Should return boolean when call includes function', () => { const state: State = [[1,2,3], [4,5,6], [7, 8, 0]]; const list: State[] = [state]; expect(includes(state, list)).to.be.a('Boolean'); }); + + it('Should exist isSolvable function', () => { + expect(isSolvable).to.exist; + }); + + it('Should return boolean when call isSolvable function', () => { + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + expect(isSolvable(state)).to.be.a('Boolean'); + }); }); describe('Testing returns of areEqual function', () => { @@ -97,4 +106,42 @@ describe('Testing returns of includes function', () => { list.push(state1); expect(includes(state1Copy, list)).to.eql(true); }); +}); + +describe('Testing returns of isSolvable function', () => { + it('should return false using this state', () => { + const state: State = [[4,5,8], [0,1,6], [7, 2, 3]]; + expect(isSolvable(state)).to.eql(false); + }); + + it('should return true using this state', () => { + const state: State = [[1,8,2], [0,4,3], [7, 6, 5]]; + expect(isSolvable(state)).to.eql(true); + }); + + it('should return false using this state', () => { + const state: State = [[8,1,2], [0,4,3], [7, 6, 5]]; + expect(isSolvable(state)).to.eql(false); + }); + + it('should return false using this state', () => { + const state: State = [[1,2,3], [4,5,6], [8, 7, 0]]; + expect(isSolvable(state)).to.eql(false); + }); + + it('should return true using this state', () => { + const state: State = [[8,4,2], [0,1,3], [7, 6, 5]]; + expect(isSolvable(state)).to.eql(true); + }); + + it('should return true using this state', () => { + const state: State = [[8,7,0], [4,1,3], [2, 6, 5]]; + expect(isSolvable(state)).to.eql(true); + }); + + it('should return false using this state', () => { + const state: State = [[8,4,0], [7,1,3], [2, 6, 5]]; + expect(isSolvable(state)).to.eql(false); + }); + }); \ No newline at end of file From 4ea71c107087c1bbec5ff759af49cb19f1d935e7 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 19:16:09 -0300 Subject: [PATCH 35/47] Add frontier type --- src/utils/frontier.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/utils/frontier.ts diff --git a/src/utils/frontier.ts b/src/utils/frontier.ts new file mode 100644 index 0000000..47e2337 --- /dev/null +++ b/src/utils/frontier.ts @@ -0,0 +1,3 @@ +import { NodeInfo } from "../classes/Node"; + +export type Frontier = NodeInfo[]; \ No newline at end of file From 3c8643977776e53e4336326b5b0a4d93ad13cf6e Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 19:16:58 -0300 Subject: [PATCH 36/47] Update index (change run function name) --- src/index.ts | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/index.ts b/src/index.ts index a7d30b1..518a1bc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,35 +2,46 @@ import { operations } from './utils/operations'; import { State } from "./utils/state"; import { NodeInfo } from "./classes/Node"; import { generateNodeList, generateNode, readNode } from './functions/node'; -import { areEqual, includes } from './functions/state'; +import { areEqual, includes, isSolvable } from './functions/state'; +import { Frontier } from './utils/frontier'; -// const initialState: State = [[4,5,8], [null,1,6], [7, 2, 3]]; -const initialState: State = [[1,2,3], [5,4,6], [7, null, 8]]; -const finalState: State = [[1,2,3], [4,5,6], [7, 8, null]]; +const initialState: State = [ + [8,4,0], + [7,1,3], + [2, 6, 5] +]; +const finalState: State = [ + [1,2,3], + [4,5,6], + [7, 8,0] +]; const firstNode = generateNode(initialState, operations.none, finalState, 0); -let frontier: NodeInfo[] = [firstNode]; +let frontier: Frontier = [firstNode]; let expandedStates: State[] = []; -const finalNode = run(finalState, frontier, expandedStates); +console.time('run'); +const finalNode = runAStar(finalState, frontier, expandedStates); if(finalNode){ readNode(finalNode); } -function run(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ +function runAStar(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ let actualNode = frontier.shift(); if(actualNode){ while(!areEqual(actualNode.state, goalState)){ const children = generateNodeList(actualNode, goalState); for (let c of children){ - if(!includes(c.state, expandedStates)){//Only add to frontier states not openned yet - frontier.push(c); + if(!includes(c.state, expandedStates)){ //Only add to frontier states not openned yet + if(isSolvable(c.state)){ //Only add to frontier solvable states + frontier.push(c); + } expandedStates.push(actualNode.state); } } - frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.h < b.evaluationFunctionValue.h) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes + frontier.sort((a, b) => (a.evaluationFunctionValue.f < b.evaluationFunctionValue.f) ? -1 : ((a.evaluationFunctionValue.f === b.evaluationFunctionValue.f) ? ((a.evaluationFunctionValue.h < b.evaluationFunctionValue.h) ? -1 : 1): 1)); // Order frontier according to heuristic value of nodes const aux = frontier.shift(); if(aux){ From a692e3ad6c729869ff00bf0c59b823fd69237edd Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 19:22:34 -0300 Subject: [PATCH 37/47] Update index (move code to functions) --- src/index.ts | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/index.ts b/src/index.ts index 518a1bc..30f07e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,29 +5,20 @@ import { generateNodeList, generateNode, readNode } from './functions/node'; import { areEqual, includes, isSolvable } from './functions/state'; import { Frontier } from './utils/frontier'; -const initialState: State = [ - [8,4,0], - [7,1,3], - [2, 6, 5] -]; -const finalState: State = [ - [1,2,3], - [4,5,6], - [7, 8,0] -]; - -const firstNode = generateNode(initialState, operations.none, finalState, 0); - -let frontier: Frontier = [firstNode]; -let expandedStates: State[] = []; - -console.time('run'); -const finalNode = runAStar(finalState, frontier, expandedStates); -if(finalNode){ - readNode(finalNode); +function AStar(initialState: State, finalState?: State){ + const goalState: State = finalState ? finalState : [[1,2,3],[4,5,6],[7, 8,0]]; + if(isSolvable(initialState)){ + const firstNode = generateNode(initialState, operations.none, goalState, 0); + let frontier: Frontier = [firstNode]; + let expandedStates: State[] = []; + + const finalNode = runAStarLoop(goalState, frontier, expandedStates); + }else{ + throw new Error('Initial state is not solvable'); + } } -function runAStar(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ +function runAStarLoop(goalState: State, frontier: NodeInfo[], expandedStates: State[]){ let actualNode = frontier.shift(); if(actualNode){ while(!areEqual(actualNode.state, goalState)){ From d77e250e383ba2e045ce15ebd8696ebd1ffdc582 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 19:53:52 -0300 Subject: [PATCH 38/47] Add webpack (generating lib) --- lib/a-star-puzzle-solver.umd.js | 1 + package-lock.json | 3530 ++++++++++++++++++++++++++++++- package.json | 16 +- src/index.ts | 4 +- webpack.config.js | 12 + 5 files changed, 3464 insertions(+), 99 deletions(-) create mode 100644 lib/a-star-puzzle-solver.umd.js create mode 100644 webpack.config.js diff --git a/lib/a-star-puzzle-solver.umd.js b/lib/a-star-puzzle-solver.umd.js new file mode 100644 index 0000000..d837ff6 --- /dev/null +++ b/lib/a-star-puzzle-solver.umd.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AStarPuzzleSolver=t():e.AStarPuzzleSolver=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operations=void 0,function(e){e.up="UP_OPERATION",e.right="RIGHT_OPERATION",e.down="DOWN_OPERATION",e.left="LEFT_OPERATION",e.none="NONE"}(t.operations||(t.operations={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){this.line=e,this.col=t};t.default=o},function(e,t,n){"use strict";function o(e,t){for(var n in e)for(var o in e)if(e[n][o]!=t[n][o])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isSolvable=t.readState=t.includes=t.areEqual=void 0,t.areEqual=o,t.includes=function(e,t){for(var n=0,r=t;nt[r]&&n++;return n}(e)%2==0},t.readState=function(e){console.log("---------");for(var t=0,n=e;tr.evaluationFunctionValue.h&&r.evaluationFunctionValue.f>f.f&&(f.f=r.evaluationFunctionValue.f),new u.NodeInfo(f,t,e,r)}t.generateNodeList=function(e,t){var n=[],o=c(r.operations.up,e,t,e.evaluationFunctionValue.g);o&&n.push(o);var u=c(r.operations.right,e,t,e.evaluationFunctionValue.g);u&&n.push(u);var i=c(r.operations.down,e,t,e.evaluationFunctionValue.g);i&&n.push(i);var a=c(r.operations.left,e,t,e.evaluationFunctionValue.g);return a&&n.push(a),n},t.generateNode=s,t.readNode=function e(t){return f.readState(t.state),t.previousNode?e(t.previousNode):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeInfo=void 0;var o=function(e,t,n,o){this.evaluationFunctionValue=e,this.operation=t,this.state=n,this.previousNode=o};t.NodeInfo=o},function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcDistanceOfItem=t.calcHValue=void 0;var r=o(n(1));function u(e,t,n){for(var o in n){var r=n[o].indexOf(e);if(r>-1)return Math.abs(t.line-Number(o))+Math.abs(t.col-r)}return 10}t.calcHValue=function(e,t){var n=0;for(var o in e)for(var i in e[o]){var a=new r.default(Number(o),Number(i));n+=u(e[o][i],a,t)}return n},t.calcDistanceOfItem=u},function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPositionOfBlankItem=t.moveLeftOperation=t.moveDownOperation=t.moveRightOperation=t.moveUpOperation=t.applyOperation=void 0;var r=n(0),u=o(n(1));function i(e){var t=c(e),n=t.line-1;return n>=0?s(t,new u.default(n,t.col),e):null}function a(e){var t=c(e),n=t.col+1;return n<=2?s(t,new u.default(t.line,n),e):null}function l(e){var t=c(e),n=t.line+1;return n<=2?s(t,new u.default(n,t.col),e):null}function f(e){var t=c(e),n=t.col-1;return n>=0?s(t,new u.default(t.line,n),e):null}function c(e){for(var t in e){var n=e[t].indexOf(0);if(n>-1)return new u.default(Number(t),Number(n))}throw new Error("Error: null item not found on state")}function s(e,t,n){var o=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];for(var n in e)for(var o in e)t[n][o]=e[n][o];return t}(n),r=n[t.line][t.col];return o[t.line][t.col]=0,o[e.line][e.col]=r,o}t.applyOperation=function(e,t){switch(t){case r.operations.up:return i(e);case r.operations.right:return a(e);case r.operations.down:return l(e);case r.operations.left:return f(e)}},t.moveUpOperation=i,t.moveRightOperation=a,t.moveDownOperation=l,t.moveLeftOperation=f,t.getPositionOfBlankItem=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t,n){this.g=e,this.h=t,this.f=n};t.default=o}])})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0caf656..9e9a10e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,12 +37,229 @@ "integrity": "sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==", "dev": true }, + "@webassemblyjs/ast": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", + "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz", + "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz", + "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz", + "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz", + "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz", + "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz", + "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz", + "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz", + "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz", + "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz", + "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz", + "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz", + "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/helper-wasm-section": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-opt": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz", + "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz", + "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz", + "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz", + "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/floating-point-hex-parser": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-code-frame": "1.9.0", + "@webassemblyjs/helper-fsm": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz", + "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "dev": true + }, + "ajv": { + "version": "6.12.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", + "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", + "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", + "dev": true + }, + "ajv-keywords": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.0.tgz", + "integrity": "sha512-eyoaac3btgU8eJlvh01En8OCKzRqlLe2G5jDsCr3RiE2uLGMEEB1aaGwVVpwR8M95956tGH6R+9edC++OvzaVw==", + "dev": true + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", @@ -97,6 +314,12 @@ "picomatch": "^2.0.4" } }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -112,6 +335,30 @@ "sprintf-js": "~1.0.2" } }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, "array.prototype.map": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", @@ -124,24 +371,168 @@ "is-string": "^1.0.4" } }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true, + "optional": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, "binary-extensions": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "bn.js": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.2.tgz", + "integrity": "sha512-40rZaf3bUNKTVYu9sIeeEGOg7g14Yvnj9kH7b50EiwX0Q7A6umbvfI5tvHaOERH0XigqKkfLkFQxzb4e6CIXnA==", + "dev": true + }, "boxen": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", @@ -177,18 +568,206 @@ "fill-range": "^7.0.1" } }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, "browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "browserify-sign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.0.tgz", + "integrity": "sha512-hEZC1KEeYuoHRqhGhTy6gWrpJA3ZDjFWv0DE61643ZnOXAKJb3u7yWcrU0mMc9SwAqK1n7myPGndkp0dFG7NFA==", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.2", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cacache": { + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -290,12 +869,60 @@ "readdirp": "~3.4.0" } }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, "cli-boxes": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", @@ -335,6 +962,16 @@ "mimic-response": "^1.0.0" } }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -350,12 +987,42 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, "configstore": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", @@ -370,12 +1037,155 @@ "xdg-basedir": "^4.0.0" } }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, "crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "cyclist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", + "dev": true + }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -391,6 +1201,12 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -430,12 +1246,94 @@ "object-keys": "^1.0.12" } }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, "dot-prop": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", @@ -451,12 +1349,53 @@ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, + "duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "elliptic": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -466,6 +1405,26 @@ "once": "^1.4.0" } }, + "enhanced-resolve": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.2.0.tgz", + "integrity": "sha512-S7eiFb/erugyd1rLb6mQ3Vuq+EXHv5cpCkNqqIkYkBgN2QdFnyCZzFBleqwGEx4lgNGYij81BWnCrFNK7vxvjQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, "es-abstract": { "version": "1.17.6", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", @@ -529,12 +1488,216 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "events": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", + "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "figgy-pudding": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -544,6 +1707,29 @@ "to-regex-range": "^5.0.1" } }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "dependencies": { + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + } + } + }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -554,6 +1740,18 @@ "path-exists": "^4.0.0" } }, + "findup-sync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", + "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + } + }, "flat": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", @@ -563,12 +1761,59 @@ "is-buffer": "~2.0.3" } }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, + "flush-write-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", + "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "fsevents": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", @@ -603,6 +1848,12 @@ "pump": "^3.0.0" } }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -635,6 +1886,61 @@ "ini": "^1.3.5" } }, + "global-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz", + "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==", + "dev": true, + "requires": { + "global-prefix": "^3.0.0" + }, + "dependencies": { + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -687,24 +1993,160 @@ "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "has-yarn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "dev": true }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, "ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -717,12 +2159,28 @@ "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", "dev": true }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -745,6 +2203,38 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "is-arguments": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", @@ -781,12 +2271,63 @@ "ci-info": "^2.0.0" } }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "is-date-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -848,6 +2389,15 @@ "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", "dev": true }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, "is-regex": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", @@ -884,6 +2434,18 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, "is-yarn-global": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", @@ -902,6 +2464,12 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, "iterate-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", @@ -934,6 +2502,27 @@ "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", "dev": true }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -943,6 +2532,12 @@ "json-buffer": "3.0.0" } }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, "latest-version": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", @@ -952,6 +2547,23 @@ "package-json": "^6.3.0" } }, + "loader-runner": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", + "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==", + "dev": true + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -1019,6 +2631,15 @@ "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "dev": true }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -1042,62 +2663,287 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", "dev": true }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, "requires": { - "brace-expansion": "^1.1.7" + "object-visit": "^1.0.0" } }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } }, - "mocha": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", - "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", + "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", "dev": true, "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.3.1", - "debug": "3.2.6", - "diff": "4.0.2", - "escape-string-regexp": "1.0.5", - "find-up": "4.1.0", - "glob": "7.1.6", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", - "minimatch": "3.0.4", - "ms": "2.1.2", - "object.assign": "4.1.0", - "promise.allsettled": "1.0.2", - "serialize-javascript": "3.0.0", - "strip-json-comments": "3.0.1", - "supports-color": "7.1.0", - "which": "2.0.2", - "wide-align": "1.1.3", - "workerpool": "6.0.0", - "yargs": "13.3.2", - "yargs-parser": "13.1.2", - "yargs-unparser": "1.6.0" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" }, "dependencies": { - "chokidar": { - "version": "3.3.1", + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "mocha": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", + "dev": true, + "requires": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.3.1", + "debug": "3.2.6", + "diff": "4.0.2", + "escape-string-regexp": "1.0.5", + "find-up": "4.1.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", + "minimatch": "3.0.4", + "ms": "2.1.2", + "object.assign": "4.1.0", + "promise.allsettled": "1.0.2", + "serialize-javascript": "3.0.0", + "strip-json-comments": "3.0.1", + "supports-color": "7.1.0", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.0.0", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" + }, + "dependencies": { + "chokidar": { + "version": "3.3.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", "dev": true, @@ -1144,12 +2990,107 @@ } } }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-libs-browser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", + "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, "nodemon": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.4.tgz", @@ -1189,6 +3130,49 @@ "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "dev": true }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", @@ -1201,6 +3185,15 @@ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, "object.assign": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", @@ -1213,6 +3206,15 @@ "object-keys": "^1.0.11" } }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1222,6 +3224,12 @@ "wrappy": "1" } }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -1272,6 +3280,62 @@ } } }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, + "parallel-transform": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", + "dev": true, + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true, + "optional": true + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1284,43 +3348,165 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "pbkdf2": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", + "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, - "promise.allsettled": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", - "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", "dev": true, "requires": { - "array.prototype.map": "^1.0.1", - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "iterate-value": "^1.0.0" + "find-up": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } } }, - "pstree.remy": { + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "promise.allsettled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", + "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "dev": true, + "requires": { + "array.prototype.map": "^1.0.1", + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "iterate-value": "^1.0.0" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pstree.remy": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", "dev": true }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -1331,6 +3517,35 @@ "once": "^1.3.1" } }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "pupa": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz", @@ -1340,6 +3555,37 @@ "escape-goat": "^2.0.0" } }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -1352,6 +3598,29 @@ "strip-json-comments": "~2.0.1" } }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, "readdirp": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", @@ -1361,6 +3630,16 @@ "picomatch": "^2.2.1" } }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, "registry-auth-token": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", @@ -1379,6 +3658,25 @@ "rc": "^1.2.8" } }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true, + "optional": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -1391,6 +3689,50 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "dependencies": { + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + } + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -1400,6 +3742,66 @@ "lowercase-keys": "^1.0.0" } }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -1435,18 +3837,225 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, "source-map-support": { "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", @@ -1457,12 +4066,96 @@ "source-map": "^0.6.0" } }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", + "dev": true + }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", @@ -1513,52 +4206,169 @@ "es-abstract": "^1.17.5" } }, - "string.prototype.trimstart": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", - "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", + "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", + "dev": true + }, + "term-size": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", + "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", + "dev": true + }, + "terser": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", + "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + } + }, + "terser-webpack-plugin": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.4.tgz", + "integrity": "sha512-U4mACBHIegmfoEe5fdongHESNJWqsGU+W0S/9+BmYGVQDw1+c2Ow05TpMhxjPK1sRb7cuYq1BPl1e5YHJMTCqA==", + "dev": true, + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^3.1.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + }, + "dependencies": { + "serialize-javascript": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.1.0.tgz", + "integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + } + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "dev": true, "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" } }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "timers-browserify": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", + "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "setimmediate": "^1.0.4" } }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", "dev": true }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, "requires": { - "has-flag": "^3.0.0" + "kind-of": "^3.0.2" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } } }, - "term-size": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", - "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", - "dev": true - }, "to-readable-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", "dev": true }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1590,6 +4400,18 @@ "yn": "3.1.1" } }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "dev": true + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -1602,6 +4424,12 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -1643,6 +4471,36 @@ } } }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, "unique-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", @@ -1652,6 +4510,59 @@ "crypto-random-string": "^2.0.0" } }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true, + "optional": true + }, "update-notifier": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz", @@ -1673,6 +4584,39 @@ "xdg-basedir": "^4.0.0" } }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, "url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -1682,6 +4626,383 @@ "prepend-http": "^2.0.0" } }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8-compile-cache": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", + "dev": true + }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true + }, + "watchpack": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz", + "integrity": "sha512-ymVbbQP40MFTp+cNMvpyBpBtygHnPzPkHqoIwRRj/0B8KhqQwV8LaKjtbaxF2lK4vl8zN9wCxS46IFCU5K4W0g==", + "dev": true, + "requires": { + "chokidar": "^3.4.0", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0", + "watchpack-chokidar2": "^2.0.0" + } + }, + "watchpack-chokidar2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.0.tgz", + "integrity": "sha512-9TyfOyN/zLUbA288wZ8IsMZ+6cbzvsNyEzSBp6e/zkifi6xxbl8SmQ/CxQq32k8NNqrdVEVUVSEf56L4rQ/ZxA==", + "dev": true, + "optional": true, + "requires": { + "chokidar": "^2.1.8" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "optional": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "optional": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true, + "optional": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "optional": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "optional": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "optional": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, + "optional": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "optional": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "optional": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "webpack": { + "version": "4.43.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.43.0.tgz", + "integrity": "sha512-GW1LjnPipFW2Y78OOab8NJlCflB7EFskMih2AHdvjbpKMeDJqEgSx24cXXXiPS65+WSwVyxtDsJH6jGX2czy+g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/wasm-edit": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "acorn": "^6.4.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.1.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.3", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.3", + "watchpack": "^1.6.1", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + } + } + }, + "webpack-cli": { + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.12.tgz", + "integrity": "sha512-NVWBaz9k839ZH/sinurM+HcDvJOTXwSjYp1ku+5XKeOC03z8v5QitnK/x+lAxGXFyhdayoIf/GOpv85z3/xPag==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "cross-spawn": "^6.0.5", + "enhanced-resolve": "^4.1.1", + "findup-sync": "^3.0.0", + "global-modules": "^2.0.0", + "import-local": "^2.0.0", + "interpret": "^1.4.0", + "loader-utils": "^1.4.0", + "supports-color": "^6.1.0", + "v8-compile-cache": "^2.1.1", + "yargs": "^13.3.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "webpack-sources": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1742,6 +5063,15 @@ "string-width": "^4.0.0" } }, + "worker-farm": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", + "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, "workerpool": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", @@ -1820,12 +5150,24 @@ "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, "y18n": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "yargs": { "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", diff --git a/package.json b/package.json index 03048ef..65ef7ff 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "a-star-typescript", + "name": "a-star-puzzle-solver-typescript", "version": "0.0.1", - "description": "A* search algorithm in TypeScript", + "description": "A* search algorithm in TypeScript that solves puzzle game problem", "main": "dist/index.js", "dependencies": {}, "devDependencies": { @@ -10,13 +10,21 @@ "chai": "^4.2.0", "mocha": "^8.0.1", "nodemon": "^2.0.4", + "rimraf": "^3.0.2", "ts-node": "^8.10.2", - "typescript": "^3.9.6" + "typescript": "^3.9.6", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.12" }, "scripts": { + "clear": "rimraf lib", + "create:lib": "node_modules/.bin/webpack --output-filename a-star-puzzle-solver.umd.js", + "build": "npm run clear && npm run create:lib", + "build:w": "npm run build -- --watch", "start:ts": "tsc --watch", "start:js": "nodemon ./dist/index.js", - "test": "mocha --require ts-node/register --extensions ts,tsx --watch --watch-files src 'tests/**/*.{ts,tsx}'" + "test": "mocha --require ts-node/register --extensions ts,tsx --watch-files src 'tests/**/*.{ts,tsx}'", + "test:tdd": "npm test -- --watch" }, "author": "Alexandre Kavalerski", "license": "MIT" diff --git a/src/index.ts b/src/index.ts index 30f07e6..761d232 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,4 +43,6 @@ function runAStarLoop(goalState: State, frontier: NodeInfo[], expandedStates: St } return actualNode; } -} \ No newline at end of file +} + +export {AStar as solvePuzzle} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..fac47ec --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,12 @@ +var join = require("path").join; + +module.exports = { + entry: "./dist/index.js", + mode: "production", + output: { + path: join(__dirname, "lib"), + filename: "a-star-puzzle-solver.js", + libraryTarget: "umd", + library: "AStarPuzzleSolver", + }, +}; From 1315c86a9a8794a11a9580a6ceef641789801a3b Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 20:33:11 -0300 Subject: [PATCH 39/47] Add README file --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1edbade --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# A Star Puzzle Solver + +A TypeScript lib that solves Puzzle Game problem using the A* Algorithm + +## Installation + +Use the package manager [npm](https://www.npmjs.com/) to install A* Puzzle Solver. + +```bash +npm install a-star-puzzle-solver-ts +``` + +## How to use + +### ES6 + +```js +import AStarPuzzleSolver from 'a-star-puzzle-solver'; + +const solution = AStarPuzzleSolver.solvePuzzle(state); +``` + +### CommonJS + +```js +const AStar = require('a-star-puzzle-solver').default; + +AStar.solvePuzzle(state); +``` + +### UMD in Browser + +```html + + + + + +``` + +After that the library will be available to the Global as `AStarPuzzleSolver`. Follow an example: + +```js + +const aStar = AStarPuzzleSolver; + +const solution = aStar.solvePuzzle(state); +``` + + +## Contributing +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +Please make sure to update tests as appropriate. + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details \ No newline at end of file From a7f6e57adab1dfdef2276f773bffacf7b4551d4d Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 20:33:24 -0300 Subject: [PATCH 40/47] Update license file --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index eca0e90..4ff0f43 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright 2018 Alexandre Kavalerski +Copyright 2020 Alexandre Kavalerski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From a29265f4495a832a4d6d5da730c4c5ab7e807ec9 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 20:33:53 -0300 Subject: [PATCH 41/47] Update package file --- package.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 65ef7ff..48228d0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "a-star-puzzle-solver-typescript", + "name": "a-star-puzzle-solver", "version": "0.0.1", "description": "A* search algorithm in TypeScript that solves puzzle game problem", "main": "dist/index.js", @@ -18,7 +18,9 @@ }, "scripts": { "clear": "rimraf lib", - "create:lib": "node_modules/.bin/webpack --output-filename a-star-puzzle-solver.umd.js", + "create:lib-normal": "node_modules/.bin/webpack --output-filename a-star-puzzle-solver.umd.js", + "create:lib-min": "node_modules/.bin/webpack --output-filename a-star-puzzle-solver.umd.min.js -p", + "create:lib": "npm run create:lib-normal && npm run create:lib-min", "build": "npm run clear && npm run create:lib", "build:w": "npm run build -- --watch", "start:ts": "tsc --watch", @@ -26,6 +28,14 @@ "test": "mocha --require ts-node/register --extensions ts,tsx --watch-files src 'tests/**/*.{ts,tsx}'", "test:tdd": "npm test -- --watch" }, - "author": "Alexandre Kavalerski", - "license": "MIT" + "repository": { + "type": "git", + "url": "git+https://github.com/AlexandreKavalerski/a-star-typescript.git" + }, + "author": "Alexandre Kavalerski ", + "license": "MIT", + "bugs": { + "url": "https://github.com/AlexandreKavalerski/a-star-typescript/issues" + }, + "homepage": "https://github.com/AlexandreKavalerski/a-star-typescript#readme" } From fac9b6c66a4b3f8f3bccb9e5e8f359cb715ab911 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 20:34:12 -0300 Subject: [PATCH 42/47] Update index file --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 761d232..69824a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ function AStar(initialState: State, finalState?: State){ let expandedStates: State[] = []; const finalNode = runAStarLoop(goalState, frontier, expandedStates); + return finalNode; }else{ throw new Error('Initial state is not solvable'); } From bfbca6a21f8cfd97673c2f200db7a2243d07ef50 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 20:35:00 -0300 Subject: [PATCH 43/47] Bump version 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48228d0..516ce30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "a-star-puzzle-solver", - "version": "0.0.1", + "version": "1.0.0", "description": "A* search algorithm in TypeScript that solves puzzle game problem", "main": "dist/index.js", "dependencies": {}, From 4543a144a8dbc8a1576417112c3b88c8d34d6559 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 21:16:04 -0300 Subject: [PATCH 44/47] Update package (add files included on lib) --- lib/a-star-puzzle-solver.umd.js | 2 +- lib/a-star-puzzle-solver.umd.min.js | 1 + package.json | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 lib/a-star-puzzle-solver.umd.min.js diff --git a/lib/a-star-puzzle-solver.umd.js b/lib/a-star-puzzle-solver.umd.js index d837ff6..4083775 100644 --- a/lib/a-star-puzzle-solver.umd.js +++ b/lib/a-star-puzzle-solver.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AStarPuzzleSolver=t():e.AStarPuzzleSolver=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operations=void 0,function(e){e.up="UP_OPERATION",e.right="RIGHT_OPERATION",e.down="DOWN_OPERATION",e.left="LEFT_OPERATION",e.none="NONE"}(t.operations||(t.operations={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){this.line=e,this.col=t};t.default=o},function(e,t,n){"use strict";function o(e,t){for(var n in e)for(var o in e)if(e[n][o]!=t[n][o])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isSolvable=t.readState=t.includes=t.areEqual=void 0,t.areEqual=o,t.includes=function(e,t){for(var n=0,r=t;nt[r]&&n++;return n}(e)%2==0},t.readState=function(e){console.log("---------");for(var t=0,n=e;tr.evaluationFunctionValue.h&&r.evaluationFunctionValue.f>f.f&&(f.f=r.evaluationFunctionValue.f),new u.NodeInfo(f,t,e,r)}t.generateNodeList=function(e,t){var n=[],o=c(r.operations.up,e,t,e.evaluationFunctionValue.g);o&&n.push(o);var u=c(r.operations.right,e,t,e.evaluationFunctionValue.g);u&&n.push(u);var i=c(r.operations.down,e,t,e.evaluationFunctionValue.g);i&&n.push(i);var a=c(r.operations.left,e,t,e.evaluationFunctionValue.g);return a&&n.push(a),n},t.generateNode=s,t.readNode=function e(t){return f.readState(t.state),t.previousNode?e(t.previousNode):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeInfo=void 0;var o=function(e,t,n,o){this.evaluationFunctionValue=e,this.operation=t,this.state=n,this.previousNode=o};t.NodeInfo=o},function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcDistanceOfItem=t.calcHValue=void 0;var r=o(n(1));function u(e,t,n){for(var o in n){var r=n[o].indexOf(e);if(r>-1)return Math.abs(t.line-Number(o))+Math.abs(t.col-r)}return 10}t.calcHValue=function(e,t){var n=0;for(var o in e)for(var i in e[o]){var a=new r.default(Number(o),Number(i));n+=u(e[o][i],a,t)}return n},t.calcDistanceOfItem=u},function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPositionOfBlankItem=t.moveLeftOperation=t.moveDownOperation=t.moveRightOperation=t.moveUpOperation=t.applyOperation=void 0;var r=n(0),u=o(n(1));function i(e){var t=c(e),n=t.line-1;return n>=0?s(t,new u.default(n,t.col),e):null}function a(e){var t=c(e),n=t.col+1;return n<=2?s(t,new u.default(t.line,n),e):null}function l(e){var t=c(e),n=t.line+1;return n<=2?s(t,new u.default(n,t.col),e):null}function f(e){var t=c(e),n=t.col-1;return n>=0?s(t,new u.default(t.line,n),e):null}function c(e){for(var t in e){var n=e[t].indexOf(0);if(n>-1)return new u.default(Number(t),Number(n))}throw new Error("Error: null item not found on state")}function s(e,t,n){var o=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];for(var n in e)for(var o in e)t[n][o]=e[n][o];return t}(n),r=n[t.line][t.col];return o[t.line][t.col]=0,o[e.line][e.col]=r,o}t.applyOperation=function(e,t){switch(t){case r.operations.up:return i(e);case r.operations.right:return a(e);case r.operations.down:return l(e);case r.operations.left:return f(e)}},t.moveUpOperation=i,t.moveRightOperation=a,t.moveDownOperation=l,t.moveLeftOperation=f,t.getPositionOfBlankItem=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t,n){this.g=e,this.h=t,this.f=n};t.default=o}])})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AStarPuzzleSolver=t():e.AStarPuzzleSolver=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operations=void 0,function(e){e.up="UP_OPERATION",e.right="RIGHT_OPERATION",e.down="DOWN_OPERATION",e.left="LEFT_OPERATION",e.none="NONE"}(t.operations||(t.operations={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){this.line=e,this.col=t};t.default=r},function(e,t,n){"use strict";function r(e,t){for(var n in e)for(var r in e)if(e[n][r]!=t[n][r])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isSolvable=t.readState=t.includes=t.areEqual=void 0,t.areEqual=r,t.includes=function(e,t){for(var n=0,o=t;nt[o]&&n++;return n}(e)%2==0},t.readState=function(e){console.log("---------");for(var t=0,n=e;to.evaluationFunctionValue.h&&o.evaluationFunctionValue.f>f.f&&(f.f=o.evaluationFunctionValue.f),new u.NodeInfo(f,t,e,o)}t.generateNodeList=function(e,t){var n=[],r=c(o.operations.up,e,t,e.evaluationFunctionValue.g);r&&n.push(r);var u=c(o.operations.right,e,t,e.evaluationFunctionValue.g);u&&n.push(u);var i=c(o.operations.down,e,t,e.evaluationFunctionValue.g);i&&n.push(i);var a=c(o.operations.left,e,t,e.evaluationFunctionValue.g);return a&&n.push(a),n},t.generateNode=s,t.readNode=function e(t){return f.readState(t.state),t.previousNode?e(t.previousNode):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeInfo=void 0;var r=function(e,t,n,r){this.evaluationFunctionValue=e,this.operation=t,this.state=n,this.previousNode=r};t.NodeInfo=r},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcDistanceOfItem=t.calcHValue=void 0;var o=r(n(1));function u(e,t,n){for(var r in n){var o=n[r].indexOf(e);if(o>-1)return Math.abs(t.line-Number(r))+Math.abs(t.col-o)}return 10}t.calcHValue=function(e,t){var n=0;for(var r in e)for(var i in e[r]){var a=new o.default(Number(r),Number(i));n+=u(e[r][i],a,t)}return n},t.calcDistanceOfItem=u},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPositionOfBlankItem=t.moveLeftOperation=t.moveDownOperation=t.moveRightOperation=t.moveUpOperation=t.applyOperation=void 0;var o=n(0),u=r(n(1));function i(e){var t=c(e),n=t.line-1;return n>=0?s(t,new u.default(n,t.col),e):null}function a(e){var t=c(e),n=t.col+1;return n<=2?s(t,new u.default(t.line,n),e):null}function l(e){var t=c(e),n=t.line+1;return n<=2?s(t,new u.default(n,t.col),e):null}function f(e){var t=c(e),n=t.col-1;return n>=0?s(t,new u.default(t.line,n),e):null}function c(e){for(var t in e){var n=e[t].indexOf(0);if(n>-1)return new u.default(Number(t),Number(n))}throw new Error("Error: null item not found on state")}function s(e,t,n){var r=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];for(var n in e)for(var r in e)t[n][r]=e[n][r];return t}(n),o=n[t.line][t.col];return r[t.line][t.col]=0,r[e.line][e.col]=o,r}t.applyOperation=function(e,t){switch(t){case o.operations.up:return i(e);case o.operations.right:return a(e);case o.operations.down:return l(e);case o.operations.left:return f(e)}},t.moveUpOperation=i,t.moveRightOperation=a,t.moveDownOperation=l,t.moveLeftOperation=f,t.getPositionOfBlankItem=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){this.g=e,this.h=t,this.f=n};t.default=r}])})); \ No newline at end of file diff --git a/lib/a-star-puzzle-solver.umd.min.js b/lib/a-star-puzzle-solver.umd.min.js new file mode 100644 index 0000000..4083775 --- /dev/null +++ b/lib/a-star-puzzle-solver.umd.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AStarPuzzleSolver=t():e.AStarPuzzleSolver=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operations=void 0,function(e){e.up="UP_OPERATION",e.right="RIGHT_OPERATION",e.down="DOWN_OPERATION",e.left="LEFT_OPERATION",e.none="NONE"}(t.operations||(t.operations={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){this.line=e,this.col=t};t.default=r},function(e,t,n){"use strict";function r(e,t){for(var n in e)for(var r in e)if(e[n][r]!=t[n][r])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isSolvable=t.readState=t.includes=t.areEqual=void 0,t.areEqual=r,t.includes=function(e,t){for(var n=0,o=t;nt[o]&&n++;return n}(e)%2==0},t.readState=function(e){console.log("---------");for(var t=0,n=e;to.evaluationFunctionValue.h&&o.evaluationFunctionValue.f>f.f&&(f.f=o.evaluationFunctionValue.f),new u.NodeInfo(f,t,e,o)}t.generateNodeList=function(e,t){var n=[],r=c(o.operations.up,e,t,e.evaluationFunctionValue.g);r&&n.push(r);var u=c(o.operations.right,e,t,e.evaluationFunctionValue.g);u&&n.push(u);var i=c(o.operations.down,e,t,e.evaluationFunctionValue.g);i&&n.push(i);var a=c(o.operations.left,e,t,e.evaluationFunctionValue.g);return a&&n.push(a),n},t.generateNode=s,t.readNode=function e(t){return f.readState(t.state),t.previousNode?e(t.previousNode):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeInfo=void 0;var r=function(e,t,n,r){this.evaluationFunctionValue=e,this.operation=t,this.state=n,this.previousNode=r};t.NodeInfo=r},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcDistanceOfItem=t.calcHValue=void 0;var o=r(n(1));function u(e,t,n){for(var r in n){var o=n[r].indexOf(e);if(o>-1)return Math.abs(t.line-Number(r))+Math.abs(t.col-o)}return 10}t.calcHValue=function(e,t){var n=0;for(var r in e)for(var i in e[r]){var a=new o.default(Number(r),Number(i));n+=u(e[r][i],a,t)}return n},t.calcDistanceOfItem=u},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getPositionOfBlankItem=t.moveLeftOperation=t.moveDownOperation=t.moveRightOperation=t.moveUpOperation=t.applyOperation=void 0;var o=n(0),u=r(n(1));function i(e){var t=c(e),n=t.line-1;return n>=0?s(t,new u.default(n,t.col),e):null}function a(e){var t=c(e),n=t.col+1;return n<=2?s(t,new u.default(t.line,n),e):null}function l(e){var t=c(e),n=t.line+1;return n<=2?s(t,new u.default(n,t.col),e):null}function f(e){var t=c(e),n=t.col-1;return n>=0?s(t,new u.default(t.line,n),e):null}function c(e){for(var t in e){var n=e[t].indexOf(0);if(n>-1)return new u.default(Number(t),Number(n))}throw new Error("Error: null item not found on state")}function s(e,t,n){var r=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];for(var n in e)for(var r in e)t[n][r]=e[n][r];return t}(n),o=n[t.line][t.col];return r[t.line][t.col]=0,r[e.line][e.col]=o,r}t.applyOperation=function(e,t){switch(t){case o.operations.up:return i(e);case o.operations.right:return a(e);case o.operations.down:return l(e);case o.operations.left:return f(e)}},t.moveUpOperation=i,t.moveRightOperation=a,t.moveDownOperation=l,t.moveLeftOperation=f,t.getPositionOfBlankItem=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){this.g=e,this.h=t,this.f=n};t.default=r}])})); \ No newline at end of file diff --git a/package.json b/package.json index 516ce30..348c8ec 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,10 @@ "webpack": "^4.43.0", "webpack-cli": "^3.3.12" }, + "files":[ + "dist", + "lib" + ], "scripts": { "clear": "rimraf lib", "create:lib-normal": "node_modules/.bin/webpack --output-filename a-star-puzzle-solver.umd.js", From b8f6c68f042622ff1b73807f1ef990f8f608b667 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 21:38:06 -0300 Subject: [PATCH 45/47] Update README (add methods section) --- README.md | 38 +++++++++++++++++++++++++++++++++++++- images/goal-state.jpg | Bin 0 -> 13707 bytes 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 images/goal-state.jpg diff --git a/README.md b/README.md index 1edbade..c010cce 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A TypeScript lib that solves Puzzle Game problem using the A* Algorithm Use the package manager [npm](https://www.npmjs.com/) to install A* Puzzle Solver. ```bash -npm install a-star-puzzle-solver-ts +npm install a-star-puzzle-solver ``` ## How to use @@ -47,6 +47,42 @@ const aStar = AStarPuzzleSolver; const solution = aStar.solvePuzzle(state); ``` +## Methods +> This library provides only one method: + +### solvePuzzle(initialState) +> Solves the 8 Puzzle Game with provided initial state. + +**Arguments** + +| Argument | Type | Options | +|----------|---------|-------------------| +|`initialState`|*Array of Arrays of Number* | 'Any state possible'| + +**Example** + +```js +const state = [ + [1, 2, 3], + [4, 5, 6], + [7, 0, 8] +]; + +const solution = AStar.solvePuzzle(state); +``` + +**Return** +> This method return an object with: +> - 'state' property: last state visited (the goal state) +> - 'evaluationFunctionValue': an object (wich you can use to access property 'g' that represents the depth traveled) +> - 'previousNode': another Node object with same properties (that you can use to see expanded nodes and operations applied) + +**Obs:** +- For more examples of how to use, see './examples' folder +- The goalState considered by the algorithm is: + +![](./images/goal-state.jpg) + ## Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. diff --git a/images/goal-state.jpg b/images/goal-state.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1caf4129a2cc3b361ac9335c3243493f8f45dd05 GIT binary patch literal 13707 zcmeHM2{@E%`+vsL$dVKpS;iW17;D0eA))0sp+)wFLC9`0M;J>aSwd72rBkUaN790f z5~CHREG>+sY+-~3W8UwbI$!6c@4CMFmj8AAug~jxdEVFk-p~E}-S>Mx_x-$3JJb!9 zZ?V{H0T2iT*aQCnh`xNlob2rhfRzBA_I#IEHbdjz#;>S4E!%LV7kwPOz1XH!KoPvj`DmNU(ZPYH0IXS1Rx{h&+(si1z$FYyT!WVe=&j z@FxS>n%bI%n)-&C>twaH40Uu3b+y4ix(9$M*atiS84!R!AcA0c%-QJ>klGs>8fb{Y z_=ji^hyiXM8twsp7&0LcqotvV0a!dakl^m?5i0BE;pOd*Qy#0LD$9BkamsdjR+?6U zW*&RJH-!g#Y!ClshkLlMy8%%dZ!E-*B^#3c0{uKf39@9ref}YaWSsmb?S}A}a~mUX zj14Aw8rp8O_(KA|!pZ+(OITQ#MwpI9K(H4^%fP?@qp6M2)>ell)I)yt4<(S*{X-P~ zP_WS>#68$MFw{H1UzVeg;1)m%#mSRM-b6!Bf~TGvk*KHcM$jRuYiSV)>I9;WmO4>K zhp4ZowO-p(%T4}|>51-NW)CC<@B1`2(H-Nl&%@8dKQshpLklC1`E2xmYEGD2oN+`-R%iBkAU z+5dxMagrY*d6BL~x_*d(9}-@Su0^_jh=CsxUW~5)XLS8p>3aCX`@_h;hQ}R@PdJo#I4L9ZSXTD&6DM;D&i!`&!o|W% zm#>yztGIsS=B>)Rb@%EUXpQ$DJbl*s{6$-PM<>0fx3B;0yMe(W#>9uosp*f*nOP1l z1mOM*>kG04xI|!FTs%D7JV*{M1Xmb*a*Ocr%4scGVQPaU1g(_Uj^PvCkbbu8&Qb*( z+i@|s;1>Q>in??q1_#V%xeM(~&1I?z= zVOx&tB5r)6<{W!f(>>Q&h1o;wCHZVUmwIzR9{VriyOMuuI;%~cwNY1sEwd@-QWjyA zmyI!Df5UTHR%>4rX;LgAr3XKQ-9#NR@M4`iBW(8#AvWKDD0M4{#)f^3#PVwpx08|p zqw8x=p%*%7T2+OcMp@`77uQtdwa-X?s?YAZ3YCPOAgMLJSI9fin_P~lotUXLs6Vii zJVqO1vc|>dlQkirWg=5=E^3W%F`Cn++}Ems!0-1UFv~+4`6iM+3GyD8n{(EFJX(5Q zWW#Akp3D)@mrr=ShpbGS#izXw7_Bze5UR*(>PXI{l|S-3d-cqR)C19xS1y*y&gVz( z#`=iv5f*s`kj>V}(iU@3U>6hhxNAb6WeI^&CS}s&@qzbb@sZaMP@vqS%tGK01T37I zku|U^BCBWHiov{<&Hc|ww;ru)IeJDl`&X%4Rn=7c!vkt@Pua#~|FL_!W{t}(_!^^g z2BU9e?y3+`Jh@)N=&%H?k#;*=>20PrrEvEf=Zhzm;&hLyMLyr}T*a90J|B&{vHHWd zPUS6!9GC~Z2-1~JSDbwUO)nIpwXzQL2>Vr)zl<3)kts7b^AdQu`wmZrgp11a)n?BV zQBA$utr4yYd# zB};uuKU%L*>g|5Yq_+EgdZJKVgQd*L(#;uqIm)S~x1_iHKDFeg>)|}iIQ3wJ5aq&9 z*sh?>LB#17oq-A=2^*5uE!(i{9STJ90#c_&IiW{-Rokwo8mrzu7}ZkLE^MGrVq*=L zhl|)}DRIryjZJ9e&Uut2$6zJn(v7*6AZj=eL##nHgX>ViVbt@x|I+Z5NZBH?r2mK z1cs{p;HQ;nlcn}mF{8yUs8P=f&%vLJ!Z5fST)0X*Ejs#;gKMn6|M})IlI-z}lO=>a zQu>;saUY~gOy6Neas``_j-MiPL1NGwtLSzu4`Zc3Km-EAZ1lWDh>6S`EXwP=)%My` z-Hx%TwJ+Yh;C-!_)+{`<%>=2K%l|IaPqo*f&7I+u=-1h~$({IgL}}P-W#pg~rO6J} z^wF+=_~uEh-#7#|Gp33wu2%&`U7sE$?)EDY^m*KI0&!pZwzh9tKu2Belk?6~`?t4B z_Jqt@BQM#%aU5E8Da1p28_&rOd8sRVdSyRKkuF`XIZX&S@10#4ne3+KyU7-1P2pDo z!i_tVfLdPwZ1(*gIKL7e;`^l|L%t550q)@(m4aygv&DPET@$a}51sdK5E!=Kk&sFh zG(OinmukMdru>l2vyy!!aVUScy+pqHUtaJ?i8QXqnFp=L+{Ni{yy|BxEJDuq)4D2j zurgb|GrUmsa;;3a=40T_ZVKNwYZo)+>#BF*S*By9m7#^f2RYj-HxI1Z#R_pLw(jV7 z>HWgGquo@x;u@bq66%<0L25Ljc}FYkepVC&(wY#I_B!DYVx0VdruKfQb)D9%W7PwA zC9yH#jc6M;>Y>F&heX7xvo8g@^~2q<6GE&FZF>(+)=HmqZxd zu6$9AJMW_}aK#FhGy1^5NoDu=Ee~a>Jlp_x2?P=nm|hSt6M#TBFAes#B}-So4nK=> zg#ggNGn0n!bSJU``(T$aEKwrNUX#YOli`EFS^YW)FxBE9aQMtJSN3X2dj7m11_III zXqGv8ytzvdj#dJN1#Uv1M~$=Hz0vBsYzu6CkjK9 zQfC&S1J4r=fpM;02qc!AV~f#Z@dH+H0I~VIVYPd|(F*z@KtEd}0fFYbuz83e2;8$v zXNfXT(YNuD(;AMu$hCI9khUFNtB!JPWV;x~_FUhPk> zO1YTqSyT3nM`l7?TS9MAeA=%ihQ3@s`K-vnVqZ4z@?-MYl1F}b?l;oH!AI)<27kZ4 zt4AMZuV6G3cUJ`n4*C76UQ#7k&h7Wp0lPqnhlNdam$q+Wus?q_R-HbNv>C@%%EVt7 zyt=jYZU*jjZs2jJ)TP$ixI*sN0|juxqftD!&8*SynnvYAz$Eo{Qgzrg5dsmRG9~Nw)a_#*vl-5>muNaxUsgP(^3cyVxLqnYv~ViYp=m?QC<*tA ztLlpvI*KXDx#5UcnbF8#lTx8nb!P~8cOi$Of%C*U4c{)`TB_&Rj3iqD0&Oh(toGYz+%!kDaBIn+ z=9U(#%l4M?(nV>3(U&F_^fDR9`Z6-Qwlcd)R!FIO_l;x-JlyPf5dCv*{vKZ%b}8L8 zwrhEZ2=UhKw!Ura-Us-5B={cII(}5e@1n9|ys{`_Qa4z!tSDW(a=l>DMY)&((~H~X zl8nfa&kMeWr6nQ_gh`Gyh`pcyy`1+XU|VKFa^wV9ThPuskmLeB}4$p$~QL8LyzF=<>Ngtu`&V>a6tqa^j=2yNT=8E0U0< zr~%(<#^cgt|IjMW@g-;7y&?ta{i$qR%PY&cV^5a41U*B(+C^^0+Vni!t6ohGz2a;j zt&~^yv$xWm<66Nh3O7+!wJXj@b#t{h%1V1?hUmRL;z1&zkLyk|?#ok1NwJo1eO|+M ze=Z_cqZibm%@FuY5sFCb8Pt#)|K*lacGS}xQk{8f)jhwoHnDy@V2RLE?7H8desk%Z zy^pwf@RK#Zg$K_E$vJ6^yrW#B~oWuOWS}Gb^vdU1&X^8jFrf3wPlYLD=ki`zOq+Lc5GZ0EV^>2 z=+;Nu13A-`{nZlPz4VtUjyqeuQimO1j2gE@VtqDftlxB0X1~gMo{3+L>n_2sZCLL| zRuox)-GHK;D0M59X3j$ZoyP@%vIO*7mCqUE+gwv)%QPQP2#_LM3~x`XuguO+XjO`9 zy#C}_h4m<2vu|`>g?p$|t&T#^)u0R%_~xg>Yxe-WNCn=4``^PQQSkeAK1a%rpqN!bQTs!<-us5Tu7d zz3%)Dv;x(R6-&dp4hPCrXAD$9Y8PwOhN4);TU;AnDjYkHOI5y*qaA{$w&;sku z{nfB&+=Ha?uD@D`{|XuRtADPb#)5%n<>}(5rOMehZRa3Rx84cv$Tzm(;rv+NcF3nj zAfu`GE_vgyzHODyuIaAMpYh@P2WMudByYZ}0Fg9vasW#wzG+_6Dr5rBaz>9o5ywy3 z=ruLMdkdk6(H(XP3v{+Dpu$9^|DWjiy7+{v#IJ3X=%vO7GliYTBU|%ST1hda;yZj> zi+b=Ur0d>dn~|;8Y|J_N?5mv;PS^8w4;+dZ*#QfR+KKc&>pe9$ERCV}KQ1{fe<^R8 zJ+0YtIkGjybl1ZbsN7}ilGF1dKGtIxSMFY4bzIy<=cxwq_U(j*H+=iHM`Sd%15erY z63XqX!N;7n>1w~JT-`(@SxYo>2Tj#pZ2p0qgD?-GidK8+$5czqpY<%0tU7gKd+AJZ!FVEKJ5yWGq&U)Z@5K^!1RwVQ|s2mtE!{b}$S);F7-@7-d^LnA?mj zXxSNB)&E@gh!L}QZ}t$+NgMV=f_1ww>-pvHZc;dn3g={WrFAi8x-oMo0^5zV!2ji4 zJtOQ^kfZ`irRPuL`%ZLG+TAGgT!z!CjINGM_U4q2^9jmuNv!a9G2HV*EJdnRXryk$ ziztb!kz2Y++k^B+>Dxy|jf9KC1+)uR1&i$?!4203xCVCQ-cx1r_@k; zvhFngREW4U*;xGjJ?6jTzM0`W#?s8^Fjp4&o13rUxP0yX^WKqO&E+o{g{Qrzz{ze>gK5WR>q9_>Qh}15G?a4FVKNxMAk(o_v?Cul5p4?G_sTp{gsMvTCeG5tDM^ zsc!nE;#YQVdX=uq5eEXbsOx7e!@+D$5~FJYzvsT87G5b!r57s4f9<7cT+;Wcx zQ)us^sUw6#Gf4}yl<9Q|vGy=(%IUp5DUxP4%AZcDlnU5yOQr<8N>U;mH61 literal 0 HcmV?d00001 From 799ec6d78cae0248ef18a56d826ae90df67dac4a Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 23:20:26 -0300 Subject: [PATCH 46/47] Add example --- examples/index.html | 65 +++++++++++++++++++++++++ examples/index.js | 112 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 examples/index.html create mode 100644 examples/index.js diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 0000000..3fa2717 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,65 @@ + + + + + + A Star Puzzle Solver - Example 01 + + + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + +
+
+
+
+
+ + +
+
+ +
+
    +
+
+ +
+
+ + +
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/examples/index.js b/examples/index.js new file mode 100644 index 0000000..c514635 --- /dev/null +++ b/examples/index.js @@ -0,0 +1,112 @@ +$(document).ready(function () { + const initialState = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + initialState.sort((a, b) => Math.random() - Math.random()); + + renderTDList(initialState); + $("#btnRandomize").on("click", function () { + randomState(); + }); + + $("#btnSolution").on("click", function () { + getSolution(); + }); +}); + +function renderTDList(stateList) { + console.log("rendering..."); + console.log(stateList); + + const list = $("td.td-puzzle"); + let pos = 0; + for (let td of list) { + $(td).html(stateList.shift()); + pos++; + } +} + +function getActualState() { + const list = $("td.td-puzzle"); + let state = [[], [], []]; + const stateList = []; + for (let td of list) { + stateList.push($(td).text()); + } + + for (let i in stateList) { + if (i <= 2) { + state[0].push(Number(stateList[i])); + } else if (i <= 5) { + state[1].push(Number(stateList[i])); + } else { + state[2].push(Number(stateList[i])); + } + } + return state; +} + +function getSolution() { + const aStar = AStarPuzzleSolver; + const state = getActualState(); + console.log(state); + const solution = aStar.solvePuzzle(state); + showResults(solution); + viewSolution(solution); +} + +function showResults(solution) { + const markup = ` +
  • Problema resolvido!
  • +
  • Custo final: ${solution.evaluationFunctionValue.g}
  • +
  • Nós expandidos: ?
  • +
  • Início da fronteira: ?
  • + `; + + $("#results").html(markup); +} + +async function viewSolution(solution) { + // const markup = ` + // `; + + let states = getListOfStates(solution, []); + awaitsToRender(states); + + // $("#solution").html(markup); +} + +function timer(ms) { + return new Promise((res) => setTimeout(res, ms)); +} + +async function awaitsToRender(states) { + for (let s of states) { + console.log(s); + await timer(1200); + renderTDList(transformStateInArray(s)); + } +} + +function transformStateInArray(state) { + let array = []; + for (let l in state) { + for (let c in state[l]) { + array.push(state[l][c]); + } + } + return array; +} + +function getListOfStates(node, list) { + if (node.previousNode) { + list.unshift(node.state); + return getListOfStates(node.previousNode, list); + } else { + return list; + } +} + +function randomState() { + state = [1, 2, 3, 4, 5, 6, 7, 8, 0]; + state.sort((a, b) => Math.random() - Math.random()); + renderTDList(state); +} From 057693299497fb5ad43181f503bf4e68cc3dc33f Mon Sep 17 00:00:00 2001 From: Alexandre Date: Mon, 6 Jul 2020 23:24:26 -0300 Subject: [PATCH 47/47] Add treatment of error --- examples/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/index.js b/examples/index.js index c514635..6ad66c1 100644 --- a/examples/index.js +++ b/examples/index.js @@ -48,9 +48,15 @@ function getSolution() { const aStar = AStarPuzzleSolver; const state = getActualState(); console.log(state); - const solution = aStar.solvePuzzle(state); - showResults(solution); - viewSolution(solution); + try { + const solution = aStar.solvePuzzle(state); + showResults(solution); + viewSolution(solution); + } catch (err) { + alert( + "O estado inicial é solucionável! Por favor, gere outro estado e tente novamente." + ); + } } function showResults(solution) {