diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..b584e3a --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules +dist +test \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..99f5cfe --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "quotes": [2, "single", { "avoidEscape": true }], + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/explicit-function-return-type": [ + "error", + { + "allowTypedFunctionExpressions": false + } + ], + "@typescript-eslint/typedef": [ + "error", + { + "variableDeclaration": true, + "variableDeclarationIgnoreFunction": true + } + ] + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..400900c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/node_modules/ +/.idea/ +/dist/ \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..36af219 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3ccc248 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 250, + "tabWidth": 4, + "semi": true, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "none", + "bracketSpacing": false, + "arrowParens": "avoid", + "endOfLine": "auto" +} \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..64c575f --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,13 @@ +Copyright (c) 2020 RS Mod + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..992e1b0 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# rsmod-pathfinder +A breadth-first search path finder. + +Ported from Kotlin: https://github.com/rsmod/rsmod/tree/master/game/pathfinder + +## Installing +https://www.npmjs.com/package/rsmod-pathfinder + +```shell +npm i @2004scape/rsmod-pathfinder +npm run prepare +``` + +If you are on a Mac: +```shell +chmod ug+x .husky/* +chmod ug+x .git/hooks/* +``` + +## Publishing (Local Development) +https://github.com/wclr/yalc + +```shell +npm run build # Builds the js bundle and type definitions. +yalc publish --push # Publishes to the local repo and pushes to all projects it has been added to. +yalc add rsmod-pathfinder # Adds the published library to your project. +``` diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..0a27839 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,13 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': [ + 'ts-jest', + { + useESM: true + } + ] + } +}; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f264bcd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5012 @@ +{ + "name": "@2004scape/rsmod-pathfinder", + "version": "4.2.3", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@2004scape/rsmod-pathfinder", + "version": "4.2.3", + "license": "ISC", + "devDependencies": { + "@types/jest": "^29.5.11", + "@typescript-eslint/eslint-plugin": "^6.18.0", + "@typescript-eslint/parser": "^6.18.0", + "eslint": "^8.56.0", + "husky": "^8.0.3", + "jest": "^29.7.0", + "prettier": "^3.1.1", + "ts-jest": "^29.1.1", + "typescript": "^5.3.3" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/code-frame/node_modules/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, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/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, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/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, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/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, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", + "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", + "dev": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.7", + "@babel/parser": "^7.23.6", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", + "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/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, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/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, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/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, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/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, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", + "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", + "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", + "dev": true + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.5.tgz", + "integrity": "sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.11", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", + "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.11.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", + "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/semver": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "dev": true + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true + }, + "node_modules/@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz", + "integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/type-utils": "6.19.0", + "@typescript-eslint/utils": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz", + "integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz", + "integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz", + "integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.19.0", + "@typescript-eslint/utils": "6.19.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz", + "integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz", + "integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/visitor-keys": "6.19.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz", + "integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.19.0", + "@typescript-eslint/types": "6.19.0", + "@typescript-eslint/typescript-estree": "6.19.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz", + "integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.19.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001579", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz", + "integrity": "sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.640", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.640.tgz", + "integrity": "sha512-z/6oZ/Muqk4BaE7P69bXhUhpJbUM9ZJeka43ZwxsDshKtePns4mhBlh8bU5+yrnOnz3fhG82XLzGUXazOmsWnA==", + "dev": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint": { + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.56.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/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, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/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 + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/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 + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/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, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/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, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/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, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz", + "integrity": "sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/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 + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/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, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/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, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/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 + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/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 + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/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, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/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, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/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, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/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, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", + "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", + "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-jest": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", + "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/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, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..de0c654 --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "name": "@2004scape/rsmod-pathfinder", + "version": "4.2.3", + "description": "A breadth-first search path finder.", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "/dist" + ], + "scripts": { + "test": "jest", + "build": "tsc", + "prepare": "husky install", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "format": "prettier src/**/*.ts --write" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/2004scape/rsmod-pathfinder.git" + }, + "keywords": [ + "rsmod", + "pathfinder", + "bfs", + "2004scape" + ], + "author": "2004scape", + "license": "ISC", + "bugs": { + "url": "https://github.com/2004scape/rsmod-pathfinder/issues" + }, + "homepage": "https://github.com/2004scape/rsmod-pathfinder#readme", + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "src/**/*.ts": [ + "npm run format", + "npm run lint:fix", + "git add" + ] + }, + "devDependencies": { + "@types/jest": "^29.5.11", + "@typescript-eslint/eslint-plugin": "^6.18.0", + "@typescript-eslint/parser": "^6.18.0", + "eslint": "^8.56.0", + "husky": "^8.0.3", + "jest": "^29.7.0", + "prettier": "^3.1.1", + "ts-jest": "^29.1.1", + "typescript": "^5.3.3" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..536a8bc --- /dev/null +++ b/src/index.ts @@ -0,0 +1,18 @@ +import CollisionFlag from './rsmod/flag/CollisionFlag'; + +import CollisionFlagMap from './rsmod/collision/CollisionFlagMap'; +import CollisionStrategy from './rsmod/collision/CollisionStrategy'; +import CollisionStrategies from './rsmod/collision/CollisionStrategies'; + +import StepValidator from './rsmod/StepValidator'; +import PathFinder from './rsmod/PathFinder'; +import NaivePathFinder from './rsmod/NaivePathFinder'; + +import Line from './rsmod/Line'; +import LinePathFinder from './rsmod/LinePathFinder'; +import LineValidator from './rsmod/LineValidator'; +import RouteCoordinates from './rsmod/RouteCoordinates'; + +import ReachStrategy from './rsmod/reach/ReachStrategy'; + +export {CollisionFlag, CollisionFlagMap, CollisionStrategy, CollisionStrategies, StepValidator, PathFinder, NaivePathFinder, Line, LinePathFinder, LineValidator, RouteCoordinates, ReachStrategy}; diff --git a/src/rsmod/Line.ts b/src/rsmod/Line.ts new file mode 100644 index 0000000..a9d7bfb --- /dev/null +++ b/src/rsmod/Line.ts @@ -0,0 +1,32 @@ +import CollisionFlag from './flag/CollisionFlag'; + +export default class Line { + static readonly SIGHT_BLOCKED_NORTH: number = CollisionFlag.LOC_PROJ_BLOCKER | CollisionFlag.WALL_NORTH_PROJ_BLOCKER; + static readonly SIGHT_BLOCKED_EAST: number = CollisionFlag.LOC_PROJ_BLOCKER | CollisionFlag.WALL_EAST_PROJ_BLOCKER; + static readonly SIGHT_BLOCKED_SOUTH: number = CollisionFlag.LOC_PROJ_BLOCKER | CollisionFlag.WALL_SOUTH_PROJ_BLOCKER; + static readonly SIGHT_BLOCKED_WEST: number = CollisionFlag.LOC_PROJ_BLOCKER | CollisionFlag.WALL_WEST_PROJ_BLOCKER; + + static readonly WALK_BLOCKED_NORTH: number = CollisionFlag.WALL_NORTH | CollisionFlag.WALK_BLOCKED; + static readonly WALK_BLOCKED_EAST: number = CollisionFlag.WALL_EAST | CollisionFlag.WALK_BLOCKED; + static readonly WALK_BLOCKED_SOUTH: number = CollisionFlag.WALL_SOUTH | CollisionFlag.WALK_BLOCKED; + static readonly WALK_BLOCKED_WEST: number = CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + + static readonly HALF_TILE: number = this.scaleUp(1) / 2; + + static scaleUp(tiles: number): number { + return tiles << 16; + } + + static scaleDown(tiles: number): number { + return tiles >>> 16; + } + + static coordinate(a: number, b: number, size: number): number { + if (a >= b) { + return a; + } else if (a + size - 1 <= b) { + return a + size - 1; + } + return b; + } +} diff --git a/src/rsmod/LinePathFinder.ts b/src/rsmod/LinePathFinder.ts new file mode 100644 index 0000000..92fb5ff --- /dev/null +++ b/src/rsmod/LinePathFinder.ts @@ -0,0 +1,161 @@ +import CollisionFlagMap from './collision/CollisionFlagMap'; +import RayCast from './RayCast'; +import Line from './Line'; +import CollisionFlag from './flag/CollisionFlag'; +import RouteCoordinates from './RouteCoordinates'; + +export default class LinePathFinder { + private readonly flags: CollisionFlagMap; + + constructor(flags: CollisionFlagMap) { + this.flags = flags; + } + + lineOfSight(level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number = 1, destWidth: number = 0, destHeight: number = 0, extraFlag: number = 0): RayCast { + return this.rayCast( + level, + srcX, + srcZ, + destX, + destZ, + srcSize, + destWidth, + destHeight, + Line.SIGHT_BLOCKED_WEST | extraFlag, + Line.SIGHT_BLOCKED_EAST | extraFlag, + Line.SIGHT_BLOCKED_SOUTH | extraFlag, + Line.SIGHT_BLOCKED_NORTH | extraFlag, + CollisionFlag.LOC | extraFlag, + true + ); + } + + lineOfWalk(level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number = 1, destWidth: number = 0, destHeight: number = 0, extraFlag: number = 0): RayCast { + return this.rayCast( + level, + srcX, + srcZ, + destX, + destZ, + srcSize, + destWidth, + destHeight, + Line.WALK_BLOCKED_WEST | extraFlag, + Line.WALK_BLOCKED_EAST | extraFlag, + Line.WALK_BLOCKED_SOUTH | extraFlag, + Line.WALK_BLOCKED_NORTH | extraFlag, + CollisionFlag.LOC | extraFlag, + false + ); + } + + rayCast( + level: number, + srcX: number, + srcZ: number, + destX: number, + destZ: number, + srcSize: number, + destWidth: number, + destHeight: number, + flagWest: number, + flagEast: number, + flagSouth: number, + flagNorth: number, + flagObject: number, + los: boolean + ): RayCast { + const startX: number = Line.coordinate(srcX, destX, srcSize); + const startZ: number = Line.coordinate(srcZ, destZ, srcSize); + + if (los && this.flags.isFlagged(startX, startZ, level, flagObject)) { + return RayCast.FAILED; + } + + const endX: number = Line.coordinate(destX, srcX, destWidth); + const endZ: number = Line.coordinate(destZ, srcZ, destHeight); + + if (startX === endX && startZ === endZ) { + return RayCast.EMPTY_SUCCESS; + } + + const deltaX: number = endX - startX; + const deltaZ: number = endZ - startZ; + const absoluteDeltaX: number = Math.abs(deltaX); + const absoluteDeltaZ: number = Math.abs(deltaZ); + + const travelEast: boolean = deltaX >= 0; + const travelNorth: boolean = deltaZ >= 0; + + let xFlags: number = travelEast ? flagWest : flagEast; + let zFlags: number = travelNorth ? flagSouth : flagNorth; + + const coordinates: RouteCoordinates[] = []; + if (absoluteDeltaX > absoluteDeltaZ) { + const offsetX: number = travelEast ? 1 : -1; + const offsetZ: number = travelNorth ? 0 : -1; + + let scaledZ: number = Line.scaleUp(startZ) + Line.HALF_TILE + offsetZ; + const tangent: number = Line.scaleUp(deltaZ) / absoluteDeltaX; + + let currX: number = startX; + while (currX !== endX) { + currX += offsetX; + const currZ: number = Line.scaleDown(scaledZ); + if (los && currX === endX && currZ === endZ) { + xFlags = (xFlags & ~CollisionFlag.LOC_PROJ_BLOCKER) | (xFlags & ~CollisionFlag.PLAYER); + } + if (this.flags.isFlagged(currX, currZ, level, xFlags)) { + return new RayCast(coordinates, coordinates.length > 0, false); + } + coordinates.push(new RouteCoordinates(currX, currZ, level)); + + scaledZ += tangent; + + const nextZ: number = Line.scaleDown(scaledZ); + if (nextZ !== currZ) { + if (los && currX === endX && nextZ === endZ) { + zFlags = (zFlags & ~CollisionFlag.LOC_PROJ_BLOCKER) | (zFlags & ~CollisionFlag.PLAYER); + } + if (this.flags.isFlagged(currX, nextZ, level, zFlags)) { + return new RayCast(coordinates, coordinates.length > 0, false); + } + coordinates.push(new RouteCoordinates(currX, nextZ, level)); + } + } + } else { + const offsetX: number = travelEast ? 0 : -1; + const offsetZ: number = travelNorth ? 1 : -1; + + let scaledX: number = Line.scaleUp(startX) + Line.HALF_TILE + offsetX; + const tangent: number = Line.scaleUp(deltaX) / absoluteDeltaZ; + + let currZ: number = startZ; + while (currZ !== endZ) { + currZ += offsetZ; + const currX: number = Line.scaleDown(scaledX); + if (los && currX === endX && currZ === endZ) { + zFlags = (zFlags & ~CollisionFlag.LOC_PROJ_BLOCKER) | (zFlags & ~CollisionFlag.PLAYER); + } + if (this.flags.isFlagged(currX, currZ, level, zFlags)) { + return new RayCast(coordinates, coordinates.length > 0, false); + } + coordinates.push(new RouteCoordinates(currX, currZ, level)); + + scaledX += tangent; + + const nextX: number = Line.scaleDown(scaledX); + if (nextX !== currX) { + if (los && nextX === endX && currZ === endZ) { + xFlags = (xFlags & ~CollisionFlag.LOC_PROJ_BLOCKER) | (xFlags & ~CollisionFlag.PLAYER); + } + if (this.flags.isFlagged(nextX, currZ, level, xFlags)) { + return new RayCast(coordinates, coordinates.length > 0, false); + } + coordinates.push(new RouteCoordinates(nextX, currZ, level)); + } + } + } + return new RayCast(coordinates, false, true); + } +} diff --git a/src/rsmod/LineValidator.ts b/src/rsmod/LineValidator.ts new file mode 100644 index 0000000..b9bb837 --- /dev/null +++ b/src/rsmod/LineValidator.ts @@ -0,0 +1,153 @@ +import CollisionFlagMap from './collision/CollisionFlagMap'; +import Line from './Line'; +import CollisionFlag from './flag/CollisionFlag'; + +export default class LineValidator { + private readonly flags: CollisionFlagMap; + + constructor(flags: CollisionFlagMap) { + this.flags = flags; + } + + hasLineOfSight(level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number = 1, destWidth: number = 0, destHeight: number = 0, extraFlag: number = 0): boolean { + return this.rayCast( + level, + srcX, + srcZ, + destX, + destZ, + srcSize, + destWidth, + destHeight, + Line.SIGHT_BLOCKED_WEST | extraFlag, + Line.SIGHT_BLOCKED_EAST | extraFlag, + Line.SIGHT_BLOCKED_SOUTH | extraFlag, + Line.SIGHT_BLOCKED_NORTH | extraFlag, + CollisionFlag.LOC | extraFlag, + CollisionFlag.LOC_PROJ_BLOCKER | extraFlag, + true + ); + } + + hasLineOfWalk(level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number = 1, destWidth: number = 0, destHeight: number = 0, extraFlag: number = 0): boolean { + return this.rayCast( + level, + srcX, + srcZ, + destX, + destZ, + srcSize, + destWidth, + destHeight, + Line.WALK_BLOCKED_WEST | extraFlag, + Line.WALK_BLOCKED_EAST | extraFlag, + Line.WALK_BLOCKED_SOUTH | extraFlag, + Line.WALK_BLOCKED_NORTH | extraFlag, + CollisionFlag.LOC | extraFlag, + CollisionFlag.LOC_PROJ_BLOCKER | extraFlag, + false + ); + } + + rayCast( + level: number, + srcX: number, + srcZ: number, + destX: number, + destZ: number, + srcSize: number, + destWidth: number, + destHeight: number, + flagWest: number, + flagEast: number, + flagSouth: number, + flagNorth: number, + flagLoc: number, + flagProj: number, + los: boolean + ): boolean { + const startX: number = Line.coordinate(srcX, destX, srcSize); + const startZ: number = Line.coordinate(srcZ, destZ, srcSize); + + if (los && this.flags.isFlagged(startX, startZ, level, flagLoc)) { + return false; + } + + const endX: number = Line.coordinate(destX, srcX, destWidth); + const endZ: number = Line.coordinate(destZ, srcZ, destHeight); + + if (startX === endX && startZ === endZ) { + return true; + } + + const deltaX: number = endX - startX; + const deltaZ: number = endZ - startZ; + const absoluteDeltaX: number = Math.abs(deltaX); + const absoluteDeltaZ: number = Math.abs(deltaZ); + + const travelEast: boolean = deltaX >= 0; + const travelNorth: boolean = deltaZ >= 0; + + let xFlags: number = travelEast ? flagWest : flagEast; + let zFlags: number = travelNorth ? flagSouth : flagNorth; + + if (absoluteDeltaX > absoluteDeltaZ) { + const offsetX: number = travelEast ? 1 : -1; + const offsetZ: number = travelNorth ? 0 : -1; + + let scaledZ: number = Line.scaleUp(startZ) + Line.HALF_TILE + offsetZ; + const tangent: number = Line.scaleUp(deltaZ) / absoluteDeltaX; + + let currX: number = startX; + while (currX !== endX) { + currX += offsetX; + const currZ: number = Line.scaleDown(scaledZ); + if (los && currX === endX && currZ === endZ) { + xFlags = xFlags & ~flagProj; + } + if (this.flags.isFlagged(currX, currZ, level, xFlags)) { + return false; + } + + scaledZ += tangent; + + const nextZ: number = Line.scaleDown(scaledZ); + if (los && currX === endX && nextZ === endZ) { + zFlags = zFlags & ~flagProj; + } + if (nextZ !== currZ && this.flags.isFlagged(currX, nextZ, level, zFlags)) { + return false; + } + } + } else { + const offsetX: number = travelEast ? 0 : -1; + const offsetZ: number = travelNorth ? 1 : -1; + + let scaledX: number = Line.scaleUp(startX) + Line.HALF_TILE + offsetX; + const tangent: number = Line.scaleUp(deltaX) / absoluteDeltaZ; + + let currZ: number = startZ; + while (currZ !== endZ) { + currZ += offsetZ; + const currX: number = Line.scaleDown(scaledX); + if (los && currX === endX && currZ === endZ) { + zFlags = zFlags & ~flagProj; + } + if (this.flags.isFlagged(currX, currZ, level, zFlags)) { + return false; + } + + scaledX += tangent; + + const nextX: number = Line.scaleDown(scaledX); + if (los && nextX === endX && currZ === endZ) { + xFlags = xFlags & ~flagProj; + } + if (nextX !== currX && this.flags.isFlagged(nextX, currZ, level, xFlags)) { + return false; + } + } + } + return true; + } +} diff --git a/src/rsmod/NaivePathFinder.ts b/src/rsmod/NaivePathFinder.ts new file mode 100644 index 0000000..7f91ed8 --- /dev/null +++ b/src/rsmod/NaivePathFinder.ts @@ -0,0 +1,187 @@ +// https://gist.github.com/Z-Kris/2eb1c2fbc22aa7486a57089c82f293f8 +// https://gist.github.com/Z-Kris/fe476d75a51374f12dca999700f009f7 + +import StepValidator from './StepValidator'; +import CollisionStrategy from './collision/CollisionStrategy'; +import Route from './Route'; +import RouteCoordinates from './RouteCoordinates'; + +export default class NaivePathFinder { + private readonly stepValidator: StepValidator; + private readonly cardinals = [ + [-1, 0], // West + [1, 0], // East + [0, 1], // North + [0, -1] // South + ]; + + constructor(stepValidator: StepValidator) { + this.stepValidator = stepValidator; + } + + findPath(level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcWidth: number, srcHeight: number, destWidth: number, destHeight: number, blockAccessFlags: number, collision: CollisionStrategy): Route { + if (!(srcX >= 0 && srcX <= 0x7fff && srcZ >= 0 && srcZ <= 0x7fff)) { + throw new Error(`Failed requirement. srcX was: ${srcX}, srcZ was: ${srcZ}.`); + } + if (!(destX >= 0 && destX <= 0x7fff && destZ >= 0 && destZ <= 0x7fff)) { + throw new Error(`Failed requirement. destX was: ${destX}, destZ was: ${destZ}.`); + } + if (!(level >= 0 && level <= 0x3)) { + throw new Error(`Failed requirement. level was: ${level}.`); + } + // If we are intersecting at all, the path needs to try to move out of the way. + if (this.intersects(srcX, srcZ, srcWidth, srcHeight, destX, destZ, destWidth, destHeight)) { + const dest: RouteCoordinates = this.cardinalDestination(level, srcX, srcZ); + return new Route([dest], false, true); + } + const dest: RouteCoordinates = this.naiveDestination(level, srcX, srcZ, srcWidth, srcHeight, destX, destZ, destWidth, destHeight); + if (this.isDiagonal(dest.x, dest.z, srcWidth, srcHeight, destX, destZ, destWidth, destHeight)) { + return new Route([dest], false, true); + } + /* If we can interact from this coord(or overlap with the target), allow the pathfinder to exit. */ + if (this.intersects(dest.x, dest.z, srcWidth, srcHeight, destX, destZ, destWidth, destHeight)) { + return new Route([dest], false, true); + } + let currX: number = dest.x; + let currZ: number = dest.z; + while (currX !== destX && currZ !== destZ) { + const dx: number = Math.sign(destX - currX); + const dz: number = Math.sign(destZ - currZ); + if (this.stepValidator.canTravel(level, currX, currZ, dx, dz, srcWidth, blockAccessFlags, collision)) { + currX += dx; + currZ += dz; + } else if (dx !== 0 && this.stepValidator.canTravel(level, currX, currZ, dx, 0, srcWidth, blockAccessFlags, collision)) { + currX += dx; + } else if (dz !== 0 && this.stepValidator.canTravel(level, currX, currZ, 0, dz, srcWidth, blockAccessFlags, collision)) { + currZ += dz; + } else { + /* If we can't step anywhere, exit out, we've arrived. */ + break; + } + } + return new Route([new RouteCoordinates(currX, currZ, level)], false, true); + } + + /** + * Fast way to check if two squares are intersecting. + * @param srcX The starting SW X. + * @param srcZ The starting SW Z. + * @param srcWidth The width on the X axis. + * @param srcHeight The length on the Z axis. + * @param destX The ending SW X. + * @param destZ The ending SW Z. + * @param destWidth The end width on the X axis. + * @param destHeight The end length on the Z axis. + */ + intersects(srcX: number, srcZ: number, srcWidth: number, srcHeight: number, destX: number, destZ: number, destWidth: number, destHeight: number): boolean { + const srcHorizontal: number = srcX + srcWidth; + const srcVertical: number = srcZ + srcHeight; + const destHorizontal: number = destX + destWidth; + const destVertical: number = destZ + destHeight; + return !(destX >= srcHorizontal || destHorizontal <= srcX || destZ >= srcVertical || destVertical <= srcZ); + } + + private isDiagonal(srcX: number, srcZ: number, srcWidth: number, srcHeight: number, destX: number, destZ: number, destWidth: number, destHeight: number): boolean { + if (srcX + srcWidth === destX && srcZ + srcHeight === destZ) { + return true; + } + if (srcX - 1 === destX + destWidth - 1 && srcZ - 1 === destZ + destHeight - 1) { + return true; + } + if (srcX + srcWidth === destX && srcZ - 1 === destZ + destHeight - 1) { + return true; + } + return srcX - 1 === destX + destWidth - 1 && srcZ + srcHeight === destZ; + } + + cardinalDestination(level: number, srcX: number, srcZ: number): RouteCoordinates { + const direction: number[] = this.cardinals[Math.floor(Math.random() * this.cardinals.length)]; + return new RouteCoordinates(srcX + direction[0], srcZ + direction[1], level); + } + + /** + * Calculates coordinates for [sourceX]/[sourceZ] to move to interact with [targetX]/[targetZ] + * We first determine the cardinal direction of the source relative to the target by comparing if + * the source lies to the left or right of diagonal \ and anti-diagonal / lines. + * \ <= North <= / + * +------------+ > + * | | East + * +------------+ < + * / <= South <= \ + * We then further bisect the area into three section relative to the south-west tile (zero): + * 1. Greater than zero: follow their diagonal until the target side is reached (clamped at the furthest most tile) + * 2. Less than zero: zero minus the size of the source + * 3. Equal to zero: move directly towards zero / the south-west coordinate + * + * < \ 0 / < / + * +---------+ + * | | + * +---------+ + * This method is equivalent to returning the last coordinate in a sequence of steps towards south-west when moving + * ordinal then cardinally until entity side comes into contact with another. + */ + naiveDestination(level: number, srcX: number, srcZ: number, srcWidth: number, srcHeight: number, destX: number, destZ: number, destWidth: number, destHeight: number): RouteCoordinates { + const diagonal: number = srcX - destX + (srcZ - destZ); + const anti: number = srcX - destX - (srcZ - destZ); + const southWestClockwise: boolean = anti < 0; + const northWestClockwise: boolean = diagonal >= destHeight - 1 - (srcWidth - 1); + const northEastClockwise: boolean = anti > srcWidth - srcHeight; + const southEastClockwise: boolean = diagonal <= destWidth - 1 - (srcHeight - 1); + + const target: RouteCoordinates = new RouteCoordinates(destX, destZ, level); + if (southWestClockwise && !northWestClockwise) { + // West + let offZ: number = 0; + if (diagonal >= -srcWidth) { + offZ = this.coerceAtMost(diagonal + srcWidth, destHeight - 1); + } else if (anti > -srcWidth) { + offZ = -(srcWidth + anti); + } + return target.translate(-srcWidth, offZ, 0); + } else if (northWestClockwise && !northEastClockwise) { + // North + let offX: number = 0; + if (anti >= -destHeight) { + offX = this.coerceAtMost(anti + destHeight, destWidth - 1); + } else if (diagonal < destHeight) { + offX = this.coerceAtLeast(diagonal - destHeight, -(srcWidth - 1)); + } + return target.translate(offX, destHeight, 0); + } else if (northEastClockwise && !southEastClockwise) { + // East + let offZ: number = 0; + if (anti <= destWidth) { + offZ = destHeight - anti; + } else if (diagonal < destWidth) { + offZ = this.coerceAtLeast(diagonal - destWidth, -(srcHeight - 1)); + } + return target.translate(destWidth, offZ, 0); + } else { + if (!(southEastClockwise && !southWestClockwise)) { + // South + throw new Error(`Failed requirement. southEastClockwise was: ${southEastClockwise}, southWestClockwise was: ${southWestClockwise}.`); + } + let offX: number = 0; + if (diagonal > -srcHeight) { + offX = this.coerceAtMost(diagonal + srcHeight, destWidth - 1); + } else if (anti < srcHeight) { + offX = this.coerceAtLeast(anti - srcHeight, -(srcHeight - 1)); + } + return target.translate(offX, -srcHeight, 0); + } + } + + /** + * Ensures that this value is not greater than the specified maximumValue. + */ + private coerceAtMost(value: number, maximumValue: number): number { + return value > maximumValue ? maximumValue : value; + } + + /** + * Ensures that this value is not less than the specified minimumValue. + */ + private coerceAtLeast(value: number, minimumValue: number): number { + return value < minimumValue ? minimumValue : value; + } +} diff --git a/src/rsmod/PathFinder.ts b/src/rsmod/PathFinder.ts new file mode 100644 index 0000000..bc9288c --- /dev/null +++ b/src/rsmod/PathFinder.ts @@ -0,0 +1,682 @@ +// noinspection DuplicatedCode + +import CollisionFlagMap from './collision/CollisionFlagMap'; +import CollisionStrategy from './collision/CollisionStrategy'; +import CollisionStrategies from './collision/CollisionStrategies'; +import Route from './Route'; +import DirectionFlag from './flag/DirectionFlag'; +import RouteCoordinates from './RouteCoordinates'; +import CollisionFlag from './flag/CollisionFlag'; +import ReachStrategy from './reach/ReachStrategy'; +import RotationUtils from './utils/RotationUtils'; + +export default class PathFinder { + private static readonly DEFAULT_SEARCH_MAP_SIZE: number = 128; + private static readonly DEFAULT_RING_BUFFER_SIZE: number = 4096; + private static readonly DEFAULT_DISTANCE_VALUE: number = 99_999_999; + private static readonly DEFAULT_SRC_DIRECTION_VALUE: number = 99; + private static readonly MAX_ALTERNATIVE_ROUTE_LOWEST_COST: number = 1000; + private static readonly MAX_ALTERNATIVE_ROUTE_SEEK_RANGE: number = 100; + private static readonly MAX_ALTERNATIVE_ROUTE_DISTANCE_FROM_DESTINATION: number = 10; + + private readonly flags: CollisionFlagMap; + private readonly searchMapSize: number; + private readonly ringBufferSize: number; + private readonly directions: Int32Array; + private readonly distances: Int32Array; + private readonly validLocalX: Int32Array; + private readonly validLocalZ: Int32Array; + + private currLocalX: number = 0; + private currLocalZ: number = 0; + private bufReaderIndex: number = 0; + private bufWriterIndex: number = 0; + + constructor(flags: CollisionFlagMap, searchMapSize: number = PathFinder.DEFAULT_SEARCH_MAP_SIZE, ringBufferSize: number = PathFinder.DEFAULT_RING_BUFFER_SIZE) { + this.flags = flags; + this.searchMapSize = searchMapSize; + this.ringBufferSize = ringBufferSize; + this.directions = new Int32Array(searchMapSize * searchMapSize); + this.distances = new Int32Array(searchMapSize * searchMapSize).fill(PathFinder.DEFAULT_DISTANCE_VALUE); + this.validLocalX = new Int32Array(ringBufferSize); + this.validLocalZ = new Int32Array(ringBufferSize); + } + + findPath( + level: number, + srcX: number, + srcZ: number, + destX: number, + destZ: number, + srcSize: number = 1, + destWidth: number = 1, + destHeight: number = 1, + angle: number = 0, + shape: number = -1, + moveNear: boolean = true, + blockAccessFlags: number = 0, + maxWaypoints: number = 25, + collision: CollisionStrategy = CollisionStrategies.NORMAL + ): Route { + if (!(srcX >= 0 && srcX <= 0x7fff && srcZ >= 0 && srcZ <= 0x7fff)) { + throw new Error(`Failed requirement. srcX was: ${srcX}, srcZ was: ${srcZ}.`); + } + if (!(destX >= 0 && destX <= 0x7fff && destZ >= 0 && destZ <= 0x7fff)) { + throw new Error(`Failed requirement. destX was: ${destX}, destZ was: ${destZ}.`); + } + if (!(level >= 0 && level <= 0x3)) { + throw new Error(`Failed requirement. level was: ${level}.`); + } + this.reset(); + const baseX: number = srcX - this.searchMapSize / 2; + const baseZ: number = srcZ - this.searchMapSize / 2; + const localSrcX: number = srcX - baseX; + const localSrcZ: number = srcZ - baseZ; + const localDestX: number = destX - baseX; + const localDestZ: number = destZ - baseZ; + this.appendDirection(localSrcX, localSrcZ, PathFinder.DEFAULT_SRC_DIRECTION_VALUE, 0); + + let pathFound: boolean; + switch (srcSize) { + case 1: + pathFound = this.findPath1(baseX, baseZ, level, localDestX, localDestZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags, collision); + break; + case 2: + pathFound = this.findPath2(baseX, baseZ, level, localDestX, localDestZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags, collision); + break; + default: + pathFound = this.findPathN(baseX, baseZ, level, localDestX, localDestZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags, collision); + break; + } + if (!pathFound) { + if (!moveNear) { + return Route.FAILED; + } + const foundApproachPoint: boolean = this.findClosestApproachPoint(localDestX, localDestZ, RotationUtils.rotate(angle, destWidth, destHeight), RotationUtils.rotate(angle, destHeight, destWidth)); + if (!foundApproachPoint) { + return Route.FAILED; + } + } + const waypoints: RouteCoordinates[] = []; + let nextDir: number = this.directions[this.localIndex(this.currLocalX, this.currLocalZ)]; + let currDir: number = -1; + + for (let index: number = 0; index < this.directions.length; index++) { + if (this.currLocalX === localSrcX && this.currLocalZ === localSrcZ) { + break; + } + if (currDir !== nextDir) { + currDir = nextDir; + if (waypoints.length >= maxWaypoints) { + waypoints.pop(); + } + const coords: RouteCoordinates = new RouteCoordinates(baseX + this.currLocalX, baseZ + this.currLocalZ, level); + waypoints.unshift(coords); + } + if ((currDir & DirectionFlag.EAST) !== 0) { + this.currLocalX++; + } else if ((currDir & DirectionFlag.WEST) !== 0) { + this.currLocalX--; + } + if ((currDir & DirectionFlag.NORTH) !== 0) { + this.currLocalZ++; + } else if ((currDir & DirectionFlag.SOUTH) !== 0) { + this.currLocalZ--; + } + nextDir = this.directions[this.localIndex(this.currLocalX, this.currLocalZ)]; + } + return new Route(waypoints, !pathFound, true); + } + + private findPath1( + baseX: number, + baseZ: number, + level: number, + localDestX: number, + localDestZ: number, + destWidth: number, + destHeight: number, + srcSize: number, + angle: number, + shape: number, + blockAccessFlags: number, + collision: CollisionStrategy + ): boolean { + let x: number; + let z: number; + let clipFlag: number; + let dirFlag: number; + const relativeSearchSize: number = this.searchMapSize - 1; + + while (this.bufWriterIndex !== this.bufReaderIndex) { + this.currLocalX = this.validLocalX[this.bufReaderIndex]; + this.currLocalZ = this.validLocalZ[this.bufReaderIndex]; + this.bufReaderIndex = (this.bufReaderIndex + 1) & (this.ringBufferSize - 1); + + const reached: boolean = ReachStrategy.reached(this.flags, level, this.currLocalX + baseX, this.currLocalZ + baseZ, localDestX + baseX, localDestZ + baseZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags); + if (reached) { + return true; + } + + const nextDistance: number = this.distances[this.localIndex(this.currLocalX, this.currLocalZ)] + 1; + + /* east to west */ + x = this.currLocalX - 1; + z = this.currLocalZ; + clipFlag = CollisionFlag.BLOCK_WEST; + dirFlag = DirectionFlag.EAST; + if (this.currLocalX > 0 && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), clipFlag)) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* west to east */ + x = this.currLocalX + 1; + z = this.currLocalZ; + clipFlag = CollisionFlag.BLOCK_EAST; + dirFlag = DirectionFlag.WEST; + if (this.currLocalX < relativeSearchSize && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), clipFlag)) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north to south */ + x = this.currLocalX; + z = this.currLocalZ - 1; + clipFlag = CollisionFlag.BLOCK_SOUTH; + dirFlag = DirectionFlag.NORTH; + if (this.currLocalZ > 0 && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), clipFlag)) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south to north */ + x = this.currLocalX; + z = this.currLocalZ + 1; + clipFlag = CollisionFlag.BLOCK_NORTH; + dirFlag = DirectionFlag.SOUTH; + if (this.currLocalZ < relativeSearchSize && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), clipFlag)) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north-east to south-west */ + x = this.currLocalX - 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_EAST; + if ( + this.currLocalX > 0 && + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ, level), CollisionFlag.BLOCK_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, z, level), CollisionFlag.BLOCK_SOUTH) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north-west to south-east */ + x = this.currLocalX + 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_WEST; + if ( + this.currLocalX < relativeSearchSize && + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ, level), CollisionFlag.BLOCK_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, z, level), CollisionFlag.BLOCK_SOUTH) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south-east to north-west */ + x = this.currLocalX - 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_EAST; + if ( + this.currLocalX > 0 && + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_NORTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ, level), CollisionFlag.BLOCK_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, z, level), CollisionFlag.BLOCK_NORTH) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south-west to north-east */ + x = this.currLocalX + 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_WEST; + if ( + this.currLocalX < relativeSearchSize && + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_NORTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ, level), CollisionFlag.BLOCK_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, z, level), CollisionFlag.BLOCK_NORTH) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + return false; + } + + private findPath2( + baseX: number, + baseZ: number, + level: number, + localDestX: number, + localDestZ: number, + destWidth: number, + destHeight: number, + srcSize: number, + angle: number, + shape: number, + blockAccessFlags: number, + collision: CollisionStrategy + ): boolean { + let x: number; + let z: number; + let dirFlag: number; + const relativeSearchSize: number = this.searchMapSize - 2; + + while (this.bufWriterIndex !== this.bufReaderIndex) { + this.currLocalX = this.validLocalX[this.bufReaderIndex]; + this.currLocalZ = this.validLocalZ[this.bufReaderIndex]; + this.bufReaderIndex = (this.bufReaderIndex + 1) & (this.ringBufferSize - 1); + + const reached: boolean = ReachStrategy.reached(this.flags, level, this.currLocalX + baseX, this.currLocalZ + baseZ, localDestX + baseX, localDestZ + baseZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags); + if (reached) { + return true; + } + + const nextDistance: number = this.distances[this.localIndex(this.currLocalX, this.currLocalZ)] + 1; + + /* east to west */ + x = this.currLocalX - 1; + z = this.currLocalZ; + dirFlag = DirectionFlag.EAST; + if ( + this.currLocalX > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + 1, level), CollisionFlag.BLOCK_NORTH_WEST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* west to east */ + x = this.currLocalX + 1; + z = this.currLocalZ; + dirFlag = DirectionFlag.WEST; + if ( + this.currLocalX < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, z, level), CollisionFlag.BLOCK_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, this.currLocalZ + 1, level), CollisionFlag.BLOCK_NORTH_EAST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north to south */ + x = this.currLocalX; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH; + if ( + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 1, z, level), CollisionFlag.BLOCK_SOUTH_EAST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south to north */ + x = this.currLocalX; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH; + if ( + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + 2, level), CollisionFlag.BLOCK_NORTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 1, this.currLocalZ + 2, level), CollisionFlag.BLOCK_NORTH_EAST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north-east to south-west */ + x = this.currLocalX - 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_EAST; + if ( + this.currLocalX > 0 && + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, z, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* north-west to south-east */ + x = this.currLocalX + 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_WEST; + if ( + this.currLocalX < relativeSearchSize && + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, z, level), CollisionFlag.BLOCK_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, this.currLocalZ, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south-east to north-west */ + x = this.currLocalX - 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_EAST; + if ( + this.currLocalX > 0 && + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + 2, level), CollisionFlag.BLOCK_NORTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX, this.currLocalZ + 2, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + + /* south-west to north-east */ + x = this.currLocalX + 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_WEST; + if ( + this.currLocalX < relativeSearchSize && + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + 2, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, this.currLocalZ + 2, level), CollisionFlag.BLOCK_NORTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + 2, z, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST) + ) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + return false; + } + + private findPathN( + baseX: number, + baseZ: number, + level: number, + localDestX: number, + localDestZ: number, + destWidth: number, + destHeight: number, + srcSize: number, + angle: number, + shape: number, + blockAccessFlags: number, + collision: CollisionStrategy + ): boolean { + let x: number; + let z: number; + let dirFlag: number; + const relativeSearchSize: number = this.searchMapSize - srcSize; + + while (this.bufWriterIndex !== this.bufReaderIndex) { + this.currLocalX = this.validLocalX[this.bufReaderIndex]; + this.currLocalZ = this.validLocalZ[this.bufReaderIndex]; + this.bufReaderIndex = (this.bufReaderIndex + 1) & (this.ringBufferSize - 1); + + const reached: boolean = ReachStrategy.reached(this.flags, level, this.currLocalX + baseX, this.currLocalZ + baseZ, localDestX + baseX, localDestZ + baseZ, destWidth, destHeight, srcSize, angle, shape, blockAccessFlags); + if (reached) { + return true; + } + + const nextDistance: number = this.distances[this.localIndex(this.currLocalX, this.currLocalZ)] + 1; + + /* east to west */ + x = this.currLocalX - 1; + z = this.currLocalZ; + dirFlag = DirectionFlag.EAST; + if ( + this.currLocalX > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + srcSize - 1, level), CollisionFlag.BLOCK_NORTH_WEST) + ) { + const clipFlag: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize - 1; index++) { + if (!collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + index, level), clipFlag)) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* west to east */ + x = this.currLocalX + 1; + z = this.currLocalZ; + dirFlag = DirectionFlag.WEST; + if ( + this.currLocalX < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, z, level), CollisionFlag.BLOCK_SOUTH_EAST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, this.currLocalZ + srcSize - 1, level), CollisionFlag.BLOCK_NORTH_EAST) + ) { + const clipFlag: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize - 1; index++) { + if (!collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, this.currLocalZ + index, level), clipFlag)) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* north to south */ + x = this.currLocalX; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH; + if ( + this.currLocalZ > 0 && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize - 1, z, level), CollisionFlag.BLOCK_SOUTH_EAST) + ) { + const clipFlag: number = CollisionFlag.BLOCK_NORTH_EAST_AND_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize - 1; index++) { + if (!collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + index, z, level), clipFlag)) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* south to north */ + x = this.currLocalX; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH; + if ( + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + srcSize, level), CollisionFlag.BLOCK_NORTH_WEST) && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize - 1, this.currLocalZ + srcSize, level), CollisionFlag.BLOCK_NORTH_EAST) + ) { + const clipFlag: number = CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize - 1; index++) { + if (!collision.canMove(this.collisionFlag(baseX, baseZ, x + index, this.currLocalZ + srcSize, level), clipFlag)) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* north-east to south-west */ + x = this.currLocalX - 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_EAST; + if (this.currLocalX > 0 && this.currLocalZ > 0 && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, z, level), CollisionFlag.BLOCK_SOUTH_WEST)) { + const clipFlag1: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST; + const clipFlag2: number = CollisionFlag.BLOCK_NORTH_EAST_AND_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize; index++) { + if (!collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + index - 1, level), clipFlag1) || !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + index - 1, z, level), clipFlag2)) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* north-west to south-east */ + x = this.currLocalX + 1; + z = this.currLocalZ - 1; + dirFlag = DirectionFlag.NORTH_WEST; + if (this.currLocalX < relativeSearchSize && this.currLocalZ > 0 && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, z, level), CollisionFlag.BLOCK_SOUTH_EAST)) { + const clipFlag1: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST; + const clipFlag2: number = CollisionFlag.BLOCK_NORTH_EAST_AND_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize; index++) { + if ( + !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, this.currLocalZ + index - 1, level), clipFlag1) || + !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + index, z, level), clipFlag2) + ) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* south-east to north-west */ + x = this.currLocalX - 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_EAST; + if (this.currLocalX > 0 && this.currLocalZ < relativeSearchSize && this.directions[this.localIndex(x, z)] === 0 && collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + srcSize, level), CollisionFlag.BLOCK_NORTH_WEST)) { + const clipFlag1: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST; + const clipFlag2: number = CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize; index++) { + if ( + !collision.canMove(this.collisionFlag(baseX, baseZ, x, this.currLocalZ + index, level), clipFlag1) || + !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + index - 1, this.currLocalZ + srcSize, level), clipFlag2) + ) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + + /* south-west to north-east */ + x = this.currLocalX + 1; + z = this.currLocalZ + 1; + dirFlag = DirectionFlag.SOUTH_WEST; + if ( + this.currLocalX < relativeSearchSize && + this.currLocalZ < relativeSearchSize && + this.directions[this.localIndex(x, z)] === 0 && + collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, this.currLocalZ + srcSize, level), CollisionFlag.BLOCK_NORTH_EAST) + ) { + const clipFlag1: number = CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST; + const clipFlag2: number = CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST; + let blocked: boolean = false; + for (let index: number = 1; index < srcSize; index++) { + if ( + !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + index, this.currLocalZ + srcSize, level), clipFlag1) || + !collision.canMove(this.collisionFlag(baseX, baseZ, this.currLocalX + srcSize, this.currLocalZ + index, level), clipFlag2) + ) { + blocked = true; + break; + } + } + if (!blocked) { + this.appendDirection(x, z, dirFlag, nextDistance); + } + } + } + return false; + } + + private findClosestApproachPoint(localDestX: number, localDestZ: number, width: number, height: number): boolean { + let lowestCost: number = PathFinder.MAX_ALTERNATIVE_ROUTE_LOWEST_COST; + let maxAlternativePath: number = PathFinder.MAX_ALTERNATIVE_ROUTE_SEEK_RANGE; + const alternativeRouteRange: number = PathFinder.MAX_ALTERNATIVE_ROUTE_DISTANCE_FROM_DESTINATION; + for (let x: number = localDestX - alternativeRouteRange; x <= localDestX + alternativeRouteRange; x++) { + for (let z: number = localDestZ - alternativeRouteRange; z <= localDestZ + alternativeRouteRange; z++) { + if (!(x >= 0 && x < this.searchMapSize) || !(z >= 0 && z < this.searchMapSize) || this.distances[this.localIndex(x, z)] >= PathFinder.MAX_ALTERNATIVE_ROUTE_SEEK_RANGE) { + continue; + } + + let dx: number = 0; + if (x < localDestX) { + dx = localDestX - x; + } else if (x > localDestX + width - 1) { + dx = x - (width + localDestX - 1); + } + + let dz: number = 0; + if (z < localDestZ) { + dz = localDestZ - z; + } else if (z > localDestZ + height - 1) { + dz = z - (height + localDestZ - 1); + } + const cost: number = dx * dx + dz * dz; + if (cost < lowestCost || (cost === lowestCost && maxAlternativePath > this.distances[this.localIndex(x, z)])) { + this.currLocalX = x; + this.currLocalZ = z; + lowestCost = cost; + maxAlternativePath = this.distances[this.localIndex(x, z)]; + } + } + } + return lowestCost !== PathFinder.MAX_ALTERNATIVE_ROUTE_LOWEST_COST; + } + + private localIndex(x: number, z: number): number { + return x * this.searchMapSize + z; + } + + private collisionFlag(baseX: number, baseZ: number, localX: number, localZ: number, level: number): number { + return this.flags.get(baseX + localX, baseZ + localZ, level); + } + + private appendDirection(x: number, z: number, direction: number, distance: number): void { + const index: number = this.localIndex(x, z); + this.directions[index] = direction; + this.distances[index] = distance; + this.validLocalX[this.bufWriterIndex] = x; + this.validLocalZ[this.bufWriterIndex] = z; + this.bufWriterIndex = (this.bufWriterIndex + 1) & (this.ringBufferSize - 1); + } + + private reset(): void { + this.directions.fill(0); + this.distances.fill(PathFinder.DEFAULT_DISTANCE_VALUE); + this.bufReaderIndex = 0; + this.bufWriterIndex = 0; + } +} diff --git a/src/rsmod/RayCast.ts b/src/rsmod/RayCast.ts new file mode 100644 index 0000000..235745c --- /dev/null +++ b/src/rsmod/RayCast.ts @@ -0,0 +1,16 @@ +import RouteCoordinates from './RouteCoordinates'; + +export default class RayCast { + static readonly FAILED: RayCast = new RayCast([], false, false); + static readonly EMPTY_SUCCESS: RayCast = new RayCast([], false, true); + + readonly coordinates: RouteCoordinates[]; + readonly alternative: boolean; + readonly success: boolean; + + constructor(coordinates: RouteCoordinates[], alternative: boolean, success: boolean) { + this.coordinates = coordinates; + this.alternative = alternative; + this.success = success; + } +} diff --git a/src/rsmod/Route.ts b/src/rsmod/Route.ts new file mode 100644 index 0000000..46f51a5 --- /dev/null +++ b/src/rsmod/Route.ts @@ -0,0 +1,19 @@ +import RouteCoordinates from './RouteCoordinates'; + +export default class Route { + static readonly FAILED: Route = new Route([], false, false); + + readonly waypoints: RouteCoordinates[]; + readonly alternative: boolean; + readonly success: boolean; + + constructor(waypoints: RouteCoordinates[], alternative: boolean, success: boolean) { + this.waypoints = waypoints; + this.alternative = alternative; + this.success = success; + } + + get failed(): boolean { + return !this.success; + } +} diff --git a/src/rsmod/RouteCoordinates.ts b/src/rsmod/RouteCoordinates.ts new file mode 100644 index 0000000..be4e7be --- /dev/null +++ b/src/rsmod/RouteCoordinates.ts @@ -0,0 +1,28 @@ +export default class RouteCoordinates { + private static readonly COORD_MASK: number = 0x3fff; + private static readonly LEVEL_MASK: number = 0x3; + private static readonly X_BITS: number = 14; + private static readonly LEVEL_BITS: number = 28; + + private readonly packed: number; + + constructor(x: number, z: number, level: number) { + this.packed = (z & RouteCoordinates.COORD_MASK) | ((x & RouteCoordinates.COORD_MASK) << RouteCoordinates.X_BITS) | ((level & RouteCoordinates.LEVEL_MASK) << RouteCoordinates.LEVEL_BITS); + } + + get x(): number { + return (this.packed >> RouteCoordinates.X_BITS) & RouteCoordinates.COORD_MASK; + } + + get z(): number { + return this.packed & RouteCoordinates.COORD_MASK; + } + + get level(): number { + return (this.packed >> RouteCoordinates.LEVEL_BITS) & RouteCoordinates.LEVEL_MASK; + } + + translate(offsetX: number, offsetZ: number, offsetLevel: number): RouteCoordinates { + return new RouteCoordinates(this.x + offsetX, this.z + offsetZ, this.level + offsetLevel); + } +} diff --git a/src/rsmod/StepValidator.ts b/src/rsmod/StepValidator.ts new file mode 100644 index 0000000..5690721 --- /dev/null +++ b/src/rsmod/StepValidator.ts @@ -0,0 +1,232 @@ +import CollisionFlagMap from './collision/CollisionFlagMap'; +import CollisionStrategy from './collision/CollisionStrategy'; +import CollisionFlag from './flag/CollisionFlag'; + +export default class StepValidator { + private readonly flags: CollisionFlagMap; + + constructor(flags: CollisionFlagMap) { + this.flags = flags; + } + + canTravel(level: number, x: number, z: number, offsetX: number, offsetZ: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + let blocked: boolean; + if (offsetX === 0 && offsetZ === -1) { + blocked = this.isBlockedSouth(level, x, z, size, extraFlag, collision); + } else if (offsetX === 0 && offsetZ === 1) { + blocked = this.isBlockedNorth(level, x, z, size, extraFlag, collision); + } else if (offsetX === -1 && offsetZ === 0) { + blocked = this.isBlockedWest(level, x, z, size, extraFlag, collision); + } else if (offsetX === 1 && offsetZ === 0) { + blocked = this.isBlockedEast(level, x, z, size, extraFlag, collision); + } else if (offsetX === -1 && offsetZ === -1) { + blocked = this.isBlockedSouthWest(level, x, z, size, extraFlag, collision); + } else if (offsetX === -1 && offsetZ === 1) { + blocked = this.isBlockedNorthWest(level, x, z, size, extraFlag, collision); + } else if (offsetX === 1 && offsetZ === -1) { + blocked = this.isBlockedSouthEast(level, x, z, size, extraFlag, collision); + } else if (offsetX === 1 && offsetZ === 1) { + blocked = this.isBlockedNorthEast(level, x, z, size, extraFlag, collision); + } else { + throw new Error(`Invalid offsets: offsetX was: ${offsetX}, offsetZ was: ${offsetZ}`); + } + return !blocked; + } + + isBlockedSouth(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return !collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_SOUTH | extraFlag); + case 2: + return !collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag) || !collision.canMove(this.flags.get(x + 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag); + default: + if (!collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + size - 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag)) { + return true; + } + for (let midX: number = x + 1; midX < x + size - 1; midX++) { + if (!collision.canMove(this.flags.get(midX, z - 1, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedNorth(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return !collision.canMove(this.flags.get(x, z + 1, level), CollisionFlag.BLOCK_NORTH | extraFlag); + case 2: + return !collision.canMove(this.flags.get(x, z + 2, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag) || !collision.canMove(this.flags.get(x + 1, z + 2, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag); + default: + if (!collision.canMove(this.flags.get(x, z + size, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + size - 1, z + size, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag)) { + return true; + } + for (let midX: number = x + 1; midX < x + size - 1; midX++) { + if (!collision.canMove(this.flags.get(midX, z + size, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedWest(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return !collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_WEST | extraFlag); + case 2: + return !collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag) || !collision.canMove(this.flags.get(x - 1, z + 1, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag); + default: + if (!collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x - 1, z + size - 1, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag)) { + return true; + } + for (let midZ: number = z + 1; midZ < z + size - 1; midZ++) { + if (!collision.canMove(this.flags.get(x - 1, midZ, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedEast(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return !collision.canMove(this.flags.get(x + 1, z, level), CollisionFlag.BLOCK_EAST | extraFlag); + case 2: + return !collision.canMove(this.flags.get(x + 2, z, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag) || !collision.canMove(this.flags.get(x + 2, z + 1, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag); + default: + if (!collision.canMove(this.flags.get(x + size, z, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + size, z + size - 1, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag)) { + return true; + } + for (let midZ: number = z + 1; midZ < z + size - 1; midZ++) { + if (!collision.canMove(this.flags.get(x + size, midZ, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedSouthWest(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return ( + !collision.canMove(this.flags.get(x - 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag) || + !collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_WEST | extraFlag) || + !collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_SOUTH | extraFlag) + ); + case 2: + return ( + !collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x - 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag) || + !collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST | extraFlag) + ); + default: + if (!collision.canMove(this.flags.get(x - 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_WEST | extraFlag)) { + return true; + } + for (let mid: number = 1; mid < size; mid++) { + if (!collision.canMove(this.flags.get(x - 1, z + mid - 1, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + mid - 1, z - 1, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedNorthWest(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return ( + !collision.canMove(this.flags.get(x - 1, z + 1, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag) || + !collision.canMove(this.flags.get(x - 1, z, level), CollisionFlag.BLOCK_WEST | extraFlag) || + !collision.canMove(this.flags.get(x, z + 1, level), CollisionFlag.BLOCK_NORTH | extraFlag) + ); + case 2: + return ( + !collision.canMove(this.flags.get(x - 1, z + 1, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x - 1, z + 2, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag) || + !collision.canMove(this.flags.get(x, z + 2, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST | extraFlag) + ); + default: + if (!collision.canMove(this.flags.get(x - 1, z + size, level), CollisionFlag.BLOCK_NORTH_WEST | extraFlag)) { + return true; + } + for (let mid: number = 1; mid < size; mid++) { + if (!collision.canMove(this.flags.get(x - 1, z + mid, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_EAST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + mid - 1, z + size, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedSouthEast(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return ( + !collision.canMove(this.flags.get(x + 1, z - 1, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x + 1, z, level), CollisionFlag.BLOCK_EAST | extraFlag) || + !collision.canMove(this.flags.get(x, z - 1, level), CollisionFlag.BLOCK_SOUTH | extraFlag) + ); + case 2: + return ( + !collision.canMove(this.flags.get(x + 1, z - 1, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST | extraFlag) || + !collision.canMove(this.flags.get(x + 2, z - 1, level), CollisionFlag.BLOCK_SOUTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x + 2, z, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST | extraFlag) + ); + default: + for (let mid: number = 1; mid < size; mid++) { + if (!collision.canMove(this.flags.get(x + size, z + mid - 1, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + mid, z - 1, level), CollisionFlag.BLOCK_NORTH_EAST_AND_WEST | extraFlag)) { + return true; + } + } + return false; + } + } + + isBlockedNorthEast(level: number, x: number, z: number, size: number, extraFlag: number, collision: CollisionStrategy): boolean { + switch (size) { + case 1: + return ( + !collision.canMove(this.flags.get(x + 1, z + 1, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x + 1, z, level), CollisionFlag.BLOCK_EAST | extraFlag) || + !collision.canMove(this.flags.get(x, z + 1, level), CollisionFlag.BLOCK_NORTH | extraFlag) + ); + case 2: + return ( + !collision.canMove(this.flags.get(x + 1, z + 2, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST | extraFlag) || + !collision.canMove(this.flags.get(x + 2, z + 2, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag) || + !collision.canMove(this.flags.get(x + 2, z + 1, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST | extraFlag) + ); + default: + if (!collision.canMove(this.flags.get(x + size, z + size, level), CollisionFlag.BLOCK_NORTH_EAST | extraFlag)) { + return true; + } + for (let mid: number = 1; mid < size; mid++) { + if (!collision.canMove(this.flags.get(x + mid, z + size, level), CollisionFlag.BLOCK_SOUTH_EAST_AND_WEST | extraFlag)) { + return true; + } else if (!collision.canMove(this.flags.get(x + size, z + mid, level), CollisionFlag.BLOCK_NORTH_AND_SOUTH_WEST | extraFlag)) { + return true; + } + } + return false; + } + } +} diff --git a/src/rsmod/collision/CollisionFlagMap.ts b/src/rsmod/collision/CollisionFlagMap.ts new file mode 100644 index 0000000..272031e --- /dev/null +++ b/src/rsmod/collision/CollisionFlagMap.ts @@ -0,0 +1,71 @@ +import CollisionFlag from '../flag/CollisionFlag'; + +export default class CollisionFlagMap { + // 256x256 mapsquares (room for instances): 2048 * 2048 * 4 = ((256 * 256) * 64) * 4 + // 60x160 mapsquares (we don't support instances): ((60 * 160) * 64) * 4 + private static readonly TOTAL_ZONE_COUNT: number = 60 * 160 * 64 * 4; + private static readonly ZONE_TILE_COUNT: number = 8 * 8; + + private static tileIndex(x: number, z: number): number { + return (x & 0x7) | ((z & 0x7) << 3); + } + + private static zoneIndex(x: number, z: number, level: number): number { + return ((x >> 3) & 0x7ff) | (((z >> 3) & 0x7ff) << 11) | ((level & 0x3) << 22); + } + + flags: Array = new Array(CollisionFlagMap.TOTAL_ZONE_COUNT); + + get(absoluteX: number, absoluteZ: number, level: number): number { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + const tileIndex: number = CollisionFlagMap.tileIndex(absoluteX, absoluteZ); + return this.flags?.[zoneIndex]?.[tileIndex] ?? CollisionFlag.NULL; + } + + set(absoluteX: number, absoluteZ: number, level: number, mask: number): void { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + const tileIndex: number = CollisionFlagMap.tileIndex(absoluteX, absoluteZ); + const tiles: Int32Array = this.flags[zoneIndex] ?? this.allocateIfAbsent(absoluteX, absoluteZ, level); + tiles[tileIndex] = mask; + } + + add(absoluteX: number, absoluteZ: number, level: number, mask: number): void { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + const tileIndex: number = CollisionFlagMap.tileIndex(absoluteX, absoluteZ); + const currentFlags: number = this.flags?.[zoneIndex]?.[tileIndex] ?? CollisionFlag.OPEN; + this.set(absoluteX, absoluteZ, level, currentFlags | mask); + } + + remove(absoluteX: number, absoluteZ: number, level: number, mask: number): void { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + const tileIndex: number = CollisionFlagMap.tileIndex(absoluteX, absoluteZ); + const currentFlags: number = this.flags?.[zoneIndex]?.[tileIndex] ?? CollisionFlag.OPEN; + this.set(absoluteX, absoluteZ, level, currentFlags & ~mask); + } + + allocateIfAbsent(absoluteX: number, absoluteZ: number, level: number): Int32Array { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + const existingFlags: Int32Array | null = this.flags[zoneIndex]; + if (existingFlags != null) { + return existingFlags; + } + + const tileFlags: Int32Array = new Int32Array(CollisionFlagMap.ZONE_TILE_COUNT); + this.flags[zoneIndex] = tileFlags; + return tileFlags; + } + + deallocateIfPresent(absoluteX: number, absoluteZ: number, level: number): void { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + this.flags[zoneIndex] = null; + } + + isZoneAllocated(absoluteX: number, absoluteZ: number, level: number): boolean { + const zoneIndex: number = CollisionFlagMap.zoneIndex(absoluteX, absoluteZ, level); + return this.flags[zoneIndex] != null; + } + + isFlagged(x: number, z: number, level: number, flags: number): boolean { + return (this.get(x, z, level) & flags) !== CollisionFlag.OPEN; + } +} diff --git a/src/rsmod/collision/CollisionStrategies.ts b/src/rsmod/collision/CollisionStrategies.ts new file mode 100644 index 0000000..ab9af31 --- /dev/null +++ b/src/rsmod/collision/CollisionStrategies.ts @@ -0,0 +1,57 @@ +import CollisionStrategy from './CollisionStrategy'; +import CollisionFlag from '../flag/CollisionFlag'; + +class Normal implements CollisionStrategy { + canMove(tileFlag: number, blockFlag: number): boolean { + return (tileFlag & blockFlag) === CollisionFlag.OPEN; + } +} + +class Blocked implements CollisionStrategy { + canMove(tileFlag: number, blockFlag: number): boolean { + const flag: number = blockFlag & ~CollisionFlag.FLOOR; + return (tileFlag & flag) === 0 && (tileFlag & CollisionFlag.FLOOR) !== CollisionFlag.OPEN; + } +} + +class Indoors implements CollisionStrategy { + canMove(tileFlag: number, blockFlag: number): boolean { + return (tileFlag & blockFlag) === 0 && (tileFlag & CollisionFlag.ROOF) !== CollisionFlag.OPEN; + } +} + +class Outdoors implements CollisionStrategy { + canMove(tileFlag: number, blockFlag: number): boolean { + return (tileFlag & (blockFlag | CollisionFlag.ROOF)) === CollisionFlag.OPEN; + } +} + +class LineOfSight implements CollisionStrategy { + static BLOCK_MOVEMENT: number = + CollisionFlag.WALL_NORTH_WEST | + CollisionFlag.WALL_NORTH | + CollisionFlag.WALL_NORTH_EAST | + CollisionFlag.WALL_EAST | + CollisionFlag.WALL_SOUTH_EAST | + CollisionFlag.WALL_SOUTH | + CollisionFlag.WALL_SOUTH_WEST | + CollisionFlag.WALL_WEST | + CollisionFlag.LOC; + + static BLOCK_ROUTE: number = CollisionFlag.PLAYER; + + canMove(tileFlag: number, blockFlag: number): boolean { + const movementFlags: number = (blockFlag & LineOfSight.BLOCK_MOVEMENT) << 9; + const routeFlags: number = LineOfSight.BLOCK_ROUTE; + const finalBlockFlag: number = movementFlags | routeFlags; + return (tileFlag & finalBlockFlag) === CollisionFlag.OPEN; + } +} + +export default class CollisionStrategies { + static NORMAL: CollisionStrategy = new Normal(); + static BLOCKED: CollisionStrategy = new Blocked(); + static INDOORS: CollisionStrategy = new Indoors(); + static OUTDOORS: CollisionStrategy = new Outdoors(); + static LINE_OF_SIGHT: CollisionStrategy = new LineOfSight(); +} diff --git a/src/rsmod/collision/CollisionStrategy.ts b/src/rsmod/collision/CollisionStrategy.ts new file mode 100644 index 0000000..3ac9e54 --- /dev/null +++ b/src/rsmod/collision/CollisionStrategy.ts @@ -0,0 +1,5 @@ +interface CollisionStrategy { + canMove(tileFlag: number, blockFlag: number): boolean; +} + +export default CollisionStrategy; diff --git a/src/rsmod/flag/BlockAccessFlag.ts b/src/rsmod/flag/BlockAccessFlag.ts new file mode 100644 index 0000000..6020416 --- /dev/null +++ b/src/rsmod/flag/BlockAccessFlag.ts @@ -0,0 +1,6 @@ +export default class BlockAccessFlag { + static readonly BLOCK_NORTH: number = 0x1; + static readonly BLOCK_EAST: number = 0x2; + static readonly BLOCK_SOUTH: number = 0x4; + static readonly BLOCK_WEST: number = 0x8; +} diff --git a/src/rsmod/flag/CollisionFlag.ts b/src/rsmod/flag/CollisionFlag.ts new file mode 100644 index 0000000..6f7e42f --- /dev/null +++ b/src/rsmod/flag/CollisionFlag.ts @@ -0,0 +1,73 @@ +export default class CollisionFlag { + static readonly NULL: number = 0xffffffff; // -1 + static readonly OPEN: number = 0x0; + static readonly WALL_NORTH_WEST: number = 0x1; + static readonly WALL_NORTH: number = 0x2; + static readonly WALL_NORTH_EAST: number = 0x4; + static readonly WALL_EAST: number = 0x8; + static readonly WALL_SOUTH_EAST: number = 0x10; + static readonly WALL_SOUTH: number = 0x20; + static readonly WALL_SOUTH_WEST: number = 0x40; + static readonly WALL_WEST: number = 0x80; + static readonly LOC: number = 0x100; + static readonly WALL_NORTH_WEST_PROJ_BLOCKER: number = 0x200; + static readonly WALL_NORTH_PROJ_BLOCKER: number = 0x400; + static readonly WALL_NORTH_EAST_PROJ_BLOCKER: number = 0x800; + static readonly WALL_EAST_PROJ_BLOCKER: number = 0x1000; + static readonly WALL_SOUTH_EAST_PROJ_BLOCKER: number = 0x2000; + static readonly WALL_SOUTH_PROJ_BLOCKER: number = 0x4000; + static readonly WALL_SOUTH_WEST_PROJ_BLOCKER: number = 0x8000; + static readonly WALL_WEST_PROJ_BLOCKER: number = 0x10000; + static readonly LOC_PROJ_BLOCKER: number = 0x20000; + static readonly FLOOR_DECORATION: number = 0x40000; + + /** + * Custom flag dedicated to blocking NPCs. + * It should be noted that this is a custom flag, and you do not need to use this. + * The pathfinder takes the flag as a custom option, so you may use any other flag, this just defines + * a reliable constant to use + */ + static readonly NPC: number = 0x80000; + + /** + * Custom flag dedicated to blocking players, projectiles as well as NPCs. + * An example of a monster to set this flag is Brawler. Note that it is unclear if this flag + * prevents NPCs, as there is a separate flag option for it. + * This flag is similar to the one above, except it's strictly for NPCs. + */ + static readonly PLAYER: number = 0x100000; + + static readonly FLOOR: number = 0x200000; + + /** + * Roof flag, used to bind NPCs to not leave the buildings they spawn in. This is a custom flag. + */ + static readonly ROOF: number = 0x80000000; + + /* A shorthand combination of both the floor flags. */ + static readonly FLOOR_BLOCKED: number = CollisionFlag.FLOOR | CollisionFlag.FLOOR_DECORATION; + + static readonly WALK_BLOCKED: number = CollisionFlag.LOC | CollisionFlag.FLOOR_BLOCKED; + + /* Mixed masks of the above flags */ + static readonly BLOCK_WEST: number = CollisionFlag.WALL_EAST | CollisionFlag.WALK_BLOCKED; + static readonly BLOCK_EAST: number = CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + static readonly BLOCK_SOUTH: number = CollisionFlag.WALL_NORTH | CollisionFlag.WALK_BLOCKED; + static readonly BLOCK_NORTH: number = CollisionFlag.WALL_SOUTH | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_SOUTH_WEST: number = CollisionFlag.WALL_NORTH | CollisionFlag.WALL_NORTH_EAST | CollisionFlag.WALL_EAST | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_SOUTH_EAST: number = CollisionFlag.WALL_NORTH_WEST | CollisionFlag.WALL_NORTH | CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_NORTH_WEST: number = CollisionFlag.WALL_EAST | CollisionFlag.WALL_SOUTH_EAST | CollisionFlag.WALL_SOUTH | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_NORTH_EAST: number = CollisionFlag.WALL_SOUTH | CollisionFlag.WALL_SOUTH_WEST | CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_NORTH_AND_SOUTH_EAST: number = CollisionFlag.WALL_NORTH | CollisionFlag.WALL_NORTH_EAST | CollisionFlag.WALL_EAST | CollisionFlag.WALL_SOUTH_EAST | CollisionFlag.WALL_SOUTH | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_NORTH_AND_SOUTH_WEST: number = CollisionFlag.WALL_NORTH_WEST | CollisionFlag.WALL_NORTH | CollisionFlag.WALL_SOUTH | CollisionFlag.WALL_SOUTH_WEST | CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_NORTH_EAST_AND_WEST: number = CollisionFlag.WALL_NORTH_WEST | CollisionFlag.WALL_NORTH | CollisionFlag.WALL_NORTH_EAST | CollisionFlag.WALL_EAST | CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; + + static readonly BLOCK_SOUTH_EAST_AND_WEST: number = CollisionFlag.WALL_EAST | CollisionFlag.WALL_SOUTH_EAST | CollisionFlag.WALL_SOUTH | CollisionFlag.WALL_SOUTH_WEST | CollisionFlag.WALL_WEST | CollisionFlag.WALK_BLOCKED; +} diff --git a/src/rsmod/flag/DirectionFlag.ts b/src/rsmod/flag/DirectionFlag.ts new file mode 100644 index 0000000..8adbe8c --- /dev/null +++ b/src/rsmod/flag/DirectionFlag.ts @@ -0,0 +1,11 @@ +export default class DirectionFlag { + static readonly NORTH: number = 0x1; + static readonly EAST: number = 0x2; + static readonly SOUTH: number = 0x4; + static readonly WEST: number = 0x8; + + static readonly SOUTH_WEST: number = DirectionFlag.WEST | DirectionFlag.SOUTH; + static readonly NORTH_WEST: number = DirectionFlag.WEST | DirectionFlag.NORTH; + static readonly SOUTH_EAST: number = DirectionFlag.EAST | DirectionFlag.SOUTH; + static readonly NORTH_EAST: number = DirectionFlag.EAST | DirectionFlag.NORTH; +} diff --git a/src/rsmod/reach/ReachStrategy.ts b/src/rsmod/reach/ReachStrategy.ts new file mode 100644 index 0000000..e4bacda --- /dev/null +++ b/src/rsmod/reach/ReachStrategy.ts @@ -0,0 +1,417 @@ +// noinspection DuplicatedCode + +import CollisionFlagMap from '../collision/CollisionFlagMap'; +import RotationUtils from '../utils/RotationUtils'; +import RectangleBoundaryUtils from './RectangleBoundaryUtils'; +import CollisionFlag from '../flag/CollisionFlag'; + +export default class ReachStrategy { + static readonly WALL_STRATEGY: number = 0; + static readonly WALL_DECOR_STRATEGY: number = 1; + static readonly RECTANGLE_STRATEGY: number = 2; + static readonly NO_STRATEGY: number = 3; + static readonly RECTANGLE_EXCLUSIVE_STRATEGY: number = 4; + + static exitStrategy(locShape: number): number { + if (locShape === -2) { + return this.RECTANGLE_EXCLUSIVE_STRATEGY; + } else if (locShape === -1) { + return this.NO_STRATEGY; + } else if ((locShape >= 0 && locShape <= 3) || locShape === 9) { + return this.WALL_STRATEGY; + } else if (locShape < 9) { + return this.WALL_DECOR_STRATEGY; + } else if ((locShape >= 10 && locShape <= 11) || locShape === 22) { + return this.RECTANGLE_STRATEGY; + } + return this.NO_STRATEGY; + } + + static alteredRotation(angle: number, shape: number): number { + return shape === 7 ? (angle + 2) & 0x3 : angle; + } + + static reached( + flags: CollisionFlagMap, + level: number, + srcX: number, + srcZ: number, + destX: number, + destZ: number, + destWidth: number, + destHeight: number, + srcSize: number, + angle: number = 0, + shape: number = -1, + blockAccessFlags: number = 0 + ): boolean { + const exitStrategy: number = this.exitStrategy(shape); + if (exitStrategy !== this.RECTANGLE_EXCLUSIVE_STRATEGY && srcX === destX && srcZ === destZ) { + return true; + } + switch (exitStrategy) { + case this.WALL_STRATEGY: + return this.reachWall(flags, level, srcX, srcZ, destX, destZ, srcSize, shape, angle); + case this.WALL_DECOR_STRATEGY: + return this.reachWallDecor(flags, level, srcX, srcZ, destX, destZ, srcSize, shape, angle); + case this.RECTANGLE_STRATEGY: + return this.reachRectangle(flags, level, srcX, srcZ, destX, destZ, srcSize, destWidth, destHeight, angle, blockAccessFlags); + case this.RECTANGLE_EXCLUSIVE_STRATEGY: + return this.reachExclusiveRectangle(flags, level, srcX, srcZ, destX, destZ, srcSize, destWidth, destHeight, angle, blockAccessFlags); + } + return false; + } + + static reachRectangle(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, destWidth: number, destHeight: number, angle: number = 0, blockAccessFlags: number = 0): boolean { + const rotatedWidth: number = RotationUtils.rotate(angle, destWidth, destHeight); + const rotatedHeight: number = RotationUtils.rotate(angle, destHeight, destWidth); + const rotatedBlockAccess: number = RotationUtils.rotateFlags(angle, blockAccessFlags); + const collides: boolean = RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcSize, srcSize, rotatedWidth, rotatedHeight); + + if (srcSize > 1) { + return collides || RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcSize, srcSize, rotatedWidth, rotatedHeight, rotatedBlockAccess); + } + return collides || RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, rotatedWidth, rotatedHeight, rotatedBlockAccess); + } + + static reachExclusiveRectangle(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, destWidth: number, destHeight: number, angle: number = 0, blockAccessFlags: number = 0): boolean { + const rotatedWidth: number = RotationUtils.rotate(angle, destWidth, destHeight); + const rotatedHeight: number = RotationUtils.rotate(angle, destHeight, destWidth); + const rotatedBlockAccess: number = RotationUtils.rotateFlags(angle, blockAccessFlags); + const collides: boolean = RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcSize, srcSize, rotatedWidth, rotatedHeight); + + if (srcSize > 1) { + return !collides && RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcSize, srcSize, rotatedWidth, rotatedHeight, rotatedBlockAccess); + } + return !collides && RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, rotatedWidth, rotatedHeight, rotatedBlockAccess); + } + + static reachWall(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, shape: number, angle: number): boolean { + if (srcSize === 1 && srcX === destX && srcZ === destZ) { + return true; + } else if (srcSize !== 1 && destX >= srcX && srcSize + srcX - 1 >= destX && destZ >= srcZ && srcSize + srcZ - 1 >= destZ) { + return true; + } else if (srcSize === 1) { + return this.reachWall1(flags, level, srcX, srcZ, destX, destZ, shape, angle); + } + return this.reachWallN(flags, level, srcX, srcZ, destX, destZ, srcSize, shape, angle); + } + + static reachWallDecor(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, shape: number, angle: number): boolean { + if (srcSize === 1 && srcX === destX && srcZ === destZ) { + return true; + } else if (srcSize !== 1 && destX >= srcX && srcSize + srcX - 1 >= destX && destZ >= srcZ && srcSize + srcZ - 1 >= destZ) { + return true; + } else if (srcSize === 1) { + return this.reachWallDecor1(flags, level, srcX, srcZ, destX, destZ, shape, angle); + } + return this.reachWallDecorN(flags, level, srcX, srcZ, destX, destZ, srcSize, shape, angle); + } + + static reachWall1(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, shape: number, angle: number): boolean { + const collisionFlags: number = flags.get(srcX, srcZ, level); + if (shape === 0) { + if (angle === 0) { + if (srcX === destX - 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 1) { + if (srcX === destX && srcZ === destZ + 1) { + return true; + } else if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 2) { + if (srcX === destX + 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 3) { + if (srcX === destX && srcZ === destZ - 1) { + return true; + } else if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } else if (shape === 2) { + if (angle === 0) { + if (srcX === destX - 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ + 1) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 1) { + if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ + 1) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 2) { + if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ - 1) { + return true; + } + return false; + } else if (angle === 3) { + if (srcX === destX - 1 && srcZ === destZ) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1) { + return true; + } + return false; + } + return false; + } else if (shape === 9) { + if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } + + static reachWallN(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, shape: number, angle: number): boolean { + const collisionFlags: number = flags.get(srcX, srcZ, level); + const east: number = srcX + srcSize - 1; + const north: number = srcZ + srcSize - 1; + if (shape === 0) { + if (angle === 0) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 1) { + if (destX >= srcX && destX <= east && srcZ === destZ + 1) { + return true; + } else if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 2) { + if (srcX === destX + 1 && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 3) { + if (destX >= srcX && destX <= east && srcZ === destZ - srcSize) { + return true; + } else if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } else if (shape === 2) { + if (angle === 0) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 1) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (angle === 2) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize) { + return true; + } + return false; + } else if (angle === 3) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize) { + return true; + } + return false; + } + return false; + } else if (shape === 9) { + if (destX >= srcX && destX <= east && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (destX >= srcX && destX <= east && srcZ === destZ - srcSize && (collisionFlags & CollisionFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } + + static reachWallDecor1(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, shape: number, angle: number): boolean { + const collisionFlags: number = flags.get(srcX, srcZ, level); + if (shape === 6 || shape === 7) { + const number: number = this.alteredRotation(angle, shape); + if (number === 0) { + if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 1) { + if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 2) { + if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 3) { + if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } + } + return false; + } else if (shape === 8) { + if (srcX === destX && srcZ === destZ + 1 && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX && srcZ === destZ - 1 && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX - 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ === destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } + + static reachWallDecorN(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcSize: number, shape: number, angle: number): boolean { + const collisionFlags: number = flags.get(srcX, srcZ, level); + const east: number = srcX + srcSize - 1; + const north: number = srcZ + srcSize - 1; + if (shape === 6 || shape === 7) { + const number: number = this.alteredRotation(angle, shape); + if (number === 0) { + if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX <= destX && srcZ === destZ - srcSize && east >= destX && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 1) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX <= destX && srcZ === destZ - srcSize && east >= destX && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 2) { + if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX <= destX && srcZ === destZ + 1 && east >= destX && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } else if (number === 3) { + if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } else if (srcX <= destX && srcZ === destZ + 1 && east >= destX && (collisionFlags & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } else if (shape === 8) { + if (srcX <= destX && srcZ === destZ + 1 && east >= destX && (collisionFlags & CollisionFlag.WALL_SOUTH) === 0) { + return true; + } else if (srcX <= destX && srcZ === destZ - srcSize && east >= destX && (collisionFlags & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX - srcSize && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } else if (srcX === destX + 1 && srcZ <= destZ && north >= destZ && (collisionFlags & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } + return false; + } + return false; + } +} diff --git a/src/rsmod/reach/RectangleBoundaryUtils.ts b/src/rsmod/reach/RectangleBoundaryUtils.ts new file mode 100644 index 0000000..7e7f6ef --- /dev/null +++ b/src/rsmod/reach/RectangleBoundaryUtils.ts @@ -0,0 +1,70 @@ +import CollisionFlagMap from '../collision/CollisionFlagMap'; +import BlockAccessFlag from '../flag/BlockAccessFlag'; +import CollisionFlag from '../flag/CollisionFlag'; + +export default class RectangleBoundaryUtils { + static collides(srcX: number, srcZ: number, destX: number, destZ: number, srcWidth: number, srcHeight: number, destWidth: number, destHeight: number): boolean { + return srcX >= destX + destWidth || srcX + srcWidth <= destX ? false : srcZ < destZ + destHeight && destZ < srcHeight + srcZ; + } + + static reachRectangle1(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, destWidth: number, destHeight: number, blockAccessFlags: number): boolean { + const east: number = destX + destWidth - 1; + const north: number = destZ + destHeight - 1; + + if (srcX === destX - 1 && srcZ >= destZ && srcZ <= north && (flags.get(srcX, srcZ, level) & CollisionFlag.WALL_EAST) === 0 && (blockAccessFlags & BlockAccessFlag.BLOCK_WEST) === 0) { + return true; + } + + if (srcX === east + 1 && srcZ >= destZ && srcZ <= north && (flags.get(srcX, srcZ, level) & CollisionFlag.WALL_WEST) === 0 && (blockAccessFlags & BlockAccessFlag.BLOCK_EAST) === 0) { + return true; + } + + if (srcZ + 1 === destZ && srcX >= destX && srcX <= east && (flags.get(srcX, srcZ, level) & CollisionFlag.WALL_NORTH) === 0 && (blockAccessFlags & BlockAccessFlag.BLOCK_SOUTH) === 0) { + return true; + } + + return srcZ === north + 1 && srcX >= destX && srcX <= east && (flags.get(srcX, srcZ, level) & CollisionFlag.WALL_SOUTH) === 0 && (blockAccessFlags & BlockAccessFlag.BLOCK_NORTH) === 0; + } + + static reachRectangleN(flags: CollisionFlagMap, level: number, srcX: number, srcZ: number, destX: number, destZ: number, srcWidth: number, srcHeight: number, destWidth: number, destHeight: number, blockAccessFlags: number): boolean { + const srcEast: number = srcX + srcWidth; + const srcNorth: number = srcHeight + srcZ; + const destEast: number = destWidth + destX; + const destNorth: number = destHeight + destZ; + + if (destEast === srcX && (blockAccessFlags & BlockAccessFlag.BLOCK_EAST) === CollisionFlag.OPEN) { + const fromZ: number = Math.max(srcZ, destZ); + const toZ: number = Math.min(srcNorth, destNorth); + for (let sideZ: number = fromZ; sideZ < toZ; sideZ++) { + if ((flags.get(destEast - 1, sideZ, level) & CollisionFlag.WALL_EAST) === CollisionFlag.OPEN) { + return true; + } + } + } else if (srcEast === destX && (blockAccessFlags & BlockAccessFlag.BLOCK_WEST) === CollisionFlag.OPEN) { + const fromZ: number = Math.max(srcZ, destZ); + const toZ: number = Math.min(srcNorth, destNorth); + for (let sideZ: number = fromZ; sideZ < toZ; sideZ++) { + if ((flags.get(destX, sideZ, level) & CollisionFlag.WALL_WEST) === CollisionFlag.OPEN) { + return true; + } + } + } else if (srcZ === destNorth && (blockAccessFlags & BlockAccessFlag.BLOCK_NORTH) === CollisionFlag.OPEN) { + const fromX: number = Math.max(srcX, destX); + const toX: number = Math.min(srcEast, destEast); + for (let sideX: number = fromX; sideX < toX; sideX++) { + if ((flags.get(sideX, destNorth - 1, level) & CollisionFlag.WALL_NORTH) === CollisionFlag.OPEN) { + return true; + } + } + } else if (destZ === srcNorth && (blockAccessFlags & BlockAccessFlag.BLOCK_SOUTH) === CollisionFlag.OPEN) { + const fromX: number = Math.max(srcX, destX); + const toX: number = Math.min(srcEast, destEast); + for (let sideX: number = fromX; sideX < toX; sideX++) { + if ((flags.get(sideX, destZ, level) & CollisionFlag.WALL_SOUTH) === CollisionFlag.OPEN) { + return true; + } + } + } + return false; + } +} diff --git a/src/rsmod/utils/RotationUtils.ts b/src/rsmod/utils/RotationUtils.ts new file mode 100644 index 0000000..ec5bb0b --- /dev/null +++ b/src/rsmod/utils/RotationUtils.ts @@ -0,0 +1,9 @@ +export default class RotationUtils { + static rotate(angle: number, dimensionA: number, dimensionB: number): number { + return (angle & 0x1) !== 0 ? dimensionB : dimensionA; + } + + static rotateFlags(angle: number, blockAccessFlags: number): number { + return angle === 0 ? blockAccessFlags : ((blockAccessFlags << angle) & 0xf) | (blockAccessFlags >> (4 - angle)); + } +} diff --git a/test/rsmod/LinePathFinder.test.ts b/test/rsmod/LinePathFinder.test.ts new file mode 100644 index 0000000..6384774 --- /dev/null +++ b/test/rsmod/LinePathFinder.test.ts @@ -0,0 +1,224 @@ +import CollisionFlagMap from '../../src/rsmod/collision/CollisionFlagMap'; +import CollisionFlag from '../../src/rsmod/flag/CollisionFlag'; +import LinePathFinder from '../../src/rsmod/LinePathFinder'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +describe('LinePathFinder', () => { + const srcX = 3200; + const srcZ = 3200; + + const args = [ + [ 0, -1 ], + [ 0, 1 ], + [ -1, 0 ], + [ 1, 0 ] + ]; + + const flags = [ + CollisionFlag.OPEN, + CollisionFlag.FLOOR, + CollisionFlag.FLOOR_DECORATION, + CollisionFlag.FLOOR | CollisionFlag.FLOOR_DECORATION + ]; + + const extraFlags = [ + CollisionFlag.PLAYER, + CollisionFlag.NPC, + CollisionFlag.PLAYER | CollisionFlag.NPC + ]; + + describe('line of walk', () => { + test('test same tile has line of walk', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(srcX, srcZ, 0); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfWalk(0, srcX, srcZ, srcX, srcZ); + + expect(rayCast.success).toBeTruthy(); + }); + + describe('with flags', () => { + test('test partial line of walk', () => { + const map = new CollisionFlagMap(); + map.set(3200, 3205, 0, CollisionFlag.LOC); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfWalk(0, srcX, srcZ, 3200, 3207); + + expect(rayCast.coordinates.length).toBe(4); + expect(rayCast.success).toBeFalsy(); + expect(rayCast.alternative).toBeTruthy(); + }); + + test.each(args)('test clear line of walk', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.allocateIfAbsent(srcX + dirX, srcZ + dirZ, level); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfWalk(level, srcX, srcZ, destX, destZ); + + expect(rayCast.coordinates.length).not.toBe(0); + expect(rayCast.success).toBeTruthy(); + expect(rayCast.alternative).toBeFalsy(); + } + }); + + test.each(args)('test loc blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.set(srcX + dirX, srcZ + dirZ, level, CollisionFlag.LOC); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfWalk(level, srcX, srcZ, destX, destZ); + + expect(rayCast.success).toBeFalsy(); + } + }); + + test.each(args)('test extra flag blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfWalk(level, srcX, srcZ, destX, destZ, 1, 0, 0, flag); + + expect(rayCast.success).toBeFalsy(); + } + } + }); + }); + }); + + describe('line of sight', () => { + test('test on top of loc fails line of sight', () => { + const map = new CollisionFlagMap(); + map.add(srcX, srcZ, 0, CollisionFlag.LOC); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(0, srcX, srcZ, 3200, 3201); + + expect(rayCast.coordinates.length).toBe(0); + expect(rayCast.success).toBeFalsy(); + expect(rayCast.alternative).toBeFalsy(); + }); + + test('test on top of extra flag fails line of sight', () => { + const map = new CollisionFlagMap(); + map.add(srcX, srcZ, 0, CollisionFlag.PLAYER); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(0, srcX, srcZ, 3200, 3201, 1, 0, 0, CollisionFlag.PLAYER); + + expect(rayCast.coordinates.length).toBe(0); + expect(rayCast.success).toBeFalsy(); + expect(rayCast.alternative).toBeFalsy(); + }); + + test('test same tile has line of sight', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(srcX, srcZ, 0); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(0, srcX, srcZ, srcX, srcZ); + + expect(rayCast.coordinates.length).toBe(0); + expect(rayCast.success).toBeTruthy(); + expect(rayCast.alternative).toBeFalsy(); + }); + + describe('with flags', () => { + test('test partial line of sight', () => { + const map = new CollisionFlagMap(); + map.set(3200, 3205, 0, CollisionFlag.LOC_PROJ_BLOCKER); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(0, srcX, srcZ, 3200, 3207); + + expect(rayCast.coordinates.length).toBe(4); + expect(rayCast.success).toBeFalsy(); + expect(rayCast.alternative).toBeTruthy(); + }); + + test.each(args)('test valid line of sight', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of flags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(level, srcX, srcZ, destX, destZ); + + expect(rayCast.coordinates.length).not.toBe(0); + expect(rayCast.success).toBeTruthy(); + expect(rayCast.alternative).toBeFalsy(); + } + } + }); + + test.each(args)('test loc blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.set(srcX +dirX, srcZ + dirZ, level, CollisionFlag.LOC_PROJ_BLOCKER); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(level, srcX, srcZ, destX, destZ); + + expect(rayCast.success).toBeFalsy(); + } + }); + + test.each(args)('test extra flag blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LinePathFinder(map); + const rayCast = pf.lineOfSight(level, srcX, srcZ, destX, destZ, 1, 0, 0, flag); + + expect(rayCast.success).toBeFalsy(); + } + } + }); + }); + }); +}); \ No newline at end of file diff --git a/test/rsmod/LineValidator.test.ts b/test/rsmod/LineValidator.test.ts new file mode 100644 index 0000000..8d00e9a --- /dev/null +++ b/test/rsmod/LineValidator.test.ts @@ -0,0 +1,210 @@ +import CollisionFlagMap from '../../src/rsmod/collision/CollisionFlagMap'; +import CollisionFlag from '../../src/rsmod/flag/CollisionFlag'; +import LineValidator from '../../src/rsmod/LineValidator'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +describe('LineValidator', () => { + const srcX = 3200; + const srcZ = 3200; + + const args = [ + [ 0, -1 ], + [ 0, 1 ], + [ -1, 0 ], + [ 1, 0 ] + ]; + + const flags = [ + CollisionFlag.OPEN, + CollisionFlag.FLOOR, + CollisionFlag.FLOOR_DECORATION, + CollisionFlag.FLOOR | CollisionFlag.FLOOR_DECORATION + ]; + + const extraFlags = [ + CollisionFlag.PLAYER, + CollisionFlag.NPC, + CollisionFlag.PLAYER | CollisionFlag.NPC + ]; + + describe('line of walk', () => { + test('test same tile has line of walk', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(srcX, srcZ, 0); + + const pf = new LineValidator(map); + const low = pf.hasLineOfWalk(0, srcX, srcZ, srcX, srcZ); + + expect(low).toBeTruthy(); + }); + + describe('with flags', () => { + test('test partial line of walk', () => { + const map = new CollisionFlagMap(); + map.set(3200, 3205, 0, CollisionFlag.LOC); + + const pf = new LineValidator(map); + const low = pf.hasLineOfWalk(0, srcX, srcZ, 3200, 3207); + + expect(low).toBeFalsy(); + }); + + test.each(args)('test clear line of walk', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.allocateIfAbsent(srcX + dirX, srcZ + dirZ, level); + + const pf = new LineValidator(map); + const low = pf.hasLineOfWalk(level, srcX, srcZ, destX, destZ); + + expect(low).toBeTruthy(); + } + }); + + test.each(args)('test loc blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.set(srcX + dirX, srcZ + dirZ, level, CollisionFlag.LOC); + + const pf = new LineValidator(map); + const low = pf.hasLineOfWalk(level, srcX, srcZ, destX, destZ); + + expect(low).toBeFalsy(); + } + }); + + test.each(args)('test extra flag blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LineValidator(map); + const low = pf.hasLineOfWalk(level, srcX, srcZ, destX, destZ, 1, 0, 0, flag); + + expect(low).toBeFalsy(); + } + } + }); + }); + }); + + describe('line of sight', () => { + test('test on top of loc fails line of sight', () => { + const map = new CollisionFlagMap(); + map.add(srcX, srcZ, 0, CollisionFlag.LOC); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(0, srcX, srcZ, 3200, 3201); + + expect(los).toBeFalsy(); + }); + + test('test on top of extra flag fails line of sight', () => { + const map = new CollisionFlagMap(); + map.add(srcX, srcZ, 0, CollisionFlag.PLAYER); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(0, srcX, srcZ, 3200, 3201, 1, 0, 0, CollisionFlag.PLAYER); + + expect(los).toBeFalsy(); + }); + + test('test same tile has line of sight', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(srcX, srcZ, 0); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(0, srcX, srcZ, srcX, srcZ); + + expect(los).toBeTruthy(); + }); + + describe('with flags', () => { + test('test partial line of sight', () => { + const map = new CollisionFlagMap(); + map.set(3200, 3205, 0, CollisionFlag.LOC_PROJ_BLOCKER); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(0, srcX, srcZ, 3200, 3207); + + expect(los).toBeFalsy(); + }); + + test.each(args)('test valid line of sight', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of flags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(level, srcX, srcZ, destX, destZ); + + expect(los).toBeTruthy(); + } + } + }); + + test.each(args)('test loc blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + map.set(srcX + dirX, srcZ + dirZ, level, CollisionFlag.LOC_PROJ_BLOCKER); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(level, srcX, srcZ, destX, destZ); + + expect(los).toBeFalsy(); + } + }); + + test.each(args)('test extra flag blocking', (dirX, dirZ) => { + const destX = srcX + (dirX * 3); + const destZ = srcZ + (dirZ * 3); + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + map.set(srcX + dirX, srcZ + dirZ, level, flag); + + const pf = new LineValidator(map); + const los = pf.hasLineOfSight(level, srcX, srcZ, destX, destZ, 1, 0, 0, flag); + + expect(los).toBeFalsy(); + } + } + }); + }); + }); +}); \ No newline at end of file diff --git a/test/rsmod/NaivePathFinder.test.ts b/test/rsmod/NaivePathFinder.test.ts new file mode 100644 index 0000000..78b7ae5 --- /dev/null +++ b/test/rsmod/NaivePathFinder.test.ts @@ -0,0 +1,46 @@ +import NaivePathFinder from '../../src/rsmod/NaivePathFinder'; +import StepValidator from '../../src/rsmod/StepValidator'; +import CollisionFlagMap from '../../src/rsmod/collision/CollisionFlagMap'; + +describe('NaivePathFinder', () => { + test('test intersects size 1', () => { + const map = new CollisionFlagMap(); + const sv = new StepValidator(map); + const pf = new NaivePathFinder(sv); + + expect(pf.intersects(3222, 3222, 1, 1, 3222, 3222, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 1, 1, 3223, 3223, 1, 1)).toBeFalsy(); + + expect(pf.intersects(3222, 3222, 2, 2, 3222, 3222, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 2, 2, 3223, 3223, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 2, 2, 3224, 3224, 1, 1)).toBeFalsy(); + + expect(pf.intersects(3222, 3222, 3, 3, 3222, 3222, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3223, 3223, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3224, 3224, 1, 1)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3225, 3225, 1, 1)).toBeFalsy(); + }); + + test('test intersects size 2', () => { + const map = new CollisionFlagMap(); + const sv = new StepValidator(map); + const pf = new NaivePathFinder(sv); + + expect(pf.intersects(3222, 3222, 1, 1, 3222, 3222, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 1, 1, 3223, 3223, 2, 2)).toBeFalsy(); + + expect(pf.intersects(3222, 3222, 2, 2, 3222, 3222, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 2, 2, 3223, 3223, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 2, 2, 3224, 3224, 2, 2)).toBeFalsy(); + + expect(pf.intersects(3222, 3222, 3, 3, 3222, 3222, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3223, 3223, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3224, 3224, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 3, 3, 3225, 3225, 2, 2)).toBeFalsy(); + + expect(pf.intersects(3222, 3222, 1, 1, 3221, 3221, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 1, 1, 3220, 3220, 2, 2)).toBeFalsy(); + expect(pf.intersects(3222, 3222, 1, 1, 3222, 3221, 2, 2)).toBeTruthy(); + expect(pf.intersects(3222, 3222, 1, 1, 3222, 3220, 2, 2)).toBeFalsy(); + }); +}); \ No newline at end of file diff --git a/test/rsmod/PathFinder.test.ts b/test/rsmod/PathFinder.test.ts new file mode 100644 index 0000000..08d8824 --- /dev/null +++ b/test/rsmod/PathFinder.test.ts @@ -0,0 +1,143 @@ +import PathFinder from '../../src/rsmod/PathFinder'; +import CollisionFlagMap from '../../src/rsmod/collision/CollisionFlagMap'; +import CollisionFlag from '../../src/rsmod/flag/CollisionFlag'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +function flag(map: CollisionFlagMap, baseX: number, baseZ: number, width: number, height: number, mask: number) { + for (let level = 0; level < 4; level++) { + for (let z = 0; z < height; z++) { + for (let x = 0; x < width; x++) { + map.set(baseX + x, baseZ + z, level, mask); + } + } + } +} + +describe('PathFinder', () => { + test('route coordinates match level input', () => { + const srcX = 3200, srcZ = 3200; + const destX = 3201, destZ = 3200; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + const pathFinder = new PathFinder(map); + + let route = pathFinder.findPath(0, srcX, srcZ, destX, destZ); + expect(route.success).toBeTruthy(); + route.waypoints.forEach(routePoint => { + expect(routePoint.level).toBe(0); + }); + + route = pathFinder.findPath(1, srcX, srcZ, destX, destZ); + expect(route.success).toBeTruthy(); + route.waypoints.forEach(routePoint => { + expect(routePoint.level).toBe(1); + }); + + route = pathFinder.findPath(2, srcX, srcZ, destX, destZ); + expect(route.success).toBeTruthy(); + route.waypoints.forEach(routePoint => { + expect(routePoint.level).toBe(2); + }); + + route = pathFinder.findPath(3, srcX, srcZ, destX, destZ); + expect(route.success).toBeTruthy(); + route.waypoints.forEach(routePoint => { + expect(routePoint.level).toBe(3); + }); + }); + + test('surrounded by objects allow move near', () => { + const srcX = 3200, srcZ = 3200; + const destX = 3205, destZ = 3200; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + flag(map, srcX - 1, srcZ - 1, 3, 3, CollisionFlag.LOC); + map.set(srcX, srcZ, 0, CollisionFlag.OPEN); // Remove collision flag from source tile + + const pathFinder = new PathFinder(map); + const route = pathFinder.findPath(0, srcX, srcZ, destX, destZ); + expect(route.alternative).toBeTruthy(); + expect(route.waypoints).toHaveLength(0); + }); + + test('surrounded by objects no move near', () => { + const srcX = 3200, srcZ = 3200; + const destX = 3205, destZ = 3200; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + flag(map, srcX - 1, srcZ - 1, 3, 3, CollisionFlag.LOC); + map.set(srcX, srcZ, 0, CollisionFlag.OPEN); // Remove collision flag from source tile + + const pathFinder = new PathFinder(map); + const route = pathFinder.findPath(0, srcX, srcZ, destX, destZ, 1, 1, 1, 0, -1, false); + expect(route.failed).toBeTruthy(); + expect(route.waypoints).toHaveLength(0); + }); + + test('single exit point', () => { + const srcX = 3200, srcZ = 3200; + const destX = 3200, destZ = 3205; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + flag(map, srcX - 1, srcZ - 1, 3, 3, CollisionFlag.LOC); + map.set(srcX, srcZ, 0, CollisionFlag.OPEN); // Remove collision flag from source tile + map.set(srcX, srcZ - 1, 0, CollisionFlag.OPEN); // Remove collision flag from tile south of source tile. + + const pathFinder = new PathFinder(map); + const route = pathFinder.findPath(0, srcX, srcZ, destX, destZ); + expect(route.success).toBeTruthy(); + expect(route.waypoints).toHaveLength(4); + + expect(route.waypoints[0].x).toEqual(3200); + expect(route.waypoints[0].z).toEqual(3198); + + expect(route.waypoints[1].x).toEqual(3198); + expect(route.waypoints[1].z).toEqual(3198); + + expect(route.waypoints[2].x).toEqual(3198); + expect(route.waypoints[2].z).toEqual(3203); + + expect(route.waypoints[3].x).toEqual(destX); + expect(route.waypoints[3].z).toEqual(destZ); + }); + + test('standing on closest approach point', () => { + const srcX = 3200, srcZ = 3200; + const objX = 3200, objZ = 3201; + + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + const pathFinder = new PathFinder(map); + map.add(objX, objZ, 0, CollisionFlag.WALL_NORTH | CollisionFlag.WALL_SOUTH | CollisionFlag.WALL_WEST | CollisionFlag.WALL_EAST); + + const route = pathFinder.findPath(0, srcX, srcZ, objX, objZ); + expect(route.success).toBeTruthy(); + expect(route.alternative).toBeTruthy(); + expect(route.waypoints).toHaveLength(0); + }); + + test('find path any size', () => { + for (let size = 1; size <= 3; size++) { + const srcX = 3200, srcZ = 3200; + const objX = 3200, objZ = 3210 + size; + + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + map.set(srcX, srcZ + 1, 0, CollisionFlag.LOC); + const pathFinder = new PathFinder(map); + + const route = pathFinder.findPath(0, srcX, srcZ, objX, objZ, size); + expect(route.success).toBeTruthy(); + expect(route.alternative).toBeFalsy(); + } + }); +}); diff --git a/test/rsmod/StepValidator.test.ts b/test/rsmod/StepValidator.test.ts new file mode 100644 index 0000000..12b9e9d --- /dev/null +++ b/test/rsmod/StepValidator.test.ts @@ -0,0 +1,268 @@ +import StepValidator from '../../src/rsmod/StepValidator'; +import CollisionFlag from '../../src/rsmod/flag/CollisionFlag'; +import CollisionStrategies from '../../src/rsmod/collision/CollisionStrategies'; +import CollisionFlagMap from '../../src/rsmod/collision/CollisionFlagMap'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +function buildCollisionMapWithFlag(x1: number, z1: number, x2: number, z2: number, mask: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.set(x, z, level, mask); + } + } + } + return map; +} + +describe('StepValidator', () => { + const srcX = 3200; + const srcZ = 3200; + + const args = [ + [ 1, 0, -1 ], + [ 1, 0, 1 ], + [ 1, -1, 0 ], + [ 1, 1, 0 ], + [ 1, -1, -1 ], + [ 1, -1, 1 ], + [ 1, 1, -1 ], + [ 1, 1, 1 ], + [ 2, 0, -1 ], + [ 2, 0, 1 ], + [ 2, -1, 0 ], + [ 2, 1, 0 ], + [ 2, -1, -1 ], + [ 2, -1, 1 ], + [ 2, 1, -1 ], + [ 2, 1, 1 ], + [ 3, 0, -1 ], + [ 3, 0, 1 ], + [ 3, -1, 0 ], + [ 3, 1, 0 ], + [ 3, -1, -1 ], + [ 3, -1, 1 ], + [ 3, 1, -1 ], + [ 3, 1, 1 ], + ]; + + const extraFlags = [ + CollisionFlag.PLAYER, + CollisionFlag.NPC, + CollisionFlag.PLAYER | CollisionFlag.NPC + ]; + + test.each(args)('test clear path', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, size, 0, CollisionStrategies.NORMAL); + expect(validated).toBeTruthy(); + } + }); + + test.each(args)('test loc blocking', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + for (let index = 0; index < size * size; index++) { + const deltaX = destX + (index % size); + const deltaZ = destZ + (index / size); + map.set(deltaX, deltaZ, level, CollisionFlag.LOC); + } + } + + for (let level = 0; level < 4; level++) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, size, 0, CollisionStrategies.NORMAL); + expect(validated).toBeFalsy(); + } + }); + + test.each(args)('test extra flag blocking', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + + const map = buildCollisionMap(srcX, srcZ, destX, destZ); + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + for (let index = 0; index < size * size; index++) { + const deltaX = destX + (index % size); + const deltaZ = destZ + (index / size); + map.set(deltaX, deltaZ, level, flag); + } + } + } + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, size, flag, CollisionStrategies.NORMAL); + expect(validated).toBeFalsy(); + } + } + }); + + test.each(args)('test blocked flag strategy', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + + const map = buildCollisionMapWithFlag(srcX, srcZ, destX, destZ, CollisionFlag.FLOOR); + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, 1, 0, CollisionStrategies.BLOCKED); + expect(validated).toBeTruthy(); + } + } + }); + + test.each(args)('test indoors flag strategy', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + const outdoorsX = destX + dirX; + const outdoorsZ = destZ + dirZ; + + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let x = Math.min(srcX, Math.min(destX, outdoorsX)); x <= Math.max(srcX, Math.max(destX, outdoorsX)); x++) { + for (let z = Math.min(srcZ, Math.min(destZ, outdoorsZ)); z <= Math.max(srcZ, Math.max(destZ, outdoorsZ)); z++) { + map.set(x, z, level, CollisionFlag.ROOF); + } + } + } + + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + map.set(outdoorsX, outdoorsZ, level, CollisionFlag.OPEN); + } + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, 1, 0, CollisionStrategies.INDOORS); + expect(validated).toBeTruthy(); + + const validated2 = stepValidator.canTravel(level, destX, destZ, dirX, dirZ, 1, 0, CollisionStrategies.INDOORS); + expect(validated2).toBeFalsy(); + } + } + }); + + test.each(args)('test outdoors flag strategy', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + const indoorsX = destX + dirX; + const indoorsZ = destZ + dirZ; + + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let x = Math.min(srcX, Math.min(destX, indoorsX)); x <= Math.max(srcX, Math.max(destX, indoorsX)); x++) { + for (let z = Math.min(srcZ, Math.min(destZ, indoorsZ)); z <= Math.max(srcZ, Math.max(destZ, indoorsZ)); z++) { + map.allocateIfAbsent(x, z, level); + } + } + } + + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + map.set(indoorsX, indoorsZ, level, CollisionFlag.ROOF); + } + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, 1, 0, CollisionStrategies.OUTDOORS); + expect(validated).toBeTruthy(); + + const validated2 = stepValidator.canTravel(level, destX, destZ, dirX, dirZ, 1, 0, CollisionStrategies.OUTDOORS); + expect(validated2).toBeFalsy(); + } + } + }); + + test.each(args)('test line of sight flag strategy loc', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + const blockedX = destX + dirX; + const blockedZ = destZ + dirZ; + + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let x = Math.min(srcX, Math.min(destX, blockedX)); x <= Math.max(srcX, Math.max(destX, blockedX)); x++) { + for (let z = Math.min(srcZ, Math.min(destZ, blockedZ)); z <= Math.max(srcZ, Math.max(destZ, blockedZ)); z++) { + map.allocateIfAbsent(x, z, level); + } + } + } + + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + map.set(blockedX, blockedZ, level, CollisionFlag.LOC_PROJ_BLOCKER); + } + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, 1, 0, CollisionStrategies.LINE_OF_SIGHT); + expect(validated).toBeTruthy(); + + const validated2 = stepValidator.canTravel(level, destX, destZ, dirX, dirZ, 1, 0, CollisionStrategies.LINE_OF_SIGHT); + expect(validated2).toBeFalsy(); + } + } + }); + + test.each(args)('test line of sight flag strategy player', (size, dirX, dirZ) => { + const destX = srcX + dirX; + const destZ = srcZ + dirZ; + const blockedX = destX + dirX; + const blockedZ = destZ + dirZ; + + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let x = Math.min(srcX, Math.min(destX, blockedX)); x <= Math.max(srcX, Math.max(destX, blockedX)); x++) { + for (let z = Math.min(srcZ, Math.min(destZ, blockedZ)); z <= Math.max(srcZ, Math.max(destZ, blockedZ)); z++) { + map.allocateIfAbsent(x, z, level); + } + } + } + + const stepValidator = new StepValidator(map); + + for (let level = 0; level < 4; level++) { + map.set(blockedX, blockedZ, level, CollisionFlag.PLAYER); + } + + for (let level = 0; level < 4; level++) { + for (const flag of extraFlags) { + const validated = stepValidator.canTravel(level, srcX, srcZ, dirX, dirZ, 1, 0, CollisionStrategies.LINE_OF_SIGHT); + expect(validated).toBeTruthy(); + + const validated2 = stepValidator.canTravel(level, destX, destZ, dirX, dirZ, 1, 0, CollisionStrategies.LINE_OF_SIGHT); + expect(validated2).toBeFalsy(); + } + } + }); +}); \ No newline at end of file diff --git a/test/rsmod/collision/CollisionFlagMap.test.ts b/test/rsmod/collision/CollisionFlagMap.test.ts new file mode 100644 index 0000000..b46c747 --- /dev/null +++ b/test/rsmod/collision/CollisionFlagMap.test.ts @@ -0,0 +1,93 @@ +import CollisionFlagMap from '../../../src/rsmod/collision/CollisionFlagMap'; +import CollisionFlag from '../../../src/rsmod/flag/CollisionFlag'; + +describe('CollisionFlagMap', () => { + test('test get collision flag', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(0, 0, 0); + const flags = map.flags[0]; + expect(flags).not.toBeNull(); + flags![0] = 123456; + expect(map.get(0, 0, 0)).toBe(123456); + }); + + test('test get collision flag null zone', () => { + const map = new CollisionFlagMap(); + expect(map.isZoneAllocated(3200, 3200, 0)).toBeFalsy(); + + for (let x = 3200; x < 3208; x++) { + for (let z = 3200; z < 3208; z++) { + expect(map.get(x, z, 0)).toBe(CollisionFlag.NULL); + } + } + }); + + test('test get collision flag allocated zone', () => { + const map = new CollisionFlagMap(); + expect(map.isZoneAllocated(3200, 3200, 0)).toBeFalsy(); + + map.allocateIfAbsent(3200, 3200, 0); + expect(map.isZoneAllocated(3200, 3200, 0)).toBeTruthy(); + + for (let x = 3200; x < 3208; x++) { + for (let z = 3200; z < 3208; z++) { + expect(map.get(x, z, 0)).toBe(CollisionFlag.OPEN); + } + } + }); + + test('test set collision flag', () => { + const map = new CollisionFlagMap(); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.NULL); + expect(map.get(3200, 3200, 1)).toBe(CollisionFlag.NULL); + expect(map.get(3200, 3200, 2)).toBe(CollisionFlag.NULL); + + map.set(3200, 3200, 0, 0x800); + map.set(3200, 3200, 1, 0x200); + map.set(3200, 3200, 2, 0); + + expect(map.get(3200, 3200, 0)).toBe(0x800); + expect(map.get(3200, 3200, 1)).toBe(0x200); + expect(map.get(3200, 3200, 2)).toBe(0); + }); + + test('test add collision flag', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(3200, 3200, 0); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.OPEN); + + map.add(3200, 3200, 0, 0x1000); + expect(map.get(3200, 3200, 0)).toBe(0x1000); + + map.add(3200, 3200, 0, 0x400); + expect(map.isFlagged(3200, 3200, 0, 0x1000)).toBeTruthy(); + expect(map.isFlagged(3200, 3200, 0, 0x400)).toBeTruthy(); + + for (let x = 3201; x < 3208; x++) { + for (let z = 3201; z < 3208; z++) { + expect(map.get(x, z, 0)).toBe(CollisionFlag.OPEN); + } + } + }); + + test('test remove collision flag', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(3200, 3200, 0); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.OPEN); + + map.add(3200, 3200, 0, 0x1000); + expect(map.get(3200, 3200, 0)).toBe(0x1000); + + map.remove(3200, 3200, 0, 0x1000); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.OPEN); + }); + + test('test deallocate if present', () => { + const map = new CollisionFlagMap(); + map.allocateIfAbsent(3200, 3200, 0); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.OPEN); + + map.deallocateIfPresent(3200, 3200, 0); + expect(map.get(3200, 3200, 0)).toBe(CollisionFlag.NULL); + }); +}); \ No newline at end of file diff --git a/test/rsmod/reach/ReachStrategyTest.test.ts b/test/rsmod/reach/ReachStrategyTest.test.ts new file mode 100644 index 0000000..9be57f2 --- /dev/null +++ b/test/rsmod/reach/ReachStrategyTest.test.ts @@ -0,0 +1,200 @@ +import CollisionFlag from '../../../src/rsmod/flag/CollisionFlag'; +import ReachStrategy from '../../../src/rsmod/reach/ReachStrategy'; +import BlockAccessFlag from '../../../src/rsmod/flag/BlockAccessFlag'; +import CollisionFlagMap from '../../../src/rsmod/collision/CollisionFlagMap'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +function flag(map: CollisionFlagMap, baseX: number, baseZ: number, width: number, height: number, mask: number) { + for (let level = 0; level < 4; level++) { + for (let z = 0; z < height; z++) { + for (let x = 0; x < width; x++) { + map.set(baseX + x, baseZ + z, level, mask); + } + } + } +} + +describe('ReachStrategyTest', () => { + const ROTATED_OBJECT_TEST_ARGS = [ + [ 3203, 3203, { width: 1, height: 1 } ], + [ 3203, 3203, { width: 1, height: 2 } ], + [ 3203, 3203, { width: 1, height: 3 } ], + [ 3203, 3203, { width: 2, height: 1 } ], + [ 3203, 3203, { width: 2, height: 2 } ], + [ 3203, 3203, { width: 2, height: 3 } ], + [ 3203, 3203, { width: 3, height: 1 } ], + [ 3203, 3203, { width: 3, height: 2 } ], + [ 3203, 3203, { width: 3, height: 3 } ], + ] as const; + + /** + * Test that object rotations are taken into account within [ReachStrategy.reached] + * and do not rely on external modifications. For example, given the parameters of + * an object in coordinates (3203, 3203) with a dimension of 3 x 1 (width x height), + * the following test should pass: + * + * Object rotation of [0] or [2]. (normal) + * ``` + * -------- + * -------- + * -------- + * ---ooo-- + * --o o- + * ---ooo-- + * -------- + * -------- + * ``` + * Where: + * - Area starts from bottom-left and makes its way to top-right. (3200,3200 - 3207,3207) + * - ' ' (whitespace) are the tiles occupied by the rotated object. + * - 'o' are the tiles that successfully pass [ReachStrategy.reached]. + * - '-' represents every other tile in the area. (in this case a zone, or 8x8 tile area) + */ + test.each(ROTATED_OBJECT_TEST_ARGS)('test rotated object normal ', (objX, objZ, { width, height }) => { + const LEVEL = 0; + + const minX = objX - 16, minZ = objZ - 16; + const maxX = objX + 16, maxZ = objZ + 16; + + const map = buildCollisionMap(minX, minZ, maxX, maxZ); + flag(map, objX, objZ, width, height, CollisionFlag.LOC); + + const reached = (srcX: number, srcZ: number, rot: number, blockAccessFlags: number = 0) => { + return ReachStrategy.reached( + map, + LEVEL, + srcX, + srcZ, + objX, + objZ, + width, + height, + 1, + rot, + -2, // Use rectangular excludive strategy + blockAccessFlags + ); + }; + + for (let x = 0; x < width; x++) { + // Test coming from south tiles. + expect(reached(objX + x, objZ - 1, 0)).toBeTruthy(); + expect(reached(objX + x, objZ - 1, 2)).toBeTruthy(); + // Test coming from north tiles. + expect(reached(objX + x, objZ + height, 0)).toBeTruthy(); + expect(reached(objX + x, objZ + height, 2)).toBeTruthy(); + // Test coming from south tiles with access blocked. + expect(reached(objX + x, objZ - 1, 0, BlockAccessFlag.BLOCK_SOUTH)).toBeFalsy(); + expect(reached(objX + x, objZ - 1, 2, BlockAccessFlag.BLOCK_NORTH)).toBeFalsy(); + // Test coming from north tiles with access blocked. + expect(reached(objX + x, objZ + height, 0, BlockAccessFlag.BLOCK_NORTH)).toBeFalsy(); + expect(reached(objX + x, objZ + height, 2, BlockAccessFlag.BLOCK_SOUTH)).toBeFalsy(); + } + + for (let z = 0; z < height; z++) { + // Test coming from west tiles. + expect(reached(objX - 1, objZ + z, 0)).toBeTruthy(); + expect(reached(objX - 1, objZ + z, 2)).toBeTruthy(); + // Test coming from east tiles. + expect(reached(objX + width, objZ + z, 0)).toBeTruthy(); + expect(reached(objX + width, objZ + z, 2)).toBeTruthy(); + // Test coming from west tiles with access blocked. + expect(reached(objX - 1, objZ + z, 0, BlockAccessFlag.BLOCK_WEST)).toBeFalsy(); + expect(reached(objX - 1, objZ + z, 2, BlockAccessFlag.BLOCK_EAST)).toBeFalsy(); + // Test coming from east tiles with access blocked. + expect(reached(objX + width, objZ + z, 0, BlockAccessFlag.BLOCK_EAST)).toBeFalsy(); + expect(reached(objX + width, objZ + z, 2, BlockAccessFlag.BLOCK_WEST)).toBeFalsy(); + } + }); + + /** + * Test that object rotations are taken into account within [ReachStrategy.reached] + * and do not rely on external modifications. For example, given the parameters of + * an object in coordinates (3203, 3203) with a dimension of 3 x 1 (width x height), + * the following test should pass: + * + * Object rotation of [1] or [3]. (flipped) + * ``` + * -------- + * ---o---- + * --o o--- + * --o o--- + * --o o--- + * ---o---- + * -------- + * -------- + * ``` + * Where: + * - Area starts from bottom-left and makes its way to top-right. (3200,3200 - 3207,3207) + * - ' ' (whitespace) are the tiles occupied by the rotated object. + * - 'o' are the tiles that successfully pass [ReachStrategy.reached]. + * - '-' represents every other tile in the area. (in this case a zone, or 8x8 tile area) + */ + test.each(ROTATED_OBJECT_TEST_ARGS)('test rotated object flipped', (objX, objZ, { width, height }) => { + const LEVEL = 0; + + const minX = objX - 16, minZ = objZ - 16; + const maxX = objX + 16, maxZ = objZ + 16; + + const map = buildCollisionMap(minX, minZ, maxX, maxZ); + flag(map, objX, objZ, width, height, CollisionFlag.LOC); + + const reached = (srcX: number, srcZ: number, rot: number, blockAccessFlags: number = 0) => { + return ReachStrategy.reached( + map, + LEVEL, + srcX, + srcZ, + objX, + objZ, + width, + height, + 1, + rot, + -2, // Use rectangular exclusive strategy + blockAccessFlags + ); + }; + + for (let x = 0; x < height; x++) { // width and height are swapped + // Test coming from south tiles. + expect(reached(objX + x, objZ - 1, 1)).toBeTruthy(); + expect(reached(objX + x, objZ - 1, 3)).toBeTruthy(); + // Test coming from north tiles. + expect(reached(objX + x, objZ + width, 1)).toBeTruthy(); // width and height are swapped + expect(reached(objX + x, objZ + width, 3)).toBeTruthy(); // width and height are swapped + // Test coming from south tiles with access blocked. + expect(reached(objX + x, objZ - 1, 1, BlockAccessFlag.BLOCK_EAST)).toBeFalsy(); + expect(reached(objX + x, objZ - 1, 3, BlockAccessFlag.BLOCK_WEST)).toBeFalsy(); + // Test coming from north tiles with access blocked. + expect(reached(objX + x, objZ + width, 1, BlockAccessFlag.BLOCK_WEST)).toBeFalsy(); // width and height are swapped + expect(reached(objX + x, objZ + width, 3, BlockAccessFlag.BLOCK_EAST)).toBeFalsy(); // width and height are swapped + } + + for (let z = 0; z < width; z++) { // width and height are swapped + // Test coming from west tiles. + expect(reached(objX - 1, objZ + z, 1)).toBeTruthy(); + expect(reached(objX - 1, objZ + z, 3)).toBeTruthy(); + // Test coming from east tiles. + expect(reached(objX + height, objZ + z, 1)).toBeTruthy(); // width and height are swapped + expect(reached(objX + height, objZ + z, 3)).toBeTruthy(); // width and height are swapped + // Test coming from west tiles with access blocked. + expect(reached(objX - 1, objZ + z, 1, BlockAccessFlag.BLOCK_SOUTH)).toBeFalsy(); + expect(reached(objX - 1, objZ + z, 3, BlockAccessFlag.BLOCK_NORTH)).toBeFalsy(); + // Test coming from east tiles with access blocked. + expect(reached(objX + height, objZ + z, 1, BlockAccessFlag.BLOCK_NORTH)).toBeFalsy(); // width and height are swapped + expect(reached(objX + height, objZ + z, 3, BlockAccessFlag.BLOCK_SOUTH)).toBeFalsy(); // width and height are swapped + } + }); +}); \ No newline at end of file diff --git a/test/rsmod/reach/RectangleBoundaryUtils.test.ts b/test/rsmod/reach/RectangleBoundaryUtils.test.ts new file mode 100644 index 0000000..b5644b8 --- /dev/null +++ b/test/rsmod/reach/RectangleBoundaryUtils.test.ts @@ -0,0 +1,213 @@ +import CollisionFlagMap from '../../../src/rsmod/collision/CollisionFlagMap'; +import BlockAccessFlag from '../../../src/rsmod/flag/BlockAccessFlag'; +import CollisionFlag from '../../../src/rsmod/flag/CollisionFlag'; +import RectangleBoundaryUtils from '../../../src/rsmod/reach/RectangleBoundaryUtils'; + +describe('RectangleBoundaryUtils', () => { + let flags: CollisionFlagMap; + let blockAccessFlags: number; + let level: number; + + beforeEach(() => { + // Initialize with some default values + flags = new CollisionFlagMap(); + blockAccessFlags = 0; + level = 0; + }); + + describe('reachRectangleN', () => { + describe('no collision flags', () => { + describe('size 2', () => { + it('should return true when src is west of destination', () => { + const srcX = 0, srcZ = 2, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeTruthy(); + }); + + it('should return true when src is east of destination', () => { + const srcX = 4, srcZ = 2, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeTruthy(); + }); + + it('should return true when src is south of destination', () => { + const srcX = 2, srcZ = 4, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeTruthy(); + }); + + it('should return true when src is north of destination', () => { + const srcX = 2, srcZ = 0, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeTruthy(); + }); + }); + }); + + describe('block access flags', () => { + describe('size 2', () => { + it('should return false when a wall is to the east of src and we cannot pass', () => { + const srcX = 0, srcZ = 2, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_EAST); + blockAccessFlags = BlockAccessFlag.BLOCK_WEST; + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeFalsy(); + }); + + it('should return false when a wall is to the west of src and we cannot pass', () => { + const srcX = 4, srcZ = 2, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_WEST); + blockAccessFlags = BlockAccessFlag.BLOCK_EAST; + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeFalsy(); + }); + + it('should return false when a wall is to the south of src and we cannot pass', () => { + const srcX = 2, srcZ = 4, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_SOUTH); + blockAccessFlags = BlockAccessFlag.BLOCK_NORTH; + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeFalsy(); + }); + + it('should return false when a wall is to the north of src and we cannot pass', () => { + const srcX = 2, srcZ = 0, destX = 2, destZ = 2, srcWidth = 2, srcHeight = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_NORTH); + blockAccessFlags = BlockAccessFlag.BLOCK_SOUTH; + + expect(RectangleBoundaryUtils.collides(srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight)).toBeFalsy(); + expect(RectangleBoundaryUtils.reachRectangleN(flags, level, srcX, srcZ, destX, destZ, srcWidth, srcHeight, destWidth, destHeight, blockAccessFlags)).toBeFalsy(); + }); + }); + }); + }); + + describe('reachRectangle1', () => { + describe('no collision flags', () => { + it('should return true when src is west of destination', () => { + const srcX = 1, srcZ = 2, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(true); + }); + + it('should return true when src is east of destination', () => { + const srcX = 4, srcZ = 2, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(true); + }); + + it('should return true when src is south of destination', () => { + const srcX = 2, srcZ = 1, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(true); + }); + + it('should return true when src is north of destination', () => { + const srcX = 2, srcZ = 4, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(true); + }); + }); + + describe('block access flags', () => { + it('should return false when a wall is to the east of src and we cannot pass', () => { + const srcX = 1, srcZ = 2, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_EAST); + blockAccessFlags = BlockAccessFlag.BLOCK_WEST; + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + + it('should return false when a wall is to the west of src and we cannot pass', () => { + const srcX = 4, srcZ = 2, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_WEST); + blockAccessFlags = BlockAccessFlag.BLOCK_EAST; + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + + it('should return false when a wall is to the south of src and we cannot pass', () => { + const srcX = 2, srcZ = 1, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_NORTH); + blockAccessFlags = BlockAccessFlag.BLOCK_SOUTH; + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + + it('should return false when a wall is to the north of src and we cannot pass', () => { + const srcX = 2, srcZ = 4, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_SOUTH); + blockAccessFlags = BlockAccessFlag.BLOCK_NORTH; + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + }); + + describe('positioning', () => { + it('should return false when src is not adjacent to destination', () => { + const srcX = 5, srcZ = 5, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + + it('should return false when src is within the destination rectangle', () => { + const srcX = 3, srcZ = 3, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + + it('should return true when src is at the boundary and no wall blocking it', () => { + const srcX = 3, srcZ = 4, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.OPEN); + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(true); + }); + + it('should return false when src is at the boundary and there is a wall blocking it', () => { + const srcX = 3, srcZ = 4, destX = 2, destZ = 2, destWidth = 2, destHeight = 2; + + flags.set(srcX, srcZ, level, CollisionFlag.WALL_SOUTH); + blockAccessFlags = BlockAccessFlag.BLOCK_NORTH; + + expect(RectangleBoundaryUtils.reachRectangle1(flags, level, srcX, srcZ, destX, destZ, destWidth, destHeight, blockAccessFlags)).toBe(false); + }); + }); + + }); +}); \ No newline at end of file diff --git a/test/rsmod/reach/RectangularReachStrategy.test.ts b/test/rsmod/reach/RectangularReachStrategy.test.ts new file mode 100644 index 0000000..151c974 --- /dev/null +++ b/test/rsmod/reach/RectangularReachStrategy.test.ts @@ -0,0 +1,465 @@ +import CollisionFlag from '../../../src/rsmod/flag/CollisionFlag'; +import ReachStrategy from '../../../src/rsmod/reach/ReachStrategy'; +import DirectionFlag from '../../../src/rsmod/flag/DirectionFlag'; +import CollisionFlagMap from '../../../src/rsmod/collision/CollisionFlagMap'; + +function buildCollisionMap(x1: number, z1: number, x2: number, z2: number) { + const map = new CollisionFlagMap(); + for (let level = 0; level < 4; level++) { + for (let z = Math.min(z1, z2); z <= Math.max(z1, z2); z++) { + for (let x = Math.min(x1, x2); x <= Math.max(x1, x2); x++) { + map.allocateIfAbsent(x, z, level); + } + } + } + return map; +} + +function flag(map: CollisionFlagMap, baseX: number, baseZ: number, width: number, height: number, mask: number) { + for (let level = 0; level < 4; level++) { + for (let z = 0; z < height; z++) { + for (let x = 0; x < width; x++) { + map.set(baseX + x, baseZ + z, level, mask); + } + } + } +} + +describe('RectangularReachStrategy', () => { + const BLOCK_ACCESS_FLAG_TEST_ARGS = [ + [ 0, 1, DirectionFlag.NORTH ], + [ 1, 0, DirectionFlag.EAST ], + [ 0, -1, DirectionFlag.SOUTH ], + [ -1, 0, DirectionFlag.WEST ] + ] as const; + + const DIMENSIONS_TEST_ARGS = [ + [ 1, 1 ], + [ 1, 2 ], + [ 1, 3 ], + [ 2, 1 ], + [ 2, 2 ], + [ 2, 3 ], + [ 3, 1 ], + [ 3, 2 ], + [ 3, 3 ] + ] as const; + + const WALL_STRAIGHT_STRATEGY_TEST_ARGS = [ + [ 0, 0, 1, CollisionFlag.WALL_SOUTH ], + [ 0, 0, -1, CollisionFlag.WALL_NORTH ], + [ 1, -1, 0, CollisionFlag.WALL_EAST ], + [ 1, 1, 0, CollisionFlag.WALL_WEST ], + [ 2, 0, 1, CollisionFlag.WALL_SOUTH ], + [ 2, 0, -1, CollisionFlag.WALL_NORTH ], + [ 3, -1, 0, CollisionFlag.WALL_EAST ], + [ 3, 1, 0, CollisionFlag.WALL_WEST ] + ] as const; + + const WALL_L_STRATEGY_TEST_ARGS = [ + [ 0, 1, 0, CollisionFlag.WALL_WEST ], + [ 0, 0, -1, CollisionFlag.WALL_NORTH ], + [ 1, -1, 0, CollisionFlag.WALL_EAST ], + [ 1, 0, -1, CollisionFlag.BLOCK_NORTH ], + [ 2, -1, 0, CollisionFlag.BLOCK_EAST ], + [ 2, 0, 1, CollisionFlag.BLOCK_NORTH ], + [ 3, 0, 1, CollisionFlag.BLOCK_SOUTH ], + [ 3, 1, 0, CollisionFlag.BLOCK_WEST ] + ] as const; + + const WALLDECOR_DIAGONAL_OFFSET_STRATEGY_TEST_ARGS = [ + [ 0, 1, 0, CollisionFlag.WALL_WEST ], + [ 0, 0, -1, CollisionFlag.WALL_NORTH ], + [ 1, -1, 0, CollisionFlag.WALL_EAST ], + [ 1, 0, -1, CollisionFlag.WALL_NORTH ], + [ 2, -1, 0, CollisionFlag.WALL_EAST ], + [ 2, 0, 1, CollisionFlag.WALL_SOUTH ], + [ 3, 1, 0, CollisionFlag.WALL_WEST ], + [ 3, 0, 1, CollisionFlag.WALL_SOUTH ] + ]; + + describe('test wall decor strategy', () => { + const srcX = 3200; + const srcZ = 3200; + const objX = 3200; + const objZ = 3200; + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + + describe('shape 6', () => { + test.each(WALLDECOR_DIAGONAL_OFFSET_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 6); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 6); + expect(reached2).toBeTruthy(); + }); + }); + + describe('shape 7', () => { + test.each(WALLDECOR_DIAGONAL_OFFSET_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, ReachStrategy.alteredRotation(rotation, 7), 7); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, ReachStrategy.alteredRotation(rotation, 7), 7); + expect(reached2).toBeTruthy(); + }); + }); + + describe('shape 8', () => { + test.each(WALLDECOR_DIAGONAL_OFFSET_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 8); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 8); + expect(reached2).toBeTruthy(); + }); + }); + }); + + describe('test wall strategy', () => { + describe('no flags', () => { + const srcX = 3200; + const srcZ = 3200; + const objX = 3200; + const objZ = 3200; + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + + describe('shape 0', () => { + test.each(WALL_STRAIGHT_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, objX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 0); + expect(reached).toBeFalsy(); + + const reached2 = ReachStrategy.reached(map, 0, objX, objZ, objX + dirX, objZ + dirZ, 1, 1, 1, rotation, 0); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + + describe('shape 2', () => { + test.each(WALL_L_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, objX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 2); + expect(reached).toBeFalsy(); + + const reached2 = ReachStrategy.reached(map, 0, objX, objZ, objX + dirX, objZ + dirZ, 1, 1, 1, rotation, 2); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + + describe('shape 9', () => { + test.each(WALL_STRAIGHT_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, objX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 9); + expect(reached).toBeFalsy(); + + const reached2 = ReachStrategy.reached(map, 0, objX, objZ, objX + dirX, objZ + dirZ, 1, 1, 1, rotation, 9); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + }); + + describe('with flags', () => { + const srcX = 3200; + const srcZ = 3200; + const objX = 3200; + const objZ = 3200; + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + + describe('shape 0', () => { + test.each(WALL_STRAIGHT_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 0); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 0); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + + describe('shape 2', () => { + test.each(WALL_L_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 2); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 2); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + + describe('shape 9', () => { + test.each(WALL_STRAIGHT_STRATEGY_TEST_ARGS)('test reach with dimensions', (rotation, dirX, dirZ, flag) => { + map.set(objX + dirX, objZ + dirZ, 0, flag); + + const reached = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 9); + expect(reached).toBeFalsy(); + + map.set(objX + dirX, objZ + dirZ, 0, CollisionFlag.OPEN); + + const reached2 = ReachStrategy.reached(map, 0, srcX + dirX, objZ + dirZ, objX, objZ, 1, 1, 1, rotation, 9); + expect(reached2).toBeTruthy(); + + map.remove(objX + dirX, objZ + dirZ, 0, flag); + }); + }); + }); + }); + + describe('test divided by loc', () => { + const srcX = 3200; + const srcZ = 3200; + const objX = 3200; + const objZ = 3201; + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH); + + test('test blocked north', () => { + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeFalsy(); + }); + + test('test free east', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_EAST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free south', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free west', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_WEST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free northwest', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH_WEST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free northeast', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH_EAST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free southeast', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH_EAST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + + test('test free southwest', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH_WEST); + const reached = ReachStrategy.reached(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, 10); + expect(reached).toBeTruthy(); + }); + }); + + describe('test divided by wall', () => { + const srcX = 3200; + const srcZ = 3200; + const objX = 3200; + const objZ = 3201; + const map = buildCollisionMap(srcX, srcZ, objX, objZ); + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH); + + test('test blocked north', () => { + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeFalsy(); + }); + + test('test free east', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_EAST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free south', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free west', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_WEST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free northwest', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH_WEST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free northeast', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_NORTH_EAST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free southeast', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH_EAST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + + test('test free southwest', () => { + map.set(srcX, srcZ, 0, CollisionFlag.WALL_SOUTH_WEST); + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1); + expect(reached).toBeTruthy(); + }); + }); + + describe('test block access flag', () => { + test.each(BLOCK_ACCESS_FLAG_TEST_ARGS)('test block access flag', (offX, offZ, directionFlag) => { + const objX = 3205; + const objZ = 3205; + const map = buildCollisionMap(objX, objZ, objX, objZ); + flag(map, objX, objZ, 1, 1, CollisionFlag.LOC); + + const cardinal = [ + [ 0, -1 ], + [ 0, 1 ], + [ -1, 0 ], + [ 1, 0 ] + ]; + + for (const dir of cardinal) { + const srcX = objX + dir[0]; + const srcZ = objZ + dir[1]; + map.allocateIfAbsent(srcX, srcZ, 0); + + const reached = ReachStrategy.reachRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, directionFlag); + + if (dir[0] === offX && dir[1] === offZ) { + expect(reached).toBeFalsy(); + } else { + expect(reached).toBeTruthy(); + } + } + }); + + test.each(BLOCK_ACCESS_FLAG_TEST_ARGS)('test block access flag exclusive', (offX, offZ, directionFlag) => { + const objX = 3205; + const objZ = 3205; + const map = buildCollisionMap(objX, objZ, objX, objZ); + flag(map, objX, objZ, 1, 1, CollisionFlag.LOC); + + const cardinal = [ + [ 0, -1 ], + [ 0, 1 ], + [ -1, 0 ], + [ 1, 0 ] + ]; + + for (const dir of cardinal) { + const srcX = objX + dir[0]; + const srcZ = objZ + dir[1]; + map.allocateIfAbsent(srcX, srcZ, 0); + + const reached = ReachStrategy.reachExclusiveRectangle(map, 0, srcX, srcZ, objX, objZ, 1, 1, 1, 0, directionFlag); + + if (dir[0] === offX && dir[1] === offZ) { + expect(reached).toBeFalsy(); + } else { + expect(reached).toBeTruthy(); + } + } + }); + }); + + describe('test reach with dimensions', () => { + test.each(DIMENSIONS_TEST_ARGS)('test reach with dimensions', (width, height) => { + const objX = 3202 + width; + const objZ = 3202; + const map = buildCollisionMap(objX - 1, objZ - 1, objX + width, objZ + height); + flag(map, objX, objZ, width, height, CollisionFlag.LOC); + + const reached1 = ReachStrategy.reachRectangle(map, 0, objX - 2, objZ - 1, objX, objZ, 1, width, height); + expect(reached1).toBeFalsy(); + + const reached2 = ReachStrategy.reachRectangle(map, 0, objX - 1, objZ - 2, objX, objZ, 1, width, height); + expect(reached2).toBeFalsy(); + + for (let x = -1; x < width + 1; x++) { + for (let z = -1; z < height + 1; z++) { + const reached3 = ReachStrategy.reachRectangle(map, 0, objX + x, objZ + z, objX, objZ, 1, width, height); + const diagonal = z === -1 && x === -1 || z === height && x === width || z === -1 && x === width || z === height && x === -1; + if (diagonal) { + expect(reached3).toBeFalsy(); + continue; + } + expect(reached3).toBeTruthy(); + } + } + }); + + test.each(DIMENSIONS_TEST_ARGS)('test reach with dimensions exclusive', (width, height) => { + const objX = 3202 + width; + const objZ = 3202; + const map = buildCollisionMap(objX - 1, objZ - 1, objX + width, objZ + height); + flag(map, objX, objZ, width, height, CollisionFlag.LOC); + + const reached1 = ReachStrategy.reachExclusiveRectangle(map, 0, objX - 2, objZ - 1, objX, objZ, 1, width, height); + expect(reached1).toBeFalsy(); + + const reached2 = ReachStrategy.reachExclusiveRectangle(map, 0, objX - 1, objZ - 2, objX, objZ, 1, width, height); + expect(reached2).toBeFalsy(); + + for (let x = -1; x < width + 1; x++) { + for (let z = -1; z < height + 1; z++) { + const reached3 = ReachStrategy.reachExclusiveRectangle(map, 0, objX + x, objZ + z, objX, objZ, 1, width, height); + const diagonal = z === -1 && x === -1 || z === height && x === width || z === -1 && x === width || z === height && x === -1; + if (diagonal) { + expect(reached3).toBeFalsy(); + continue; + } + const inLocArea = 0 <= x && width > x && 0 <= z && height > z; + if (inLocArea) { + expect(reached3).toBeFalsy(); + continue; + } + expect(reached3).toBeTruthy(); + } + } + }); + }); +}); \ No newline at end of file diff --git a/test/rsmod/utils/RotationUtils.test.ts b/test/rsmod/utils/RotationUtils.test.ts new file mode 100644 index 0000000..b6e46e9 --- /dev/null +++ b/test/rsmod/utils/RotationUtils.test.ts @@ -0,0 +1,54 @@ +import RotationUtils from '../../../src/rsmod/utils/RotationUtils'; +import BlockAccessFlag from '../../../src/rsmod/flag/BlockAccessFlag'; + +describe('RotationUtils', () => { + test('test rotate width', () => { + const width = 3; + const height = 2; + expect(RotationUtils.rotate(0, width, height)).toBe(width); + expect(RotationUtils.rotate(1, width, height)).toBe(height); + expect(RotationUtils.rotate(2, width, height)).toBe(width); + expect(RotationUtils.rotate(3, width, height)).toBe(height); + }); + + test('test rotate height', () => { + const width = 3; + const height = 2; + expect(RotationUtils.rotate(0, height, width)).toBe(height); + expect(RotationUtils.rotate(1, height, width)).toBe(width); + expect(RotationUtils.rotate(2, height, width)).toBe(height); + expect(RotationUtils.rotate(3, height, width)).toBe(width); + }); + + test('test rotate block access flag north', () => { + const north = BlockAccessFlag.BLOCK_NORTH; + expect(RotationUtils.rotateFlags(0, north)).toBe(BlockAccessFlag.BLOCK_NORTH); + expect(RotationUtils.rotateFlags(1, north)).toBe(BlockAccessFlag.BLOCK_EAST); + expect(RotationUtils.rotateFlags(2, north)).toBe(BlockAccessFlag.BLOCK_SOUTH); + expect(RotationUtils.rotateFlags(3, north)).toBe(BlockAccessFlag.BLOCK_WEST); + }); + + test('test rotate block access flag east', () => { + const east = BlockAccessFlag.BLOCK_EAST; + expect(RotationUtils.rotateFlags(0, east)).toBe(BlockAccessFlag.BLOCK_EAST); + expect(RotationUtils.rotateFlags(1, east)).toBe(BlockAccessFlag.BLOCK_SOUTH); + expect(RotationUtils.rotateFlags(2, east)).toBe(BlockAccessFlag.BLOCK_WEST); + expect(RotationUtils.rotateFlags(3, east)).toBe(BlockAccessFlag.BLOCK_NORTH); + }); + + test('test rotate block access flag south', () => { + const south = BlockAccessFlag.BLOCK_SOUTH; + expect(RotationUtils.rotateFlags(0, south)).toBe(BlockAccessFlag.BLOCK_SOUTH); + expect(RotationUtils.rotateFlags(1, south)).toBe(BlockAccessFlag.BLOCK_WEST); + expect(RotationUtils.rotateFlags(2, south)).toBe(BlockAccessFlag.BLOCK_NORTH); + expect(RotationUtils.rotateFlags(3, south)).toBe(BlockAccessFlag.BLOCK_EAST); + }); + + test('test rotate block access flag west', () => { + const west = BlockAccessFlag.BLOCK_WEST; + expect(RotationUtils.rotateFlags(0, west)).toBe(BlockAccessFlag.BLOCK_WEST); + expect(RotationUtils.rotateFlags(1, west)).toBe(BlockAccessFlag.BLOCK_NORTH); + expect(RotationUtils.rotateFlags(2, west)).toBe(BlockAccessFlag.BLOCK_EAST); + expect(RotationUtils.rotateFlags(3, west)).toBe(BlockAccessFlag.BLOCK_SOUTH); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..097028e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "target": "esnext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowJs": false, + "checkJs": false, + "strict": true, + "alwaysStrict": true, + "allowSyntheticDefaultImports": true, + "declaration": true + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file