diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..6287566 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,28 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": [ + "standard" + ], + "ignorePatterns": ["/client/dist/*", "client/certs/*", "client/favicon_package/*", "client/webpack/*", "node_modules/*"], + "parser": "@babel/eslint-parser", + "parserOptions": { + "requireConfigFile": false, + "ecmaVersion": 12, + "sourceType": "module" + }, + "rules": { + "indent": ["error", 4, { "SwitchCase": 1 }], + "semi": [2, "always"], + "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before", "&&": "before", "||": "before", "+": "after" } }], + "no-void": ["error", { "allowAsStatement": true }], + "no-prototype-builtins": "off", + "no-undef": "off", + "no-return-assign": "warn", + "prefer-promise-reject-errors": "warn", + "no-trailing-spaces": "off" + } +} diff --git a/.gcloudignore b/.gcloudignore new file mode 100644 index 0000000..4d7d693 --- /dev/null +++ b/.gcloudignore @@ -0,0 +1,17 @@ +# This file specifies files that are *not* uploaded to Google Cloud +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Node.js dependencies: +node_modules/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8fc412e..eb06cc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .idea node_modules/* +client/certs/ +client/dist/ +app.yaml .vscode/launch.json diff --git a/Procfile b/Procfile index 489b270..8fbd1b9 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: node server.js +web: node main.js diff --git a/README.md b/README.md index 4ec0518..eb6dcff 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,83 @@ -Werewolf +An application to run games of Werewolf (Mafia) +smoothly when you don't have a deck, or when you and your friends are together virtually. Inspired by my time playing +Ultimate Werewolf and by +2020's quarantine. The app is free to use and anonymous. -This app is still in active development. The latest deployment can be found here +After a long hiatus from maintaining the application, I have come back and undertaken a large-scale redesign, rewriting +most of the code and producing a result that I believe is more stable and has much more sensible client-server interaction. -A Werewolf utility that provides the tools to run games smoothly in the absence of a deck, or in any context in which traditional moderation is hindered. +![player](./client/src/images/screenshots/player.PNG) -This is a Javascript application running on a node express server. I am using the socket.io package as a wrapper for Javascript Websocket. This was built from scratch as a learning project; I do not claim it as a shining example of socket programming or web app design in general. I welcome collaboration and suggestions for improvements. +## Features -All pixel art is my own (for better or for worse). +This is meant to facilitate a game through a shared game state and various utilities - not to control +every aspect of the game flow. The app provides a host the ability to construct a deck with a custom distribution +of roles. Players can join a game with one click and are then dealt a role to their device. The app features a concealable +role card, an optional shared timer (which the moderator can play/pause), a reference for roles in the game, and status +information for players including who is alive/dead and who has had their role revealed. The app also provides the +option for a "dedicated moderator" or a "temporary moderator." Dedicated moderators will never be dealt in, and will +have all controls and information from the beginning of the game. Temporary moderators _will_ be dealt a role and will +have some moderator powers, but will only exist until the first player is out, at which point that player will be made +the game's dedicated moderator. A dedicated moderator can transfer their powers to another player that is out of the +game at any time. -This is meant to facilitate the game in a face-to-face social setting and provide utility/convenience - not control all aspects of the game flow. The app allows players to create or join a game lobby where state is synchronized. The creator of the game can build a deck from either the standard set of provided cards, or from any number of custom cards the user creates. Once the game begins, this deck will be randomly dealt to all participants. +The application prioritizes responsiveness. A key scenario would be when a group is hanging out with only their phones. -Players will see their card (which can be flipped up and down), an optional timer, and a button to say that they have been killed off. If a player presses the button, they will be removed from the game, and their role revealed to other players. The game will continue until the end of the game is detected, or the timer expires. +## Tech Stack -To learn more about this type of game, see the Wikipedia entry on the game's ancestor, Mafia. +This is a Node.js application. It is written purely using JavaScript/HTML/CSS. The main dependencies are +Express.js and Socket.io. It is fully open-source +and under the MIT license. This was (and still is) fundamentally a learning project, and thus I welcome collaboration +and feedback of any kind. -
-
- home - create - lobby -
-
-
- game - killed - hunter -
-
-
-
+All pixel art is my own, for better or for worse. -# Run Locally +## Contributing and Developers' Guide -Run `npm install` from the root directory. +### Running Locally -Run `node server.js` from the root directory, navigate to **localhost:5000** +If you haven't already, install Node.js. This should include the node package +manager, npm. -# Testing/Debugging +Run `npm install` from the root directory to install the necessary dependencies. -Use `npm run test` to run unit tests using Jasmine (test coverage is barebones and is currently being expanded) -

-To turn on logging at the debug level, add the `debug` argument like so: +These instructions assume you are somewhat familiar with Node.js and npm. At this point, we will use some of the run +commands defined in `package.json`. -`node server.js -- debug` +First, start a terminal in the root directory. Execute `npm run build:dev`. This uses +Webpack to bundle javascript from the `client/src` directory and place it in the `client/dist` directory, which is ignored by Git. +If you look at this command as defined in `package.json`, it uses the `--watch` flag, which means the process will continue +to run in this terminal, watching for changes to JavaScript within the `client/src` directory and re-bundling automatically. You +definitely want this if making frequent JavaScript changes to client-side source code. Any other changes, such as to HTML or CSS +files, are not bundled, and thus your changes will be picked up simply by refreshing the browser. -# Contributing +Next, in a separate terminal, we will start the application: -Contributions of any kind are welcome. Simply open an issue or pull request and I can respond accordingly. +`npm run start:dev` (if developing on a linux machine)
+`npm run start:dev:windows` (if developing on a windows machine) + +This will start the application and serve it on the default port of **5000**. This command uses nodemon +to listen for changes to **server-side code** (Node.js modules) and automatically restart the server. If you do not want +this, run instead `npm run start:dev:no-hot-reload` or `npm run start:dev:windows:no-hot-reload`. + +And there we go! You should be able to navigate to and use the application on localhost. There are additional CLI arguments +you can provide to the run commands that specify things such as port, HTTP vs HTTPS, or the log level. I **highly recommend** +consulting these below. + +### CLI Options + +These options will be at the end of your run command following two dashes e.g. `npm run start:dev -- [options]`. +Options are whitespace-delimited key-value pairs with the syntax `[key]=[value]` e.g. `port=4242`. Options include: + +- `port`. Specify an integer port for the application. +- `loglevel` the log level for the application. Can be `info`, `error`, `warn`, `debug`, or `trace`. +- `protocol` either HTTP or HTTPS. If you specify HTTPS, the server will look in `client/certs` for localhost certificates +before serving the application over HTTPS - otherwise it will revert to HTTP. Using HTTPS is particularly useful if you + want to make the application public on your home network, which would allow you to test it on your mobile device. **Careful - + I had to disable my computer's firewall for this to work, which would of course make browsing the internet much riskier.** + +## Testing + +Unit tests are written using Jasmine. Execute them by running `npm run test`. +They reside in the `spec/unit` directory, which maps 1:1 to the application directory structure - i.e. unit tests for +`server/modules/GameManager` are found in `spec/unit/server/modules/GameManager_Spec.js` diff --git a/_config.yml b/_config.yml deleted file mode 100644 index f3da9b6..0000000 --- a/_config.yml +++ /dev/null @@ -1,2 +0,0 @@ -theme: jekyll-theme-minimal -logo: /assets/images/roles-small/wolf_logo.png diff --git a/app.yaml b/app.yaml new file mode 100644 index 0000000..b55ef99 --- /dev/null +++ b/app.yaml @@ -0,0 +1,19 @@ +runtime: nodejs +env: flex +network: + session_affinity: true +liveness_check: + path: "/liveness_check" + check_interval_sec: 60 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 +readiness_check: + path: "/readiness_check" + check_interval_sec: 60 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + app_start_timeout_sec: 600 +manual_scaling: + instances: 1 diff --git a/assets/fonts/Diavlo_BLACK_II_37.otf b/assets/fonts/Diavlo_BLACK_II_37.otf deleted file mode 100644 index eb42a9e..0000000 Binary files a/assets/fonts/Diavlo_BLACK_II_37.otf and /dev/null differ diff --git a/assets/fonts/Diavlo_BOLD_II_37.otf b/assets/fonts/Diavlo_BOLD_II_37.otf deleted file mode 100644 index 31aeb80..0000000 Binary files a/assets/fonts/Diavlo_BOLD_II_37.otf and /dev/null differ diff --git a/assets/fonts/Diavlo_BOOK_II_37.otf b/assets/fonts/Diavlo_BOOK_II_37.otf deleted file mode 100644 index 14f5641..0000000 Binary files a/assets/fonts/Diavlo_BOOK_II_37.otf and /dev/null differ diff --git a/assets/fonts/Diavlo_LIGHT_II_37.otf b/assets/fonts/Diavlo_LIGHT_II_37.otf deleted file mode 100644 index 18528ed..0000000 Binary files a/assets/fonts/Diavlo_LIGHT_II_37.otf and /dev/null differ diff --git a/assets/fonts/Diavlo_MEDIUM_II_37.otf b/assets/fonts/Diavlo_MEDIUM_II_37.otf deleted file mode 100644 index 1cfea27..0000000 Binary files a/assets/fonts/Diavlo_MEDIUM_II_37.otf and /dev/null differ diff --git a/assets/fonts/REVOLUTION.ttf b/assets/fonts/REVOLUTION.ttf deleted file mode 100644 index 2d77382..0000000 Binary files a/assets/fonts/REVOLUTION.ttf and /dev/null differ diff --git a/assets/fonts/manrope-light.otf b/assets/fonts/manrope-light.otf deleted file mode 100644 index 2b31915..0000000 Binary files a/assets/fonts/manrope-light.otf and /dev/null differ diff --git a/assets/images/gallery.svg b/assets/images/gallery.svg deleted file mode 100644 index 56a2e0f..0000000 --- a/assets/images/gallery.svg +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/assets/images/import.svg b/assets/images/import.svg deleted file mode 100644 index 4507e6c..0000000 --- a/assets/images/import.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/info.svg b/assets/images/info.svg deleted file mode 100644 index 8a71b01..0000000 --- a/assets/images/info.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - background - - - - - - - Layer 1 - - - diff --git a/assets/images/list.svg b/assets/images/list.svg deleted file mode 100644 index d3d8453..0000000 --- a/assets/images/list.svg +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - diff --git a/assets/images/pause-button.svg b/assets/images/pause-button.svg deleted file mode 100644 index 8ac6ece..0000000 --- a/assets/images/pause-button.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - Layer 1 - - - - - diff --git a/assets/images/pencil_green.svg b/assets/images/pencil_green.svg deleted file mode 100644 index 53c2bd5..0000000 --- a/assets/images/pencil_green.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - background - - - - - - - Layer 1 - - - diff --git a/assets/images/question_mark.svg b/assets/images/question_mark.svg deleted file mode 100644 index a90b9f9..0000000 --- a/assets/images/question_mark.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - background - - - - - - - Layer 1 - - - diff --git a/assets/images/roles-small/DreamWolf.png b/assets/images/roles-small/DreamWolf.png deleted file mode 100644 index 67b7a20..0000000 Binary files a/assets/images/roles-small/DreamWolf.png and /dev/null differ diff --git a/assets/images/roles-small/Hunter.png b/assets/images/roles-small/Hunter.png deleted file mode 100644 index c7076e2..0000000 Binary files a/assets/images/roles-small/Hunter.png and /dev/null differ diff --git a/assets/images/roles-small/Mason.png b/assets/images/roles-small/Mason.png deleted file mode 100644 index 7182d35..0000000 Binary files a/assets/images/roles-small/Mason.png and /dev/null differ diff --git a/assets/images/roles-small/Minion.png b/assets/images/roles-small/Minion.png deleted file mode 100644 index ead2d61..0000000 Binary files a/assets/images/roles-small/Minion.png and /dev/null differ diff --git a/assets/images/roles-small/Seer.png b/assets/images/roles-small/Seer.png deleted file mode 100644 index 3e3373b..0000000 Binary files a/assets/images/roles-small/Seer.png and /dev/null differ diff --git a/assets/images/roles-small/Shadow.png b/assets/images/roles-small/Shadow.png deleted file mode 100644 index a591ff0..0000000 Binary files a/assets/images/roles-small/Shadow.png and /dev/null differ diff --git a/assets/images/roles-small/Sorcerer.png b/assets/images/roles-small/Sorcerer.png deleted file mode 100644 index 2c9f2e7..0000000 Binary files a/assets/images/roles-small/Sorcerer.png and /dev/null differ diff --git a/assets/images/roles-small/Villager.png b/assets/images/roles-small/Villager.png deleted file mode 100644 index 2816360..0000000 Binary files a/assets/images/roles-small/Villager.png and /dev/null differ diff --git a/assets/images/roles-small/Werewolf.png b/assets/images/roles-small/Werewolf.png deleted file mode 100644 index d81ac12..0000000 Binary files a/assets/images/roles-small/Werewolf.png and /dev/null differ diff --git a/assets/images/roles-small/wolf_logo.png b/assets/images/roles-small/wolf_logo.png deleted file mode 100644 index f57147a..0000000 Binary files a/assets/images/roles-small/wolf_logo.png and /dev/null differ diff --git a/assets/images/roles/Sorcerer.png b/assets/images/roles/Sorcerer.png deleted file mode 100644 index a85b4da..0000000 Binary files a/assets/images/roles/Sorcerer.png and /dev/null differ diff --git a/assets/images/screenshots/create.PNG b/assets/images/screenshots/create.PNG deleted file mode 100644 index 686392a..0000000 Binary files a/assets/images/screenshots/create.PNG and /dev/null differ diff --git a/assets/images/screenshots/game.PNG b/assets/images/screenshots/game.PNG deleted file mode 100644 index de108bf..0000000 Binary files a/assets/images/screenshots/game.PNG and /dev/null differ diff --git a/assets/images/screenshots/home.PNG b/assets/images/screenshots/home.PNG deleted file mode 100644 index 5ca2301..0000000 Binary files a/assets/images/screenshots/home.PNG and /dev/null differ diff --git a/assets/images/screenshots/hunter.PNG b/assets/images/screenshots/hunter.PNG deleted file mode 100644 index abbb19b..0000000 Binary files a/assets/images/screenshots/hunter.PNG and /dev/null differ diff --git a/assets/images/screenshots/killed.PNG b/assets/images/screenshots/killed.PNG deleted file mode 100644 index 3f764f3..0000000 Binary files a/assets/images/screenshots/killed.PNG and /dev/null differ diff --git a/assets/images/screenshots/lobby.PNG b/assets/images/screenshots/lobby.PNG deleted file mode 100644 index 246326d..0000000 Binary files a/assets/images/screenshots/lobby.PNG and /dev/null differ diff --git a/client/favicon_package/android-chrome-192x192.png b/client/favicon_package/android-chrome-192x192.png new file mode 100644 index 0000000..9fd7645 Binary files /dev/null and b/client/favicon_package/android-chrome-192x192.png differ diff --git a/client/favicon_package/android-chrome-256x256.png b/client/favicon_package/android-chrome-256x256.png new file mode 100644 index 0000000..4a5e54e Binary files /dev/null and b/client/favicon_package/android-chrome-256x256.png differ diff --git a/client/favicon_package/apple-touch-icon.png b/client/favicon_package/apple-touch-icon.png new file mode 100644 index 0000000..7e7e809 Binary files /dev/null and b/client/favicon_package/apple-touch-icon.png differ diff --git a/client/favicon_package/browserconfig.xml b/client/favicon_package/browserconfig.xml new file mode 100644 index 0000000..b3930d0 --- /dev/null +++ b/client/favicon_package/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/client/favicon_package/favicon-16x16.png b/client/favicon_package/favicon-16x16.png new file mode 100644 index 0000000..c973b9d Binary files /dev/null and b/client/favicon_package/favicon-16x16.png differ diff --git a/client/favicon_package/favicon-32x32.png b/client/favicon_package/favicon-32x32.png new file mode 100644 index 0000000..a2b679a Binary files /dev/null and b/client/favicon_package/favicon-32x32.png differ diff --git a/client/favicon_package/favicon.ico b/client/favicon_package/favicon.ico new file mode 100644 index 0000000..1d1cba5 Binary files /dev/null and b/client/favicon_package/favicon.ico differ diff --git a/client/favicon_package/mstile-150x150.png b/client/favicon_package/mstile-150x150.png new file mode 100644 index 0000000..bd2c94c Binary files /dev/null and b/client/favicon_package/mstile-150x150.png differ diff --git a/client/favicon_package/safari-pinned-tab.svg b/client/favicon_package/safari-pinned-tab.svg new file mode 100644 index 0000000..2f93f4f --- /dev/null +++ b/client/favicon_package/safari-pinned-tab.svg @@ -0,0 +1,54 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/client/favicon_package/site.webmanifest b/client/favicon_package/site.webmanifest new file mode 100644 index 0000000..de65106 --- /dev/null +++ b/client/favicon_package/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "", + "short_name": "", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-256x256.png", + "sizes": "256x256", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/client/robots.txt b/client/robots.txt new file mode 100644 index 0000000..d346249 --- /dev/null +++ b/client/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /api/ diff --git a/client/src/config/defaultCards.js b/client/src/config/defaultCards.js new file mode 100644 index 0000000..39891b4 --- /dev/null +++ b/client/src/config/defaultCards.js @@ -0,0 +1,47 @@ +export const defaultCards = [ + { + role: 'Villager', + team: 'good', + description: 'During the day, find the wolves and kill them.' + }, + { + role: 'Werewolf', + team: 'evil', + description: "During the night, choose a villager to kill. Don't get killed." + }, + { + role: 'Dream Wolf', + team: 'evil', + description: "You are a Werewolf, but you don't wake up with the other Werewolves until one of them dies." + }, + { + role: 'Sorceress', + team: 'evil', + description: 'Each night, learn if a chosen person is the Seer.' + }, + { + role: 'Minion', + team: 'evil', + description: 'You are an evil Villager, and you know who the Werewolves are.' + }, + { + role: 'Blind Minion', + team: 'evil', + description: "You are an evil villager, but you don't know who the Werewolves are." + }, + { + role: 'Seer', + team: 'good', + description: 'Each night, learn if a chosen person is a Werewolf.' + }, + { + role: 'Parity Hunter', + team: 'good', + description: 'You beat a werewolf in a 1v1 situation, winning the game for the village.' + }, + { + role: 'Hunter', + team: 'good', + description: 'When you are eliminated, choose another player to go with you.' + } +]; diff --git a/client/src/config/globals.js b/client/src/config/globals.js new file mode 100644 index 0000000..5b374b8 --- /dev/null +++ b/client/src/config/globals.js @@ -0,0 +1,64 @@ +export const globals = { + USER_SIGNATURE_LENGTH: 25, + CLOCK_TICK_INTERVAL_MILLIS: 10, + MAX_CUSTOM_ROLE_NAME_LENGTH: 30, + MAX_CUSTOM_ROLE_DESCRIPTION_LENGTH: 500, + TOAST_DURATION_DEFAULT: 6, + ACCESS_CODE_LENGTH: 6, + PLAYER_ID_COOKIE_KEY: 'play-werewolf-anon-id', + ACCESS_CODE_CHAR_POOL: 'abcdefghijklmnopqrstuvwxyz0123456789', + COMMANDS: { + FETCH_GAME_STATE: 'fetchGameState', + GET_ENVIRONMENT: 'getEnvironment', + START_GAME: 'startGame', + PAUSE_TIMER: 'pauseTimer', + RESUME_TIMER: 'resumeTimer', + GET_TIME_REMAINING: 'getTimeRemaining', + KILL_PLAYER: 'killPlayer', + REVEAL_PLAYER: 'revealPlayer', + TRANSFER_MODERATOR: 'transferModerator', + CHANGE_NAME: 'changeName', + END_GAME: 'endGame', + FETCH_IN_PROGRESS_STATE: 'fetchInitialInProgressState' + }, + STATUS: { + LOBBY: 'lobby', + IN_PROGRESS: 'in progress', + ENDED: 'ended' + }, + ALIGNMENT: { + GOOD: 'good', + EVIL: 'evil' + }, + MESSAGES: { + ENTER_NAME: 'Client must enter name.' + }, + EVENTS: { + PLAYER_JOINED: 'playerJoined', + SYNC_GAME_STATE: 'syncGameState', + START_TIMER: 'startTimer', + KILL_PLAYER: 'killPlayer', + REVEAL_PLAYER: 'revealPlayer', + CHANGE_NAME: 'changeName', + START_GAME: 'startGame', + PLAYER_LEFT: 'playerLeft' + }, + USER_TYPES: { + MODERATOR: 'moderator', + PLAYER: 'player', + TEMPORARY_MODERATOR: 'player / temp mod', + KILLED_PLAYER: 'killed', + SPECTATOR: 'spectator' + }, + ENVIRONMENT: { + LOCAL: 'local', + PRODUCTION: 'production' + }, + USER_TYPE_ICONS: { + player: ' \uD83C\uDFAE', + moderator: ' \uD83D\uDC51', + 'player / temp mod': ' \uD83C\uDFAE\uD83D\uDC51', + spectator: ' \uD83D\uDC7B', + killed: '\uD83D\uDC80' + } +}; diff --git a/client/src/images/GitHub-Mark-32px.png b/client/src/images/GitHub-Mark-32px.png new file mode 100644 index 0000000..8b25551 Binary files /dev/null and b/client/src/images/GitHub-Mark-32px.png differ diff --git a/client/src/images/GitHub-Mark-Light-120px-plus.png b/client/src/images/GitHub-Mark-Light-120px-plus.png new file mode 100644 index 0000000..192846a Binary files /dev/null and b/client/src/images/GitHub-Mark-Light-120px-plus.png differ diff --git a/assets/images/roles/Werewolf.png b/client/src/images/Werewolf.png similarity index 100% rename from assets/images/roles/Werewolf.png rename to client/src/images/Werewolf.png diff --git a/client/src/images/Werewolf_Small.png b/client/src/images/Werewolf_Small.png new file mode 100644 index 0000000..0f6256a Binary files /dev/null and b/client/src/images/Werewolf_Small.png differ diff --git a/client/src/images/add.svg b/client/src/images/add.svg new file mode 100644 index 0000000..b84df19 --- /dev/null +++ b/client/src/images/add.svg @@ -0,0 +1 @@ + diff --git a/client/src/images/clock.svg b/client/src/images/clock.svg new file mode 100644 index 0000000..0aa8181 --- /dev/null +++ b/client/src/images/clock.svg @@ -0,0 +1,14 @@ + + + + background + + + + + + + Layer 1 + + + diff --git a/client/src/images/copy.svg b/client/src/images/copy.svg new file mode 100644 index 0000000..dfb0268 --- /dev/null +++ b/client/src/images/copy.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/assets/images/delete.svg b/client/src/images/delete.svg similarity index 90% rename from assets/images/delete.svg rename to client/src/images/delete.svg index 8938fe0..9a8137f 100644 --- a/assets/images/delete.svg +++ b/client/src/images/delete.svg @@ -9,6 +9,6 @@ Layer 1 - + diff --git a/client/src/images/email.svg b/client/src/images/email.svg new file mode 100644 index 0000000..b510f10 --- /dev/null +++ b/client/src/images/email.svg @@ -0,0 +1 @@ + diff --git a/client/src/images/eye.svg b/client/src/images/eye.svg new file mode 100644 index 0000000..5add930 --- /dev/null +++ b/client/src/images/eye.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/src/images/info.svg b/client/src/images/info.svg new file mode 100644 index 0000000..a09de5e --- /dev/null +++ b/client/src/images/info.svg @@ -0,0 +1 @@ + diff --git a/assets/images/Wolf_Logo.gif b/client/src/images/logo.gif similarity index 100% rename from assets/images/Wolf_Logo.gif rename to client/src/images/logo.gif diff --git a/client/src/images/logo_cropped.gif b/client/src/images/logo_cropped.gif new file mode 100644 index 0000000..7ebb7fb Binary files /dev/null and b/client/src/images/logo_cropped.gif differ diff --git a/client/src/images/pause-button.svg b/client/src/images/pause-button.svg new file mode 100644 index 0000000..76b6c6c --- /dev/null +++ b/client/src/images/pause-button.svg @@ -0,0 +1,8 @@ + + + Layer 1 + + + + + diff --git a/assets/images/pencil.svg b/client/src/images/pencil.svg similarity index 94% rename from assets/images/pencil.svg rename to client/src/images/pencil.svg index 584c54e..355b4f4 100644 --- a/assets/images/pencil.svg +++ b/client/src/images/pencil.svg @@ -9,6 +9,6 @@ Layer 1 - + diff --git a/assets/images/custom.svg b/client/src/images/person.svg similarity index 88% rename from assets/images/custom.svg rename to client/src/images/person.svg index 8eb5fe6..17e7fea 100644 --- a/assets/images/custom.svg +++ b/client/src/images/person.svg @@ -79,7 +79,7 @@ id="layer1" transform="translate(-44.488903,-69.97024)"> + style="fill:none;stroke:#d7d7d7;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> diff --git a/assets/images/play-button.svg b/client/src/images/play-button.svg similarity index 67% rename from assets/images/play-button.svg rename to client/src/images/play-button.svg index 96e17dc..51cc5e1 100644 --- a/assets/images/play-button.svg +++ b/client/src/images/play-button.svg @@ -1,7 +1,7 @@ Layer 1 - - + + diff --git a/assets/images/roles/Minion.png b/client/src/images/roles/BlindMinion.png similarity index 100% rename from assets/images/roles/Minion.png rename to client/src/images/roles/BlindMinion.png diff --git a/assets/images/roles/DreamWolf.png b/client/src/images/roles/DreamWolf.png similarity index 100% rename from assets/images/roles/DreamWolf.png rename to client/src/images/roles/DreamWolf.png diff --git a/assets/images/roles/Hunter.png b/client/src/images/roles/Hunter.png similarity index 100% rename from assets/images/roles/Hunter.png rename to client/src/images/roles/Hunter.png diff --git a/assets/images/roles/Mason.png b/client/src/images/roles/Mason.png similarity index 100% rename from assets/images/roles/Mason.png rename to client/src/images/roles/Mason.png diff --git a/client/src/images/roles/Minion.png b/client/src/images/roles/Minion.png new file mode 100644 index 0000000..e48ec91 Binary files /dev/null and b/client/src/images/roles/Minion.png differ diff --git a/client/src/images/roles/ParityHunter.png b/client/src/images/roles/ParityHunter.png new file mode 100644 index 0000000..c4251e3 Binary files /dev/null and b/client/src/images/roles/ParityHunter.png differ diff --git a/assets/images/roles/Seer.png b/client/src/images/roles/Seer.png similarity index 100% rename from assets/images/roles/Seer.png rename to client/src/images/roles/Seer.png diff --git a/assets/images/roles/Shadow.png b/client/src/images/roles/Sorceress.png similarity index 100% rename from assets/images/roles/Shadow.png rename to client/src/images/roles/Sorceress.png diff --git a/assets/images/roles/Villager.png b/client/src/images/roles/Villager1.png similarity index 100% rename from assets/images/roles/Villager.png rename to client/src/images/roles/Villager1.png diff --git a/client/src/images/roles/Villager2.png b/client/src/images/roles/Villager2.png new file mode 100644 index 0000000..c2283a6 Binary files /dev/null and b/client/src/images/roles/Villager2.png differ diff --git a/client/src/images/roles/Werewolf.png b/client/src/images/roles/Werewolf.png new file mode 100644 index 0000000..fa2d3db Binary files /dev/null and b/client/src/images/roles/Werewolf.png differ diff --git a/client/src/images/roles/custom-role.svg b/client/src/images/roles/custom-role.svg new file mode 100644 index 0000000..3184bb5 --- /dev/null +++ b/client/src/images/roles/custom-role.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/client/src/images/screenshots/deckbuilder.PNG b/client/src/images/screenshots/deckbuilder.PNG new file mode 100644 index 0000000..f7310b0 Binary files /dev/null and b/client/src/images/screenshots/deckbuilder.PNG differ diff --git a/client/src/images/screenshots/moderator.PNG b/client/src/images/screenshots/moderator.PNG new file mode 100644 index 0000000..aca32b0 Binary files /dev/null and b/client/src/images/screenshots/moderator.PNG differ diff --git a/client/src/images/screenshots/player.PNG b/client/src/images/screenshots/player.PNG new file mode 100644 index 0000000..45054c1 Binary files /dev/null and b/client/src/images/screenshots/player.PNG differ diff --git a/client/src/images/tombstone.png b/client/src/images/tombstone.png new file mode 100644 index 0000000..49a91b6 Binary files /dev/null and b/client/src/images/tombstone.png differ diff --git a/client/src/images/tutorial/custom-roles.PNG b/client/src/images/tutorial/custom-roles.PNG new file mode 100644 index 0000000..e5413d5 Binary files /dev/null and b/client/src/images/tutorial/custom-roles.PNG differ diff --git a/client/src/images/tutorial/default-roles.PNG b/client/src/images/tutorial/default-roles.PNG new file mode 100644 index 0000000..57f9c7c Binary files /dev/null and b/client/src/images/tutorial/default-roles.PNG differ diff --git a/client/src/images/tutorial/moderation-option.png b/client/src/images/tutorial/moderation-option.png new file mode 100644 index 0000000..b82fa70 Binary files /dev/null and b/client/src/images/tutorial/moderation-option.png differ diff --git a/assets/images/vanilla_js.png b/client/src/images/vanilla_js.png similarity index 100% rename from assets/images/vanilla_js.png rename to client/src/images/vanilla_js.png diff --git a/client/src/images/x.svg b/client/src/images/x.svg new file mode 100644 index 0000000..5f6dd02 --- /dev/null +++ b/client/src/images/x.svg @@ -0,0 +1,14 @@ + + + + background + + + + + + + Layer 1 + + + diff --git a/client/src/model/Game.js b/client/src/model/Game.js new file mode 100644 index 0000000..2b725e4 --- /dev/null +++ b/client/src/model/Game.js @@ -0,0 +1,9 @@ +export class Game { + constructor (deck, hasTimer, hasDedicatedModerator, timerParams = null) { + this.deck = deck; + this.hasTimer = hasTimer; + this.timerParams = timerParams; + this.hasDedicatedModerator = hasDedicatedModerator; + this.accessCode = null; + } +} diff --git a/client/src/modules/DeckStateManager.js b/client/src/modules/DeckStateManager.js new file mode 100644 index 0000000..12235cd --- /dev/null +++ b/client/src/modules/DeckStateManager.js @@ -0,0 +1,157 @@ +import { globals } from '../config/globals.js'; +import { toast } from './Toast.js'; +import { ModalManager } from './ModalManager'; + +export class DeckStateManager { + constructor () { + this.deck = null; + this.customRoleOptions = []; + this.createMode = false; + this.currentlyEditingRoleName = null; + } + + addToDeck (role) { + const option = this.customRoleOptions.find((option) => option.role === role); + if (option) { + option.quantity = 0; + this.deck.push(option); + this.customRoleOptions.splice(this.customRoleOptions.indexOf(option), 1); + } + } + + addToCustomRoleOptions (role) { + this.customRoleOptions.push(role); + localStorage.setItem('play-werewolf-custom-roles', JSON.stringify(this.customRoleOptions.concat(this.deck.filter(card => card.custom === true)))); + } + + updateCustomRoleOption (option, name, description, team) { + option.role = name; + option.description = description; + option.team = team; + localStorage.setItem('play-werewolf-custom-roles', JSON.stringify(this.customRoleOptions.concat(this.deck.filter(card => card.custom === true)))); + } + + removeFromCustomRoleOptions (name) { + const option = this.customRoleOptions.find((option) => option.role === name); + if (option) { + this.customRoleOptions.splice(this.customRoleOptions.indexOf(option), 1); + localStorage.setItem('play-werewolf-custom-roles', JSON.stringify(this.customRoleOptions.concat(this.deck.filter(card => card.custom === true)))); + toast('"' + name + '" deleted.', 'error', true, true, 3); + } + } + + addCopyOfCard (role) { + const existingCard = this.deck.find((card) => card.role === role); + if (existingCard) { + existingCard.quantity += 1; + } + } + + removeCopyOfCard (role) { + const existingCard = this.deck.find((card) => card.role === role); + if (existingCard && existingCard.quantity > 0) { + existingCard.quantity -= 1; + } + } + + getCurrentDeck () { return this.deck; } + + getCard (role) { + return this.deck.find( + (card) => card.role.toLowerCase().trim() === role.toLowerCase().trim() + ); + } + + getCurrentCustomRoleOptions () { return this.customRoleOptions; } + + getCustomRoleOption (role) { + return this.customRoleOptions.find( + (option) => option.role.toLowerCase().trim() === role.toLowerCase().trim() + ); + }; + + getDeckSize () { + let total = 0; + for (const role of this.deck) { + total += role.quantity; + } + return total; + } + + loadCustomRolesFromCookies () { + const customRoles = localStorage.getItem('play-werewolf-custom-roles'); + if (customRoles !== null && validateCustomRoleCookie(customRoles)) { + this.customRoleOptions = JSON.parse(customRoles); // we know it is valid JSON from the validate function + } + } + + loadCustomRolesFromFile (file, updateRoleListFunction, loadDefaultCardsFn, showIncludedCardsFn) { + const reader = new FileReader(); + reader.onerror = (e) => { + toast(reader.error.message, 'error', true, true, 5); + }; + reader.onload = (e) => { + let string; + if (typeof e.target.result !== 'string') { + string = new TextDecoder('utf-8').decode(e.target.result); + } else { + string = e.target.result; + } + if (validateCustomRoleCookie(string)) { + this.customRoleOptions = JSON.parse(string); // we know it is valid JSON from the validate function + ModalManager.dispelModal('upload-custom-roles-modal', 'modal-background'); + toast('Roles imported successfully', 'success', true, true, 3); + localStorage.setItem('play-werewolf-custom-roles', JSON.stringify(this.customRoleOptions)); + updateRoleListFunction(this, document.getElementById('deck-select')); + // loadDefaultCardsFn(this); + // showIncludedCardsFn(this); + } else { + toast('Invalid formatting. Make sure you import the file as downloaded from this page.', 'error', true, true, 5); + } + }; + reader.readAsText(file); + } + + // via https://stackoverflow.com/a/18197341 + downloadCustomRoles (filename, text) { + const element = document.createElement('a'); + element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + element.setAttribute('download', filename); + + element.style.display = 'none'; + document.body.appendChild(element); + + element.click(); + + document.body.removeChild(element); + } +} + +// this is user-supplied, so we should validate it fully +function validateCustomRoleCookie (cookie) { + const valid = false; + if (typeof cookie === 'string' && new Blob([cookie]).size <= 1000000) { + try { + const cookieJSON = JSON.parse(cookie); + if (Array.isArray(cookieJSON)) { + for (const entry of cookieJSON) { + if (typeof entry === 'object') { + if (typeof entry.role !== 'string' || entry.role.length > globals.MAX_CUSTOM_ROLE_NAME_LENGTH + || typeof entry.team !== 'string' || (entry.team !== globals.ALIGNMENT.GOOD && entry.team !== globals.ALIGNMENT.EVIL) + || typeof entry.description !== 'string' || entry.description.length > globals.MAX_CUSTOM_ROLE_DESCRIPTION_LENGTH + ) { + return false; + } + } else { + return false; + } + } + return true; + } + } catch (e) { + return false; + } + } + + return valid; +} diff --git a/client/src/modules/GameCreationStepManager.js b/client/src/modules/GameCreationStepManager.js new file mode 100644 index 0000000..a126d62 --- /dev/null +++ b/client/src/modules/GameCreationStepManager.js @@ -0,0 +1,646 @@ +import { Game } from '../model/Game.js'; +import { cancelCurrentToast, toast } from './Toast.js'; +import { ModalManager } from './ModalManager.js'; +import { XHRUtility } from './XHRUtility.js'; +import { globals } from '../config/globals.js'; +import { templates } from './Templates.js'; +import { defaultCards } from '../config/defaultCards'; + +export class GameCreationStepManager { + constructor (deckManager) { + loadDefaultCards(deckManager); + deckManager.loadCustomRolesFromCookies(); + this.step = 1; + this.currentGame = new Game(null, null, null, null); + this.deckManager = deckManager; + this.defaultBackHandler = () => { + cancelCurrentToast(); + this.removeStepElementsFromDOM(this.step); + this.decrementStep(); + this.renderStep('creation-step-container', this.step); + }; + this.steps = { + 1: { + title: 'Select your method of moderation:', + forwardHandler: () => { + if (this.currentGame.hasDedicatedModerator !== null) { + cancelCurrentToast(); + this.removeStepElementsFromDOM(this.step); + this.incrementStep(); + this.renderStep('creation-step-container', this.step); + } else { + toast('You must select a moderation option.', 'error', true); + } + } + }, + 2: { + title: 'Create your deck of cards:', + forwardHandler: () => { + if (this.deckManager.getDeckSize() >= 5 && this.deckManager.getDeckSize() <= 50) { + this.currentGame.deck = deckManager.getCurrentDeck().filter((card) => card.quantity > 0); + cancelCurrentToast(); + this.removeStepElementsFromDOM(this.step); + this.incrementStep(); + this.renderStep('creation-step-container', this.step); + } else { + toast('You must have a deck for between 5 and 50 players', 'error', true); + } + }, + backHandler: this.defaultBackHandler + }, + 3: { + title: 'Set an optional timer:', + forwardHandler: () => { + const hours = parseInt(document.getElementById('game-hours').value); + const minutes = parseInt(document.getElementById('game-minutes').value); + if ((isNaN(hours) && isNaN(minutes)) + || (isNaN(hours) && minutes > 0 && minutes < 60) + || (isNaN(minutes) && hours > 0 && hours < 6) + || (hours === 0 && minutes > 0 && minutes < 60) + || (minutes === 0 && hours > 0 && hours < 6) + || (hours > 0 && hours < 6 && minutes >= 0 && minutes < 60) + ) { + if (hasTimer(hours, minutes)) { + this.currentGame.hasTimer = true; + this.currentGame.timerParams = { + hours: hours, + minutes: minutes + }; + } else { + this.currentGame.hasTimer = false; + this.currentGame.timerParams = null; + } + cancelCurrentToast(); + this.removeStepElementsFromDOM(this.step); + this.incrementStep(); + this.renderStep('creation-step-container', this.step); + } else { + if (hours === 0 && minutes === 0) { + toast('You must enter a non-zero amount of time.', 'error', true); + } else { + toast('Invalid timer options. Hours can be a max of 5, Minutes a max of 59.', 'error', true); + } + } + }, + backHandler: this.defaultBackHandler + }, + 4: { + title: 'Review and submit:', + backHandler: this.defaultBackHandler, + forwardHandler: (deck, hasTimer, hasDedicatedModerator, timerParams) => { + XHRUtility.xhr( + '/api/games/create', + 'POST', + null, + JSON.stringify( + new Game(deck, hasTimer, hasDedicatedModerator, timerParams) + ) + ) + .then((res) => { + if (res + && typeof res === 'object' + && Object.prototype.hasOwnProperty.call(res, 'content') + && typeof res.content === 'string' + ) { + window.location = ('/game/' + res.content); + } + }).catch((e) => { + if (e.status === 429) { + toast('You\'ve sent this request too many times.', 'error', true, true, 6); + } + }); + } + } + }; + } + + incrementStep () { + if (this.step < Object.keys(this.steps).length) { + this.step += 1; + } + } + + decrementStep () { + if (this.step > 1) { + this.step -= 1; + } + } + + renderStep (containerId, step) { + document.querySelectorAll('.animated-placeholder').forEach((el) => el.remove()); + document.querySelectorAll('.placeholder-row').forEach((el) => el.remove()); + document.getElementById('step-title').innerText = this.steps[step].title; + switch (step) { + case 1: + renderModerationTypeStep(this.currentGame, containerId, step); + showButtons(false, true, this.steps[step].forwardHandler, null); + break; + case 2: + renderRoleSelectionStep(this.currentGame, containerId, step, this.deckManager); + showButtons(true, true, this.steps[step].forwardHandler, this.steps[step].backHandler); + break; + case 3: + renderTimerStep(containerId, step, this.currentGame); + showButtons(true, true, this.steps[step].forwardHandler, this.steps[step].backHandler); + break; + case 4: + renderReviewAndCreateStep(containerId, step, this.currentGame); + showButtons(true, true, this.steps[step].forwardHandler, this.steps[step].backHandler, this.currentGame); + break; + default: + break; + } + updateTracker(step); + } + + removeStepElementsFromDOM (stepNumber) { + document.getElementById('step-' + stepNumber)?.remove(); + } +} + +function renderModerationTypeStep (game, containerId, stepNumber) { + const stepContainer = document.createElement('div'); + setAttributes(stepContainer, { id: 'step-' + stepNumber, class: 'flex-row-container step' }); + + stepContainer.innerHTML = + "
I will be the dedicated mod. Don't deal me a card.
" + + "
The first person out will mod. Deal me into the game (mod will be assigned automatically).
"; + + const dedicatedOption = stepContainer.querySelector('#moderation-dedicated'); + if (game.hasDedicatedModerator) { + dedicatedOption.classList.add('option-selected'); + } + const selfOption = stepContainer.querySelector('#moderation-self'); + if (game.hasDedicatedModerator === false) { + selfOption.classList.add('option-selected'); + } + + dedicatedOption.addEventListener('click', () => { + dedicatedOption.classList.add('option-selected'); + selfOption.classList.remove('option-selected'); + game.hasDedicatedModerator = true; + }); + + selfOption.addEventListener('click', () => { + selfOption.classList.add('option-selected'); + dedicatedOption.classList.remove('option-selected'); + game.hasDedicatedModerator = false; + }); + + document.getElementById(containerId).appendChild(stepContainer); +} + +function renderRoleSelectionStep (game, containerId, step, deckManager) { + const stepContainer = document.createElement('div'); + setAttributes(stepContainer, { id: 'step-' + step, class: 'flex-row-container-left-align step' }); + + stepContainer.innerHTML = templates.CREATE_GAME_CUSTOM_ROLES; + stepContainer.innerHTML += templates.CREATE_GAME_DECK_STATUS; + stepContainer.innerHTML += templates.CREATE_GAME_DECK; + + document.getElementById(containerId).appendChild(stepContainer); + document.querySelector('#custom-roles-export').addEventListener('click', (e) => { + e.preventDefault(); + deckManager.downloadCustomRoles('play-werewolf-custom-roles', JSON.stringify(deckManager.getCurrentCustomRoleOptions())); + }); + + document.querySelector('#custom-roles-import').addEventListener('click', (e) => { + e.preventDefault(); + ModalManager.displayModal('upload-custom-roles-modal', 'modal-background', 'close-upload-custom-roles-modal-button'); + }); + + document.getElementById('upload-custom-roles-form').onsubmit = (e) => { + e.preventDefault(); + const fileList = document.getElementById('upload-custom-roles').files; + if (fileList.length > 0) { + const file = fileList[0]; + if (file.size > 1000000) { + toast('Your file is too large (max 1MB)', 'error', true, true, 5); + return; + } + if (file.type !== 'text/plain') { + toast('Your file must be a text file', 'error', true, true, 5); + return; + } + + deckManager.loadCustomRolesFromFile(file, updateCustomRoleOptionsList, loadDefaultCards, showIncludedCards); + } else { + toast('You must upload a text file', 'error', true, true, 5); + } + }; + + const clickHandler = () => { + console.log('fired'); + const actions = document.getElementById('custom-role-actions'); + if (actions.style.display !== 'none') { + actions.style.display = 'none'; + } else { + actions.style.display = 'block'; + } + }; + + document.getElementById('custom-role-hamburger').addEventListener('click', clickHandler); + + showIncludedCards(deckManager); + + loadCustomRoles(deckManager); + + updateDeckStatus(deckManager); + + initializeRemainingEventListeners(deckManager); +} + +function renderTimerStep (containerId, stepNumber, game) { + const div = document.createElement('div'); + div.setAttribute('id', 'step-' + stepNumber); + div.classList.add('step'); + + const timeContainer = document.createElement('div'); + timeContainer.setAttribute('id', 'game-time'); + + const hoursDiv = document.createElement('div'); + const hoursLabel = document.createElement('label'); + hoursLabel.setAttribute('for', 'game-hours'); + hoursLabel.innerText = 'Hours (max 5)'; + const hours = document.createElement('input'); + setAttributes(hours, { type: 'number', id: 'game-hours', name: 'game-hours', min: '0', max: '5', value: game.timerParams?.hours }); + + const minutesDiv = document.createElement('div'); + const minsLabel = document.createElement('label'); + minsLabel.setAttribute('for', 'game-minutes'); + minsLabel.innerText = 'Minutes'; + const minutes = document.createElement('input'); + setAttributes(minutes, { type: 'number', id: 'game-minutes', name: 'game-minutes', min: '1', max: '60', value: game.timerParams?.minutes }); + + hoursDiv.appendChild(hoursLabel); + hoursDiv.appendChild(hours); + minutesDiv.appendChild(minsLabel); + minutesDiv.appendChild(minutes); + timeContainer.appendChild(hoursDiv); + timeContainer.appendChild(minutesDiv); + div.appendChild(timeContainer); + + document.getElementById(containerId).appendChild(div); +} + +function renderReviewAndCreateStep (containerId, stepNumber, game) { + const div = document.createElement('div'); + div.setAttribute('id', 'step-' + stepNumber); + div.classList.add('step'); + + div.innerHTML = + '
' + + "" + + "
" + + '
' + + '
' + + "" + + "
" + + '
' + + '
' + + "" + + "
" + + '
'; + + div.querySelector('#mod-option').innerText = game.hasDedicatedModerator + ? "I will be the dedicated mod. Don't deal me a card." + : 'The first person out will mod. Deal me into the game.'; + + if (game.hasTimer) { + const formattedHours = !isNaN(game.timerParams.hours) + ? game.timerParams.hours + ' Hours' + : '0 Hours'; + + const formattedMinutes = !isNaN(game.timerParams.minutes) + ? game.timerParams.minutes + ' Minutes' + : '0 Minutes'; + + div.querySelector('#timer-option').innerText = formattedHours + ' ' + formattedMinutes; + } else { + div.querySelector('#timer-option').innerText = 'untimed'; + } + + for (const card of game.deck) { + const roleEl = document.createElement('div'); + roleEl.innerText = card.quantity + 'x ' + card.role; + div.querySelector('#roles-option').appendChild(roleEl); + } + + document.getElementById(containerId).appendChild(div); +} + +function setAttributes (element, attributeObject) { + for (const key of Object.keys(attributeObject)) { + element.setAttribute(key, attributeObject[key]); + } +} + +function updateTracker (step) { + document.querySelectorAll('.creation-step').forEach((element, i) => { + if ((i + 1) <= step) { + element.classList.add('creation-step-filled'); + } else { + element.classList.remove('creation-step-filled'); + } + }); +} + +function showButtons (back, forward, forwardHandler, backHandler, builtGame = null) { + document.querySelector('#step-back-button')?.remove(); + document.querySelector('#step-forward-button')?.remove(); + document.querySelector('#create-game')?.remove(); + if (back) { + const backButton = document.createElement('button'); + backButton.innerText = '\u25C0'; + backButton.addEventListener('click', backHandler); + backButton.setAttribute('id', 'step-back-button'); + backButton.classList.add('cancel'); + backButton.classList.add('app-button'); + document.getElementById('tracker-container').prepend(backButton); + } + + if (forward && builtGame === null) { + const fwdButton = document.createElement('button'); + fwdButton.innerHTML = '\u25b6'; + fwdButton.addEventListener('click', forwardHandler); + fwdButton.setAttribute('id', 'step-forward-button'); + fwdButton.classList.add('app-button'); + document.getElementById('tracker-container').appendChild(fwdButton); + } else if (forward && builtGame !== null) { + const createButton = document.createElement('button'); + createButton.innerText = 'Create'; + createButton.setAttribute('id', 'create-game'); + createButton.classList.add('app-button'); + createButton.addEventListener('click', () => { + forwardHandler( + builtGame.deck.filter((card) => card.quantity > 0), + builtGame.hasTimer, + builtGame.hasDedicatedModerator, + builtGame.timerParams + ); + }); + document.getElementById('tracker-container').appendChild(createButton); + } +} + +// Display a widget for each default card that allows copies of it to be added/removed. Set initial deck state. +function showIncludedCards (deckManager) { + document.querySelectorAll('.compact-card').forEach((el) => { el.remove(); }); + for (let i = 0; i < deckManager.getCurrentDeck().length; i++) { + const card = deckManager.getCurrentDeck()[i]; + const cardEl = constructCompactDeckBuilderElement(card, deckManager); + if (card.team === globals.ALIGNMENT.GOOD) { + document.getElementById('deck-good').appendChild(cardEl); + } else { + document.getElementById('deck-evil').appendChild(cardEl); + } + } +} + +/* Display a dropdown containing all the custom roles. Adding one will add it to the game deck and +create a widget for it */ +function loadCustomRoles (deckManager) { + addOptionsToList(deckManager, document.getElementById('deck-select')); +} + +function loadDefaultCards (deckManager) { + defaultCards.sort((a, b) => { + if (a.team !== b.team) { + return a.team === globals.ALIGNMENT.GOOD ? 1 : -1; + } + return a.role.localeCompare(b.role); + }); + const deck = []; + for (let i = 0; i < defaultCards.length; i++) { + const card = defaultCards[i]; + card.quantity = 0; + deck.push(card); + } + deckManager.deck = deck; +} + +function constructCompactDeckBuilderElement (card, deckManager) { + const cardContainer = document.createElement('div'); + const alignmentClass = card.team === globals.ALIGNMENT.GOOD ? globals.ALIGNMENT.GOOD : globals.ALIGNMENT.EVIL; + + cardContainer.setAttribute('class', 'compact-card ' + alignmentClass); + + cardContainer.setAttribute('id', 'card-' + card.role.replaceAll(' ', '-')); + + cardContainer.innerHTML = + "
" + + '

-

' + + '
' + + "
" + + "

" + + "
" + + '
' + + "
" + + '

+

' + + '
'; + + cardContainer.querySelector('.card-role').innerText = card.role; + cardContainer.title = card.role; + cardContainer.querySelector('.card-quantity').innerText = card.quantity; + + if (card.quantity > 0) { + cardContainer.classList.add('selected-card'); + } + + cardContainer.querySelector('.compact-card-right').addEventListener('click', () => { + deckManager.addCopyOfCard(card.role); + updateDeckStatus(deckManager); + cardContainer.querySelector('.card-quantity').innerText = deckManager.getCard(card.role).quantity; + if (deckManager.getCard(card.role).quantity > 0) { + document.getElementById('card-' + card.role.replaceAll(' ', '-')).classList.add('selected-card'); + } + }); + cardContainer.querySelector('.compact-card-left').addEventListener('click', () => { + deckManager.removeCopyOfCard(card.role); + updateDeckStatus(deckManager); + cardContainer.querySelector('.card-quantity').innerText = deckManager.getCard(card.role).quantity; + if (deckManager.getCard(card.role).quantity === 0) { + document.getElementById('card-' + card.role.replaceAll(' ', '-')).classList.remove('selected-card'); + } + }); + return cardContainer; +} + +function initializeRemainingEventListeners (deckManager) { + document.getElementById('role-form').onsubmit = (e) => { + e.preventDefault(); + const name = document.getElementById('role-name').value.trim(); + const description = document.getElementById('role-description').value.trim(); + const team = document.getElementById('role-alignment').value.toLowerCase().trim(); + if (deckManager.createMode) { + if (!deckManager.getCustomRoleOption(name) && !deckManager.getCard(name)) { // confirm there is no existing custom role with the same name + processNewCustomRoleSubmission(name, description, team, deckManager, false); + } else { + toast('There is already a role with this name', 'error', true, true, 3); + } + } else { + const option = deckManager.getCustomRoleOption(deckManager.currentlyEditingRoleName); + if (name === option.role) { // did they edit the name? + processNewCustomRoleSubmission(name, description, team, deckManager, true, option); + } else { + if (!deckManager.getCustomRoleOption(name) && !deckManager.getCard(name)) { + processNewCustomRoleSubmission(name, description, team, deckManager, true, option); + } else { + toast('There is already a role with this name', 'error', true, true, 3); + } + } + } + }; + document.getElementById('custom-role-btn').addEventListener( + 'click', () => { + const createBtn = document.getElementById('create-role-button'); + createBtn.setAttribute('value', 'Create'); + deckManager.createMode = true; + deckManager.currentlyEditingRoleName = null; + document.getElementById('role-name').value = ''; + document.getElementById('role-alignment').value = globals.ALIGNMENT.GOOD; + document.getElementById('role-description').value = ''; + ModalManager.displayModal( + 'role-modal', + 'modal-background', + 'close-modal-button' + ); + } + ); +} + +function processNewCustomRoleSubmission (name, description, team, deckManager, isUpdate, option = null) { + if (name.length > 40) { + toast('Your name is too long (max 40 characters).', 'error', true); + return; + } + if (description.length > 500) { + toast('Your description is too long (max 500 characters).', 'error', true); + return; + } + if (isUpdate) { + deckManager.updateCustomRoleOption(option, name, description, team); + ModalManager.dispelModal('role-modal', 'modal-background'); + toast('Role Updated', 'success', true); + } else { + deckManager.addToCustomRoleOptions({ role: name, description: description, team: team, custom: true }); + ModalManager.dispelModal('role-modal', 'modal-background'); + toast('Role Created', 'success', true); + } + + updateCustomRoleOptionsList(deckManager, document.getElementById('deck-select')); +} + +function updateCustomRoleOptionsList (deckManager, selectEl) { + document.querySelectorAll('#deck-select .deck-select-role').forEach(e => e.remove()); + addOptionsToList(deckManager, selectEl); +} + +function addOptionsToList (deckManager, selectEl) { + const options = deckManager.getCurrentCustomRoleOptions(); + options.sort((a, b) => { + if (a.team !== b.team) { + return a.team === globals.ALIGNMENT.GOOD ? 1 : -1; + } + return a.role.localeCompare(b.role); + }); + for (let i = 0; i < options.length; i++) { + const optionEl = document.createElement('div'); + optionEl.innerHTML = templates.DECK_SELECT_ROLE; + optionEl.classList.add('deck-select-role'); + const alignmentClass = options[i].team === globals.ALIGNMENT.GOOD ? globals.ALIGNMENT.GOOD : globals.ALIGNMENT.EVIL; + optionEl.classList.add(alignmentClass); + optionEl.querySelector('.deck-select-role-name').innerText = options[i].role; + selectEl.appendChild(optionEl); + } + + addCustomRoleEventListeners(deckManager, selectEl); +} + +function addCustomRoleEventListeners (deckManager, select) { + document.querySelectorAll('.deck-select-role').forEach((role) => { + const name = role.querySelector('.deck-select-role-name').innerText; + role.querySelector('.deck-select-include').addEventListener('click', (e) => { + e.preventDefault(); + if (!deckManager.getCard(name)) { + deckManager.addToDeck(name); + const cardEl = constructCompactDeckBuilderElement(deckManager.getCard(name), deckManager); + toast('"' + name + '" made available below.', 'success', true, true, 4); + if (deckManager.getCard(name).team === globals.ALIGNMENT.GOOD) { + document.getElementById('deck-good').appendChild(cardEl); + } else { + document.getElementById('deck-evil').appendChild(cardEl); + } + updateCustomRoleOptionsList(deckManager, select); + } else { + toast('"' + select.value + '" already included.', 'error', true, true, 3); + } + }); + + role.querySelector('.deck-select-remove').addEventListener('click', (e) => { + if (confirm("Delete the role '" + name + "'?")) { + e.preventDefault(); + deckManager.removeFromCustomRoleOptions(name); + updateCustomRoleOptionsList(deckManager, select); + } + }); + + role.querySelector('.deck-select-info').addEventListener('click', (e) => { + const alignmentEl = document.getElementById('custom-role-info-modal-alignment'); + alignmentEl.classList.remove(globals.ALIGNMENT.GOOD); + alignmentEl.classList.remove(globals.ALIGNMENT.EVIL); + e.preventDefault(); + const option = deckManager.getCustomRoleOption(name); + document.getElementById('custom-role-info-modal-name').innerText = name; + alignmentEl.classList.add(option.team); + document.getElementById('custom-role-info-modal-description').innerText = option.description; + alignmentEl.innerText = option.team; + ModalManager.displayModal('custom-role-info-modal', 'modal-background', 'close-custom-role-info-modal-button'); + }); + + role.querySelector('.deck-select-edit').addEventListener('click', (e) => { + e.preventDefault(); + const option = deckManager.getCustomRoleOption(name); + document.getElementById('role-name').value = option.role; + document.getElementById('role-alignment').value = option.team; + document.getElementById('role-description').value = option.description; + deckManager.createMode = false; + deckManager.currentlyEditingRoleName = option.role; + const createBtn = document.getElementById('create-role-button'); + createBtn.setAttribute('value', 'Update'); + ModalManager.displayModal('role-modal', 'modal-background', 'close-modal-button'); + }); + }); +} + +function updateDeckStatus (deckManager) { + document.querySelectorAll('.deck-role').forEach((el) => el.remove()); + document.getElementById('deck-count').innerText = deckManager.getDeckSize() + ' Players'; + if (deckManager.getDeckSize() === 0) { + const placeholder = document.createElement('div'); + placeholder.setAttribute('id', 'deck-list-placeholder'); + placeholder.innerText = 'Add a card from the available roles below.'; + document.getElementById('deck-list').appendChild(placeholder); + } else { + if (document.getElementById('deck-list-placeholder')) { + document.getElementById('deck-list-placeholder').remove(); + } + for (const card of deckManager.getCurrentDeck()) { + if (card.quantity > 0) { + const roleEl = document.createElement('div'); + roleEl.classList.add('deck-role'); + if (card.team === globals.ALIGNMENT.GOOD) { + roleEl.classList.add(globals.ALIGNMENT.GOOD); + } else { + roleEl.classList.add(globals.ALIGNMENT.EVIL); + } + roleEl.innerText = card.quantity + 'x ' + card.role; + document.getElementById('deck-list').appendChild(roleEl); + } + } + } +} + +function hasTimer (hours, minutes) { + return (!isNaN(hours) || !isNaN(minutes)); +} diff --git a/client/src/modules/GameStateRenderer.js b/client/src/modules/GameStateRenderer.js new file mode 100644 index 0000000..29ac700 --- /dev/null +++ b/client/src/modules/GameStateRenderer.js @@ -0,0 +1,486 @@ +import { globals } from '../config/globals.js'; +import { toast } from './Toast.js'; +import { templates } from './Templates.js'; +import { ModalManager } from './ModalManager.js'; + +export class GameStateRenderer { + constructor (stateBucket, socket) { + this.stateBucket = stateBucket; + this.socket = socket; + this.killPlayerHandlers = {}; + this.revealRoleHandlers = {}; + this.transferModHandlers = {}; + this.startGameHandler = (e) => { + e.preventDefault(); + if (confirm('Start the game and deal roles?')) { + socket.emit(globals.COMMANDS.START_GAME, this.stateBucket.currentGameState.accessCode); + } + }; + } + + renderLobbyPlayers () { + document.querySelectorAll('.lobby-player').forEach((el) => el.remove()); + const lobbyPlayersContainer = document.getElementById('lobby-players'); + if (this.stateBucket.currentGameState.moderator.userType === globals.USER_TYPES.MODERATOR) { + lobbyPlayersContainer.appendChild( + renderLobbyPerson( + this.stateBucket.currentGameState.moderator.name, + this.stateBucket.currentGameState.moderator.userType + ) + ); + } + for (const person of this.stateBucket.currentGameState.people) { + lobbyPlayersContainer.appendChild(renderLobbyPerson(person.name, person.userType)); + } + const playerCount = this.stateBucket.currentGameState.people.length; + document.querySelector("label[for='lobby-players']").innerText = + 'Participants (' + playerCount + '/' + getGameSize(this.stateBucket.currentGameState.deck) + ' Players)'; + } + + renderLobbyHeader () { + removeExistingTitle(); + const title = document.createElement('h1'); + title.innerText = 'Lobby'; + document.getElementById('game-title').appendChild(title); + const gameLinkContainer = document.getElementById('game-link'); + const linkDiv = document.createElement('div'); + linkDiv.innerText = window.location; + gameLinkContainer.prepend(linkDiv); + gameLinkContainer.addEventListener('click', () => { + navigator.clipboard.writeText(gameLinkContainer.innerText).then(() => { + toast('Link copied!', 'success', true); + }); + }); + const copyImg = document.createElement('img'); + copyImg.setAttribute('src', '../images/copy.svg'); + gameLinkContainer.appendChild(copyImg); + + const time = document.getElementById('game-time'); + const playerCount = document.getElementById('game-player-count'); + playerCount.innerText = getGameSize(this.stateBucket.currentGameState.deck) + ' Players'; + + if (this.stateBucket.currentGameState.timerParams) { + let timeString = ''; + const hours = this.stateBucket.currentGameState.timerParams.hours; + const minutes = this.stateBucket.currentGameState.timerParams.minutes; + if (hours) { + timeString += hours > 1 + ? hours + ' hours ' + : hours + ' hour '; + } + if (minutes) { + timeString += minutes > 1 + ? minutes + ' minutes ' + : minutes + ' minute '; + } + time.innerText = timeString; + } else { + time.innerText = 'untimed'; + } + } + + renderLobbyFooter () { + for (const card of this.stateBucket.currentGameState.deck) { + const cardEl = document.createElement('div'); + cardEl.innerText = card.quantity + 'x ' + card.role; + cardEl.classList.add('lobby-card'); + } + } + + renderGameHeader () { + removeExistingTitle(); + // let title = document.createElement("h1"); + // title.innerText = "Game"; + // document.getElementById("game-title").appendChild(title); + } + + renderModeratorView () { + createEndGamePromptComponent(this.socket, this.stateBucket); + + const modTransferButton = document.getElementById('mod-transfer-button'); + modTransferButton.addEventListener( + 'click', () => { + this.displayAvailableModerators(); + ModalManager.displayModal( + 'transfer-mod-modal', + 'transfer-mod-modal-background', + 'close-mod-transfer-modal-button' + ); + } + ); + this.renderPlayersWithRoleAndAlignmentInfo(); + } + + renderTempModView () { + createEndGamePromptComponent(this.socket, this.stateBucket); + + renderPlayerRole(this.stateBucket.currentGameState); + this.renderPlayersWithNoRoleInformationUnlessRevealed(true); + } + + renderPlayerView (isKilled = false) { + if (isKilled) { + const clientUserType = document.getElementById('client-user-type'); + if (clientUserType) { + clientUserType.innerText = globals.USER_TYPES.KILLED_PLAYER + ' \uD83D\uDC80'; + } + } + renderPlayerRole(this.stateBucket.currentGameState); + this.renderPlayersWithNoRoleInformationUnlessRevealed(false); + } + + renderSpectatorView () { + this.renderPlayersWithNoRoleInformationUnlessRevealed(); + } + + refreshPlayerList (isModerator) { + if (isModerator) { + this.renderPlayersWithRoleAndAlignmentInfo(); + } else { + this.renderPlayersWithNoRoleInformationUnlessRevealed(); + } + } + + renderPlayersWithRoleAndAlignmentInfo () { + removeExistingPlayerElements(this.killPlayerHandlers, this.revealRoleHandlers); + this.stateBucket.currentGameState.people.sort((a, b) => { + return a.name >= b.name ? 1 : -1; + }); + const teamGood = this.stateBucket.currentGameState.people.filter((person) => person.alignment === globals.ALIGNMENT.GOOD); + const teamEvil = this.stateBucket.currentGameState.people.filter((person) => person.alignment === globals.ALIGNMENT.EVIL); + renderGroupOfPlayers( + teamEvil, + this.killPlayerHandlers, + this.revealRoleHandlers, + this.stateBucket.currentGameState.accessCode, + globals.ALIGNMENT.EVIL, + this.stateBucket.currentGameState.moderator.userType, + this.socket + ); + renderGroupOfPlayers( + teamGood, + this.killPlayerHandlers, + this.revealRoleHandlers, + this.stateBucket.currentGameState.accessCode, + globals.ALIGNMENT.GOOD, + this.stateBucket.currentGameState.moderator.userType, + this.socket + ); + document.getElementById('players-alive-label').innerText = + 'Players: ' + this.stateBucket.currentGameState.people.filter((person) => !person.out).length + ' / ' + + this.stateBucket.currentGameState.people.length + ' Alive'; + } + + renderPlayersWithNoRoleInformationUnlessRevealed (tempMod = false) { + if (tempMod) { + document.querySelectorAll('.game-player').forEach((el) => { + const pointer = el.dataset.pointer; + if (pointer && this.killPlayerHandlers[pointer]) { + el.removeEventListener('click', this.killPlayerHandlers[pointer]); + delete this.killPlayerHandlers[pointer]; + } + if (pointer && this.revealRoleHandlers[pointer]) { + el.removeEventListener('click', this.revealRoleHandlers[pointer]); + delete this.revealRoleHandlers[pointer]; + } + el.remove(); + }); + } + document.querySelectorAll('.game-player').forEach((el) => el.remove()); + sortPeopleByStatus(this.stateBucket.currentGameState.people); + const modType = tempMod ? this.stateBucket.currentGameState.moderator.userType : null; + renderGroupOfPlayers( + this.stateBucket.currentGameState.people, + this.killPlayerHandlers, + this.revealRoleHandlers, + this.stateBucket.currentGameState.accessCode, + null, + modType, + this.socket + ); + document.getElementById('players-alive-label').innerText = + 'Players: ' + this.stateBucket.currentGameState.people.filter((person) => !person.out).length + ' / ' + + this.stateBucket.currentGameState.people.length + ' Alive'; + } + + updatePlayerCardToKilledState () { + document.querySelector('#role-image').classList.add('killed-card'); + document.getElementById('role-image').setAttribute( + 'src', + '../images/tombstone.png' + ); + } + + displayAvailableModerators () { + document.getElementById('transfer-mod-modal-content').innerText = ''; + document.querySelectorAll('.potential-moderator').forEach((el) => { + const pointer = el.dataset.pointer; + if (pointer && this.transferModHandlers[pointer]) { + el.removeEventListener('click', this.transferModHandlers[pointer]); + delete this.transferModHandlers[pointer]; + } + el.remove(); + }); + renderPotentialMods( + this.stateBucket.currentGameState, + this.stateBucket.currentGameState.people, + this.transferModHandlers, + this.socket + ); + renderPotentialMods( // spectators can also be made mods. + this.stateBucket.currentGameState, + this.stateBucket.currentGameState.spectators, + this.transferModHandlers, + this.socket + ); + + if (document.querySelectorAll('.potential-moderator').length === 0) { + document.getElementById('transfer-mod-modal-content').innerText = 'There is nobody available to transfer to.'; + } + } + + renderEndOfGame () { + this.renderPlayersWithNoRoleInformationUnlessRevealed(); + } +} + +function renderPotentialMods (gameState, group, transferModHandlers, socket) { + const modalContent = document.getElementById('transfer-mod-modal-content'); + for (const member of group) { + if ((member.out || member.userType === globals.USER_TYPES.SPECTATOR) && !(member.id === gameState.client.id)) { + const container = document.createElement('div'); + container.classList.add('potential-moderator'); + container.dataset.pointer = member.id; + container.innerText = member.name; + transferModHandlers[member.id] = () => { + if (confirm('Transfer moderator powers to ' + member.name + '?')) { + socket.emit(globals.COMMANDS.TRANSFER_MODERATOR, gameState.accessCode, member.id); + } + }; + + container.addEventListener('click', transferModHandlers[member.id]); + modalContent.appendChild(container); + } + } +} + +function renderLobbyPerson (name, userType) { + const el = document.createElement('div'); + const personNameEl = document.createElement('div'); + const personTypeEl = document.createElement('div'); + personNameEl.innerText = name; + personTypeEl.innerText = userType + globals.USER_TYPE_ICONS[userType]; + el.classList.add('lobby-player'); + + el.appendChild(personNameEl); + el.appendChild(personTypeEl); + + return el; +} + +function sortPeopleByStatus (people) { + people.sort((a, b) => { + if (a.out !== b.out) { + return a.out ? 1 : -1; + } else { + if (a.revealed !== b.revealed) { + return a.revealed ? -1 : 1; + } + return a.name >= b.name ? 1 : -1; + } + }); +} + +function getGameSize (cards) { + let quantity = 0; + for (const card of cards) { + quantity += card.quantity; + } + + return quantity; +} + +function removeExistingTitle () { + const existingTitle = document.querySelector('#game-title h1'); + if (existingTitle) { + existingTitle.remove(); + } +} + +// TODO: refactor to reduce the cyclomatic complexity of this function +function renderGroupOfPlayers ( + people, + killPlayerHandlers, + revealRoleHandlers, + accessCode = null, + alignment = null, + moderatorType, + socket = null +) { + for (const player of people) { + const container = document.createElement('div'); + container.classList.add('game-player'); + if (moderatorType) { + container.dataset.pointer = player.id; + container.innerHTML = templates.MODERATOR_PLAYER; + } else { + container.innerHTML = templates.GAME_PLAYER; + } + container.querySelector('.game-player-name').innerText = player.name; + const roleElement = container.querySelector('.game-player-role'); + + if (moderatorType) { + roleElement.classList.add(alignment); + if (moderatorType === globals.USER_TYPES.MODERATOR) { + roleElement.innerText = player.gameRole; + document.getElementById('player-list-moderator-team-' + alignment).appendChild(container); + } else { + if (player.revealed) { + roleElement.innerText = player.gameRole; + roleElement.classList.add(player.alignment); + } else { + roleElement.innerText = 'Unknown'; + } + document.getElementById('game-player-list').appendChild(container); + } + } else if (player.revealed) { + roleElement.classList.add(player.alignment); + roleElement.innerText = player.gameRole; + document.getElementById('game-player-list').appendChild(container); + } else { + roleElement.innerText = 'Unknown'; + document.getElementById('game-player-list').appendChild(container); + } + + if (player.out) { + container.classList.add('killed'); + if (moderatorType) { + container.querySelector('.kill-player-button')?.remove(); + insertPlaceholderButton(container, false, 'killed'); + } + } else { + if (moderatorType) { + killPlayerHandlers[player.id] = () => { + if (confirm('KILL ' + player.name + '?')) { + socket.emit(globals.COMMANDS.KILL_PLAYER, accessCode, player.id); + } + }; + container.querySelector('.kill-player-button').addEventListener('click', killPlayerHandlers[player.id]); + } + } + + if (player.revealed) { + if (moderatorType) { + container.querySelector('.reveal-role-button')?.remove(); + insertPlaceholderButton(container, true, 'revealed'); + } + } else { + if (moderatorType) { + revealRoleHandlers[player.id] = () => { + if (confirm('REVEAL ' + player.name + '?')) { + socket.emit(globals.COMMANDS.REVEAL_PLAYER, accessCode, player.id); + } + }; + container.querySelector('.reveal-role-button').addEventListener('click', revealRoleHandlers[player.id]); + } + } + } +} + +function renderPlayerRole (gameState) { + const name = document.querySelector('#role-name'); + name.innerText = gameState.client.gameRole; + if (gameState.client.alignment === globals.ALIGNMENT.GOOD) { + document.getElementById('game-role').classList.add('game-role-good'); + name.classList.add('good'); + } else { + document.getElementById('game-role').classList.add('game-role-evil'); + name.classList.add('evil'); + } + name.setAttribute('title', gameState.client.gameRole); + if (gameState.client.out) { + document.querySelector('#role-image').classList.add('killed-card'); + document.getElementById('role-image').setAttribute( + 'src', + '../images/tombstone.png' + ); + } else { + if (gameState.client.gameRole.toLowerCase() === 'villager') { + document.getElementById('role-image').setAttribute( + 'src', + '../images/roles/Villager' + Math.ceil(Math.random() * 2) + '.png' + ); + } else { + if (gameState.client.customRole) { + document.getElementById('role-image').setAttribute( + 'src', + '../images/roles/custom-role.svg' + ); + } else { + document.getElementById('role-image').setAttribute( + 'src', + '../images/roles/' + gameState.client.gameRole.replaceAll(' ', '') + '.png' + ); + } + } + } + + document.querySelector('#role-description').innerText = gameState.client.gameRoleDescription; + + document.getElementById('game-role-back').addEventListener('click', () => { + document.getElementById('game-role').style.display = 'flex'; + document.getElementById('game-role-back').style.display = 'none'; + }); + + document.getElementById('game-role').addEventListener('click', () => { + document.getElementById('game-role-back').style.display = 'flex'; + document.getElementById('game-role').style.display = 'none'; + }); +} + +function insertPlaceholderButton (container, append, type) { + const button = document.createElement('div'); + button.classList.add('placeholder-button'); + if (type === 'killed') { + button.innerText = 'Killed'; + } else { + button.innerText = 'Revealed'; + } + if (append) { + container.querySelector('.player-action-buttons').appendChild(button); + } else { + container.querySelector('.player-action-buttons').prepend(button); + } +} + +function removeExistingPlayerElements (killPlayerHandlers, revealRoleHandlers) { + document.querySelectorAll('.game-player').forEach((el) => { + const pointer = el.dataset.pointer; + if (pointer && killPlayerHandlers[pointer]) { + el.removeEventListener('click', killPlayerHandlers[pointer]); + delete killPlayerHandlers[pointer]; + } + if (pointer && revealRoleHandlers[pointer]) { + el.removeEventListener('click', revealRoleHandlers[pointer]); + delete revealRoleHandlers[pointer]; + } + el.remove(); + }); +} + +function createEndGamePromptComponent (socket, stateBucket) { + if (document.querySelector('#end-game-prompt') === null) { + const div = document.createElement('div'); + div.innerHTML = templates.END_GAME_PROMPT; + div.querySelector('#end-game-button').addEventListener('click', (e) => { + e.preventDefault(); + if (confirm('End the game?')) { + socket.emit( + globals.COMMANDS.END_GAME, + stateBucket.currentGameState.accessCode + ); + } + }); + document.getElementById('game-content').appendChild(div); + } +} diff --git a/client/src/modules/GameTimerManager.js b/client/src/modules/GameTimerManager.js new file mode 100644 index 0000000..2e977a6 --- /dev/null +++ b/client/src/modules/GameTimerManager.js @@ -0,0 +1,178 @@ +import { globals } from '../config/globals.js'; + +export class GameTimerManager { + constructor (stateBucket, socket) { + this.stateBucket = stateBucket; + this.playListener = () => { + socket.emit(globals.COMMANDS.RESUME_TIMER, this.stateBucket.currentGameState.accessCode); + }; + this.pauseListener = () => { + socket.emit(globals.COMMANDS.PAUSE_TIMER, this.stateBucket.currentGameState.accessCode); + }; + } + + resumeGameTimer (totalTime, tickRate, soundManager, timerWorker) { + if (window.Worker) { + if ( + this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR + || this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR + ) { + this.swapToPauseButton(); + } + const instance = this; + const timer = document.getElementById('game-timer'); + timer.classList.remove('paused'); + timer.classList.remove('paused-low'); + timer.classList.remove('low'); + if (totalTime < 60000) { + timer.classList.add('low'); + } + timer.innerText = totalTime < 60000 + ? returnHumanReadableTime(totalTime, true) + : returnHumanReadableTime(totalTime); + timerWorker.onmessage = function (e) { + if (e.data.hasOwnProperty('timeRemainingInMilliseconds') && e.data.timeRemainingInMilliseconds >= 0) { + if (e.data.timeRemainingInMilliseconds === 0) { + instance.displayExpiredTime(); + } else if (e.data.timeRemainingInMilliseconds < 60000) { + timer.classList.add('low'); + timer.innerText = e.data.displayTime; + } else { + timer.innerText = e.data.displayTime; + } + } + }; + timerWorker.postMessage({ totalTime: totalTime, tickInterval: tickRate }); + } + } + + pauseGameTimer (timerWorker, timeRemaining) { + if (window.Worker) { + if ( + this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR + || this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR + ) { + this.swapToPlayButton(); + } + + timerWorker.postMessage('stop'); + const timer = document.getElementById('game-timer'); + if (timeRemaining < 60000) { + timer.innerText = returnHumanReadableTime(timeRemaining, true); + timer.classList.add('paused-low'); + timer.classList.add('low'); + } else { + timer.innerText = returnHumanReadableTime(timeRemaining); + timer.classList.add('paused'); + } + } + } + + displayPausedTime (time) { + if ( + this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR + || this.stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR + ) { + this.swapToPlayButton(); + } + + const timer = document.getElementById('game-timer'); + if (time < 60000) { + timer.innerText = returnHumanReadableTime(time, true); + timer.classList.add('paused-low'); + timer.classList.add('low'); + } else { + timer.innerText = returnHumanReadableTime(time); + timer.classList.add('paused'); + } + } + + displayExpiredTime () { + const currentBtn = document.querySelector('#play-pause img'); + if (currentBtn) { + currentBtn.removeEventListener('click', this.pauseListener); + currentBtn.removeEventListener('click', this.playListener); + currentBtn.remove(); + } + + const timer = document.getElementById('game-timer'); + timer.innerText = returnHumanReadableTime(0, true); + } + + attachTimerSocketListeners (socket, timerWorker, gameStateRenderer) { + if (!socket.hasListeners(globals.COMMANDS.PAUSE_TIMER)) { + socket.on(globals.COMMANDS.PAUSE_TIMER, (timeRemaining) => { + this.pauseGameTimer(timerWorker, timeRemaining); + }); + } + + if (!socket.hasListeners(globals.COMMANDS.RESUME_TIMER)) { + socket.on(globals.COMMANDS.RESUME_TIMER, (timeRemaining) => { + this.resumeGameTimer(timeRemaining, globals.CLOCK_TICK_INTERVAL_MILLIS, null, timerWorker); + }); + } + + if (!socket.hasListeners(globals.COMMANDS.GET_TIME_REMAINING)) { + socket.on(globals.COMMANDS.GET_TIME_REMAINING, (timeRemaining, paused) => { + if (paused) { + this.displayPausedTime(timeRemaining); + } else if (timeRemaining === 0) { + this.displayExpiredTime(); + } else { + this.resumeGameTimer(timeRemaining, globals.CLOCK_TICK_INTERVAL_MILLIS, null, timerWorker); + } + }); + } + } + + swapToPlayButton () { + const currentBtn = document.querySelector('#play-pause img'); + if (currentBtn) { + currentBtn.removeEventListener('click', this.pauseListener); + currentBtn.remove(); + } + + const playBtn = document.createElement('img'); + playBtn.setAttribute('src', '../images/play-button.svg'); + playBtn.addEventListener('click', this.playListener); + document.getElementById('play-pause').appendChild(playBtn); + } + + swapToPauseButton () { + const currentBtn = document.querySelector('#play-pause img'); + if (currentBtn) { + currentBtn.removeEventListener('click', this.playListener); + currentBtn.remove(); + } + + const pauseBtn = document.createElement('img'); + pauseBtn.setAttribute('src', '../images/pause-button.svg'); + pauseBtn.addEventListener('click', this.pauseListener); + document.getElementById('play-pause').appendChild(pauseBtn); + } + + processTimeRemaining (timeRemaining, paused, timerWorker) { + if (paused) { + this.displayPausedTime(timeRemaining); + } else if (timeRemaining === 0) { + this.displayExpiredTime(); + } else { + this.resumeGameTimer(timeRemaining, globals.CLOCK_TICK_INTERVAL_MILLIS, null, timerWorker); + } + } +} + +function returnHumanReadableTime (milliseconds, tenthsOfSeconds = false) { + const tenths = Math.floor((milliseconds / 100) % 10); + let seconds = Math.floor((milliseconds / 1000) % 60); + let minutes = Math.floor((milliseconds / (1000 * 60)) % 60); + let hours = Math.floor((milliseconds / (1000 * 60 * 60)) % 24); + + hours = hours < 10 ? '0' + hours : hours; + minutes = minutes < 10 ? '0' + minutes : minutes; + seconds = seconds < 10 ? '0' + seconds : seconds; + + return tenthsOfSeconds + ? hours + ':' + minutes + ':' + seconds + '.' + tenths + : hours + ':' + minutes + ':' + seconds; +} diff --git a/client/src/modules/ModalManager.js b/client/src/modules/ModalManager.js new file mode 100644 index 0000000..75a4457 --- /dev/null +++ b/client/src/modules/ModalManager.js @@ -0,0 +1,33 @@ +export const ModalManager = { + displayModal: displayModal, + dispelModal: dispelModal +}; + +function displayModal (modalId, backgroundId, closeButtonId) { + const modal = document.getElementById(modalId); + const modalOverlay = document.getElementById(backgroundId); + const closeBtn = document.getElementById(closeButtonId); + let closeModalHandler; + if (modal && modalOverlay && closeBtn) { + modal.style.display = 'flex'; + modalOverlay.style.display = 'flex'; + modalOverlay.removeEventListener('click', closeModalHandler); + modalOverlay.addEventListener('click', closeModalHandler = function (e) { + e.preventDefault(); + dispelModal(modalId, backgroundId); + }); + closeBtn.removeEventListener('click', closeModalHandler); + closeBtn.addEventListener('click', closeModalHandler); + } else { + throw new Error('One or more of the ids supplied to ModalManager.displayModal is invalid.'); + } +} + +function dispelModal (modalId, backgroundId) { + const modal = document.getElementById(modalId); + const modalOverlay = document.getElementById(backgroundId); + if (modal && modalOverlay) { + modal.style.display = 'none'; + modalOverlay.style.display = 'none'; + } +} diff --git a/client/src/modules/Navbar.js b/client/src/modules/Navbar.js new file mode 100644 index 0000000..642b61a --- /dev/null +++ b/client/src/modules/Navbar.js @@ -0,0 +1,54 @@ +export const injectNavbar = (page = null) => { + if (document.getElementById('navbar') !== null) { + document.getElementById('navbar').innerHTML = + "' + + '' + + '' + + '
' + + '' + + '
' + + ''; + } + attachHamburgerListener(); +}; + +function flipHamburger () { + const hamburger = document.getElementById('navbar-hamburger'); + if (hamburger.classList.contains('is-active')) { + hamburger.classList.remove('is-active'); + document.getElementById('mobile-menu').classList.add('hidden'); + document.getElementById('mobile-menu-background-overlay').classList.remove('overlay'); + } else { + hamburger.classList.add('is-active'); + document.getElementById('mobile-menu-background-overlay').classList.add('overlay'); + document.getElementById('mobile-menu').classList.remove('hidden'); + } +} + +function getNavbarLinks (page = null, device) { + const linkClass = device === 'mobile' ? 'mobile-link' : 'desktop-link'; + return '' + + 'Home' + + 'Create' + + 'How to Use' + + 'Contact' + + 'Support the App'; +} + +function attachHamburgerListener () { + if (document.getElementById('navbar') !== null && document.getElementById('navbar').style.display !== 'none') { + document.getElementById('navbar-hamburger').addEventListener('click', flipHamburger); + } +} diff --git a/client/src/modules/StateBucket.js b/client/src/modules/StateBucket.js new file mode 100644 index 0000000..af46c84 --- /dev/null +++ b/client/src/modules/StateBucket.js @@ -0,0 +1,8 @@ +/* It started getting confusing where I am reading/writing to the game state, and thus the state started to get inconsistent. + Creating a bucket to hold it so I can overwrite the gameState object whilst still preserving a reference to the containing bucket. + Now several components can read a shared game state. + */ +export const stateBucket = { + currentGameState: null, + timerWorker: null +}; diff --git a/client/src/modules/Templates.js b/client/src/modules/Templates.js new file mode 100644 index 0000000..6d23494 --- /dev/null +++ b/client/src/modules/Templates.js @@ -0,0 +1,266 @@ +export const templates = { + LOBBY: + "
" + + '
' + + "" + + "" + + '
' + + "
" + + '
' + + "clock" + + "
" + + '
' + + '
' + + "person" + + "
" + + '
' + + '
' + + '
' + + "
' + + '
' + + '
' + + "
" + + "" + + "
" + + '
' + + "' + + '
', + START_GAME_PROMPT: + "
" + + "" + + '
', + END_GAME_PROMPT: + "
" + + "" + + '
', + PLAYER_GAME_VIEW: + "
" + + '
' + + "" + + "
" + + '
' + + '
' + + "
' + + '
' + + "' + + "
" + + '

Click to show your role

' + + '

(click again to hide)

' + + '
' + + "
" + + "" + + "
" + + '
', + SPECTATOR_GAME_VIEW: + "
" + + '
' + + "" + + "
" + + '
' + + '
' + + "
' + + '
' + + "
" + + "" + + "
" + + '
', + MODERATOR_GAME_VIEW: + "" + + "' + + "
" + + "
" + + '
' + + "" + + "
" + + '
' + + "
" + '
' + + '
' + + "" + + '
' + + "
' + + '
' + + '
' + + "" + + "
" + + "
" + + "" + + "
" + + '
' + + "
" + + "" + + "
" + + '
' + + '
' + + '
', + TEMP_MOD_GAME_VIEW: + "" + + "' + + "
" + + "
" + + '
' + + "" + + "
" + + '
' + + "
" + '
' + + '
' + + '
' + + "
' + + '
' + + "' + + "
" + + '

Click to show your role

' + + '

(click again to hide)

' + + '
' + + "
" + + "" + + "
" + + '
' + + '', + MODERATOR_PLAYER: + '
' + + "
" + + "
" + + '
' + + "
" + + "" + + "" + + '
', + GAME_PLAYER: + '
' + + "
" + + "
" + + '
', + INITIAL_GAME_DOM: + "
" + + "
" + + "" + + "
" + + "
" + + "
" + + '
' + + '
' + + "
", + // via https://loading.io/css/ + SPINNER: + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
', + NAME_CHANGE_MODAL: + "" + + "', + ROLE_INFO_MODAL: + "" + + "', + END_OF_GAME_VIEW: + '

The moderator has ended the game. Roles are revealed.

' + + "
" + + '
' + + "
' + + '
' + + "" + + "" + + '' + + '
' + + '
' + + "
" + + "" + + "
" + + '
', + CREATE_GAME_DECK: + "
" + + '
' + + "" + + "
" + + '
' + + '
' + + "" + + "
" + + '
' + + '
', + CREATE_GAME_CUSTOM_ROLES: + '
' + + '' + + '' + + '' + + '
' + + '' + + '
', + CREATE_GAME_DECK_STATUS: + '
' + + '
0 Players
' + + '
' + + '
', + DECK_SELECT_ROLE: + '
' + + '
' + + 'include' + + 'info' + + 'edit' + + 'remove' + + '
' +}; diff --git a/client/src/modules/Timer.js b/client/src/modules/Timer.js new file mode 100644 index 0000000..ff0c180 --- /dev/null +++ b/client/src/modules/Timer.js @@ -0,0 +1,121 @@ +/* +A timer using setTimeout that compensates for drift. Drift can happen for several reasons: +https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#reasons_for_delays + +This means the timer may very well be late in executing the next call (but never early). +This timer is accurate to within a few ms for any amount of time provided. It's meant to be utilized as a Web Worker. +See: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API + */ + +const messageParameters = { + STOP: 'stop', + TICK_INTERVAL: 'tickInterval', + TOTAL_TIME: 'totalTime' +}; + +let timer; + +onmessage = function (e) { + if (typeof e.data === 'object' + && e.data.hasOwnProperty(messageParameters.TOTAL_TIME) + && e.data.hasOwnProperty(messageParameters.TICK_INTERVAL) + ) { + timer = new Singleton(e.data.totalTime, e.data.tickInterval); + timer.startTimer(); + } else if (e.data === 'stop') { + timer.stopTimer(); + } +}; + +function stepFn (expected, interval, start, totalTime) { + const now = Date.now(); + if (now - start >= totalTime) { + postMessage({ + timeRemainingInMilliseconds: 0, + displayTime: returnHumanReadableTime(0, true) + }); + return; + } + const delta = now - expected; + expected += interval; + const displayTime = (totalTime - (now - start)) < 60000 + ? returnHumanReadableTime(totalTime - (now - start), true) + : returnHumanReadableTime(totalTime - (now - start)); + postMessage({ + timeRemainingInMilliseconds: totalTime - (now - start), + displayTime: displayTime + }); + Singleton.setNewTimeoutReference(setTimeout(() => { + stepFn(expected, interval, start, totalTime); + }, Math.max(0, interval - delta) + )); // take into account drift - also retain a reference to this clock tick so it can be cleared later +} + +class Timer { + constructor (totalTime, tickInterval) { + this.timeoutId = undefined; + this.totalTime = totalTime; + this.tickInterval = tickInterval; + } + + startTimer () { + if (!isNaN(this.tickInterval)) { + const interval = this.tickInterval; + const start = Date.now(); + const expected = Date.now() + this.tickInterval; + const totalTime = this.totalTime; + if (this.timeoutId) { + clearTimeout(this.timeoutId); + } + this.timeoutId = setTimeout(() => { + stepFn(expected, interval, start, totalTime); + }, this.tickInterval); + } + } + + stopTimer () { + if (this.timeoutId) { + clearTimeout(this.timeoutId); + } + } +} + +class Singleton { + constructor (totalTime, tickInterval) { + if (!Singleton.instance) { + Singleton.instance = new Timer(totalTime, tickInterval); + } else { + // This allows the same timer to be configured to run for different intervals / at a different granularity. + Singleton.setNewTimerParameters(totalTime, tickInterval); + } + return Singleton.instance; + } + + static setNewTimerParameters (totalTime, tickInterval) { + if (Singleton.instance) { + Singleton.instance.totalTime = totalTime; + Singleton.instance.tickInterval = tickInterval; + } + } + + static setNewTimeoutReference (timeoutId) { + if (Singleton.instance) { + Singleton.instance.timeoutId = timeoutId; + } + } +} + +function returnHumanReadableTime (milliseconds, tenthsOfSeconds = false) { + const tenths = Math.floor((milliseconds / 100) % 10); + let seconds = Math.floor((milliseconds / 1000) % 60); + let minutes = Math.floor((milliseconds / (1000 * 60)) % 60); + let hours = Math.floor((milliseconds / (1000 * 60 * 60)) % 24); + + hours = hours < 10 ? '0' + hours : hours; + minutes = minutes < 10 ? '0' + minutes : minutes; + seconds = seconds < 10 ? '0' + seconds : seconds; + + return tenthsOfSeconds + ? hours + ':' + minutes + ':' + seconds + '.' + tenths + : hours + ':' + minutes + ':' + seconds; +} diff --git a/client/src/modules/Toast.js b/client/src/modules/Toast.js new file mode 100644 index 0000000..0302da8 --- /dev/null +++ b/client/src/modules/Toast.js @@ -0,0 +1,48 @@ +import { globals } from '../config/globals.js'; + +export const toast = (message, type, positionAtTop = true, dispelAutomatically = true, duration = null) => { + if (message && type) { + buildAndInsertMessageElement(message, type, positionAtTop, dispelAutomatically, duration); + } +}; + +function buildAndInsertMessageElement (message, type, positionAtTop, dispelAutomatically, duration) { + cancelCurrentToast(); + let backgroundColor, border; + const position = positionAtTop ? 'top:2rem;' : 'bottom: 90px;'; + switch (type) { + case 'warning': + backgroundColor = '#fff5b1'; + border = '3px solid #c7c28a'; + break; + case 'error': + backgroundColor = '#fdaeb7'; + border = '3px solid #c78a8a'; + break; + case 'success': + backgroundColor = '#bef5cb'; + border = '3px solid #8ac78a;'; + break; + } + + const durationInSeconds = duration ? duration + 's' : globals.TOAST_DURATION_DEFAULT + 's'; + let animation = ''; + if (dispelAutomatically) { + animation = 'animation:fade-in-slide-down-then-exit ' + durationInSeconds + ' ease normal forwards'; + } else { + animation = 'animation:fade-in-slide-down ' + durationInSeconds + ' ease normal forwards'; + } + const messageEl = document.createElement('div'); + messageEl.setAttribute('id', 'current-info-message'); + messageEl.setAttribute('style', 'background-color:' + backgroundColor + ';' + 'border:' + border + ';' + position + animation); + messageEl.setAttribute('class', 'info-message'); + messageEl.innerText = message; + document.body.prepend(messageEl); +} + +export function cancelCurrentToast () { + const currentMessage = document.getElementById('current-info-message'); + if (currentMessage !== null) { + currentMessage.remove(); + } +} diff --git a/client/src/modules/UserUtility.js b/client/src/modules/UserUtility.js new file mode 100644 index 0000000..ce1912c --- /dev/null +++ b/client/src/modules/UserUtility.js @@ -0,0 +1,63 @@ +import { globals } from '../config/globals.js'; + +/* + we will use sessionStorage during local development to aid in testing, vs. localStorage for production. + sessionStorage does not persist across tabs, allowing developers to join a game as different players from different windows. + */ +export const UserUtility = { + + createNewAnonymousUserId (force = true, environment) { + let newId, currentId; + + if (environment === globals.ENVIRONMENT.LOCAL) { + currentId = sessionStorage.getItem(globals.PLAYER_ID_COOKIE_KEY); + } else { + currentId = localStorage.getItem(globals.PLAYER_ID_COOKIE_KEY); + } + if (currentId !== null && !force) { + newId = currentId; + } else { + newId = createRandomUserId(); + if (environment === globals.ENVIRONMENT.LOCAL) { + sessionStorage.setItem(globals.PLAYER_ID_COOKIE_KEY, newId); + } else { + localStorage.setItem(globals.PLAYER_ID_COOKIE_KEY, newId); + } + } + return newId; + }, + + setAnonymousUserId (id, environment) { + if (environment === globals.ENVIRONMENT.LOCAL) { + sessionStorage.setItem(globals.PLAYER_ID_COOKIE_KEY, id); + } else { + localStorage.setItem(globals.PLAYER_ID_COOKIE_KEY, id); + } + }, + + validateAnonUserSignature (environment) { + let userSig; + if (environment === globals.ENVIRONMENT.LOCAL) { + userSig = sessionStorage.getItem(globals.PLAYER_ID_COOKIE_KEY); + } else { + userSig = localStorage.getItem(globals.PLAYER_ID_COOKIE_KEY); + } + return ( + userSig + && typeof userSig === 'string' + && /^[a-zA-Z0-9]+$/.test(userSig) + && userSig.length === globals.USER_SIGNATURE_LENGTH + ) + ? userSig + : false; + } + +}; + +function createRandomUserId () { + let id = ''; + for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) { + id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)]; + } + return id; +} diff --git a/client/src/modules/XHRUtility.js b/client/src/modules/XHRUtility.js new file mode 100644 index 0000000..0607047 --- /dev/null +++ b/client/src/modules/XHRUtility.js @@ -0,0 +1,39 @@ +export const XHRUtility = + { + standardHeaders: [['Content-Type', 'application/json'], ['Accept', 'application/json'], ['X-Requested-With', 'XMLHttpRequest']], + + // Easily make XHR calls with a promise wrapper. Defaults to GET and MIME type application/JSON + xhr (url, method = 'GET', headers, body = null) { + if (headers === undefined || headers === null) { + headers = this.standardHeaders; + } + if (typeof url !== 'string' || url.trim().length < 1) { + return Promise.reject('Cannot request with empty URL: ' + url); + } + + const req = new XMLHttpRequest(); + req.open(method, url.trim()); + + for (const hdr of headers) { + if (hdr.length !== 2) continue; + req.setRequestHeader(hdr[0], hdr[1]); + } + + return new Promise((resolve, reject) => { + req.onload = function () { + const response = { + status: this.status, + statusText: this.statusText, + content: this.responseText + }; + if (this.status >= 200 && this.status < 400) { + resolve(response); + } else { + reject(response); + } + }; + body ? req.send(body) : req.send(); + }); + } + + }; diff --git a/client/src/scripts/create.js b/client/src/scripts/create.js new file mode 100644 index 0000000..241bb49 --- /dev/null +++ b/client/src/scripts/create.js @@ -0,0 +1,16 @@ +import { DeckStateManager } from '../modules/DeckStateManager.js'; +import { GameCreationStepManager } from '../modules/GameCreationStepManager.js'; +import { injectNavbar } from '../modules/Navbar.js'; + +const create = () => { + injectNavbar(); + const deckManager = new DeckStateManager(); + const gameCreationStepManager = new GameCreationStepManager(deckManager); + gameCreationStepManager.renderStep('creation-step-container', 1); +}; + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = create; +} else { + create(); +} diff --git a/client/src/scripts/game.js b/client/src/scripts/game.js new file mode 100644 index 0000000..0b3edaf --- /dev/null +++ b/client/src/scripts/game.js @@ -0,0 +1,438 @@ +import { UserUtility } from '../modules/UserUtility.js'; +import { globals } from '../config/globals.js'; +import { templates } from '../modules/Templates.js'; +import { GameStateRenderer } from '../modules/GameStateRenderer.js'; +import { toast } from '../modules/Toast.js'; +import { GameTimerManager } from '../modules/GameTimerManager.js'; +import { ModalManager } from '../modules/ModalManager.js'; +import { stateBucket } from '../modules/StateBucket.js'; +import { io } from 'socket.io-client'; +import { injectNavbar } from '../modules/Navbar.js'; + +const game = () => { + injectNavbar(); + let timerWorker; + const socket = io('/in-game'); + socket.on('disconnect', () => { + if (timerWorker) { + timerWorker.terminate(); + } + toast('Disconnected. Attempting reconnect...', 'error', true, false); + }); + socket.on('connect', () => { + console.log('fired connect event'); + socket.emit(globals.COMMANDS.GET_ENVIRONMENT, function (returnedEnvironment) { + timerWorker = new Worker(new URL('../modules/Timer.js', import.meta.url)); + prepareGamePage(returnedEnvironment, socket, timerWorker); + }); + }); +}; + +function prepareGamePage (environment, socket, timerWorker) { + let userId = UserUtility.validateAnonUserSignature(environment); + const splitUrl = window.location.href.split('/game/'); + const accessCode = splitUrl[1]; + if (/^[a-zA-Z0-9]+$/.test(accessCode) && accessCode.length === globals.ACCESS_CODE_LENGTH) { + socket.emit(globals.COMMANDS.FETCH_GAME_STATE, accessCode, userId, function (gameState) { + stateBucket.currentGameState = gameState; + document.querySelector('.spinner-container')?.remove(); + document.querySelector('.spinner-background')?.remove(); + + if (gameState === null) { + window.location = '/not-found?reason=' + encodeURIComponent('game-not-found'); + } else { + document.getElementById('game-content').innerHTML = templates.INITIAL_GAME_DOM; + toast('You are connected.', 'success', true, true, 2); + userId = gameState.client.cookie; + UserUtility.setAnonymousUserId(userId, environment); + const gameStateRenderer = new GameStateRenderer(stateBucket, socket); + let gameTimerManager; + if (stateBucket.currentGameState.timerParams) { + gameTimerManager = new GameTimerManager(stateBucket, socket); + } + initializeGame(stateBucket, socket, timerWorker, userId, gameStateRenderer, gameTimerManager); + + if (!gameState.client.hasEnteredName) { + document.getElementById('prompt').innerHTML = templates.NAME_CHANGE_MODAL; + document.getElementById('change-name-form').onsubmit = (e) => { + e.preventDefault(); + const name = document.getElementById('player-new-name').value; + if (validateName(name)) { + socket.emit(globals.COMMANDS.CHANGE_NAME, gameState.accessCode, { + name: name, + personId: gameState.client.id + }, (result) => { + switch (result) { + case 'taken': + toast('This name is already taken.', 'error', true, true, 8); + break; + case 'changed': + ModalManager.dispelModal('change-name-modal', 'change-name-modal-background'); + toast('Name set.', 'success', true, true, 5); + propagateNameChange(stateBucket.currentGameState, name, stateBucket.currentGameState.client.id); + processGameState(stateBucket.currentGameState, userId, socket, gameStateRenderer, gameTimerManager, timerWorker); + } + }); + } else { + toast('Name must be between 1 and 30 characters.', 'error', true, true, 8); + } + }; + } + } + }); + } else { + window.location = '/not-found?reason=' + encodeURIComponent('invalid-access-code'); + } +} + +function initializeGame (stateBucket, socket, timerWorker, userId, gameStateRenderer, gameTimerManager) { + setClientSocketHandlers(stateBucket, gameStateRenderer, socket, timerWorker, gameTimerManager); + processGameState(stateBucket.currentGameState, userId, socket, gameStateRenderer, gameTimerManager, timerWorker); +} + +function processGameState (currentGameState, userId, socket, gameStateRenderer, gameTimerManager, timerWorker, refreshPrompt = true) { + displayClientInfo(currentGameState.client.name, currentGameState.client.userType); + if (refreshPrompt) { + removeStartGameFunctionalityIfPresent(gameStateRenderer); + document.querySelector('#end-game-prompt')?.remove(); + } + switch (currentGameState.status) { + case globals.STATUS.LOBBY: + document.getElementById('game-state-container').innerHTML = templates.LOBBY; + gameStateRenderer.renderLobbyHeader(); + gameStateRenderer.renderLobbyPlayers(); + if ( + currentGameState.isFull + && ( + currentGameState.client.userType === globals.USER_TYPES.MODERATOR + || currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR + ) + && refreshPrompt + ) { + displayStartGamePromptForModerators(currentGameState, gameStateRenderer); + } + break; + case globals.STATUS.IN_PROGRESS: + gameStateRenderer.renderGameHeader(); + switch (currentGameState.client.userType) { + case globals.USER_TYPES.PLAYER: + document.getElementById('game-state-container').innerHTML = templates.PLAYER_GAME_VIEW; + gameStateRenderer.renderPlayerView(); + break; + case globals.USER_TYPES.KILLED_PLAYER: + + document.getElementById('game-state-container').innerHTML = templates.PLAYER_GAME_VIEW; + gameStateRenderer.renderPlayerView(true); + break; + case globals.USER_TYPES.MODERATOR: + document.getElementById('game-state-container').innerHTML = templates.MODERATOR_GAME_VIEW; + gameStateRenderer.renderModeratorView(); + break; + case globals.USER_TYPES.TEMPORARY_MODERATOR: + document.getElementById('game-state-container').innerHTML = templates.TEMP_MOD_GAME_VIEW; + gameStateRenderer.renderTempModView(); + break; + case globals.USER_TYPES.SPECTATOR: + document.getElementById('game-state-container').innerHTML = templates.SPECTATOR_GAME_VIEW; + gameStateRenderer.renderSpectatorView(); + break; + default: + break; + } + if (currentGameState.timerParams) { + socket.emit(globals.COMMANDS.GET_TIME_REMAINING, currentGameState.accessCode, (timeRemaining, paused) => { + gameTimerManager.processTimeRemaining(timeRemaining, paused, timerWorker); + }); + } else { + document.querySelector('#game-timer')?.remove(); + document.querySelector('label[for="game-timer"]')?.remove(); + } + break; + case globals.STATUS.ENDED: { + const container = document.getElementById('game-state-container'); + container.innerHTML = templates.END_OF_GAME_VIEW; + container.classList.add('vertical-flex'); + gameStateRenderer.renderEndOfGame(); + break; + } + default: + break; + } + + activateRoleInfoButton(stateBucket.currentGameState.deck); +} + +function displayClientInfo (name, userType) { + document.getElementById('client-name').innerText = name; + document.getElementById('client-user-type').innerText = userType; + document.getElementById('client-user-type').innerText += globals.USER_TYPE_ICONS[userType]; +} + +function setClientSocketHandlers (stateBucket, gameStateRenderer, socket, timerWorker, gameTimerManager) { + if (!socket.hasListeners(globals.EVENTS.PLAYER_JOINED)) { + socket.on(globals.EVENTS.PLAYER_JOINED, (player, gameIsFull) => { + toast(player.name + ' joined!', 'success', false, true, 3); + stateBucket.currentGameState.people.push(player); + stateBucket.currentGameState.isFull = gameIsFull; + gameStateRenderer.renderLobbyPlayers(); + if ( + gameIsFull + && ( + stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR + || stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR + ) + ) { + displayStartGamePromptForModerators(stateBucket.currentGameState, gameStateRenderer); + } + }); + } + + if (!socket.hasListeners(globals.EVENTS.PLAYER_LEFT)) { + socket.on(globals.EVENTS.PLAYER_LEFT, (player) => { + removeStartGameFunctionalityIfPresent(gameStateRenderer); + toast(player.name + ' has left!', 'error', false, true, 3); + const index = stateBucket.currentGameState.people.findIndex(person => person.id === player.id); + if (index >= 0) { + stateBucket.currentGameState.people.splice( + index, + 1 + ); + gameStateRenderer.renderLobbyPlayers(); + } + }); + } + + if (!socket.hasListeners(globals.EVENTS.START_GAME)) { + socket.on(globals.EVENTS.START_GAME, () => { + socket.emit( + globals.COMMANDS.FETCH_IN_PROGRESS_STATE, + stateBucket.currentGameState.accessCode, + stateBucket.currentGameState.client.cookie, + function (gameState) { + stateBucket.currentGameState = gameState; + processGameState( + stateBucket.currentGameState, + gameState.client.cookie, + socket, + gameStateRenderer, + gameTimerManager, + timerWorker + ); + } + ); + }); + } + if (!socket.hasListeners(globals.EVENTS.SYNC_GAME_STATE)) { + socket.on(globals.EVENTS.SYNC_GAME_STATE, () => { + socket.emit( + globals.COMMANDS.FETCH_IN_PROGRESS_STATE, + stateBucket.currentGameState.accessCode, + stateBucket.currentGameState.client.cookie, + function (gameState) { + stateBucket.currentGameState = gameState; + processGameState( + stateBucket.currentGameState, + gameState.client.cookie, + socket, + gameStateRenderer, + gameTimerManager, + timerWorker + ); + } + ); + }); + } + + if (timerWorker && gameTimerManager) { + gameTimerManager.attachTimerSocketListeners(socket, timerWorker, gameStateRenderer); + } + + if (!socket.hasListeners(globals.EVENTS.KILL_PLAYER)) { + socket.on(globals.EVENTS.KILL_PLAYER, (id) => { + const killedPerson = stateBucket.currentGameState.people.find((person) => person.id === id); + if (killedPerson) { + killedPerson.out = true; + if (stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR) { + toast(killedPerson.name + ' killed.', 'success', true, true, 6); + gameStateRenderer.renderPlayersWithRoleAndAlignmentInfo(stateBucket.currentGameState.status === globals.STATUS.ENDED); + } else { + if (killedPerson.id === stateBucket.currentGameState.client.id) { + const clientUserType = document.getElementById('client-user-type'); + if (clientUserType) { + clientUserType.innerText = globals.USER_TYPES.KILLED_PLAYER + ' \uD83D\uDC80'; + } + gameStateRenderer.updatePlayerCardToKilledState(); + toast('You have been killed!', 'warning', true, true, 6); + } else { + toast(killedPerson.name + ' was killed!', 'warning', true, true, 6); + } + if (stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(true); + } else { + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(false); + } + } + } + }); + } + + if (!socket.hasListeners(globals.EVENTS.REVEAL_PLAYER)) { + socket.on(globals.EVENTS.REVEAL_PLAYER, (revealData) => { + const revealedPerson = stateBucket.currentGameState.people.find((person) => person.id === revealData.id); + if (revealedPerson) { + revealedPerson.revealed = true; + revealedPerson.gameRole = revealData.gameRole; + revealedPerson.alignment = revealData.alignment; + if (stateBucket.currentGameState.client.userType === globals.USER_TYPES.MODERATOR) { + toast(revealedPerson.name + ' revealed.', 'success', true, true, 6); + gameStateRenderer.renderPlayersWithRoleAndAlignmentInfo(stateBucket.currentGameState.status === globals.STATUS.ENDED); + } else { + if (revealedPerson.id === stateBucket.currentGameState.client.id) { + toast('Your role has been revealed!', 'warning', true, true, 6); + } else { + toast(revealedPerson.name + ' was revealed as a ' + revealedPerson.gameRole + '!', 'warning', true, true, 6); + } + if (stateBucket.currentGameState.client.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(true); + } else { + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(false); + } + } + } + }); + } + + if (!socket.hasListeners(globals.EVENTS.CHANGE_NAME)) { + socket.on(globals.EVENTS.CHANGE_NAME, (personId, name) => { + propagateNameChange(stateBucket.currentGameState, name, personId); + updateDOMWithNameChange(stateBucket.currentGameState, gameStateRenderer); + processGameState( + stateBucket.currentGameState, + stateBucket.currentGameState.client.cookie, + socket, + gameStateRenderer, + gameTimerManager, + timerWorker, + false + ); + }); + } + + if (!socket.hasListeners(globals.COMMANDS.END_GAME)) { + socket.on(globals.COMMANDS.END_GAME, (people) => { + stateBucket.currentGameState.people = people; + stateBucket.currentGameState.status = globals.STATUS.ENDED; + processGameState( + stateBucket.currentGameState, + stateBucket.currentGameState.client.cookie, + socket, + gameStateRenderer, + gameTimerManager, + timerWorker + ); + }); + } +} + +function displayStartGamePromptForModerators (gameState, gameStateRenderer) { + const div = document.createElement('div'); + div.innerHTML = templates.START_GAME_PROMPT; + div.querySelector('#start-game-button').addEventListener('click', gameStateRenderer.startGameHandler); + document.body.appendChild(div); +} + +function validateName (name) { + return typeof name === 'string' && name.length > 0 && name.length <= 30; +} + +function removeStartGameFunctionalityIfPresent (gameStateRenderer) { + document.querySelector('#start-game-prompt')?.removeEventListener('click', gameStateRenderer.startGameHandler); + document.querySelector('#start-game-prompt')?.remove(); +} + +function propagateNameChange (gameState, name, personId) { + if (gameState.client.id === personId) { + gameState.client.name = name; + } + const matchingPerson = gameState.people.find((person) => person.id === personId); + if (matchingPerson) { + matchingPerson.name = name; + } + + if (gameState.moderator.id === personId) { + gameState.moderator.name = name; + } + + const matchingSpectator = gameState.spectators?.find((spectator) => spectator.id === personId); + if (matchingSpectator) { + matchingSpectator.name = name; + } +} + +function updateDOMWithNameChange (gameState, gameStateRenderer) { + if (gameState.status === globals.STATUS.IN_PROGRESS) { + switch (gameState.client.userType) { + case globals.USER_TYPES.PLAYER: + case globals.USER_TYPES.KILLED_PLAYER: + case globals.USER_TYPES.SPECTATOR: + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(false); + break; + case globals.USER_TYPES.MODERATOR: + gameStateRenderer.renderPlayersWithRoleAndAlignmentInfo(gameState.status === globals.STATUS.ENDED); + break; + case globals.USER_TYPES.TEMPORARY_MODERATOR: + gameStateRenderer.renderPlayersWithNoRoleInformationUnlessRevealed(true); + break; + default: + break; + } + } else { + gameStateRenderer.renderLobbyPlayers(); + } +} + +function activateRoleInfoButton (deck) { + deck.sort((a, b) => { + return a.team === globals.ALIGNMENT.GOOD ? 1 : -1; + }); + document.getElementById('role-info-button').addEventListener('click', (e) => { + e.preventDefault(); + document.getElementById('prompt').innerHTML = templates.ROLE_INFO_MODAL; + const modalContent = document.getElementById('game-role-info-container'); + for (const card of deck) { + const roleDiv = document.createElement('div'); + const roleNameDiv = document.createElement('div'); + + roleNameDiv.classList.add('role-info-name'); + + const roleName = document.createElement('h5'); + const roleQuantity = document.createElement('h5'); + const roleDescription = document.createElement('p'); + + roleDescription.innerText = card.description; + roleName.innerText = card.role; + roleQuantity.innerText = card.quantity + 'x'; + + if (card.team === globals.ALIGNMENT.GOOD) { + roleName.classList.add(globals.ALIGNMENT.GOOD); + } else { + roleName.classList.add(globals.ALIGNMENT.EVIL); + } + + roleNameDiv.appendChild(roleQuantity); + roleNameDiv.appendChild(roleName); + + roleDiv.appendChild(roleNameDiv); + roleDiv.appendChild(roleDescription); + + modalContent.appendChild(roleDiv); + } + ModalManager.displayModal('role-info-modal', 'role-info-modal-background', 'close-role-info-modal-button'); + }); +} + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = game; +} else { + game(); +} diff --git a/client/src/scripts/home.js b/client/src/scripts/home.js new file mode 100644 index 0000000..15cf119 --- /dev/null +++ b/client/src/scripts/home.js @@ -0,0 +1,48 @@ +import { XHRUtility } from '../modules/XHRUtility.js'; +import { toast } from '../modules/Toast.js'; +import { injectNavbar } from '../modules/Navbar.js'; + +const home = () => { + injectNavbar(); + document.getElementById('join-form').onsubmit = (e) => { + e.preventDefault(); + const userCode = document.getElementById('room-code').value; + if (roomCodeIsValid(userCode)) { + attemptToJoinGame(userCode); + } else { + toast('Invalid code. Codes are 6 numbers or letters.', 'error', true, true); + } + }; +}; + +function roomCodeIsValid (code) { + return typeof code === 'string' && /^[a-z0-9]{6}$/.test(code.toLowerCase()); +} + +function attemptToJoinGame (code) { + XHRUtility.xhr( + '/api/games/availability/' + code.toLowerCase().trim(), + 'GET', + null, + null + ) + .then((res) => { + if (res.status === 200) { + window.location = '/game/' + res.content; + } + }).catch((res) => { + if (res.status === 404) { + toast('Game not found', 'error', true); + } else if (res.status === 400) { + toast(res.content, 'error', true); + } else { + toast('An unknown error occurred. Please try again later.', 'error', true); + } + }); +} + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = home; +} else { + home(); +} diff --git a/client/src/scripts/howToUse.js b/client/src/scripts/howToUse.js new file mode 100644 index 0000000..e7d2679 --- /dev/null +++ b/client/src/scripts/howToUse.js @@ -0,0 +1,9 @@ +import { injectNavbar } from '../modules/Navbar.js'; + +const howToUse = () => { injectNavbar(); }; + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = howToUse; +} else { + howToUse(); +} diff --git a/client/src/scripts/notFound.js b/client/src/scripts/notFound.js new file mode 100644 index 0000000..68e7047 --- /dev/null +++ b/client/src/scripts/notFound.js @@ -0,0 +1,9 @@ +import { injectNavbar } from '../modules/Navbar.js'; + +const notFound = () => { injectNavbar(); }; + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = notFound; +} else { + notFound(); +} diff --git a/client/src/styles/GLOBAL.css b/client/src/styles/GLOBAL.css new file mode 100644 index 0000000..4f6fcb5 --- /dev/null +++ b/client/src/styles/GLOBAL.css @@ -0,0 +1,676 @@ +canvas, caption, center, cite, code, +dd, del, dfn, div, dl, dt, em, embed, +fieldset, font, form, h1, h2, h3, h4, +h5, h6, hr, i, iframe, img, ins, kbd, +label, legend, li, menu, object, ol, p, +pre, q, s, samp, small, span, strike, +strong, sub, sup, table, tbody, td, tfoot, +th, thead, tr, tt, u, ul, var { + margin: 0; + padding: 0; + border: 0; + background: transparent; +} +@font-face { + font-family: 'diavlo'; + src: url("../webfonts/Diavlo_LIGHT_II_37.woff2") format("woff2"); +} + +@font-face { + font-family: 'signika-negative'; + src: url("../webfonts/SignikaNegative-Light.woff2") format("woff2"); +} + +html { + font-family: 'signika-negative', sans-serif !important; + background-color: #0f0f10; + overflow: auto; +} + +body { + display: flex; + flex-direction: column; + align-items: flex-start; + margin: 0 auto; + position: relative; + background-color: #0f0f10; +} + +.bmc-btn { + height: 40px !important; + border-radius: 3px !important; + font-size: 18px !important; + min-width: 180px !important; + padding: 0 17px !important; +} + +.bmc-btn-text { + margin: 0 !important; +} + +h1 { + font-family: 'diavlo', sans-serif; + color: #b1afcd; + filter: drop-shadow(2px 2px 4px black); + margin: 0.5em 0; +} + +h2 { + color: whitesmoke; + font-size: 25px; + font-weight: bold; +} + +h3 { + color: #d7d7d7; + font-family: 'signika-negative', sans-serif; + font-weight: normal; + font-size: 18px; + margin: 0.5em 0; +} + +#footer { + bottom: 0; + width: 100%; + text-align: center; + align-items: center; + display: flex; + justify-content: center; + flex-wrap: wrap; + color: #d7d7d7; + font-size: 14px; + margin-top: 4em; + margin-bottom: 0.5em; +} +#footer a img { + width: 32px; +} + +#footer a { + color: #f7f7f7; + text-decoration: none; + cursor: pointer; + font-family: 'diavlo', sans-serif; + margin: 0 0.25em; +} + +#footer a:hover { + color: gray; +} + +#footer div { + display: flex; +} + +#footer > div, #footer > a { + margin: 0.5em; +} + +#footer div:nth-child(2) > a, #footer div:nth-child(2) > p { + margin: 0 5px; +} + +label { + color: #d7d7d7; + font-family: 'signika-negative', sans-serif; + font-size: 20px; + font-weight: normal; +} + +input, textarea { + background-color: transparent; + border: 1px solid white; + border-radius: 3px; + color: #d7d7d7; +} + +a { + text-decoration: none; +} + +textarea, input { + font-family: 'signika-negative', sans-serif; + font-size: 16px; +} + +button { + display: flex; + align-items: center; + justify-content: center; +} + +.app-button, input[type="submit"] { + font-family: 'signika-negative', sans-serif !important; + padding: 10px; + background-color: #13762b; + border-radius: 3px; + color: whitesmoke; + font-size: 18px; + cursor: pointer; + border: 2px solid transparent; + text-shadow: 0 3px 4px rgb(0 0 0 / 55%); +} + +.app-button:active, input[type=submit]:active { + border: 2px solid #21ba45; +} + +.cancel { + background-color: #762323 !important; +} + +.cancel:hover { + background-color: #623232 !important; + border: 2px solid #8a1c1c !important; +} + +.container { + padding: 5px; + border-radius: 3px; + display: flex; + flex-direction: column; + justify-content: center; + width: 95%; + margin: 0 auto; + align-items: center; +} + +.app-button:hover, input[type="submit"]:hover, #game-link:hover { + background-color: #326243; + border: 2px solid #1c8a36; +} + +.emphasized { + font-weight: bold; + color: #00a718; +} + +#how-to-use-container img { + max-width: 98%; + border: 1px solid #57566a; + border-radius: 3px; + width: 45em; + margin: 0 auto; + /* justify-self: center; */ + /* align-self: center; */ + display: flex; +} + +#how-to-use-container h1 { + font-family: signika-negative, sans-serif; +} + +input { + padding: 10px; +} + +.info-message { + pointer-events: none; + display: flex; + align-items: center; + justify-content: center; + position: fixed; + z-index: 55000; + padding: 10px; + border-radius: 3px; + font-family: 'signika-negative', sans-serif; + font-weight: 100; + box-shadow: 0 1px 1px rgba(0,0,0,0.11), + 0 2px 2px rgba(0,0,0,0.11), + 0 4px 4px rgba(0,0,0,0.11), + 0 8px 8px rgba(0,0,0,0.11), + 0 16px 16px rgba(0,0,0,0.11), + 0 32px 32px rgba(0,0,0,0.11); + left: 0; + right: 0; + width: fit-content; + max-width: 80%; + min-width: 15em; + font-size: 20px; + margin: 0 auto; +} + +#navbar { + display: flex; + align-items: center; + padding: 5px 0; + width: 100%; + background-color: #333243; + border-bottom: 2px solid #57566a; + height: 51px; + z-index: 53000; +} + +#how-to-use-container { + color: #d7d7d7; + display: flex; + flex-direction: column; + margin: 0 auto; + width: 95%; + max-width: 64em; + line-height: 1.5; +} + +#how-to-use-container h3 { + font-size: 25px; +} + +#how-to-use-container h1 { + font-size: 40px !important; +} + +.tutorial-image-small { + width: 30em !important; +} + +#desktop-links > a:nth-child(1), #mobile-links a:nth-child(1) { + margin: 0 0.5em; + width: 50px; +} + +.logo { + display: flex; + align-items: center; +} + +#navbar img { + width: 100%; +} + +#navbar a:not(.logo) { + color: #f7f7f7; + text-decoration: none; + cursor: pointer; + font-family: 'diavlo', sans-serif; + border-radius: 5px; + padding: 2px 5px; + font-size: 20px; + margin: 0 0.75em; + width: fit-content; +} + +#navbar a:hover { + color: gray; +} + +.overlay { + position: fixed; + background-size: cover; + height: 100%; + opacity: 50%; + background-color: black; + width: 100%; + z-index: 50000; +} + +.hidden { + display: none !important; +} + +.hamburger-light { + min-width: auto; + color: whitesmoke; +} + +.hamburger-dark { + min-width: auto; + color: black; +} + +#mobile-links { + display: flex; + flex-direction: column; + margin-top: 3em; +} + +.mobile-link { + margin-top: 1em !important; + margin-left: 1em !important; +} + +@media(max-width: 1000px) { + #navbar { + display: flex; + padding: 0; + } + + #navbar-hamburger { + z-index: 52000; + position: relative; + } + + #desktop-menu { + display: none; + } + + #mobile-menu { + position: absolute; + top: 0; + left: 0; + height: auto; + padding-bottom: 2em; + width: 100%; + z-index: 51000; + background-color: #191920; + } +} + +@media(min-width: 1001px) { + + #navbar-hamburger, #mobile-menu, #mobile-menu-background-overlay { + display: none; + } + + .desktop-link { + display: flex; + } + + #desktop-links { + display: flex; + align-items: center; + } +} + +.flex-row-container { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + justify-content: center; +} + +.flex-row-container-left-align { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; +} + +.animated-placeholder { + animation-fill-mode: forwards; + animation-duration: 1s; + animation-iteration-count: infinite; + animation-name: pulse-background; + animation-timing-function: ease-in; + animation-direction: alternate; + background: rgb(238,238,238); + position: relative; + overflow: hidden; + height: 20px; + border-radius: 3px; + opacity: 0.15; + margin: 0.5em 0; +} + +.animated-placeholder-short { + width: 100%; + max-width: 15em; + height: 2em; + margin: 0 auto; +} + +.animated-placeholder-long { + width: 100%; + max-width: 30em; + height: 8em; + margin: 0 auto 1em auto; +} + +.animated-placeholder-invisible { + background-color: transparent; + animation: none; +} + +.placeholder-row { + display: flex; + margin: 0; + justify-content: center; + width: 100%; +} + +.placeholder-row .animated-placeholder-short { + margin: 0 0 1em 0; +} + +.good, .compact-card.good .card-role { + color: #4b6bfa; +} + +.good-players, #deck-good { + background-color: #26244a; +} + +.evil-players, #deck-evil { + background-color: #4a2424; +} + +.evil, .compact-card.evil .card-role { + color: #e73333; +} + +@keyframes placeholder { + 0%{ + background-position: 50% 0 + } + 100%{ + background-position: -50% 0 + } +} + +@keyframes pulse-background { + from { + background-color: rgb(120 120 120); + } to { + background-color: rgb(255 255 255); + } +} + + +@keyframes fade-in-slide-down-then-exit { + 0% { + opacity: 0; + transform: translateY(-20px); + } + 5% { + opacity: 1; + transform: translateY(0px); + } + 95% { + opacity: 1; + transform: translateY(0px); + } + 100% { + opacity: 0; + transform: translateY(-20px); + } +} + +@keyframes fade-in-slide-down { + 0% { + opacity: 0; + transform: translateY(-20px); + } + 5% { + opacity: 1; + transform: translateY(0px); + } + 95% { + opacity: 1; + transform: translateY(0px); + } + 100% { + opacity: 1; + transform: translateY(0px); + } +} + +@media(max-width: 550px) { + h1 { + font-size: 30px; + } + + #step-1 div { + font-size: 20px; + } + + .info-message { + padding: 5px; + font-size: 16px; + } +} + +@media(min-width: 551px) { + h1 { + font-size: 50px; + } + + #step-1 div { + font-size: 25px; + } +} + +.spinner-background { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: calc(100% + 100px); + background-color: rgba(0, 0, 0, 0.75); + z-index: 50; +} + + +/* via https://loading.io/css/ */ + +.spinner-container { + position: relative; +} + +.spinner-container p { + margin: auto; + position: fixed; + top: 0; + left: 0; + bottom: -8em; + font-size: 20px; + z-index: 51; + text-align: center; + right: 0; + color: #d7d7d7; + height: fit-content; +} + +.lds-spinner { + margin: auto; + position: fixed; + top: -80px; + left: 0; + bottom: 0; + z-index: 51; + right: 0; + height: fit-content; + display: inline-block; + width: 80px; +} +.lds-spinner div { + transform-origin: 40px 40px; + animation: lds-spinner 1.2s linear infinite; +} +.lds-spinner div:after { + content: " "; + display: block; + position: absolute; + top: 3px; + left: 37px; + width: 6px; + height: 18px; + border-radius: 20%; + background: #d7d7d7; +} +.lds-spinner div:nth-child(1) { + transform: rotate(0deg); + animation-delay: -1.1s; +} +.lds-spinner div:nth-child(2) { + transform: rotate(30deg); + animation-delay: -1s; +} +.lds-spinner div:nth-child(3) { + transform: rotate(60deg); + animation-delay: -0.9s; +} +.lds-spinner div:nth-child(4) { + transform: rotate(90deg); + animation-delay: -0.8s; +} +.lds-spinner div:nth-child(5) { + transform: rotate(120deg); + animation-delay: -0.7s; +} +.lds-spinner div:nth-child(6) { + transform: rotate(150deg); + animation-delay: -0.6s; +} +.lds-spinner div:nth-child(7) { + transform: rotate(180deg); + animation-delay: -0.5s; +} +.lds-spinner div:nth-child(8) { + transform: rotate(210deg); + animation-delay: -0.4s; +} +.lds-spinner div:nth-child(9) { + transform: rotate(240deg); + animation-delay: -0.3s; +} +.lds-spinner div:nth-child(10) { + transform: rotate(270deg); + animation-delay: -0.2s; +} +.lds-spinner div:nth-child(11) { + transform: rotate(300deg); + animation-delay: -0.1s; +} +.lds-spinner div:nth-child(12) { + transform: rotate(330deg); + animation-delay: 0s; +} + +.bmc-button span:nth-child(1) { + font-size: 20px; +} + +.bmc-button { + line-height: 35px !important; + height:40px !important; + text-decoration: none !important; + display:inline-flex !important; + align-items: center !important; + color:#ffffff !important; + background-color:#333243 !important; + border-radius: 5px !important; + border: 1px solid transparent !important; + padding: 7px 15px 7px 10px !important; + font-size: 15px !important; + box-shadow: 0px 1px 1px rgba(190, 190, 190, 0.5) !important; + -webkit-box-shadow: 0px 1px 2px 1px rgba(190, 190, 190, 0.5) !important; + font-family: sitewide-sans-serif, sans-serif !important; + -webkit-box-sizing: border-box !important; + box-sizing: border-box !important; +} + +.bmc-button:hover, .bmc-button:active, .bmc-button:focus { + -webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; + text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; + opacity: 0.85 !important;color:#ffffff !important; +} + + +@keyframes lds-spinner { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} diff --git a/client/src/styles/create.css b/client/src/styles/create.css new file mode 100644 index 0000000..40192c1 --- /dev/null +++ b/client/src/styles/create.css @@ -0,0 +1,573 @@ +.compact-card { + border: 2px solid transparent; + text-align: center; + cursor: pointer; + position: relative; + margin: 0.3em; + background-color: #191920; + color: gray; + box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); + border-radius: 3px; + user-select: none; + display: flex; + height: 55px; +} + +.compact-card h1 { + display: flex; + align-items: center; + font-size: 14px; + margin: 0 10px 0 10px; +} + +.compact-card .card-role { + color: #bfb8b8; + margin: 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.selected-card { + border: 2px solid #c5c5c5; +} + +.card-role { + font-weight: bold; + pointer-events: none; +} + +.compact-card-right p { + font-size: 40px; + margin: 0 10px 0 0; + display: flex; + justify-content: flex-end; +} + +.compact-card-left p { + font-size: 40px; + margin: 0 0 0 10px; + display: flex; + justify-content: flex-start; +} + +.compact-card-left, .compact-card-right { + width: 50%; +} + +.compact-card .card-quantity { + text-align: center; + margin: 0; + font-size: 25px; +} + +.compact-card-header { + position: absolute; + left: 0; + right: 0; + margin: auto; + flex-direction: column; + align-items: center; + justify-content: center; + display: flex; + top: 0; + pointer-events: none; + text-align: center; +} + +#deck-container, #deck, #custom-roles-container { + width: fit-content; +} + +#custom-roles-container { + width: 95%; + max-width: 25em; +} + +.deck-role { + border-radius: 3px; + margin: 0.25em 0; + padding: 0 5px; + font-size: 18px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#custom-roles-container, #deck-status-container { + color: #d7d7d7; + margin: 1em 0.5em; + background-color: #191920; + padding: 10px; + border-radius: 3px; + border: 2px solid #333243; + position: relative; +} + +#deck-status-container { + width: 20em; + max-width: 95%; + height: 13em; + overflow-y: auto; + position: relative; +} + +#deck-count { + font-size: 30px; + position: sticky; + top: 0; + left: 5px; + background-color: #333243; + width: fit-content; + padding: 0 5px; + border-radius: 3px; +} + +#deck-list { + margin-top: 0.5em; +} + +#deck-list-placeholder { + margin: auto; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + width: 290px; + height: 50px; + font-size: 20px; + text-align: center; +} + +#custom-role-hamburger .hamburger-inner, #custom-role-hamburger .hamburger-inner::before, #custom-role-hamburger .hamburger-inner::after { + background-color: whitesmoke; + width: 28px; + height: 3px; +} + +#custom-roles-container .hamburger-box { + width: 28px; + height: 20px; +} + +#custom-role-hamburger { + position: absolute; + top: 0; + right: 0; +} + +#custom-role-hamburger .hamburger-inner::before { + top: -8px; +} + +#custom-role-hamburger .hamburger-inner::after { + top: -16px; +} + +#custom-role-actions { + color: whitesmoke; + position: absolute; + top: 38px; + right: 29px; + background-color: #333243; + border-radius: 3px; + box-shadow: -3px -3px 6px rgb(0 0 0 / 60%); +} + +.custom-role-action { + display: flex; + width: 100%; + padding: 10px; + background-color: #333243; + text-align: center; + justify-content: center; + align-items: center; + font-size: 20px; +} + +.custom-role-action:hover { + background-color: #57566a; + cursor: pointer; +} + +#deck-good, #deck-evil { + padding: 0; + border-radius: 3px; + margin: 0.5em; + display: flex; + flex-wrap: wrap; + overflow: auto; + max-height: 20em; +} + +#deck-container { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + justify-content: center; + flex-direction: column; + width: 95%; + max-width: 38em; +} + +#deck-container label { + margin: 0.5em; + display: block; +} + +#step-3 { + display: flex; + padding: 10px; + justify-content: center; + align-items: center; + width: fit-content; + border-radius: 3px; + margin: 0 auto; +} + +option { + background-color: #191920; + cursor: pointer; +} + +#step-4 > div { + display: flex; + flex-direction: column; + align-items: flex-start; + text-align: left; + justify-content: center; + margin: 0 auto; + width: 25em; + max-width: 95%; +} + +#step-4 > div label { + width: 100%; +} + +#moderation-self span { + color: gray; + font-size: 18px; +} + +form { + width: 100%; +} + +select { + padding: 10px; + font-size: 16px; + font-family: 'signika-negative', sans-serif; + background-color: transparent; + color: #d7d7d7; + border-radius: 3px; + min-width: 10em; + cursor: pointer; +} + +#game-form > div { + background-color: #191920; + display: flex; + flex-direction: column; + padding: 10px; + border-radius: 3px; + width: fit-content; + margin: 1em 0; +} + +#game-form > div > label { + display: flex; +} + +#game-time { + display: flex; + flex-wrap: wrap; + background-color: #191920; + border: 2px solid #333243; + border-radius: 3px; +} + +.step { + margin-bottom: 2em; +} + +#step-2 { + max-width: 70em; + margin: 0 auto; + justify-content: center; +} + +#game-time label, #game-time input { + margin-right: 10px; + font-size: 25px; +} + +#game-time div { + margin: 0.5em; +} + +#role-alignment { + max-width: 10em; +} + +label[for="game-time"], label[for="add-card-to-deck-form"], label[for="deck"] { + color: whitesmoke; + font-size: 20px; + border-radius: 3px; + margin-bottom: 10px; + font-weight: bold; +} + +input[type="number"] { + width: 3em; + font-size: 40px; +} + +#add-card-to-deck-form { + margin: 1em 0; +} + +#create-game { + background-color: #1c8a36; + color: whitesmoke; + font-size: 30px; + padding: 10px 50px; +} + +#create-game:hover { + background-color: #326243; + border: 2px solid #1c8a36; +} + +#deck-select { + margin: 0.5em 1em 1.5em 0; + overflow-y: auto; + height: 15em; +} + +.deck-select-role { + display: flex; + justify-content: space-between; + background-color: black; + align-items: center; + padding: 5px; + margin: 0.25em 0; + border-radius: 3px; + border: 1px solid transparent; + font-size: 16px; +} + +.deck-select-role-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap +} + +.deck-select-role:hover { + border: 1px solid #d7d7d7; +} + +.deck-select-role-options { + display: flex; + align-items: center; + justify-content: center; +} + +#deck-select img { + height: 20px; + margin: 0 8px; + cursor: pointer; + padding: 5px; + border-radius: 3px; +} + +#deck-select img:nth-child(4) { + height: 18px; +} + +#deck-select img:hover { + filter: brightness(1.5); + background-color: #8080804d; +} + +.dropdown { + margin: 0.5em; +} + +.creation-step { + width: 20px; + height: 20px; + background-color: transparent; + border-radius: 50%; + border: 2px solid whitesmoke; + margin: 0 0.5em; +} + +.creation-step-filled { + background-color: whitesmoke; +} + +#creation-step-container { + margin-top: 2em; + width: 100%; + min-height: 16em; +} + +#creation-step-container > div:nth-child(2) { + animation: fade-in 0.5s ease-out; +} + +#step-title { + margin: 0 auto 1em auto; + text-align: center; +} + +#creation-step-buttons { + display: flex; + justify-content: space-between; + margin-top: 2em; + position: relative; + margin-bottom: 8em; +} + +#game-creation-container { + width: 95%; + position: relative; + margin-bottom: 4em; +} + +#tracker-container { + display: flex; + align-items: center; + margin-top: 2em; + justify-content: center; + width: 100%; +} + +#upload-custom-roles-modal input[type='file'] { + margin: 2em 0; +} + +#creation-step-tracker { + display: flex; + justify-content: center; + margin: 0 20px; +} + +#step-forward-button, #step-back-button, #create-game { + font-family: sans-serif; + font-size: 20px; + padding: 10px 20px; +} + +#step-forward-button, #step-back-button { + background-color: #66666657 !important; +} + +#step-forward-button, #create-game { + right: 15%; +} + +#step-back-button { + left: 15%; + background-color: #762323; +} + +#step-1 div { + background-color: #191920; + color: whitesmoke; + padding: 1em; + max-width: 20em; + margin: 0.5em; + cursor: pointer; + border: 2px solid #333243; + border-radius: 3px; + box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); +} + +#step-1 div.option-selected { + border: 2px solid whitesmoke; + background-color: #3a3c46; +} + +#step-1 div > strong { + color: #00a718; +} + +#step-1 div:hover { + border: 2px solid whitesmoke; +} + +.review-option { + background-color: #191920; + border: 2px solid #333243; + color: whitesmoke; + padding: 10px; + font-size: 18px; + width: fit-content; + border-radius: 3px; + margin: 0.5em 0; + align-self: flex-start; +} + +@keyframes fade-in { + from { + opacity: 0; + } to { + opacity: 1; + } +} + +@media(max-width: 550px) { + h1 { + font-size: 35px; + } + + #step-1 div { + font-size: 20px; + } + + .creation-step { + width: 13px; + height: 13px; + } + + #step-forward-button, #step-back-button, #create-game { + padding: 10px 15px; + font-size: 16px; + } + + .deck-select-role-name { + font-size: 13px; + font-weight: bold; + } + + .compact-card .card-role { + max-width: 9em; + font-size: 13px; + } + + .compact-card { + min-width: 130px; + } +} + +@media(min-width: 551px) { + h1 { + font-size: 50px; + } + + #step-1 div { + font-size: 25px; + } + + .compact-card .card-role { + max-width: 10em; + font-size: 15px; + } + + .compact-card { + min-width: 155px; + } +} diff --git a/client/src/styles/game.css b/client/src/styles/game.css new file mode 100644 index 0000000..aee49c9 --- /dev/null +++ b/client/src/styles/game.css @@ -0,0 +1,781 @@ +.lobby-player, #moderator { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + background-color: black; + color: whitesmoke; + padding: 10px; + border-radius: 3px; + font-size: 17px; + width: fit-content; + min-width: 15em; + border: 2px solid transparent; + margin: 0.5em 0; +} + +#lobby-players { + overflow-y: auto; + max-height: 30em; + overflow-x: hidden; + padding: 0 10px; + border-radius: 3px; +} + +#lobby-people-container label { + display: block; + margin-bottom: 0.5em; +} + +.lobby-player-client { + border: 2px solid #21ba45; +} + +.lobby-player div:nth-child(2) { + color: #21ba45; +} + +#moderator.moderator-client { + border: 2px solid lightgray; +} + +#game-state-container { + justify-content: center; + flex-direction: row; + flex-wrap: wrap; + display: flex; + width: 95%; + margin: 1em auto 100px auto; +} + +#game-state-container h2 { + margin: 0.5em 0; +} + +#lobby-header { + margin-bottom: 1em; + max-width: 95%; +} + +h1 { + text-align: center; + margin: 0.5em auto; +} + +#game-state-container > div:not(#transfer-mod-modal-background):not(#transfer-mod-modal):not(#game-people-container) { + margin: 1em; +} + +#game-content .placeholder-row:nth-child(1) { + margin-top: 2em; +} + +#footer.game-page-footer { + margin-top: 1em; + margin-bottom: 85px; +} + +#footer.game-page-footer a { + margin: 0 5px; +} + +#end-of-game-header { + display: flex; + flex-wrap: wrap; + align-items: center; +} + +#end-of-game-header button { + margin: 0.5em; +} +.potential-moderator { + display: flex; + color: #d7d7d7; + background-color: black; + border: 2px solid transparent; + align-items: center; + padding: 10px; + border-radius: 3px; + justify-content: space-between; + margin: 0.5em 0; + position: relative; +} + +.potential-moderator:hover { + border: 2px solid #d7d7d7; + cursor: pointer; +} + +.potential-moderator:active { + border: 2px solid #21ba45; + transition: border 0.2s ease-out; +} + +#game-link { + cursor: pointer; + margin-top: 10px; + padding: 7px; + border-radius: 3px; + background-color: #121314; + border: 2px solid #333243; + color: whitesmoke; + align-items: center; + display: flex; + transition: background-color 0.2s; +} + +#game-link > div { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 95%; +} + +.role-info-name { + display: flex; +} + +.role-info-name h5:nth-child(1) { + margin-right: 10px; + color: #21ba45; +} + +#role-info-button { + margin-top: 1em; +} + +#role-info-button img { + height: 25px; + margin-left: 10px; +} + +#game-role-info-container { + display: flex; + flex-direction: column; + align-items: flex-start; + margin: 1em 0; + overflow-y: auto; + max-height: 35em; +} + +#game-role-info-container > div { + width: 95%; +} + +#transfer-mod-modal-content { + overflow-y: auto; + max-height: 35em; + width: 100%; +} + +.potential-moderator { + width: 90%; +} + +#role-info-modal .modal-button-container { + margin-top: 1em; + justify-content: center; +} + +#game-role-info-container .role-info-name { + padding: 5px; + border-radius: 3px; + font-size: 20px; + font-family: signika-negative, sans-serif; + margin: 0.5em 0; + background-color: black; +} + +#role-info-modal h2 { + color: #d7d7d7; + font-family: diavlo, sans-serif; + font-weight: normal; +} + +#game-role-info-container p, #game-role-info-container h5 { + text-align: left; + font-weight: normal; +} + +#game-role-info-container p { + color: #d7d7d7; + font-size: 14px; + font-family: signika-negative, sans-serif; +} + +#game-role { + position: relative; + border: 5px solid transparent; + background-color: #e7e7e7; + display: flex; + flex-direction: column; + cursor: pointer; + justify-content: space-between; + max-width: 17em; + border-radius: 3px; + height: 23em; + margin: 0 auto 2em auto; + width: 100%; + box-shadow: 0 1px 1px rgba(0,0,0,0.11), + 0 2px 2px rgba(0,0,0,0.11), + 0 4px 4px rgba(0,0,0,0.11), + 0 8px 8px rgba(0,0,0,0.11), + 0 16px 16px rgba(0,0,0,0.11), + 0 32px 32px rgba(0,0,0,0.11); + /*perspective: 1000px;*/ + /*transform-style: preserve-3d;*/ +} + +.game-role-good { + border: 5px solid #5469c5 !important; +} + +.game-role-evil { + border: 5px solid #c55454 !important; +} + +#game-role-back { + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + display: flex; + align-items: center; + justify-content: center; + background-color: #171522; + border: 5px solid #61606a; + position: relative; + flex-direction: column; + cursor: pointer; + max-width: 17em; + border-radius: 3px; + height: 23em; + margin: 0 auto 2em auto; + width: 100%; + box-shadow: 0 1px 1px rgba(0,0,0,0.11), + 0 2px 2px rgba(0,0,0,0.11), + 0 4px 4px rgba(0,0,0,0.11), + 0 8px 8px rgba(0,0,0,0.11), + 0 16px 16px rgba(0,0,0,0.11), + 0 32px 32px rgba(0,0,0,0.11); + /*perspective: 1000px;*/ + /*transform-style: preserve-3d;*/ +} + +#game-role-back h4 { + font-size: 24px; + padding: 0.5em; + text-align: center; + color: #e7e7e7; +} + +#game-role-back p { + color: #c3c3c3; + font-size: 20px; +} + +#game-timer { + padding: 10px; + margin-top: 5px; + background-color: #262626; + color: whitesmoke; + border-radius: 3px; + font-size: 35px; + text-shadow: 0 3px 4px rgb(0 0 0 / 85%); + border: 1px solid #747474; + min-width: 5em; + display: flex; + justify-content: center; + align-items: center; + height: 43px; +} + +#game-timer.low { + color: #e71c0d; + border: 1px solid #ca1b17; + background-color: #361a1a; +} + +#role-name { + position: absolute; + top: 6%; + left: 50%; + transform: translate(-50%, -50%); + font-size: 20px; + font-family: 'diavlo', sans-serif; + width: 95%; + text-align: center; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +#role-image { + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + position: absolute; + top: 37%; + left: 50%; + transform: translate(-50%, -50%); + width: 78%; +} + +#role-description { + overflow: auto; + position: absolute; + bottom: 8%; + left: 50%; + transform: translate(-50%, 0); + font-size: 15px; + width: 78%; + max-height: 6em; +} + +#game-link img { + width: 20px; + margin-left: 0.5em; +} + +#game-title { + margin: 0 auto; +} + +#client-container { + max-width: 35em; + margin: 1em 0; +} + +#client { + padding: 5px 10px; + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + background-color: #333243; + border-radius: 3px; + min-width: 15em; +} + +#client-name { + color: whitesmoke; + font-family: 'diavlo', sans-serif; + font-size: 30px; + margin: 0.25em 2em 0.25em 0; +} + +#client-user-type { + color: #21ba45; + font-family: 'signika-negative', sans-serif; + font-size: 25px; + background-color: black; + border-radius: 3px; + display: block; + padding: 0 5px; + box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); +} + +label[for='moderator'] { + font-family: 'diavlo', sans-serif; + color: lightgray; + filter: drop-shadow(2px 2px 4px black); + font-size: 30px; +} + +#start-game-prompt, #end-game-prompt { + display: flex; + align-items: center; + justify-content: center; + position: fixed; + z-index: 3; + border-radius: 3px; + font-family: 'signika-negative', sans-serif; + font-weight: 100; + box-shadow: 0 -2px 6px 0 rgb(0 0 0 / 45%); + left: 0; + right: 0; + bottom: 0; + /* width: fit-content; */ + font-size: 20px; + height: 85px; + margin: 0 auto; + animation: fade-in-slide-up 10s ease; + animation-fill-mode: forwards; + animation-direction: normal; + width: 100%; + background-color: #333243; +} + +#end-game-prompt { + box-shadow: 0 -6px 40px black; +} + +#start-game-button, #end-game-button { + font-family: 'signika-negative', sans-serif !important; + padding: 10px; + border-radius: 3px; + color: whitesmoke; + cursor: pointer; + border: 2px solid transparent; + transition: background-color, border 0.3s ease-out; + text-shadow: 0 3px 4px rgb(0 0 0 / 85%); + font-size: 25px; +} + +#start-game-button { + background-color: #1c8a36; +} + +#end-game-button { + background-color: #8a1c1c; +} + +#start-game-button:hover { + background-color: #326243; + border: 2px solid #1c8a36; +} + +#end-game-button:hover { + background-color: #623232; + border: 2px solid #8a1c1c; +} + +#play-pause { + display: flex; + align-items: center; + margin-left: 1em; +} + +#play-pause img { + cursor: pointer; + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + width: 60px; +} + +#play-pause img:hover { + filter: brightness(0.5); +} + +#play-pause img:active { + transform: scale(0.95); +} + +.paused { + animation: pulse 0.75s linear infinite alternate; +} + +.paused-low { + animation: pulse-low 0.75s linear infinite alternate; +} + +#game-header { + display: flex; + flex-wrap: wrap; + flex-direction: column; + align-items: flex-start; +} + +.timer-container-moderator { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + margin-bottom: 1em; +} + +.game-player { + border-left: 3px solid #21ba45; + display: flex; + color: #d7d7d7; + background-color: black; + align-items: center; + padding: 0 5px; + justify-content: space-between; + margin: 0.5em 0; + position: relative; + box-shadow: 2px 3px 6px rgb(0 0 0 / 50%); +} + +.game-player-name { + position: relative; + width: 10em; + overflow: hidden; + white-space: nowrap; + font-weight: bold; + font-size: 18px; + text-overflow: ellipsis; +} + +.kill-player-button, .reveal-role-button { + font-family: 'signika-negative', sans-serif !important; + border-radius: 3px; + color: whitesmoke; + font-size: 16px; + cursor: pointer; + border: 2px solid transparent; + transition: background-color, border 0.3s ease-out; + text-shadow: 0 3px 4px rgb(0 0 0 / 55%); + margin: 5px 0 5px 25px; + width: 117px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.placeholder-button { + font-family: 'signika-negative', sans-serif !important; + display: flex; + justify-content: center; + border-radius: 3px; + color: #767676; + font-weight: bold; + font-size: 16px; + border: 2px solid transparent; + text-shadow: 0 3px 4px rgb(0 0 0 / 55%); + margin: 5px 0 5px 35px; + width: 103px; +} + +#game-link:hover { + background-color: #26282a; + border: 2px solid #d7d7d7; +} + +.reveal-role-button { + background-color: #586a6e; +} + +.reveal-role-button:hover, #mod-transfer-button:hover { + background-color: #4e5664; +} + +.kill-player-button:hover { + background-color: #b35c5c; +} + +.reveal-role-button img { + width: 18px; + margin-left: 5px; +} + +#game-player-list > .game-player.killed::after { + content: '\01F480'; + font-size: 24px; + margin-left: 1em; +} + +.killed, .killed .game-player-role { + /*color: gray !important;*/ +} + +.game-player.killed { + border-left: 3px solid #444444; +} + +.reveal-role-button { + display: flex; + align-items: center; +} + +.make-mod-button { + background-color: #3f5256; + font-size: 18px; + padding: 10px; + border: 2px transparent; + border-radius: 3px; + color: #d7d7d7; + font-family: signika-negative, sans-serif; +} + +.make-mod-button:hover { + cursor: pointer; +} + +.kill-player-button { + background-color: #9f4747; +} + +.killed-card { + width: 55% !important; +} + +.game-player > div:nth-child(2) { + display: flex; + flex-wrap: wrap; +} + +#game-player-list { + overflow-y: auto; + overflow-x: hidden; + padding: 0 10px 10px 0; + max-height: 37em; +} + +#game-player-list > div { + padding: 2px 10px; + border-radius: 3px; + margin-bottom: 0.5em; +} + +#game-parameters { + color: #d7d7d7; + font-size: 25px; + margin: 0.5em; +} + +#game-parameters > div { + display: flex; + align-items: center; +} + +#game-parameters img { + height: 20px; + margin-right: 10px; +} + +#players-alive-label { + display: block; + margin-bottom: 10px; + font-size: 25px; +} + +#transfer-mod-form { + width: 100%; +} + +#transfer-mod-form .modal-button-container { + justify-content: center; +} + +#transfer-mod-modal .modal-button-container { + justify-content: center; +} + +#change-name-modal-background { + cursor: default; +} + +#lobby-people-container , #game-people-container { + background-color: #333243; + padding: 10px 10px 0 10px; + border-radius: 3px; + min-height: 25em; + max-width: 35em; + min-width: 17em; + margin-top: 1em; +} + +#transfer-mod-modal-content { + margin-bottom: 2em; + color: #d7d7d7; +} + +#game-state-container.vertical-flex { + flex-direction: column; + align-items: center; +} + +@media(max-width: 500px) { + #client-name { + font-size: 25px; + } + + #client-user-type, #game-parameters { + font-size: 20px; + } + + #game-state-container { + margin: 0 auto 85px auto; + } + + button { + font-size: 16px; + } + + #play-pause img { + width: 45px; + } + + .make-mod-button { + font-size: 16px; + padding: 5px; + } + + .game-player-name { + font-size: 16px; + } + + #game-timer { + font-size: 30px; + height: 38px; + } + + #players-alive-label { + font-size: 20px; + } + + #start-game-prompt, #end-game-prompt { + height: 65px; + } + + #start-game-button, #end-game-button { + font-size: 20px; + padding: 5px; + } + + #game-role, #game-role-back { + height: 20em; + max-width: 15em; + } + + #client-container { + margin: 0; + } + + #game-role-back p { + font-size: 16px; + } + + #game-role-back h4 { + font-size: 20px; + } + + h2 { + font-size: 18px; + } +} + +@keyframes pulse { + from { + color: rgba(255, 255, 255, 0.1); + } to { + color: rgba(255, 255, 255, 1); + } +} + +@keyframes pulse-low { + from { + color: rgba(231, 28, 13 , 0.1); + } to { + color: rgba(231, 28, 13, 1); + } +} + +@keyframes fade-in-slide-up { + 0% { + opacity: 0; + transform: translateY(20px); + } + 5% { + opacity: 1; + transform: translateY(0px); + } + 100% { + opacity: 1; + transform: translateY(0px); + } +} diff --git a/client/src/styles/hamburgers.css b/client/src/styles/hamburgers.css new file mode 100644 index 0000000..be217df --- /dev/null +++ b/client/src/styles/hamburgers.css @@ -0,0 +1,85 @@ +/*! + * Hamburgers + * @description Tasty CSS-animated hamburgers + * @author Jonathan Suh @jonsuh + * @site https://jonsuh.com/hamburgers + * @link https://github.com/jonsuh/hamburgers + */ +.hamburger { + padding: 10px 10px; + display: inline-block; + cursor: pointer; + transition-property: opacity, filter; + transition-duration: 0.15s; + transition-timing-function: linear; + font: inherit; + color: inherit; + text-transform: none; + background-color: transparent; + border: 0; + margin: 0; + overflow: visible; +} +.hamburger:hover { + opacity: 0.7; } +.hamburger.is-active:hover { + opacity: 0.7; } +.hamburger.is-active .hamburger-inner, +.hamburger.is-active .hamburger-inner::before, +.hamburger.is-active .hamburger-inner::after { + background-color: #b1afcd; } + +.hamburger-box { + width: 40px; + height: 24px; + display: inline-block; + position: relative; } + +.hamburger-inner { + display: block; + top: 50%; + margin-top: -2px; } +.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { + width: 40px; + height: 4px; + background-color: #b1afcd; + border-radius: 4px; + position: absolute; + transition-property: transform; + transition-duration: 0.15s; + transition-timing-function: ease; } +.hamburger-inner::before, .hamburger-inner::after { + content: ""; + display: block; } +.hamburger-inner::before { + top: -10px; } +.hamburger-inner::after { + bottom: -10px; } + +/* + * Collapse + */ +.hamburger--collapse .hamburger-inner { + top: auto; + bottom: 0; + transition-duration: 0.13s; + transition-delay: 0.13s; + transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } +.hamburger--collapse .hamburger-inner::after { + top: -20px; + transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), opacity 0.1s linear; } +.hamburger--collapse .hamburger-inner::before { + transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); } + +.hamburger--collapse.is-active .hamburger-inner { + transform: translate3d(0, -10px, 0) rotate(-45deg); + transition-delay: 0.22s; + transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } +.hamburger--collapse.is-active .hamburger-inner::after { + top: 0; + opacity: 0; + transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), opacity 0.1s 0.22s linear; } +.hamburger--collapse.is-active .hamburger-inner::before { + top: 0; + transform: rotate(-90deg); + transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1); } diff --git a/client/src/styles/home.css b/client/src/styles/home.css new file mode 100644 index 0000000..a61f86b --- /dev/null +++ b/client/src/styles/home.css @@ -0,0 +1,104 @@ +html { + /*background: rgb(0,0,0); + background: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgb(17 18 18) 35%, rgba(27,31,31,1) 100%);*/ +} + +body { + align-items: center; +} + +button#home-create-button { + padding: 20px; + margin-bottom: 1em; +} + +#home-page-top-section { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + background-color: #1e1b26; + margin-bottom: 15px; +} + +form { + display: flex; + flex-wrap: wrap; + margin: 10px 0; + padding: 10px; + border-radius: 3px; + justify-content: center; + align-items: center; +} + +a button { + text-shadow: 0 3px 4px rgb(0 0 0 / 85%); +} + +#join-button { + min-width: 6em; + max-height: 3em; + background-color: #1c8a36; + color: whitesmoke; + font-size: 16px; +} + +#join-button:hover { + background-color: #326243; + border: 2px solid #1c8a36; +} + +#join-form div:nth-child(1) { + margin-right: 1em; +} + +h3 { + font-size: 20px; + margin-bottom: 1em; + padding: 1em; + max-width: 23em; + font-family: 'diavlo', sans-serif; +} + +img[src='../images/logo_cropped.gif'] { + max-width: 400px; + width: 63vw; + min-width: 250px; + margin: 3em 0 1em 0; +} + +form > div { + margin: 15px 0; +} + +#join-container { + max-width: 90%; +} + +#join-container > label { + font-size: 35px; + font-family: 'diavlo', sans-serif; + color: #b1afcd; + filter: drop-shadow(2px 2px 4px black); +} + +label[for="room-code"], label[for="player-name"] { + margin-right: 0.5em; +} + +@media (min-width: 700px) { + button#home-create-button { + font-size: 35px; + } +} + +@media (max-width: 701px) { + button#home-create-button { + font-size: 5vw; + } + + #room-code { + max-width: 9em; + } +} diff --git a/client/src/styles/modal.css b/client/src/styles/modal.css new file mode 100644 index 0000000..0bddbba --- /dev/null +++ b/client/src/styles/modal.css @@ -0,0 +1,81 @@ +.modal { + border-radius: 2px; + text-align: center; + position: fixed; + width: 85%; + z-index: 100; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: #191920; + align-items: center; + justify-content: center; + max-width: 25em; + font-family: sans-serif; + flex-direction: column; + padding: 1em; +} + +.modal-background { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: calc(100% + 100px); + background-color: rgba(0, 0, 0, 0.75); + z-index: 50; + cursor: pointer; +} + +.modal > form > div:not(.modal-button-container) { + display: flex; + flex-direction: column; + margin-bottom: 1em; +} + +.modal > form > div > label { + display: flex; + font-size: 16px; +} + +#close-modal-button { + background-color: #762323 !important; +} + +.modal-button-container { + display: flex; + width: 100%; + justify-content: space-between; + flex-direction: row; +} + +#custom-role-info-modal { + display: flex; + color: #d7d7d7; + text-align: left; + font-family: signika-negative, sans-serif; +} + +#custom-role-info-modal-description { + margin: 2em 0; + max-height: 10em; + overflow: auto; +} + +#custom-role-info-modal-name { + font-family: 'diavlo', sans-serif; + font-size: 23px; +} + +#custom-role-info-modal-alignment { + font-size: 20px; + font-weight: bold; +} + +#change-name-modal, #transfer-mod-modal, #role-info-modal { + position: fixed; +} + +#role-info-modal, #transfer-mod-modal { + max-height: 80%; +} diff --git a/client/src/views/404.html b/client/src/views/404.html new file mode 100644 index 0000000..5e96291 --- /dev/null +++ b/client/src/views/404.html @@ -0,0 +1,68 @@ + + + + + + Create A Game + + + + + + + + + + + + + + + +
+ + +

404

+

The game or other resource that you are looking for could not be found, or you don't have permission to access it. + If this error is unexpected, the application may have restarted.

+
+ + + + diff --git a/client/src/views/create.html b/client/src/views/create.html new file mode 100644 index 0000000..cc0bbc2 --- /dev/null +++ b/client/src/views/create.html @@ -0,0 +1,88 @@ + + + + + + Create A Game + + + + + + + + + + + + + + + +
+ +
+ + + + +

Create A Game

+
+
+
+
+
+
+
+
+
+

Select your method of moderation:

+
+
+
+
+
+
+
+
+ + + diff --git a/client/src/views/game.html b/client/src/views/game.html new file mode 100644 index 0000000..89ab19a --- /dev/null +++ b/client/src/views/game.html @@ -0,0 +1,64 @@ + + + + + + Active Game + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Connecting to game...

+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + diff --git a/client/src/views/home.html b/client/src/views/home.html new file mode 100644 index 0000000..22a764b --- /dev/null +++ b/client/src/views/home.html @@ -0,0 +1,55 @@ + + + + + + + Werewolf Utility + + + + + + + + + + + + + + + + +
+ +
+ +

A tool to run werewolf when not in-person, or in any setting without a deck of cards.

+ + + +
+
+ +
+
+ + +
+ +
+
+
+ +
+ + +
+
+

Werewolf created by Andrew Plotkin

+
+
+ + + diff --git a/client/src/views/how-to-use.html b/client/src/views/how-to-use.html new file mode 100644 index 0000000..c56d249 --- /dev/null +++ b/client/src/views/how-to-use.html @@ -0,0 +1,85 @@ + + + + + + Create A Game + + + + + + + + + + + + + + + +
+ +
+

Purpose of the Application

+
This app serves as a means of running games in a social setting where a traditional + running of the game is hindered. This might be when people are meeting virtually, and thus roles can't be handed + out in-person, or when people are in-person but don't have Werewolf cards with them. You can use a deck of regular + playing cards, but it can be difficult for players to remember which card signifies which role, especially if + you want to build a crazy game with many different roles. Even when people are together and have cards, there's + information that would be great to centralize for everyone - a timer, role descriptions, and the in/out status of + players. This app attempts to provide the utilities necessary to run Werewolf with all the different roles you want, + wherever you can access the internet. +
+

Creating a Game

+
+ Creating a game through the app has 3 main components: +
+

Step One: Choosing method of moderation

+
+ You have two options for moderation during the game. If the moderator isn't playing, you can choose the dedicated + moderator option. Dedicated Moderators are not dealt into the game. Once they start the game, they will know + everyone's role. At that point, they can kill players, reveal players' roles to everyone else, transfer their + moderator powers, play/pause the timer (if there is one), and end the game when team good or evil wins. +

+ Similarly, you can also choose the temporary moderator option. The key differences + here are that you are dealt a role. You have the same powers as the dedicated + moderator, with the exception of game knowledge - you know the same information that a regular player does. + When you remove the first player from the game, your powers will be automatically transferred to them - they become + the dedicated moderator, and you become a regular player. +

+ Dedicated moderators can transfer their moderator powers + to a player that is out, or to a spectator. That way, if the current dedicated moderator has to leave, or simply + does not want to moderate anymore, they can easily delegate. +

+ moderation-option +

+

Step Two: Build your deck

+
+ A default set of common roles are available to you on this page. Available roles + are ones that have a widget where you can adjust their quantity and add them to the current game. They have been + "taken out of the box," so to speak: +

+ +

+ You also have a custom role box. These are not yet "available," in that they + are still "in the box." If you want them in the game, click the green plus button, and they will become part of the + available roles - a widget will be created, and you can increment or decrement the quantity of that card in the game. + Custom roles can be created, removed, edited, and imported/exported via a formatted text file: +

+ +

+

Step Three: Set an optional timer

+
+ If you don't fill in these fields, the game will be untimed. If you do, you can use a time between 1 minute + and 5 hours. The timer can be played and paused by the current moderator. Importantly, when the timer expires + nothing automatically happens. The timer will display 0s, but the game will not + end. Whether or not the game ends immediately after that or continues longer is up to the moderator. +

+

More content coming soon.

+
+
+ + + diff --git a/client/src/webfonts/Diavlo_LIGHT_II_37.woff2 b/client/src/webfonts/Diavlo_LIGHT_II_37.woff2 new file mode 100644 index 0000000..996862b Binary files /dev/null and b/client/src/webfonts/Diavlo_LIGHT_II_37.woff2 differ diff --git a/client/src/webfonts/OFL.txt b/client/src/webfonts/OFL.txt new file mode 100644 index 0000000..9531841 --- /dev/null +++ b/client/src/webfonts/OFL.txt @@ -0,0 +1,94 @@ +Copyright (c) 2011 by Anna Giedryś (http://ancymonic.com), +with Reserved Font Names "Signika". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/client/src/webfonts/SignikaNegative-Light.woff2 b/client/src/webfonts/SignikaNegative-Light.woff2 new file mode 100644 index 0000000..7342135 Binary files /dev/null and b/client/src/webfonts/SignikaNegative-Light.woff2 differ diff --git a/client/webpack/webpack-dev.config.js b/client/webpack/webpack-dev.config.js new file mode 100644 index 0000000..a68125c --- /dev/null +++ b/client/webpack/webpack-dev.config.js @@ -0,0 +1,36 @@ +const path = require('path'); + +module.exports = { + entry: { + game: './client/src/scripts/game.js', + home: './client/src/scripts/home.js', + create: './client/src/scripts/create.js', + notFound: './client/src/scripts/notFound.js', + howToUse: './client/src/scripts/howToUse.js' + }, + output: { + path: path.resolve(__dirname, '../dist'), + filename: "[name]-bundle.js" + }, + mode: "development", + node: false, + devtool: 'source-map', + module: { + rules: [ + { + test: /\.m?js$/, + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env"], // ensure compatibility with older browsers + plugins: ["@babel/plugin-transform-object-assign"], // ensure compatibility with IE 11 + }, + }, + }, + { + test: /\.js$/, + loader: "webpack-remove-debug", // remove "debug" package + } + ], + } +} diff --git a/client/webpack/webpack-prod.config.js b/client/webpack/webpack-prod.config.js new file mode 100644 index 0000000..a39d2fd --- /dev/null +++ b/client/webpack/webpack-prod.config.js @@ -0,0 +1,35 @@ +const path = require('path'); +'use strict'; + +module.exports = { + entry: { + game: './client/src/scripts/game.js', + home: './client/src/scripts/home.js', + create: './client/src/scripts/create.js', + notFound: './client/src/scripts/notFound.js' + }, + output: { + path: path.resolve(__dirname, '../dist'), + filename: "[name]-bundle.js" + }, + mode: "production", + node: false, + module: { + rules: [ + { + test: /\.m?js$/, + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env"], // ensure compatibility with older browsers + plugins: ["@babel/plugin-transform-object-assign"], // ensure compatibility with IE 11 + }, + }, + }, + { + test: /\.js$/, + loader: "webpack-remove-debug", // remove "debug" package + } + ], + } +} diff --git a/assets/images/favicon.ico b/favicon.ico similarity index 100% rename from assets/images/favicon.ico rename to favicon.ico diff --git a/javascript/cards.js b/javascript/cards.js deleted file mode 100644 index 0f64861..0000000 --- a/javascript/cards.js +++ /dev/null @@ -1,57 +0,0 @@ -export let cards = [ - { - role: "Villager", - team: "good", - description: "During the day, find the wolves and kill them.", - isTypeOfWerewolf: false - }, - { - role: "Werewolf", - team: "evil", - description: "During the night, choose a villager to kill. Don't get killed.", - isTypeOfWerewolf: true - }, - { - role: "Dream Wolf", - team: "evil", - description: "If a Werewolf dies, you become a Werewolf. You do not wake up with the Werewolves until this happens. You count for parity only after converting to a wolf.", - isTypeOfWerewolf: false - }, - { - role: "Minion", - team: "evil", - description: "You are an evil villager - you know who the wolves are, and you want them to win.", - isTypeOfWerewolf: false - }, - { - role: "Seer", - team: "good", - description: "During each night, choose one person. The moderator will tell you whether that player is a wolf.", - isTypeOfWerewolf: false - }, - { - role: "Shadow", - team: "evil", - description: "If the Seer checks you, the Seer dies that night instead of whoever the wolves chose to kill. Reveal" + - " yourself to the moderator.", - isTypeOfWerewolf: false - }, - { - role: "Hunter", - team: "good", - description: "If you are alive with a wolf at the end of the game, you best the wolf, and the village wins.", - isTypeOfWerewolf: false - }, - { - role: "Sorcerer", - team: "good", - description: "Once a game, change who the wolves are going to kill to someone else, including yourself.", - isTypeOfWerewolf: false - }, - { - role: "Mason", - team: "good", - description: "Masons know who other Masons are. Wake them up to see each other on the first night.", - isTypeOfWerewolf: false - } -]; diff --git a/javascript/game.js b/javascript/game.js deleted file mode 100644 index e1b4dae..0000000 --- a/javascript/game.js +++ /dev/null @@ -1,456 +0,0 @@ -import {utility} from './util.js' - -const socket = io(); - -const standardRoles = ["Villager", "Werewolf", "Seer", "Shadow", "Hunter", "Mason", "Minion", "Sorcerer", "Dream Wolf"]; -let clock; -let currentGame = null; -let lastGameState = null; -let cardFlippedOver = false; -let cardRendered = false; -let lastKilled = null; - -// respond to the game state received from the server -socket.on('state', function(game) { - currentGame = game; - if(detectChanges(game)) { - buildGameBasedOnState(game); - } -}); - -function buildGameBasedOnState(game) { - switch(game.status) { - case "lobby": - renderLobby(); - break; - case "started": - renderGame(); - break; - case "ended": - renderEndSplash(); - break; - default: - break; - } -} - -function detectChanges(game) { - if (lastGameState === null || - lastGameState.status !== game.status || - lastGameState.paused !== game.paused || - lastGameState.lastKilled !== game.lastKilled || - lastGameState.startTime !== game.startTime || - lastGameState.players.length !== game.players.length) { - lastGameState = game; - return true; - } - return false; -} - -function hideAfterExit(e) { - e.target.style.display = 'none'; - e.target.classList.remove(e.target.exitClass); -} - -function triggerExitAnimation(e) { - e.target.classList.remove(e.target.entranceClass); - e.target.classList.remove(e.target.exitClass); - e.target.offsetWidth; - e.target.classList.add(e.target.exitClass); - window.setTimeout(()=>{ - e.target.addEventListener('animationend', hideAfterExit, true); - },0); -} - -function triggerEntranceAnimation(selector, entranceClass, exitClass, image) { - let transitionEl = document.querySelector(selector); - transitionEl.style.display = 'flex'; - transitionEl.addEventListener('animationend', triggerExitAnimation, true); - transitionEl.classList.remove(entranceClass); - transitionEl.entranceClass = entranceClass; - transitionEl.exitClass = exitClass; - transitionEl.offsetWidth; - if (currentGame.reveals) { - if (image && standardRoles.includes(currentGame.killedRole)) { - transitionEl.classList.remove("killed-role-custom"); - transitionEl.setAttribute("src", "../assets/images/roles/" + currentGame.killedRole.replace(/\s/g, '') + ".png"); - } else { - if (image) { - transitionEl.setAttribute("src", "../assets/images/custom.svg"); - transitionEl.setAttribute("class", "killed-role-custom"); - } - } - } else { - transitionEl.setAttribute("src", "../assets/images/question_mark.svg"); - transitionEl.setAttribute("class", "killed-role-hidden"); - } - transitionEl.classList.add(entranceClass); -} - -function playKilledAnimation() { - triggerEntranceAnimation('#overlay', 'animate-overlay-in', 'animate-overlay-out', false); - triggerEntranceAnimation('#killed-role', 'animate-role-in', 'animate-role-out', true); - triggerEntranceAnimation('#killed-name', 'animate-name-in', 'animate-name-out', false); -} - -function launchGame() { - randomlyDealCardsToPlayers(); - utility.shuffle(currentGame.players); // put the players in a random order - socket.emit('startGame', { players: currentGame.players , code: currentGame.accessCode}); -} - -function randomlyDealCardsToPlayers() { - for (let player of currentGame.players) { - player.card = drawRandomCard(); - } -} - -function drawRandomCard() { - return currentGame.deck.splice(utility.getRandomInt(currentGame.deck.length) - 1, 1)[0]; -} - -function getLiveCount() { - let liveCount = 0; - for (let player of currentGame.players) { - if (!player.dead) { - liveCount ++; - } - } - return liveCount; -} - -function renderEndSplash() { - clearInterval(clock); - document.getElementById("game-container").remove(); - document.querySelector("#message-box").style.display = 'none'; - currentGame.winningTeam === "village" - ? document.getElementById("end-container").innerHTML ="

Village

wins!
" - : document.getElementById("end-container").innerHTML ="

Wolves

win!
"; - const rosterContainer = document.createElement("div"); - rosterContainer.setAttribute("id", "roster"); - document.getElementById("end-container").innerHTML += "
Here's what everyone was:
"; - let rosterContent = ""; - for (const player of currentGame.players) { - rosterContent += "
"; - rosterContent += standardRoles.includes(player.card.role) - ? "" - : ""; - rosterContent += player.name + ": " + player.card.role + "
" - } - rosterContainer.innerHTML = rosterContent; - document.getElementById("end-container").appendChild(rosterContainer); - document.getElementById("end-container").innerHTML += ""; - -} - -function renderGame() { - // remove lobby components if present - if (document.getElementById("lobby-container") !== null && document.getElementById("launch") !== null) { - document.getElementById("lobby-container").remove(); - document.getElementById("launch").remove(); - } - - document.querySelector("#message-box").style.display = 'block'; - if (currentGame.killedRole && currentGame.lastKilled !== lastKilled) { // a new player has been killed - lastKilled = currentGame.lastKilled; - document.getElementById("killed-name").innerText = currentGame.reveals - ? currentGame.killedPlayer + " was a " + currentGame.killedRole + "!" - : currentGame.killedPlayer + " has died!"; - playKilledAnimation(); - document.getElementById("message-box").innerText = currentGame.message; - } - const player = currentGame.players.find((player) => player.id === sessionStorage.getItem("id")); - - // render the header - document.getElementById("game-container").setAttribute("class", "game-container"); - const gameHeader = document.createElement("div"); - gameHeader.setAttribute("id", "game-header"); - gameHeader.innerHTML = - "
" + getLiveCount() + "/" + currentGame.size + " alive
" + - "
" + - "
"; - if (document.getElementById("game-header")) { - document.getElementById("card-container").removeChild(document.getElementById("game-header")); - } - document.getElementById("card-container").prepend(gameHeader); - - // render the card if it hasn't been yet - if (!cardRendered) { - renderPlayerCard(player); - cardRendered = true; - } - - // build the clock - if (currentGame.time) { - updateClock(); - document.getElementById("pause-container").innerHTML = currentGame.paused ? - "pause" - : "pause"; - document.getElementById("play-pause").addEventListener("click", pauseOrResumeGame) - } - - // add the "I'm dead" button - let killedBtn = document.createElement("button"); - killedBtn.setAttribute("id", "dead-btn"); - - if (player.dead) { - killedBtn.setAttribute("class", "app-btn killed-btn disabled"); - killedBtn.innerText = "Killed" - } else { - killedBtn.setAttribute("class", "app-btn killed-btn"); - killedBtn.innerText = "I'm dead"; - } - if (document.getElementById("dead-btn")) { - document.getElementById("card-container").removeChild(document.getElementById("dead-btn")); - } - document.getElementById("card-container").appendChild(killedBtn); - document.getElementById("dead-btn").addEventListener("click", killPlayer); - - // add the list of dead/alive players - renderDeadAndAliveInformation(); -} - -function renderDeadAndAliveInformation() { - // TODO: Refactor this function. - currentGame.players = currentGame.players.sort((a, b) => - { - return a.card.role > b.card.role ? 1 : -1; - }); - let infoContainer = document.getElementById("info-container"); - let alivePlayers = currentGame.players.filter((player) => !player.dead); - let deadPlayers = currentGame.players.filter((player) => player.dead); - deadPlayers.sort((a, b) => { // sort players by the time they died - return new Date(a.deadAt) > new Date(b.deadAt) ? -1 : 1; - }); - - let killedContainer = document.createElement("div"); - killedContainer.setAttribute("id", "killed-container"); - let killedHeader = document.createElement("h2"); - killedHeader.innerText = "Killed Players"; - killedContainer.appendChild(killedHeader); - - addDeadPlayers(deadPlayers, killedContainer); - - let aliveContainer = document.createElement("div"); - aliveContainer.setAttribute("id", "alive-container"); - let aliveHeader = document.createElement("h2"); - aliveContainer.appendChild(aliveHeader); - aliveHeader.innerText = currentGame.reveals - ? "Roles Still Alive" - : "Roles in the Game"; - var rollCounter = {}; // RTM - - if (currentGame.reveals) { - addAlivePlayers(alivePlayers, aliveContainer, rollCounter); - } else { - addAlivePlayers(currentGame.players, aliveContainer, rollCounter); - } - - if (infoContainer === null) { - infoContainer = document.createElement("div"); - infoContainer.setAttribute("id", "info-container"); - infoContainer.appendChild(killedContainer); - infoContainer.appendChild(aliveContainer); - document.getElementById("game-container").appendChild(infoContainer); - // Has to be done AFTER the infoContainer is rendered in the DOM to insert the updated counts - for (let x of document.getElementsByClassName("alive-player")) { - x.getElementsByClassName("rolecount")[0].innerText = rollCounter[x.getElementsByTagName("p")[0].innerText]; - } - } else { - document.getElementById("killed-container").remove(); - document.getElementById("alive-container").remove(); - document.getElementById("info-container").append(killedContainer); - document.getElementById("info-container").append(aliveContainer); - // Has to be done AFTER the infoContainer is rendered in the DOM to insert the updated counts - for (let x of document.getElementsByClassName("alive-player")) { - x.getElementsByClassName("rolecount")[0].innerText = rollCounter[x.getElementsByTagName("p")[0].innerText]; - } - } -} - -function addDeadPlayers(deadPlayers, killedContainer) { - deadPlayers.forEach((player) => { - let deadPlayerClass = player.card.team === "good" ? "dead-player-village" : "dead-player-evil"; - if (player.card.isTypeOfWerewolf) { - deadPlayerClass += " dead-player-wolf"; - } - const killedPlayer = document.createElement("div"); - if (currentGame.reveals) { - killedPlayer.setAttribute("class", "killed-player " + deadPlayerClass); - } else { - killedPlayer.setAttribute("class", "killed-player dead-player-no-reveals"); - } - killedPlayer.innerText = currentGame.reveals - ? player.name + ": " + player.card.role - : player.name; - killedContainer.appendChild(killedPlayer); - }); -} - -function addAlivePlayers(alivePlayers, aliveContainer, rollCounter) { - alivePlayers.forEach((player) => { - let alivePlayerClass = player.card.team === "good" ? "alive-player-village" : "alive-player-evil"; - if (player.card.isTypeOfWerewolf) { - alivePlayerClass += " alive-player-wolf"; - } - //RTM - if (rollCounter.hasOwnProperty(player.card.role)) { - rollCounter[player.card.role] += 1; - } else { - rollCounter[player.card.role] = 1; - //RTM - const alivePlayer = document.createElement("div"); - alivePlayer.setAttribute("class", "alive-player " + alivePlayerClass); - alivePlayer.innerHTML = "

" + player.card.role + "

"; - let roleCount = document.createElement("span"); // RTM - roleCount.setAttribute("class", "rolecount"); - //Add hidden description span - RTM 4/18/2020 - let playerCardInfo=document.createElement("span"); - playerCardInfo.setAttribute("class","tooltiptext"); - playerCardInfo.innerText=player.card.description; - alivePlayer.prepend(roleCount); - alivePlayer.appendChild(playerCardInfo); - aliveContainer.appendChild(alivePlayer); - } - }); -} - -function renderPlayerCard(player) { - const card = player.card; - const cardArt = standardRoles.includes(card.role) ? - "" + card.role + "" - : "
Custom Role
"; - const cardClass = player.card.team === "good" ? "game-card-inner village" : "game-card-inner wolf"; - const playerCard = document.createElement("div"); - playerCard.setAttribute("id", "game-card"); - playerCard.setAttribute("class", getFlipState()); - playerCard.innerHTML = - "
" + - "
" + - "

" + card.role + "

" + - cardArt + - "
" + - "

" + card.description + "

" + - "

Click to flip

" + - "
" + - "
" + - "
" + - "
"; - document.getElementById("card-container").appendChild(playerCard); - document.getElementById("game-card").addEventListener("click", flipCard); -} - -function pauseOrResumeGame() { - if (currentGame.paused) { - socket.emit('resumeGame', currentGame.accessCode); - } else { - socket.emit('pauseGame', currentGame.accessCode); - } -} - -function getFlipState() { - return cardFlippedOver ? "flip-down" : "flip-up"; -} - -function flipCard() { - cardFlippedOver - ? flipUp() - : flipDown(); - - cardFlippedOver = !cardFlippedOver; -} - -function flipUp(){ - const card = document.getElementById("game-card"); - card.classList.add("flip-up"); - card.classList.remove("flip-down"); -} - -function flipDown(){ - const card = document.getElementById("game-card"); - card.classList.add("flip-down"); - card.classList.remove("flip-up"); -} - -function displayTime() { - const start = currentGame.paused ? new Date(currentGame.pauseTime) : new Date(); - const end = new Date(currentGame.endTime); - const delta = end - start; - let seconds = Math.floor((delta / 1000) % 60); - let minutes = Math.floor((delta / 1000 / 60) % 60); - let hours = Math.floor((delta / (1000 * 60 * 60)) % 24); - - seconds = seconds < 10 ? "0" + seconds : seconds; - minutes = minutes < 10 ? "0" + minutes : minutes; - - document.getElementById("clock").innerText = hours > 0 - ? hours + ":" + minutes + ":" + seconds - : minutes + ":" + seconds; -} - -function updateClock() { - clearInterval(clock); - if (document.getElementById("clock") !== null) { - displayTime(); - clock = setInterval(function() { - displayTime(); - }, 1000); - } -} - -function killPlayer() { - if(confirm("Are you sure you are dead?")) { - socket.emit("killPlayer", currentGame.players.find((player) => player.id === sessionStorage.getItem("id")).id, currentGame.accessCode); - } -} - -function renderLobby() { - document.querySelector("#message-box").style.display = 'none'; - // Render lobby header - if (document.getElementsByClassName("lobby-player").length === 0) { - let header = document.createElement("h2"); - header.setAttribute("class", "app-header-secondary"); - header.innerText = "Lobby"; - document.getElementById("lobby-container").appendChild(header); - let subHeader = document.createElement("div"); - subHeader.setAttribute("id", "lobby-subheader"); - subHeader.innerHTML = "
" + - "" + currentGame.players.length + "" + - "/" + currentGame.size + " Players" + - "
" + - "
" + - "
Access Code: " + currentGame.accessCode + "
"; - document.getElementById("lobby-container").appendChild(subHeader); - } - // Render all players that are new - let i = 1; - for (let player of currentGame.players) { - if(!document.getElementById("player-" + i)) { - const playerContainer = document.createElement("div"); - player.id === sessionStorage.getItem("id") ? - playerContainer.setAttribute("class", "lobby-player highlighted") - : playerContainer.setAttribute("class", "lobby-player"); - playerContainer.setAttribute("id", "player-" + i); - playerContainer.innerHTML = "

" + player.name + "

"; - document.getElementById("lobby-container").appendChild(playerContainer); - document.getElementById("join-count").innerText = currentGame.players.length.toString(); - } - i ++; - } - // display the launch button if the player is the host - if (sessionStorage.getItem("host")) { - if (currentGame.players.length === currentGame.size) { - document.getElementById("launch").innerHTML = ""; - document.getElementById("launch").addEventListener("click", launchGame); - } else { - document.getElementById("launch").innerHTML = ""; - } - } else { - document.getElementById("launch").innerHTML = "

The host will start the game.

" - } -} - -// request game state from server periodically -setInterval(function () { - socket.emit('requestState', {code: sessionStorage.getItem("code")}); -}, 200); diff --git a/javascript/index.js b/javascript/index.js deleted file mode 100644 index 419cfa1..0000000 --- a/javascript/index.js +++ /dev/null @@ -1,27 +0,0 @@ -let gameModeSelect = false; - -window.onload = function() { - document.getElementById("create-game").addEventListener("click", toggleGameModeSelect); - document.getElementById("game-mode-back").addEventListener("click", toggleGameModeSelect) -}; - -function toggleGameModeSelect() { - gameModeSelect = !gameModeSelect; - let mainButtons = document.getElementById("main-buttons"); - let gameModes = document.getElementById("game-mode-select"); - if (gameModeSelect) { - mainButtons.classList.remove("slide-in"); - mainButtons.offsetWidth; - mainButtons.classList.add("slide-out"); - mainButtons.addEventListener("animationend", function() { mainButtons.style.display = "none" }, {capture: true, once: true}); - - gameModes.style.display = "flex"; - } else { - gameModes.style.display = "none"; - - mainButtons.style.display = "flex"; - mainButtons.classList.remove("slide-out"); - mainButtons.offsetWidth; - mainButtons.classList.add("slide-in"); - } -} diff --git a/javascript/join.js b/javascript/join.js deleted file mode 100644 index 512e2e0..0000000 --- a/javascript/join.js +++ /dev/null @@ -1,45 +0,0 @@ -const socket = io(); -import { utility } from './util.js' - -// respond to the game state received from the server -socket.on('joinError', function(message) { - document.getElementById("join-btn").classList.remove('disabled'); - document.getElementById("code").classList.add("error"); - document.getElementById("join-error").innerText = message; -}); - -// respond to the game state received from the server -socket.on('success', function() { - document.getElementById("join-btn").classList.remove('disabled'); - if (document.getElementById("code").classList.contains("error")) { - document.getElementById("code").classList.remove("error"); - document.getElementById("join-error").innerText = ""; - } - // If a player was a host of a previous game, don't make them the host of this one - if (sessionStorage.getItem("host")) { - sessionStorage.removeItem("host"); - } - window.location.replace('/' + document.getElementById("code").value.toString().trim().toLowerCase()); -}); - -document.getElementById("join-btn").addEventListener("click", function() { - document.getElementById("join-btn").classList.add('disabled'); - if (document.getElementById("name").value.length > 0) { - const code = document.getElementById("code").value.toString().trim().toLowerCase(); - if (document.getElementById("name").classList.contains("error")) { - document.getElementById("name").classList.remove("error"); - document.getElementById("name-error").innerText = ""; - } - sessionStorage.setItem("code", code); - let playerId = utility.generateID(); - sessionStorage.setItem("id", playerId); - const playerInfo = {name: document.getElementById("name").value, id: playerId, code: code}; - socket.emit('joinGame', playerInfo); - } else { - document.getElementById("join-btn").classList.remove('disabled'); - document.getElementById("name").classList.add("error"); - document.getElementById("name-error").innerText = "Name is required."; - } - -}); - diff --git a/javascript/modules/card-manager.js b/javascript/modules/card-manager.js deleted file mode 100644 index 1b852a7..0000000 --- a/javascript/modules/card-manager.js +++ /dev/null @@ -1,133 +0,0 @@ -const finishedArtArray = ["Villager", "Werewolf", "Seer", "Shadow", "Hunter", "Mason", "Minion", "Sorcerer", "Dream Wolf"]; - -export class CardManager { - constructor() {} - - static createCard(card) { - return new Card(card.role, card.team, card.description, card.quantity, card.isTypeOfWerewolf, card.custom, card.saved); - } - - // builds element for the informational role modal on the setup page - static constructModalRoleElement(card) { - const modalRole = document.createElement("div"); - modalRole.setAttribute("class", "modal-role"); - const roleClass = card.team === "good" ? "role-village" : "role-wolf"; - let roleImage; - if (card.custom === true) { - roleImage = "No art"; - } else { - roleImage = finishedArtArray.includes(card.role) ? - "No art" - : "Art soon."; - } - modalRole.innerHTML = - "
" + - roleImage + - "
" + - "

" + card.role + "

" + - "

" + card.team + "

" + - "
" + - "
" + - "

" + card.description + "

"; - return modalRole; - } - - static constructDeckBuilderElement(card, index) { - const cardContainer = document.createElement("div"); - - const quantityClass = card.team === "good" ? "card-quantity quantity-village" : "card-quantity quantity-wolf"; - - let cardClass = card.isTypeOfWerewolf ? "card card-werewolf" : "card"; - cardContainer.setAttribute("class", cardClass); - if (card.team === "good") { - cardContainer.setAttribute("id", "card-" + index); - } else { - cardContainer.setAttribute("id", "card-" + index); - } - cardContainer.innerHTML = - "
" + - "
" + - "
" + - "

" + card.role + "

" + - "
" + card.quantity + "
" + - "
" + - "

+

" + - "
" + - "
"; - cardContainer.innerHTML = card.custom - ? cardContainer.innerHTML += "" + card.role + "" - : cardContainer.innerHTML +="" + card.role + ""; - cardContainer.innerHTML += - "
" + - "

-

" + - "
"; - - return cardContainer; - } - - static constructCompactDeckBuilderElement(card, index) { - const cardContainer = document.createElement("div"); - - const quantityClass = card.team === "good" ? "card-quantity quantity-village" : "card-quantity quantity-wolf"; - - let cardClass = card.isTypeOfWerewolf ? "compact-card card-werewolf" : "compact-card"; - cardContainer.setAttribute("class", cardClass); - if (card.team === "good") { - cardContainer.setAttribute("id", "card-" + index); - } else { - cardContainer.setAttribute("id", "card-" + index); - } - cardContainer.innerHTML = - "
" + - "

-

" + - "
" + - "
" + - "

" + card.role + "

" + - "
" + card.quantity + "
" + - "
" + - "
" + - "

+

" + - "
"; - return cardContainer; - } - - static constructCustomCardIndicator(isCondensed, team) { - let customCard = document.createElement("div"); - if (isCondensed) { - customCard.classList.add("compact-card", "custom-card"); - } else { - customCard.classList.add("card", "custom-card"); - } - - if (team === "good") { - customCard.setAttribute("id", "custom-good"); - } else { - customCard.setAttribute("id", "custom-evil"); - } - - let cardHeader = document.createElement("h1"); - cardHeader.innerText = "Add Custom Role"; - - let cardBody = document.createElement("div"); - cardBody.innerText = "+"; - - customCard.appendChild(cardHeader); - customCard.appendChild(cardBody); - - return customCard; - } - -} - -class Card { - constructor(role, team, description, quantity, isTypeOfWerewolf, custom, saved) { - this.id = null; - this.role = role; - this.isTypeOfWerewolf = isTypeOfWerewolf; - this.team = team; - this.description = description; - this.quantity = quantity || 0; - this.custom = custom; - this.saved = saved; - } -} diff --git a/javascript/modules/heroku-client.js b/javascript/modules/heroku-client.js deleted file mode 100644 index e69de29..0000000 diff --git a/javascript/modules/logger.js b/javascript/modules/logger.js deleted file mode 100644 index c49a1f4..0000000 --- a/javascript/modules/logger.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = function(debugMode = false){ - return { - log(message = "") { - const now = new Date(); - console.log('LOG ', now.toGMTString(), ': ', message); - }, - - debug(message = "") { - if (!debugMode) return; - const now = new Date(); - console.debug('DEBUG ', now.toGMTString(), ': ', message); - }, - - error(message = "") { - if (!debugMode) return; - const now = new Date(); - console.error('ERROR ', now.toGMTString(), ': ', message); - } - }; -}; diff --git a/javascript/setup.js b/javascript/setup.js deleted file mode 100644 index 5dc8c5f..0000000 --- a/javascript/setup.js +++ /dev/null @@ -1,585 +0,0 @@ -import {cards} from './cards.js' -import {utility} from './util.js' -import {CardManager} from './modules/card-manager.js' - -const socket = io(); - -class Game { - constructor(accessCode, reveals, size, deck, time, hasDreamWolf) { - this.accessCode = accessCode; - this.reveals = reveals; - this.size = size; - this.deck = deck; - this.time = time; - this.players = []; - this.status = "lobby"; - this.hasDreamWolf = hasDreamWolf; - this.endTime = null; - } -} - -let gameSize = 0; -let atLeastOnePlayer = false; - -// register event listeners on buttons -document.getElementById("reset-btn").addEventListener("click", resetCardQuantities); -document.getElementById("create-btn").addEventListener("click", createGame); -document.getElementById("role-view-changer-gallery").addEventListener("click", function() { toggleViewChanger(false) }); -document.getElementById("role-view-changer-list").addEventListener("click", function() { toggleViewChanger(true) }); -document.getElementById("role-btn").addEventListener("click", function() { displayModal("role-modal", undefined) }); -document.getElementById("edit-role-btn").addEventListener("click", function() { displayModal("edit-custom-roles-modal", undefined) }); -document.getElementById("import-role-btn").addEventListener("click", function() { - document.getElementById("import-file-input").click(); -}); -document.getElementById("import-file-input").addEventListener("change", function(e) { - selectRoleImportFile(e); -}); -document.getElementById("custom-role-form").addEventListener("submit", function(e) { - addCustomCardToRoles(e); -}); -Array.from(document.getElementsByClassName("close")).forEach(function(element) { - element.addEventListener('click', closeModal); -}); - -// render all of the available cards to the user -window.onload = function() { - const urlParams = new URLSearchParams(window.location.search); - document.getElementById("create-game-header").innerText = urlParams.get('reveals') === "true" - ? "Create Reveal Game" - : "Create No-Reveal Game"; - readInUserCustomRoles(); - renderAvailableCards(false); -}; - -function renderAvailableCards(isCondensed) { - cards.sort(function(a, b) { - return a.role.toUpperCase().localeCompare(b.role); - }); - document.getElementById("card-select-good").innerHTML = ""; - document.getElementById("card-select-evil").innerHTML = ""; - document.getElementById("roles").innerHTML = ""; - document.getElementById("custom-roles").innerHTML = ""; - - for (let i = 0; i < cards.length; i ++) { - if (!cards[i].quantity) cards[i].quantity = 0; - cards[i].team === "good" - ? renderGoodRole(cards[i], i, isCondensed) - : renderEvilRole(cards[i], i, isCondensed); - } - - if (document.getElementById("custom-roles").getElementsByClassName("custom-role-edit").length === 0) { - document.getElementById("custom-roles").innerHTML = "

You haven't added any custom cards.

"; - } - - let customCardGood = CardManager.constructCustomCardIndicator(isCondensed, "good"); - let customCardEvil = CardManager.constructCustomCardIndicator(isCondensed, "evil"); - document.getElementById("card-select-good").appendChild(customCardGood); - document.getElementById("card-select-evil").appendChild(customCardEvil); - customCardGood.addEventListener("click", function() { - displayModal("custom-card-modal", "Good"); - }); - customCardEvil.addEventListener("click", function() { - displayModal("custom-card-modal", "Evil"); - }); -} - -function renderGoodRole(cardInfo, i, isCondensed) { - const card = CardManager.createCard(cardInfo); - if (card.custom) { - document.getElementById("custom-roles").appendChild(renderCustomRole(cardInfo)); - } - - document.getElementById("roles").appendChild(CardManager.constructModalRoleElement(card)); - if (isCondensed) { - document.getElementById("card-select-good").appendChild(CardManager.constructCompactDeckBuilderElement(card, i)); - let cardLeft = document.getElementById("card-" + i).getElementsByClassName("compact-card-left")[0]; - let cardQuantity = document.getElementById("card-" + i).getElementsByClassName("card-quantity")[0]; - let cardRight = document.getElementById("card-" + i).getElementsByClassName("compact-card-right")[0]; - cardRight.addEventListener("click", function() { incrementCardQuantity(cardRight) }, true); - cardLeft.addEventListener("click", function() { decrementCardQuantity(cardLeft) }, true); - cardRight.card = card; - cardRight.quantityEl = cardQuantity; - cardLeft.card = card; - cardLeft.quantityEl = cardQuantity; - } else { - document.getElementById("card-select-good").appendChild(CardManager.constructDeckBuilderElement(card, i)); - // Add event listeners to the top and bottom halves of the card to change the quantity. - let cardTop = document.getElementById("card-" + i).getElementsByClassName("card-top")[0]; - let cardQuantity = document.getElementById("card-" + i).getElementsByClassName("card-quantity")[0]; - let cardBottom = document.getElementById("card-" + i).getElementsByClassName("card-bottom")[0]; - cardTop.addEventListener("click", function() { incrementCardQuantity(cardTop) }, false); - cardBottom.addEventListener("click", function() { decrementCardQuantity(cardBottom) }, false); - cardTop.card = card; - cardTop.quantityEl = cardQuantity; - cardBottom.card = card; - cardBottom.quantityEl = cardQuantity; - } -} - -function renderEvilRole(cardInfo, i, isCondensed) { - const card = CardManager.createCard(cardInfo); - if (card.custom) { - document.getElementById("custom-roles").appendChild(renderCustomRole(cardInfo)); - } - - document.getElementById("roles").appendChild(CardManager.constructModalRoleElement(card)); - if (isCondensed) { - document.getElementById("card-select-evil").appendChild(CardManager.constructCompactDeckBuilderElement(card, i)); - let cardLeft = document.getElementById("card-" + i).getElementsByClassName("compact-card-left")[0]; - let cardQuantity = document.getElementById("card-" + i).getElementsByClassName("card-quantity")[0]; - let cardRight = document.getElementById("card-" + i).getElementsByClassName("compact-card-right")[0]; - cardRight.addEventListener("click", function() { incrementCardQuantity(cardRight) }, false); - cardLeft.addEventListener("click", function() { decrementCardQuantity(cardLeft) }, false); - cardRight.card = card; - cardRight.quantityEl = cardQuantity; - cardLeft.card = card; - cardLeft.quantityEl = cardQuantity; - } else { - document.getElementById("card-select-evil").appendChild(CardManager.constructDeckBuilderElement(card, i)); - // Add event listeners to the top and bottom halves of the card to change the quantity. - let cardTop = document.getElementById("card-" + i).getElementsByClassName("card-top")[0]; - let cardQuantity = document.getElementById("card-" + i).getElementsByClassName("card-quantity")[0]; - let cardBottom = document.getElementById("card-" + i).getElementsByClassName("card-bottom")[0]; - cardTop.addEventListener("click", function() { incrementCardQuantity(cardTop) }, false); - cardBottom.addEventListener("click", function() { decrementCardQuantity(cardBottom) }, false); - cardTop.card = card; - cardTop.quantityEl = cardQuantity; - cardBottom.card = card; - cardBottom.quantityEl = cardQuantity; - } -} - -function addCustomCardToRoles(e) { - e.preventDefault(); - if (!cards.find((card) => card.role === document.getElementById("custom-role-name").value)) { - let newCard = { - role: document.getElementById("custom-role-name").value, - team: document.getElementById("custom-role-team").value, - description: document.getElementById("custom-role-desc").value, - isTypeOfWerewolf: document.getElementById("custom-role-wolf").checked, - custom: true, - saved: document.getElementById("custom-role-remember").checked - }; - cards.push(newCard); - renderAvailableCards(document.getElementById("role-view-changer-list").classList.contains("selected")); - - if (newCard.saved === true) { - let existingRoles = localStorage.getItem("play-werewolf-custom-roles"); - if (existingRoles !== null) { - let rolesArray; - try { - rolesArray = JSON.parse(existingRoles); - } catch (e) { - console.error(e.message); - } - if (rolesArray) { - rolesArray.push(newCard); - } - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(rolesArray)); - } else { - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(new Array(newCard))); - } - } - updateCustomRoleModal(); - closeModal(); - document.getElementById("custom-role-form").reset(); - } else { - alert("A custom or standard card already exists with that name!") - } -} - -function addImportFileToRoles (e) { - //parse roles from file - let match = /^data:(.*);base64,(.*)$/.exec(e.target.result); - if (match == null) { - throw 'Could not parse result'; // should not happen - } - let mimeType = match[1]; - let content = match[2]; - let newRoles; - try { - newRoles = JSON.parse(atob(content)); - } catch(ex) { - console.error(ex.message); - } - - //add roles - let succesfullyAddedRoles = []; - let rolesThatFailedToImport = []; - let expectedKeys = ["role", "description", "team", "isTypeOfWerewolf"]; - newRoles.forEach(newRole => { - newRole.custom = true; - newRole.saved = true; - let newRoleValidationResult = validateNewRole(newRole, expectedKeys); - if (newRoleValidationResult.isValid) { - succesfullyAddedRoles.push(newRole); - } - else { - rolesThatFailedToImport.push(newRoleValidationResult); - } - }); - cards.push(...succesfullyAddedRoles); - renderAvailableCards(document.getElementById("role-view-changer-list").classList.contains("selected")); - // always save imported roles - let existingRoles = localStorage.getItem("play-werewolf-custom-roles"); - if (existingRoles !== null) { - let rolesArray; - try { - rolesArray = JSON.parse(existingRoles); - } catch (e) { - console.error(e.message); - } - if (rolesArray) { - rolesArray.push(...succesfullyAddedRoles); - } - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(rolesArray)); - } else { - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(succesfullyAddedRoles)); - } - updateCustomRoleModal(); - updateImportRolesModal(succesfullyAddedRoles, rolesThatFailedToImport); - displayModal("import-custom-roles-result-modal", undefined); -} - -function validateNewRole(newCard,expectedKeys) { - let newRoleValidationResult = {}; - newRoleValidationResult.role = newCard; - newRoleValidationResult.issues = []; - - //add warning if there already exists a loaded role with the same name - if (cards.find((card) => card.role === newCard.role)) { - newRoleValidationResult.issues.push({level: "warning", description: "duplicate entry"}); - } - - //For each required field, add error if the role is missing it - let missingKeys = expectedKeys.filter(function(key){ return Object.keys(newCard).indexOf(key) < 0 }); - missingKeys.forEach(missingKey => { - newRoleValidationResult.issues.push({level: "error", description: "Missing data: " + missingKey}); - }); - - newRoleValidationResult.isValid = ( newRoleValidationResult.issues.length == 0 ); - - return newRoleValidationResult; -} - -function updateCustomRoleModal() { - const customRoles = document.getElementById("custom-roles"); - customRoles.innerHTML = ""; - for (let i = 0; i < cards.length; i++){ - if (cards[i].custom) { - customRoles.appendChild(renderCustomRole(cards[i])); - } - } -} - -function updateImportRolesModal(succesfullyAddedRoles, rolesThatFailedToImport) { - let numAddedRoles = succesfullyAddedRoles.length; - if (numAddedRoles > 0) { - let successSubheader = (numAddedRoles == 1) ? "role successfully imported" : "roles successfully imported"; - document.getElementById("import-successes-subheader").innerHTML = numAddedRoles + " " + successSubheader; - const successfulRoleList = document.getElementById("import-successes-role-list"); - successfulRoleList.innerHTML = ""; - succesfullyAddedRoles.forEach(role => { - successfulRoleList.appendChild(renderCustomRole(role)); - }); - } - - let numFailedRoles = rolesThatFailedToImport.length; - if (numFailedRoles > 0) { - let failureSubheader = (numFailedRoles == 1) ? "role failed to import" : "roles failed to import"; - document.getElementById("import-failures-subheader").innerHTML = numFailedRoles + " " + failureSubheader; - document.getElementById("import-failures-issue-list").innerHTML = ""; - rolesThatFailedToImport.forEach(failureInfo => { - document.getElementById("import-failures-issue-list").appendChild(renderImportFailure(failureInfo)); - }); - } -} - -function renderImportFailure(failureInfo) { - let importFailure = document.createElement("div"); - importFailure.classList.add("import-failure"); - - let failureLabelContainer = document.createElement("div"); - failureLabelContainer.classList.add("import-failure-label"); - let triangle = document.createElement("div"); - triangle.classList.add("triangle"); - let roleName = document.createElement("p"); - roleName.innerText = failureInfo.role.role; - failureLabelContainer.appendChild(triangle); - failureLabelContainer.appendChild(roleName); - - let issueDescriptionContainer = document.createElement("div"); - issueDescriptionContainer.classList.add("import-failure-data"); - let levelSeverityOrder = ["warning", "error"]; - let levelIdx = 0; - let issueDescriptionList = document.createElement("ul"); - failureInfo.issues.forEach(issue => { - let description = document.createElement("li"); - description.innerText = issue.description; - let thisIssueLevelIdx = levelSeverityOrder.indexOf(issue.level); - if (thisIssueLevelIdx > levelIdx) { levelIdx = thisIssueLevelIdx; } - issueDescriptionList.appendChild(description); - }); - issueDescriptionContainer.appendChild(issueDescriptionList); - - importFailure.classList.add(levelSeverityOrder[levelIdx]); - importFailure.appendChild(failureLabelContainer); - importFailure.appendChild(issueDescriptionContainer); - return importFailure; -} - -function readInUserCustomRoles() { - let expectedKeys = ["role", "description", "team", "isTypeOfWerewolf", "custom", "saved"]; - let userCustomRoles = utility.validateCustomRolesJsonObject("play-werewolf-custom-roles", expectedKeys); - if (userCustomRoles) { - for (let i = 0; i < userCustomRoles.length; i++) { - cards.push(userCustomRoles[i]); - } - } -} - -function renderCustomRole(card) { - let roleElement = document.createElement("div"); - let editRemoveContainer = document.createElement("div"); - let editFormDiv = document.createElement("div"); - let roleLabel = document.createElement("div"); - let roleName = document.createElement("p"); - let remove = document.createElement("img"); - let edit = document.createElement("img"); - let editRoleTemplate = document.getElementById("edit-custom-role-template"); - let editForm = editRoleTemplate.content.cloneNode(true); - - roleName.innerText = card.role; - remove.setAttribute("src", "../assets/images/delete.svg"); - remove.setAttribute("title", "Delete"); - remove.classList.add("custom-role-button"); - remove.addEventListener("click", function() { removeCustomRole(card.role) }); - - edit.setAttribute("src", "../assets/images/pencil_green.svg"); - edit.setAttribute("title", "Edit"); - edit.classList.add("custom-role-button"); - edit.addEventListener("click", function(e) { toggleEditForm(e, editFormDiv, card) }); - roleElement.setAttribute("class", "custom-role-edit"); - - editRemoveContainer.appendChild(remove); - editRemoveContainer.appendChild(edit); - roleLabel.appendChild(roleName); - roleLabel.appendChild(editRemoveContainer); - roleElement.appendChild(roleLabel); - const shadowRoot = editFormDiv.attachShadow({mode: 'open'}); - shadowRoot.appendChild(editForm); - shadowRoot.getElementById("edit-role-form").addEventListener("submit", function(e) { - updateCustomRole(e, editFormDiv, card); - }); - - editFormDiv.style.display = "none"; - roleElement.appendChild(editFormDiv); - - return roleElement; -} - -function toggleEditForm(event, formDiv, card) { - event.preventDefault(); - let displayRule = formDiv.style.display; - formDiv.style.display = displayRule === "none" ? "block" : "none"; - - if (formDiv.style.display === "block") { - populateEditRoleForm(formDiv, card); - } -} - -function toggleViewChanger(isCondensed) { - - if (isCondensed) { - document.getElementById("role-view-changer-gallery").classList.remove("selected"); - document.getElementById("role-view-changer-list").classList.add("selected"); - } else { - document.getElementById("role-view-changer-gallery").classList.add("selected"); - document.getElementById("role-view-changer-list").classList.remove("selected"); - } - renderAvailableCards(isCondensed); -} - -function populateEditRoleForm(formDiv, card) { - formDiv.shadowRoot.querySelector("#edit-role-desc").value = card.description; - formDiv.shadowRoot.querySelector("#edit-role-team").value = card.team; - formDiv.shadowRoot.querySelector("#edit-role-wolf").checked = card.isTypeOfWerewolf; - formDiv.shadowRoot.querySelector("#edit-role-remember").checked = card.saved; -} - -function removeCustomRole(name) { - if (confirm("Delete this role?")) { - let matchingCards = cards.filter((card) => card.role === name); - matchingCards.forEach((card) => { - cards.splice(cards.indexOf(card), 1); - }); - let expectedKeys = ["role", "description", "team", "isTypeOfWerewolf", "custom", "saved"]; - let userCustomRoles = utility.validateCustomRolesJsonObject("play-werewolf-custom-roles", expectedKeys); - if (userCustomRoles) { - userCustomRoles = userCustomRoles.filter((card) => card.role !== name); - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(userCustomRoles)); - } - updateCustomRoleModal(); - renderAvailableCards(document.getElementById("role-view-changer-list").classList.contains("selected")); - } -} - -function updateCustomRole(event, formDiv, cardToUpdate) { - event.preventDefault(); - cardToUpdate.team = formDiv.shadowRoot.querySelector("#edit-role-team").value; - cardToUpdate.description = formDiv.shadowRoot.querySelector("#edit-role-desc").value; - cardToUpdate.isTypeOfWerewolf = formDiv.shadowRoot.querySelector("#edit-role-wolf").checked; - cardToUpdate.saved = formDiv.shadowRoot.querySelector("#edit-role-remember").checked; - - removeOrAddSavedRoleIfNeeded(cardToUpdate); - toggleEditForm(event, formDiv, cardToUpdate); - renderAvailableCards(document.getElementById("role-view-changer-list").classList.contains("selected")); -} - -function removeOrAddSavedRoleIfNeeded(card) { - let expectedKeys = ["role", "description", "team", "isTypeOfWerewolf", "custom", "saved"]; - let userCustomRoles = utility.validateCustomRolesJsonObject("play-werewolf-custom-roles", expectedKeys); - if (userCustomRoles) { - if (card.saved) { - let roleToUpdate = userCustomRoles.find((savedCard) => savedCard.role === card.role); - if (roleToUpdate) { - userCustomRoles[userCustomRoles.indexOf(roleToUpdate)] = card; - } else { - userCustomRoles.push(card); - } - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(userCustomRoles)); - } else { - let roleToRemove = userCustomRoles.find((savedCard) => savedCard.role === card.role); - if (roleToRemove) { - userCustomRoles.splice(userCustomRoles.indexOf(roleToRemove), 1); - localStorage.setItem("play-werewolf-custom-roles", JSON.stringify(userCustomRoles)); - } - } - } -} - - -function incrementCardQuantity(e) { - if(e.card.quantity < 25) { - e.card.quantity += 1; - cards.find((card) => card.role === e.card.role).quantity += 1; - } - e.quantityEl.innerHTML = e.card.quantity; - updateGameSize(); -} - -function decrementCardQuantity(e) { - if(e.card.quantity > 0) { - e.card.quantity -= 1; - cards.find((card) => card.role === e.card.role).quantity -= 1; - } - e.quantityEl.innerHTML = e.card.quantity; - updateGameSize(); -} - -function updateGameSize() { - gameSize = 0; - for (let card of cards) { - gameSize += card.quantity; - } - document.getElementById("game-size").innerText = gameSize + " Players"; - atLeastOnePlayer = gameSize > 0; - return gameSize; -} - -function resetCardQuantities() { - for (let card of cards) { - card.quantity = 0; - } - updateGameSize(); - Array.prototype.filter.call(document.getElementsByClassName("card-quantity"), function(quantities){ - return quantities.innerHTML = 0; - }); -} - -function displayModal(modalId, teamForCustomRole) { - if (teamForCustomRole === "Good") { - document.getElementById("option-evil").removeAttribute("selected"); - document.getElementById("option-good").setAttribute("selected", "selected"); - } - if (teamForCustomRole === "Evil") { - document.getElementById("option-good").removeAttribute("selected"); - document.getElementById("option-evil").setAttribute("selected", "selected"); - } - document.getElementById(modalId).classList.remove("hidden"); - document.getElementById("app-content").classList.add("hidden"); -} - -function closeModal() { - document.getElementById("role-modal").classList.add("hidden"); - document.getElementById("custom-card-modal").classList.add("hidden"); - document.getElementById("edit-custom-roles-modal").classList.add("hidden"); - document.getElementById("import-custom-roles-result-modal").classList.add("hidden"); - document.getElementById("app-content").classList.remove("hidden"); -} - -function buildDeckFromQuantities() { - let playerDeck = []; - for (const card of cards) { - for (let i = 0; i < card.quantity; i++) { - card.id = utility.generateID(); - playerDeck.push(card); - } - } - return playerDeck; -} - -function createGame() { - if (document.getElementById("name").value.length > 0 && atLeastOnePlayer) { - const urlParams = new URLSearchParams(window.location.search); - const revealParam = urlParams.get('reveals'); - - // generate 6 digit access code - let code = ""; - let charPool = "abcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 6; i++) { - code += charPool[utility.getRandomInt(36)] - } - - // generate unique player Id for session - let id = utility.generateID(); - sessionStorage.setItem("id", id); - - // player who creates the game is the host - sessionStorage.setItem("host", true); - - // send a new game to the server, and then join it - const playerInfo = {name: document.getElementById("name").value, code: code, id: id}; - let gameDeck = buildDeckFromQuantities(); - const game = new Game( - code, - revealParam === "true", - gameSize, - gameDeck, - Math.ceil(document.getElementById("time").value), - gameDeck.find((card) => card.role === "Dream Wolf") !== undefined - ); - socket.emit('newGame', game, function() { - socket.emit('joinGame', playerInfo); - sessionStorage.setItem('code', code); - window.location.replace('/' + code); - }); - } else { - document.getElementById("some-error").innerText = "There are problems with your above setup."; - if (!atLeastOnePlayer) { - document.getElementById("game-size").classList.add("error"); - } else { - document.getElementById("game-size").classList.remove("error"); - } - document.getElementById("name").classList.add("error"); - document.getElementById("name-error").innerText = "Name is required."; - } -} -function selectRoleImportFile(e) { - var files = e.target.files; - if (files.length < 1) { return; } - var file = files[0]; - var reader = new FileReader(); - reader.onload = addImportFileToRoles; - reader.readAsDataURL(file); -} diff --git a/javascript/util.js b/javascript/util.js deleted file mode 100644 index 90fddb5..0000000 --- a/javascript/util.js +++ /dev/null @@ -1,50 +0,0 @@ -export const utility = -{ - generateID() { - let code = ""; - let charPool = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - for (let i = 0; i < 10; i++) { - code += charPool[this.getRandomInt(61)] - } - return code; - }, - - getRandomInt(max) { - return Math.floor(Math.random() * Math.floor(max)); - }, - - shuffle(array) { - for (let i = array.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [array[i], array[j]] = [array[j], array[i]]; - } - return array; - }, - - validateCustomRolesJsonObject(name, expectedKeys) { - let value = localStorage.getItem(name); - if (value !== null) { - let valueJson; - try { - valueJson = JSON.parse(value); - } catch(e) { - console.error(e.message); - localStorage.removeItem(name); - return false; - } - if (valueJson && Array.isArray(valueJson)) { // some defensive programming - check if it's an array, and that the object has the expected structure - for (let i = 0; i < valueJson.length; i++){ - if (expectedKeys.some((key) => !Object.keys(valueJson[i]).includes(key))) { - console.error("tried to read invalid object: " + valueJson[i] + " with expected keys: " + expectedKeys); - valueJson.splice(i, 1); - localStorage.setItem(name, JSON.stringify(valueJson)); - } - } - return valueJson; - } else { // object has been messed with. remove it. - localStorage.removeItem(name); - return false; - } - } - } -}; diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..83664f9 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "baseUrl": "." + } +} diff --git a/lib/jasmine-3.5.0/boot.js b/lib/jasmine-3.5.0/boot.js deleted file mode 100644 index 2d68462..0000000 --- a/lib/jasmine-3.5.0/boot.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project. - - If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms. - - The location of `boot.js` can be specified and/or overridden in `jasmine.yml`. - - [jasmine-gem]: http://github.com/pivotal/jasmine-gem - */ - -(function() { - - /** - * ## Require & Instantiate - * - * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. - */ - window.jasmine = jasmineRequire.core(jasmineRequire); - - /** - * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. - */ - jasmineRequire.html(jasmine); - - /** - * Create the Jasmine environment. This is used to run all specs in a project. - */ - var env = jasmine.getEnv(); - - /** - * ## The Global Interface - * - * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged. - */ - var jasmineInterface = jasmineRequire.interface(jasmine, env); - - /** - * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`. - */ - extend(window, jasmineInterface); - - /** - * ## Runner Parameters - * - * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface. - */ - - var queryString = new jasmine.QueryString({ - getWindowLocation: function() { return window.location; } - }); - - var filterSpecs = !!queryString.getParam("spec"); - - var config = { - failFast: queryString.getParam("failFast"), - oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"), - hideDisabled: queryString.getParam("hideDisabled") - }; - - var random = queryString.getParam("random"); - - if (random !== undefined && random !== "") { - config.random = random; - } - - var seed = queryString.getParam("seed"); - if (seed) { - config.seed = seed; - } - - /** - * ## Reporters - * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any). - */ - var htmlReporter = new jasmine.HtmlReporter({ - env: env, - navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); }, - addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); }, - getContainer: function() { return document.body; }, - createElement: function() { return document.createElement.apply(document, arguments); }, - createTextNode: function() { return document.createTextNode.apply(document, arguments); }, - timer: new jasmine.Timer(), - filterSpecs: filterSpecs - }); - - /** - * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. - */ - env.addReporter(jasmineInterface.jsApiReporter); - env.addReporter(htmlReporter); - - /** - * Filter which specs will be run by matching the start of the full name against the `spec` query param. - */ - var specFilter = new jasmine.HtmlSpecFilter({ - filterString: function() { return queryString.getParam("spec"); } - }); - - config.specFilter = function(spec) { - return specFilter.matches(spec.getFullName()); - }; - - env.configure(config); - - /** - * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack. - */ - window.setTimeout = window.setTimeout; - window.setInterval = window.setInterval; - window.clearTimeout = window.clearTimeout; - window.clearInterval = window.clearInterval; - - /** - * ## Execution - * - * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded. - */ - var currentWindowOnload = window.onload; - - window.onload = function() { - if (currentWindowOnload) { - currentWindowOnload(); - } - htmlReporter.initialize(); - env.execute(); - }; - - /** - * Helper function for readability above. - */ - function extend(destination, source) { - for (var property in source) destination[property] = source[property]; - return destination; - } - -}()); diff --git a/lib/jasmine-3.5.0/jasmine-html.js b/lib/jasmine-3.5.0/jasmine-html.js deleted file mode 100644 index aecf2f1..0000000 --- a/lib/jasmine-3.5.0/jasmine-html.js +++ /dev/null @@ -1,817 +0,0 @@ -/* -Copyright (c) 2008-2019 Pivotal Labs - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -jasmineRequire.html = function(j$) { - j$.ResultsNode = jasmineRequire.ResultsNode(); - j$.HtmlReporter = jasmineRequire.HtmlReporter(j$); - j$.QueryString = jasmineRequire.QueryString(); - j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter(); -}; - -jasmineRequire.HtmlReporter = function(j$) { - function ResultsStateBuilder() { - this.topResults = new j$.ResultsNode({}, '', null); - this.currentParent = this.topResults; - this.specsExecuted = 0; - this.failureCount = 0; - this.pendingSpecCount = 0; - } - - ResultsStateBuilder.prototype.suiteStarted = function(result) { - this.currentParent.addChild(result, 'suite'); - this.currentParent = this.currentParent.last(); - }; - - ResultsStateBuilder.prototype.suiteDone = function(result) { - this.currentParent.updateResult(result); - if (this.currentParent !== this.topResults) { - this.currentParent = this.currentParent.parent; - } - - if (result.status === 'failed') { - this.failureCount++; - } - }; - - ResultsStateBuilder.prototype.specStarted = function(result) {}; - - ResultsStateBuilder.prototype.specDone = function(result) { - this.currentParent.addChild(result, 'spec'); - - if (result.status !== 'excluded') { - this.specsExecuted++; - } - - if (result.status === 'failed') { - this.failureCount++; - } - - if (result.status == 'pending') { - this.pendingSpecCount++; - } - }; - - function HtmlReporter(options) { - var config = function() { - return (options.env && options.env.configuration()) || {}; - }, - getContainer = options.getContainer, - createElement = options.createElement, - createTextNode = options.createTextNode, - navigateWithNewParam = options.navigateWithNewParam || function() {}, - addToExistingQueryString = - options.addToExistingQueryString || defaultQueryString, - filterSpecs = options.filterSpecs, - htmlReporterMain, - symbols, - deprecationWarnings = []; - - this.initialize = function() { - clearPrior(); - htmlReporterMain = createDom( - 'div', - { className: 'jasmine_html-reporter' }, - createDom( - 'div', - { className: 'jasmine-banner' }, - createDom('a', { - className: 'jasmine-title', - href: 'http://jasmine.github.io/', - target: '_blank' - }), - createDom('span', { className: 'jasmine-version' }, j$.version) - ), - createDom('ul', { className: 'jasmine-symbol-summary' }), - createDom('div', { className: 'jasmine-alert' }), - createDom( - 'div', - { className: 'jasmine-results' }, - createDom('div', { className: 'jasmine-failures' }) - ) - ); - getContainer().appendChild(htmlReporterMain); - }; - - var totalSpecsDefined; - this.jasmineStarted = function(options) { - totalSpecsDefined = options.totalSpecsDefined || 0; - }; - - var summary = createDom('div', { className: 'jasmine-summary' }); - - var stateBuilder = new ResultsStateBuilder(); - - this.suiteStarted = function(result) { - stateBuilder.suiteStarted(result); - }; - - this.suiteDone = function(result) { - stateBuilder.suiteDone(result); - - if (result.status === 'failed') { - failures.push(failureDom(result)); - } - addDeprecationWarnings(result); - }; - - this.specStarted = function(result) { - stateBuilder.specStarted(result); - }; - - var failures = []; - this.specDone = function(result) { - stateBuilder.specDone(result); - - if (noExpectations(result)) { - var noSpecMsg = "Spec '" + result.fullName + "' has no expectations."; - if (result.status === 'failed') { - console.error(noSpecMsg); - } else { - console.warn(noSpecMsg); - } - } - - if (!symbols) { - symbols = find('.jasmine-symbol-summary'); - } - - symbols.appendChild( - createDom('li', { - className: this.displaySpecInCorrectFormat(result), - id: 'spec_' + result.id, - title: result.fullName - }) - ); - - if (result.status === 'failed') { - failures.push(failureDom(result)); - } - - addDeprecationWarnings(result); - }; - - this.displaySpecInCorrectFormat = function(result) { - return noExpectations(result) && result.status === 'passed' - ? 'jasmine-empty' - : this.resultStatus(result.status); - }; - - this.resultStatus = function(status) { - if (status === 'excluded') { - return config().hideDisabled - ? 'jasmine-excluded-no-display' - : 'jasmine-excluded'; - } - return 'jasmine-' + status; - }; - - this.jasmineDone = function(doneResult) { - var banner = find('.jasmine-banner'); - var alert = find('.jasmine-alert'); - var order = doneResult && doneResult.order; - var i; - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-duration' }, - 'finished in ' + doneResult.totalTime / 1000 + 's' - ) - ); - - banner.appendChild(optionsMenu(config())); - - if (stateBuilder.specsExecuted < totalSpecsDefined) { - var skippedMessage = - 'Ran ' + - stateBuilder.specsExecuted + - ' of ' + - totalSpecsDefined + - ' specs - run all'; - var skippedLink = addToExistingQueryString('spec', ''); - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-bar jasmine-skipped' }, - createDom( - 'a', - { href: skippedLink, title: 'Run all specs' }, - skippedMessage - ) - ) - ); - } - var statusBarMessage = ''; - var statusBarClassName = 'jasmine-overall-result jasmine-bar '; - var globalFailures = (doneResult && doneResult.failedExpectations) || []; - var failed = stateBuilder.failureCount + globalFailures.length > 0; - - if (totalSpecsDefined > 0 || failed) { - statusBarMessage += - pluralize('spec', stateBuilder.specsExecuted) + - ', ' + - pluralize('failure', stateBuilder.failureCount); - if (stateBuilder.pendingSpecCount) { - statusBarMessage += - ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); - } - } - - if (doneResult.overallStatus === 'passed') { - statusBarClassName += ' jasmine-passed '; - } else if (doneResult.overallStatus === 'incomplete') { - statusBarClassName += ' jasmine-incomplete '; - statusBarMessage = - 'Incomplete: ' + - doneResult.incompleteReason + - ', ' + - statusBarMessage; - } else { - statusBarClassName += ' jasmine-failed '; - } - - var seedBar; - if (order && order.random) { - seedBar = createDom( - 'span', - { className: 'jasmine-seed-bar' }, - ', randomized with seed ', - createDom( - 'a', - { - title: 'randomized with seed ' + order.seed, - href: seedHref(order.seed) - }, - order.seed - ) - ); - } - - alert.appendChild( - createDom( - 'span', - { className: statusBarClassName }, - statusBarMessage, - seedBar - ) - ); - - var errorBarClassName = 'jasmine-bar jasmine-errored'; - var afterAllMessagePrefix = 'AfterAll '; - - for (i = 0; i < globalFailures.length; i++) { - alert.appendChild( - createDom( - 'span', - { className: errorBarClassName }, - globalFailureMessage(globalFailures[i]) - ) - ); - } - - function globalFailureMessage(failure) { - if (failure.globalErrorType === 'load') { - var prefix = 'Error during loading: ' + failure.message; - - if (failure.filename) { - return ( - prefix + ' in ' + failure.filename + ' line ' + failure.lineno - ); - } else { - return prefix; - } - } else { - return afterAllMessagePrefix + failure.message; - } - } - - addDeprecationWarnings(doneResult); - - var warningBarClassName = 'jasmine-bar jasmine-warning'; - for (i = 0; i < deprecationWarnings.length; i++) { - var warning = deprecationWarnings[i]; - alert.appendChild( - createDom( - 'span', - { className: warningBarClassName }, - 'DEPRECATION: ' + warning - ) - ); - } - - var results = find('.jasmine-results'); - results.appendChild(summary); - - summaryList(stateBuilder.topResults, summary); - - if (failures.length) { - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-menu jasmine-bar jasmine-spec-list' }, - createDom('span', {}, 'Spec List | '), - createDom( - 'a', - { className: 'jasmine-failures-menu', href: '#' }, - 'Failures' - ) - ) - ); - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-menu jasmine-bar jasmine-failure-list' }, - createDom( - 'a', - { className: 'jasmine-spec-list-menu', href: '#' }, - 'Spec List' - ), - createDom('span', {}, ' | Failures ') - ) - ); - - find('.jasmine-failures-menu').onclick = function() { - setMenuModeTo('jasmine-failure-list'); - }; - find('.jasmine-spec-list-menu').onclick = function() { - setMenuModeTo('jasmine-spec-list'); - }; - - setMenuModeTo('jasmine-failure-list'); - - var failureNode = find('.jasmine-failures'); - for (i = 0; i < failures.length; i++) { - failureNode.appendChild(failures[i]); - } - } - }; - - return this; - - function failureDom(result) { - var failure = createDom( - 'div', - { className: 'jasmine-spec-detail jasmine-failed' }, - failureDescription(result, stateBuilder.currentParent), - createDom('div', { className: 'jasmine-messages' }) - ); - var messages = failure.childNodes[1]; - - for (var i = 0; i < result.failedExpectations.length; i++) { - var expectation = result.failedExpectations[i]; - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-result-message' }, - expectation.message - ) - ); - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-stack-trace' }, - expectation.stack - ) - ); - } - - if (result.failedExpectations.length === 0) { - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-result-message' }, - 'Spec has no expectations' - ) - ); - } - - return failure; - } - - function summaryList(resultsTree, domParent) { - var specListNode; - for (var i = 0; i < resultsTree.children.length; i++) { - var resultNode = resultsTree.children[i]; - if (filterSpecs && !hasActiveSpec(resultNode)) { - continue; - } - if (resultNode.type === 'suite') { - var suiteListNode = createDom( - 'ul', - { className: 'jasmine-suite', id: 'suite-' + resultNode.result.id }, - createDom( - 'li', - { - className: - 'jasmine-suite-detail jasmine-' + resultNode.result.status - }, - createDom( - 'a', - { href: specHref(resultNode.result) }, - resultNode.result.description - ) - ) - ); - - summaryList(resultNode, suiteListNode); - domParent.appendChild(suiteListNode); - } - if (resultNode.type === 'spec') { - if (domParent.getAttribute('class') !== 'jasmine-specs') { - specListNode = createDom('ul', { className: 'jasmine-specs' }); - domParent.appendChild(specListNode); - } - var specDescription = resultNode.result.description; - if (noExpectations(resultNode.result)) { - specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription; - } - if ( - resultNode.result.status === 'pending' && - resultNode.result.pendingReason !== '' - ) { - specDescription = - specDescription + - ' PENDING WITH MESSAGE: ' + - resultNode.result.pendingReason; - } - specListNode.appendChild( - createDom( - 'li', - { - className: 'jasmine-' + resultNode.result.status, - id: 'spec-' + resultNode.result.id - }, - createDom( - 'a', - { href: specHref(resultNode.result) }, - specDescription - ) - ) - ); - } - } - } - - function optionsMenu(config) { - var optionsMenuDom = createDom( - 'div', - { className: 'jasmine-run-options' }, - createDom('span', { className: 'jasmine-trigger' }, 'Options'), - createDom( - 'div', - { className: 'jasmine-payload' }, - createDom( - 'div', - { className: 'jasmine-stop-on-failure' }, - createDom('input', { - className: 'jasmine-fail-fast', - id: 'jasmine-fail-fast', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-fail-fast' }, - 'stop execution on spec failure' - ) - ), - createDom( - 'div', - { className: 'jasmine-throw-failures' }, - createDom('input', { - className: 'jasmine-throw', - id: 'jasmine-throw-failures', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-throw-failures' }, - 'stop spec on expectation failure' - ) - ), - createDom( - 'div', - { className: 'jasmine-random-order' }, - createDom('input', { - className: 'jasmine-random', - id: 'jasmine-random-order', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-random-order' }, - 'run tests in random order' - ) - ), - createDom( - 'div', - { className: 'jasmine-hide-disabled' }, - createDom('input', { - className: 'jasmine-disabled', - id: 'jasmine-hide-disabled', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-hide-disabled' }, - 'hide disabled tests' - ) - ) - ) - ); - - var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast'); - failFastCheckbox.checked = config.failFast; - failFastCheckbox.onclick = function() { - navigateWithNewParam('failFast', !config.failFast); - }; - - var throwCheckbox = optionsMenuDom.querySelector( - '#jasmine-throw-failures' - ); - throwCheckbox.checked = config.oneFailurePerSpec; - throwCheckbox.onclick = function() { - navigateWithNewParam('throwFailures', !config.oneFailurePerSpec); - }; - - var randomCheckbox = optionsMenuDom.querySelector( - '#jasmine-random-order' - ); - randomCheckbox.checked = config.random; - randomCheckbox.onclick = function() { - navigateWithNewParam('random', !config.random); - }; - - var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled'); - hideDisabled.checked = config.hideDisabled; - hideDisabled.onclick = function() { - navigateWithNewParam('hideDisabled', !config.hideDisabled); - }; - - var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'), - optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'), - isOpen = /\bjasmine-open\b/; - - optionsTrigger.onclick = function() { - if (isOpen.test(optionsPayload.className)) { - optionsPayload.className = optionsPayload.className.replace( - isOpen, - '' - ); - } else { - optionsPayload.className += ' jasmine-open'; - } - }; - - return optionsMenuDom; - } - - function failureDescription(result, suite) { - var wrapper = createDom( - 'div', - { className: 'jasmine-description' }, - createDom( - 'a', - { title: result.description, href: specHref(result) }, - result.description - ) - ); - var suiteLink; - - while (suite && suite.parent) { - wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild); - suiteLink = createDom( - 'a', - { href: suiteHref(suite) }, - suite.result.description - ); - wrapper.insertBefore(suiteLink, wrapper.firstChild); - - suite = suite.parent; - } - - return wrapper; - } - - function suiteHref(suite) { - var els = []; - - while (suite && suite.parent) { - els.unshift(suite.result.description); - suite = suite.parent; - } - - return addToExistingQueryString('spec', els.join(' ')); - } - - function addDeprecationWarnings(result) { - if (result && result.deprecationWarnings) { - for (var i = 0; i < result.deprecationWarnings.length; i++) { - var warning = result.deprecationWarnings[i].message; - if (!j$.util.arrayContains(warning)) { - deprecationWarnings.push(warning); - } - } - } - } - - function find(selector) { - return getContainer().querySelector('.jasmine_html-reporter ' + selector); - } - - function clearPrior() { - // return the reporter - var oldReporter = find(''); - - if (oldReporter) { - getContainer().removeChild(oldReporter); - } - } - - function createDom(type, attrs, childrenVarArgs) { - var el = createElement(type); - - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; - - if (typeof child === 'string') { - el.appendChild(createTextNode(child)); - } else { - if (child) { - el.appendChild(child); - } - } - } - - for (var attr in attrs) { - if (attr == 'className') { - el[attr] = attrs[attr]; - } else { - el.setAttribute(attr, attrs[attr]); - } - } - - return el; - } - - function pluralize(singular, count) { - var word = count == 1 ? singular : singular + 's'; - - return '' + count + ' ' + word; - } - - function specHref(result) { - return addToExistingQueryString('spec', result.fullName); - } - - function seedHref(seed) { - return addToExistingQueryString('seed', seed); - } - - function defaultQueryString(key, value) { - return '?' + key + '=' + value; - } - - function setMenuModeTo(mode) { - htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode); - } - - function noExpectations(result) { - var allExpectations = - result.failedExpectations.length + result.passedExpectations.length; - - return ( - allExpectations === 0 && - (result.status === 'passed' || result.status === 'failed') - ); - } - - function hasActiveSpec(resultNode) { - if (resultNode.type == 'spec' && resultNode.result.status != 'excluded') { - return true; - } - - if (resultNode.type == 'suite') { - for (var i = 0, j = resultNode.children.length; i < j; i++) { - if (hasActiveSpec(resultNode.children[i])) { - return true; - } - } - } - } - } - - return HtmlReporter; -}; - -jasmineRequire.HtmlSpecFilter = function() { - function HtmlSpecFilter(options) { - var filterString = - options && - options.filterString() && - options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); - var filterPattern = new RegExp(filterString); - - this.matches = function(specName) { - return filterPattern.test(specName); - }; - } - - return HtmlSpecFilter; -}; - -jasmineRequire.ResultsNode = function() { - function ResultsNode(result, type, parent) { - this.result = result; - this.type = type; - this.parent = parent; - - this.children = []; - - this.addChild = function(result, type) { - this.children.push(new ResultsNode(result, type, this)); - }; - - this.last = function() { - return this.children[this.children.length - 1]; - }; - - this.updateResult = function(result) { - this.result = result; - }; - } - - return ResultsNode; -}; - -jasmineRequire.QueryString = function() { - function QueryString(options) { - this.navigateWithNewParam = function(key, value) { - options.getWindowLocation().search = this.fullStringWithNewParam( - key, - value - ); - }; - - this.fullStringWithNewParam = function(key, value) { - var paramMap = queryStringToParamMap(); - paramMap[key] = value; - return toQueryString(paramMap); - }; - - this.getParam = function(key) { - return queryStringToParamMap()[key]; - }; - - return this; - - function toQueryString(paramMap) { - var qStrPairs = []; - for (var prop in paramMap) { - qStrPairs.push( - encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]) - ); - } - return '?' + qStrPairs.join('&'); - } - - function queryStringToParamMap() { - var paramStr = options.getWindowLocation().search.substring(1), - params = [], - paramMap = {}; - - if (paramStr.length > 0) { - params = paramStr.split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - var value = decodeURIComponent(p[1]); - if (value === 'true' || value === 'false') { - value = JSON.parse(value); - } - paramMap[decodeURIComponent(p[0])] = value; - } - } - - return paramMap; - } - } - - return QueryString; -}; diff --git a/lib/jasmine-3.5.0/jasmine.css b/lib/jasmine-3.5.0/jasmine.css deleted file mode 100644 index 81dd5b3..0000000 --- a/lib/jasmine-3.5.0/jasmine.css +++ /dev/null @@ -1,128 +0,0 @@ -@charset "UTF-8"; -body { overflow-y: scroll; } - -.jasmine_html-reporter { width: 100%; background-color: #eee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333; } - -.jasmine_html-reporter a { text-decoration: none; } - -.jasmine_html-reporter a:hover { text-decoration: underline; } - -.jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; } - -.jasmine_html-reporter .jasmine-banner, .jasmine_html-reporter .jasmine-symbol-summary, .jasmine_html-reporter .jasmine-summary, .jasmine_html-reporter .jasmine-result-message, .jasmine_html-reporter .jasmine-spec .jasmine-description, .jasmine_html-reporter .jasmine-spec-detail .jasmine-description, .jasmine_html-reporter .jasmine-alert .jasmine-bar, .jasmine_html-reporter .jasmine-stack-trace { padding-left: 9px; padding-right: 9px; } - -.jasmine_html-reporter .jasmine-banner { position: relative; } - -.jasmine_html-reporter .jasmine-banner .jasmine-title { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAZCAMAAACGusnyAAACdlBMVEX/////AP+AgICqVaqAQICZM5mAVYCSSZKAQICOOY6ATYCLRouAQICJO4mSSYCIRIiPQICHPIeOR4CGQ4aMQICGPYaLRoCFQ4WKQICPPYWJRYCOQoSJQICNPoSIRICMQoSHQICHRICKQoOHQICKPoOJO4OJQYOMQICMQ4CIQYKLQICIPoKLQ4CKQICNPoKJQISMQ4KJQoSLQYKJQISLQ4KIQoSKQYKIQICIQISMQoSKQYKLQIOLQoOJQYGLQIOKQIOMQoGKQYOLQYGKQIOLQoGJQYOJQIOKQYGJQIOKQoGKQIGLQIKLQ4KKQoGLQYKJQIGKQYKJQIGKQIKJQoGKQYKLQIGKQYKLQIOJQoKKQoOJQYKKQIOJQoKKQoOKQIOLQoKKQYOLQYKJQIOKQoKKQYKKQoKJQYOKQYKLQIOKQoKLQYOKQYKLQIOJQoGKQYKJQYGJQoGKQYKLQoGLQYGKQoGJQYKKQYGJQIKKQoGJQYKLQIKKQYGLQYKKQYGKQYGKQYKJQYOKQoKJQYOKQYKLQYOLQYOKQYKLQYOKQoKKQYKKQYOKQYOJQYKKQYKLQYKKQIKKQoKKQYKKQYKKQoKJQIKKQYKLQYKKQYKKQIKKQYKKQYKKQYKKQIKKQYKJQYGLQYGKQYKKQYKKQYGKQIKKQYGKQYOJQoKKQYOLQYKKQYOKQoKKQYKKQoKKQYKKQYKJQYKLQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKJQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKLQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKmIDpEAAAA0XRSTlMAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAiIyQlJycoKissLS4wMTQ1Njc4OTo7PDw+P0BCQ0RISUpLTE1OUFNUVVdYWFlaW15fYGFiY2ZnaGlqa2xtb3BxcnN0dnh5ent8fX5/gIGChIWIioyNjo+QkZOUlZaYmZqbnJ2eoKGio6WmqKmsra6vsLGztre4ubq7vL2+wMHDxMjJysvNzs/Q0dLU1tfY2dvc3t/g4eLj5ebn6Onq6+zt7u/w8vP09fb3+Pn6+/z9/vkVQXAAAAMaSURBVHhe5dXxV1N1GMfxz2ABbDgIAm5VDJOyVDIJLUMaVpBWUZUaGbmqoGpZRSiGiRWp6KoZ5AB0ZY50RImZQIlahKkMYXv/R90dBvET/rJfOr3Ouc8v99zPec59zvf56j+vYKlViSf7250X4Mr3O29Tgq08BdGB4DhcekEJ5YkQKFsgWZdtj9JpV+I8xPjLFqkrsEIqO8PHSpis36jWazcqjEsfJjkvRssVU37SdIOu4XCf5vEJPsnwJpnRNU9JmxhMk8l1gehIrq7hTFjzOD+Vf88629qKMJVNltInFeRexRQyJlNeqd1iGDlSzrIUIyXbyFfm3RYprcQRe7lqtWyGYbfc6dT0R2vmdOOkX3u55C1rP37ftiH+tDby4r/RBT0w8TyEkr+epB9XgPDmSYYWbrhCuFYaIyw3fDQAXTnSkh+ANofiHmWf9l+FY1I90FdQTetstO00o23novzVsJ7uB3/C5TkbjRwZ5JerwV4iRWq9HFbFMaK/d0TYqayRiQPuIxxS3Bu8JWU90/60tKi7vkhaznez0a/TbVOKj5CaOZh6fWG6/Lyv9B/ZLR1gw/S/fpbeVD3MCW1li6SvWDOn65tr99/uvWtBS0XDm4s1t+sOHpG0kpBKx/l77wOSnxLpcx6TXmXLTPQOKYOf9Q1dfr8/SJ2mFdCvl1Yl93DiHUZvXeLJbGSzYu5gVJ2slbSakOR8dxCq5adQ2oFLqsE9Ex3L4qQO0eOPeU5x56bypXp4onSEb5OkICX6lDat55TeoztNKQcJaakrz9KCb95oD69IKq+yKW4XPjknaS52V0TZqE2cTtXjcHSCRmUO88e+85hj3EP74i9p8pylw7lxgMDyyl6OV7ZejnjNMfatu87LxRbH0IS35gt2a4ZjmGpVBdKK3Wr6INk8jWWSGqbA55CKgjBRC6E9w78ydTg3ABS3AFV1QN0Y4Aa2pgEjWnQURj9L0ayK6R2ysEqxHUKzYnLvvyU+i9KM2JHJzE4vyZOyDcOwOsySajeLPc8sNvPJkFlyJd20wpqAzZeAfZ3oWybxd+P/3j+SG3uSBdf2VQAAAABJRU5ErkJggg==") no-repeat; background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICB3aWR0aD0iNjgxLjk2MjUyIgogICBoZWlnaHQ9IjE4Ny41IgogICBpZD0ic3ZnMiIKICAgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhOCI+PHJkZjpSREY+PGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz48L2NjOldvcms+PC9yZGY6UkRGPjwvbWV0YWRhdGE+PGRlZnMKICAgICBpZD0iZGVmczYiPjxjbGlwUGF0aAogICAgICAgaWQ9ImNsaXBQYXRoMTgiPjxwYXRoCiAgICAgICAgIGQ9Ik0gMCwxNTAwIDAsMCBsIDU0NTUuNzQsMCAwLDE1MDAgTCAwLDE1MDAgeiIKICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgaWQ9InBhdGgyMCIgLz48L2NsaXBQYXRoPjwvZGVmcz48ZwogICAgIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUsMCwwLC0xLjI1LDAsMTg3LjUpIgogICAgIGlkPSJnMTAiPjxnCiAgICAgICB0cmFuc2Zvcm09InNjYWxlKDAuMSwwLjEpIgogICAgICAgaWQ9ImcxMiI+PGcKICAgICAgICAgaWQ9ImcxNCI+PGcKICAgICAgICAgICBjbGlwLXBhdGg9InVybCgjY2xpcFBhdGgxOCkiCiAgICAgICAgICAgaWQ9ImcxNiI+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMTU0NCw1OTkuNDM0IGMgMC45MiwtNDAuMzUyIDI1LjY4LC04MS42MDIgNzEuNTMsLTgxLjYwMiAyNy41MSwwIDQ3LjY4LDEyLjgzMiA2MS40NCwzNS43NTQgMTIuODMsMjIuOTMgMTIuODMsNTYuODUyIDEyLjgzLDgyLjUyNyBsIDAsMzI5LjE4NCAtNzEuNTIsMCAwLDEwNC41NDMgMjY2LjgzLDAgMCwtMTA0LjU0MyAtNzAuNiwwIDAsLTM0NC43NyBjIDAsLTU4LjY5MSAtMy42OCwtMTA0LjUzMSAtNDQuOTMsLTE1Mi4yMTggLTM2LjY4LC00Mi4xOCAtOTYuMjgsLTY2LjAyIC0xNTMuMTQsLTY2LjAyIC0xMTcuMzcsMCAtMjA3LjI0LDc3Ljk0MSAtMjAyLjY0LDE5Ny4xNDUgbCAxMzAuMiwwIgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMjIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDIzMDEuNCw2NjIuNjk1IGMgMCw4MC43MDMgLTY2Ljk0LDE0NS44MTMgLTE0Ny42MywxNDUuODEzIC04My40NCwwIC0xNDcuNjMsLTY4Ljc4MSAtMTQ3LjYzLC0xNTEuMzAxIDAsLTc5Ljc4NSA2Ni45NCwtMTQ1LjgwMSAxNDUuOCwtMTQ1LjgwMSA4NC4zNSwwIDE0OS40Niw2Ny44NTIgMTQ5LjQ2LDE1MS4yODkgeiBtIC0xLjgzLC0xODEuNTQ3IGMgLTM1Ljc3LC01NC4wOTcgLTkzLjUzLC03OC44NTkgLTE1Ny43MiwtNzguODU5IC0xNDAuMywwIC0yNTEuMjQsMTE2LjQ0OSAtMjUxLjI0LDI1NC45MTggMCwxNDIuMTI5IDExMy43LDI2MC40MSAyNTYuNzQsMjYwLjQxIDYzLjI3LDAgMTE4LjI5LC0yOS4zMzYgMTUyLjIyLC04Mi41MjMgbCAwLDY5LjY4NyAxNzUuMTQsMCAwLC0xMDQuNTI3IC02MS40NCwwIDAsLTI4MC41OTggNjEuNDQsMCAwLC0xMDQuNTI3IC0xNzUuMTQsMCAwLDY2LjAxOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDI0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSAyNjIyLjMzLDU1Ny4yNTggYyAzLjY3LC00NC4wMTYgMzMuMDEsLTczLjM0OCA3OC44NiwtNzMuMzQ4IDMzLjkzLDAgNjYuOTMsMjMuODI0IDY2LjkzLDYwLjUwNCAwLDQ4LjYwNiAtNDUuODQsNTYuODU2IC04My40NCw2Ni45NDEgLTg1LjI4LDIyLjAwNCAtMTc4LjgxLDQ4LjYwNiAtMTc4LjgxLDE1NS44NzkgMCw5My41MzYgNzguODYsMTQ3LjYzMyAxNjUuOTgsMTQ3LjYzMyA0NCwwIDgzLjQzLC05LjE3NiAxMTAuOTQsLTQ0LjAwOCBsIDAsMzMuOTIyIDgyLjUzLDAgMCwtMTMyLjk2NSAtMTA4LjIxLDAgYyAtMS44MywzNC44NTYgLTI4LjQyLDU3Ljc3NCAtNjMuMjYsNTcuNzc0IC0zMC4yNiwwIC02Mi4zNSwtMTcuNDIyIC02Mi4zNSwtNTEuMzQ4IDAsLTQ1Ljg0NyA0NC45MywtNTUuOTMgODAuNjksLTY0LjE4IDg4LjAyLC0yMC4xNzUgMTgyLjQ3LC00Ny42OTUgMTgyLjQ3LC0xNTcuNzM0IDAsLTk5LjAyNyAtODMuNDQsLTE1NC4wMzkgLTE3NS4xMywtMTU0LjAzOSAtNDkuNTMsMCAtOTQuNDYsMTUuNTgyIC0xMjYuNTUsNTMuMTggbCAwLC00MC4zNCAtODUuMjcsMCAwLDE0Mi4xMjkgMTE0LjYyLDAiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGgyNiIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMjk4OC4xOCw4MDAuMjU0IC02My4yNiwwIDAsMTA0LjUyNyAxNjUuMDUsMCAwLC03My4zNTUgYyAzMS4xOCw1MS4zNDcgNzguODYsODUuMjc3IDE0MS4yMSw4NS4yNzcgNjcuODUsMCAxMjQuNzEsLTQxLjI1OCAxNTIuMjEsLTEwMi42OTkgMjYuNiw2Mi4zNTEgOTIuNjIsMTAyLjY5OSAxNjAuNDcsMTAyLjY5OSA1My4xOSwwIDEwNS40NiwtMjIgMTQxLjIxLC02Mi4zNTEgMzguNTIsLTQ0LjkzOCAzOC41MiwtOTMuNTMyIDM4LjUyLC0xNDkuNDU3IGwgMCwtMTg1LjIzOSA2My4yNywwIDAsLTEwNC41MjcgLTIzOC40MiwwIDAsMTA0LjUyNyA2My4yOCwwIDAsMTU3LjcxNSBjIDAsMzIuMTAyIDAsNjAuNTI3IC0xNC42Nyw4OC45NTcgLTE4LjM0LDI2LjU4MiAtNDguNjEsNDAuMzQ0IC03OS43Nyw0MC4zNDQgLTMwLjI2LDAgLTYzLjI4LC0xMi44NDQgLTgyLjUzLC0zNi42NzIgLTIyLjkzLC0yOS4zNTUgLTIyLjkzLC01Ni44NjMgLTIyLjkzLC05Mi42MjkgbCAwLC0xNTcuNzE1IDYzLjI3LDAgMCwtMTA0LjUyNyAtMjM4LjQxLDAgMCwxMDQuNTI3IDYzLjI4LDAgMCwxNTAuMzgzIGMgMCwyOS4zNDggMCw2Ni4wMjMgLTE0LjY3LDkxLjY5OSAtMTUuNTksMjkuMzM2IC00Ny42OSw0NC45MzQgLTgwLjcsNDQuOTM0IC0zMS4xOCwwIC01Ny43NywtMTEuMDA4IC03Ny45NCwtMzUuNzc0IC0yNC43NywtMzAuMjUzIC0yNi42LC02Mi4zNDMgLTI2LjYsLTk5Ljk0MSBsIDAsLTE1MS4zMDEgNjMuMjcsMCAwLC0xMDQuNTI3IC0yMzguNCwwIDAsMTA0LjUyNyA2My4yNiwwIDAsMjgwLjU5OCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDI4IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSAzOTk4LjY2LDk1MS41NDcgLTExMS44NywwIDAsMTE4LjI5MyAxMTEuODcsMCAwLC0xMTguMjkzIHogbSAwLC00MzEuODkxIDYzLjI3LDAgMCwtMTA0LjUyNyAtMjM5LjMzLDAgMCwxMDQuNTI3IDY0LjE5LDAgMCwyODAuNTk4IC02My4yNywwIDAsMTA0LjUyNyAxNzUuMTQsMCAwLC0zODUuMTI1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzAiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDQxNTkuMTIsODAwLjI1NCAtNjMuMjcsMCAwLDEwNC41MjcgMTc1LjE0LDAgMCwtNjkuNjg3IGMgMjkuMzUsNTQuMTAxIDg0LjM2LDgwLjY5OSAxNDQuODcsODAuNjk5IDUzLjE5LDAgMTA1LjQ1LC0yMi4wMTYgMTQxLjIyLC02MC41MjcgNDAuMzQsLTQ0LjkzNCA0MS4yNiwtODguMDMyIDQxLjI2LC0xNDMuOTU3IGwgMCwtMTkxLjY1MyA2My4yNywwIDAsLTEwNC41MjcgLTIzOC40LDAgMCwxMDQuNTI3IDYzLjI2LDAgMCwxNTguNjM3IGMgMCwzMC4yNjIgMCw2MS40MzQgLTE5LjI2LDg4LjAzNSAtMjAuMTcsMjYuNTgyIC01My4xOCwzOS40MTQgLTg2LjE5LDM5LjQxNCAtMzMuOTMsMCAtNjguNzcsLTEzLjc1IC04OC45NCwtNDEuMjUgLTIxLjA5LC0yNy41IC0yMS4wOSwtNjkuNjg3IC0yMS4wOSwtMTAyLjcwNyBsIDAsLTE0Mi4xMjkgNjMuMjYsMCAwLC0xMDQuNTI3IC0yMzguNCwwIDAsMTA0LjUyNyA2My4yNywwIDAsMjgwLjU5OCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDMyIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA1MDgyLjQ4LDcwMy45NjUgYyAtMTkuMjQsNzAuNjA1IC04MS42LDExNS41NDcgLTE1NC4wNCwxMTUuNTQ3IC02Ni4wNCwwIC0xMjkuMywtNTEuMzQ4IC0xNDMuMDUsLTExNS41NDcgbCAyOTcuMDksMCB6IG0gODUuMjcsLTE0NC44ODMgYyAtMzguNTEsLTkzLjUyMyAtMTI5LjI3LC0xNTYuNzkzIC0yMzEuMDUsLTE1Ni43OTMgLTE0My4wNywwIC0yNTcuNjgsMTExLjg3MSAtMjU3LjY4LDI1NS44MzYgMCwxNDQuODgzIDEwOS4xMiwyNjEuMzI4IDI1NC45MSwyNjEuMzI4IDY3Ljg3LDAgMTM1LjcyLC0zMC4yNTggMTgzLjM5LC03OC44NjMgNDguNjIsLTUxLjM0NCA2OC43OSwtMTEzLjY5NSA2OC43OSwtMTgzLjM4MyBsIC0zLjY3LC0zOS40MzQgLTM5Ni4xMywwIGMgMTQuNjcsLTY3Ljg2MyA3Ny4wMywtMTE3LjM2MyAxNDYuNzIsLTExNy4zNjMgNDguNTksMCA5MC43NiwxOC4zMjggMTE4LjI4LDU4LjY3MiBsIDExNi40NCwwIgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzQiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDY5MC44OTUsODUwLjcwMyA5MC43NSwwIDIyLjU0MywzMS4wMzUgMCwyNDMuMTIyIC0xMzUuODI5LDAgMCwtMjQzLjE0MSAyMi41MzYsLTMxLjAxNiIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDM2IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA2MzIuMzk1LDc0Mi4yNTggMjguMDM5LDg2LjMwNCAtMjIuNTUxLDMxLjA0IC0yMzEuMjIzLDc1LjEyOCAtNDEuOTc2LC0xMjkuMTgzIDIzMS4yNTcsLTc1LjEzNyAzNi40NTQsMTEuODQ4IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzgiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDcxNy40NDksNjUzLjEwNSAtNzMuNDEsNTMuMzYgLTM2LjQ4OCwtMTEuODc1IC0xNDIuOTAzLC0xOTYuNjkyIDEwOS44ODMsLTc5LjgyOCAxNDIuOTE4LDE5Ni43MDMgMCwzOC4zMzIiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGg0MCIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gODI4LjUyLDcwNi40NjUgLTczLjQyNiwtNTMuMzQgMC4wMTEsLTM4LjM1OSBMIDg5OC4wMDQsNDE4LjA3IDEwMDcuOSw0OTcuODk4IDg2NC45NzMsNjk0LjYwOSA4MjguNTIsNzA2LjQ2NSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDQyIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA4MTIuMDg2LDgyOC41ODYgMjguMDU1LC04Ni4zMiAzNi40ODQsLTExLjgzNiAyMzEuMjI1LDc1LjExNyAtNDEuOTcsMTI5LjE4MyAtMjMxLjIzOSwtNzUuMTQgLTIyLjU1NSwtMzEuMDA0IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNDQiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDczNi4zMDEsMTMzNS44OCBjIC0zMjMuMDQ3LDAgLTU4NS44NzUsLTI2Mi43OCAtNTg1Ljg3NSwtNTg1Ljc4MiAwLC0zMjMuMTE4IDI2Mi44MjgsLTU4NS45NzcgNTg1Ljg3NSwtNTg1Ljk3NyAzMjMuMDE5LDAgNTg1LjgwOSwyNjIuODU5IDU4NS44MDksNTg1Ljk3NyAwLDMyMy4wMDIgLTI2Mi43OSw1ODUuNzgyIC01ODUuODA5LDU4NS43ODIgbCAwLDAgeiBtIDAsLTExOC42MSBjIDI1Ny45NzIsMCA0NjcuMTg5LC0yMDkuMTMgNDY3LjE4OSwtNDY3LjE3MiAwLC0yNTguMTI5IC0yMDkuMjE3LC00NjcuMzQ4IC00NjcuMTg5LC00NjcuMzQ4IC0yNTguMDc0LDAgLTQ2Ny4yNTQsMjA5LjIxOSAtNDY3LjI1NCw0NjcuMzQ4IDAsMjU4LjA0MiAyMDkuMTgsNDY3LjE3MiA0NjcuMjU0LDQ2Ny4xNzIiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGg0NiIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMTA5MS4xMyw2MTkuODgzIC0xNzUuNzcxLDU3LjEyMSAxMS42MjksMzUuODA4IDE3NS43NjIsLTU3LjEyMSAtMTEuNjIsLTM1LjgwOCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDQ4IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0iTSA4NjYuOTU3LDkwMi4wNzQgODM2LjUsOTI0LjE5OSA5NDUuMTIxLDEwNzMuNzMgOTc1LjU4NiwxMDUxLjYxIDg2Ni45NTcsOTAyLjA3NCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDUwIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0iTSA2MDcuNDY1LDkwMy40NDUgNDk4Ljg1NSwxMDUyLjk3IDUyOS4zMiwxMDc1LjEgNjM3LjkzLDkyNS41NjYgNjA3LjQ2NSw5MDMuNDQ1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDM4MC42ODgsNjIyLjEyOSAtMTEuNjI2LDM1LjgwMSAxNzUuNzU4LDU3LjA5IDExLjYyMSwtMzUuODAxIC0xNzUuNzUzLC01Ny4wOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDU0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA3MTYuMjg5LDM3Ni41OSAzNy42NDA2LDAgMCwxODQuODE2IC0zNy42NDA2LDAgMCwtMTg0LjgxNiB6IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTYiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=") no-repeat, none; -moz-background-size: 100%; -o-background-size: 100%; -webkit-background-size: 100%; background-size: 100%; display: block; float: left; width: 90px; height: 25px; } - -.jasmine_html-reporter .jasmine-banner .jasmine-version { margin-left: 14px; position: relative; top: 6px; } - -.jasmine_html-reporter #jasmine_content { position: fixed; right: 100%; } - -.jasmine_html-reporter .jasmine-version { color: #aaa; } - -.jasmine_html-reporter .jasmine-banner { margin-top: 14px; } - -.jasmine_html-reporter .jasmine-duration { color: #fff; float: right; line-height: 28px; padding-right: 9px; } - -.jasmine_html-reporter .jasmine-symbol-summary { overflow: hidden; margin: 14px 0; } - -.jasmine_html-reporter .jasmine-symbol-summary li { display: inline-block; height: 10px; width: 14px; font-size: 16px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed { font-size: 14px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-passed:before { color: #007069; content: "•"; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed { line-height: 9px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-failed:before { color: #ca3a11; content: "×"; font-weight: bold; margin-left: -1px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded { font-size: 14px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded:before { color: #bababa; content: "•"; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-excluded-no-display { font-size: 14px; display: none; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending { line-height: 17px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-pending:before { color: #ba9d37; content: "*"; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty { font-size: 14px; } - -.jasmine_html-reporter .jasmine-symbol-summary li.jasmine-empty:before { color: #ba9d37; content: "•"; } - -.jasmine_html-reporter .jasmine-run-options { float: right; margin-right: 5px; border: 1px solid #8a4182; color: #8a4182; position: relative; line-height: 20px; } - -.jasmine_html-reporter .jasmine-run-options .jasmine-trigger { cursor: pointer; padding: 8px 16px; } - -.jasmine_html-reporter .jasmine-run-options .jasmine-payload { position: absolute; display: none; right: -1px; border: 1px solid #8a4182; background-color: #eee; white-space: nowrap; padding: 4px 8px; } - -.jasmine_html-reporter .jasmine-run-options .jasmine-payload.jasmine-open { display: block; } - -.jasmine_html-reporter .jasmine-bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } - -.jasmine_html-reporter .jasmine-bar.jasmine-failed, .jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; border-bottom: 1px solid #eee; } - -.jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; } - -.jasmine_html-reporter .jasmine-bar.jasmine-incomplete { background-color: #bababa; } - -.jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; } - -.jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; color: #333; } - -.jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; } - -.jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; } - -.jasmine_html-reporter .jasmine-bar a { color: white; } - -.jasmine_html-reporter.jasmine-spec-list .jasmine-bar.jasmine-menu.jasmine-failure-list, .jasmine_html-reporter.jasmine-spec-list .jasmine-results .jasmine-failures { display: none; } - -.jasmine_html-reporter.jasmine-failure-list .jasmine-bar.jasmine-menu.jasmine-spec-list, .jasmine_html-reporter.jasmine-failure-list .jasmine-summary { display: none; } - -.jasmine_html-reporter .jasmine-results { margin-top: 14px; } - -.jasmine_html-reporter .jasmine-summary { margin-top: 14px; } - -.jasmine_html-reporter .jasmine-summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } - -.jasmine_html-reporter .jasmine-summary ul.jasmine-suite { margin-top: 7px; margin-bottom: 7px; } - -.jasmine_html-reporter .jasmine-summary li.jasmine-passed a { color: #007069; } - -.jasmine_html-reporter .jasmine-summary li.jasmine-failed a { color: #ca3a11; } - -.jasmine_html-reporter .jasmine-summary li.jasmine-empty a { color: #ba9d37; } - -.jasmine_html-reporter .jasmine-summary li.jasmine-pending a { color: #ba9d37; } - -.jasmine_html-reporter .jasmine-summary li.jasmine-excluded a { color: #bababa; } - -.jasmine_html-reporter .jasmine-specs li.jasmine-passed a:before { content: "• "; } - -.jasmine_html-reporter .jasmine-specs li.jasmine-failed a:before { content: "× "; } - -.jasmine_html-reporter .jasmine-specs li.jasmine-empty a:before { content: "* "; } - -.jasmine_html-reporter .jasmine-specs li.jasmine-pending a:before { content: "• "; } - -.jasmine_html-reporter .jasmine-specs li.jasmine-excluded a:before { content: "• "; } - -.jasmine_html-reporter .jasmine-description + .jasmine-suite { margin-top: 0; } - -.jasmine_html-reporter .jasmine-suite { margin-top: 14px; } - -.jasmine_html-reporter .jasmine-suite a { color: #333; } - -.jasmine_html-reporter .jasmine-failures .jasmine-spec-detail { margin-bottom: 28px; } - -.jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description { background-color: #ca3a11; color: white; } - -.jasmine_html-reporter .jasmine-failures .jasmine-spec-detail .jasmine-description a { color: white; } - -.jasmine_html-reporter .jasmine-result-message { padding-top: 14px; color: #333; white-space: pre-wrap; } - -.jasmine_html-reporter .jasmine-result-message span.jasmine-result { display: block; } - -.jasmine_html-reporter .jasmine-stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666; border: 1px solid #ddd; background: white; white-space: pre; } diff --git a/lib/jasmine-3.5.0/jasmine.js b/lib/jasmine-3.5.0/jasmine.js deleted file mode 100644 index 4875624..0000000 --- a/lib/jasmine-3.5.0/jasmine.js +++ /dev/null @@ -1,8218 +0,0 @@ -/* -Copyright (c) 2008-2019 Pivotal Labs - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -// eslint-disable-next-line no-unused-vars -var getJasmineRequireObj = (function(jasmineGlobal) { - var jasmineRequire; - - if ( - typeof module !== 'undefined' && - module.exports && - typeof exports !== 'undefined' - ) { - if (typeof global !== 'undefined') { - jasmineGlobal = global; - } else { - jasmineGlobal = {}; - } - jasmineRequire = exports; - } else { - if ( - typeof window !== 'undefined' && - typeof window.toString === 'function' && - window.toString() === '[object GjsGlobal]' - ) { - jasmineGlobal = window; - } - jasmineRequire = jasmineGlobal.jasmineRequire = {}; - } - - function getJasmineRequire() { - return jasmineRequire; - } - - getJasmineRequire().core = function(jRequire) { - var j$ = {}; - - jRequire.base(j$, jasmineGlobal); - j$.util = jRequire.util(j$); - j$.errors = jRequire.errors(); - j$.formatErrorMsg = jRequire.formatErrorMsg(); - j$.Any = jRequire.Any(j$); - j$.Anything = jRequire.Anything(j$); - j$.CallTracker = jRequire.CallTracker(j$); - j$.MockDate = jRequire.MockDate(); - j$.getClearStack = jRequire.clearStack(j$); - j$.Clock = jRequire.Clock(); - j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$); - j$.Env = jRequire.Env(j$); - j$.StackTrace = jRequire.StackTrace(j$); - j$.ExceptionFormatter = jRequire.ExceptionFormatter(j$); - j$.ExpectationFilterChain = jRequire.ExpectationFilterChain(); - j$.Expector = jRequire.Expector(j$); - j$.Expectation = jRequire.Expectation(j$); - j$.buildExpectationResult = jRequire.buildExpectationResult(); - j$.noopTimer = jRequire.noopTimer(); - j$.JsApiReporter = jRequire.JsApiReporter(j$); - j$.matchersUtil = jRequire.matchersUtil(j$); - j$.ObjectContaining = jRequire.ObjectContaining(j$); - j$.ArrayContaining = jRequire.ArrayContaining(j$); - j$.ArrayWithExactContents = jRequire.ArrayWithExactContents(j$); - j$.MapContaining = jRequire.MapContaining(j$); - j$.SetContaining = jRequire.SetContaining(j$); - j$.pp = jRequire.pp(j$); - j$.QueueRunner = jRequire.QueueRunner(j$); - j$.ReportDispatcher = jRequire.ReportDispatcher(j$); - j$.Spec = jRequire.Spec(j$); - j$.Spy = jRequire.Spy(j$); - j$.SpyFactory = jRequire.SpyFactory(j$); - j$.SpyRegistry = jRequire.SpyRegistry(j$); - j$.SpyStrategy = jRequire.SpyStrategy(j$); - j$.StringMatching = jRequire.StringMatching(j$); - j$.UserContext = jRequire.UserContext(j$); - j$.Suite = jRequire.Suite(j$); - j$.Timer = jRequire.Timer(); - j$.TreeProcessor = jRequire.TreeProcessor(); - j$.version = jRequire.version(); - j$.Order = jRequire.Order(); - j$.DiffBuilder = jRequire.DiffBuilder(j$); - j$.NullDiffBuilder = jRequire.NullDiffBuilder(j$); - j$.ObjectPath = jRequire.ObjectPath(j$); - j$.GlobalErrors = jRequire.GlobalErrors(j$); - - j$.Truthy = jRequire.Truthy(j$); - j$.Falsy = jRequire.Falsy(j$); - j$.Empty = jRequire.Empty(j$); - j$.NotEmpty = jRequire.NotEmpty(j$); - - j$.matchers = jRequire.requireMatchers(jRequire, j$); - j$.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$); - - return j$; - }; - - return getJasmineRequire; -})(this); - -getJasmineRequireObj().requireMatchers = function(jRequire, j$) { - var availableMatchers = [ - 'nothing', - 'toBe', - 'toBeCloseTo', - 'toBeDefined', - 'toBeInstanceOf', - 'toBeFalse', - 'toBeFalsy', - 'toBeGreaterThan', - 'toBeGreaterThanOrEqual', - 'toBeLessThan', - 'toBeLessThanOrEqual', - 'toBeNaN', - 'toBeNegativeInfinity', - 'toBeNull', - 'toBePositiveInfinity', - 'toBeTrue', - 'toBeTruthy', - 'toBeUndefined', - 'toContain', - 'toEqual', - 'toHaveBeenCalled', - 'toHaveBeenCalledBefore', - 'toHaveBeenCalledTimes', - 'toHaveBeenCalledWith', - 'toHaveClass', - 'toMatch', - 'toThrow', - 'toThrowError', - 'toThrowMatching' - ], - matchers = {}; - - for (var i = 0; i < availableMatchers.length; i++) { - var name = availableMatchers[i]; - matchers[name] = jRequire[name](j$); - } - - return matchers; -}; - -getJasmineRequireObj().base = function(j$, jasmineGlobal) { - j$.unimplementedMethod_ = function() { - throw new Error('unimplemented method'); - }; - - /** - * Maximum object depth the pretty printer will print to. - * Set this to a lower value to speed up pretty printing if you have large objects. - * @name jasmine.MAX_PRETTY_PRINT_DEPTH - * @since 1.3.0 - */ - j$.MAX_PRETTY_PRINT_DEPTH = 8; - /** - * Maximum number of array elements to display when pretty printing objects. - * This will also limit the number of keys and values displayed for an object. - * Elements past this number will be ellipised. - * @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH - * @since 2.7.0 - */ - j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50; - /** - * Maximum number of characters to display when pretty printing objects. - * Characters past this number will be ellipised. - * @name jasmine.MAX_PRETTY_PRINT_CHARS - * @since 2.9.0 - */ - j$.MAX_PRETTY_PRINT_CHARS = 1000; - /** - * Default number of milliseconds Jasmine will wait for an asynchronous spec to complete. - * @name jasmine.DEFAULT_TIMEOUT_INTERVAL - * @since 1.3.0 - */ - j$.DEFAULT_TIMEOUT_INTERVAL = 5000; - - j$.getGlobal = function() { - return jasmineGlobal; - }; - - /** - * Get the currently booted Jasmine Environment. - * - * @name jasmine.getEnv - * @since 1.3.0 - * @function - * @return {Env} - */ - j$.getEnv = function(options) { - var env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options)); - //jasmine. singletons in here (setTimeout blah blah). - return env; - }; - - j$.isArray_ = function(value) { - return j$.isA_('Array', value); - }; - - j$.isObject_ = function(value) { - return ( - !j$.util.isUndefined(value) && value !== null && j$.isA_('Object', value) - ); - }; - - j$.isString_ = function(value) { - return j$.isA_('String', value); - }; - - j$.isNumber_ = function(value) { - return j$.isA_('Number', value); - }; - - j$.isFunction_ = function(value) { - return j$.isA_('Function', value); - }; - - j$.isAsyncFunction_ = function(value) { - return j$.isA_('AsyncFunction', value); - }; - - j$.isTypedArray_ = function(value) { - return ( - j$.isA_('Float32Array', value) || - j$.isA_('Float64Array', value) || - j$.isA_('Int16Array', value) || - j$.isA_('Int32Array', value) || - j$.isA_('Int8Array', value) || - j$.isA_('Uint16Array', value) || - j$.isA_('Uint32Array', value) || - j$.isA_('Uint8Array', value) || - j$.isA_('Uint8ClampedArray', value) - ); - }; - - j$.isA_ = function(typeName, value) { - return j$.getType_(value) === '[object ' + typeName + ']'; - }; - - j$.isError_ = function(value) { - if (value instanceof Error) { - return true; - } - if (value && value.constructor && value.constructor.constructor) { - var valueGlobal = value.constructor.constructor('return this'); - if (j$.isFunction_(valueGlobal)) { - valueGlobal = valueGlobal(); - } - - if (valueGlobal.Error && value instanceof valueGlobal.Error) { - return true; - } - } - return false; - }; - - j$.getType_ = function(value) { - return Object.prototype.toString.apply(value); - }; - - j$.isDomNode = function(obj) { - // Node is a function, because constructors - return typeof jasmineGlobal.Node !== 'undefined' - ? obj instanceof jasmineGlobal.Node - : obj !== null && - typeof obj === 'object' && - typeof obj.nodeType === 'number' && - typeof obj.nodeName === 'string'; - // return obj.nodeType > 0; - }; - - j$.isMap = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.Map !== 'undefined' && - obj.constructor === jasmineGlobal.Map - ); - }; - - j$.isSet = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.Set !== 'undefined' && - obj.constructor === jasmineGlobal.Set - ); - }; - - j$.isPromise = function(obj) { - return ( - typeof jasmineGlobal.Promise !== 'undefined' && - !!obj && - obj.constructor === jasmineGlobal.Promise - ); - }; - - j$.isPromiseLike = function(obj) { - return !!obj && j$.isFunction_(obj.then); - }; - - j$.fnNameFor = function(func) { - if (func.name) { - return func.name; - } - - var matches = - func.toString().match(/^\s*function\s*(\w+)\s*\(/) || - func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/); - - return matches ? matches[1] : ''; - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is an instance of the specified class/constructor. - * @name jasmine.any - * @since 1.3.0 - * @function - * @param {Constructor} clazz - The constructor to check against. - */ - j$.any = function(clazz) { - return new j$.Any(clazz); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is not `null` and not `undefined`. - * @name jasmine.anything - * @since 2.2.0 - * @function - */ - j$.anything = function() { - return new j$.Anything(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is `true` or anything truthy. - * @name jasmine.truthy - * @since 3.1.0 - * @function - */ - j$.truthy = function() { - return new j$.Truthy(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey. - * @name jasmine.falsy - * @since 3.1.0 - * @function - */ - j$.falsy = function() { - return new j$.Falsy(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is empty. - * @name jasmine.empty - * @since 3.1.0 - * @function - */ - j$.empty = function() { - return new j$.Empty(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is not empty. - * @name jasmine.notEmpty - * @since 3.1.0 - * @function - */ - j$.notEmpty = function() { - return new j$.NotEmpty(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared contains at least the keys and values. - * @name jasmine.objectContaining - * @since 1.3.0 - * @function - * @param {Object} sample - The subset of properties that _must_ be in the actual. - */ - j$.objectContaining = function(sample) { - return new j$.ObjectContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is a `String` that matches the `RegExp` or `String`. - * @name jasmine.stringMatching - * @since 2.2.0 - * @function - * @param {RegExp|String} expected - */ - j$.stringMatching = function(expected) { - return new j$.StringMatching(expected); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is an `Array` that contains at least the elements in the sample. - * @name jasmine.arrayContaining - * @since 2.2.0 - * @function - * @param {Array} sample - */ - j$.arrayContaining = function(sample) { - return new j$.ArrayContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order. - * @name jasmine.arrayWithExactContents - * @since 2.8.0 - * @function - * @param {Array} sample - */ - j$.arrayWithExactContents = function(sample) { - return new j$.ArrayWithExactContents(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if every key/value pair in the sample passes the deep equality comparison - * with at least one key/value pair in the actual value being compared - * @name jasmine.mapContaining - * @since 3.5.0 - * @function - * @param {Map} sample - The subset of items that _must_ be in the actual. - */ - j$.mapContaining = function(sample) { - return new j$.MapContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if every item in the sample passes the deep equality comparison - * with at least one item in the actual value being compared - * @name jasmine.setContaining - * @since 3.5.0 - * @function - * @param {Set} sample - The subset of items that _must_ be in the actual. - */ - j$.setContaining = function(sample) { - return new j$.SetContaining(sample); - }; - - j$.isSpy = function(putativeSpy) { - if (!putativeSpy) { - return false; - } - return ( - putativeSpy.and instanceof j$.SpyStrategy && - putativeSpy.calls instanceof j$.CallTracker - ); - }; -}; - -getJasmineRequireObj().util = function(j$) { - var util = {}; - - util.inherit = function(childClass, parentClass) { - var Subclass = function() {}; - Subclass.prototype = parentClass.prototype; - childClass.prototype = new Subclass(); - }; - - util.htmlEscape = function(str) { - if (!str) { - return str; - } - return str - .replace(/&/g, '&') - .replace(//g, '>'); - }; - - util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) { - arrayOfArgs.push(args[i]); - } - return arrayOfArgs; - }; - - util.isUndefined = function(obj) { - return obj === void 0; - }; - - util.arrayContains = function(array, search) { - var i = array.length; - while (i--) { - if (array[i] === search) { - return true; - } - } - return false; - }; - - util.clone = function(obj) { - if (Object.prototype.toString.apply(obj) === '[object Array]') { - return obj.slice(); - } - - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - - return cloned; - }; - - util.cloneArgs = function(args) { - var clonedArgs = []; - var argsAsArray = j$.util.argsToArray(args); - for (var i = 0; i < argsAsArray.length; i++) { - var str = Object.prototype.toString.apply(argsAsArray[i]), - primitives = /^\[object (Boolean|String|RegExp|Number)/; - - // All falsey values are either primitives, `null`, or `undefined. - if (!argsAsArray[i] || str.match(primitives)) { - clonedArgs.push(argsAsArray[i]); - } else { - clonedArgs.push(j$.util.clone(argsAsArray[i])); - } - } - return clonedArgs; - }; - - util.getPropertyDescriptor = function(obj, methodName) { - var descriptor, - proto = obj; - - do { - descriptor = Object.getOwnPropertyDescriptor(proto, methodName); - proto = Object.getPrototypeOf(proto); - } while (!descriptor && proto); - - return descriptor; - }; - - util.objectDifference = function(obj, toRemove) { - var diff = {}; - - for (var key in obj) { - if (util.has(obj, key) && !util.has(toRemove, key)) { - diff[key] = obj[key]; - } - } - - return diff; - }; - - util.has = function(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); - }; - - util.errorWithStack = function errorWithStack() { - // Don't throw and catch if we don't have to, because it makes it harder - // for users to debug their code with exception breakpoints. - var error = new Error(); - - if (error.stack) { - return error; - } - - // But some browsers (e.g. Phantom) only provide a stack trace if we throw. - try { - throw new Error(); - } catch (e) { - return e; - } - }; - - function callerFile() { - var trace = new j$.StackTrace(util.errorWithStack()); - return trace.frames[2].file; - } - - util.jasmineFile = (function() { - var result; - - return function() { - if (!result) { - result = callerFile(); - } - - return result; - }; - })(); - - function StopIteration() {} - StopIteration.prototype = Object.create(Error.prototype); - StopIteration.prototype.constructor = StopIteration; - - // useful for maps and sets since `forEach` is the only IE11-compatible way to iterate them - util.forEachBreakable = function(iterable, iteratee) { - function breakLoop() { - throw new StopIteration(); - } - - try { - iterable.forEach(function(value, key) { - iteratee(breakLoop, value, key, iterable); - }); - } catch (error) { - if (!(error instanceof StopIteration)) throw error; - } - }; - - return util; -}; - -getJasmineRequireObj().Spec = function(j$) { - function Spec(attrs) { - this.expectationFactory = attrs.expectationFactory; - this.asyncExpectationFactory = attrs.asyncExpectationFactory; - this.resultCallback = attrs.resultCallback || function() {}; - this.id = attrs.id; - this.description = attrs.description || ''; - this.queueableFn = attrs.queueableFn; - this.beforeAndAfterFns = - attrs.beforeAndAfterFns || - function() { - return { befores: [], afters: [] }; - }; - this.userContext = - attrs.userContext || - function() { - return {}; - }; - this.onStart = attrs.onStart || function() {}; - this.getSpecName = - attrs.getSpecName || - function() { - return ''; - }; - this.expectationResultFactory = - attrs.expectationResultFactory || function() {}; - this.queueRunnerFactory = attrs.queueRunnerFactory || function() {}; - this.catchingExceptions = - attrs.catchingExceptions || - function() { - return true; - }; - this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; - this.timer = attrs.timer || j$.noopTimer; - - if (!this.queueableFn.fn) { - this.pend(); - } - - /** - * @typedef SpecResult - * @property {Int} id - The unique id of this spec. - * @property {String} description - The description passed to the {@link it} that created this spec. - * @property {String} fullName - The full description including all ancestors of this spec. - * @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec. - * @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec. - * @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec. - * @property {String} pendingReason - If the spec is {@link pending}, this will be the reason. - * @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec. - * @property {number} duration - The time in ms used by the spec execution, including any before/afterEach. - */ - this.result = { - id: this.id, - description: this.description, - fullName: this.getFullName(), - failedExpectations: [], - passedExpectations: [], - deprecationWarnings: [], - pendingReason: '', - duration: null - }; - } - - Spec.prototype.addExpectationResult = function(passed, data, isError) { - var expectationResult = this.expectationResultFactory(data); - if (passed) { - this.result.passedExpectations.push(expectationResult); - } else { - this.result.failedExpectations.push(expectationResult); - - if (this.throwOnExpectationFailure && !isError) { - throw new j$.errors.ExpectationFailed(); - } - } - }; - - Spec.prototype.expect = function(actual) { - return this.expectationFactory(actual, this); - }; - - Spec.prototype.expectAsync = function(actual) { - return this.asyncExpectationFactory(actual, this); - }; - - Spec.prototype.execute = function(onComplete, excluded, failSpecWithNoExp) { - var self = this; - - var onStart = { - fn: function(done) { - self.timer.start(); - self.onStart(self, done); - } - }; - - var complete = { - fn: function(done) { - self.queueableFn.fn = null; - self.result.status = self.status(excluded, failSpecWithNoExp); - self.resultCallback(self.result, done); - } - }; - - var fns = this.beforeAndAfterFns(); - var regularFns = fns.befores.concat(this.queueableFn); - - var runnerConfig = { - isLeaf: true, - queueableFns: regularFns, - cleanupFns: fns.afters, - onException: function() { - self.onException.apply(self, arguments); - }, - onComplete: function() { - self.result.duration = self.timer.elapsed(); - onComplete( - self.result.status === 'failed' && - new j$.StopExecutionError('spec failed') - ); - }, - userContext: this.userContext() - }; - - if (this.markedPending || excluded === true) { - runnerConfig.queueableFns = []; - runnerConfig.cleanupFns = []; - } - - runnerConfig.queueableFns.unshift(onStart); - runnerConfig.cleanupFns.push(complete); - - this.queueRunnerFactory(runnerConfig); - }; - - Spec.prototype.onException = function onException(e) { - if (Spec.isPendingSpecException(e)) { - this.pend(extractCustomPendingMessage(e)); - return; - } - - if (e instanceof j$.errors.ExpectationFailed) { - return; - } - - this.addExpectationResult( - false, - { - matcherName: '', - passed: false, - expected: '', - actual: '', - error: e - }, - true - ); - }; - - Spec.prototype.pend = function(message) { - this.markedPending = true; - if (message) { - this.result.pendingReason = message; - } - }; - - Spec.prototype.getResult = function() { - this.result.status = this.status(); - return this.result; - }; - - Spec.prototype.status = function(excluded, failSpecWithNoExpectations) { - if (excluded === true) { - return 'excluded'; - } - - if (this.markedPending) { - return 'pending'; - } - - if ( - this.result.failedExpectations.length > 0 || - (failSpecWithNoExpectations && - this.result.failedExpectations.length + - this.result.passedExpectations.length === - 0) - ) { - return 'failed'; - } - - return 'passed'; - }; - - Spec.prototype.getFullName = function() { - return this.getSpecName(this); - }; - - Spec.prototype.addDeprecationWarning = function(deprecation) { - if (typeof deprecation === 'string') { - deprecation = { message: deprecation }; - } - this.result.deprecationWarnings.push( - this.expectationResultFactory(deprecation) - ); - }; - - var extractCustomPendingMessage = function(e) { - var fullMessage = e.toString(), - boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage), - boilerplateEnd = - boilerplateStart + Spec.pendingSpecExceptionMessage.length; - - return fullMessage.substr(boilerplateEnd); - }; - - Spec.pendingSpecExceptionMessage = '=> marked Pending'; - - Spec.isPendingSpecException = function(e) { - return !!( - e && - e.toString && - e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1 - ); - }; - - return Spec; -}; - -if (typeof window == void 0 && typeof exports == 'object') { - /* globals exports */ - exports.Spec = jasmineRequire.Spec; -} - -/*jshint bitwise: false*/ - -getJasmineRequireObj().Order = function() { - function Order(options) { - this.random = 'random' in options ? options.random : true; - var seed = (this.seed = options.seed || generateSeed()); - this.sort = this.random ? randomOrder : naturalOrder; - - function naturalOrder(items) { - return items; - } - - function randomOrder(items) { - var copy = items.slice(); - copy.sort(function(a, b) { - return jenkinsHash(seed + a.id) - jenkinsHash(seed + b.id); - }); - return copy; - } - - function generateSeed() { - return String(Math.random()).slice(-5); - } - - // Bob Jenkins One-at-a-Time Hash algorithm is a non-cryptographic hash function - // used to get a different output when the key changes slightly. - // We use your return to sort the children randomly in a consistent way when - // used in conjunction with a seed - - function jenkinsHash(key) { - var hash, i; - for (hash = i = 0; i < key.length; ++i) { - hash += key.charCodeAt(i); - hash += hash << 10; - hash ^= hash >> 6; - } - hash += hash << 3; - hash ^= hash >> 11; - hash += hash << 15; - return hash; - } - } - - return Order; -}; - -getJasmineRequireObj().Env = function(j$) { - /** - * _Note:_ Do not construct this directly, Jasmine will make one during booting. - * @name Env - * @since 2.0.0 - * @classdesc The Jasmine environment - * @constructor - */ - function Env(options) { - options = options || {}; - - var self = this; - var global = options.global || j$.getGlobal(); - var customPromise; - - var totalSpecsDefined = 0; - - var realSetTimeout = global.setTimeout; - var realClearTimeout = global.clearTimeout; - var clearStack = j$.getClearStack(global); - this.clock = new j$.Clock( - global, - function() { - return new j$.DelayedFunctionScheduler(); - }, - new j$.MockDate(global) - ); - - var runnableResources = {}; - - var currentSpec = null; - var currentlyExecutingSuites = []; - var currentDeclarationSuite = null; - var hasFailures = false; - - /** - * This represents the available options to configure Jasmine. - * Options that are not provided will use their default values - * @interface Configuration - * @since 3.3.0 - */ - var config = { - /** - * Whether to randomize spec execution order - * @name Configuration#random - * @since 3.3.0 - * @type Boolean - * @default true - */ - random: true, - /** - * Seed to use as the basis of randomization. - * Null causes the seed to be determined randomly at the start of execution. - * @name Configuration#seed - * @since 3.3.0 - * @type function - * @default null - */ - seed: null, - /** - * Whether to stop execution of the suite after the first spec failure - * @name Configuration#failFast - * @since 3.3.0 - * @type Boolean - * @default false - */ - failFast: false, - /** - * Whether to fail the spec if it ran no expectations. By default - * a spec that ran no expectations is reported as passed. Setting this - * to true will report such spec as a failure. - * @name Configuration#failSpecWithNoExpectations - * @since 3.5.0 - * @type Boolean - * @default false - */ - failSpecWithNoExpectations: false, - /** - * Whether to cause specs to only have one expectation failure. - * @name Configuration#oneFailurePerSpec - * @since 3.3.0 - * @type Boolean - * @default false - */ - oneFailurePerSpec: false, - /** - * Function to use to filter specs - * @name Configuration#specFilter - * @since 3.3.0 - * @type function - * @default true - */ - specFilter: function() { - return true; - }, - /** - * Whether or not reporters should hide disabled specs from their output. - * Currently only supported by Jasmine's HTMLReporter - * @name Configuration#hideDisabled - * @since 3.3.0 - * @type Boolean - * @default false - */ - hideDisabled: false, - /** - * Set to provide a custom promise library that Jasmine will use if it needs - * to create a promise. If not set, it will default to whatever global Promise - * library is available (if any). - * @name Configuration#Promise - * @since 3.5.0 - * @type function - * @default undefined - */ - Promise: undefined - }; - - var currentSuite = function() { - return currentlyExecutingSuites[currentlyExecutingSuites.length - 1]; - }; - - var currentRunnable = function() { - return currentSpec || currentSuite(); - }; - - var globalErrors = null; - - var installGlobalErrors = function() { - if (globalErrors) { - return; - } - - globalErrors = new j$.GlobalErrors(); - globalErrors.install(); - }; - - if (!options.suppressLoadErrors) { - installGlobalErrors(); - globalErrors.pushListener(function( - message, - filename, - lineno, - colNo, - err - ) { - topSuite.result.failedExpectations.push({ - passed: false, - globalErrorType: 'load', - message: message, - stack: err && err.stack, - filename: filename, - lineno: lineno - }); - }); - } - - /** - * Configure your jasmine environment - * @name Env#configure - * @since 3.3.0 - * @argument {Configuration} configuration - * @function - */ - this.configure = function(configuration) { - if (configuration.specFilter) { - config.specFilter = configuration.specFilter; - } - - if (configuration.hasOwnProperty('random')) { - config.random = !!configuration.random; - } - - if (configuration.hasOwnProperty('seed')) { - config.seed = configuration.seed; - } - - if (configuration.hasOwnProperty('failFast')) { - config.failFast = configuration.failFast; - } - - if (configuration.hasOwnProperty('failSpecWithNoExpectations')) { - config.failSpecWithNoExpectations = - configuration.failSpecWithNoExpectations; - } - - if (configuration.hasOwnProperty('oneFailurePerSpec')) { - config.oneFailurePerSpec = configuration.oneFailurePerSpec; - } - - if (configuration.hasOwnProperty('hideDisabled')) { - config.hideDisabled = configuration.hideDisabled; - } - - // Don't use hasOwnProperty to check for Promise existence because Promise - // can be initialized to undefined, either explicitly or by using the - // object returned from Env#configuration. In particular, Karma does this. - if (configuration.Promise) { - if ( - typeof configuration.Promise.resolve === 'function' && - typeof configuration.Promise.reject === 'function' - ) { - customPromise = configuration.Promise; - } else { - throw new Error( - 'Custom promise library missing `resolve`/`reject` functions' - ); - } - } - }; - - /** - * Get the current configuration for your jasmine environment - * @name Env#configuration - * @since 3.3.0 - * @function - * @returns {Configuration} - */ - this.configuration = function() { - var result = {}; - for (var property in config) { - result[property] = config[property]; - } - return result; - }; - - Object.defineProperty(this, 'specFilter', { - get: function() { - self.deprecated( - 'Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`' - ); - return config.specFilter; - }, - set: function(val) { - self.deprecated( - 'Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`' - ); - config.specFilter = val; - } - }); - - this.setDefaultSpyStrategy = function(defaultStrategyFn) { - if (!currentRunnable()) { - throw new Error( - 'Default spy strategy must be set in a before function or a spec' - ); - } - runnableResources[ - currentRunnable().id - ].defaultStrategyFn = defaultStrategyFn; - }; - - this.addSpyStrategy = function(name, fn) { - if (!currentRunnable()) { - throw new Error( - 'Custom spy strategies must be added in a before function or a spec' - ); - } - runnableResources[currentRunnable().id].customSpyStrategies[name] = fn; - }; - - this.addCustomEqualityTester = function(tester) { - if (!currentRunnable()) { - throw new Error( - 'Custom Equalities must be added in a before function or a spec' - ); - } - runnableResources[currentRunnable().id].customEqualityTesters.push( - tester - ); - }; - - this.addMatchers = function(matchersToAdd) { - if (!currentRunnable()) { - throw new Error( - 'Matchers must be added in a before function or a spec' - ); - } - var customMatchers = - runnableResources[currentRunnable().id].customMatchers; - for (var matcherName in matchersToAdd) { - customMatchers[matcherName] = matchersToAdd[matcherName]; - } - }; - - this.addAsyncMatchers = function(matchersToAdd) { - if (!currentRunnable()) { - throw new Error( - 'Async Matchers must be added in a before function or a spec' - ); - } - var customAsyncMatchers = - runnableResources[currentRunnable().id].customAsyncMatchers; - for (var matcherName in matchersToAdd) { - customAsyncMatchers[matcherName] = matchersToAdd[matcherName]; - } - }; - - j$.Expectation.addCoreMatchers(j$.matchers); - j$.Expectation.addAsyncCoreMatchers(j$.asyncMatchers); - - var nextSpecId = 0; - var getNextSpecId = function() { - return 'spec' + nextSpecId++; - }; - - var nextSuiteId = 0; - var getNextSuiteId = function() { - return 'suite' + nextSuiteId++; - }; - - var expectationFactory = function(actual, spec) { - return j$.Expectation.factory({ - util: j$.matchersUtil, - customEqualityTesters: runnableResources[spec.id].customEqualityTesters, - customMatchers: runnableResources[spec.id].customMatchers, - actual: actual, - addExpectationResult: addExpectationResult - }); - - function addExpectationResult(passed, result) { - return spec.addExpectationResult(passed, result); - } - }; - - var asyncExpectationFactory = function(actual, spec) { - return j$.Expectation.asyncFactory({ - util: j$.matchersUtil, - customEqualityTesters: runnableResources[spec.id].customEqualityTesters, - customAsyncMatchers: runnableResources[spec.id].customAsyncMatchers, - actual: actual, - addExpectationResult: addExpectationResult - }); - - function addExpectationResult(passed, result) { - return spec.addExpectationResult(passed, result); - } - }; - - var defaultResourcesForRunnable = function(id, parentRunnableId) { - var resources = { - spies: [], - customEqualityTesters: [], - customMatchers: {}, - customAsyncMatchers: {}, - customSpyStrategies: {}, - defaultStrategyFn: undefined - }; - - if (runnableResources[parentRunnableId]) { - resources.customEqualityTesters = j$.util.clone( - runnableResources[parentRunnableId].customEqualityTesters - ); - resources.customMatchers = j$.util.clone( - runnableResources[parentRunnableId].customMatchers - ); - resources.customAsyncMatchers = j$.util.clone( - runnableResources[parentRunnableId].customAsyncMatchers - ); - resources.defaultStrategyFn = - runnableResources[parentRunnableId].defaultStrategyFn; - } - - runnableResources[id] = resources; - }; - - var clearResourcesForRunnable = function(id) { - spyRegistry.clearSpies(); - delete runnableResources[id]; - }; - - var beforeAndAfterFns = function(suite) { - return function() { - var befores = [], - afters = []; - - while (suite) { - befores = befores.concat(suite.beforeFns); - afters = afters.concat(suite.afterFns); - - suite = suite.parentSuite; - } - - return { - befores: befores.reverse(), - afters: afters - }; - }; - }; - - var getSpecName = function(spec, suite) { - var fullName = [spec.description], - suiteFullName = suite.getFullName(); - - if (suiteFullName !== '') { - fullName.unshift(suiteFullName); - } - return fullName.join(' '); - }; - - // TODO: we may just be able to pass in the fn instead of wrapping here - var buildExpectationResult = j$.buildExpectationResult, - exceptionFormatter = new j$.ExceptionFormatter(), - expectationResultFactory = function(attrs) { - attrs.messageFormatter = exceptionFormatter.message; - attrs.stackFormatter = exceptionFormatter.stack; - - return buildExpectationResult(attrs); - }; - - /** - * Sets whether Jasmine should throw an Error when an expectation fails. - * This causes a spec to only have one expectation failure. - * @name Env#throwOnExpectationFailure - * @since 2.3.0 - * @function - * @param {Boolean} value Whether to throw when a expectation fails - * @deprecated Use the `oneFailurePerSpec` option with {@link Env#configure} - */ - this.throwOnExpectationFailure = function(value) { - this.deprecated( - 'Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`' - ); - this.configure({ oneFailurePerSpec: !!value }); - }; - - this.throwingExpectationFailures = function() { - this.deprecated( - 'Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`' - ); - return config.oneFailurePerSpec; - }; - - /** - * Set whether to stop suite execution when a spec fails - * @name Env#stopOnSpecFailure - * @since 2.7.0 - * @function - * @param {Boolean} value Whether to stop suite execution when a spec fails - * @deprecated Use the `failFast` option with {@link Env#configure} - */ - this.stopOnSpecFailure = function(value) { - this.deprecated( - 'Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`' - ); - this.configure({ failFast: !!value }); - }; - - this.stoppingOnSpecFailure = function() { - this.deprecated( - 'Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`' - ); - return config.failFast; - }; - - /** - * Set whether to randomize test execution order - * @name Env#randomizeTests - * @since 2.4.0 - * @function - * @param {Boolean} value Whether to randomize execution order - * @deprecated Use the `random` option with {@link Env#configure} - */ - this.randomizeTests = function(value) { - this.deprecated( - 'Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`' - ); - config.random = !!value; - }; - - this.randomTests = function() { - this.deprecated( - 'Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`' - ); - return config.random; - }; - - /** - * Set the random number seed for spec randomization - * @name Env#seed - * @since 2.4.0 - * @function - * @param {Number} value The seed value - * @deprecated Use the `seed` option with {@link Env#configure} - */ - this.seed = function(value) { - this.deprecated( - 'Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`' - ); - if (value) { - config.seed = value; - } - return config.seed; - }; - - this.hidingDisabled = function(value) { - this.deprecated( - 'Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`' - ); - return config.hideDisabled; - }; - - /** - * @name Env#hideDisabled - * @since 3.2.0 - * @function - */ - this.hideDisabled = function(value) { - this.deprecated( - 'Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`' - ); - config.hideDisabled = !!value; - }; - - this.deprecated = function(deprecation) { - var runnable = currentRunnable() || topSuite; - runnable.addDeprecationWarning(deprecation); - if ( - typeof console !== 'undefined' && - typeof console.error === 'function' - ) { - console.error('DEPRECATION:', deprecation); - } - }; - - var queueRunnerFactory = function(options, args) { - var failFast = false; - if (options.isLeaf) { - failFast = config.oneFailurePerSpec; - } else if (!options.isReporter) { - failFast = config.failFast; - } - options.clearStack = options.clearStack || clearStack; - options.timeout = { - setTimeout: realSetTimeout, - clearTimeout: realClearTimeout - }; - options.fail = self.fail; - options.globalErrors = globalErrors; - options.completeOnFirstError = failFast; - options.onException = - options.onException || - function(e) { - (currentRunnable() || topSuite).onException(e); - }; - options.deprecated = self.deprecated; - - new j$.QueueRunner(options).execute(args); - }; - - var topSuite = new j$.Suite({ - env: this, - id: getNextSuiteId(), - description: 'Jasmine__TopLevel__Suite', - expectationFactory: expectationFactory, - asyncExpectationFactory: asyncExpectationFactory, - expectationResultFactory: expectationResultFactory - }); - defaultResourcesForRunnable(topSuite.id); - currentDeclarationSuite = topSuite; - - this.topSuite = function() { - return topSuite; - }; - - /** - * This represents the available reporter callback for an object passed to {@link Env#addReporter}. - * @interface Reporter - * @see custom_reporter - */ - var reporter = new j$.ReportDispatcher( - [ - /** - * `jasmineStarted` is called after all of the specs have been loaded, but just before execution starts. - * @function - * @name Reporter#jasmineStarted - * @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'jasmineStarted', - /** - * When the entire suite has finished execution `jasmineDone` is called - * @function - * @name Reporter#jasmineDone - * @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running. - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'jasmineDone', - /** - * `suiteStarted` is invoked when a `describe` starts to run - * @function - * @name Reporter#suiteStarted - * @param {SuiteResult} result Information about the individual {@link describe} being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'suiteStarted', - /** - * `suiteDone` is invoked when all of the child specs and suites for a given suite have been run - * - * While jasmine doesn't require any specific functions, not defining a `suiteDone` will make it impossible for a reporter to know when a suite has failures in an `afterAll`. - * @function - * @name Reporter#suiteDone - * @param {SuiteResult} result - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'suiteDone', - /** - * `specStarted` is invoked when an `it` starts to run (including associated `beforeEach` functions) - * @function - * @name Reporter#specStarted - * @param {SpecResult} result Information about the individual {@link it} being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'specStarted', - /** - * `specDone` is invoked when an `it` and its associated `beforeEach` and `afterEach` functions have been run. - * - * While jasmine doesn't require any specific functions, not defining a `specDone` will make it impossible for a reporter to know when a spec has failed. - * @function - * @name Reporter#specDone - * @param {SpecResult} result - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'specDone' - ], - queueRunnerFactory - ); - - this.execute = function(runnablesToRun) { - installGlobalErrors(); - - if (!runnablesToRun) { - if (focusedRunnables.length) { - runnablesToRun = focusedRunnables; - } else { - runnablesToRun = [topSuite.id]; - } - } - - var order = new j$.Order({ - random: config.random, - seed: config.seed - }); - - var processor = new j$.TreeProcessor({ - tree: topSuite, - runnableIds: runnablesToRun, - queueRunnerFactory: queueRunnerFactory, - failSpecWithNoExpectations: config.failSpecWithNoExpectations, - nodeStart: function(suite, next) { - currentlyExecutingSuites.push(suite); - defaultResourcesForRunnable(suite.id, suite.parentSuite.id); - reporter.suiteStarted(suite.result, next); - suite.startTimer(); - }, - nodeComplete: function(suite, result, next) { - if (suite !== currentSuite()) { - throw new Error('Tried to complete the wrong suite'); - } - - clearResourcesForRunnable(suite.id); - currentlyExecutingSuites.pop(); - - if (result.status === 'failed') { - hasFailures = true; - } - suite.endTimer(); - reporter.suiteDone(result, next); - }, - orderChildren: function(node) { - return order.sort(node.children); - }, - excludeNode: function(spec) { - return !config.specFilter(spec); - } - }); - - if (!processor.processTree().valid) { - throw new Error( - 'Invalid order: would cause a beforeAll or afterAll to be run multiple times' - ); - } - - var jasmineTimer = new j$.Timer(); - jasmineTimer.start(); - - /** - * Information passed to the {@link Reporter#jasmineStarted} event. - * @typedef JasmineStartedInfo - * @property {Int} totalSpecsDefined - The total number of specs defined in this suite. - * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. - */ - reporter.jasmineStarted( - { - totalSpecsDefined: totalSpecsDefined, - order: order - }, - function() { - currentlyExecutingSuites.push(topSuite); - - processor.execute(function() { - clearResourcesForRunnable(topSuite.id); - currentlyExecutingSuites.pop(); - var overallStatus, incompleteReason; - - if (hasFailures || topSuite.result.failedExpectations.length > 0) { - overallStatus = 'failed'; - } else if (focusedRunnables.length > 0) { - overallStatus = 'incomplete'; - incompleteReason = 'fit() or fdescribe() was found'; - } else if (totalSpecsDefined === 0) { - overallStatus = 'incomplete'; - incompleteReason = 'No specs found'; - } else { - overallStatus = 'passed'; - } - - /** - * Information passed to the {@link Reporter#jasmineDone} event. - * @typedef JasmineDoneInfo - * @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'. - * @property {Int} totalTime - The total time (in ms) that it took to execute the suite - * @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete. - * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. - * @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level. - * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level. - */ - reporter.jasmineDone( - { - overallStatus: overallStatus, - totalTime: jasmineTimer.elapsed(), - incompleteReason: incompleteReason, - order: order, - failedExpectations: topSuite.result.failedExpectations, - deprecationWarnings: topSuite.result.deprecationWarnings - }, - function() {} - ); - }); - } - ); - }; - - /** - * Add a custom reporter to the Jasmine environment. - * @name Env#addReporter - * @since 2.0.0 - * @function - * @param {Reporter} reporterToAdd The reporter to be added. - * @see custom_reporter - */ - this.addReporter = function(reporterToAdd) { - reporter.addReporter(reporterToAdd); - }; - - /** - * Provide a fallback reporter if no other reporters have been specified. - * @name Env#provideFallbackReporter - * @since 2.5.0 - * @function - * @param {Reporter} reporterToAdd The reporter - * @see custom_reporter - */ - this.provideFallbackReporter = function(reporterToAdd) { - reporter.provideFallbackReporter(reporterToAdd); - }; - - /** - * Clear all registered reporters - * @name Env#clearReporters - * @since 2.5.2 - * @function - */ - this.clearReporters = function() { - reporter.clearReporters(); - }; - - var spyFactory = new j$.SpyFactory( - function getCustomStrategies() { - var runnable = currentRunnable(); - - if (runnable) { - return runnableResources[runnable.id].customSpyStrategies; - } - - return {}; - }, - function getDefaultStrategyFn() { - var runnable = currentRunnable(); - - if (runnable) { - return runnableResources[runnable.id].defaultStrategyFn; - } - - return undefined; - }, - function getPromise() { - return customPromise || global.Promise; - } - ); - - var spyRegistry = new j$.SpyRegistry({ - currentSpies: function() { - if (!currentRunnable()) { - throw new Error( - 'Spies must be created in a before function or a spec' - ); - } - return runnableResources[currentRunnable().id].spies; - }, - createSpy: function(name, originalFn) { - return self.createSpy(name, originalFn); - } - }); - - this.allowRespy = function(allow) { - spyRegistry.allowRespy(allow); - }; - - this.spyOn = function() { - return spyRegistry.spyOn.apply(spyRegistry, arguments); - }; - - this.spyOnProperty = function() { - return spyRegistry.spyOnProperty.apply(spyRegistry, arguments); - }; - - this.spyOnAllFunctions = function() { - return spyRegistry.spyOnAllFunctions.apply(spyRegistry, arguments); - }; - - this.createSpy = function(name, originalFn) { - if (arguments.length === 1 && j$.isFunction_(name)) { - originalFn = name; - name = originalFn.name; - } - - return spyFactory.createSpy(name, originalFn); - }; - - this.createSpyObj = function(baseName, methodNames, propertyNames) { - return spyFactory.createSpyObj(baseName, methodNames, propertyNames); - }; - - var ensureIsFunction = function(fn, caller) { - if (!j$.isFunction_(fn)) { - throw new Error( - caller + ' expects a function argument; received ' + j$.getType_(fn) - ); - } - }; - - var ensureIsFunctionOrAsync = function(fn, caller) { - if (!j$.isFunction_(fn) && !j$.isAsyncFunction_(fn)) { - throw new Error( - caller + ' expects a function argument; received ' + j$.getType_(fn) - ); - } - }; - - function ensureIsNotNested(method) { - var runnable = currentRunnable(); - if (runnable !== null && runnable !== undefined) { - throw new Error( - "'" + method + "' should only be used in 'describe' function" - ); - } - } - - var suiteFactory = function(description) { - var suite = new j$.Suite({ - env: self, - id: getNextSuiteId(), - description: description, - parentSuite: currentDeclarationSuite, - expectationFactory: expectationFactory, - asyncExpectationFactory: asyncExpectationFactory, - expectationResultFactory: expectationResultFactory, - throwOnExpectationFailure: config.oneFailurePerSpec - }); - - return suite; - }; - - this.describe = function(description, specDefinitions) { - ensureIsNotNested('describe'); - ensureIsFunction(specDefinitions, 'describe'); - var suite = suiteFactory(description); - if (specDefinitions.length > 0) { - throw new Error('describe does not expect any arguments'); - } - if (currentDeclarationSuite.markedPending) { - suite.pend(); - } - addSpecsToSuite(suite, specDefinitions); - return suite; - }; - - this.xdescribe = function(description, specDefinitions) { - ensureIsNotNested('xdescribe'); - ensureIsFunction(specDefinitions, 'xdescribe'); - var suite = suiteFactory(description); - suite.pend(); - addSpecsToSuite(suite, specDefinitions); - return suite; - }; - - var focusedRunnables = []; - - this.fdescribe = function(description, specDefinitions) { - ensureIsNotNested('fdescribe'); - ensureIsFunction(specDefinitions, 'fdescribe'); - var suite = suiteFactory(description); - suite.isFocused = true; - - focusedRunnables.push(suite.id); - unfocusAncestor(); - addSpecsToSuite(suite, specDefinitions); - - return suite; - }; - - function addSpecsToSuite(suite, specDefinitions) { - var parentSuite = currentDeclarationSuite; - parentSuite.addChild(suite); - currentDeclarationSuite = suite; - - var declarationError = null; - try { - specDefinitions.call(suite); - } catch (e) { - declarationError = e; - } - - if (declarationError) { - suite.onException(declarationError); - } - - currentDeclarationSuite = parentSuite; - } - - function findFocusedAncestor(suite) { - while (suite) { - if (suite.isFocused) { - return suite.id; - } - suite = suite.parentSuite; - } - - return null; - } - - function unfocusAncestor() { - var focusedAncestor = findFocusedAncestor(currentDeclarationSuite); - if (focusedAncestor) { - for (var i = 0; i < focusedRunnables.length; i++) { - if (focusedRunnables[i] === focusedAncestor) { - focusedRunnables.splice(i, 1); - break; - } - } - } - } - - var specFactory = function(description, fn, suite, timeout) { - totalSpecsDefined++; - var spec = new j$.Spec({ - id: getNextSpecId(), - beforeAndAfterFns: beforeAndAfterFns(suite), - expectationFactory: expectationFactory, - asyncExpectationFactory: asyncExpectationFactory, - resultCallback: specResultCallback, - getSpecName: function(spec) { - return getSpecName(spec, suite); - }, - onStart: specStarted, - description: description, - expectationResultFactory: expectationResultFactory, - queueRunnerFactory: queueRunnerFactory, - userContext: function() { - return suite.clonedSharedUserContext(); - }, - queueableFn: { - fn: fn, - timeout: timeout || 0 - }, - throwOnExpectationFailure: config.oneFailurePerSpec, - timer: new j$.Timer() - }); - return spec; - - function specResultCallback(result, next) { - clearResourcesForRunnable(spec.id); - currentSpec = null; - - if (result.status === 'failed') { - hasFailures = true; - } - - reporter.specDone(result, next); - } - - function specStarted(spec, next) { - currentSpec = spec; - defaultResourcesForRunnable(spec.id, suite.id); - reporter.specStarted(spec.result, next); - } - }; - - this.it = function(description, fn, timeout) { - ensureIsNotNested('it'); - // it() sometimes doesn't have a fn argument, so only check the type if - // it's given. - if (arguments.length > 1 && typeof fn !== 'undefined') { - ensureIsFunctionOrAsync(fn, 'it'); - } - var spec = specFactory(description, fn, currentDeclarationSuite, timeout); - if (currentDeclarationSuite.markedPending) { - spec.pend(); - } - currentDeclarationSuite.addChild(spec); - return spec; - }; - - this.xit = function(description, fn, timeout) { - ensureIsNotNested('xit'); - // xit(), like it(), doesn't always have a fn argument, so only check the - // type when needed. - if (arguments.length > 1 && typeof fn !== 'undefined') { - ensureIsFunctionOrAsync(fn, 'xit'); - } - var spec = this.it.apply(this, arguments); - spec.pend('Temporarily disabled with xit'); - return spec; - }; - - this.fit = function(description, fn, timeout) { - ensureIsNotNested('fit'); - ensureIsFunctionOrAsync(fn, 'fit'); - var spec = specFactory(description, fn, currentDeclarationSuite, timeout); - currentDeclarationSuite.addChild(spec); - focusedRunnables.push(spec.id); - unfocusAncestor(); - return spec; - }; - - this.expect = function(actual) { - if (!currentRunnable()) { - throw new Error( - "'expect' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - return currentRunnable().expect(actual); - }; - - this.expectAsync = function(actual) { - if (!currentRunnable()) { - throw new Error( - "'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - return currentRunnable().expectAsync(actual); - }; - - this.beforeEach = function(beforeEachFunction, timeout) { - ensureIsNotNested('beforeEach'); - ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach'); - currentDeclarationSuite.beforeEach({ - fn: beforeEachFunction, - timeout: timeout || 0 - }); - }; - - this.beforeAll = function(beforeAllFunction, timeout) { - ensureIsNotNested('beforeAll'); - ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll'); - currentDeclarationSuite.beforeAll({ - fn: beforeAllFunction, - timeout: timeout || 0 - }); - }; - - this.afterEach = function(afterEachFunction, timeout) { - ensureIsNotNested('afterEach'); - ensureIsFunctionOrAsync(afterEachFunction, 'afterEach'); - afterEachFunction.isCleanup = true; - currentDeclarationSuite.afterEach({ - fn: afterEachFunction, - timeout: timeout || 0 - }); - }; - - this.afterAll = function(afterAllFunction, timeout) { - ensureIsNotNested('afterAll'); - ensureIsFunctionOrAsync(afterAllFunction, 'afterAll'); - currentDeclarationSuite.afterAll({ - fn: afterAllFunction, - timeout: timeout || 0 - }); - }; - - this.pending = function(message) { - var fullMessage = j$.Spec.pendingSpecExceptionMessage; - if (message) { - fullMessage += message; - } - throw fullMessage; - }; - - this.fail = function(error) { - if (!currentRunnable()) { - throw new Error( - "'fail' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - var message = 'Failed'; - if (error) { - message += ': '; - if (error.message) { - message += error.message; - } else if (j$.isString_(error)) { - message += error; - } else { - // pretty print all kind of objects. This includes arrays. - message += j$.pp(error); - } - } - - currentRunnable().addExpectationResult(false, { - matcherName: '', - passed: false, - expected: '', - actual: '', - message: message, - error: error && error.message ? error : null - }); - - if (config.oneFailurePerSpec) { - throw new Error(message); - } - }; - } - - return Env; -}; - -getJasmineRequireObj().JsApiReporter = function(j$) { - /** - * @name jsApiReporter - * @classdesc {@link Reporter} added by default in `boot.js` to record results for retrieval in javascript code. An instance is made available as `jsApiReporter` on the global object. - * @class - * @hideconstructor - */ - function JsApiReporter(options) { - var timer = options.timer || j$.noopTimer, - status = 'loaded'; - - this.started = false; - this.finished = false; - this.runDetails = {}; - - this.jasmineStarted = function() { - this.started = true; - status = 'started'; - timer.start(); - }; - - var executionTime; - - this.jasmineDone = function(runDetails) { - this.finished = true; - this.runDetails = runDetails; - executionTime = timer.elapsed(); - status = 'done'; - }; - - /** - * Get the current status for the Jasmine environment. - * @name jsApiReporter#status - * @since 2.0.0 - * @function - * @return {String} - One of `loaded`, `started`, or `done` - */ - this.status = function() { - return status; - }; - - var suites = [], - suites_hash = {}; - - this.suiteStarted = function(result) { - suites_hash[result.id] = result; - }; - - this.suiteDone = function(result) { - storeSuite(result); - }; - - /** - * Get the results for a set of suites. - * - * Retrievable in slices for easier serialization. - * @name jsApiReporter#suiteResults - * @since 2.1.0 - * @function - * @param {Number} index - The position in the suites list to start from. - * @param {Number} length - Maximum number of suite results to return. - * @return {SuiteResult[]} - */ - this.suiteResults = function(index, length) { - return suites.slice(index, index + length); - }; - - function storeSuite(result) { - suites.push(result); - suites_hash[result.id] = result; - } - - /** - * Get all of the suites in a single object, with their `id` as the key. - * @name jsApiReporter#suites - * @since 2.0.0 - * @function - * @return {Object} - Map of suite id to {@link SuiteResult} - */ - this.suites = function() { - return suites_hash; - }; - - var specs = []; - - this.specDone = function(result) { - specs.push(result); - }; - - /** - * Get the results for a set of specs. - * - * Retrievable in slices for easier serialization. - * @name jsApiReporter#specResults - * @since 2.0.0 - * @function - * @param {Number} index - The position in the specs list to start from. - * @param {Number} length - Maximum number of specs results to return. - * @return {SpecResult[]} - */ - this.specResults = function(index, length) { - return specs.slice(index, index + length); - }; - - /** - * Get all spec results. - * @name jsApiReporter#specs - * @since 2.0.0 - * @function - * @return {SpecResult[]} - */ - this.specs = function() { - return specs; - }; - - /** - * Get the number of milliseconds it took for the full Jasmine suite to run. - * @name jsApiReporter#executionTime - * @since 2.0.0 - * @function - * @return {Number} - */ - this.executionTime = function() { - return executionTime; - }; - } - - return JsApiReporter; -}; - -getJasmineRequireObj().Any = function(j$) { - - function Any(expectedObject) { - if (typeof expectedObject === 'undefined') { - throw new TypeError( - 'jasmine.any() expects to be passed a constructor function. ' + - 'Please pass one or use jasmine.anything() to match any object.' - ); - } - this.expectedObject = expectedObject; - } - - Any.prototype.asymmetricMatch = function(other) { - if (this.expectedObject == String) { - return typeof other == 'string' || other instanceof String; - } - - if (this.expectedObject == Number) { - return typeof other == 'number' || other instanceof Number; - } - - if (this.expectedObject == Function) { - return typeof other == 'function' || other instanceof Function; - } - - if (this.expectedObject == Object) { - return other !== null && typeof other == 'object'; - } - - if (this.expectedObject == Boolean) { - return typeof other == 'boolean'; - } - - /* jshint -W122 */ - /* global Symbol */ - if (typeof Symbol != 'undefined' && this.expectedObject == Symbol) { - return typeof other == 'symbol'; - } - /* jshint +W122 */ - - return other instanceof this.expectedObject; - }; - - Any.prototype.jasmineToString = function() { - return ''; - }; - - return Any; -}; - -getJasmineRequireObj().Anything = function(j$) { - - function Anything() {} - - Anything.prototype.asymmetricMatch = function(other) { - return !j$.util.isUndefined(other) && other !== null; - }; - - Anything.prototype.jasmineToString = function() { - return ''; - }; - - return Anything; -}; - -getJasmineRequireObj().ArrayContaining = function(j$) { - function ArrayContaining(sample) { - this.sample = sample; - } - - ArrayContaining.prototype.asymmetricMatch = function(other, customTesters) { - if (!j$.isArray_(this.sample)) { - throw new Error('You must provide an array to arrayContaining, not ' + j$.pp(this.sample) + '.'); - } - - // If the actual parameter is not an array, we can fail immediately, since it couldn't - // possibly be an "array containing" anything. However, we also want an empty sample - // array to match anything, so we need to double-check we aren't in that case - if (!j$.isArray_(other) && this.sample.length > 0) { - return false; - } - - for (var i = 0; i < this.sample.length; i++) { - var item = this.sample[i]; - if (!j$.matchersUtil.contains(other, item, customTesters)) { - return false; - } - } - - return true; - }; - - ArrayContaining.prototype.jasmineToString = function () { - return ''; - }; - - return ArrayContaining; -}; - -getJasmineRequireObj().ArrayWithExactContents = function(j$) { - - function ArrayWithExactContents(sample) { - this.sample = sample; - } - - ArrayWithExactContents.prototype.asymmetricMatch = function(other, customTesters) { - if (!j$.isArray_(this.sample)) { - throw new Error('You must provide an array to arrayWithExactContents, not ' + j$.pp(this.sample) + '.'); - } - - if (this.sample.length !== other.length) { - return false; - } - - for (var i = 0; i < this.sample.length; i++) { - var item = this.sample[i]; - if (!j$.matchersUtil.contains(other, item, customTesters)) { - return false; - } - } - - return true; - }; - - ArrayWithExactContents.prototype.jasmineToString = function() { - return ''; - }; - - return ArrayWithExactContents; -}; - -getJasmineRequireObj().Empty = function (j$) { - - function Empty() {} - - Empty.prototype.asymmetricMatch = function (other) { - if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) { - return other.length === 0; - } - - if (j$.isMap(other) || j$.isSet(other)) { - return other.size === 0; - } - - if (j$.isObject_(other)) { - return Object.keys(other).length === 0; - } - return false; - }; - - Empty.prototype.jasmineToString = function () { - return ''; - }; - - return Empty; -}; - -getJasmineRequireObj().Falsy = function(j$) { - - function Falsy() {} - - Falsy.prototype.asymmetricMatch = function(other) { - return !other; - }; - - Falsy.prototype.jasmineToString = function() { - return ''; - }; - - return Falsy; -}; - -getJasmineRequireObj().MapContaining = function(j$) { - function MapContaining(sample) { - if (!j$.isMap(sample)) { - throw new Error('You must provide a map to `mapContaining`, not ' + j$.pp(sample)); - } - - this.sample = sample; - } - - MapContaining.prototype.asymmetricMatch = function(other, customTesters) { - if (!j$.isMap(other)) return false; - - var hasAllMatches = true; - j$.util.forEachBreakable(this.sample, function(breakLoop, value, key) { - // for each key/value pair in `sample` - // there should be at least one pair in `other` whose key and value both match - var hasMatch = false; - j$.util.forEachBreakable(other, function(oBreakLoop, oValue, oKey) { - if ( - j$.matchersUtil.equals(oKey, key, customTesters) - && j$.matchersUtil.equals(oValue, value, customTesters) - ) { - hasMatch = true; - oBreakLoop(); - } - }); - if (!hasMatch) { - hasAllMatches = false; - breakLoop(); - } - }); - - return hasAllMatches; - }; - - MapContaining.prototype.jasmineToString = function() { - return ''; - }; - - return MapContaining; -}; - -getJasmineRequireObj().NotEmpty = function (j$) { - - function NotEmpty() {} - - NotEmpty.prototype.asymmetricMatch = function (other) { - if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) { - return other.length !== 0; - } - - if (j$.isMap(other) || j$.isSet(other)) { - return other.size !== 0; - } - - if (j$.isObject_(other)) { - return Object.keys(other).length !== 0; - } - - return false; - }; - - NotEmpty.prototype.jasmineToString = function () { - return ''; - }; - - return NotEmpty; -}; - -getJasmineRequireObj().ObjectContaining = function(j$) { - - function ObjectContaining(sample) { - this.sample = sample; - } - - function getPrototype(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - - if (obj.constructor.prototype == obj) { - return null; - } - - return obj.constructor.prototype; - } - - function hasProperty(obj, property) { - if (!obj) { - return false; - } - - if (Object.prototype.hasOwnProperty.call(obj, property)) { - return true; - } - - return hasProperty(getPrototype(obj), property); - } - - ObjectContaining.prototype.asymmetricMatch = function(other, customTesters) { - if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); } - - for (var property in this.sample) { - if (!hasProperty(other, property) || - !j$.matchersUtil.equals(this.sample[property], other[property], customTesters)) { - return false; - } - } - - return true; - }; - - ObjectContaining.prototype.jasmineToString = function() { - return ''; - }; - - return ObjectContaining; -}; - -getJasmineRequireObj().SetContaining = function(j$) { - function SetContaining(sample) { - if (!j$.isSet(sample)) { - throw new Error('You must provide a set to `setContaining`, not ' + j$.pp(sample)); - } - - this.sample = sample; - } - - SetContaining.prototype.asymmetricMatch = function(other, customTesters) { - if (!j$.isSet(other)) return false; - - var hasAllMatches = true; - j$.util.forEachBreakable(this.sample, function(breakLoop, item) { - // for each item in `sample` there should be at least one matching item in `other` - // (not using `j$.matchersUtil.contains` because it compares set members by reference, - // not by deep value equality) - var hasMatch = false; - j$.util.forEachBreakable(other, function(oBreakLoop, oItem) { - if (j$.matchersUtil.equals(oItem, item, customTesters)) { - hasMatch = true; - oBreakLoop(); - } - }); - if (!hasMatch) { - hasAllMatches = false; - breakLoop(); - } - }); - - return hasAllMatches; - }; - - SetContaining.prototype.jasmineToString = function() { - return ''; - }; - - return SetContaining; -}; - -getJasmineRequireObj().StringMatching = function(j$) { - - function StringMatching(expected) { - if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { - throw new Error('Expected is not a String or a RegExp'); - } - - this.regexp = new RegExp(expected); - } - - StringMatching.prototype.asymmetricMatch = function(other) { - return this.regexp.test(other); - }; - - StringMatching.prototype.jasmineToString = function() { - return ''; - }; - - return StringMatching; -}; - -getJasmineRequireObj().Truthy = function(j$) { - - function Truthy() {} - - Truthy.prototype.asymmetricMatch = function(other) { - return !!other; - }; - - Truthy.prototype.jasmineToString = function() { - return ''; - }; - - return Truthy; -}; - -getJasmineRequireObj().CallTracker = function(j$) { - /** - * @namespace Spy#calls - * @since 2.0.0 - */ - function CallTracker() { - var calls = []; - var opts = {}; - - this.track = function(context) { - if (opts.cloneArgs) { - context.args = j$.util.cloneArgs(context.args); - } - calls.push(context); - }; - - /** - * Check whether this spy has been invoked. - * @name Spy#calls#any - * @since 2.0.0 - * @function - * @return {Boolean} - */ - this.any = function() { - return !!calls.length; - }; - - /** - * Get the number of invocations of this spy. - * @name Spy#calls#count - * @since 2.0.0 - * @function - * @return {Integer} - */ - this.count = function() { - return calls.length; - }; - - /** - * Get the arguments that were passed to a specific invocation of this spy. - * @name Spy#calls#argsFor - * @since 2.0.0 - * @function - * @param {Integer} index The 0-based invocation index. - * @return {Array} - */ - this.argsFor = function(index) { - var call = calls[index]; - return call ? call.args : []; - }; - - /** - * Get the raw calls array for this spy. - * @name Spy#calls#all - * @since 2.0.0 - * @function - * @return {Spy.callData[]} - */ - this.all = function() { - return calls; - }; - - /** - * Get all of the arguments for each invocation of this spy in the order they were received. - * @name Spy#calls#allArgs - * @since 2.0.0 - * @function - * @return {Array} - */ - this.allArgs = function() { - var callArgs = []; - for (var i = 0; i < calls.length; i++) { - callArgs.push(calls[i].args); - } - - return callArgs; - }; - - /** - * Get the first invocation of this spy. - * @name Spy#calls#first - * @since 2.0.0 - * @function - * @return {ObjecSpy.callData} - */ - this.first = function() { - return calls[0]; - }; - - /** - * Get the most recent invocation of this spy. - * @name Spy#calls#mostRecent - * @since 2.0.0 - * @function - * @return {ObjecSpy.callData} - */ - this.mostRecent = function() { - return calls[calls.length - 1]; - }; - - /** - * Reset this spy as if it has never been called. - * @name Spy#calls#reset - * @since 2.0.0 - * @function - */ - this.reset = function() { - calls = []; - }; - - /** - * Set this spy to do a shallow clone of arguments passed to each invocation. - * @name Spy#calls#saveArgumentsByValue - * @since 2.5.0 - * @function - */ - this.saveArgumentsByValue = function() { - opts.cloneArgs = true; - }; - } - - return CallTracker; -}; - -getJasmineRequireObj().clearStack = function(j$) { - var maxInlineCallCount = 10; - - function messageChannelImpl(global, setTimeout) { - var channel = new global.MessageChannel(), - head = {}, - tail = head; - - var taskRunning = false; - channel.port1.onmessage = function() { - head = head.next; - var task = head.task; - delete head.task; - - if (taskRunning) { - global.setTimeout(task, 0); - } else { - try { - taskRunning = true; - task(); - } finally { - taskRunning = false; - } - } - }; - - var currentCallCount = 0; - return function clearStack(fn) { - currentCallCount++; - - if (currentCallCount < maxInlineCallCount) { - tail = tail.next = { task: fn }; - channel.port2.postMessage(0); - } else { - currentCallCount = 0; - setTimeout(fn); - } - }; - } - - function getClearStack(global) { - var currentCallCount = 0; - var realSetTimeout = global.setTimeout; - var setTimeoutImpl = function clearStack(fn) { - Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]); - }; - - if (j$.isFunction_(global.setImmediate)) { - var realSetImmediate = global.setImmediate; - return function(fn) { - currentCallCount++; - - if (currentCallCount < maxInlineCallCount) { - realSetImmediate(fn); - } else { - currentCallCount = 0; - - setTimeoutImpl(fn); - } - }; - } else if (!j$.util.isUndefined(global.MessageChannel)) { - return messageChannelImpl(global, setTimeoutImpl); - } else { - return setTimeoutImpl; - } - } - - return getClearStack; -}; - -getJasmineRequireObj().Clock = function() { - /* global process */ - var NODE_JS = - typeof process !== 'undefined' && - process.versions && - typeof process.versions.node === 'string'; - - /** - * _Note:_ Do not construct this directly, Jasmine will make one during booting. You can get the current clock with {@link jasmine.clock}. - * @class Clock - * @classdesc Jasmine's mock clock is used when testing time dependent code. - */ - function Clock(global, delayedFunctionSchedulerFactory, mockDate) { - var self = this, - realTimingFunctions = { - setTimeout: global.setTimeout, - clearTimeout: global.clearTimeout, - setInterval: global.setInterval, - clearInterval: global.clearInterval - }, - fakeTimingFunctions = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setInterval: setInterval, - clearInterval: clearInterval - }, - installed = false, - delayedFunctionScheduler, - timer; - - self.FakeTimeout = FakeTimeout; - - /** - * Install the mock clock over the built-in methods. - * @name Clock#install - * @since 2.0.0 - * @function - * @return {Clock} - */ - self.install = function() { - if (!originalTimingFunctionsIntact()) { - throw new Error( - 'Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?' - ); - } - replace(global, fakeTimingFunctions); - timer = fakeTimingFunctions; - delayedFunctionScheduler = delayedFunctionSchedulerFactory(); - installed = true; - - return self; - }; - - /** - * Uninstall the mock clock, returning the built-in methods to their places. - * @name Clock#uninstall - * @since 2.0.0 - * @function - */ - self.uninstall = function() { - delayedFunctionScheduler = null; - mockDate.uninstall(); - replace(global, realTimingFunctions); - - timer = realTimingFunctions; - installed = false; - }; - - /** - * Execute a function with a mocked Clock - * - * The clock will be {@link Clock#install|install}ed before the function is called and {@link Clock#uninstall|uninstall}ed in a `finally` after the function completes. - * @name Clock#withMock - * @since 2.3.0 - * @function - * @param {Function} closure The function to be called. - */ - self.withMock = function(closure) { - this.install(); - try { - closure(); - } finally { - this.uninstall(); - } - }; - - /** - * Instruct the installed Clock to also mock the date returned by `new Date()` - * @name Clock#mockDate - * @since 2.1.0 - * @function - * @param {Date} [initialDate=now] The `Date` to provide. - */ - self.mockDate = function(initialDate) { - mockDate.install(initialDate); - }; - - self.setTimeout = function(fn, delay, params) { - return Function.prototype.apply.apply(timer.setTimeout, [ - global, - arguments - ]); - }; - - self.setInterval = function(fn, delay, params) { - return Function.prototype.apply.apply(timer.setInterval, [ - global, - arguments - ]); - }; - - self.clearTimeout = function(id) { - return Function.prototype.call.apply(timer.clearTimeout, [global, id]); - }; - - self.clearInterval = function(id) { - return Function.prototype.call.apply(timer.clearInterval, [global, id]); - }; - - /** - * Tick the Clock forward, running any enqueued timeouts along the way - * @name Clock#tick - * @since 1.3.0 - * @function - * @param {int} millis The number of milliseconds to tick. - */ - self.tick = function(millis) { - if (installed) { - delayedFunctionScheduler.tick(millis, function(millis) { - mockDate.tick(millis); - }); - } else { - throw new Error( - 'Mock clock is not installed, use jasmine.clock().install()' - ); - } - }; - - return self; - - function originalTimingFunctionsIntact() { - return ( - global.setTimeout === realTimingFunctions.setTimeout && - global.clearTimeout === realTimingFunctions.clearTimeout && - global.setInterval === realTimingFunctions.setInterval && - global.clearInterval === realTimingFunctions.clearInterval - ); - } - - function replace(dest, source) { - for (var prop in source) { - dest[prop] = source[prop]; - } - } - - function setTimeout(fn, delay) { - if (!NODE_JS) { - return delayedFunctionScheduler.scheduleFunction( - fn, - delay, - argSlice(arguments, 2) - ); - } - - var timeout = new FakeTimeout(); - - delayedFunctionScheduler.scheduleFunction( - fn, - delay, - argSlice(arguments, 2), - false, - timeout - ); - - return timeout; - } - - function clearTimeout(id) { - return delayedFunctionScheduler.removeFunctionWithId(id); - } - - function setInterval(fn, interval) { - if (!NODE_JS) { - return delayedFunctionScheduler.scheduleFunction( - fn, - interval, - argSlice(arguments, 2), - true - ); - } - - var timeout = new FakeTimeout(); - - delayedFunctionScheduler.scheduleFunction( - fn, - interval, - argSlice(arguments, 2), - true, - timeout - ); - - return timeout; - } - - function clearInterval(id) { - return delayedFunctionScheduler.removeFunctionWithId(id); - } - - function argSlice(argsObj, n) { - return Array.prototype.slice.call(argsObj, n); - } - } - - /** - * Mocks Node.js Timeout class - */ - function FakeTimeout() {} - - FakeTimeout.prototype.ref = function() { - return this; - }; - - FakeTimeout.prototype.unref = function() { - return this; - }; - - return Clock; -}; - -getJasmineRequireObj().DelayedFunctionScheduler = function(j$) { - function DelayedFunctionScheduler() { - var self = this; - var scheduledLookup = []; - var scheduledFunctions = {}; - var currentTime = 0; - var delayedFnCount = 0; - var deletedKeys = []; - - self.tick = function(millis, tickDate) { - millis = millis || 0; - var endTime = currentTime + millis; - - runScheduledFunctions(endTime, tickDate); - currentTime = endTime; - }; - - self.scheduleFunction = function( - funcToCall, - millis, - params, - recurring, - timeoutKey, - runAtMillis - ) { - var f; - if (typeof funcToCall === 'string') { - /* jshint evil: true */ - f = function() { - return eval(funcToCall); - }; - /* jshint evil: false */ - } else { - f = funcToCall; - } - - millis = millis || 0; - timeoutKey = timeoutKey || ++delayedFnCount; - runAtMillis = runAtMillis || currentTime + millis; - - var funcToSchedule = { - runAtMillis: runAtMillis, - funcToCall: f, - recurring: recurring, - params: params, - timeoutKey: timeoutKey, - millis: millis - }; - - if (runAtMillis in scheduledFunctions) { - scheduledFunctions[runAtMillis].push(funcToSchedule); - } else { - scheduledFunctions[runAtMillis] = [funcToSchedule]; - scheduledLookup.push(runAtMillis); - scheduledLookup.sort(function(a, b) { - return a - b; - }); - } - - return timeoutKey; - }; - - self.removeFunctionWithId = function(timeoutKey) { - deletedKeys.push(timeoutKey); - - for (var runAtMillis in scheduledFunctions) { - var funcs = scheduledFunctions[runAtMillis]; - var i = indexOfFirstToPass(funcs, function(func) { - return func.timeoutKey === timeoutKey; - }); - - if (i > -1) { - if (funcs.length === 1) { - delete scheduledFunctions[runAtMillis]; - deleteFromLookup(runAtMillis); - } else { - funcs.splice(i, 1); - } - - // intervals get rescheduled when executed, so there's never more - // than a single scheduled function with a given timeoutKey - break; - } - } - }; - - return self; - - function indexOfFirstToPass(array, testFn) { - var index = -1; - - for (var i = 0; i < array.length; ++i) { - if (testFn(array[i])) { - index = i; - break; - } - } - - return index; - } - - function deleteFromLookup(key) { - var value = Number(key); - var i = indexOfFirstToPass(scheduledLookup, function(millis) { - return millis === value; - }); - - if (i > -1) { - scheduledLookup.splice(i, 1); - } - } - - function reschedule(scheduledFn) { - self.scheduleFunction( - scheduledFn.funcToCall, - scheduledFn.millis, - scheduledFn.params, - true, - scheduledFn.timeoutKey, - scheduledFn.runAtMillis + scheduledFn.millis - ); - } - - function forEachFunction(funcsToRun, callback) { - for (var i = 0; i < funcsToRun.length; ++i) { - callback(funcsToRun[i]); - } - } - - function runScheduledFunctions(endTime, tickDate) { - tickDate = tickDate || function() {}; - if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) { - tickDate(endTime - currentTime); - return; - } - - do { - deletedKeys = []; - var newCurrentTime = scheduledLookup.shift(); - tickDate(newCurrentTime - currentTime); - - currentTime = newCurrentTime; - - var funcsToRun = scheduledFunctions[currentTime]; - - delete scheduledFunctions[currentTime]; - - forEachFunction(funcsToRun, function(funcToRun) { - if (funcToRun.recurring) { - reschedule(funcToRun); - } - }); - - forEachFunction(funcsToRun, function(funcToRun) { - if (j$.util.arrayContains(deletedKeys, funcToRun.timeoutKey)) { - // skip a timeoutKey deleted whilst we were running - return; - } - funcToRun.funcToCall.apply(null, funcToRun.params || []); - }); - deletedKeys = []; - } while ( - scheduledLookup.length > 0 && - // checking first if we're out of time prevents setTimeout(0) - // scheduled in a funcToRun from forcing an extra iteration - currentTime !== endTime && - scheduledLookup[0] <= endTime - ); - - // ran out of functions to call, but still time left on the clock - if (currentTime !== endTime) { - tickDate(endTime - currentTime); - } - } - } - - return DelayedFunctionScheduler; -}; - -getJasmineRequireObj().errors = function() { - function ExpectationFailed() {} - - ExpectationFailed.prototype = new Error(); - ExpectationFailed.prototype.constructor = ExpectationFailed; - - return { - ExpectationFailed: ExpectationFailed - }; -}; - -getJasmineRequireObj().ExceptionFormatter = function(j$) { - var ignoredProperties = [ - 'name', - 'message', - 'stack', - 'fileName', - 'sourceURL', - 'line', - 'lineNumber', - 'column', - 'description', - 'jasmineMessage' - ]; - - function ExceptionFormatter(options) { - var jasmineFile = (options && options.jasmineFile) || j$.util.jasmineFile(); - this.message = function(error) { - var message = ''; - - if (error.jasmineMessage) { - message += error.jasmineMessage; - } else if (error.name && error.message) { - message += error.name + ': ' + error.message; - } else if (error.message) { - message += error.message; - } else { - message += error.toString() + ' thrown'; - } - - if (error.fileName || error.sourceURL) { - message += ' in ' + (error.fileName || error.sourceURL); - } - - if (error.line || error.lineNumber) { - message += ' (line ' + (error.line || error.lineNumber) + ')'; - } - - return message; - }; - - this.stack = function(error) { - if (!error || !error.stack) { - return null; - } - - var stackTrace = new j$.StackTrace(error); - var lines = filterJasmine(stackTrace); - var result = ''; - - if (stackTrace.message) { - lines.unshift(stackTrace.message); - } - - result += formatProperties(error); - result += lines.join('\n'); - - return result; - }; - - function filterJasmine(stackTrace) { - var result = [], - jasmineMarker = - stackTrace.style === 'webkit' ? '' : ' at '; - - stackTrace.frames.forEach(function(frame) { - if (frame.file && frame.file !== jasmineFile) { - result.push(frame.raw); - } else if (result[result.length - 1] !== jasmineMarker) { - result.push(jasmineMarker); - } - }); - - return result; - } - - function formatProperties(error) { - if (!(error instanceof Object)) { - return; - } - - var result = {}; - var empty = true; - - for (var prop in error) { - if (j$.util.arrayContains(ignoredProperties, prop)) { - continue; - } - result[prop] = error[prop]; - empty = false; - } - - if (!empty) { - return 'error properties: ' + j$.pp(result) + '\n'; - } - - return ''; - } - } - - return ExceptionFormatter; -}; - -getJasmineRequireObj().Expectation = function(j$) { - /** - * Matchers that come with Jasmine out of the box. - * @namespace matchers - */ - function Expectation(options) { - this.expector = new j$.Expector(options); - - var customMatchers = options.customMatchers || {}; - for (var matcherName in customMatchers) { - this[matcherName] = wrapSyncCompare( - matcherName, - customMatchers[matcherName] - ); - } - } - - /** - * Add some context for an {@link expect} - * @function - * @name matchers#withContext - * @since 3.3.0 - * @param {String} message - Additional context to show when the matcher fails - * @return {matchers} - */ - Expectation.prototype.withContext = function withContext(message) { - return addFilter(this, new ContextAddingFilter(message)); - }; - - /** - * Invert the matcher following this {@link expect} - * @member - * @name matchers#not - * @since 1.3.0 - * @type {matchers} - * @example - * expect(something).not.toBe(true); - */ - Object.defineProperty(Expectation.prototype, 'not', { - get: function() { - return addFilter(this, syncNegatingFilter); - } - }); - - /** - * Asynchronous matchers. - * @namespace async-matchers - */ - function AsyncExpectation(options) { - var global = options.global || j$.getGlobal(); - this.expector = new j$.Expector(options); - - if (!global.Promise) { - throw new Error( - 'expectAsync is unavailable because the environment does not support promises.' - ); - } - - var customAsyncMatchers = options.customAsyncMatchers || {}; - for (var matcherName in customAsyncMatchers) { - this[matcherName] = wrapAsyncCompare( - matcherName, - customAsyncMatchers[matcherName] - ); - } - } - - /** - * Add some context for an {@link expectAsync} - * @function - * @name async-matchers#withContext - * @since 3.3.0 - * @param {String} message - Additional context to show when the async matcher fails - * @return {async-matchers} - */ - AsyncExpectation.prototype.withContext = function withContext(message) { - return addFilter(this, new ContextAddingFilter(message)); - }; - - /** - * Invert the matcher following this {@link expectAsync} - * @member - * @name async-matchers#not - * @type {async-matchers} - * @example - * await expectAsync(myPromise).not.toBeResolved(); - * @example - * return expectAsync(myPromise).not.toBeResolved(); - */ - Object.defineProperty(AsyncExpectation.prototype, 'not', { - get: function() { - return addFilter(this, asyncNegatingFilter); - } - }); - - function wrapSyncCompare(name, matcherFactory) { - return function() { - var result = this.expector.compare(name, matcherFactory, arguments); - this.expector.processResult(result); - }; - } - - function wrapAsyncCompare(name, matcherFactory) { - return function() { - var self = this; - - // Capture the call stack here, before we go async, so that it will contain - // frames that are relevant to the user instead of just parts of Jasmine. - var errorForStack = j$.util.errorWithStack(); - - return this.expector - .compare(name, matcherFactory, arguments) - .then(function(result) { - self.expector.processResult(result, errorForStack); - }); - }; - } - - function addCoreMatchers(prototype, matchers, wrapper) { - for (var matcherName in matchers) { - var matcher = matchers[matcherName]; - prototype[matcherName] = wrapper(matcherName, matcher); - } - } - - function addFilter(source, filter) { - var result = Object.create(source); - result.expector = source.expector.addFilter(filter); - return result; - } - - function negatedFailureMessage(result, matcherName, args, util) { - if (result.message) { - if (j$.isFunction_(result.message)) { - return result.message(); - } else { - return result.message; - } - } - - args = args.slice(); - args.unshift(true); - args.unshift(matcherName); - return util.buildFailureMessage.apply(null, args); - } - - function negate(result) { - result.pass = !result.pass; - return result; - } - - var syncNegatingFilter = { - selectComparisonFunc: function(matcher) { - function defaultNegativeCompare() { - return negate(matcher.compare.apply(null, arguments)); - } - - return matcher.negativeCompare || defaultNegativeCompare; - }, - buildFailureMessage: negatedFailureMessage - }; - - var asyncNegatingFilter = { - selectComparisonFunc: function(matcher) { - function defaultNegativeCompare() { - return matcher.compare.apply(this, arguments).then(negate); - } - - return matcher.negativeCompare || defaultNegativeCompare; - }, - buildFailureMessage: negatedFailureMessage - }; - - function ContextAddingFilter(message) { - this.message = message; - } - - ContextAddingFilter.prototype.modifyFailureMessage = function(msg) { - return this.message + ': ' + msg; - }; - - return { - factory: function(options) { - return new Expectation(options || {}); - }, - addCoreMatchers: function(matchers) { - addCoreMatchers(Expectation.prototype, matchers, wrapSyncCompare); - }, - asyncFactory: function(options) { - return new AsyncExpectation(options || {}); - }, - addAsyncCoreMatchers: function(matchers) { - addCoreMatchers(AsyncExpectation.prototype, matchers, wrapAsyncCompare); - } - }; -}; - -getJasmineRequireObj().ExpectationFilterChain = function() { - function ExpectationFilterChain(maybeFilter, prev) { - this.filter_ = maybeFilter; - this.prev_ = prev; - } - - ExpectationFilterChain.prototype.addFilter = function(filter) { - return new ExpectationFilterChain(filter, this); - }; - - ExpectationFilterChain.prototype.selectComparisonFunc = function(matcher) { - return this.callFirst_('selectComparisonFunc', arguments).result; - }; - - ExpectationFilterChain.prototype.buildFailureMessage = function( - result, - matcherName, - args, - util - ) { - return this.callFirst_('buildFailureMessage', arguments).result; - }; - - ExpectationFilterChain.prototype.modifyFailureMessage = function(msg) { - var result = this.callFirst_('modifyFailureMessage', arguments).result; - return result || msg; - }; - - ExpectationFilterChain.prototype.callFirst_ = function(fname, args) { - var prevResult; - - if (this.prev_) { - prevResult = this.prev_.callFirst_(fname, args); - - if (prevResult.found) { - return prevResult; - } - } - - if (this.filter_ && this.filter_[fname]) { - return { - found: true, - result: this.filter_[fname].apply(this.filter_, args) - }; - } - - return { found: false }; - }; - - return ExpectationFilterChain; -}; - -//TODO: expectation result may make more sense as a presentation of an expectation. -getJasmineRequireObj().buildExpectationResult = function() { - function buildExpectationResult(options) { - var messageFormatter = options.messageFormatter || function() {}, - stackFormatter = options.stackFormatter || function() {}; - - /** - * @typedef Expectation - * @property {String} matcherName - The name of the matcher that was executed for this expectation. - * @property {String} message - The failure message for the expectation. - * @property {String} stack - The stack trace for the failure if available. - * @property {Boolean} passed - Whether the expectation passed or failed. - * @property {Object} expected - If the expectation failed, what was the expected value. - * @property {Object} actual - If the expectation failed, what actual value was produced. - */ - var result = { - matcherName: options.matcherName, - message: message(), - stack: stack(), - passed: options.passed - }; - - if (!result.passed) { - result.expected = options.expected; - result.actual = options.actual; - } - - return result; - - function message() { - if (options.passed) { - return 'Passed.'; - } else if (options.message) { - return options.message; - } else if (options.error) { - return messageFormatter(options.error); - } - return ''; - } - - function stack() { - if (options.passed) { - return ''; - } - - var error = options.error; - if (!error) { - if (options.errorForStack) { - error = options.errorForStack; - } else if (options.stack) { - error = options; - } else { - try { - throw new Error(message()); - } catch (e) { - error = e; - } - } - } - return stackFormatter(error); - } - } - - return buildExpectationResult; -}; - -getJasmineRequireObj().Expector = function(j$) { - function Expector(options) { - this.util = options.util || { buildFailureMessage: function() {} }; - this.customEqualityTesters = options.customEqualityTesters || []; - this.actual = options.actual; - this.addExpectationResult = options.addExpectationResult || function() {}; - this.filters = new j$.ExpectationFilterChain(); - } - - Expector.prototype.instantiateMatcher = function( - matcherName, - matcherFactory, - args - ) { - this.matcherName = matcherName; - this.args = Array.prototype.slice.call(args, 0); - this.expected = this.args.slice(0); - - this.args.unshift(this.actual); - - var matcher = matcherFactory(this.util, this.customEqualityTesters); - var comparisonFunc = this.filters.selectComparisonFunc(matcher); - return comparisonFunc || matcher.compare; - }; - - Expector.prototype.buildMessage = function(result) { - var self = this; - - if (result.pass) { - return ''; - } - - var msg = this.filters.buildFailureMessage( - result, - this.matcherName, - this.args, - this.util, - defaultMessage - ); - return this.filters.modifyFailureMessage(msg || defaultMessage()); - - function defaultMessage() { - if (!result.message) { - var args = self.args.slice(); - args.unshift(false); - args.unshift(self.matcherName); - return self.util.buildFailureMessage.apply(null, args); - } else if (j$.isFunction_(result.message)) { - return result.message(); - } else { - return result.message; - } - } - }; - - Expector.prototype.compare = function(matcherName, matcherFactory, args) { - var matcherCompare = this.instantiateMatcher( - matcherName, - matcherFactory, - args - ); - return matcherCompare.apply(null, this.args); - }; - - Expector.prototype.addFilter = function(filter) { - var result = Object.create(this); - result.filters = this.filters.addFilter(filter); - return result; - }; - - Expector.prototype.processResult = function(result, errorForStack) { - var message = this.buildMessage(result); - - if (this.expected.length === 1) { - this.expected = this.expected[0]; - } - - this.addExpectationResult(result.pass, { - matcherName: this.matcherName, - passed: result.pass, - message: message, - error: errorForStack ? undefined : result.error, - errorForStack: errorForStack || undefined, - actual: this.actual, - expected: this.expected // TODO: this may need to be arrayified/sliced - }); - }; - - return Expector; -}; - -getJasmineRequireObj().formatErrorMsg = function() { - function generateErrorMsg(domain, usage) { - var usageDefinition = usage ? '\nUsage: ' + usage : ''; - - return function errorMsg(msg) { - return domain + ' : ' + msg + usageDefinition; - }; - } - - return generateErrorMsg; -}; - -getJasmineRequireObj().GlobalErrors = function(j$) { - function GlobalErrors(global) { - var handlers = []; - global = global || j$.getGlobal(); - - var onerror = function onerror() { - var handler = handlers[handlers.length - 1]; - - if (handler) { - handler.apply(null, Array.prototype.slice.call(arguments, 0)); - } else { - throw arguments[0]; - } - }; - - this.originalHandlers = {}; - this.jasmineHandlers = {}; - this.installOne_ = function installOne_(errorType, jasmineMessage) { - function taggedOnError(error) { - error.jasmineMessage = jasmineMessage + ': ' + error; - - var handler = handlers[handlers.length - 1]; - - if (handler) { - handler(error); - } else { - throw error; - } - } - - this.originalHandlers[errorType] = global.process.listeners(errorType); - this.jasmineHandlers[errorType] = taggedOnError; - - global.process.removeAllListeners(errorType); - global.process.on(errorType, taggedOnError); - - this.uninstall = function uninstall() { - var errorTypes = Object.keys(this.originalHandlers); - for (var iType = 0; iType < errorTypes.length; iType++) { - var errorType = errorTypes[iType]; - global.process.removeListener( - errorType, - this.jasmineHandlers[errorType] - ); - for (var i = 0; i < this.originalHandlers[errorType].length; i++) { - global.process.on(errorType, this.originalHandlers[errorType][i]); - } - delete this.originalHandlers[errorType]; - delete this.jasmineHandlers[errorType]; - } - }; - }; - - this.install = function install() { - if ( - global.process && - global.process.listeners && - j$.isFunction_(global.process.on) - ) { - this.installOne_('uncaughtException', 'Uncaught exception'); - this.installOne_('unhandledRejection', 'Unhandled promise rejection'); - } else { - var originalHandler = global.onerror; - global.onerror = onerror; - - this.uninstall = function uninstall() { - global.onerror = originalHandler; - }; - } - }; - - this.pushListener = function pushListener(listener) { - handlers.push(listener); - }; - - this.popListener = function popListener() { - handlers.pop(); - }; - } - - return GlobalErrors; -}; - -getJasmineRequireObj().toBeRejected = function(j$) { - /** - * Expect a promise to be rejected. - * @function - * @async - * @name async-matchers#toBeRejected - * @since 3.1.0 - * @example - * await expectAsync(aPromise).toBeRejected(); - * @example - * return expectAsync(aPromise).toBeRejected(); - */ - return function toBeRejected(util) { - return { - compare: function(actual) { - if (!j$.isPromiseLike(actual)) { - throw new Error('Expected toBeRejected to be called on a promise.'); - } - return actual.then( - function() { return {pass: false}; }, - function() { return {pass: true}; } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeRejectedWith = function(j$) { - /** - * Expect a promise to be rejected with a value equal to the expected, using deep equality comparison. - * @function - * @async - * @name async-matchers#toBeRejectedWith - * @since 3.3.0 - * @param {Object} expected - Value that the promise is expected to be rejected with - * @example - * await expectAsync(aPromise).toBeRejectedWith({prop: 'value'}); - * @example - * return expectAsync(aPromise).toBeRejectedWith({prop: 'value'}); - */ - return function toBeRejectedWith(util, customEqualityTesters) { - return { - compare: function(actualPromise, expectedValue) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error('Expected toBeRejectedWith to be called on a promise.'); - } - - function prefix(passed) { - return 'Expected a promise ' + - (passed ? 'not ' : '') + - 'to be rejected with ' + j$.pp(expectedValue); - } - - return actualPromise.then( - function() { - return { - pass: false, - message: prefix(false) + ' but it was resolved.' - }; - }, - function(actualValue) { - if (util.equals(actualValue, expectedValue, customEqualityTesters)) { - return { - pass: true, - message: prefix(true) + '.' - }; - } else { - return { - pass: false, - message: prefix(false) + ' but it was rejected with ' + j$.pp(actualValue) + '.' - }; - } - } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeRejectedWithError = function(j$) { - /** - * Expect a promise to be rejected with a value matched to the expected - * @function - * @async - * @name async-matchers#toBeRejectedWithError - * @since 3.5.0 - * @param {Error} [expected] - `Error` constructor the object that was thrown needs to be an instance of. If not provided, `Error` will be used. - * @param {RegExp|String} [message] - The message that should be set on the thrown `Error` - * @example - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError, 'Error message'); - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError, /Error message/); - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError); - * await expectAsync(aPromise).toBeRejectedWithError('Error message'); - * return expectAsync(aPromise).toBeRejectedWithError(/Error message/); - */ - return function toBeRejectedWithError() { - return { - compare: function(actualPromise, arg1, arg2) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error('Expected toBeRejectedWithError to be called on a promise.'); - } - - var expected = getExpectedFromArgs(arg1, arg2); - - return actualPromise.then( - function() { - return { - pass: false, - message: 'Expected a promise to be rejected but it was resolved.' - }; - }, - function(actualValue) { return matchError(actualValue, expected); } - ); - } - }; - }; - - function matchError(actual, expected) { - if (!j$.isError_(actual)) { - return fail(expected, 'rejected with ' + j$.pp(actual)); - } - - if (!(actual instanceof expected.error)) { - return fail(expected, 'rejected with type ' + j$.fnNameFor(actual.constructor)); - } - - var actualMessage = actual.message; - - if (actualMessage === expected.message || typeof expected.message === 'undefined') { - return pass(expected); - } - - if (expected.message instanceof RegExp && expected.message.test(actualMessage)) { - return pass(expected); - } - - return fail(expected, 'rejected with ' + j$.pp(actual)); - } - - function pass(expected) { - return { - pass: true, - message: 'Expected a promise not to be rejected with ' + expected.printValue + ', but it was.' - }; - } - - function fail(expected, message) { - return { - pass: false, - message: 'Expected a promise to be rejected with ' + expected.printValue + ' but it was ' + message + '.' - }; - } - - - function getExpectedFromArgs(arg1, arg2) { - var error, message; - - if (isErrorConstructor(arg1)) { - error = arg1; - message = arg2; - } else { - error = Error; - message = arg1; - } - - return { - error: error, - message: message, - printValue: j$.fnNameFor(error) + (typeof message === 'undefined' ? '' : ': ' + j$.pp(message)) - }; - } - - function isErrorConstructor(value) { - return typeof value === 'function' && (value === Error || j$.isError_(value.prototype)); - } -}; - -getJasmineRequireObj().toBeResolved = function(j$) { - /** - * Expect a promise to be resolved. - * @function - * @async - * @name async-matchers#toBeResolved - * @since 3.1.0 - * @example - * await expectAsync(aPromise).toBeResolved(); - * @example - * return expectAsync(aPromise).toBeResolved(); - */ - return function toBeResolved(util) { - return { - compare: function(actual) { - if (!j$.isPromiseLike(actual)) { - throw new Error('Expected toBeResolved to be called on a promise.'); - } - - return actual.then( - function() { return {pass: true}; }, - function() { return {pass: false}; } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeResolvedTo = function(j$) { - /** - * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison. - * @function - * @async - * @name async-matchers#toBeResolvedTo - * @since 3.1.0 - * @param {Object} expected - Value that the promise is expected to resolve to - * @example - * await expectAsync(aPromise).toBeResolvedTo({prop: 'value'}); - * @example - * return expectAsync(aPromise).toBeResolvedTo({prop: 'value'}); - */ - return function toBeResolvedTo(util, customEqualityTesters) { - return { - compare: function(actualPromise, expectedValue) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error('Expected toBeResolvedTo to be called on a promise.'); - } - - function prefix(passed) { - return 'Expected a promise ' + - (passed ? 'not ' : '') + - 'to be resolved to ' + j$.pp(expectedValue); - } - - return actualPromise.then( - function(actualValue) { - if (util.equals(actualValue, expectedValue, customEqualityTesters)) { - return { - pass: true, - message: prefix(true) + '.' - }; - } else { - return { - pass: false, - message: prefix(false) + ' but it was resolved to ' + j$.pp(actualValue) + '.' - }; - } - }, - function() { - return { - pass: false, - message: prefix(false) + ' but it was rejected.' - }; - } - ); - } - }; - }; -}; - -getJasmineRequireObj().DiffBuilder = function(j$) { - return function DiffBuilder() { - var path = new j$.ObjectPath(), - mismatches = []; - - return { - record: function (actual, expected, formatter) { - formatter = formatter || defaultFormatter; - mismatches.push(formatter(actual, expected, path)); - }, - - getMessage: function () { - return mismatches.join('\n'); - }, - - withPath: function (pathComponent, block) { - var oldPath = path; - path = path.add(pathComponent); - block(); - path = oldPath; - } - }; - - function defaultFormatter (actual, expected, path) { - return 'Expected ' + - path + (path.depth() ? ' = ' : '') + - j$.pp(actual) + - ' to equal ' + - j$.pp(expected) + - '.'; - } - }; -}; - -getJasmineRequireObj().matchersUtil = function(j$) { - // TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter? - - return { - equals: equals, - - contains: function(haystack, needle, customTesters) { - customTesters = customTesters || []; - - if (j$.isSet(haystack)) { - return haystack.has(needle); - } - - if ((Object.prototype.toString.apply(haystack) === '[object Array]') || - (!!haystack && !haystack.indexOf)) - { - for (var i = 0; i < haystack.length; i++) { - if (equals(haystack[i], needle, customTesters)) { - return true; - } - } - return false; - } - - return !!haystack && haystack.indexOf(needle) >= 0; - }, - - buildFailureMessage: function() { - var args = Array.prototype.slice.call(arguments, 0), - matcherName = args[0], - isNot = args[1], - actual = args[2], - expected = args.slice(3), - englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - - var message = 'Expected ' + - j$.pp(actual) + - (isNot ? ' not ' : ' ') + - englishyPredicate; - - if (expected.length > 0) { - for (var i = 0; i < expected.length; i++) { - if (i > 0) { - message += ','; - } - message += ' ' + j$.pp(expected[i]); - } - } - - return message + '.'; - } - }; - - function isAsymmetric(obj) { - return obj && j$.isA_('Function', obj.asymmetricMatch); - } - - function asymmetricMatch(a, b, customTesters, diffBuilder) { - var asymmetricA = isAsymmetric(a), - asymmetricB = isAsymmetric(b), - result; - - if (asymmetricA && asymmetricB) { - return undefined; - } - - if (asymmetricA) { - result = a.asymmetricMatch(b, customTesters); - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - - if (asymmetricB) { - result = b.asymmetricMatch(a, customTesters); - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - } - - function equals(a, b, customTesters, diffBuilder) { - customTesters = customTesters || []; - diffBuilder = diffBuilder || j$.NullDiffBuilder(); - - return eq(a, b, [], [], customTesters, diffBuilder); - } - - // Equality function lovingly adapted from isEqual in - // [Underscore](http://underscorejs.org) - function eq(a, b, aStack, bStack, customTesters, diffBuilder) { - var result = true, i; - - var asymmetricResult = asymmetricMatch(a, b, customTesters, diffBuilder); - if (!j$.util.isUndefined(asymmetricResult)) { - return asymmetricResult; - } - - for (i = 0; i < customTesters.length; i++) { - var customTesterResult = customTesters[i](a, b); - if (!j$.util.isUndefined(customTesterResult)) { - if (!customTesterResult) { - diffBuilder.record(a, b); - } - return customTesterResult; - } - } - - if (a instanceof Error && b instanceof Error) { - result = a.message == b.message; - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) { - result = a !== 0 || 1 / a == 1 / b; - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - // A strict comparison is necessary because `null == undefined`. - if (a === null || b === null) { - result = a === b; - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - var className = Object.prototype.toString.call(a); - if (className != Object.prototype.toString.call(b)) { - diffBuilder.record(a, b); - return false; - } - switch (className) { - // Strings, numbers, dates, and booleans are compared by value. - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - result = a == String(b); - if (!result) { - diffBuilder.record(a, b); - } - return result; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for - // other numeric values. - result = a != +a ? b != +b : (a === 0 ? 1 / a == 1 / b : a == +b); - if (!result) { - diffBuilder.record(a, b); - } - return result; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - result = +a == +b; - if (!result) { - diffBuilder.record(a, b); - } - return result; - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source == b.source && - a.global == b.global && - a.multiline == b.multiline && - a.ignoreCase == b.ignoreCase; - } - if (typeof a != 'object' || typeof b != 'object') { - diffBuilder.record(a, b); - return false; - } - - var aIsDomNode = j$.isDomNode(a); - var bIsDomNode = j$.isDomNode(b); - if (aIsDomNode && bIsDomNode) { - // At first try to use DOM3 method isEqualNode - result = a.isEqualNode(b); - if (!result) { - diffBuilder.record(a, b); - } - return result; - } - if (aIsDomNode || bIsDomNode) { - diffBuilder.record(a, b); - return false; - } - - var aIsPromise = j$.isPromise(a); - var bIsPromise = j$.isPromise(b); - if (aIsPromise && bIsPromise) { - return a === b; - } - - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] == a) { return bStack[length] == b; } - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - var size = 0; - // Recursively compare objects and arrays. - // Compare array lengths to determine if a deep comparison is necessary. - if (className == '[object Array]') { - var aLength = a.length; - var bLength = b.length; - - diffBuilder.withPath('length', function() { - if (aLength !== bLength) { - diffBuilder.record(aLength, bLength); - result = false; - } - }); - - for (i = 0; i < aLength || i < bLength; i++) { - diffBuilder.withPath(i, function() { - if (i >= bLength) { - diffBuilder.record(a[i], void 0, actualArrayIsLongerFormatter); - result = false; - } else { - result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result; - } - }); - } - if (!result) { - return false; - } - } else if (j$.isMap(a) && j$.isMap(b)) { - if (a.size != b.size) { - diffBuilder.record(a, b); - return false; - } - - var keysA = []; - var keysB = []; - a.forEach( function( valueA, keyA ) { - keysA.push( keyA ); - }); - b.forEach( function( valueB, keyB ) { - keysB.push( keyB ); - }); - - // For both sets of keys, check they map to equal values in both maps. - // Keep track of corresponding keys (in insertion order) in order to handle asymmetric obj keys. - var mapKeys = [keysA, keysB]; - var cmpKeys = [keysB, keysA]; - var mapIter, mapKey, mapValueA, mapValueB; - var cmpIter, cmpKey; - for (i = 0; result && i < mapKeys.length; i++) { - mapIter = mapKeys[i]; - cmpIter = cmpKeys[i]; - - for (var j = 0; result && j < mapIter.length; j++) { - mapKey = mapIter[j]; - cmpKey = cmpIter[j]; - mapValueA = a.get(mapKey); - - // Only use the cmpKey when one of the keys is asymmetric and the corresponding key matches, - // otherwise explicitly look up the mapKey in the other Map since we want keys with unique - // obj identity (that are otherwise equal) to not match. - if (isAsymmetric(mapKey) || isAsymmetric(cmpKey) && - eq(mapKey, cmpKey, aStack, bStack, customTesters, j$.NullDiffBuilder())) { - mapValueB = b.get(cmpKey); - } else { - mapValueB = b.get(mapKey); - } - result = eq(mapValueA, mapValueB, aStack, bStack, customTesters, j$.NullDiffBuilder()); - } - } - - if (!result) { - diffBuilder.record(a, b); - return false; - } - } else if (j$.isSet(a) && j$.isSet(b)) { - if (a.size != b.size) { - diffBuilder.record(a, b); - return false; - } - - var valuesA = []; - a.forEach( function( valueA ) { - valuesA.push( valueA ); - }); - var valuesB = []; - b.forEach( function( valueB ) { - valuesB.push( valueB ); - }); - - // For both sets, check they are all contained in the other set - var setPairs = [[valuesA, valuesB], [valuesB, valuesA]]; - var stackPairs = [[aStack, bStack], [bStack, aStack]]; - var baseValues, baseValue, baseStack; - var otherValues, otherValue, otherStack; - var found; - var prevStackSize; - for (i = 0; result && i < setPairs.length; i++) { - baseValues = setPairs[i][0]; - otherValues = setPairs[i][1]; - baseStack = stackPairs[i][0]; - otherStack = stackPairs[i][1]; - // For each value in the base set... - for (var k = 0; result && k < baseValues.length; k++) { - baseValue = baseValues[k]; - found = false; - // ... test that it is present in the other set - for (var l = 0; !found && l < otherValues.length; l++) { - otherValue = otherValues[l]; - prevStackSize = baseStack.length; - // compare by value equality - found = eq(baseValue, otherValue, baseStack, otherStack, customTesters, j$.NullDiffBuilder()); - if (!found && prevStackSize !== baseStack.length) { - baseStack.splice(prevStackSize); - otherStack.splice(prevStackSize); - } - } - result = result && found; - } - } - - if (!result) { - diffBuilder.record(a, b); - return false; - } - } else { - - // Objects with different constructors are not equivalent, but `Object`s - // or `Array`s from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && - isFunction(aCtor) && isFunction(bCtor) && - a instanceof aCtor && b instanceof bCtor && - !(aCtor instanceof aCtor && bCtor instanceof bCtor)) { - - diffBuilder.record(a, b, constructorsAreDifferentFormatter); - return false; - } - } - - // Deep compare objects. - var aKeys = keys(a, className == '[object Array]'), key; - size = aKeys.length; - - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (keys(b, className == '[object Array]').length !== size) { - diffBuilder.record(a, b, objectKeysAreDifferentFormatter); - return false; - } - - for (i = 0; i < size; i++) { - key = aKeys[i]; - // Deep compare each member - if (!j$.util.has(b, key)) { - diffBuilder.record(a, b, objectKeysAreDifferentFormatter); - result = false; - continue; - } - - diffBuilder.withPath(key, function() { - if(!eq(a[key], b[key], aStack, bStack, customTesters, diffBuilder)) { - result = false; - } - }); - } - - if (!result) { - return false; - } - - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - - return result; - } - - function keys(obj, isArray) { - var allKeys = Object.keys ? Object.keys(obj) : - (function(o) { - var keys = []; - for (var key in o) { - if (j$.util.has(o, key)) { - keys.push(key); - } - } - return keys; - })(obj); - - if (!isArray) { - return allKeys; - } - - if (allKeys.length === 0) { - return allKeys; - } - - var extraKeys = []; - for (var i = 0; i < allKeys.length; i++) { - if (!/^[0-9]+$/.test(allKeys[i])) { - extraKeys.push(allKeys[i]); - } - } - - return extraKeys; - } - - function isFunction(obj) { - return typeof obj === 'function'; - } - - function objectKeysAreDifferentFormatter(actual, expected, path) { - var missingProperties = j$.util.objectDifference(expected, actual), - extraProperties = j$.util.objectDifference(actual, expected), - missingPropertiesMessage = formatKeyValuePairs(missingProperties), - extraPropertiesMessage = formatKeyValuePairs(extraProperties), - messages = []; - - if (!path.depth()) { - path = 'object'; - } - - if (missingPropertiesMessage.length) { - messages.push('Expected ' + path + ' to have properties' + missingPropertiesMessage); - } - - if (extraPropertiesMessage.length) { - messages.push('Expected ' + path + ' not to have properties' + extraPropertiesMessage); - } - - return messages.join('\n'); - } - - function constructorsAreDifferentFormatter(actual, expected, path) { - if (!path.depth()) { - path = 'object'; - } - - return 'Expected ' + - path + ' to be a kind of ' + - j$.fnNameFor(expected.constructor) + - ', but was ' + j$.pp(actual) + '.'; - } - - function actualArrayIsLongerFormatter(actual, expected, path) { - return 'Unexpected ' + - path + (path.depth() ? ' = ' : '') + - j$.pp(actual) + - ' in array.'; - } - - function formatKeyValuePairs(obj) { - var formatted = ''; - for (var key in obj) { - formatted += '\n ' + key + ': ' + j$.pp(obj[key]); - } - return formatted; - } -}; - -getJasmineRequireObj().nothing = function() { - /** - * {@link expect} nothing explicitly. - * @function - * @name matchers#nothing - * @since 2.8.0 - * @example - * expect().nothing(); - */ - function nothing() { - return { - compare: function() { - return { - pass: true - }; - } - }; - } - - return nothing; -}; - -getJasmineRequireObj().NullDiffBuilder = function(j$) { - return function() { - return { - withPath: function(_, block) { - block(); - }, - record: function() {} - }; - }; -}; - -getJasmineRequireObj().ObjectPath = function(j$) { - function ObjectPath(components) { - this.components = components || []; - } - - ObjectPath.prototype.toString = function() { - if (this.components.length) { - return '$' + map(this.components, formatPropertyAccess).join(''); - } else { - return ''; - } - }; - - ObjectPath.prototype.add = function(component) { - return new ObjectPath(this.components.concat([component])); - }; - - ObjectPath.prototype.depth = function() { - return this.components.length; - }; - - function formatPropertyAccess(prop) { - if (typeof prop === 'number') { - return '[' + prop + ']'; - } - - if (isValidIdentifier(prop)) { - return '.' + prop; - } - - return '[\'' + prop + '\']'; - } - - function map(array, fn) { - var results = []; - for (var i = 0; i < array.length; i++) { - results.push(fn(array[i])); - } - return results; - } - - function isValidIdentifier(string) { - return /^[A-Za-z\$_][A-Za-z0-9\$_]*$/.test(string); - } - - return ObjectPath; -}; - -getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) { - var availableMatchers = [ - 'toBeResolved', - 'toBeRejected', - 'toBeResolvedTo', - 'toBeRejectedWith', - 'toBeRejectedWithError' - ], - matchers = {}; - - for (var i = 0; i < availableMatchers.length; i++) { - var name = availableMatchers[i]; - matchers[name] = jRequire[name](j$); - } - - return matchers; -}; - -getJasmineRequireObj().toBe = function(j$) { - /** - * {@link expect} the actual value to be `===` to the expected value. - * @function - * @name matchers#toBe - * @since 1.3.0 - * @param {Object} expected - The expected value to compare against. - * @example - * expect(thing).toBe(realThing); - */ - function toBe(util) { - var tip = ' Tip: To check for deep equality, use .toEqual() instead of .toBe().'; - - return { - compare: function(actual, expected) { - var result = { - pass: actual === expected - }; - - if (typeof expected === 'object') { - result.message = util.buildFailureMessage('toBe', result.pass, actual, expected) + tip; - } - - return result; - } - }; - } - - return toBe; -}; - -getJasmineRequireObj().toBeCloseTo = function() { - /** - * {@link expect} the actual value to be within a specified precision of the expected value. - * @function - * @name matchers#toBeCloseTo - * @since 1.3.0 - * @param {Object} expected - The expected value to compare against. - * @param {Number} [precision=2] - The number of decimal points to check. - * @example - * expect(number).toBeCloseTo(42.2, 3); - */ - function toBeCloseTo() { - return { - compare: function(actual, expected, precision) { - if (precision !== 0) { - precision = precision || 2; - } - - if (expected === null || actual === null) { - throw new Error('Cannot use toBeCloseTo with null. Arguments evaluated to: ' + - 'expect(' + actual + ').toBeCloseTo(' + expected + ').' - ); - } - - var pow = Math.pow(10, precision + 1); - var delta = Math.abs(expected - actual); - var maxDelta = Math.pow(10, -precision) / 2; - - return { - pass: Math.round(delta * pow) <= maxDelta * pow - }; - } - }; - } - - return toBeCloseTo; -}; - -getJasmineRequireObj().toBeDefined = function() { - /** - * {@link expect} the actual value to be defined. (Not `undefined`) - * @function - * @name matchers#toBeDefined - * @since 1.3.0 - * @example - * expect(result).toBeDefined(); - */ - function toBeDefined() { - return { - compare: function(actual) { - return { - pass: (void 0 !== actual) - }; - } - }; - } - - return toBeDefined; -}; - -getJasmineRequireObj().toBeFalse = function() { - /** - * {@link expect} the actual value to be `false`. - * @function - * @name matchers#toBeFalse - * @since 3.5.0 - * @example - * expect(result).toBeFalse(); - */ - function toBeFalse() { - return { - compare: function(actual) { - return { - pass: actual === false - }; - } - }; - } - - return toBeFalse; -}; - -getJasmineRequireObj().toBeFalsy = function() { - /** - * {@link expect} the actual value to be falsy - * @function - * @name matchers#toBeFalsy - * @since 2.0.0 - * @example - * expect(result).toBeFalsy(); - */ - function toBeFalsy() { - return { - compare: function(actual) { - return { - pass: !actual - }; - } - }; - } - - return toBeFalsy; -}; - -getJasmineRequireObj().toBeGreaterThan = function() { - /** - * {@link expect} the actual value to be greater than the expected value. - * @function - * @name matchers#toBeGreaterThan - * @since 2.0.0 - * @param {Number} expected - The value to compare against. - * @example - * expect(result).toBeGreaterThan(3); - */ - function toBeGreaterThan() { - return { - compare: function(actual, expected) { - return { - pass: actual > expected - }; - } - }; - } - - return toBeGreaterThan; -}; - - -getJasmineRequireObj().toBeGreaterThanOrEqual = function() { - /** - * {@link expect} the actual value to be greater than or equal to the expected value. - * @function - * @name matchers#toBeGreaterThanOrEqual - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeGreaterThanOrEqual(25); - */ - function toBeGreaterThanOrEqual() { - return { - compare: function(actual, expected) { - return { - pass: actual >= expected - }; - } - }; - } - - return toBeGreaterThanOrEqual; -}; - -getJasmineRequireObj().toBeInstanceOf = function(j$) { - var usageError = j$.formatErrorMsg('', 'expect(value).toBeInstanceOf()'); - - /** - * {@link expect} the actual to be an instance of the expected class - * @function - * @name matchers#toBeInstanceOf - * @since 3.5.0 - * @param {Object} expected - The class or constructor function to check for - * @example - * expect('foo').toBeInstanceOf(String); - * expect(3).toBeInstanceOf(Number); - * expect(new Error()).toBeInstanceOf(Error); - */ - function toBeInstanceOf(util, customEqualityTesters) { - return { - compare: function(actual, expected) { - var actualType = actual && actual.constructor ? j$.fnNameFor(actual.constructor) : j$.pp(actual), - expectedType = expected ? j$.fnNameFor(expected) : j$.pp(expected), - expectedMatcher, - pass; - - try { - expectedMatcher = new j$.Any(expected); - pass = expectedMatcher.asymmetricMatch(actual); - } catch (error) { - throw new Error(usageError('Expected value is not a constructor function')); - } - - if (pass) { - return { - pass: true, - message: 'Expected instance of ' + actualType + ' not to be an instance of ' + expectedType - }; - } else { - return { - pass: false, - message: 'Expected instance of ' + actualType + ' to be an instance of ' + expectedType - }; - } - } - }; - } - - return toBeInstanceOf; -}; - -getJasmineRequireObj().toBeLessThan = function() { - /** - * {@link expect} the actual value to be less than the expected value. - * @function - * @name matchers#toBeLessThan - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeLessThan(0); - */ - function toBeLessThan() { - return { - - compare: function(actual, expected) { - return { - pass: actual < expected - }; - } - }; - } - - return toBeLessThan; -}; - -getJasmineRequireObj().toBeLessThanOrEqual = function() { - /** - * {@link expect} the actual value to be less than or equal to the expected value. - * @function - * @name matchers#toBeLessThanOrEqual - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeLessThanOrEqual(123); - */ - function toBeLessThanOrEqual() { - return { - - compare: function(actual, expected) { - return { - pass: actual <= expected - }; - } - }; - } - - return toBeLessThanOrEqual; -}; - -getJasmineRequireObj().toBeNaN = function(j$) { - /** - * {@link expect} the actual value to be `NaN` (Not a Number). - * @function - * @name matchers#toBeNaN - * @since 1.3.0 - * @example - * expect(thing).toBeNaN(); - */ - function toBeNaN() { - return { - compare: function(actual) { - var result = { - pass: (actual !== actual) - }; - - if (result.pass) { - result.message = 'Expected actual not to be NaN.'; - } else { - result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; }; - } - - return result; - } - }; - } - - return toBeNaN; -}; - -getJasmineRequireObj().toBeNegativeInfinity = function(j$) { - /** - * {@link expect} the actual value to be `-Infinity` (-infinity). - * @function - * @name matchers#toBeNegativeInfinity - * @since 2.6.0 - * @example - * expect(thing).toBeNegativeInfinity(); - */ - function toBeNegativeInfinity() { - return { - compare: function(actual) { - var result = { - pass: (actual === Number.NEGATIVE_INFINITY) - }; - - if (result.pass) { - result.message = 'Expected actual not to be -Infinity.'; - } else { - result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be -Infinity.'; }; - } - - return result; - } - }; - } - - return toBeNegativeInfinity; -}; - -getJasmineRequireObj().toBeNull = function() { - /** - * {@link expect} the actual value to be `null`. - * @function - * @name matchers#toBeNull - * @since 1.3.0 - * @example - * expect(result).toBeNull(); - */ - function toBeNull() { - return { - compare: function(actual) { - return { - pass: actual === null - }; - } - }; - } - - return toBeNull; -}; - -getJasmineRequireObj().toBePositiveInfinity = function(j$) { - /** - * {@link expect} the actual value to be `Infinity` (infinity). - * @function - * @name matchers#toBePositiveInfinity - * @since 2.6.0 - * @example - * expect(thing).toBePositiveInfinity(); - */ - function toBePositiveInfinity() { - return { - compare: function(actual) { - var result = { - pass: (actual === Number.POSITIVE_INFINITY) - }; - - if (result.pass) { - result.message = 'Expected actual not to be Infinity.'; - } else { - result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be Infinity.'; }; - } - - return result; - } - }; - } - - return toBePositiveInfinity; -}; - -getJasmineRequireObj().toBeTrue = function() { - /** - * {@link expect} the actual value to be `true`. - * @function - * @name matchers#toBeTrue - * @since 3.5.0 - * @example - * expect(result).toBeTrue(); - */ - function toBeTrue() { - return { - compare: function(actual) { - return { - pass: actual === true - }; - } - }; - } - - return toBeTrue; -}; - -getJasmineRequireObj().toBeTruthy = function() { - /** - * {@link expect} the actual value to be truthy. - * @function - * @name matchers#toBeTruthy - * @since 2.0.0 - * @example - * expect(thing).toBeTruthy(); - */ - function toBeTruthy() { - return { - compare: function(actual) { - return { - pass: !!actual - }; - } - }; - } - - return toBeTruthy; -}; - -getJasmineRequireObj().toBeUndefined = function() { - /** - * {@link expect} the actual value to be `undefined`. - * @function - * @name matchers#toBeUndefined - * @since 1.3.0 - * @example - * expect(result).toBeUndefined(): - */ - function toBeUndefined() { - return { - compare: function(actual) { - return { - pass: void 0 === actual - }; - } - }; - } - - return toBeUndefined; -}; - -getJasmineRequireObj().toContain = function() { - /** - * {@link expect} the actual value to contain a specific value. - * @function - * @name matchers#toContain - * @since 2.0.0 - * @param {Object} expected - The value to look for. - * @example - * expect(array).toContain(anElement); - * expect(string).toContain(substring); - */ - function toContain(util, customEqualityTesters) { - customEqualityTesters = customEqualityTesters || []; - - return { - compare: function(actual, expected) { - - return { - pass: util.contains(actual, expected, customEqualityTesters) - }; - } - }; - } - - return toContain; -}; - -getJasmineRequireObj().toEqual = function(j$) { - /** - * {@link expect} the actual value to be equal to the expected, using deep equality comparison. - * @function - * @name matchers#toEqual - * @since 1.3.0 - * @param {Object} expected - Expected value - * @example - * expect(bigObject).toEqual({"foo": ['bar', 'baz']}); - */ - function toEqual(util, customEqualityTesters) { - customEqualityTesters = customEqualityTesters || []; - - return { - compare: function(actual, expected) { - var result = { - pass: false - }, - diffBuilder = j$.DiffBuilder(); - - result.pass = util.equals(actual, expected, customEqualityTesters, diffBuilder); - - // TODO: only set error message if test fails - result.message = diffBuilder.getMessage(); - - return result; - } - }; - } - - return toEqual; -}; - -getJasmineRequireObj().toHaveBeenCalled = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalled()'); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called. - * @function - * @name matchers#toHaveBeenCalled - * @since 1.3.0 - * @example - * expect(mySpy).toHaveBeenCalled(); - * expect(mySpy).not.toHaveBeenCalled(); - */ - function toHaveBeenCalled() { - return { - compare: function(actual) { - var result = {}; - - if (!j$.isSpy(actual)) { - throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.')); - } - - if (arguments.length > 1) { - throw new Error(getErrorMsg('Does not take arguments, use toHaveBeenCalledWith')); - } - - result.pass = actual.calls.any(); - - result.message = result.pass ? - 'Expected spy ' + actual.and.identity + ' not to have been called.' : - 'Expected spy ' + actual.and.identity + ' to have been called.'; - - return result; - } - }; - } - - return toHaveBeenCalled; -}; - -getJasmineRequireObj().toHaveBeenCalledBefore = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalledBefore()'); - - /** - * {@link expect} the actual value (a {@link Spy}) to have been called before another {@link Spy}. - * @function - * @name matchers#toHaveBeenCalledBefore - * @since 2.6.0 - * @param {Spy} expected - {@link Spy} that should have been called after the `actual` {@link Spy}. - * @example - * expect(mySpy).toHaveBeenCalledBefore(otherSpy); - */ - function toHaveBeenCalledBefore() { - return { - compare: function(firstSpy, latterSpy) { - if (!j$.isSpy(firstSpy)) { - throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(firstSpy) + '.')); - } - if (!j$.isSpy(latterSpy)) { - throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(latterSpy) + '.')); - } - - var result = { pass: false }; - - if (!firstSpy.calls.count()) { - result.message = 'Expected spy ' + firstSpy.and.identity + ' to have been called.'; - return result; - } - if (!latterSpy.calls.count()) { - result.message = 'Expected spy ' + latterSpy.and.identity + ' to have been called.'; - return result; - } - - var latest1stSpyCall = firstSpy.calls.mostRecent().invocationOrder; - var first2ndSpyCall = latterSpy.calls.first().invocationOrder; - - result.pass = latest1stSpyCall < first2ndSpyCall; - - if (result.pass) { - result.message = 'Expected spy ' + firstSpy.and.identity + ' to not have been called before spy ' + latterSpy.and.identity + ', but it was'; - } else { - var first1stSpyCall = firstSpy.calls.first().invocationOrder; - var latest2ndSpyCall = latterSpy.calls.mostRecent().invocationOrder; - - if(first1stSpyCall < first2ndSpyCall) { - result.message = 'Expected latest call to spy ' + firstSpy.and.identity + ' to have been called before first call to spy ' + latterSpy.and.identity + ' (no interleaved calls)'; - } else if (latest2ndSpyCall > latest1stSpyCall) { - result.message = 'Expected first call to spy ' + latterSpy.and.identity + ' to have been called after latest call to spy ' + firstSpy.and.identity + ' (no interleaved calls)'; - } else { - result.message = 'Expected spy ' + firstSpy.and.identity + ' to have been called before spy ' + latterSpy.and.identity; - } - } - - return result; - } - }; - } - - return toHaveBeenCalledBefore; -}; - -getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalledTimes()'); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called the specified number of times. - * @function - * @name matchers#toHaveBeenCalledTimes - * @since 2.4.0 - * @param {Number} expected - The number of invocations to look for. - * @example - * expect(mySpy).toHaveBeenCalledTimes(3); - */ - function toHaveBeenCalledTimes() { - return { - compare: function(actual, expected) { - if (!j$.isSpy(actual)) { - throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.')); - } - - var args = Array.prototype.slice.call(arguments, 0), - result = { pass: false }; - - if (!j$.isNumber_(expected)) { - throw new Error(getErrorMsg('The expected times failed is a required argument and must be a number.')); - } - - actual = args[0]; - var calls = actual.calls.count(); - var timesMessage = expected === 1 ? 'once' : expected + ' times'; - result.pass = calls === expected; - result.message = result.pass ? - 'Expected spy ' + actual.and.identity + ' not to have been called ' + timesMessage + '. It was called ' + calls + ' times.' : - 'Expected spy ' + actual.and.identity + ' to have been called ' + timesMessage + '. It was called ' + calls + ' times.'; - return result; - } - }; - } - - return toHaveBeenCalledTimes; -}; - -getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect().toHaveBeenCalledWith(...arguments)'); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called with particular arguments at least once. - * @function - * @name matchers#toHaveBeenCalledWith - * @since 1.3.0 - * @param {...Object} - The arguments to look for - * @example - * expect(mySpy).toHaveBeenCalledWith('foo', 'bar', 2); - */ - function toHaveBeenCalledWith(util, customEqualityTesters) { - return { - compare: function() { - var args = Array.prototype.slice.call(arguments, 0), - actual = args[0], - expectedArgs = args.slice(1), - result = { pass: false }; - - if (!j$.isSpy(actual)) { - throw new Error(getErrorMsg('Expected a spy, but got ' + j$.pp(actual) + '.')); - } - - if (!actual.calls.any()) { - result.message = function() { - return 'Expected spy ' + actual.and.identity + ' to have been called with:\n' + - ' ' + j$.pp(expectedArgs) + - '\nbut it was never called.'; - }; - return result; - } - - if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) { - result.pass = true; - result.message = function() { - return 'Expected spy ' + actual.and.identity + ' not to have been called with:\n' + - ' ' + j$.pp(expectedArgs) + - '\nbut it was.'; - }; - } else { - result.message = function() { - var prettyPrintedCalls = actual.calls.allArgs().map(function(argsForCall) { - return ' ' + j$.pp(argsForCall); - }); - - var diffs = actual.calls.allArgs().map(function(argsForCall, callIx) { - var diffBuilder = new j$.DiffBuilder(); - util.equals(argsForCall, expectedArgs, customEqualityTesters, diffBuilder); - return 'Call ' + callIx + ':\n' + - diffBuilder.getMessage().replace(/^/mg, ' '); - }); - - return 'Expected spy ' + actual.and.identity + ' to have been called with:\n' + - ' ' + j$.pp(expectedArgs) + '\n' + '' + - 'but actual calls were:\n' + - prettyPrintedCalls.join(',\n') + '.\n\n' + - diffs.join('\n'); - }; - } - - return result; - } - }; - } - - return toHaveBeenCalledWith; -}; - -getJasmineRequireObj().toHaveClass = function(j$) { - /** - * {@link expect} the actual value to be a DOM element that has the expected class - * @function - * @name matchers#toHaveClass - * @since 3.0.0 - * @param {Object} expected - The class name to test for - * @example - * var el = document.createElement('div'); - * el.className = 'foo bar baz'; - * expect(el).toHaveClass('bar'); - */ - function toHaveClass(util, customEqualityTesters) { - return { - compare: function(actual, expected) { - if (!isElement(actual)) { - throw new Error(j$.pp(actual) + ' is not a DOM element'); - } - - return { - pass: actual.classList.contains(expected) - }; - } - }; - } - - function isElement(maybeEl) { - return maybeEl && - maybeEl.classList && - j$.isFunction_(maybeEl.classList.contains); - } - - return toHaveClass; -}; - -getJasmineRequireObj().toMatch = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect().toMatch( || )'); - - /** - * {@link expect} the actual value to match a regular expression - * @function - * @name matchers#toMatch - * @since 1.3.0 - * @param {RegExp|String} expected - Value to look for in the string. - * @example - * expect("my string").toMatch(/string$/); - * expect("other string").toMatch("her"); - */ - function toMatch() { - return { - compare: function(actual, expected) { - if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { - throw new Error(getErrorMsg('Expected is not a String or a RegExp')); - } - - var regexp = new RegExp(expected); - - return { - pass: regexp.test(actual) - }; - } - }; - } - - return toMatch; -}; - -getJasmineRequireObj().toThrow = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect(function() {}).toThrow()'); - - /** - * {@link expect} a function to `throw` something. - * @function - * @name matchers#toThrow - * @since 2.0.0 - * @param {Object} [expected] - Value that should be thrown. If not provided, simply the fact that something was thrown will be checked. - * @example - * expect(function() { return 'things'; }).toThrow('foo'); - * expect(function() { return 'stuff'; }).toThrow(); - */ - function toThrow(util) { - return { - compare: function(actual, expected) { - var result = { pass: false }, - threw = false, - thrown; - - if (typeof actual != 'function') { - throw new Error(getErrorMsg('Actual is not a Function')); - } - - try { - actual(); - } catch (e) { - threw = true; - thrown = e; - } - - if (!threw) { - result.message = 'Expected function to throw an exception.'; - return result; - } - - if (arguments.length == 1) { - result.pass = true; - result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; }; - - return result; - } - - if (util.equals(thrown, expected)) { - result.pass = true; - result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; }; - } else { - result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' + j$.pp(thrown) + '.'; }; - } - - return result; - } - }; - } - - return toThrow; -}; - -getJasmineRequireObj().toThrowError = function(j$) { - - var getErrorMsg = j$.formatErrorMsg('', 'expect(function() {}).toThrowError(, )'); - - /** - * {@link expect} a function to `throw` an `Error`. - * @function - * @name matchers#toThrowError - * @since 2.0.0 - * @param {Error} [expected] - `Error` constructor the object that was thrown needs to be an instance of. If not provided, `Error` will be used. - * @param {RegExp|String} [message] - The message that should be set on the thrown `Error` - * @example - * expect(function() { return 'things'; }).toThrowError(MyCustomError, 'message'); - * expect(function() { return 'things'; }).toThrowError(MyCustomError, /bar/); - * expect(function() { return 'stuff'; }).toThrowError(MyCustomError); - * expect(function() { return 'other'; }).toThrowError(/foo/); - * expect(function() { return 'other'; }).toThrowError(); - */ - function toThrowError () { - return { - compare: function(actual) { - var errorMatcher = getMatcher.apply(null, arguments), - thrown; - - if (typeof actual != 'function') { - throw new Error(getErrorMsg('Actual is not a Function')); - } - - try { - actual(); - return fail('Expected function to throw an Error.'); - } catch (e) { - thrown = e; - } - - if (!j$.isError_(thrown)) { - return fail(function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; }); - } - - return errorMatcher.match(thrown); - } - }; - - function getMatcher() { - var expected, errorType; - - if (arguments[2]) { - errorType = arguments[1]; - expected = arguments[2]; - if (!isAnErrorType(errorType)) { - throw new Error(getErrorMsg('Expected error type is not an Error.')); - } - - return exactMatcher(expected, errorType); - } else if (arguments[1]) { - expected = arguments[1]; - - if (isAnErrorType(arguments[1])) { - return exactMatcher(null, arguments[1]); - } else { - return exactMatcher(arguments[1], null); - } - } else { - return anyMatcher(); - } - } - - function anyMatcher() { - return { - match: function(error) { - return pass('Expected function not to throw an Error, but it threw ' + j$.fnNameFor(error) + '.'); - } - }; - } - - function exactMatcher(expected, errorType) { - if (expected && !isStringOrRegExp(expected)) { - if (errorType) { - throw new Error(getErrorMsg('Expected error message is not a string or RegExp.')); - } else { - throw new Error(getErrorMsg('Expected is not an Error, string, or RegExp.')); - } - } - - function messageMatch(message) { - if (typeof expected == 'string') { - return expected == message; - } else { - return expected.test(message); - } - } - - var errorTypeDescription = errorType ? j$.fnNameFor(errorType) : 'an exception'; - - function thrownDescription(thrown) { - var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception', - thrownMessage = ''; - - if (expected) { - thrownMessage = ' with message ' + j$.pp(thrown.message); - } - - return thrownName + thrownMessage; - } - - function messageDescription() { - if (expected === null) { - return ''; - } else if (expected instanceof RegExp) { - return ' with a message matching ' + j$.pp(expected); - } else { - return ' with message ' + j$.pp(expected); - } - } - - function matches(error) { - return (errorType === null || error instanceof errorType) && - (expected === null || messageMatch(error.message)); - } - - return { - match: function(thrown) { - if (matches(thrown)) { - return pass(function() { - return 'Expected function not to throw ' + errorTypeDescription + messageDescription() + '.'; - }); - } else { - return fail(function() { - return 'Expected function to throw ' + errorTypeDescription + messageDescription() + - ', but it threw ' + thrownDescription(thrown) + '.'; - }); - } - } - }; - } - - function isStringOrRegExp(potential) { - return potential instanceof RegExp || (typeof potential == 'string'); - } - - function isAnErrorType(type) { - if (typeof type !== 'function') { - return false; - } - - var Surrogate = function() {}; - Surrogate.prototype = type.prototype; - return j$.isError_(new Surrogate()); - } - } - - function pass(message) { - return { - pass: true, - message: message - }; - } - - function fail(message) { - return { - pass: false, - message: message - }; - } - - return toThrowError; -}; - -getJasmineRequireObj().toThrowMatching = function(j$) { - var usageError = j$.formatErrorMsg('', 'expect(function() {}).toThrowMatching()'); - - /** - * {@link expect} a function to `throw` something matching a predicate. - * @function - * @name matchers#toThrowMatching - * @since 3.0.0 - * @param {Function} predicate - A function that takes the thrown exception as its parameter and returns true if it matches. - * @example - * expect(function() { throw new Error('nope'); }).toThrowMatching(function(thrown) { return thrown.message === 'nope'; }); - */ - function toThrowMatching() { - return { - compare: function(actual, predicate) { - var thrown; - - if (typeof actual !== 'function') { - throw new Error(usageError('Actual is not a Function')); - } - - if (typeof predicate !== 'function') { - throw new Error(usageError('Predicate is not a Function')); - } - - try { - actual(); - return fail('Expected function to throw an exception.'); - } catch (e) { - thrown = e; - } - - if (predicate(thrown)) { - return pass('Expected function not to throw an exception matching a predicate.'); - } else { - return fail(function() { - return 'Expected function to throw an exception matching a predicate, ' + - 'but it threw ' + thrownDescription(thrown) + '.'; - }); - } - } - }; - } - - function thrownDescription(thrown) { - if (thrown && thrown.constructor) { - return j$.fnNameFor(thrown.constructor) + ' with message ' + - j$.pp(thrown.message); - } else { - return j$.pp(thrown); - } - } - - function pass(message) { - return { - pass: true, - message: message - }; - } - - function fail(message) { - return { - pass: false, - message: message - }; - } - - return toThrowMatching; -}; - -getJasmineRequireObj().MockDate = function() { - function MockDate(global) { - var self = this; - var currentTime = 0; - - if (!global || !global.Date) { - self.install = function() {}; - self.tick = function() {}; - self.uninstall = function() {}; - return self; - } - - var GlobalDate = global.Date; - - self.install = function(mockDate) { - if (mockDate instanceof GlobalDate) { - currentTime = mockDate.getTime(); - } else { - currentTime = new GlobalDate().getTime(); - } - - global.Date = FakeDate; - }; - - self.tick = function(millis) { - millis = millis || 0; - currentTime = currentTime + millis; - }; - - self.uninstall = function() { - currentTime = 0; - global.Date = GlobalDate; - }; - - createDateProperties(); - - return self; - - function FakeDate() { - switch (arguments.length) { - case 0: - return new GlobalDate(currentTime); - case 1: - return new GlobalDate(arguments[0]); - case 2: - return new GlobalDate(arguments[0], arguments[1]); - case 3: - return new GlobalDate(arguments[0], arguments[1], arguments[2]); - case 4: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3] - ); - case 5: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4] - ); - case 6: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4], - arguments[5] - ); - default: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4], - arguments[5], - arguments[6] - ); - } - } - - function createDateProperties() { - FakeDate.prototype = GlobalDate.prototype; - - FakeDate.now = function() { - if (GlobalDate.now) { - return currentTime; - } else { - throw new Error('Browser does not support Date.now()'); - } - }; - - FakeDate.toSource = GlobalDate.toSource; - FakeDate.toString = GlobalDate.toString; - FakeDate.parse = GlobalDate.parse; - FakeDate.UTC = GlobalDate.UTC; - } - } - - return MockDate; -}; - -getJasmineRequireObj().pp = function(j$) { - function PrettyPrinter() { - this.ppNestLevel_ = 0; - this.seen = []; - this.length = 0; - this.stringParts = []; - } - - function hasCustomToString(value) { - // value.toString !== Object.prototype.toString if value has no custom toString but is from another context (e.g. - // iframe, web worker) - try { - return ( - j$.isFunction_(value.toString) && - value.toString !== Object.prototype.toString && - value.toString() !== Object.prototype.toString.call(value) - ); - } catch (e) { - // The custom toString() threw. - return true; - } - } - - PrettyPrinter.prototype.format = function(value) { - this.ppNestLevel_++; - try { - if (j$.util.isUndefined(value)) { - this.emitScalar('undefined'); - } else if (value === null) { - this.emitScalar('null'); - } else if (value === 0 && 1 / value === -Infinity) { - this.emitScalar('-0'); - } else if (value === j$.getGlobal()) { - this.emitScalar(''); - } else if (value.jasmineToString) { - this.emitScalar(value.jasmineToString()); - } else if (typeof value === 'string') { - this.emitString(value); - } else if (j$.isSpy(value)) { - this.emitScalar('spy on ' + value.and.identity); - } else if (j$.isSpy(value.toString)) { - this.emitScalar('spy on ' + value.toString.and.identity); - } else if (value instanceof RegExp) { - this.emitScalar(value.toString()); - } else if (typeof value === 'function') { - this.emitScalar('Function'); - } else if (j$.isDomNode(value)) { - if (value.tagName) { - this.emitDomElement(value); - } else { - this.emitScalar('HTMLNode'); - } - } else if (value instanceof Date) { - this.emitScalar('Date(' + value + ')'); - } else if (j$.isSet(value)) { - this.emitSet(value); - } else if (j$.isMap(value)) { - this.emitMap(value); - } else if (j$.isTypedArray_(value)) { - this.emitTypedArray(value); - } else if ( - value.toString && - typeof value === 'object' && - !j$.isArray_(value) && - hasCustomToString(value) - ) { - try { - this.emitScalar(value.toString()); - } catch (e) { - this.emitScalar('has-invalid-toString-method'); - } - } else if (j$.util.arrayContains(this.seen, value)) { - this.emitScalar( - '' - ); - } else if (j$.isArray_(value) || j$.isA_('Object', value)) { - this.seen.push(value); - if (j$.isArray_(value)) { - this.emitArray(value); - } else { - this.emitObject(value); - } - this.seen.pop(); - } else { - this.emitScalar(value.toString()); - } - } catch (e) { - if (this.ppNestLevel_ > 1 || !(e instanceof MaxCharsReachedError)) { - throw e; - } - } finally { - this.ppNestLevel_--; - } - }; - - PrettyPrinter.prototype.iterateObject = function(obj, fn) { - var objKeys = keys(obj, j$.isArray_(obj)); - var isGetter = function isGetter(prop) {}; - - if (obj.__lookupGetter__) { - isGetter = function isGetter(prop) { - var getter = obj.__lookupGetter__(prop); - return !j$.util.isUndefined(getter) && getter !== null; - }; - } - var length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - for (var i = 0; i < length; i++) { - var property = objKeys[i]; - fn(property, isGetter(property)); - } - - return objKeys.length > length; - }; - - PrettyPrinter.prototype.emitScalar = function(value) { - this.append(value); - }; - - PrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); - }; - - PrettyPrinter.prototype.emitArray = function(array) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Array'); - return; - } - var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - this.append('[ '); - for (var i = 0; i < length; i++) { - if (i > 0) { - this.append(', '); - } - this.format(array[i]); - } - if (array.length > length) { - this.append(', ...'); - } - - var self = this; - var first = array.length === 0; - var truncated = this.iterateObject(array, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.formatProperty(array, property, isGetter); - }); - - if (truncated) { - this.append(', ...'); - } - - this.append(' ]'); - }; - - PrettyPrinter.prototype.emitSet = function(set) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Set'); - return; - } - this.append('Set( '); - var size = Math.min(set.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - var i = 0; - set.forEach(function(value, key) { - if (i >= size) { - return; - } - if (i > 0) { - this.append(', '); - } - this.format(value); - - i++; - }, this); - if (set.size > size) { - this.append(', ...'); - } - this.append(' )'); - }; - - PrettyPrinter.prototype.emitMap = function(map) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Map'); - return; - } - this.append('Map( '); - var size = Math.min(map.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - var i = 0; - map.forEach(function(value, key) { - if (i >= size) { - return; - } - if (i > 0) { - this.append(', '); - } - this.format([key, value]); - - i++; - }, this); - if (map.size > size) { - this.append(', ...'); - } - this.append(' )'); - }; - - PrettyPrinter.prototype.emitObject = function(obj) { - var ctor = obj.constructor, - constructorName; - - constructorName = - typeof ctor === 'function' && obj instanceof ctor - ? j$.fnNameFor(obj.constructor) - : 'null'; - - this.append(constructorName); - - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - return; - } - - var self = this; - this.append('({ '); - var first = true; - - var truncated = this.iterateObject(obj, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.formatProperty(obj, property, isGetter); - }); - - if (truncated) { - this.append(', ...'); - } - - this.append(' })'); - }; - - PrettyPrinter.prototype.emitTypedArray = function(arr) { - var constructorName = j$.fnNameFor(arr.constructor), - limitedArray = Array.prototype.slice.call( - arr, - 0, - j$.MAX_PRETTY_PRINT_ARRAY_LENGTH - ), - itemsString = Array.prototype.join.call(limitedArray, ', '); - - if (limitedArray.length !== arr.length) { - itemsString += ', ...'; - } - - this.append(constructorName + ' [ ' + itemsString + ' ]'); - }; - - PrettyPrinter.prototype.emitDomElement = function(el) { - var tagName = el.tagName.toLowerCase(), - attrs = el.attributes, - i, - len = attrs.length, - out = '<' + tagName, - attr; - - for (i = 0; i < len; i++) { - attr = attrs[i]; - out += ' ' + attr.name; - - if (attr.value !== '') { - out += '="' + attr.value + '"'; - } - } - - out += '>'; - - if (el.childElementCount !== 0 || el.textContent !== '') { - out += '...'; - } - - this.append(out); - }; - - PrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) { - this.append(property); - this.append(': '); - if (isGetter) { - this.append(''); - } else { - this.format(obj[property]); - } - }; - - PrettyPrinter.prototype.append = function(value) { - // This check protects us from the rare case where an object has overriden - // `toString()` with an invalid implementation (returning a non-string). - if (typeof value !== 'string') { - value = Object.prototype.toString.call(value); - } - - var result = truncate(value, j$.MAX_PRETTY_PRINT_CHARS - this.length); - this.length += result.value.length; - this.stringParts.push(result.value); - - if (result.truncated) { - throw new MaxCharsReachedError(); - } - }; - - function truncate(s, maxlen) { - if (s.length <= maxlen) { - return { value: s, truncated: false }; - } - - s = s.substring(0, maxlen - 4) + ' ...'; - return { value: s, truncated: true }; - } - - function MaxCharsReachedError() { - this.message = - 'Exceeded ' + - j$.MAX_PRETTY_PRINT_CHARS + - ' characters while pretty-printing a value'; - } - - MaxCharsReachedError.prototype = new Error(); - - function keys(obj, isArray) { - var allKeys = Object.keys - ? Object.keys(obj) - : (function(o) { - var keys = []; - for (var key in o) { - if (j$.util.has(o, key)) { - keys.push(key); - } - } - return keys; - })(obj); - - if (!isArray) { - return allKeys; - } - - if (allKeys.length === 0) { - return allKeys; - } - - var extraKeys = []; - for (var i = 0; i < allKeys.length; i++) { - if (!/^[0-9]+$/.test(allKeys[i])) { - extraKeys.push(allKeys[i]); - } - } - - return extraKeys; - } - return function(value) { - var prettyPrinter = new PrettyPrinter(); - prettyPrinter.format(value); - return prettyPrinter.stringParts.join(''); - }; -}; - -getJasmineRequireObj().QueueRunner = function(j$) { - function StopExecutionError() {} - StopExecutionError.prototype = new Error(); - j$.StopExecutionError = StopExecutionError; - - function once(fn) { - var called = false; - return function(arg) { - if (!called) { - called = true; - // Direct call using single parameter, because cleanup/next does not need more - fn(arg); - } - return null; - }; - } - - function emptyFn() {} - - function QueueRunner(attrs) { - var queueableFns = attrs.queueableFns || []; - this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); - this.firstCleanupIx = queueableFns.length; - this.onComplete = attrs.onComplete || emptyFn; - this.clearStack = - attrs.clearStack || - function(fn) { - fn(); - }; - this.onException = attrs.onException || emptyFn; - this.userContext = attrs.userContext || new j$.UserContext(); - this.timeout = attrs.timeout || { - setTimeout: setTimeout, - clearTimeout: clearTimeout - }; - this.fail = attrs.fail || emptyFn; - this.globalErrors = attrs.globalErrors || { - pushListener: emptyFn, - popListener: emptyFn - }; - this.completeOnFirstError = !!attrs.completeOnFirstError; - this.errored = false; - - if (typeof this.onComplete !== 'function') { - throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete)); - } - this.deprecated = attrs.deprecated; - } - - QueueRunner.prototype.execute = function() { - var self = this; - this.handleFinalError = function(message, source, lineno, colno, error) { - // Older browsers would send the error as the first parameter. HTML5 - // specifies the the five parameters above. The error instance should - // be preffered, otherwise the call stack would get lost. - self.onException(error || message); - }; - this.globalErrors.pushListener(this.handleFinalError); - this.run(0); - }; - - QueueRunner.prototype.skipToCleanup = function(lastRanIndex) { - if (lastRanIndex < this.firstCleanupIx) { - this.run(this.firstCleanupIx); - } else { - this.run(lastRanIndex + 1); - } - }; - - QueueRunner.prototype.clearTimeout = function(timeoutId) { - Function.prototype.apply.apply(this.timeout.clearTimeout, [ - j$.getGlobal(), - [timeoutId] - ]); - }; - - QueueRunner.prototype.setTimeout = function(fn, timeout) { - return Function.prototype.apply.apply(this.timeout.setTimeout, [ - j$.getGlobal(), - [fn, timeout] - ]); - }; - - QueueRunner.prototype.attempt = function attempt(iterativeIndex) { - var self = this, - completedSynchronously = true, - handleError = function handleError(error) { - onException(error); - next(error); - }, - cleanup = once(function cleanup() { - if (timeoutId !== void 0) { - self.clearTimeout(timeoutId); - } - self.globalErrors.popListener(handleError); - }), - next = once(function next(err) { - cleanup(); - - if (j$.isError_(err)) { - if (!(err instanceof StopExecutionError) && !err.jasmineMessage) { - self.fail(err); - } - self.errored = errored = true; - } - - function runNext() { - if (self.completeOnFirstError && errored) { - self.skipToCleanup(iterativeIndex); - } else { - self.run(iterativeIndex + 1); - } - } - - if (completedSynchronously) { - self.setTimeout(runNext); - } else { - runNext(); - } - }), - errored = false, - queueableFn = self.queueableFns[iterativeIndex], - timeoutId; - - next.fail = function nextFail() { - self.fail.apply(null, arguments); - self.errored = errored = true; - next(); - }; - - self.globalErrors.pushListener(handleError); - - if (queueableFn.timeout !== undefined) { - var timeoutInterval = queueableFn.timeout || j$.DEFAULT_TIMEOUT_INTERVAL; - timeoutId = self.setTimeout(function() { - var error = new Error( - 'Timeout - Async function did not complete within ' + - timeoutInterval + - 'ms ' + - (queueableFn.timeout - ? '(custom timeout)' - : '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)') - ); - onException(error); - next(); - }, timeoutInterval); - } - - try { - if (queueableFn.fn.length === 0) { - var maybeThenable = queueableFn.fn.call(self.userContext); - - if (maybeThenable && j$.isFunction_(maybeThenable.then)) { - maybeThenable.then(next, onPromiseRejection); - completedSynchronously = false; - return { completedSynchronously: false }; - } - } else { - queueableFn.fn.call(self.userContext, next); - completedSynchronously = false; - return { completedSynchronously: false }; - } - } catch (e) { - onException(e); - self.errored = errored = true; - } - - cleanup(); - return { completedSynchronously: true, errored: errored }; - - function onException(e) { - self.onException(e); - self.errored = errored = true; - } - - function onPromiseRejection(e) { - onException(e); - next(); - } - }; - - QueueRunner.prototype.run = function(recursiveIndex) { - var length = this.queueableFns.length, - self = this, - iterativeIndex; - - for ( - iterativeIndex = recursiveIndex; - iterativeIndex < length; - iterativeIndex++ - ) { - var result = this.attempt(iterativeIndex); - - if (!result.completedSynchronously) { - return; - } - - self.errored = self.errored || result.errored; - - if (this.completeOnFirstError && result.errored) { - this.skipToCleanup(iterativeIndex); - return; - } - } - - this.clearStack(function() { - self.globalErrors.popListener(self.handleFinalError); - self.onComplete(self.errored && new StopExecutionError()); - }); - }; - - return QueueRunner; -}; - -getJasmineRequireObj().ReportDispatcher = function(j$) { - function ReportDispatcher(methods, queueRunnerFactory) { - var dispatchedMethods = methods || []; - - for (var i = 0; i < dispatchedMethods.length; i++) { - var method = dispatchedMethods[i]; - this[method] = (function(m) { - return function() { - dispatch(m, arguments); - }; - })(method); - } - - var reporters = []; - var fallbackReporter = null; - - this.addReporter = function(reporter) { - reporters.push(reporter); - }; - - this.provideFallbackReporter = function(reporter) { - fallbackReporter = reporter; - }; - - this.clearReporters = function() { - reporters = []; - }; - - return this; - - function dispatch(method, args) { - if (reporters.length === 0 && fallbackReporter !== null) { - reporters.push(fallbackReporter); - } - var onComplete = args[args.length - 1]; - args = j$.util.argsToArray(args).splice(0, args.length - 1); - var fns = []; - for (var i = 0; i < reporters.length; i++) { - var reporter = reporters[i]; - addFn(fns, reporter, method, args); - } - - queueRunnerFactory({ - queueableFns: fns, - onComplete: onComplete, - isReporter: true - }); - } - - function addFn(fns, reporter, method, args) { - var fn = reporter[method]; - if (!fn) { - return; - } - - var thisArgs = j$.util.cloneArgs(args); - if (fn.length <= 1) { - fns.push({ - fn: function() { - return fn.apply(reporter, thisArgs); - } - }); - } else { - fns.push({ - fn: function(done) { - return fn.apply(reporter, thisArgs.concat([done])); - } - }); - } - } - } - - return ReportDispatcher; -}; - -getJasmineRequireObj().interface = function(jasmine, env) { - var jasmineInterface = { - /** - * Callback passed to parts of the Jasmine base interface. - * - * By default Jasmine assumes this function completes synchronously. - * If you have code that you need to test asynchronously, you can declare that you receive a `done` callback, return a Promise, or use the `async` keyword if it is supported in your environment. - * @callback implementationCallback - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - */ - - /** - * Create a group of specs (often called a suite). - * - * Calls to `describe` can be nested within other calls to compose your suite as a tree. - * @name describe - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - describe: function(description, specDefinitions) { - return env.describe(description, specDefinitions); - }, - - /** - * A temporarily disabled [`describe`]{@link describe} - * - * Specs within an `xdescribe` will be marked pending and not executed - * @name xdescribe - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - xdescribe: function(description, specDefinitions) { - return env.xdescribe(description, specDefinitions); - }, - - /** - * A focused [`describe`]{@link describe} - * - * If suites or specs are focused, only those that are focused will be executed - * @see fit - * @name fdescribe - * @since 2.1.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - fdescribe: function(description, specDefinitions) { - return env.fdescribe(description, specDefinitions); - }, - - /** - * Define a single spec. A spec should contain one or more {@link expect|expectations} that test the state of the code. - * - * A spec whose expectations all succeed will be passing and a spec with any failures will fail. - * @name it - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking - * @param {implementationCallback} [testFunction] Function that contains the code of your test. If not provided the test will be `pending`. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec. - * @see async - */ - it: function() { - return env.it.apply(env, arguments); - }, - - /** - * A temporarily disabled [`it`]{@link it} - * - * The spec will report as `pending` and will not be executed. - * @name xit - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking. - * @param {implementationCallback} [testFunction] Function that contains the code of your test. Will not be executed. - */ - xit: function() { - return env.xit.apply(env, arguments); - }, - - /** - * A focused [`it`]{@link it} - * - * If suites or specs are focused, only those that are focused will be executed. - * @name fit - * @since 2.1.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking. - * @param {implementationCallback} testFunction Function that contains the code of your test. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec. - * @see async - */ - fit: function() { - return env.fit.apply(env, arguments); - }, - - /** - * Run some shared setup before each of the specs in the {@link describe} in which it is called. - * @name beforeEach - * @since 1.3.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to setup your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeEach. - * @see async - */ - beforeEach: function() { - return env.beforeEach.apply(env, arguments); - }, - - /** - * Run some shared teardown after each of the specs in the {@link describe} in which it is called. - * @name afterEach - * @since 1.3.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to teardown your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterEach. - * @see async - */ - afterEach: function() { - return env.afterEach.apply(env, arguments); - }, - - /** - * Run some shared setup once before all of the specs in the {@link describe} are run. - * - * _Note:_ Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. - * @name beforeAll - * @since 2.1.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to setup your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeAll. - * @see async - */ - beforeAll: function() { - return env.beforeAll.apply(env, arguments); - }, - - /** - * Run some shared teardown once after all of the specs in the {@link describe} are run. - * - * _Note:_ Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. - * @name afterAll - * @since 2.1.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to teardown your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterAll. - * @see async - */ - afterAll: function() { - return env.afterAll.apply(env, arguments); - }, - - /** - * Create an expectation for a spec. - * @name expect - * @since 1.3.0 - * @function - * @global - * @param {Object} actual - Actual computed value to test expectations against. - * @return {matchers} - */ - expect: function(actual) { - return env.expect(actual); - }, - - /** - * Create an asynchronous expectation for a spec. Note that the matchers - * that are provided by an asynchronous expectation all return promises - * which must be either returned from the spec or waited for using `await` - * in order for Jasmine to associate them with the correct spec. - * @name expectAsync - * @since 3.3.0 - * @function - * @global - * @param {Object} actual - Actual computed value to test expectations against. - * @return {async-matchers} - * @example - * await expectAsync(somePromise).toBeResolved(); - * @example - * return expectAsync(somePromise).toBeResolved(); - */ - expectAsync: function(actual) { - return env.expectAsync(actual); - }, - - /** - * Mark a spec as pending, expectation results will be ignored. - * @name pending - * @since 2.0.0 - * @function - * @global - * @param {String} [message] - Reason the spec is pending. - */ - pending: function() { - return env.pending.apply(env, arguments); - }, - - /** - * Explicitly mark a spec as failed. - * @name fail - * @since 2.1.0 - * @function - * @global - * @param {String|Error} [error] - Reason for the failure. - */ - fail: function() { - return env.fail.apply(env, arguments); - }, - - /** - * Install a spy onto an existing object. - * @name spyOn - * @since 1.3.0 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy}. - * @param {String} methodName - The name of the method to replace with a {@link Spy}. - * @returns {Spy} - */ - spyOn: function(obj, methodName) { - return env.spyOn(obj, methodName); - }, - - /** - * Install a spy on a property installed with `Object.defineProperty` onto an existing object. - * @name spyOnProperty - * @since 2.6.0 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy} - * @param {String} propertyName - The name of the property to replace with a {@link Spy}. - * @param {String} [accessType=get] - The access type (get|set) of the property to {@link Spy} on. - * @returns {Spy} - */ - spyOnProperty: function(obj, methodName, accessType) { - return env.spyOnProperty(obj, methodName, accessType); - }, - - /** - * Installs spies on all writable and configurable properties of an object. - * @name spyOnAllFunctions - * @since 3.2.1 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy}s - * @returns {Object} the spied object - */ - spyOnAllFunctions: function(obj) { - return env.spyOnAllFunctions(obj); - }, - - jsApiReporter: new jasmine.JsApiReporter({ - timer: new jasmine.Timer() - }), - - /** - * @namespace jasmine - */ - jasmine: jasmine - }; - - /** - * Add a custom equality tester for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addCustomEqualityTester - * @since 2.0.0 - * @function - * @param {Function} tester - A function which takes two arguments to compare and returns a `true` or `false` comparison result if it knows how to compare them, and `undefined` otherwise. - * @see custom_equality - */ - jasmine.addCustomEqualityTester = function(tester) { - env.addCustomEqualityTester(tester); - }; - - /** - * Add custom matchers for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addMatchers - * @since 2.0.0 - * @function - * @param {Object} matchers - Keys from this object will be the new matcher names. - * @see custom_matcher - */ - jasmine.addMatchers = function(matchers) { - return env.addMatchers(matchers); - }; - - /** - * Add custom async matchers for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addAsyncMatchers - * @since 3.5.0 - * @function - * @param {Object} matchers - Keys from this object will be the new async matcher names. - * @see custom_matcher - */ - jasmine.addAsyncMatchers = function(matchers) { - return env.addAsyncMatchers(matchers); - }; - - /** - * Get the currently booted mock {Clock} for this Jasmine environment. - * @name jasmine.clock - * @since 2.0.0 - * @function - * @returns {Clock} - */ - jasmine.clock = function() { - return env.clock; - }; - - /** - * Create a bare {@link Spy} object. This won't be installed anywhere and will not have any implementation behind it. - * @name jasmine.createSpy - * @since 1.3.0 - * @function - * @param {String} [name] - Name to give the spy. This will be displayed in failure messages. - * @param {Function} [originalFn] - Function to act as the real implementation. - * @return {Spy} - */ - jasmine.createSpy = function(name, originalFn) { - return env.createSpy(name, originalFn); - }; - - /** - * Create an object with multiple {@link Spy}s as its members. - * @name jasmine.createSpyObj - * @since 1.3.0 - * @function - * @param {String} [baseName] - Base name for the spies in the object. - * @param {String[]|Object} methodNames - Array of method names to create spies for, or Object whose keys will be method names and values the {@link Spy#and#returnValue|returnValue}. - * @param {String[]|Object} [propertyNames] - Array of property names to create spies for, or Object whose keys will be propertynames and values the {@link Spy#and#returnValue|returnValue}. - * @return {Object} - */ - jasmine.createSpyObj = function(baseName, methodNames, propertyNames) { - return env.createSpyObj(baseName, methodNames, propertyNames); - }; - - /** - * Add a custom spy strategy for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addSpyStrategy - * @since 3.5.0 - * @function - * @param {String} name - The name of the strategy (i.e. what you call from `and`) - * @param {Function} factory - Factory function that returns the plan to be executed. - */ - jasmine.addSpyStrategy = function(name, factory) { - return env.addSpyStrategy(name, factory); - }; - - /** - * Set the default spy strategy for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.setDefaultSpyStrategy - * @function - * @param {Function} defaultStrategyFn - a function that assigns a strategy - * @example - * beforeEach(function() { - * jasmine.setDefaultSpyStrategy(and => and.returnValue(true)); - * }); - */ - jasmine.setDefaultSpyStrategy = function(defaultStrategyFn) { - return env.setDefaultSpyStrategy(defaultStrategyFn); - }; - - return jasmineInterface; -}; - -getJasmineRequireObj().Spy = function(j$) { - var nextOrder = (function() { - var order = 0; - - return function() { - return order++; - }; - })(); - - /** - * _Note:_ Do not construct this directly, use {@link spyOn}, {@link spyOnProperty}, {@link jasmine.createSpy}, or {@link jasmine.createSpyObj} - * @constructor - * @name Spy - */ - function Spy( - name, - originalFn, - customStrategies, - defaultStrategyFn, - getPromise - ) { - var numArgs = typeof originalFn === 'function' ? originalFn.length : 0, - wrapper = makeFunc(numArgs, function() { - return spy.apply(this, Array.prototype.slice.call(arguments)); - }), - strategyDispatcher = new SpyStrategyDispatcher({ - name: name, - fn: originalFn, - getSpy: function() { - return wrapper; - }, - customStrategies: customStrategies, - getPromise: getPromise - }), - callTracker = new j$.CallTracker(), - spy = function() { - /** - * @name Spy.callData - * @property {object} object - `this` context for the invocation. - * @property {number} invocationOrder - Order of the invocation. - * @property {Array} args - The arguments passed for this invocation. - */ - var callData = { - object: this, - invocationOrder: nextOrder(), - args: Array.prototype.slice.apply(arguments) - }; - - callTracker.track(callData); - var returnValue = strategyDispatcher.exec(this, arguments); - callData.returnValue = returnValue; - - return returnValue; - }; - - function makeFunc(length, fn) { - switch (length) { - case 1: - return function(a) { - return fn.apply(this, arguments); - }; - case 2: - return function(a, b) { - return fn.apply(this, arguments); - }; - case 3: - return function(a, b, c) { - return fn.apply(this, arguments); - }; - case 4: - return function(a, b, c, d) { - return fn.apply(this, arguments); - }; - case 5: - return function(a, b, c, d, e) { - return fn.apply(this, arguments); - }; - case 6: - return function(a, b, c, d, e, f) { - return fn.apply(this, arguments); - }; - case 7: - return function(a, b, c, d, e, f, g) { - return fn.apply(this, arguments); - }; - case 8: - return function(a, b, c, d, e, f, g, h) { - return fn.apply(this, arguments); - }; - case 9: - return function(a, b, c, d, e, f, g, h, i) { - return fn.apply(this, arguments); - }; - default: - return function() { - return fn.apply(this, arguments); - }; - } - } - - for (var prop in originalFn) { - if (prop === 'and' || prop === 'calls') { - throw new Error( - "Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon" - ); - } - - wrapper[prop] = originalFn[prop]; - } - - /** - * @member {SpyStrategy} - Accesses the default strategy for the spy. This strategy will be used - * whenever the spy is called with arguments that don't match any strategy - * created with {@link Spy#withArgs}. - * @name Spy#and - * @since 2.0.0 - * @example - * spyOn(someObj, 'func').and.returnValue(42); - */ - wrapper.and = strategyDispatcher.and; - /** - * Specifies a strategy to be used for calls to the spy that have the - * specified arguments. - * @name Spy#withArgs - * @since 3.0.0 - * @function - * @param {...*} args - The arguments to match - * @type {SpyStrategy} - * @example - * spyOn(someObj, 'func').withArgs(1, 2, 3).and.returnValue(42); - * someObj.func(1, 2, 3); // returns 42 - */ - wrapper.withArgs = function() { - return strategyDispatcher.withArgs.apply(strategyDispatcher, arguments); - }; - wrapper.calls = callTracker; - - if (defaultStrategyFn) { - defaultStrategyFn(wrapper.and); - } - - return wrapper; - } - - function SpyStrategyDispatcher(strategyArgs) { - var baseStrategy = new j$.SpyStrategy(strategyArgs); - var argsStrategies = new StrategyDict(function() { - return new j$.SpyStrategy(strategyArgs); - }); - - this.and = baseStrategy; - - this.exec = function(spy, args) { - var strategy = argsStrategies.get(args); - - if (!strategy) { - if (argsStrategies.any() && !baseStrategy.isConfigured()) { - throw new Error( - "Spy '" + - strategyArgs.name + - "' received a call with arguments " + - j$.pp(Array.prototype.slice.call(args)) + - ' but all configured strategies specify other arguments.' - ); - } else { - strategy = baseStrategy; - } - } - - return strategy.exec(spy, args); - }; - - this.withArgs = function() { - return { and: argsStrategies.getOrCreate(arguments) }; - }; - } - - function StrategyDict(strategyFactory) { - this.strategies = []; - this.strategyFactory = strategyFactory; - } - - StrategyDict.prototype.any = function() { - return this.strategies.length > 0; - }; - - StrategyDict.prototype.getOrCreate = function(args) { - var strategy = this.get(args); - - if (!strategy) { - strategy = this.strategyFactory(); - this.strategies.push({ - args: args, - strategy: strategy - }); - } - - return strategy; - }; - - StrategyDict.prototype.get = function(args) { - var i; - - for (i = 0; i < this.strategies.length; i++) { - if (j$.matchersUtil.equals(args, this.strategies[i].args)) { - return this.strategies[i].strategy; - } - } - }; - - return Spy; -}; - -getJasmineRequireObj().SpyFactory = function(j$) { - function SpyFactory(getCustomStrategies, getDefaultStrategyFn, getPromise) { - var self = this; - - this.createSpy = function(name, originalFn) { - return j$.Spy( - name, - originalFn, - getCustomStrategies(), - getDefaultStrategyFn(), - getPromise - ); - }; - - this.createSpyObj = function(baseName, methodNames, propertyNames) { - var baseNameIsCollection = - j$.isObject_(baseName) || j$.isArray_(baseName); - - if (baseNameIsCollection) { - propertyNames = methodNames; - methodNames = baseName; - baseName = 'unknown'; - } - - var obj = {}; - var spy, descriptor; - - var methods = normalizeKeyValues(methodNames); - for (var i = 0; i < methods.length; i++) { - spy = obj[methods[i][0]] = self.createSpy( - baseName + '.' + methods[i][0] - ); - if (methods[i].length > 1) { - spy.and.returnValue(methods[i][1]); - } - } - - var properties = normalizeKeyValues(propertyNames); - for (var i = 0; i < properties.length; i++) { - descriptor = { - get: self.createSpy(baseName + '.' + properties[i][0] + '.get'), - set: self.createSpy(baseName + '.' + properties[i][0] + '.set') - }; - if (properties[i].length > 1) { - descriptor.get.and.returnValue(properties[i][1]); - descriptor.set.and.returnValue(properties[i][1]); - } - Object.defineProperty(obj, properties[i][0], descriptor); - } - - if (methods.length === 0 && properties.length === 0) { - throw 'createSpyObj requires a non-empty array or object of method names to create spies for'; - } - - return obj; - }; - } - - function normalizeKeyValues(object) { - var result = []; - if (j$.isArray_(object)) { - for (var i = 0; i < object.length; i++) { - result.push([object[i]]); - } - } else if (j$.isObject_(object)) { - for (var key in object) { - if (object.hasOwnProperty(key)) { - result.push([key, object[key]]); - } - } - } - return result; - } - - return SpyFactory; -}; - -getJasmineRequireObj().SpyRegistry = function(j$) { - var spyOnMsg = j$.formatErrorMsg('', 'spyOn(, )'); - var spyOnPropertyMsg = j$.formatErrorMsg( - '', - 'spyOnProperty(, , [accessType])' - ); - - function SpyRegistry(options) { - options = options || {}; - var global = options.global || j$.getGlobal(); - var createSpy = options.createSpy; - var currentSpies = - options.currentSpies || - function() { - return []; - }; - - this.allowRespy = function(allow) { - this.respy = allow; - }; - - this.spyOn = function(obj, methodName) { - var getErrorMsg = spyOnMsg; - - if (j$.util.isUndefined(obj) || obj === null) { - throw new Error( - getErrorMsg( - 'could not find an object to spy upon for ' + methodName + '()' - ) - ); - } - - if (j$.util.isUndefined(methodName) || methodName === null) { - throw new Error(getErrorMsg('No method name supplied')); - } - - if (j$.util.isUndefined(obj[methodName])) { - throw new Error(getErrorMsg(methodName + '() method does not exist')); - } - - if (obj[methodName] && j$.isSpy(obj[methodName])) { - if (this.respy) { - return obj[methodName]; - } else { - throw new Error( - getErrorMsg(methodName + ' has already been spied upon') - ); - } - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, methodName); - - if (descriptor && !(descriptor.writable || descriptor.set)) { - throw new Error( - getErrorMsg(methodName + ' is not declared writable or has no setter') - ); - } - - var originalMethod = obj[methodName], - spiedMethod = createSpy(methodName, originalMethod), - restoreStrategy; - - if ( - Object.prototype.hasOwnProperty.call(obj, methodName) || - (obj === global && methodName === 'onerror') - ) { - restoreStrategy = function() { - obj[methodName] = originalMethod; - }; - } else { - restoreStrategy = function() { - if (!delete obj[methodName]) { - obj[methodName] = originalMethod; - } - }; - } - - currentSpies().push({ - restoreObjectToOriginalState: restoreStrategy - }); - - obj[methodName] = spiedMethod; - - return spiedMethod; - }; - - this.spyOnProperty = function(obj, propertyName, accessType) { - var getErrorMsg = spyOnPropertyMsg; - - accessType = accessType || 'get'; - - if (j$.util.isUndefined(obj)) { - throw new Error( - getErrorMsg( - 'spyOn could not find an object to spy upon for ' + - propertyName + - '' - ) - ); - } - - if (j$.util.isUndefined(propertyName)) { - throw new Error(getErrorMsg('No property name supplied')); - } - - var descriptor = j$.util.getPropertyDescriptor(obj, propertyName); - - if (!descriptor) { - throw new Error(getErrorMsg(propertyName + ' property does not exist')); - } - - if (!descriptor.configurable) { - throw new Error( - getErrorMsg(propertyName + ' is not declared configurable') - ); - } - - if (!descriptor[accessType]) { - throw new Error( - getErrorMsg( - 'Property ' + - propertyName + - ' does not have access type ' + - accessType - ) - ); - } - - if (j$.isSpy(descriptor[accessType])) { - if (this.respy) { - return descriptor[accessType]; - } else { - throw new Error( - getErrorMsg( - propertyName + '#' + accessType + ' has already been spied upon' - ) - ); - } - } - - var originalDescriptor = j$.util.clone(descriptor), - spy = createSpy(propertyName, descriptor[accessType]), - restoreStrategy; - - if (Object.prototype.hasOwnProperty.call(obj, propertyName)) { - restoreStrategy = function() { - Object.defineProperty(obj, propertyName, originalDescriptor); - }; - } else { - restoreStrategy = function() { - delete obj[propertyName]; - }; - } - - currentSpies().push({ - restoreObjectToOriginalState: restoreStrategy - }); - - descriptor[accessType] = spy; - - Object.defineProperty(obj, propertyName, descriptor); - - return spy; - }; - - this.spyOnAllFunctions = function(obj) { - if (j$.util.isUndefined(obj)) { - throw new Error( - 'spyOnAllFunctions could not find an object to spy upon' - ); - } - - var pointer = obj, - props = [], - prop, - descriptor; - - while (pointer) { - for (prop in pointer) { - if ( - Object.prototype.hasOwnProperty.call(pointer, prop) && - pointer[prop] instanceof Function - ) { - descriptor = Object.getOwnPropertyDescriptor(pointer, prop); - if ( - (descriptor.writable || descriptor.set) && - descriptor.configurable - ) { - props.push(prop); - } - } - } - pointer = Object.getPrototypeOf(pointer); - } - - for (var i = 0; i < props.length; i++) { - this.spyOn(obj, props[i]); - } - - return obj; - }; - - this.clearSpies = function() { - var spies = currentSpies(); - for (var i = spies.length - 1; i >= 0; i--) { - var spyEntry = spies[i]; - spyEntry.restoreObjectToOriginalState(); - } - }; - } - - return SpyRegistry; -}; - -getJasmineRequireObj().SpyStrategy = function(j$) { - /** - * @interface SpyStrategy - */ - function SpyStrategy(options) { - options = options || {}; - - var self = this; - - /** - * Get the identifying information for the spy. - * @name SpyStrategy#identity - * @since 3.0.0 - * @member - * @type {String} - */ - this.identity = options.name || 'unknown'; - this.originalFn = options.fn || function() {}; - this.getSpy = options.getSpy || function() {}; - this.plan = this._defaultPlan = function() {}; - - var k, - cs = options.customStrategies || {}; - for (k in cs) { - if (j$.util.has(cs, k) && !this[k]) { - this[k] = createCustomPlan(cs[k]); - } - } - - var getPromise = - typeof options.getPromise === 'function' - ? options.getPromise - : function() {}; - - var requirePromise = function(name) { - var Promise = getPromise(); - - if (!Promise) { - throw new Error( - name + - ' requires global Promise, or `Promise` configured with `jasmine.getEnv().configure()`' - ); - } - - return Promise; - }; - - /** - * Tell the spy to return a promise resolving to the specified value when invoked. - * @name SpyStrategy#resolveTo - * @since 3.5.0 - * @function - * @param {*} value The value to return. - */ - this.resolveTo = function(value) { - var Promise = requirePromise('resolveTo'); - self.plan = function() { - return Promise.resolve(value); - }; - return self.getSpy(); - }; - - /** - * Tell the spy to return a promise rejecting with the specified value when invoked. - * @name SpyStrategy#rejectWith - * @since 3.5.0 - * @function - * @param {*} value The value to return. - */ - this.rejectWith = function(value) { - var Promise = requirePromise('rejectWith'); - - self.plan = function() { - return Promise.reject(value); - }; - return self.getSpy(); - }; - } - - function createCustomPlan(factory) { - return function() { - var plan = factory.apply(null, arguments); - - if (!j$.isFunction_(plan)) { - throw new Error('Spy strategy must return a function'); - } - - this.plan = plan; - return this.getSpy(); - }; - } - - /** - * Execute the current spy strategy. - * @name SpyStrategy#exec - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.exec = function(context, args) { - return this.plan.apply(context, args); - }; - - /** - * Tell the spy to call through to the real implementation when invoked. - * @name SpyStrategy#callThrough - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.callThrough = function() { - this.plan = this.originalFn; - return this.getSpy(); - }; - - /** - * Tell the spy to return the value when invoked. - * @name SpyStrategy#returnValue - * @since 2.0.0 - * @function - * @param {*} value The value to return. - */ - SpyStrategy.prototype.returnValue = function(value) { - this.plan = function() { - return value; - }; - return this.getSpy(); - }; - - /** - * Tell the spy to return one of the specified values (sequentially) each time the spy is invoked. - * @name SpyStrategy#returnValues - * @since 2.1.0 - * @function - * @param {...*} values - Values to be returned on subsequent calls to the spy. - */ - SpyStrategy.prototype.returnValues = function() { - var values = Array.prototype.slice.call(arguments); - this.plan = function() { - return values.shift(); - }; - return this.getSpy(); - }; - - /** - * Tell the spy to throw an error when invoked. - * @name SpyStrategy#throwError - * @since 2.0.0 - * @function - * @param {Error|String} something Thing to throw - */ - SpyStrategy.prototype.throwError = function(something) { - var error = something instanceof Error ? something : new Error(something); - this.plan = function() { - throw error; - }; - return this.getSpy(); - }; - - /** - * Tell the spy to call a fake implementation when invoked. - * @name SpyStrategy#callFake - * @since 2.0.0 - * @function - * @param {Function} fn The function to invoke with the passed parameters. - */ - SpyStrategy.prototype.callFake = function(fn) { - if (!(j$.isFunction_(fn) || j$.isAsyncFunction_(fn))) { - throw new Error( - 'Argument passed to callFake should be a function, got ' + fn - ); - } - this.plan = fn; - return this.getSpy(); - }; - - /** - * Tell the spy to do nothing when invoked. This is the default. - * @name SpyStrategy#stub - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.stub = function(fn) { - this.plan = function() {}; - return this.getSpy(); - }; - - SpyStrategy.prototype.isConfigured = function() { - return this.plan !== this._defaultPlan; - }; - - return SpyStrategy; -}; - -getJasmineRequireObj().StackTrace = function(j$) { - function StackTrace(error) { - var lines = error.stack.split('\n').filter(function(line) { - return line !== ''; - }); - - var extractResult = extractMessage(error.message, lines); - - if (extractResult) { - this.message = extractResult.message; - lines = extractResult.remainder; - } - - var parseResult = tryParseFrames(lines); - this.frames = parseResult.frames; - this.style = parseResult.style; - } - - var framePatterns = [ - // PhantomJS on Linux, Node, Chrome, IE, Edge - // e.g. " at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)" - // Note that the "function name" can include a surprisingly large set of - // characters, including angle brackets and square brackets. - { - re: /^\s*at ([^\)]+) \(([^\)]+)\)$/, - fnIx: 1, - fileLineColIx: 2, - style: 'v8' - }, - - // NodeJS alternate form, often mixed in with the Chrome style - // e.g. " at /some/path:4320:20 - { re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' }, - - // PhantomJS on OS X, Safari, Firefox - // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" - // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" - { - re: /^(([^@\s]+)@)?([^\s]+)$/, - fnIx: 2, - fileLineColIx: 3, - style: 'webkit' - } - ]; - - // regexes should capture the function name (if any) as group 1 - // and the file, line, and column as group 2. - function tryParseFrames(lines) { - var style = null; - var frames = lines.map(function(line) { - var convertedLine = first(framePatterns, function(pattern) { - var overallMatch = line.match(pattern.re), - fileLineColMatch; - if (!overallMatch) { - return null; - } - - fileLineColMatch = overallMatch[pattern.fileLineColIx].match( - /^(.*):(\d+):\d+$/ - ); - if (!fileLineColMatch) { - return null; - } - - style = style || pattern.style; - return { - raw: line, - file: fileLineColMatch[1], - line: parseInt(fileLineColMatch[2], 10), - func: overallMatch[pattern.fnIx] - }; - }); - - return convertedLine || { raw: line }; - }); - - return { - style: style, - frames: frames - }; - } - - function first(items, fn) { - var i, result; - - for (i = 0; i < items.length; i++) { - result = fn(items[i]); - - if (result) { - return result; - } - } - } - - function extractMessage(message, stackLines) { - var len = messagePrefixLength(message, stackLines); - - if (len > 0) { - return { - message: stackLines.slice(0, len).join('\n'), - remainder: stackLines.slice(len) - }; - } - } - - function messagePrefixLength(message, stackLines) { - if (!stackLines[0].match(/^Error/)) { - return 0; - } - - var messageLines = message.split('\n'); - var i; - - for (i = 1; i < messageLines.length; i++) { - if (messageLines[i] !== stackLines[i]) { - return 0; - } - } - - return messageLines.length; - } - - return StackTrace; -}; - -getJasmineRequireObj().Suite = function(j$) { - function Suite(attrs) { - this.env = attrs.env; - this.id = attrs.id; - this.parentSuite = attrs.parentSuite; - this.description = attrs.description; - this.expectationFactory = attrs.expectationFactory; - this.asyncExpectationFactory = attrs.asyncExpectationFactory; - this.expectationResultFactory = attrs.expectationResultFactory; - this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; - - this.beforeFns = []; - this.afterFns = []; - this.beforeAllFns = []; - this.afterAllFns = []; - - this.timer = attrs.timer || j$.noopTimer; - - this.children = []; - - /** - * @typedef SuiteResult - * @property {Int} id - The unique id of this suite. - * @property {String} description - The description text passed to the {@link describe} that made this suite. - * @property {String} fullName - The full description including all ancestors of this suite. - * @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite. - * @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite. - * @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite. - * @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach. - */ - this.result = { - id: this.id, - description: this.description, - fullName: this.getFullName(), - failedExpectations: [], - deprecationWarnings: [], - duration: null - }; - } - - Suite.prototype.expect = function(actual) { - return this.expectationFactory(actual, this); - }; - - Suite.prototype.expectAsync = function(actual) { - return this.asyncExpectationFactory(actual, this); - }; - - Suite.prototype.getFullName = function() { - var fullName = []; - for ( - var parentSuite = this; - parentSuite; - parentSuite = parentSuite.parentSuite - ) { - if (parentSuite.parentSuite) { - fullName.unshift(parentSuite.description); - } - } - return fullName.join(' '); - }; - - Suite.prototype.pend = function() { - this.markedPending = true; - }; - - Suite.prototype.beforeEach = function(fn) { - this.beforeFns.unshift(fn); - }; - - Suite.prototype.beforeAll = function(fn) { - this.beforeAllFns.push(fn); - }; - - Suite.prototype.afterEach = function(fn) { - this.afterFns.unshift(fn); - }; - - Suite.prototype.afterAll = function(fn) { - this.afterAllFns.unshift(fn); - }; - - Suite.prototype.startTimer = function() { - this.timer.start(); - }; - - Suite.prototype.endTimer = function() { - this.result.duration = this.timer.elapsed(); - }; - - function removeFns(queueableFns) { - for (var i = 0; i < queueableFns.length; i++) { - queueableFns[i].fn = null; - } - } - - Suite.prototype.cleanupBeforeAfter = function() { - removeFns(this.beforeAllFns); - removeFns(this.afterAllFns); - removeFns(this.beforeFns); - removeFns(this.afterFns); - }; - - Suite.prototype.addChild = function(child) { - this.children.push(child); - }; - - Suite.prototype.status = function() { - if (this.markedPending) { - return 'pending'; - } - - if (this.result.failedExpectations.length > 0) { - return 'failed'; - } else { - return 'passed'; - } - }; - - Suite.prototype.canBeReentered = function() { - return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0; - }; - - Suite.prototype.getResult = function() { - this.result.status = this.status(); - return this.result; - }; - - Suite.prototype.sharedUserContext = function() { - if (!this.sharedContext) { - this.sharedContext = this.parentSuite - ? this.parentSuite.clonedSharedUserContext() - : new j$.UserContext(); - } - - return this.sharedContext; - }; - - Suite.prototype.clonedSharedUserContext = function() { - return j$.UserContext.fromExisting(this.sharedUserContext()); - }; - - Suite.prototype.onException = function() { - if (arguments[0] instanceof j$.errors.ExpectationFailed) { - return; - } - - var data = { - matcherName: '', - passed: false, - expected: '', - actual: '', - error: arguments[0] - }; - var failedExpectation = this.expectationResultFactory(data); - - if (!this.parentSuite) { - failedExpectation.globalErrorType = 'afterAll'; - } - - this.result.failedExpectations.push(failedExpectation); - }; - - Suite.prototype.addExpectationResult = function() { - if (isFailure(arguments)) { - var data = arguments[1]; - this.result.failedExpectations.push(this.expectationResultFactory(data)); - if (this.throwOnExpectationFailure) { - throw new j$.errors.ExpectationFailed(); - } - } - }; - - Suite.prototype.addDeprecationWarning = function(deprecation) { - if (typeof deprecation === 'string') { - deprecation = { message: deprecation }; - } - this.result.deprecationWarnings.push( - this.expectationResultFactory(deprecation) - ); - }; - - function isFailure(args) { - return !args[0]; - } - - return Suite; -}; - -if (typeof window == void 0 && typeof exports == 'object') { - /* globals exports */ - exports.Suite = jasmineRequire.Suite; -} - -getJasmineRequireObj().Timer = function() { - var defaultNow = (function(Date) { - return function() { - return new Date().getTime(); - }; - })(Date); - - function Timer(options) { - options = options || {}; - - var now = options.now || defaultNow, - startTime; - - this.start = function() { - startTime = now(); - }; - - this.elapsed = function() { - return now() - startTime; - }; - } - - return Timer; -}; - -getJasmineRequireObj().noopTimer = function() { - return { - start: function() {}, - elapsed: function() { - return 0; - } - }; -}; - -getJasmineRequireObj().TreeProcessor = function() { - function TreeProcessor(attrs) { - var tree = attrs.tree, - runnableIds = attrs.runnableIds, - queueRunnerFactory = attrs.queueRunnerFactory, - nodeStart = attrs.nodeStart || function() {}, - nodeComplete = attrs.nodeComplete || function() {}, - failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations, - orderChildren = - attrs.orderChildren || - function(node) { - return node.children; - }, - excludeNode = - attrs.excludeNode || - function(node) { - return false; - }, - stats = { valid: true }, - processed = false, - defaultMin = Infinity, - defaultMax = 1 - Infinity; - - this.processTree = function() { - processNode(tree, true); - processed = true; - return stats; - }; - - this.execute = function(done) { - if (!processed) { - this.processTree(); - } - - if (!stats.valid) { - throw 'invalid order'; - } - - var childFns = wrapChildren(tree, 0); - - queueRunnerFactory({ - queueableFns: childFns, - userContext: tree.sharedUserContext(), - onException: function() { - tree.onException.apply(tree, arguments); - }, - onComplete: done - }); - }; - - function runnableIndex(id) { - for (var i = 0; i < runnableIds.length; i++) { - if (runnableIds[i] === id) { - return i; - } - } - } - - function processNode(node, parentExcluded) { - var executableIndex = runnableIndex(node.id); - - if (executableIndex !== undefined) { - parentExcluded = false; - } - - if (!node.children) { - var excluded = parentExcluded || excludeNode(node); - stats[node.id] = { - excluded: excluded, - willExecute: !excluded && !node.markedPending, - segments: [ - { - index: 0, - owner: node, - nodes: [node], - min: startingMin(executableIndex), - max: startingMax(executableIndex) - } - ] - }; - } else { - var hasExecutableChild = false; - - var orderedChildren = orderChildren(node); - - for (var i = 0; i < orderedChildren.length; i++) { - var child = orderedChildren[i]; - - processNode(child, parentExcluded); - - if (!stats.valid) { - return; - } - - var childStats = stats[child.id]; - - hasExecutableChild = hasExecutableChild || childStats.willExecute; - } - - stats[node.id] = { - excluded: parentExcluded, - willExecute: hasExecutableChild - }; - - segmentChildren(node, orderedChildren, stats[node.id], executableIndex); - - if (!node.canBeReentered() && stats[node.id].segments.length > 1) { - stats = { valid: false }; - } - } - } - - function startingMin(executableIndex) { - return executableIndex === undefined ? defaultMin : executableIndex; - } - - function startingMax(executableIndex) { - return executableIndex === undefined ? defaultMax : executableIndex; - } - - function segmentChildren( - node, - orderedChildren, - nodeStats, - executableIndex - ) { - var currentSegment = { - index: 0, - owner: node, - nodes: [], - min: startingMin(executableIndex), - max: startingMax(executableIndex) - }, - result = [currentSegment], - lastMax = defaultMax, - orderedChildSegments = orderChildSegments(orderedChildren); - - function isSegmentBoundary(minIndex) { - return ( - lastMax !== defaultMax && - minIndex !== defaultMin && - lastMax < minIndex - 1 - ); - } - - for (var i = 0; i < orderedChildSegments.length; i++) { - var childSegment = orderedChildSegments[i], - maxIndex = childSegment.max, - minIndex = childSegment.min; - - if (isSegmentBoundary(minIndex)) { - currentSegment = { - index: result.length, - owner: node, - nodes: [], - min: defaultMin, - max: defaultMax - }; - result.push(currentSegment); - } - - currentSegment.nodes.push(childSegment); - currentSegment.min = Math.min(currentSegment.min, minIndex); - currentSegment.max = Math.max(currentSegment.max, maxIndex); - lastMax = maxIndex; - } - - nodeStats.segments = result; - } - - function orderChildSegments(children) { - var specifiedOrder = [], - unspecifiedOrder = []; - - for (var i = 0; i < children.length; i++) { - var child = children[i], - segments = stats[child.id].segments; - - for (var j = 0; j < segments.length; j++) { - var seg = segments[j]; - - if (seg.min === defaultMin) { - unspecifiedOrder.push(seg); - } else { - specifiedOrder.push(seg); - } - } - } - - specifiedOrder.sort(function(a, b) { - return a.min - b.min; - }); - - return specifiedOrder.concat(unspecifiedOrder); - } - - function executeNode(node, segmentNumber) { - if (node.children) { - return { - fn: function(done) { - var onStart = { - fn: function(next) { - nodeStart(node, next); - } - }; - - queueRunnerFactory({ - onComplete: function() { - var args = Array.prototype.slice.call(arguments, [0]); - node.cleanupBeforeAfter(); - nodeComplete(node, node.getResult(), function() { - done.apply(undefined, args); - }); - }, - queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)), - userContext: node.sharedUserContext(), - onException: function() { - node.onException.apply(node, arguments); - } - }); - } - }; - } else { - return { - fn: function(done) { - node.execute( - done, - stats[node.id].excluded, - failSpecWithNoExpectations - ); - } - }; - } - } - - function wrapChildren(node, segmentNumber) { - var result = [], - segmentChildren = stats[node.id].segments[segmentNumber].nodes; - - for (var i = 0; i < segmentChildren.length; i++) { - result.push( - executeNode(segmentChildren[i].owner, segmentChildren[i].index) - ); - } - - if (!stats[node.id].willExecute) { - return result; - } - - return node.beforeAllFns.concat(result).concat(node.afterAllFns); - } - } - - return TreeProcessor; -}; - -getJasmineRequireObj().UserContext = function(j$) { - function UserContext() {} - - UserContext.fromExisting = function(oldContext) { - var context = new UserContext(); - - for (var prop in oldContext) { - if (oldContext.hasOwnProperty(prop)) { - context[prop] = oldContext[prop]; - } - } - - return context; - }; - - return UserContext; -}; - -getJasmineRequireObj().version = function() { - return '3.5.0'; -}; diff --git a/lib/jasmine-3.5.0/jasmine_favicon.png b/lib/jasmine-3.5.0/jasmine_favicon.png deleted file mode 100644 index 3b84583..0000000 Binary files a/lib/jasmine-3.5.0/jasmine_favicon.png and /dev/null differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..0e32c7b --- /dev/null +++ b/manifest.json @@ -0,0 +1,22 @@ +{ + "name": "Werewolf Utility", + "short_name": "Werewolf", + "icons": [ + { + "src": "/client/favicon_package/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/client/favicon_package/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#000000", + "background_color": "#000000", + "start_url": "/?source=pwa", + "display": "fullscreen", + "display_override": ["fullscreen", "standalone", "minimal-ui"], + "description": "A utility to deal Werewolf cards and run games in any setting, on any device." +} diff --git a/package-lock.json b/package-lock.json index 1ba9c97..6c5fd3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,1681 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "requires": { + "@babel/highlight": "^7.16.0" + } + }, + "@babel/compat-data": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", + "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==" + }, + "@babel/core": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", + "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/generator": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.8", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-simple-access": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true + }, + "@babel/highlight": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", + "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "dev": true + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", + "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "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 + } + } + }, + "@babel/eslint-parser": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.5.tgz", + "integrity": "sha512-mUqYa46lgWqHKQ33Q6LNCGp/wPR3eqOYTUixHFsfrSQqRxH0+WOzca75iEjFr5RDGH1dDz622LaHhLOzOuQRUA==", + "dev": true, + "requires": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + } + }, + "@babel/generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz", + "integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==", + "requires": { + "@babel/types": "^7.16.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.0.tgz", + "integrity": "sha512-ItmYF9vR4zA8cByDocY05o0LGUkp1zhbTQOH1NFyl5xXEqlTJQCEJjieriw+aFpxo16swMxUnUiKS7a/r4vtHg==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.5.tgz", + "integrity": "sha512-3JEA9G5dmmnIWdzaT9d0NmFRgYnWUThLsDaL7982H0XqqWr56lRrsmwheXFMjR+TMl7QMBb6mzy9kvgr1lRLUA==", + "requires": { + "@babel/helper-explode-assignable-expression": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.3", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", + "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "requires": { + "@babel/compat-data": "^7.16.0", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.5.tgz", + "integrity": "sha512-NEohnYA7mkB8L5JhU7BLwcBdU3j83IziR9aseMueWGeAjblbul3zzb8UvJ3a1zuBiqCMObzCJHFqKIQE6hTVmg==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.0.tgz", + "integrity": "sha512-3DyG0zAFAZKcOp7aVr33ddwkxJ0Z0Jr5V99y3I690eYLpukJsJvAbzTy1ewoCqsML8SbIrjH14Jc/nSQ4TvNPA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "regexpu-core": "^4.7.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.0.tgz", + "integrity": "sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg==", + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz", + "integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.0.tgz", + "integrity": "sha512-Hk2SLxC9ZbcOhLpg/yMznzJ11W++lg5GMbxt1ev6TXUiJB0N42KPC+7w8a+eWGuqDnUYuwStJoZHM7RgmIOaGQ==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-function-name": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "requires": { + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.5.tgz", + "integrity": "sha512-7fecSXq7ZrLE+TWshbGT+HyCLkxloWNhTbU2QM1NTI/tDqyf0oZiMcEfYtDuUDCo528EOlt39G1rftea4bRZIw==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", + "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz", + "integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==", + "requires": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-simple-access": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/helper-validator-identifier": "^7.15.7", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", + "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.5.tgz", + "integrity": "sha512-59KHWHXxVA9K4HNF4sbHCf+eJeFe0Te/ZFGqBT4OjXhrwvA04sGfaEGsVTdsjoszq0YTP49RC9UKe5g8uN2RwQ==" + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.5.tgz", + "integrity": "sha512-X+aAJldyxrOmN9v3FKp+Hu1NO69VWgYgDGq6YDykwRPzxs5f2N+X988CBXS7EQahDU+Vpet5QYMqLk+nsp+Qxw==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-wrap-function": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-replace-supers": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.5.tgz", + "integrity": "sha512-ao3seGVa/FZCMCCNDuBcqnBFSbdr8N2EW35mzojx3TwfIbdPmNK+JV6+2d5bR0Z71W5ocLnQp9en/cTF7pBJiQ==", + "requires": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-simple-access": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", + "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", + "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==" + }, + "@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", + "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==" + }, + "@babel/helper-wrap-function": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.5.tgz", + "integrity": "sha512-2J2pmLBqUqVdJw78U0KPNdeE2qeuIyKoG4mKV7wAq3mc4jJG282UgjZw4ZYDnqiWQuS3Y3IYdF/AQ6CpyBV3VA==", + "requires": { + "@babel/helper-function-name": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helpers": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", + "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/generator": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.8", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", + "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "dev": true + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", + "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "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 + } + } + }, + "@babel/highlight": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "requires": { + "@babel/helper-validator-identifier": "^7.15.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.16.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz", + "integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==" + }, + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.16.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.2.tgz", + "integrity": "sha512-h37CvpLSf8gb2lIJ2CgC3t+EjFbi0t8qS7LCS1xcJIlEXE4czlofwaW7W1HA8zpgOCzI9C1nmoqNR1zWkk0pQg==", + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.0.tgz", + "integrity": "sha512-4tcFwwicpWTrpl9qjf7UsoosaArgImF85AxqCRZlgc3IQDvkUHjJpruXAL58Wmj+T6fypWTC/BakfEkwIL/pwA==", + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.0" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.5.tgz", + "integrity": "sha512-C/FX+3HNLV6sz7AqbTQqEo1L9/kfrKjxcVtgyBCmvIgOjvuBVUWooDoi7trsLxOzCEo5FccjRvKHkfDsJFZlfA==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.5.tgz", + "integrity": "sha512-pJD3HjgRv83s5dv1sTnDbZOaTjghKEz8KUn1Kbh2eAIRhGuyQ1XSeI4xVXU3UlIEVA3DAyIdxqT1eRn7Wcn55A==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-proposal-class-static-block": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.5.tgz", + "integrity": "sha512-EEFzuLZcm/rNJ8Q5krK+FRKdVkd6FjfzT9tuSZql9sQn64K0hHA2KLJ0DqVot9/iV6+SsuadC5yI39zWnm+nmQ==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.5.tgz", + "integrity": "sha512-P05/SJZTTvHz79LNYTF8ff5xXge0kk5sIIWAypcWgX4BTRUgyHc8wRxJ/Hk+mU0KXldgOOslKaeqnhthcDJCJQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.5.tgz", + "integrity": "sha512-i+sltzEShH1vsVydvNaTRsgvq2vZsfyrd7K7vPLUU/KgS0D5yZMe6uipM0+izminnkKrEfdUnz7CxMRb6oHZWw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.5.tgz", + "integrity": "sha512-QQJueTFa0y9E4qHANqIvMsuxM/qcLQmKttBACtPCQzGUEizsXDACGonlPiSwynHfOa3vNw0FPMVvQzbuXwh4SQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.5.tgz", + "integrity": "sha512-xqibl7ISO2vjuQM+MzR3rkd0zfNWltk7n9QhaD8ghMmMceVguYrNDt7MikRyj4J4v3QehpnrU8RYLnC7z/gZLA==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.5.tgz", + "integrity": "sha512-YwMsTp/oOviSBhrjwi0vzCUycseCYwoXnLiXIL3YNjHSMBHicGTz7GjVU/IGgz4DtOEXBdCNG72pvCX22ehfqg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.5.tgz", + "integrity": "sha512-DvB9l/TcsCRvsIV9v4jxR/jVP45cslTVC0PMVHvaJhhNuhn2Y1SOhCSFlPK777qLB5wb8rVDaNoqMTyOqtY5Iw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.5.tgz", + "integrity": "sha512-UEd6KpChoyPhCoE840KRHOlGhEZFutdPDMGj+0I56yuTTOaT51GzmnEl/0uT41fB/vD2nT+Pci2KjezyE3HmUw==", + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.16.5" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.5.tgz", + "integrity": "sha512-ihCMxY1Iljmx4bWy/PIMJGXN4NS4oUj1MKynwO07kiKms23pNvIn1DMB92DNB2R0EA882sw0VXIelYGdtF7xEQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.5.tgz", + "integrity": "sha512-kzdHgnaXRonttiTfKYnSVafbWngPPr2qKw9BWYBESl91W54e+9R5pP70LtWxV56g0f05f/SQrwHYkfvbwcdQ/A==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.5.tgz", + "integrity": "sha512-+yFMO4BGT3sgzXo+lrq7orX5mAZt57DwUK6seqII6AcJnJOIhBJ8pzKH47/ql/d426uQ7YhN8DpUFirQzqYSUA==", + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.5.tgz", + "integrity": "sha512-+YGh5Wbw0NH3y/E5YMu6ci5qTDmAEVNoZ3I54aB6nVEOZ5BQ7QJlwKq5pYVucQilMByGn/bvX0af+uNaPRCabA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.5.tgz", + "integrity": "sha512-s5sKtlKQyFSatt781HQwv1hoM5BQ9qRH30r+dK56OLDsHmV74mzwJNX7R1yMuE7VZKG5O6q/gmOGSAO6ikTudg==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@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==", + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.5.tgz", + "integrity": "sha512-8bTHiiZyMOyfZFULjsCnYOWG059FVMes0iljEHSfARhNgFfpsqE92OrCffv3veSw9rwMkYcFe9bj0ZoXU2IGtQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.5.tgz", + "integrity": "sha512-TMXgfioJnkXU+XRoj7P2ED7rUm5jbnDWwlCuFVTpQboMfbSya5WrmubNBAMlk7KXvywpo8rd8WuYZkis1o2H8w==", + "requires": { + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.5.tgz", + "integrity": "sha512-BxmIyKLjUGksJ99+hJyL/HIxLIGnLKtw772zYDER7UuycDZ+Xvzs98ZQw6NGgM2ss4/hlFAaGiZmMNKvValEjw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.5.tgz", + "integrity": "sha512-JxjSPNZSiOtmxjX7PBRBeRJTUKTyJ607YUYeT0QJCNdsedOe+/rXITjP08eG8xUpsLfPirgzdCFN+h0w6RI+pQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.5.tgz", + "integrity": "sha512-DzJ1vYf/7TaCYy57J3SJ9rV+JEuvmlnvvyvYKFbk5u46oQbBvuB9/0w+YsVsxkOv8zVWKpDmUoj4T5ILHoXevA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.5.tgz", + "integrity": "sha512-n1+O7xtU5lSLraRzX88CNcpl7vtGdPakKzww74bVwpAIRgz9JVLJJpOLb0uYqcOaXVM0TL6X0RVeIJGD2CnCkg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.5.tgz", + "integrity": "sha512-GuRVAsjq+c9YPK6NeTkRLWyQskDC099XkBSVO+6QzbnOnH2d/4mBVXYStaPrZD3dFRfg00I6BFJ9Atsjfs8mlg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.5.tgz", + "integrity": "sha512-iQiEMt8Q4/5aRGHpGVK2Zc7a6mx7qEAO7qehgSug3SDImnuMzgmm/wtJALXaz25zUj1PmnNHtShjFgk4PDx4nw==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.5.tgz", + "integrity": "sha512-81tijpDg2a6I1Yhj4aWY1l3O1J4Cg/Pd7LfvuaH2VVInAkXtzibz9+zSPdUM1WvuUi128ksstAP0hM5w48vQgg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.5.tgz", + "integrity": "sha512-12rba2HwemQPa7BLIKCzm1pT2/RuQHtSFHdNl41cFiC6oi4tcrp7gjB07pxQvFpcADojQywSjblQth6gJyE6CA==", + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.5.tgz", + "integrity": "sha512-+DpCAJFPAvViR17PIMi9x2AE34dll5wNlXO43wagAX2YcRGgEVHCNFC4azG85b4YyyFarvkc/iD5NPrz4Oneqw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.5.tgz", + "integrity": "sha512-Fuec/KPSpVLbGo6z1RPw4EE1X+z9gZk1uQmnYy7v4xr4TO9p41v1AoUuXEtyqAI7H+xNJYSICzRqZBhDEkd3kQ==", + "requires": { + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.5.tgz", + "integrity": "sha512-B1j9C/IfvshnPcklsc93AVLTrNVa69iSqztylZH6qnmiAsDDOmmjEYqOm3Ts2lGSgTSywnBNiqC949VdD0/gfw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.5.tgz", + "integrity": "sha512-d57i3vPHWgIde/9Y8W/xSFUndhvhZN5Wu2TjRrN1MVz5KzdUihKnfDVlfP1U7mS5DNj/WHHhaE4/tTi4hIyHwQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.5.tgz", + "integrity": "sha512-oHI15S/hdJuSCfnwIz+4lm6wu/wBn7oJ8+QrkzPPwSFGXk8kgdI/AIKcbR/XnD1nQVMg/i6eNaXpszbGuwYDRQ==", + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.5.tgz", + "integrity": "sha512-ABhUkxvoQyqhCWyb8xXtfwqNMJD7tx+irIRnUh6lmyFud7Jln1WzONXKlax1fg/ey178EXbs4bSGNd6PngO+SQ==", + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-simple-access": "^7.16.0", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.5.tgz", + "integrity": "sha512-53gmLdScNN28XpjEVIm7LbWnD/b/TpbwKbLk6KV4KqC9WyU6rq1jnNmVG6UgAdQZVVGZVoik3DqHNxk4/EvrjA==", + "requires": { + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-identifier": "^7.15.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.5.tgz", + "integrity": "sha512-qTFnpxHMoenNHkS3VoWRdwrcJ3FhX567GvDA3hRZKF0Dj8Fmg0UzySZp3AP2mShl/bzcywb/UWAMQIjA1bhXvw==", + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.5.tgz", + "integrity": "sha512-/wqGDgvFUeKELW6ex6QB7dLVRkd5ehjw34tpXu1nhKC0sFfmaLabIswnpf8JgDyV2NeDmZiwoOb0rAmxciNfjA==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.5.tgz", + "integrity": "sha512-ZaIrnXF08ZC8jnKR4/5g7YakGVL6go6V9ql6Jl3ecO8PQaQqFE74CuM384kezju7Z9nGCCA20BqZaR1tJ/WvHg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-object-assign": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.16.5.tgz", + "integrity": "sha512-KVuJ7sWf6bcXawKVH6ZDQFYcOulObt1IOvl/gvNrkNXzmFf1IdgKOy4thmVomReleXqffMbptmXXMl3zPI7zHw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.5.tgz", + "integrity": "sha512-tded+yZEXuxt9Jdtkc1RraW1zMF/GalVxaVVxh41IYwirdRgyAxxxCKZ9XB7LxZqmsjfjALxupNE1MIz9KH+Zg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.5.tgz", + "integrity": "sha512-B3O6AL5oPop1jAVg8CV+haeUte9oFuY85zu0jwnRNZZi3tVAbJriu5tag/oaO2kGaQM/7q7aGPBlTI5/sr9enA==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.5.tgz", + "integrity": "sha512-+IRcVW71VdF9pEH/2R/Apab4a19LVvdVsr/gEeotH00vSDVlKD+XgfSIw+cgGWsjDB/ziqGv/pGoQZBIiQVXHg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.5.tgz", + "integrity": "sha512-2z+it2eVWU8TtQQRauvGUqZwLy4+7rTfo6wO4npr+fvvN1SW30ZF3O/ZRCNmTuu4F5MIP8OJhXAhRV5QMJOuYg==", + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.5.tgz", + "integrity": "sha512-aIB16u8lNcf7drkhXJRoggOxSTUAuihTSTfAcpynowGJOZiGf+Yvi7RuTwFzVYSYPmWyARsPqUGoZWWWxLiknw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.5.tgz", + "integrity": "sha512-ZbuWVcY+MAXJuuW7qDoCwoxDUNClfZxoo7/4swVbOW1s/qYLOMHlm9YRWMsxMFuLs44eXsv4op1vAaBaBaDMVg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.5.tgz", + "integrity": "sha512-5d6l/cnG7Lw4tGHEoga4xSkYp1euP7LAtrah1h1PgJ3JY7yNsjybsxQAnVK4JbtReZ/8z6ASVmd3QhYYKLaKZw==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.5.tgz", + "integrity": "sha512-usYsuO1ID2LXxzuUxifgWtJemP7wL2uZtyrTVM4PKqsmJycdS4U4mGovL5xXkfUheds10Dd2PjoQLXw6zCsCbg==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.5.tgz", + "integrity": "sha512-gnyKy9RyFhkovex4BjKWL3BVYzUDG6zC0gba7VMLbQoDuqMfJ1SDXs8k/XK41Mmt1Hyp4qNAvGFb9hKzdCqBRQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.5.tgz", + "integrity": "sha512-ldxCkW180qbrvyCVDzAUZqB0TAeF8W/vGJoRcaf75awm6By+PxfJKvuqVAnq8N9wz5Xa6mSpM19OfVKKVmGHSQ==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.5.tgz", + "integrity": "sha512-shiCBHTIIChGLdyojsKQjoAyB8MBwat25lKM7MJjbe1hE0bgIppD+LX9afr41lLHOhqceqeWl4FkLp+Bgn9o1Q==", + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.5.tgz", + "integrity": "sha512-GTJ4IW012tiPEMMubd7sD07iU9O/LOo8Q/oU4xNhcaq0Xn8+6TcUQaHtC8YxySo1T+ErQ8RaWogIEeFhKGNPzw==", + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/preset-env": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.5.tgz", + "integrity": "sha512-MiJJW5pwsktG61NDxpZ4oJ1CKxM1ncam9bzRtx9g40/WkLRkxFP6mhpkYV0/DxcciqoiHicx291+eUQrXb/SfQ==", + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.2", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.0", + "@babel/plugin-proposal-async-generator-functions": "^7.16.5", + "@babel/plugin-proposal-class-properties": "^7.16.5", + "@babel/plugin-proposal-class-static-block": "^7.16.5", + "@babel/plugin-proposal-dynamic-import": "^7.16.5", + "@babel/plugin-proposal-export-namespace-from": "^7.16.5", + "@babel/plugin-proposal-json-strings": "^7.16.5", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", + "@babel/plugin-proposal-numeric-separator": "^7.16.5", + "@babel/plugin-proposal-object-rest-spread": "^7.16.5", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.5", + "@babel/plugin-proposal-optional-chaining": "^7.16.5", + "@babel/plugin-proposal-private-methods": "^7.16.5", + "@babel/plugin-proposal-private-property-in-object": "^7.16.5", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@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-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.5", + "@babel/plugin-transform-async-to-generator": "^7.16.5", + "@babel/plugin-transform-block-scoped-functions": "^7.16.5", + "@babel/plugin-transform-block-scoping": "^7.16.5", + "@babel/plugin-transform-classes": "^7.16.5", + "@babel/plugin-transform-computed-properties": "^7.16.5", + "@babel/plugin-transform-destructuring": "^7.16.5", + "@babel/plugin-transform-dotall-regex": "^7.16.5", + "@babel/plugin-transform-duplicate-keys": "^7.16.5", + "@babel/plugin-transform-exponentiation-operator": "^7.16.5", + "@babel/plugin-transform-for-of": "^7.16.5", + "@babel/plugin-transform-function-name": "^7.16.5", + "@babel/plugin-transform-literals": "^7.16.5", + "@babel/plugin-transform-member-expression-literals": "^7.16.5", + "@babel/plugin-transform-modules-amd": "^7.16.5", + "@babel/plugin-transform-modules-commonjs": "^7.16.5", + "@babel/plugin-transform-modules-systemjs": "^7.16.5", + "@babel/plugin-transform-modules-umd": "^7.16.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.5", + "@babel/plugin-transform-new-target": "^7.16.5", + "@babel/plugin-transform-object-super": "^7.16.5", + "@babel/plugin-transform-parameters": "^7.16.5", + "@babel/plugin-transform-property-literals": "^7.16.5", + "@babel/plugin-transform-regenerator": "^7.16.5", + "@babel/plugin-transform-reserved-words": "^7.16.5", + "@babel/plugin-transform-shorthand-properties": "^7.16.5", + "@babel/plugin-transform-spread": "^7.16.5", + "@babel/plugin-transform-sticky-regex": "^7.16.5", + "@babel/plugin-transform-template-literals": "^7.16.5", + "@babel/plugin-transform-typeof-symbol": "^7.16.5", + "@babel/plugin-transform-unicode-escapes": "^7.16.5", + "@babel/plugin-transform-unicode-regex": "^7.16.5", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.0", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.4.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.19.1", + "semver": "^6.3.0" + } + }, + "@babel/preset-modules": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", + "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/runtime": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", + "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", + "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "requires": { + "@babel/code-frame": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/traverse": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz", + "integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==", + "requires": { + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.5", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/parser": "^7.16.5", + "@babel/types": "^7.16.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@babel/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", + "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "requires": { + "@babel/helper-validator-identifier": "^7.15.7", + "to-fast-properties": "^2.0.0" + } + }, + "@discoveryjs/json-ext": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz", + "integrity": "sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA==" + }, + "@eslint/eslintrc": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", + "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.2.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "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 + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", + "integrity": "sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "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 + } + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@socket.io/component-emitter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz", + "integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q==" + }, + "@types/component-emitter": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz", + "integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==" + }, + "@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==" + }, + "@types/cors": { + "version": "2.8.12", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz", + "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==" + }, + "@types/eslint": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.2.1.tgz", + "integrity": "sha512-UP9rzNn/XyGwb5RQ2fok+DzcIRIYwc16qTXse5+Smsy8MOIccCChT15KAwnsgQx4PzJkaMq4myFyZ4CL5TjhIQ==", + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.2.tgz", + "integrity": "sha512-TzgYCWoPiTeRg6RQYgtuW7iODtVoKu3RVL72k3WohqhjfaOLK5Mg2T4Tg1o2bSfu0vPkoI48wdQFv5b/Xe04wQ==", + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==" + }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/node": { + "version": "17.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.3.tgz", + "integrity": "sha512-bAKB1GcA28FR/D8HHQ5U4FYk7nvoZdp7TZSy9oIyQ8gpYCzpeESa3LCK2TbeocXic7GwIXCkCItJg0DttO3ZaQ==" + }, + "@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "requires": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==" + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==" + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==" + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==" + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/configtest": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz", + "integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==" + }, + "@webpack-cli/info": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz", + "integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==", + "requires": { + "envinfo": "^7.7.3" + } + }, + "@webpack-cli/serve": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz", + "integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==" + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -13,25 +1688,158 @@ "negotiator": "0.6.2" } }, - "after": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", - "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + "acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==" + }, + "acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==" + }, + "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 + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==" + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "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==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "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 }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, - "arraybuffer.slice": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", - "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + "array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + "array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + } + }, + "babel-eslint": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", + "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0", + "eslint-visitor-keys": "^1.0.0", + "resolve": "^1.12.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==" + } + } + }, + "babel-loader": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.3.tgz", + "integrity": "sha512-n4Zeta8NC3QAsuyiizu0GkmRcQ6clkV9WFUnUf1iXP//IeSKbWjofW3UHyZVwlOB4y039YQKefawyTn64Zwbuw==", + "requires": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^1.4.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + } + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.0.tgz", + "integrity": "sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA==", + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.0", + "semver": "^6.1.1" + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.4.0.tgz", + "integrity": "sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==", + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.18.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.0.tgz", + "integrity": "sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg==", + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0" + } }, "backo2": { "version": "1.0.2", @@ -39,48 +1847,40 @@ "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base64-arraybuffer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", - "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.1.tgz", + "integrity": "sha512-vFIUq7FdLtjZMhATwDul5RZWv2jpXQ09Pd6jcVEOvIsqCWTRFD/ONHNfyOS8dA/Ippi5dsIgpyKWKZaAKZltbA==" }, "base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" }, - "better-assert": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", - "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", - "requires": { - "callsite": "1.0.0" - } - }, - "blob": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", - "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" }, "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz", + "integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==", "requires": { - "bytes": "3.1.0", + "bytes": "3.1.1", "content-type": "~1.0.4", "debug": "2.6.9", "depd": "~1.1.2", - "http-errors": "1.7.2", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" + "qs": "6.9.6", + "raw-body": "2.4.2", + "type-is": "~1.6.18" } }, "brace-expansion": { @@ -92,30 +1892,105 @@ "concat-map": "0.0.1" } }, + "browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "requires": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + } + }, + "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==" + }, "bytes": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz", + "integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true }, - "callsite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", - "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + "caniuse-lite": { + "version": "1.0.30001292", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz", + "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==" }, - "component-bind": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==" + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colorette": { + "version": "2.0.16", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", + "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==" + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=" }, "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" - }, - "component-inherit": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", - "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, "concat-map": { "version": "0.0.1", @@ -123,11 +1998,18 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "5.2.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "content-type": { @@ -135,22 +2017,58 @@ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" }, "cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, - "cron": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/cron/-/cron-1.8.2.tgz", - "integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==", + "core-js-compat": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.0.tgz", + "integrity": "sha512-relrah5h+sslXssTTOkvqcC/6RURifB0W5yhYBdBkaPYa5/2KBMiog3XiD+s3TwEHWxInWVv4Jx2/Lw0vng+IQ==", "requires": { - "moment-timezone": "^0.5.x" + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==" + } + } + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" } }, "debug": { @@ -161,6 +2079,20 @@ "ms": "2.0.0" } }, + "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 + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -171,38 +2103,366 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, + "electron-to-chromium": { + "version": "1.4.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.27.tgz", + "integrity": "sha512-uZ95szi3zUbzRDx1zx/xnsCG+2xgZyy57pDOeaeO4r8zx5Dqe8Jv1ti8cunvBwJHVI5LzPuw8umKwZb3WKYxSQ==" + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, "engine.io": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.2.tgz", - "integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.0.tgz", + "integrity": "sha512-ErhZOVu2xweCjEfYcTdkCnEYUiZgkAcBBAhW4jbIvNG8SLU3orAqoJCiytZjYF7eTpVmmCrLDjLIEaPlUAs1uw==", "requires": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", - "cookie": "0.3.1", - "debug": "~4.1.0", - "engine.io-parser": "~2.2.0", - "ws": "^7.1.2" + "cookie": "~0.4.1", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.0", + "ws": "~8.2.3" }, "dependencies": { - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "engine.io-client": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz", + "integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==", + "requires": { + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.0.0", + "has-cors": "1.1.0", + "parseqs": "0.0.6", + "parseuri": "0.0.6", + "ws": "~8.2.3", + "xmlhttprequest-ssl": "~2.0.0", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "engine.io-parser": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.2.tgz", + "integrity": "sha512-wuiO7qO/OEkPJSFueuATIXtrxF7/6GTbAO9QLv7nnbjwZ5tYhLm9zxvLwxstRs0dcT0KUlWTjtIOs1T86jt12g==", + "requires": { + "base64-arraybuffer": "~1.0.1" + } + }, + "enhanced-resolve": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", + "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==" + }, + "es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + } + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "eslint": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.6.0.tgz", + "integrity": "sha512-UvxdOJ7mXFlw7iuHZA4jmzPaUqIw54mZrv+XPYKNbKdLR0et4rf60lIZUU9kiNtnzzMzGWxMV+tQ7uG7JG8DPw==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.0.5", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.1.0", + "espree": "^9.3.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.2.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "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, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "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, + "requires": { + "color-name": "~1.1.4" + } + }, + "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 }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "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 + }, + "eslint-scope": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", + "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", + "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "dev": true + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "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 + }, + "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 + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "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, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "eslint-config-standard": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.3.tgz", + "integrity": "sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==" + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, "requires": { "ms": "^2.1.1" } @@ -210,94 +2470,317 @@ "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true } } }, - "engine.io-client": { - "version": "3.4.4", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.4.tgz", - "integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==", + "eslint-module-utils": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.2.tgz", + "integrity": "sha512-zquepFnWCY2ISMFwD/DqzaM++H+7PDzOpUvotJWm/y1BAFt5R4oeULgdrTejKqLkz7MA/tgstsUMNYc7wNdTrg==", + "dev": true, "requires": { - "component-emitter": "~1.3.0", - "component-inherit": "0.0.3", - "debug": "~3.1.0", - "engine.io-parser": "~2.2.0", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "parseqs": "0.0.6", - "parseuri": "0.0.6", - "ws": "~6.1.0", - "xmlhttprequest-ssl": "~1.5.4", - "yeast": "0.1.2" + "debug": "^3.2.7", + "find-up": "^2.1.0" }, "dependencies": { - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, - "parseqs": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", - "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" - }, - "parseuri": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", - "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" - }, - "ws": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", - "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, "requires": { - "async-limiter": "~1.0.0" + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.25.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz", + "integrity": "sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.2", + "has": "^1.0.3", + "is-core-module": "^2.8.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.12.0" + }, + "dependencies": { + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" } } } }, - "engine.io-parser": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", - "integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==", + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, "requires": { - "after": "0.8.2", - "arraybuffer.slice": "~0.0.7", - "base64-arraybuffer": "0.1.4", - "blob": "0.0.5", - "has-binary2": "~1.0.2" + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + } } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + "eslint-plugin-promise": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", + "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "espree": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", + "dev": true, + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.1.0" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", + "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "dev": true + } + } + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "requires": { + "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" + } + }, "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz", + "integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==", "requires": { "accepts": "~1.3.7", "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", @@ -311,17 +2794,24 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + } } }, "express-force-https": { @@ -329,6 +2819,41 @@ "resolved": "https://registry.npmjs.org/express-force-https/-/express-force-https-1.0.0.tgz", "integrity": "sha1-KtuBIaaJRhb8eOoFsVvY1LhV/Qw=" }, + "express-rate-limit": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.0.1.tgz", + "integrity": "sha512-4J8og2zuaafv9egUfQ3G5+hRZfTtckimd4leYPkEXNn2XOQ/IBJIwDmHrwbd2ZbI6UEX3AlyAKLG2EWiXvgCig==" + }, + "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==" + }, + "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==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", + "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==" + }, + "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, + "requires": { + "flat-cache": "^3.0.4" + } + }, "finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", @@ -343,10 +2868,45 @@ "unpipe": "~1.0.0" } }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", + "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", + "dev": true + }, "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" }, "fresh": { "version": "0.5.2", @@ -358,10 +2918,52 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "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 + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "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==" + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -371,31 +2973,92 @@ "path-is-absolute": "^1.0.0" } }, - "has-binary2": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", - "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "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, "requires": { - "isarray": "2.0.1" + "is-glob": "^4.0.3" } }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + }, + "graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "requires": { "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + } } }, + "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==" + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -404,10 +3067,44 @@ "safer-buffer": ">= 2.1.2 < 3" } }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "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, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "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 + } + } + }, + "import-local": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz", + "integrity": "sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA==", + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true }, "inflight": { "version": "1.0.6", @@ -419,48 +3116,340 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==" }, "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true + }, + "is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-docker": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", - "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==", + "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "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, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true + }, + "is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, "requires": { "is-docker": "^2.0.0" } }, - "isarray": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", - "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" }, "jasmine": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.3.tgz", - "integrity": "sha512-Th91zHsbsALWjDUIiU5d/W5zaYQsZFMPTdeNmi8GivZPmAaUAK8MblSG3yQI4VMGC/abF2us7ex60NH1AAIMTA==", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.10.0.tgz", + "integrity": "sha512-2Y42VsC+3CQCTzTwJezOvji4qLORmKIE0kwowWC+934Krn6ZXNQYljiwK5st9V3PVx96BSiDYXSB60VVah3IlQ==", "requires": { "glob": "^7.1.6", - "jasmine-core": "~3.6.0" + "jasmine-core": "~3.10.0" } }, "jasmine-core": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.6.0.tgz", - "integrity": "sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw==" + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.10.1.tgz", + "integrity": "sha512-ooZWSDVAdh79Rrj4/nnfklL3NQVra0BcuhcuWoAwwi+znLDoUeH87AFfeX8s+YeYi6xlv5nveRyaA1v7CintfA==" + }, + "jest-worker": { + "version": "27.4.5", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.4.5.tgz", + "integrity": "sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg==", + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "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, + "requires": { + "argparse": "^2.0.1" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "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==" + }, + "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": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "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, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "loader-runner": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", + "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==" + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" + }, + "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 + }, + "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, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "requires": { + "semver": "^6.0.0" + } }, "media-typer": { "version": "0.3.0", @@ -472,6 +3461,11 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, + "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==" + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -495,6 +3489,11 @@ "mime-db": "1.44.0" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -503,33 +3502,82 @@ "brace-expansion": "^1.1.7" } }, - "moment": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", - "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" - }, - "moment-timezone": { - "version": "0.5.32", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.32.tgz", - "integrity": "sha512-Z8QNyuQHQAmWucp8Knmgei8YNo28aLjJq6Ma+jy1ZSpSk5nyfRT8xgUbSQvD2+2UajISfenndwvFuH3NGS+nvA==", - "requires": { - "moment": ">= 2.9.0" - } + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, - "object-component": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", - "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==" + }, + "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==", + "requires": { + "path-key": "^3.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } }, "on-finished": { "version": "2.3.0", @@ -547,60 +3595,158 @@ "wrappy": "1" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, "open": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/open/-/open-7.3.0.tgz", "integrity": "sha512-mgLwQIx2F/ye9SmbrUkurZCnkoXyXyu9EbHtJZrICjVAJfyMArdHp3KkixGdZx1ZHFPNIwl0DDM1dFFqXbTLZw==", - "dev": true, "requires": { "is-docker": "^2.0.0", "is-wsl": "^2.1.1" } }, - "parseqs": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", - "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, "requires": { - "better-assert": "~1.0.0" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" } }, - "parseuri": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", - "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "requires": { - "better-assert": "~1.0.0" + "p-try": "^2.0.0" } }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "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, + "requires": { + "callsites": "^3.0.0" + } + }, + "parseqs": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" + }, + "parseuri": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, + "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==" + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "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==" + }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, - "proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "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==", "requires": { - "forwarded": "~0.1.2", + "find-up": "^4.0.0" + } + }, + "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 + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "version": "6.9.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", + "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } }, "range-parser": { "version": "1.2.1", @@ -608,16 +3754,120 @@ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz", + "integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==", "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", + "bytes": "3.1.1", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, + "rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "requires": { + "resolve": "^1.9.0" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" + }, + "regenerate-unicode-properties": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", + "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", + "requires": { + "regenerate": "^1.4.2" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" + }, + "regenerator-transform": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", + "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "requires": { + "@babel/runtime": "^7.8.4" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "regexpu-core": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", + "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", + "requires": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + } + }, + "regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==" + }, + "regjsparser": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", + "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" + } + } + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "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==", + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -628,10 +3878,25 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "schema-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "requires": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "requires": { "debug": "2.6.9", "depd": "~1.1.2", @@ -640,163 +3905,195 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" }, "dependencies": { "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "requires": { + "randombytes": "^2.1.0" + } + }, "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" } }, "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "requires": { + "kind-of": "^6.0.2" + } + }, + "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==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==" }, "socket.io": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", - "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.4.0.tgz", + "integrity": "sha512-bnpJxswR9ov0Bw6ilhCvO38/1WPtE3eA2dtxi2Iq4/sFebiDJQzgKNYA7AuVVdGW09nrESXd90NbZqtDd9dzRQ==", "requires": { - "debug": "~4.1.0", - "engine.io": "~3.4.0", - "has-binary2": "~1.0.2", - "socket.io-adapter": "~1.1.0", - "socket.io-client": "2.3.0", - "socket.io-parser": "~3.4.0" + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "debug": "~4.3.2", + "engine.io": "~6.1.0", + "socket.io-adapter": "~2.3.3", + "socket.io-parser": "~4.0.4" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, "socket.io-adapter": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", - "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==" + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.3.3.tgz", + "integrity": "sha512-Qd/iwn3VskrpNO60BeRyCyr8ZWw9CPZyitW4AQwmRZ8zCiyDiL+znRnWX6tDHXnWn1sJrM1+b6Mn6wEDJJ4aYQ==" }, "socket.io-client": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", - "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.0.tgz", + "integrity": "sha512-g7riSEJXi7qCFImPow98oT8X++MSsHz6MMFRXkWNJ6uEROSHOa3kxdrsYWMq85dO+09CFMkcqlpjvbVXQl4z6g==", "requires": { - "backo2": "1.0.2", - "base64-arraybuffer": "0.1.5", - "component-bind": "1.0.0", - "component-emitter": "1.2.1", - "debug": "~4.1.0", - "engine.io-client": "~3.4.0", - "has-binary2": "~1.0.2", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "object-component": "0.0.3", - "parseqs": "0.0.5", - "parseuri": "0.0.5", - "socket.io-parser": "~3.3.0", - "to-array": "0.1.4" + "@socket.io/component-emitter": "~3.0.0", + "backo2": "~1.0.2", + "debug": "~4.3.2", + "engine.io-client": "~6.1.1", + "parseuri": "0.0.6", + "socket.io-parser": "~4.1.1" }, "dependencies": { - "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" - }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "socket.io-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.1.tgz", - "integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.1.tgz", + "integrity": "sha512-USQVLSkDWE5nbcY760ExdKaJxCE65kcsG/8k5FDGZVVxpD1pA7hABYXYkCUvxUuYYh/+uQw0N/fvBzfT8o07KA==", "requires": { - "component-emitter": "~1.3.0", - "debug": "~3.1.0", - "isarray": "2.0.1" - }, - "dependencies": { - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } + "@socket.io/component-emitter": "~3.0.0", + "debug": "~4.3.1" } } } }, "socket.io-parser": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", - "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz", + "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==", "requires": { - "component-emitter": "1.2.1", - "debug": "~4.1.0", - "isarray": "2.0.1" + "@types/component-emitter": "^1.2.10", + "component-emitter": "~1.3.0", + "debug": "~4.3.1" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" } } }, @@ -805,15 +4102,164 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, - "to-array": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", - "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "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, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "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==" + }, + "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 + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==" + }, + "terser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.10.0.tgz", + "integrity": "sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==", + "requires": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.20" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" + } + } + }, + "terser-webpack-plugin": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz", + "integrity": "sha512-LPIisi3Ol4chwAaPP8toUJ3L4qCM1G0wao7L3qNv57Drezxj6+VEyySpPw4B1HSO2Eg/hDY/MNF5XihCAoqnsQ==", + "requires": { + "jest-worker": "^27.4.1", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.2" + }, + "dependencies": { + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" }, "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "tsconfig-paths": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", + "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "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, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "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 }, "type-is": { "version": "1.6.18", @@ -824,35 +4270,225 @@ "mime-types": "~2.1.24" } }, + "unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==" + }, + "unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "requires": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", + "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==" + }, + "unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", + "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==" + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, + "watchpack": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", + "integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "webpack": { + "version": "5.65.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.65.0.tgz", + "integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==", + "requires": { + "@types/eslint-scope": "^3.7.0", + "@types/estree": "^0.0.50", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.4.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.8.3", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.4", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.3.1", + "webpack-sources": "^3.2.2" + }, + "dependencies": { + "acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==" + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, + "webpack-cli": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", + "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==", + "requires": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.1.0", + "@webpack-cli/info": "^1.4.0", + "@webpack-cli/serve": "^1.6.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-remove-debug": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/webpack-remove-debug/-/webpack-remove-debug-0.1.0.tgz", + "integrity": "sha1-tfCSLQ24HG37498BrgYeaXfDa4E=" + }, + "webpack-sources": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz", + "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==" + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.1.tgz", - "integrity": "sha512-pTsP8UAfhy3sk1lSk/O/s4tjD0CRwvMnzvwr4OKGX7ZvqZtUyx4KIJB5JWbkykPoc55tixMGgTNoh3k4FkNGFQ==" + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==" }, "xmlhttprequest-ssl": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", - "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "yeast": { "version": "0.1.2", diff --git a/package.json b/package.json index 990b59f..1235b00 100644 --- a/package.json +++ b/package.json @@ -2,20 +2,56 @@ "name": "werewolf_game", "version": "1.0.0", "description": "", - "main": "index.js", + "private": true, "scripts": { + "bundle": "webpack --config client/webpack/webpack-prod.config.js", + "prestart": "npm run bundle", + "build:dev": "webpack --watch --config client/webpack/webpack-dev.config.js --mode=development", + "start:dev": "NODE_ENV=development nodemon server/main.js", + "start:dev:no-hot-reload": "NODE_ENV=development && node server/main.js", + "start:dev:windows": "SET NODE_ENV=development && nodemon server/main.js", + "start:dev:windows:no-hot-reload": "SET NODE_ENV=development && node server/main.js", + "start": "NODE_ENV=production node server/main.js -- loglevel=trace port=8080", + "start:windows": "SET NODE_ENV=production && node server/main.js -- loglevel=warn port=8080", "test": "jasmine" }, + "engines": { + "node": ">=14.0.0" + }, "author": "", "license": "ISC", "dependencies": { - "cron": "^1.7.1", + "@babel/plugin-transform-object-assign": "^7.16.5", + "@babel/preset-env": "^7.16.5", + "acorn": "^8.6.0", + "babel-eslint": "^10.1.0", + "babel-loader": "^8.2.3", + "body-parser": "^1.19.1", + "cors": "^2.8.5", + "eslint-config-standard": "^16.0.3", "express": "^4.17.1", "express-force-https": "^1.0.0", + "express-rate-limit": "^6.0.1", "jasmine": "^3.5.0", - "socket.io": "^2.2.0" + "open": "^7.0.3", + "socket.io": "^4.4.0", + "socket.io-client": "^4.4.0", + "webpack": "^5.65.0", + "webpack-cli": "^4.9.1", + "webpack-remove-debug": "^0.1.0" }, "devDependencies": { - "open": "^7.0.3" + "@babel/core": "^7.16.7", + "@babel/eslint-parser": "^7.16.5", + "eslint": "^8.6.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^6.0.0" + }, + "nodemonConfig": { + "ignore": [ + "client/*", + "node_modules/*" + ] } } diff --git a/server-helper.js b/server-helper.js deleted file mode 100644 index 2b7a0db..0000000 --- a/server-helper.js +++ /dev/null @@ -1,206 +0,0 @@ -const debugMode = Array.from(process.argv.map( (arg)=>arg.trim().toLowerCase() )).includes("debug"); -const LOGGER = require("./javascript/modules/logger")(debugMode); - -module.exports = class { - - constructor(CronJob) { - // TODO: do better than a plain object - this.activeGames = {}; - this.timers = {}; - - // cron job for periodically clearing finished games - const scope = this; - this.job = new CronJob('0 0 */2 * * *', function() { - console.log(scope.activeGames); - for (const key in scope.activeGames) { - if (scope.activeGames.hasOwnProperty(key) && (Math.abs((new Date()) - (new Date(scope.activeGames[key].startTime))) / 36e5) >= 2) { - delete scope.activeGames[key]; - } - } - console.log("Games pruned at: " + (new Date().toDateString()) + " " + (new Date()).toTimeString()); - }); - console.log("cron job created"); - this.job.start(); - } - - killPlayer(id, code) { - let game = this.findGame(code); - if (game) { - let player = game.players.find((player) => player.id === id); - if (player) { - player.dead = true; - player.deadAt = new Date().toJSON(); - game.killedPlayer = player.name; - game.lastKilled = player.id; - game.killedRole = player.card.role; - game.message = game.reveals - ? player.name + ", a " + player.card.role + ", was killed!" - : player.name + " has died!"; - console.log(game.message); - if (player.card.isTypeOfWerewolf && game.hasDreamWolf) { - this.activateDreamWolvesIfNeeded(game); - } - const winCheck = module.exports.teamWon(game); - if (winCheck === "wolf") { - console.log("wolves won the game!"); - game.winningTeam = "wolf"; - game.status = "ended"; - } - if (winCheck === "village") { - console.log("village won the game!"); - game.winningTeam = "village"; - game.status = "ended"; - } - } - } - } - - endGameDueToTimeExpired(code) { - if (this.timers[code]) { - clearInterval(this.timers[code]); - } - let game = this.findGame(code); - if (game) { - LOGGER.debug("Game " + code + " has ended due to expired timer."); - game.winningTeam = "wolf"; - game.status = "ended"; - } - } - - clearGameTimer(code) { - if (this.timers[code]) { - clearInterval(this.timers[code]); - LOGGER.debug("game paused and timer cleared for " + code); - } - } - - resumeGame(code) { - let game = this.findGame(code); - if (game) { - game.paused = false; - let newTime = new Date(game.endTime).getTime() + (new Date().getTime() - new Date(game.pauseTime).getTime()); - let newDate = new Date(game.endTime); - newDate.setTime(newTime); - game.endTime = newDate.toJSON(); - LOGGER.debug("Game " + code + " timer has been unpaused, starting clock anew..."); - this.startGameClock(code, newDate - Date.now()); - } - } - - pauseGame(code) { - let game = this.findGame(code); - if (game) { - game.pauseTime = (new Date()).toJSON(); - game.paused = true; - this.clearGameTimer(code); - } - } - - startGameClock(code, time) { - LOGGER.debug("timer started for game " + code); - let moduleScope = this; - if (this.timers[code]) { - clearInterval(this.timers[code]); - } - this.timers[code] = setInterval(function() { - moduleScope.endGameDueToTimeExpired(code) - }, time); - } - - startGame(gameData) { - let game = this.findGame(gameData.code); - if (game) { - LOGGER.debug("game " + gameData.code + " started"); - game.status = "started"; - game.players = gameData.players; - if (game.time) { - let d = new Date(); - d.setMinutes(d.getMinutes() + parseInt(game.time)); - game.endTime = d.toJSON(); - this.startGameClock(gameData.code, game.time * 60 * 1000); // provided time is in minutes - } - } - } - - requestState(data, socket) { - const game = this.findGame(data.code); - if (game && Object.keys(socket.rooms).includes(data.code) === false) { - socket.join(data.code, function() { - socket.emit('state', game); - }); - } else { - if (game) { - socket.emit('state', game); - } - } - } - - joinGame(playerInfo, socket) { - - const game = this.findGame(playerInfo.code); - if (game && game.players.length < game.size && !game.players.find((player) => player.id === playerInfo.id)) { - game.players.push({name: playerInfo.name, id: playerInfo.id}); - console.log(playerInfo.name + " joined the game!"); - socket.emit('success'); - } else { - if (game && game.players.length === game.size) { - socket.emit("joinError", "This game is full - sorry!"); - } else { - socket.emit("joinError", "No game found"); - } - } - } - - newGame(game, onSuccess) { - this.activeGames[game.accessCode] = game; - this.activeGames[game.accessCode].startTime = (new Date()).toJSON(); - console.log("Game created at " + (new Date().toDateString()) + " " + (new Date()).toTimeString()); - onSuccess(); - } - - findGame(code) { - return this.activeGames[Object.keys(this.activeGames).find((key) => key === code)]; - } - - // If there are multiple dream wolves, convert them all. - activateDreamWolvesIfNeeded(game) { - game.players.forEach((player) => { - if (!player.dead && player.card.role === "Dream Wolf") { - player.card.isTypeOfWerewolf = true; - console.log("player " + player.name + " was converted to a wolf!"); - } - }) - } - - static teamWon(game) { - let wolvesAlive = 0; - let villagersAlive = 0; - let totalAlive = 0; - let hunterAlive = false; - for (const player of game.players) { - if (!player.card.isTypeOfWerewolf && !player.dead) { - villagersAlive ++; - } - if (player.card.isTypeOfWerewolf && !player.dead) { - wolvesAlive ++; - } - if (player.card.role === "Hunter" && !player.dead) { - hunterAlive = true; - } - if (!player.dead) { - totalAlive ++; - } - } - if (wolvesAlive === 0) { - return "village" - } - if ((wolvesAlive >= villagersAlive) && (totalAlive !== 2)) { - return "wolf"; - } - if (totalAlive === 2) { - return hunterAlive ? "village" : "wolf" - } - return false; - } -}; - diff --git a/server.js b/server.js deleted file mode 100644 index ae6f96f..0000000 --- a/server.js +++ /dev/null @@ -1,79 +0,0 @@ -// Dependencies -const express = require('express'); -const http = require('http'); -const socketIO = require('socket.io'); -const app = express(); -const server = http.Server(app); -const io = socketIO(server); -const ServerHelper = require('./server-helper.js'); -const secure = require('express-force-https'); -app.use(secure); - -// Link websocket interaction functions, separated to aid testing -const CronJob = require('cron').CronJob; -const serverHelper = new ServerHelper(CronJob); - -const debugMode = Array.from(process.argv.map( (arg)=>arg.trim().toLowerCase() )).includes("debug"); -const LOGGER = require("./javascript/modules/logger")(debugMode); - -app.set('port', 5000); - -app.use('/javascript', express.static(__dirname + '/javascript')); // Routing -app.use('/assets', express.static(__dirname + '/assets')); // Routing -app.use('/stylesheets', express.static(__dirname + '/stylesheets')); // Routing -app.use('/node_modules/socket.io-client', express.static(__dirname + '/node_modules/socket.io-client')); // Routing -app.get('', function(request, response) { - response.sendFile(__dirname + '/views/index.html'); -}); - -app.get('/learn', function(request, response) { - response.sendFile(__dirname + '/views/learn.html'); -}); - -app.get('/faq', function(request, response) { - response.sendFile(__dirname + '/views/faq.html'); -}); - -app.get('/create', function(request, response) { - response.sendFile(__dirname + '/views/create_game.html'); -}); - -app.get('/join', function(request, response) { - response.sendFile(__dirname + '/views/join_game.html'); -}); - -app.get('/:code', function(request, response) { - response.sendFile(__dirname + '/views/game.html'); -}); - -// Starts the server. -server.listen(process.env.PORT || 5000, function() { - console.log('Starting server on port 5000'); -}); - -// Add the WebSocket handlers -io.on('connection', function(socket) { - socket.on('newGame', function(game, onSuccess) { - serverHelper.newGame(game, onSuccess); - }); - socket.on('joinGame', function(playerInfo) { - serverHelper.joinGame(playerInfo, socket); - }); - // send the game state to the client that requested it - socket.on('requestState', function(data) { - serverHelper.requestState(data, socket); - }); - socket.on('startGame', function(gameData) { - serverHelper.startGame(gameData); - }); - socket.on('pauseGame', function(code) { - serverHelper.pauseGame(code); - }); - socket.on('resumeGame', function(code) { - serverHelper.resumeGame(code); - }); - socket.on('killPlayer', function(id, code) { - serverHelper.killPlayer(id, code); - }); -}); - diff --git a/server/api/GamesAPI.js b/server/api/GamesAPI.js new file mode 100644 index 0000000..206f745 --- /dev/null +++ b/server/api/GamesAPI.js @@ -0,0 +1,54 @@ +const express = require('express'); +const router = express.Router(); +const debugMode = Array.from(process.argv.map((arg) => arg.trim().toLowerCase())).includes('debug'); +const logger = require('../modules/Logger')(debugMode); +const GameManager = require('../modules/GameManager.js'); +const rateLimit = require('express-rate-limit').default; +const globals = require('../config/globals'); + +const gameManager = new GameManager().getInstance(); + +const apiLimiter = rateLimit({ + windowMs: 600000, + max: 5, + standardHeaders: true, + legacyHeaders: false +}); + +if (process.env.NODE_ENV.trim() === 'production') { // in prod, limit clients to creating 5 games per 10 minutes. + router.use('/create', apiLimiter); +} + +router.post('/create', function (req, res) { + logger.trace('Received request to create new game: ' + JSON.stringify(req.body, null, 4)); + const gameCreationPromise = gameManager.createGame(req.body, false); + gameCreationPromise.then((result) => { + if (result instanceof Error) { + res.status(500).send(); + } else { + res.send(result); // game was created successfully, and access code was returned + } + }).catch((e) => { + if (e === globals.ERROR_MESSAGE.BAD_CREATE_REQUEST) { + res.status(400).send(globals.ERROR_MESSAGE.BAD_CREATE_REQUEST); + } + }); +}); + +router.get('/availability/:code', function (req, res) { + const joinGamePromise = gameManager.joinGame(req.params.code); + joinGamePromise.then((result) => { + if (result === 404) { + res.status(404).send(); + } else if (result instanceof Error) { + res.status(400).send(result.message); + } else if (typeof result === 'string') { + logger.debug(result); + res.status(200).send(result); + } else { + res.status(500).send(); + } + }); +}); + +module.exports = router; diff --git a/server/config/globals.js b/server/config/globals.js new file mode 100644 index 0000000..59c26d0 --- /dev/null +++ b/server/config/globals.js @@ -0,0 +1,66 @@ +const globals = { + ACCESS_CODE_CHAR_POOL: 'abcdefghijklmnopqrstuvwxyz0123456789', + ACCESS_CODE_LENGTH: 6, + CLOCK_TICK_INTERVAL_MILLIS: 10, + STALE_GAME_HOURS: 12, + CLIENT_COMMANDS: { + FETCH_GAME_STATE: 'fetchGameState', + GET_ENVIRONMENT: 'getEnvironment', + START_GAME: 'startGame', + PAUSE_TIMER: 'pauseTimer', + RESUME_TIMER: 'resumeTimer', + GET_TIME_REMAINING: 'getTimeRemaining', + KILL_PLAYER: 'killPlayer', + REVEAL_PLAYER: 'revealPlayer', + TRANSFER_MODERATOR: 'transferModerator', + CHANGE_NAME: 'changeName', + END_GAME: 'endGame', + FETCH_IN_PROGRESS_STATE: 'fetchInitialInProgressState' + }, + MESSAGES: { + ENTER_NAME: 'Client must enter name.' + }, + STATUS: { + LOBBY: 'lobby', + IN_PROGRESS: 'in progress', + ENDED: 'ended' + }, + USER_SIGNATURE_LENGTH: 25, + USER_TYPES: { + MODERATOR: 'moderator', + PLAYER: 'player', + TEMPORARY_MODERATOR: 'player / temp mod', + KILLED_PLAYER: 'killed', + SPECTATOR: 'spectator' + }, + ERROR_MESSAGE: { + GAME_IS_FULL: 'This game is full', + BAD_CREATE_REQUEST: 'Game has invalid options.' + }, + EVENTS: { + PLAYER_JOINED: 'playerJoined', + PLAYER_LEFT: 'playerLeft', + SYNC_GAME_STATE: 'syncGameState' + }, + ENVIRONMENT: { + LOCAL: 'local', + PRODUCTION: 'production' + }, + LOG_LEVEL: { + INFO: 'info', + DEBUG: 'debug', + ERROR: 'error', + WARN: 'warn', + TRACE: 'trace' + }, + GAME_PROCESS_COMMANDS: { + END_TIMER: 'endTimer', + START_GAME: 'startGame', + START_TIMER: 'startTimer', + PAUSE_TIMER: 'pauseTimer', + RESUME_TIMER: 'resumeTimer', + GET_TIME_REMAINING: 'getTimeRemaining' + } +}; + +module.exports = globals; diff --git a/server/main.js b/server/main.js new file mode 100644 index 0000000..a2d3748 --- /dev/null +++ b/server/main.js @@ -0,0 +1,74 @@ +const express = require('express'); +const path = require('path'); +const app = express(); +const bodyParser = require('body-parser'); +const GameManager = require('./modules/GameManager.js'); +const globals = require('./config/globals'); +const ServerBootstrapper = require('./modules/ServerBootstrapper'); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ + extended: true +})); + +const args = ServerBootstrapper.processCLIArgs(); + +const logger = require('./modules/Logger')(args.logLevel); +logger.info('LOG LEVEL IS: ' + args.logLevel); + +const main = ServerBootstrapper.createServerWithCorrectHTTPProtocol(app, args.useHttps, args.port, logger); + +app.set('port', args.port); + +const inGameSocketServer = ServerBootstrapper.createSocketServer(main, app, args.port); + +inGameSocketServer.on('connection', function (socket) { + socket.on('disconnecting', (reason) => { + logger.trace('client socket disconnecting because: ' + reason); + gameManager.removeClientFromLobbyIfApplicable(socket); + }); + gameManager.addGameSocketHandlers(inGameSocketServer, socket); +}); + +let gameManager; + +/* Instantiate the singleton game manager */ +if (process.env.NODE_ENV.trim() === 'development') { + gameManager = new GameManager(logger, globals.ENVIRONMENT.LOCAL).getInstance(); +} else { + gameManager = new GameManager(logger, globals.ENVIRONMENT.PRODUCTION).getInstance(); +} + +/* api endpoints */ +const games = require('./api/GamesAPI'); +app.use('/api/games', games); + +/* serve all the app's pages */ +app.use('/manifest.json', (req, res) => { + res.sendFile(path.join(__dirname, '../manifest.json')); +}); + +app.use('/favicon.ico', (req, res) => { + res.sendFile(path.join(__dirname, '../client/favicon_package/favicon.ico')); +}); + +const router = require('./routes/router'); +app.use('', router); + +app.use('/dist', express.static(path.join(__dirname, '../client/dist'))); + +// set up routing for static content that isn't being bundled. +app.use('/images', express.static(path.join(__dirname, '../client/src/images'))); +app.use('/styles', express.static(path.join(__dirname, '../client/src/styles'))); +app.use('/webfonts', express.static(path.join(__dirname, '../client/src/webfonts'))); +app.use('/robots.txt', (req, res) => { + res.sendFile(path.join(__dirname, '../client/robots.txt')); +}); + +app.use(function (req, res) { + res.sendFile(path.join(__dirname, '../client/src/views/404.html')); +}); + +main.listen(args.port, function () { + logger.info(`Starting server on port ${args.port}`); +}); diff --git a/server/model/Game.js b/server/model/Game.js new file mode 100644 index 0000000..7a35f89 --- /dev/null +++ b/server/model/Game.js @@ -0,0 +1,16 @@ +class Game { + constructor (accessCode, status, people, deck, hasTimer, moderator, timerParams = null) { + this.accessCode = accessCode; + this.status = status; + this.moderator = moderator; + this.people = people; + this.deck = deck; + this.hasTimer = hasTimer; + this.timerParams = timerParams; + this.isFull = false; + this.timeRemaining = null; + this.spectators = []; + } +} + +module.exports = Game; diff --git a/server/model/Person.js b/server/model/Person.js new file mode 100644 index 0000000..3c6afa0 --- /dev/null +++ b/server/model/Person.js @@ -0,0 +1,19 @@ +// noinspection DuplicatedCode +class Person { + constructor (id, cookie, name, userType, gameRole = null, gameRoleDescription = null, alignment = null, assigned = false) { + this.id = id; + this.cookie = cookie; + this.socketId = null; + this.name = name; + this.userType = userType; + this.gameRole = gameRole; + this.gameRoleDescription = gameRoleDescription; + this.alignment = alignment; + this.assigned = assigned; + this.out = false; + this.revealed = false; + this.hasEnteredName = false; + } +} + +module.exports = Person; diff --git a/server/modules/ActiveGameRunner.js b/server/modules/ActiveGameRunner.js new file mode 100644 index 0000000..66b79f8 --- /dev/null +++ b/server/modules/ActiveGameRunner.js @@ -0,0 +1,77 @@ +const { fork } = require('child_process'); +const path = require('path'); +const globals = require('../config/globals'); + +class ActiveGameRunner { + constructor (logger) { + this.activeGames = {}; + this.timerThreads = {}; + this.logger = logger; + } + + /* We're only going to fork a child process for games with a timer. They will report back to the parent process whenever + the timer is up. + */ + runGame = (game, namespace) => { + this.logger.debug('running game ' + game.accessCode); + const gameProcess = fork(path.join(__dirname, '/GameProcess.js')); + this.timerThreads[game.accessCode] = gameProcess; + gameProcess.on('message', (msg) => { + switch (msg.command) { + case globals.GAME_PROCESS_COMMANDS.END_TIMER: + game.timerParams.paused = false; + game.timerParams.timeRemaining = 0; + this.logger.trace('PARENT: END TIMER'); + break; + case globals.GAME_PROCESS_COMMANDS.PAUSE_TIMER: + game.timerParams.paused = true; + this.logger.trace(msg); + game.timerParams.timeRemaining = msg.timeRemaining; + this.logger.trace('PARENT: PAUSE TIMER'); + namespace.in(game.accessCode).emit(globals.GAME_PROCESS_COMMANDS.PAUSE_TIMER, game.timerParams.timeRemaining); + break; + case globals.GAME_PROCESS_COMMANDS.RESUME_TIMER: + game.timerParams.paused = false; + this.logger.trace(msg); + game.timerParams.timeRemaining = msg.timeRemaining; + this.logger.trace('PARENT: RESUME TIMER'); + namespace.in(game.accessCode).emit(globals.GAME_PROCESS_COMMANDS.RESUME_TIMER, game.timerParams.timeRemaining); + break; + case globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING: + this.logger.trace(msg); + game.timerParams.timeRemaining = msg.timeRemaining; + this.logger.trace('PARENT: GET TIME REMAINING'); + namespace.to(msg.socketId).emit(globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING, game.timerParams.timeRemaining, game.timerParams.paused); + break; + } + }); + + gameProcess.on('exit', () => { + this.logger.debug('Game ' + game.accessCode + ' timer has expired.'); + delete this.timerThreads[game.accessCode]; + }); + gameProcess.send({ + command: globals.GAME_PROCESS_COMMANDS.START_TIMER, + accessCode: game.accessCode, + logLevel: this.logger.logLevel, + hours: game.timerParams.hours, + minutes: game.timerParams.minutes + }); + game.startTime = new Date().toJSON(); + }; +} + +class Singleton { + constructor (logger) { + if (!Singleton.instance) { + logger.info('CREATING SINGLETON ACTIVE GAME RUNNER'); + Singleton.instance = new ActiveGameRunner(logger); + } + } + + getInstance () { + return Singleton.instance; + } +} + +module.exports = Singleton; diff --git a/server/modules/GameManager.js b/server/modules/GameManager.js new file mode 100644 index 0000000..5c36be1 --- /dev/null +++ b/server/modules/GameManager.js @@ -0,0 +1,514 @@ +const globals = require('../config/globals'); +const ActiveGameRunner = require('./ActiveGameRunner'); +const Game = require('../model/Game'); +const Person = require('../model/Person'); +const GameStateCurator = require('./GameStateCurator'); +const UsernameGenerator = require('./UsernameGenerator'); + +class GameManager { + constructor (logger, environment) { + this.logger = logger; + this.environment = environment; + this.activeGameRunner = new ActiveGameRunner(logger).getInstance(); + this.namespace = null; + } + + addGameSocketHandlers = (namespace, socket) => { + this.namespace = namespace; + socket.on(globals.CLIENT_COMMANDS.FETCH_GAME_STATE, (accessCode, personId, ackFn) => { + this.logger.trace('request for game state for accessCode ' + accessCode + ', person ' + personId); + this.handleRequestForGameState( + this.namespace, + this.logger, + this.activeGameRunner, + accessCode, + personId, + ackFn, + socket + ); + }); + + /* this event handler will call handleRequestForGameState() with the 'handleNoMatch' arg as false - only + connections that match a participant in the game at that time will have the game state sent to them. + */ + socket.on(globals.CLIENT_COMMANDS.FETCH_IN_PROGRESS_STATE, (accessCode, personId, ackFn) => { + this.logger.trace('request for game state for accessCode ' + accessCode + ', person ' + personId); + this.handleRequestForGameState( + this.namespace, + this.logger, + this.activeGameRunner, + accessCode, + personId, + ackFn, + socket, + false + ); + }); + + socket.on(globals.CLIENT_COMMANDS.GET_ENVIRONMENT, (ackFn) => { + ackFn(this.environment); + }); + + socket.on(globals.CLIENT_COMMANDS.START_GAME, (accessCode) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game && game.isFull) { + game.status = globals.STATUS.IN_PROGRESS; + if (game.hasTimer) { + game.timerParams.paused = true; + this.activeGameRunner.runGame(game, namespace); + } + namespace.in(accessCode).emit(globals.CLIENT_COMMANDS.START_GAME); + } + }); + + socket.on(globals.CLIENT_COMMANDS.PAUSE_TIMER, (accessCode) => { + this.logger.trace(accessCode); + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const thread = this.activeGameRunner.timerThreads[accessCode]; + if (thread) { + this.logger.debug('Timer thread found for game ' + accessCode); + thread.send({ + command: globals.GAME_PROCESS_COMMANDS.PAUSE_TIMER, + accessCode: game.accessCode, + logLevel: this.logger.logLevel + }); + } + } + }); + + socket.on(globals.CLIENT_COMMANDS.RESUME_TIMER, (accessCode) => { + this.logger.trace(accessCode); + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const thread = this.activeGameRunner.timerThreads[accessCode]; + if (thread) { + this.logger.debug('Timer thread found for game ' + accessCode); + thread.send({ + command: globals.GAME_PROCESS_COMMANDS.RESUME_TIMER, + accessCode: game.accessCode, + logLevel: this.logger.logLevel + }); + } + } + }); + + socket.on(globals.CLIENT_COMMANDS.GET_TIME_REMAINING, (accessCode) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const thread = this.activeGameRunner.timerThreads[accessCode]; + if (thread) { + thread.send({ + command: globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING, + accessCode: accessCode, + socketId: socket.id, + logLevel: this.logger.logLevel + }); + } else { + if (game.timerParams && game.timerParams.timeRemaining === 0) { + this.namespace.to(socket.id).emit(globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING, game.timerParams.timeRemaining, game.timerParams.paused); + } + } + } + }); + + socket.on(globals.CLIENT_COMMANDS.KILL_PLAYER, (accessCode, personId) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const person = game.people.find((person) => person.id === personId); + this.killPlayer(game, person, namespace, this.logger); + } + }); + + socket.on(globals.CLIENT_COMMANDS.REVEAL_PLAYER, (accessCode, personId) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const person = game.people.find((person) => person.id === personId); + if (person && !person.revealed) { + this.logger.debug('game ' + accessCode + ': revealing player ' + person.name); + person.revealed = true; + namespace.in(accessCode).emit( + globals.CLIENT_COMMANDS.REVEAL_PLAYER, + { + id: person.id, + gameRole: person.gameRole, + alignment: person.alignment + }); + } + } + }); + + socket.on(globals.CLIENT_COMMANDS.TRANSFER_MODERATOR, (accessCode, personId) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + let person = game.people.find((person) => person.id === personId); + if (!person) { + person = game.spectators.find((spectator) => spectator.id === personId); + } + this.transferModeratorPowers(game, person, namespace, this.logger); + } + }); + + socket.on(globals.CLIENT_COMMANDS.CHANGE_NAME, (accessCode, data, ackFn) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + const person = findPersonById(game, data.personId); + if (person) { + if (!isNameTaken(game, data.name)) { + ackFn('changed'); + person.name = data.name.trim(); + person.hasEnteredName = true; + namespace.in(accessCode).emit(globals.CLIENT_COMMANDS.CHANGE_NAME, person.id, person.name); + } else { + ackFn('taken'); + } + } + } + }); + + socket.on(globals.CLIENT_COMMANDS.END_GAME, (accessCode) => { + const game = this.activeGameRunner.activeGames[accessCode]; + if (game) { + game.status = globals.STATUS.ENDED; + for (const person of game.people) { + person.revealed = true; + } + namespace.in(accessCode).emit(globals.CLIENT_COMMANDS.END_GAME, GameStateCurator.mapPeopleForModerator(game.people)); + } + }); + }; + + createGame = (gameParams) => { + const expectedKeys = ['deck', 'hasTimer', 'timerParams']; + if (typeof gameParams !== 'object' + || expectedKeys.some((key) => !Object.keys(gameParams).includes(key)) + ) { + this.logger.error('Tried to create game with invalid options: ' + JSON.stringify(gameParams)); + return Promise.reject(globals.ERROR_MESSAGE.BAD_CREATE_REQUEST); + } else { + // to avoid excessive memory build-up, every time a game is created, check for and purge any stale games. + pruneStaleGames(this.activeGameRunner.activeGames, this.activeGameRunner.timerThreads, this.logger); + const newAccessCode = this.generateAccessCode(); + const moderator = initializeModerator(UsernameGenerator.generate(), gameParams.hasDedicatedModerator); + if (gameParams.timerParams !== null) { + gameParams.timerParams.paused = false; + } + this.activeGameRunner.activeGames[newAccessCode] = new Game( + newAccessCode, + globals.STATUS.LOBBY, + initializePeopleForGame(gameParams.deck, moderator), + gameParams.deck, + gameParams.hasTimer, + moderator, + gameParams.timerParams + ); + this.activeGameRunner.activeGames[newAccessCode].createTime = new Date().toJSON(); + return Promise.resolve(newAccessCode); + } + }; + + joinGame = (code) => { + const game = this.activeGameRunner.activeGames[code]; + if (game) { + const unassignedPerson = game.people.find((person) => person.assigned === false); + if (!unassignedPerson) { + return Promise.resolve(new Error(globals.ERROR_MESSAGE.GAME_IS_FULL)); + } else { + return Promise.resolve(code); + } + } else { + return Promise.resolve(404); + } + }; + + generateAccessCode = () => { + const numLetters = globals.ACCESS_CODE_CHAR_POOL.length; + const codeDigits = []; + let iterations = globals.ACCESS_CODE_LENGTH; + while (iterations > 0) { + iterations--; + codeDigits.push(globals.ACCESS_CODE_CHAR_POOL[getRandomInt(numLetters)]); + } + return codeDigits.join(''); + }; + + transferModeratorPowers = (game, person, namespace, logger) => { + if (person && (person.out || person.userType === globals.USER_TYPES.SPECTATOR)) { + logger.debug('game ' + game.accessCode + ': transferring mod powers to ' + person.name); + if (game.moderator === person) { + logger.debug('temp mod killed themselves'); + person.userType = globals.USER_TYPES.MODERATOR; + } else { + if (game.moderator.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { + game.moderator.userType = globals.USER_TYPES.PLAYER; + } else if (game.moderator.gameRole) { // the current moderator was at one point a dealt-in player. + game.moderator.userType = globals.USER_TYPES.KILLED_PLAYER; // restore their state from before being made mod. + } else if (game.moderator.userType === globals.USER_TYPES.MODERATOR) { + game.moderator.userType = globals.USER_TYPES.SPECTATOR; + if (!game.spectators.includes(game.moderator)) { + game.spectators.push(game.moderator); + } + if (game.spectators.includes(person)) { + game.spectators.splice(game.spectators.indexOf(person), 1); + } + } + person.userType = globals.USER_TYPES.MODERATOR; + game.moderator = person; + } + + namespace.in(game.accessCode).emit(globals.EVENTS.SYNC_GAME_STATE); + } + }; + + killPlayer = (game, person, namespace, logger) => { + if (person && !person.out) { + logger.debug('game ' + game.accessCode + ': killing player ' + person.name); + if (person.userType !== globals.USER_TYPES.TEMPORARY_MODERATOR) { + person.userType = globals.USER_TYPES.KILLED_PLAYER; + } + person.out = true; + namespace.in(game.accessCode).emit(globals.CLIENT_COMMANDS.KILL_PLAYER, person.id); + // temporary moderators will transfer their powers automatically to the first person they kill. + if (game.moderator.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { + this.transferModeratorPowers(game, person, namespace, logger); + } + } + }; + + handleRequestForGameState = (namespace, logger, gameRunner, accessCode, personCookie, ackFn, socket, handleNoMatch = true) => { + const game = gameRunner.activeGames[accessCode]; + if (game) { + let matchingPerson = game.people.find((person) => person.cookie === personCookie); + if (!matchingPerson) { + matchingPerson = game.spectators.find((spectator) => spectator.cookie === personCookie); + } + if (!matchingPerson && game.moderator.cookie === personCookie) { + matchingPerson = game.moderator; + } + if (matchingPerson) { + if (matchingPerson.socketId === socket.id) { + logger.trace('matching person found with an established connection to the room: ' + matchingPerson.name); + ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, matchingPerson, gameRunner, socket, logger)); + } else { + logger.trace('matching person found with a new connection to the room: ' + matchingPerson.name); + socket.join(accessCode); + matchingPerson.socketId = socket.id; + ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, matchingPerson, gameRunner, socket, logger)); + } + } else if (handleNoMatch) { + this.handleRequestFromNonMatchingPerson(game, socket, gameRunner, ackFn, logger); + } + } else { + rejectClientRequestForGameState(ackFn); + logger.trace('the game ' + accessCode + ' was not found'); + } + }; + + handleRequestFromNonMatchingPerson = (game, socket, gameRunner, ackFn, logger) => { + const personWithMatchingSocketId = findPersonWithMatchingSocketId(game, socket.id); + if (personWithMatchingSocketId) { + logger.trace('matching person found whose cookie got cleared after establishing a connection to the room: ' + personWithMatchingSocketId.name); + ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, personWithMatchingSocketId, gameRunner, socket, logger)); + } else { + const unassignedPerson = game.moderator.assigned === false + ? game.moderator + : game.people.find((person) => person.assigned === false); + if (unassignedPerson) { + logger.trace('completely new person with a first connection to the room: ' + unassignedPerson.name); + unassignedPerson.assigned = true; + unassignedPerson.socketId = socket.id; + ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, unassignedPerson, gameRunner, socket, logger)); + const isFull = isGameFull(game); + game.isFull = isFull; + socket.to(game.accessCode).emit( + globals.EVENTS.PLAYER_JOINED, + GameStateCurator.mapPerson(unassignedPerson), + isFull + ); + } else { // if the game is full, make them a spectator. + const spectator = new Person( + createRandomId(), + createRandomId(), + UsernameGenerator.generate(), + globals.USER_TYPES.SPECTATOR + ); + logger.trace('new spectator: ' + spectator.name); + game.spectators.push(spectator); + ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, spectator, gameRunner, socket, logger)); + } + socket.join(game.accessCode); + } + }; + + removeClientFromLobbyIfApplicable (socket) { + socket.rooms.forEach((room) => { + if (this.activeGameRunner.activeGames[room]) { + this.logger.trace('disconnected socket is in a game'); + const game = this.activeGameRunner.activeGames[room]; + if (game.status === globals.STATUS.LOBBY) { + const matchingPlayer = findPlayerBySocketId(game.people, socket.id); + if (matchingPlayer) { + this.logger.trace('un-assigning disconnected player: ' + matchingPlayer.name); + matchingPlayer.assigned = false; + matchingPlayer.socketId = null; + matchingPlayer.cookie = createRandomId(); + matchingPlayer.hasEnteredName = false; + socket.to(game.accessCode).emit( + globals.EVENTS.PLAYER_LEFT, + GameStateCurator.mapPerson(matchingPlayer) + ); + game.isFull = isGameFull(game); + matchingPlayer.name = UsernameGenerator.generate(); + } + } + } + }); + } +} + +function getRandomInt (max) { + return Math.floor(Math.random() * Math.floor(max)); +} + +function initializeModerator (name, hasDedicatedModerator) { + const userType = hasDedicatedModerator + ? globals.USER_TYPES.MODERATOR + : globals.USER_TYPES.TEMPORARY_MODERATOR; + return new Person(createRandomId(), createRandomId(), name, userType); ; +} + +function initializePeopleForGame (uniqueCards, moderator) { + const people = []; + let cards = []; // this will contain copies of each card equal to the quantity. + let numberOfRoles = 0; + for (const card of uniqueCards) { + for (let i = 0; i < card.quantity; i++) { + cards.push(card); + numberOfRoles++; + } + } + + cards = shuffleArray(cards); // The deck should probably be shuffled, ey?. + + let j = 0; + if (moderator.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { // temporary moderators should be dealt in. + moderator.gameRole = cards[j].role; + moderator.customRole = cards[j].custom; + moderator.gameRoleDescription = cards[j].description; + moderator.alignment = cards[j].team; + people.push(moderator); + j++; + } + + while (j < numberOfRoles) { + const person = new Person( + createRandomId(), + createRandomId(), + UsernameGenerator.generate(), + globals.USER_TYPES.PLAYER, + cards[j].role, + cards[j].description, + cards[j].team + ); + person.customRole = cards[j].custom; + person.hasEnteredName = false; + people.push(person); + j++; + } + + return people; +} + +function shuffleArray (array) { + for (let i = 0; i < array.length; i++) { + const randIndex = Math.floor(Math.random() * i); + const temp = array[i]; + array[i] = array[randIndex]; + array[randIndex] = temp; + } + return array; +} + +function createRandomId () { + let id = ''; + for (let i = 0; i < globals.USER_SIGNATURE_LENGTH; i++) { + id += globals.ACCESS_CODE_CHAR_POOL[Math.floor(Math.random() * globals.ACCESS_CODE_CHAR_POOL.length)]; + } + return id; +} + +function rejectClientRequestForGameState (acknowledgementFunction) { + return acknowledgementFunction(null); +} + +function findPersonWithMatchingSocketId (game, socketId) { + let person = game.people.find((person) => person.socketId === socketId); + if (!person) { + person = game.spectators.find((spectator) => spectator.socketId === socketId); + } + if (!person && game.moderator.socketId === socketId) { + person = game.moderator; + } + return person; +} + +function findPlayerBySocketId (people, socketId) { + return people.find((person) => person.socketId === socketId && person.userType === globals.USER_TYPES.PLAYER); +} + +function isGameFull (game) { + return game.moderator.assigned === true && !game.people.find((person) => person.assigned === false); +} + +function findPersonById (game, id) { + let person; + if (id === game.moderator.id) { + person = game.moderator; + } + if (!person) { + person = game.people.find((person) => person.id === id); + } + if (!person) { + person = game.spectators.find((spectator) => spectator.id === id); + } + return person; +} + +function isNameTaken (game, name) { + const processedName = name.toLowerCase().trim(); + return (game.people.find((person) => person.name.toLowerCase().trim() === processedName)) + || (game.moderator.name.toLowerCase().trim() === processedName) + || (game.spectators.find((spectator) => spectator.name.toLowerCase().trim() === processedName)); +} + +function pruneStaleGames (activeGames, timerThreads, logger) { + for (const [accessCode, game] of Object.entries(activeGames)) { + if (game.createTime) { + const createDate = new Date(game.createTime); + if (createDate.setHours(createDate.getHours() + globals.STALE_GAME_HOURS) < Date.now()) { // clear games created more than 12 hours ago + logger.info('PRUNING STALE GAME ' + accessCode); + delete activeGames[accessCode]; + if (timerThreads[accessCode]) { + logger.info('KILLING STALE TIMER PROCESS FOR ' + accessCode); + timerThreads[accessCode].kill(); + delete timerThreads[accessCode]; + } + } + } + } +} + +class Singleton { + constructor (logger, environment) { + if (!Singleton.instance) { + logger.info('CREATING SINGLETON GAME MANAGER'); + Singleton.instance = new GameManager(logger, environment); + } + } + + getInstance () { + return Singleton.instance; + } +} + +module.exports = Singleton; diff --git a/server/modules/GameProcess.js b/server/modules/GameProcess.js new file mode 100644 index 0000000..dd44e5e --- /dev/null +++ b/server/modules/GameProcess.js @@ -0,0 +1,52 @@ +const globals = require('../config/globals.js'); +const ServerTimer = require('./ServerTimer.js'); + +let timer; + +process.on('message', (msg) => { + const logger = require('./Logger')(msg.logLevel); + switch (msg.command) { + case globals.GAME_PROCESS_COMMANDS.START_TIMER: + logger.trace('CHILD PROCESS ' + msg.accessCode + ': START TIMER'); + timer = new ServerTimer( + msg.hours, + msg.minutes, + globals.CLOCK_TICK_INTERVAL_MILLIS, + logger + ); + timer.runTimer().then(() => { + logger.debug('Timer finished for ' + msg.accessCode); + process.send({ command: globals.GAME_PROCESS_COMMANDS.END_TIMER }); + process.exit(0); + }); + + break; + case globals.GAME_PROCESS_COMMANDS.PAUSE_TIMER: + timer.stopTimer(); + logger.trace('CHILD PROCESS ' + msg.accessCode + ': PAUSE TIMER'); + process.send({ command: globals.GAME_PROCESS_COMMANDS.PAUSE_TIMER, timeRemaining: timer.currentTimeInMillis }); + + break; + + case globals.GAME_PROCESS_COMMANDS.RESUME_TIMER: + timer.resumeTimer().then(() => { + logger.debug('Timer finished for ' + msg.accessCode); + process.send({ command: globals.GAME_PROCESS_COMMANDS.END_TIMER }); + process.exit(0); + }); + logger.trace('CHILD PROCESS ' + msg.accessCode + ': RESUME TIMER'); + process.send({ command: globals.GAME_PROCESS_COMMANDS.RESUME_TIMER, timeRemaining: timer.currentTimeInMillis }); + + break; + + case globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING: + logger.trace('CHILD PROCESS ' + msg.accessCode + ': GET TIME REMAINING'); + process.send({ + command: globals.GAME_PROCESS_COMMANDS.GET_TIME_REMAINING, + timeRemaining: timer.currentTimeInMillis, + socketId: msg.socketId + }); + + break; + } +}); diff --git a/server/modules/GameStateCurator.js b/server/modules/GameStateCurator.js new file mode 100644 index 0000000..8d24ceb --- /dev/null +++ b/server/modules/GameStateCurator.js @@ -0,0 +1,131 @@ +const globals = require('../config/globals'); + +/* The purpose of this component is to only return the game state information that is necessary. For example, we only + want to return player role information to moderators. This avoids any possibility of a player having access to + information that they shouldn't. + */ +const GameStateCurator = { + getGameStateFromPerspectiveOfPerson: (game, person, gameRunner, socket, logger) => { + return getGameStateBasedOnPermissions(game, person, gameRunner); + }, + + mapPeopleForModerator: (people) => { + return people + .filter((person) => { + return person.assigned === true; + }) + .map((person) => ({ + name: person.name, + id: person.id, + userType: person.userType, + gameRole: person.gameRole, + gameRoleDescription: person.gameRoleDescription, + alignment: person.alignment, + out: person.out, + revealed: person.revealed + })); + }, + mapPerson: (person) => { + if (person.revealed) { + return { + name: person.name, + id: person.id, + userType: person.userType, + out: person.out, + revealed: person.revealed, + gameRole: person.gameRole, + alignment: person.alignment + }; + } else { + return { name: person.name, id: person.id, userType: person.userType, out: person.out, revealed: person.revealed }; + } + } +}; + +function getGameStateBasedOnPermissions (game, person, gameRunner) { + const client = game.status === globals.STATUS.LOBBY // people won't be able to know their role until past the lobby stage. + ? { name: person.name, hasEnteredName: person.hasEnteredName, id: person.id, cookie: person.cookie, userType: person.userType } + : { + name: person.name, + hasEnteredName: person.hasEnteredName, + id: person.id, + cookie: person.cookie, + userType: person.userType, + gameRole: person.gameRole, + gameRoleDescription: person.gameRoleDescription, + customRole: person.customRole, + alignment: person.alignment, + out: person.out + }; + switch (person.userType) { + case globals.USER_TYPES.PLAYER: + case globals.USER_TYPES.KILLED_PLAYER: { + const state = { + accessCode: game.accessCode, + status: game.status, + moderator: GameStateCurator.mapPerson(game.moderator), + client: client, + deck: game.deck, + people: game.people + .filter((person) => { + return person.assigned === true; + }) + .map((filteredPerson) => + GameStateCurator.mapPerson(filteredPerson) + ), + timerParams: game.timerParams, + isFull: game.isFull + }; + if (game.status === globals.STATUS.ENDED) { + state.people = GameStateCurator.mapPeopleForModerator(game.people); + } + return state; + } + case globals.USER_TYPES.MODERATOR: + return { + accessCode: game.accessCode, + status: game.status, + moderator: GameStateCurator.mapPerson(game.moderator), + client: client, + deck: game.deck, + people: GameStateCurator.mapPeopleForModerator(game.people, client), + timerParams: game.timerParams, + isFull: game.isFull, + spectators: game.spectators + }; + case globals.USER_TYPES.TEMPORARY_MODERATOR: + return { + accessCode: game.accessCode, + status: game.status, + moderator: GameStateCurator.mapPerson(game.moderator), + client: client, + deck: game.deck, + people: game.people + .filter((person) => { + return person.assigned === true; + }) + .map((filteredPerson) => GameStateCurator.mapPerson(filteredPerson)), + timerParams: game.timerParams, + isFull: game.isFull + }; + case globals.USER_TYPES.SPECTATOR: + return { + accessCode: game.accessCode, + status: game.status, + moderator: GameStateCurator.mapPerson(game.moderator), + client: client, + deck: game.deck, + people: game.people + .filter((person) => { + return person.assigned === true; + }) + .map((filteredPerson) => GameStateCurator.mapPerson(filteredPerson)), + timerParams: game.timerParams, + isFull: game.isFull + }; + default: + break; + } +} + +module.exports = GameStateCurator; diff --git a/server/modules/Logger.js b/server/modules/Logger.js new file mode 100644 index 0000000..80d5d96 --- /dev/null +++ b/server/modules/Logger.js @@ -0,0 +1,46 @@ +const globals = require('../config/globals'); + +module.exports = function (logLevel = globals.LOG_LEVEL.INFO) { + return { + logLevel: logLevel, + info (message = '') { + const now = new Date(); + console.log('LOG ', now.toGMTString(), ': ', message); + }, + + error (message = '') { + if ( + logLevel === globals.LOG_LEVEL.INFO + ) { return; } + const now = new Date(); + console.error('ERROR ', now.toGMTString(), ': ', message); + }, + + warn (message = '') { + if ( + logLevel === globals.LOG_LEVEL.INFO + || logLevel === globals.LOG_LEVEL.ERROR + ) return; + const now = new Date(); + console.error('WARN ', now.toGMTString(), ': ', message); + }, + + debug (message = '') { + if (logLevel === globals.LOG_LEVEL.INFO || logLevel === globals.LOG_LEVEL.ERROR || logLevel === globals.LOG_LEVEL.WARN) return; + const now = new Date(); + console.debug('DEBUG ', now.toGMTString(), ': ', message); + }, + + trace (message = '') { + if ( + logLevel === globals.LOG_LEVEL.INFO + || logLevel === globals.LOG_LEVEL.WARN + || logLevel === globals.LOG_LEVEL.DEBUG + || logLevel === globals.LOG_LEVEL.ERROR + ) { return; } + + const now = new Date(); + console.error('TRACE ', now.toGMTString(), ': ', message); + } + }; +}; diff --git a/server/modules/ServerBootstrapper.js b/server/modules/ServerBootstrapper.js new file mode 100644 index 0000000..a59f3cb --- /dev/null +++ b/server/modules/ServerBootstrapper.js @@ -0,0 +1,106 @@ +const LOG_LEVEL = require('../config/globals').LOG_LEVEL; +const http = require('http'); +const https = require('https'); +const path = require('path'); +const fs = require('fs'); +const cors = require('cors'); + +const ServerBootstrapper = { + processCLIArgs: () => { + try { + const args = Array.from(process.argv.map((arg) => arg.trim().toLowerCase())); + const useHttps = args.includes('protocol=https'); + const port = process.env.PORT || args + .filter((arg) => { + return /port=\d+/.test(arg); + }) + .map((arg) => { + return /port=(\d+)/.exec(arg)[1]; + })[0] || 5000; + const logLevel = process.env.LOG_LEVEL || args + .filter((arg) => { + return /loglevel=[a-zA-Z]+/.test(arg); + }) + .map((arg) => { + return /loglevel=([a-zA-Z]+)/.exec(arg)[1]; + })[0] || LOG_LEVEL.INFO; + + return { + useHttps: useHttps, + port: port, + logLevel: logLevel + }; + } catch (e) { + throw new Error('Your server run command is malformed. Consult the codebase wiki for proper usage. Error: ' + e); + } + }, + + createServerWithCorrectHTTPProtocol: (app, useHttps, port, logger) => { + let main; + if (process.env.NODE_ENV.trim() === 'development') { + logger.info('starting main in DEVELOPMENT mode.'); + if ( + useHttps + && fs.existsSync(path.join(__dirname, '../../client/certs/localhost-key.pem')) + && fs.existsSync(path.join(__dirname, '../../client/certs/localhost.pem')) + ) { + const key = fs.readFileSync(path.join(__dirname, '../../client/certs/localhost-key.pem'), 'utf-8'); + const cert = fs.readFileSync(path.join(__dirname, '../../client/certs/localhost.pem'), 'utf-8'); + logger.info('local certs detected. Using HTTPS.'); + main = https.createServer({ key, cert }, app); + logger.info(`navigate to https://localhost:${port}`); + } else { + logger.info('https not specified or no local certs detected. Certs should reside in /client/certs. Using HTTP.'); + main = http.createServer(app); + logger.info(`navigate to http://localhost:${port}`); + } + } else { + logger.warn('starting main in PRODUCTION mode. This should not be used for local development.'); + main = http.createServer(app); + app.use(require('express-force-https')); + } + + return main; + }, + + createSocketServer: (main, app, port) => { + let io; + if (process.env.NODE_ENV.trim() === 'development') { + const corsOptions = { + origin: 'http://localhost:' + port, + optionsSuccessStatus: 200, + methods: ['GET', 'POST'] + }; + app.use(cors(corsOptions)); + io = require('socket.io')(main, { + cors: { + origin: 'http://localhost:' + port, + methods: ['GET', 'POST'], + allowedHeaders: ['Content-Type', 'X-Requested-With', 'Accept'], + credentials: false + } + }); + } else { + const corsOptions = { + origin: ['https://playwerewolf.uk.r.appspot.com'], + methods: ['GET', 'POST'], + allowedHeaders: ['Content-Type', 'X-Requested-With', 'Accept'], + optionsSuccessStatus: 200 + }; + app.use(cors(corsOptions)); + io = require('socket.io')(main, { + cors: { + origin: ['https://playwerewolf.uk.r.appspot.com', 'wss://playwerewolf.uk.r.appspot.com'], + methods: ['GET', 'POST'], + allowedHeaders: ['Content-Type', 'X-Requested-With', 'Accept'], + credentials: true + }, + transports: ['polling'] + }); + } + + return io.of('/in-game'); + } +}; + +module.exports = ServerBootstrapper; diff --git a/server/modules/ServerTimer.js b/server/modules/ServerTimer.js new file mode 100644 index 0000000..ad29705 --- /dev/null +++ b/server/modules/ServerTimer.js @@ -0,0 +1,92 @@ + +function stepFn (serverTimerInstance, expected) { + const now = Date.now(); // + serverTimerInstance.currentTimeInMillis = serverTimerInstance.totalTime - (now - serverTimerInstance.start); + if (now - serverTimerInstance.start >= serverTimerInstance.totalTime) { // check if the time has elapsed + serverTimerInstance.logger.debug( + 'ELAPSED: ' + (now - serverTimerInstance.start) + 'ms (~' + + (Math.abs(serverTimerInstance.totalTime - (now - serverTimerInstance.start)) / serverTimerInstance.totalTime).toFixed(3) + '% error).' + ); + serverTimerInstance.timesUpResolver(); // this is a reference to the callback defined in the construction of the promise in runTimer() + clearTimeout(serverTimerInstance.ticking); + return; + } + const delta = now - expected; + expected += serverTimerInstance.interval; + serverTimerInstance.ticking = setTimeout(function () { + stepFn( + serverTimerInstance, + expected + ); + }, Math.max(0, serverTimerInstance.interval - delta)); // take into account drift +} + +class ServerTimer { + constructor (hours, minutes, tickInterval, logger) { + this.hours = hours; + this.minutes = minutes; + this.tickInterval = tickInterval; + this.logger = logger; + this.currentTimeInMillis = null; + this.ticking = null; + this.timesUpPromise = null; + this.timesUpResolver = null; + this.start = null; + this.totalTime = null; + } + + runTimer (pausedInitially = true) { + const total = convertFromHoursToMilliseconds(this.hours) + convertFromMinutesToMilliseconds(this.minutes); + this.totalTime = total; + this.currentTimeInMillis = total; + this.logger.debug('STARTING TIMER FOR ' + this.totalTime + 'ms'); + this.start = Date.now(); + const expected = Date.now() + this.tickInterval; + this.timesUpPromise = new Promise((resolve) => { + this.timesUpResolver = resolve; + }); + const instance = this; + if (!pausedInitially) { + this.ticking = setTimeout(function () { + stepFn( + instance, + expected + ); + }, this.tickInterval); + } + + return this.timesUpPromise; + } + + stopTimer () { + if (this.ticking) { + clearTimeout(this.ticking); + } + } + + resumeTimer () { + this.logger.debug('RESUMING TIMER FOR ' + this.currentTimeInMillis + 'ms'); + this.start = Date.now(); + this.totalTime = this.currentTimeInMillis; + const expected = Date.now() + this.tickInterval; + const instance = this; + this.ticking = setTimeout(function () { + stepFn( + instance, + expected + ); + }, this.tickInterval); + + return this.timesUpPromise; + } +} + +function convertFromMinutesToMilliseconds (minutes) { + return minutes * 60 * 1000; +} + +function convertFromHoursToMilliseconds (hours) { + return hours * 60 * 60 * 1000; +} + +module.exports = ServerTimer; diff --git a/server/modules/UsernameGenerator.js b/server/modules/UsernameGenerator.js new file mode 100644 index 0000000..81a839a --- /dev/null +++ b/server/modules/UsernameGenerator.js @@ -0,0 +1,1338 @@ +const usernameGenerator = { + generate () { + const randAdjIndex = Math.floor(Math.random() * adjectives.length); + const randAnimalIndex = Math.floor(Math.random() * animals.length); + const randNumber = Math.floor(Math.random() * 100); + return adjectives[randAdjIndex].charAt(0).toUpperCase() + adjectives[randAdjIndex].slice(1) + + animals[randAnimalIndex].replace(/ /g, '') + + randNumber; + } +}; + +const adjectives = [ + 'aback', + 'abaft', + 'abandoned', + 'abashed', + 'aberrant', + 'abhorrent', + 'abiding', + 'abject', + 'ablaze', + 'able', + 'abnormal', + 'aboriginal', + 'abortive', + 'abounding', + 'abrasive', + 'abrupt', + 'absent', + 'absorbed', + 'absorbing', + 'abstracted', + 'absurd', + 'abundant', + 'abusive', + 'acceptable', + 'accessible', + 'accidental', + 'accurate', + 'acid', + 'acidic', + 'acoustic', + 'acrid', + 'adamant', + 'adaptable', + 'addicted', + 'adhesive', + 'adjoining', + 'adorable', + 'adventurous', + 'afraid', + 'aggressive', + 'agonizing', + 'agreeable', + 'ahead', + 'ajar', + 'alert', + 'alike', + 'alive', + 'alleged', + 'alluring', + 'aloof', + 'amazing', + 'ambiguous', + 'ambitious', + 'amuck', + 'amused', + 'amusing', + 'ancient', + 'angry', + 'animated', + 'annoyed', + 'annoying', + 'anxious', + 'apathetic', + 'aquatic', + 'aromatic', + 'arrogant', + 'ashamed', + 'aspiring', + 'assorted', + 'astonishing', + 'attractive', + 'auspicious', + 'automatic', + 'available', + 'average', + 'aware', + 'awesome', + 'axiomatic', + 'bad', + 'barbarous', + 'bashful', + 'bawdy', + 'beautiful', + 'befitting', + 'belligerent', + 'beneficial', + 'bent', + 'berserk', + 'bewildered', + 'big', + 'billowy', + 'bite-sized', + 'bitter', + 'bizarre', + 'black', + 'black-and-white', + 'bloody', + 'blue', + 'blue-eyed', + 'blushing', + 'boiling', + 'boorish', + 'bored', + 'boring', + 'bouncy', + 'boundless', + 'brainy', + 'brash', + 'brave', + 'brawny', + 'breakable', + 'breezy', + 'brief', + 'bright', + 'broad', + 'broken', + 'brown', + 'bumpy', + 'burly', + 'bustling', + 'busy', + 'cagey', + 'calculating', + 'callous', + 'calm', + 'capable', + 'capricious', + 'careful', + 'careless', + 'caring', + 'cautious', + 'ceaseless', + 'certain', + 'changeable', + 'charming', + 'cheap', + 'cheerful', + 'chemical', + 'chief', + 'childlike', + 'chilly', + 'chivalrous', + 'chubby', + 'chunky', + 'clammy', + 'classy', + 'clean', + 'clear', + 'clever', + 'cloistered', + 'cloudy', + 'closed', + 'clumsy', + 'cluttered', + 'coherent', + 'cold', + 'colorful', + 'colossal', + 'combative', + 'comfortable', + 'common', + 'complete', + 'complex', + 'concerned', + 'condemned', + 'confused', + 'conscious', + 'cooing', + 'cool', + 'cooperative', + 'coordinated', + 'courageous', + 'cowardly', + 'crabby', + 'craven', + 'crazy', + 'creepy', + 'crooked', + 'crowded', + 'cruel', + 'cuddly', + 'cultured', + 'cumbersome', + 'curious', + 'curly', + 'curved', + 'curvy', + 'cut', + 'cute', + 'cynical', + 'daffy', + 'daily', + 'damaged', + 'damaging', + 'damp', + 'dangerous', + 'dapper', + 'dark', + 'dashing', + 'dazzling', + 'dead', + 'deadpan', + 'deafening', + 'dear', + 'debonair', + 'decisive', + 'decorous', + 'deep', + 'deeply', + 'defeated', + 'defective', + 'defiant', + 'delicate', + 'delicious', + 'delightful', + 'demonic', + 'delirious', + 'dependent', + 'depressed', + 'deranged', + 'descriptive', + 'deserted', + 'detailed', + 'determined', + 'devilish', + 'didactic', + 'different', + 'difficult', + 'diligent', + 'direful', + 'dirty', + 'disagreeable', + 'disastrous', + 'discreet', + 'disgusted', + 'disgusting', + 'disillusioned', + 'dispensable', + 'distinct', + 'disturbed', + 'divergent', + 'dizzy', + 'domineering', + 'doubtful', + 'drab', + 'draconian', + 'dramatic', + 'dreary', + 'drunk', + 'dry', + 'dull', + 'dusty', + 'dynamic', + 'dysfunctional', + 'eager', + 'early', + 'earsplitting', + 'earthy', + 'easy', + 'eatable', + 'economic', + 'educated', + 'efficacious', + 'efficient', + 'elastic', + 'elated', + 'elderly', + 'electric', + 'elegant', + 'elfin', + 'elite', + 'embarrassed', + 'eminent', + 'empty', + 'enchanted', + 'enchanting', + 'encouraging', + 'endurable', + 'energetic', + 'enormous', + 'entertaining', + 'enthusiastic', + 'envious', + 'equable', + 'equal', + 'erratic', + 'ethereal', + 'evanescent', + 'evasive', + 'even', + 'excellent', + 'excited', + 'exciting', + 'exclusive', + 'exotic', + 'expensive', + 'extra-large', + 'extra-small', + 'exuberant', + 'exultant', + 'fabulous', + 'faded', + 'faint', + 'fair', + 'faithful', + 'fallacious', + 'false', + 'familiar', + 'famous', + 'fanatical', + 'fancy', + 'fantastic', + 'far', + 'far-flung', + 'fascinated', + 'fast', + 'fat', + 'faulty', + 'fearful', + 'fearless', + 'feeble', + 'feigned', + 'female', + 'fertile', + 'festive', + 'few', + 'fierce', + 'filthy', + 'fine', + 'finicky', + 'first', + 'fixed', + 'flagrant', + 'flaky', + 'flashy', + 'flat', + 'flawless', + 'flimsy', + 'flippant', + 'flowery', + 'fluffy', + 'fluttering', + 'foamy', + 'foolish', + 'foregoing', + 'forgetful', + 'fortunate', + 'frail', + 'fragile', + 'frantic', + 'free', + 'freezing', + 'frequent', + 'fresh', + 'fretful', + 'friendly', + 'frightened', + 'frightening', + 'full', + 'fumbling', + 'functional', + 'funny', + 'furry', + 'furtive', + 'future', + 'futuristic', + 'fuzzy', + 'gabby', + 'gainful', + 'gamy', + 'gaping', + 'garrulous', + 'gaudy', + 'general', + 'gentle', + 'giant', + 'giddy', + 'gifted', + 'gigantic', + 'glamorous', + 'gleaming', + 'glib', + 'glistening', + 'glorious', + 'glossy', + 'godly', + 'good', + 'goofy', + 'gorgeous', + 'graceful', + 'grandiose', + 'grateful', + 'gratis', + 'gray', + 'greasy', + 'great', + 'greedy', + 'green', + 'grey', + 'grieving', + 'groovy', + 'grotesque', + 'grouchy', + 'grubby', + 'gruesome', + 'grumpy', + 'guarded', + 'guiltless', + 'gullible', + 'gusty', + 'guttural', + 'habitual', + 'half', + 'hallowed', + 'halting', + 'handsome', + 'handy', + 'hanging', + 'hapless', + 'happy', + 'hard', + 'hard-to-find', + 'harmonious', + 'harsh', + 'hateful', + 'heady', + 'healthy', + 'heartbreaking', + 'heavenly', + 'heavy', + 'hellish', + 'helpful', + 'helpless', + 'hesitant', + 'hideous', + 'high', + 'highfalutin', + 'high-pitched', + 'hilarious', + 'hissing', + 'historical', + 'holistic', + 'hollow', + 'homeless', + 'homely', + 'honorable', + 'horrible', + 'hospitable', + 'hot', + 'huge', + 'hulking', + 'humdrum', + 'humorous', + 'hungry', + 'hurried', + 'hurt', + 'hushed', + 'husky', + 'hypnotic', + 'hysterical', + 'icky', + 'icy', + 'idiotic', + 'ignorant', + 'ill', + 'illegal', + 'ill-fated', + 'ill-informed', + 'illustrious', + 'imaginary', + 'immense', + 'imminent', + 'impartial', + 'imperfect', + 'impolite', + 'important', + 'imported', + 'impossible', + 'incandescent', + 'incompetent', + 'inconclusive', + 'industrious', + 'incredible', + 'inexpensive', + 'infamous', + 'innate', + 'innocent', + 'inquisitive', + 'insidious', + 'instinctive', + 'intelligent', + 'interesting', + 'internal', + 'invincible', + 'irate', + 'irritating', + 'itchy', + 'jaded', + 'jagged', + 'jazzy', + 'jealous', + 'jittery', + 'jobless', + 'jolly', + 'joyous', + 'judicious', + 'juicy', + 'jumbled', + 'jumpy', + 'juvenile', + 'keen', + 'kind', + 'kindhearted', + 'kindly', + 'knotty', + 'knowing', + 'knowledgeable', + 'known', + 'labored', + 'lackadaisical', + 'lacking', + 'lame', + 'lamentable', + 'languid', + 'large', + 'last', + 'late', + 'laughable', + 'lavish', + 'lazy', + 'lean', + 'learned', + 'left', + 'legal', + 'lethal', + 'level', + 'lewd', + 'light', + 'like', + 'likeable', + 'limping', + 'literate', + 'little', + 'lively', + 'living', + 'lonely', + 'long', + 'longing', + 'long-term', + 'loose', + 'lopsided', + 'loud', + 'loutish', + 'lovely', + 'loving', + 'low', + 'lowly', + 'lucky', + 'ludicrous', + 'lumpy', + 'lush', + 'luxuriant', + 'lying', + 'lyrical', + 'macabre', + 'macho', + 'maddening', + 'madly', + 'magenta', + 'magical', + 'magnificent', + 'majestic', + 'makeshift', + 'male', + 'malicious', + 'mammoth', + 'maniacal', + 'many', + 'marked', + 'massive', + 'married', + 'marvelous', + 'material', + 'materialistic', + 'mature', + 'mean', + 'measly', + 'meaty', + 'medical', + 'meek', + 'mellow', + 'melodic', + 'melted', + 'merciful', + 'mere', + 'messy', + 'mighty', + 'military', + 'milky', + 'mindless', + 'miniature', + 'minor', + 'miscreant', + 'misty', + 'mixed', + 'moaning', + 'modern', + 'moldy', + 'momentous', + 'motionless', + 'mountainous', + 'muddled', + 'mundane', + 'murky', + 'mushy', + 'mute', + 'mysterious', + 'naive', + 'nappy', + 'narrow', + 'nasty', + 'natural', + 'naughty', + 'nauseating', + 'near', + 'neat', + 'nebulous', + 'necessary', + 'needless', + 'needy', + 'neighborly', + 'nervous', + 'new', + 'next', + 'nice', + 'nifty', + 'nimble', + 'nippy', + 'noiseless', + 'noisy', + 'nonchalant', + 'nondescript', + 'nonstop', + 'normal', + 'nostalgic', + 'nosy', + 'noxious', + 'numberless', + 'numerous', + 'nutritious', + 'nutty', + 'oafish', + 'obedient', + 'obeisant', + 'obese', + 'obnoxious', + 'obscene', + 'obsequious', + 'observant', + 'obsolete', + 'obtainable', + 'oceanic', + 'odd', + 'offbeat', + 'old', + 'old-fashioned', + 'omniscient', + 'onerous', + 'open', + 'opposite', + 'optimal', + 'orange', + 'ordinary', + 'organic', + 'ossified', + 'outgoing', + 'outrageous', + 'outstanding', + 'oval', + 'overconfident', + 'overjoyed', + 'overrated', + 'overt', + 'overwrought', + 'painful', + 'painstaking', + 'pale', + 'paltry', + 'panicky', + 'panoramic', + 'parallel', + 'parched', + 'parsimonious', + 'past', + 'pastoral', + 'pathetic', + 'peaceful', + 'penitent', + 'perfect', + 'periodic', + 'permissible', + 'perpetual', + 'petite', + 'phobic', + 'physical', + 'picayune', + 'pink', + 'piquant', + 'placid', + 'plain', + 'plant', + 'plastic', + 'plausible', + 'pleasant', + 'plucky', + 'pointless', + 'poised', + 'polite', + 'political', + 'poor', + 'possessive', + 'possible', + 'powerful', + 'precious', + 'premium', + 'present', + 'pretty', + 'previous', + 'pricey', + 'prickly', + 'private', + 'probable', + 'productive', + 'profuse', + 'protective', + 'proud', + 'psychedelic', + 'psychotic', + 'public', + 'puffy', + 'pumped', + 'puny', + 'purple', + 'purring', + 'pushy', + 'puzzled', + 'puzzling', + 'quaint', + 'quarrelsome', + 'questionable', + 'quick', + 'quiet', + 'quirky', + 'quixotic', + 'quizzical', + 'rabid', + 'racial', + 'ragged', + 'rainy', + 'rambunctious', + 'rampant', + 'rapid', + 'rare', + 'raspy', + 'ratty', + 'ready', + 'real', + 'rebel', + 'receptive', + 'recondite', + 'red', + 'redundant', + 'reflective', + 'regular', + 'relieved', + 'remarkable', + 'reminiscent', + 'repulsive', + 'resolute', + 'resonant', + 'responsible', + 'rhetorical', + 'rich', + 'right', + 'righteous', + 'rightful', + 'rigid', + 'ripe', + 'ritzy', + 'roasted', + 'robust', + 'romantic', + 'roomy', + 'rotten', + 'rough', + 'round', + 'royal', + 'ruddy', + 'rude', + 'rural', + 'rustic', + 'ruthless', + 'sable', + 'sad', + 'safe', + 'salty', + 'same', + 'sassy', + 'satisfying', + 'savory', + 'scandalous', + 'scarce', + 'scared', + 'scary', + 'scattered', + 'scientific', + 'scintillating', + 'scrawny', + 'screeching', + 'second', + 'second-hand', + 'secret', + 'secretive', + 'sedate', + 'seemly', + 'selective', + 'selfish', + 'separate', + 'serious', + 'shaggy', + 'shaky', + 'shallow', + 'sharp', + 'shiny', + 'shivering', + 'shocking', + 'short', + 'shrill', + 'shut', + 'shy', + 'sick', + 'silent', + 'silky', + 'silly', + 'simple', + 'simplistic', + 'sincere', + 'skillful', + 'skinny', + 'sleepy', + 'slim', + 'slimy', + 'slippery', + 'sloppy', + 'slow', + 'small', + 'smart', + 'smelly', + 'smiling', + 'smoggy', + 'smooth', + 'sneaky', + 'snobbish', + 'snotty', + 'soft', + 'soggy', + 'solid', + 'somber', + 'sophisticated', + 'sordid', + 'sore', + 'sour', + 'sparkling', + 'special', + 'spectacular', + 'spicy', + 'spiffy', + 'spiky', + 'spiritual', + 'spiteful', + 'splendid', + 'spooky', + 'spotless', + 'spotted', + 'spotty', + 'spurious', + 'squalid', + 'square', + 'squealing', + 'squeamish', + 'staking', + 'stale', + 'standing', + 'statuesque', + 'steadfast', + 'steady', + 'steep', + 'stereotyped', + 'sticky', + 'stiff', + 'stimulating', + 'stingy', + 'stormy', + 'straight', + 'strange', + 'striped', + 'strong', + 'stupendous', + 'sturdy', + 'subdued', + 'subsequent', + 'substantial', + 'successful', + 'succinct', + 'sudden', + 'sulky', + 'super', + 'superb', + 'superficial', + 'supreme', + 'swanky', + 'sweet', + 'sweltering', + 'swift', + 'symptomatic', + 'synonymous', + 'taboo', + 'tacit', + 'tacky', + 'talented', + 'tall', + 'tame', + 'tan', + 'tangible', + 'tangy', + 'tart', + 'tasteful', + 'tasteless', + 'tasty', + 'tawdry', + 'tearful', + 'tedious', + 'teeny', + 'teeny-tiny', + 'telling', + 'temporary', + 'ten', + 'tender', + 'tense', + 'tenuous', + 'terrific', + 'tested', + 'testy', + 'thankful', + 'therapeutic', + 'thick', + 'thin', + 'thinkable', + 'third', + 'thirsty', + 'thoughtful', + 'thoughtless', + 'threatening', + 'thundering', + 'tidy', + 'tight', + 'tightfisted', + 'tiny', + 'tired', + 'tiresome', + 'toothsome', + 'torpid', + 'tough', + 'towering', + 'tranquil', + 'trashy', + 'tremendous', + 'tricky', + 'trite', + 'troubled', + 'truculent', + 'true', + 'truthful', + 'typical', + 'ubiquitous', + 'ultra', + 'unable', + 'unaccountable', + 'unadvised', + 'unarmed', + 'unbecoming', + 'unbiased', + 'uncovered', + 'understood', + 'undesirable', + 'unequal', + 'unequaled', + 'uneven', + 'unhealthy', + 'uninterested', + 'unique', + 'unkempt', + 'unknown', + 'unnatural', + 'unruly', + 'unsightly', + 'unsuitable', + 'untidy', + 'unused', + 'unusual', + 'unwieldy', + 'unwritten', + 'upbeat', + 'uppity', + 'upset', + 'uptight', + 'used', + 'useful', + 'useless', + 'utopian', + 'vacuous', + 'vagabond', + 'vague', + 'valuable', + 'various', + 'vast', + 'vengeful', + 'venomous', + 'verdant', + 'versed', + 'victorious', + 'vigorous', + 'violent', + 'violet', + 'vivacious', + 'voiceless', + 'volatile', + 'voracious', + 'vulgar', + 'wacky', + 'waggish', + 'waiting', + 'wakeful', + 'wandering', + 'wanting', + 'warlike', + 'warm', + 'wary', + 'wasteful', + 'watery', + 'weak', + 'wealthy', + 'weary', + 'well-groomed', + 'well-made', + 'well-off', + 'well-to-do', + 'wet', + 'whimsical', + 'whispering', + 'white', + 'whole', + 'wholesale', + 'wicked', + 'wide', + 'wide-eyed', + 'wiggly', + 'wild', + 'willing', + 'windy', + 'wiry', + 'wise', + 'wistful', + 'witty', + 'woebegone', + 'womanly', + 'wonderful', + 'wooden', + 'woozy', + 'workable', + 'worried', + 'worthless', + 'wrathful', + 'wretched', + 'wrong', + 'wry', + 'yellow', + 'yielding', + 'young', + 'youthful', + 'yummy', + 'zany', + 'zealous', + 'zesty', + 'zippy', + 'zonked' +]; + +const animals = [ + 'Aardvark', + 'Albatross', + 'Alligator', + 'Alpaca', + 'Ant', + 'Anteater', + 'Antelope', + 'Ape', + 'Armadillo', + 'Donkey', + 'Baboon', + 'Badger', + 'Barracuda', + 'Bat', + 'Bear', + 'Beaver', + 'Bee', + 'Bison', + 'Boar', + 'Buffalo', + 'Butterfly', + 'Camel', + 'Capybara', + 'Caribou', + 'Cassowary', + 'Cat', + 'Caterpillar', + 'Cattle', + 'Chamois', + 'Cheetah', + 'Chicken', + 'Chimpanzee', + 'Chinchilla', + 'Chough', + 'Clam', + 'Cobra', + 'Cockroach', + 'Cod', + 'Cormorant', + 'Coyote', + 'Crab', + 'Crane', + 'Crocodile', + 'Crow', + 'Curlew', + 'Deer', + 'Dinosaur', + 'Dog', + 'Dogfish', + 'Dolphin', + 'Dotterel', + 'Dove', + 'Dragonfly', + 'Duck', + 'Dugong', + 'Dunlin', + 'Eagle', + 'Echidna', + 'Eel', + 'Eland', + 'Elephant', + 'Elk', + 'Emu', + 'Falcon', + 'Ferret', + 'Finch', + 'Fish', + 'Flamingo', + 'Fly', + 'Fox', + 'Frog', + 'Gaur', + 'Gazelle', + 'Gerbil', + 'Giraffe', + 'Gnat', + 'Gnu', + 'Goat', + 'Goldfinch', + 'Goldfish', + 'Goose', + 'Gorilla', + 'Goshawk', + 'Grasshopper', + 'Grouse', + 'Guanaco', + 'Gull', + 'Hamster', + 'Hare', + 'Hawk', + 'Hedgehog', + 'Heron', + 'Herring', + 'Hippopotamus', + 'Hornet', + 'Horse', + 'Human', + 'Hummingbird', + 'Hyena', + 'Ibex', + 'Ibis', + 'Jackal', + 'Jaguar', + 'Jay', + 'Jellyfish', + 'Kangaroo', + 'Kingfisher', + 'Koala', + 'Kookabura', + 'Kouprey', + 'Kudu', + 'Lapwing', + 'Lark', + 'Lemur', + 'Leopard', + 'Lion', + 'Llama', + 'Lobster', + 'Locust', + 'Loris', + 'Louse', + 'Lyrebird', + 'Magpie', + 'Mallard', + 'Manatee', + 'Mandrill', + 'Mantis', + 'Marten', + 'Meerkat', + 'Mink', + 'Mole', + 'Mongoose', + 'Monkey', + 'Moose', + 'Mosquito', + 'Mouse', + 'Mule', + 'Narwhal', + 'Newt', + 'Nightingale', + 'Octopus', + 'Okapi', + 'Opossum', + 'Oryx', + 'Ostrich', + 'Otter', + 'Owl', + 'Oyster', + 'Panther', + 'Parrot', + 'Partridge', + 'Peafowl', + 'Pelican', + 'Penguin', + 'Pheasant', + 'Pig', + 'Pigeon', + 'Pony', + 'Porcupine', + 'Porpoise', + 'Quail', + 'Quelea', + 'Quetzal', + 'Rabbit', + 'Raccoon', + 'Rail', + 'Ram', + 'Rat', + 'Raven', + 'Red deer', + 'Red panda', + 'Reindeer', + 'Rhinoceros', + 'Rook', + 'Salamander', + 'Salmon', + 'Sand Dollar', + 'Sandpiper', + 'Sardine', + 'Scorpion', + 'Seahorse', + 'Seal', + 'Shark', + 'Sheep', + 'Shrew', + 'Skunk', + 'Snail', + 'Snake', + 'Sparrow', + 'Spider', + 'Spoonbill', + 'Squid', + 'Squirrel', + 'Starling', + 'Stingray', + 'Stinkbug', + 'Stork', + 'Swallow', + 'Swan', + 'Tapir', + 'Tarsier', + 'Termite', + 'Tiger', + 'Toad', + 'Trout', + 'Turkey', + 'Turtle', + 'Viper', + 'Vulture', + 'Wallaby', + 'Walrus', + 'Wasp', + 'Weasel', + 'Whale', + 'Wildcat', + 'Wolf', + 'Wolverine', + 'Wombat', + 'Woodcock', + 'Woodpecker', + 'Worm', + 'Wren', + 'Yak', + 'Zebra' +]; + +module.exports = usernameGenerator; diff --git a/server/routes/router.js b/server/routes/router.js new file mode 100644 index 0000000..9ec2a57 --- /dev/null +++ b/server/routes/router.js @@ -0,0 +1,29 @@ +const express = require('express'); +const router = express.Router({ strict: true }); +const path = require('path'); + +router.get('/', function (request, response) { + response.sendFile(path.join(__dirname, '../../client/src/views/home.html')); +}); + +router.get('/create', function (request, response) { + response.sendFile(path.join(__dirname, '../../client/src/views/create.html')); +}); + +router.get('/how-to-use', function (request, response) { + response.sendFile(path.join(__dirname, '../../client/src/views/how-to-use.html')); +}); + +router.get('/game/:code', function (request, response) { + response.sendFile(path.join(__dirname, '../../client/src/views/game.html')); +}); + +router.get('/liveness_check', (req, res) => { + res.sendStatus(200); +}); + +router.get('/readiness_check', (req, res) => { + res.sendStatus(200); +}); + +module.exports = router; diff --git a/server/routes/util.js b/server/routes/util.js new file mode 100644 index 0000000..4d1626f --- /dev/null +++ b/server/routes/util.js @@ -0,0 +1,9 @@ +const fs = require('fs'); + +function checkIfFileExists (file) { + return fs.promises.access(file, fs.constants.F_OK) + .then(() => true) + .catch((e) => { console.error(e); return false; }); +} + +module.exports = checkIfFileExists; diff --git a/spec/support/jasmine.json b/spec/support/jasmine.json index f004bf2..1f935fe 100644 --- a/spec/support/jasmine.json +++ b/spec/support/jasmine.json @@ -8,4 +8,4 @@ ], "stopSpecOnExpectationFailure": false, "random": true -} \ No newline at end of file +} diff --git a/spec/unit/ServerSpec.js b/spec/unit/ServerSpec.js deleted file mode 100644 index d81bf95..0000000 --- a/spec/unit/ServerSpec.js +++ /dev/null @@ -1,65 +0,0 @@ -const ServerHelper = require('../../server-helper.js'); -const CronJob = require('cron').CronJob; - -describe('server helper', function() { - - let serverHelper; - - beforeEach(function(){ - serverHelper = new ServerHelper(CronJob); - }); - - it('should be instantiated with a cron job', function() { - - expect(serverHelper.job).toBeDefined(); - expect(serverHelper.job instanceof CronJob).toBeTrue(); - - }); - - it('should find a specific game by code in activeGames', function() { - - const expectedGame = {"startTime": 12345}; - serverHelper.activeGames = { - "somegame": {"startTime": 24156}, - "expected": expectedGame, - "filler": {"eh": "i dunno"}, - "wrong": {"this is": -Infinity} - }; - - expect(serverHelper.findGame("expected")).toBe(expectedGame); - - }); - - it('should create a new game', function(){ - - const spy = jasmine.createSpy("spy"); - const game = {"accessCode": "werewolf"}; - - serverHelper.newGame(game,spy); - - expect(serverHelper.findGame("werewolf")).toBeDefined(); - expect(serverHelper.findGame("werewolf").accessCode).toEqual("werewolf"); - expect(spy).toHaveBeenCalled(); - }); - - xdescribe('should handle players joining', function() { - - const socket = { - "emit": (value) => { - return value; - } - }; - - it('successful adds a player to game', function() { - - }); - - it('rejects a player when the game is full', function() { - - }); - - it('rejects a player when game is not found', function() { - - }); - }); -}); \ No newline at end of file diff --git a/spec/unit/server/modules/GameManager_Spec.js b/spec/unit/server/modules/GameManager_Spec.js new file mode 100644 index 0000000..28bd36e --- /dev/null +++ b/spec/unit/server/modules/GameManager_Spec.js @@ -0,0 +1,218 @@ +// TODO: clean up these deep relative paths? jsconfig.json is not working... +const Game = require("../../../../server/model/Game"); +const globals = require("../../../../server/config/globals"); +const USER_TYPES = globals.USER_TYPES; +const Person = require("../../../../server/model/Person"); +const GameManager = require('../../../../server/modules/GameManager.js'); +const GameStateCurator = require("../../../../server/modules/GameStateCurator"); +const logger = require('../../../../server/modules/Logger.js')(false); + +describe('GameManager', function () { + let gameManager, namespace; + + beforeAll(function () { + spyOn(logger, 'debug'); + spyOn(logger, 'error'); + gameManager = new GameManager(logger, globals.ENVIRONMENT.PRODUCTION).getInstance(); + let inObj = { emit: () => {} } + namespace = { in: () => { return inObj }}; + }); + + beforeEach(function () { + }); + + describe('#transferModerator', function () { + it('Should transfer successfully from a dedicated moderator to a killed player', () => { + let personToTransferTo = new Person("1", "123", "Joe", USER_TYPES.KILLED_PLAYER); + personToTransferTo.out = true; + let moderator = new Person("3", "789", "Jack", USER_TYPES.MODERATOR) + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ personToTransferTo, new Person("2", "456", "Jane", USER_TYPES.PLAYER)], + [], + false, + moderator + ); + gameManager.transferModeratorPowers(game, personToTransferTo, namespace, logger); + + + expect(game.moderator).toEqual(personToTransferTo); + expect(personToTransferTo.userType).toEqual(USER_TYPES.MODERATOR); + expect(moderator.userType).toEqual(USER_TYPES.SPECTATOR); + }); + + it('Should transfer successfully from a dedicated moderator to a spectator', () => { + let personToTransferTo = new Person("1", "123", "Joe", USER_TYPES.SPECTATOR); + let moderator = new Person("3", "789", "Jack", USER_TYPES.MODERATOR) + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ new Person("2", "456", "Jane", USER_TYPES.PLAYER)], + [], + false, + moderator + ); + game.spectators.push(personToTransferTo) + gameManager.transferModeratorPowers(game, personToTransferTo, namespace, logger); + + + expect(game.moderator).toEqual(personToTransferTo); + expect(personToTransferTo.userType).toEqual(USER_TYPES.MODERATOR); + expect(moderator.userType).toEqual(USER_TYPES.SPECTATOR); + }); + + it('Should transfer successfully from a temporary moderator to a killed player', () => { + let personToTransferTo = new Person("1", "123", "Joe", USER_TYPES.KILLED_PLAYER); + personToTransferTo.out = true; + let tempMod = new Person("3", "789", "Jack", USER_TYPES.TEMPORARY_MODERATOR) + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ personToTransferTo, tempMod, new Person("2", "456", "Jane", USER_TYPES.PLAYER)], + [], + false, + tempMod + ); + gameManager.transferModeratorPowers(game, personToTransferTo, namespace, logger); + + + expect(game.moderator).toEqual(personToTransferTo); + expect(personToTransferTo.userType).toEqual(USER_TYPES.MODERATOR); + expect(tempMod.userType).toEqual(USER_TYPES.PLAYER); + }); + + it('Should make the temporary moderator a dedicated moderator when they take themselves out of the game', () => { + let tempMod = new Person("3", "789", "Jack", USER_TYPES.TEMPORARY_MODERATOR); + let personToTransferTo = tempMod; + tempMod.out = true; + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ personToTransferTo, tempMod, new Person("2", "456", "Jane", USER_TYPES.PLAYER)], + [], + false, + tempMod + ); + gameManager.transferModeratorPowers(game, personToTransferTo, namespace, logger); + + + expect(game.moderator).toEqual(personToTransferTo); + expect(personToTransferTo.userType).toEqual(USER_TYPES.MODERATOR); + expect(tempMod.userType).toEqual(USER_TYPES.MODERATOR); + }); + }); + + describe('#killPlayer', function () { + it('Should mark a player as out and broadcast it, and should not transfer moderators if the moderator is a dedicated mod.', () => { + spyOn(namespace.in(), 'emit'); + spyOn(gameManager, 'transferModeratorPowers'); + let player = new Person("1", "123", "Joe", USER_TYPES.PLAYER); + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ player ], + [], + false, + new Person("2", "456", "Jane", USER_TYPES.MODERATOR) + ); + gameManager.killPlayer(game, player, namespace, logger); + + + expect(player.out).toEqual(true); + expect(player.userType).toEqual(USER_TYPES.KILLED_PLAYER); + expect(namespace.in().emit).toHaveBeenCalled(); + expect(gameManager.transferModeratorPowers).not.toHaveBeenCalled(); + }); + + it('Should mark a temporary moderator as out but preserve their user type, and call the transfer mod function', () => { + spyOn(namespace.in(), 'emit'); + spyOn(gameManager, 'transferModeratorPowers'); + let tempMod = new Person("1", "123", "Joe", USER_TYPES.TEMPORARY_MODERATOR); + let game = new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ tempMod ], + [], + false, + tempMod + ); + gameManager.killPlayer(game, tempMod, namespace, logger); + + + expect(tempMod.out).toEqual(true); + expect(tempMod.userType).toEqual(USER_TYPES.TEMPORARY_MODERATOR); + expect(namespace.in().emit).toHaveBeenCalled(); + expect(gameManager.transferModeratorPowers).toHaveBeenCalled(); + }); + }); + + describe('#handleRequestForGameState', function () { + it('should send the game state to a matching person with an active connection to the room', () => { + let player = new Person("1", "123", "Joe", USER_TYPES.PLAYER); + let socket = { id: "socket1"}; + spyOn(GameStateCurator, 'getGameStateFromPerspectiveOfPerson'); + player.socketId = "socket1"; + let gameRunner = { + activeGames: { + "abc": new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ player ], + [], + false, + new Person("2", "456", "Jane", USER_TYPES.MODERATOR) + ) + } + } + spyOn(namespace.in(), 'emit'); + gameManager.handleRequestForGameState( + namespace, + logger, + gameRunner, + "abc", + "123", + (arg) => {}, + socket + ); + + expect(GameStateCurator.getGameStateFromPerspectiveOfPerson) + .toHaveBeenCalledWith(gameRunner.activeGames["abc"], player, gameRunner, socket, logger); + }); + + it('should send the game state to a matching person who reset their connection', () => { + let player = new Person("1", "123", "Joe", USER_TYPES.PLAYER); + let socket = { id: "socket_222222", join: () => {}}; + spyOn(socket, 'join'); + spyOn(GameStateCurator, 'getGameStateFromPerspectiveOfPerson'); + player.socketId = "socket_111111"; + let gameRunner = { + activeGames: { + "abc": new Game( + "abc", + globals.STATUS.IN_PROGRESS, + [ player ], + [], + false, + new Person("2", "456", "Jane", USER_TYPES.MODERATOR) + ) + } + } + spyOn(namespace.in(), 'emit'); + gameManager.handleRequestForGameState( + namespace, + logger, + gameRunner, + "abc", + "123", + (arg) => {}, + socket + ); + + expect(GameStateCurator.getGameStateFromPerspectiveOfPerson) + .toHaveBeenCalledWith(gameRunner.activeGames["abc"], player, gameRunner, socket, logger); + expect(player.socketId).toEqual(socket.id); + expect(socket.join).toHaveBeenCalled(); + }); + }); +}); diff --git a/stylesheets/styles.css b/stylesheets/styles.css deleted file mode 100644 index 88fa8ab..0000000 --- a/stylesheets/styles.css +++ /dev/null @@ -1,1918 +0,0 @@ -@media(max-width: 750px) { - .app-header { - font-size: 45px; - margin: 2em 0 0.5em 0; - } - - .app-header-secondary { - font-size: 35px; - margin: 0.3em 0; - } - - - #game-container #card-container { - min-width: 20em; - } - - h3 { - font-size: 20px; - } - - textarea { - font-size: 14px; - } - - #game-container { - flex-direction: column; - } - - #app-content { - width: 92%; - } - - .card { - padding: 0.5em; - width: 8em; - height: 11.5em; - font-size: 0.9em; - } - - .custom-role-edit { - font-size: 15px; - } - - .compact-card, .compact-card-header { - width: 9em; - } - - #card-select-header #role-view-changer img { - width: 20px; - } - - #role-view-changer div { - font-size: 14px; - } - - .card-header > p { - right: 7px; - top: 19px; - } - - .card-image { - top: 25%; - left: 12%;; - } - - .disclaimer, .custom-card h1 { - font-size: 15px; - } - - .modal { - width: 92%; - } - - .modal-content { - width: 90%; - } - - .modal-body { - padding: 1em; - } - - .modal-header { - padding: 0 1em; - } - - .modal-role { - margin-right: 2em; - } - - #learn-container, #faq-container { - margin: 3em 1em; - } - - .app-title img { - width: 100%; - } - - #card-select-header, #game-start { - align-items: center; - justify-content: center; - } - - #join-game-container { - display: flex; - flex-direction: column - } - - #join-game-container input[type=text] { - width: 10em; - height: 1.3em; - font-size: 1em; - } - - #join-game-container label { - font-size: 1.3em; - } - - #join-game-container h2 { - font-size: 2.5em; - margin-bottom: 1em; - } - - #join-game-container button, #join-game-container a { - width: 45%; - max-width: 15em; - margin-right: 0.5em; - } - - #join-game-container a button { - width: 100%; - } - - #overlay { - justify-content: center; - align-items: center; - } - - #killed-name { - padding-top: 0; - margin: 0 0.5em; - font-size: 2em; - } - - #game-container .alive-player .tooltiptext { - width: 12em; - right: 45%; - bottom: 80%; - font-size: 12px; - } - -} - -@media(min-width: 750.01px) { - .app-header { - font-size: 70px; - margin: 0.5em 0; - } - - #card-select-header #role-view-changer img { - width: 25px; - } - - .card-header > p { - right: 17px; - top: 30px; - } - - textarea { - font-size: 1.1em; - } - - #game-container #card-container { - min-width: 25em; - } - - .app-header-secondary { - font-size: 70px; - margin: 0.3em 0; - } - - .card { - width: 7em; - height: 10.5em; - padding: 1em; - font-size: 1.1em; - margin: 0.5em; - } - - .compact-card, .compact-card-header { - width: 11em; - } - - .custom-role-edit { - font-size: 19px; - } - - .disclaimer, .custom-card h1 { - font-size: 18px; - } - - h3 { - font-size: 30px; - } - - #app-content { - width: 80%; - } - - #learn-container, #faq-container { - margin: 3em; - } - - .modal-body { - padding: 2em 4em; - } - - .modal { - width: 92%; - } - - .modal-content { - width: 90%; - } - - #custom-card-modal .modal-content, #edit-custom-roles-modal .modal-content { - width: 50%; - } - - .modal-header { - padding: 0 3em; - } - - .modal-role { - margin-right: 3em; - } - - .app-title img { - width: 35em; - } - - #main-buttons a, #main-buttons button { - max-width: 15em; - } - - #card-select { - justify-content: flex-start; - } - - .card-image { - top: 29%; - left: 20%; - } - - #join-game-container input[type=text] { - width: 17em; - height: 1.7em; - font-size: 1.1em; - } - - #join-game-container label { - font-size: 1.3em; - } - - #join-game-container h2 { - font-size: 4em; - } - - #join-game-container button, #join-game-container a button { - width: 15em; - padding: 1.5em; - margin-right: 1em; - } - - #killed-name { - padding-top: 2em; - font-size: 2.5em; - margin: 0; - } - - #overlay { - justify-content: flex-start; - align-items: center; - } - - #game-container .alive-player .tooltiptext { - width: 15em; - font-size: 14px; - right: 106%; -/* bottom: -36%;*/ - } - -} - -@media(max-width: 850px) { - #card-select-header span:nth-child(2) { - flex-direction: column; - } - - #card-select-header span:nth-child(2) > div { - margin: 0.5em 0; - } -} - -@media(max-width: 1225px) and (min-width: 750.01px) { - #custom-card-modal .modal-content, #edit-custom-roles-modal .modal-content { - width: 75%; - } -} - -@font-face { - font-family: 'diavlo'; - src: url("../assets/fonts/Diavlo_LIGHT_II_37.otf") format("opentype"); -} - -@font-face { - font-family: 'diavlo-bold'; - src: url("../assets/fonts/Diavlo_BOOK_II_37.otf") format("opentype"); -} - -@font-face { - font-family: 'sitewide-sans-serif'; - src: url("../assets/fonts/manrope-light.otf") format("opentype"); -} - -html, body { - margin: 0 auto; - height: 100%; - color: #bfb8b8; - font-family: 'sitewide-sans-serif', sans-serif; - background-color: #23282b !important; -} - -@keyframes fadein { - from { - opacity: 0; - - } - to { - opacity: 1; - } -} - -@keyframes slide-fade { - from { - opacity: 0; - transform: translateX(80px) - - } - to { - opacity: 1; - transform: translateX(0); - } -} - -@keyframes slide-fade-remove { - from { - opacity: 1; - transform: translateX(0px) - - } - to { - opacity: 0; - transform: translateX(-80px); - } -} - -#app-content { - text-align: center; - margin: 0 auto; - position: relative; -} - -#landing-container { - width: 100%; - height: 100%; - position: relative; - text-align: center; - background: linear-gradient(0deg, rgba(35,40,43,0.7959558823529411) 18%, rgba(131,131,131,0.6222864145658263) 100%); -} - -.app-title .app-header { - width: 6em; - display: flex; - font-family: diavlo-bold, sans-serif; -} - -.app-title { - display: flex; - align-items: center; - flex-direction: column; - line-height: 0.95; -} - -#footer { - position: absolute; - bottom: 0; - width: 100%; - margin-bottom: 1.5em; - font-size: 0.75em; - text-align: center; - align-items: center; - display: flex; - flex-direction: column; - justify-content: center; -} - -.bmc-button span:nth-child(1) { - font-size: 20px; -} - -.bmc-button { - line-height: 35px !important; - height:40px !important; - text-decoration: none !important; - display:inline-flex !important; - align-items: center !important; - margin-bottom: 3em !important; - color:#ffffff !important; - background-color:#FF5F5F !important; - border-radius: 5px !important; - border: 1px solid transparent !important; - padding: 7px 15px 7px 10px !important; - font-size: 15px !important; - box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important; - -webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; - font-family: sitewide-sans-serif, sans-serif !important; - -webkit-box-sizing: border-box !important; - box-sizing: border-box !important; -} - -.bmc-button:hover, .bmc-button:active, .bmc-button:focus { - -webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; - text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; - opacity: 0.85 !important;color:#ffffff !important; -} - -#footer div { - display: flex; - align-items: center; -} - -#footer p { - margin: 0 0 0 1em; - color: lightgray; -} - -#footer a { - color: #d13d3d; - text-decoration: #d13d3d; - cursor: pointer; - margin: 0 0 0 1em; -} - -#footer a:hover { - color: #333243; -} - -.app-header, .app-header-secondary { - font-family: 'diavlo', sans-serif; - filter: drop-shadow(2px 2px 4px black); - color: #992626; -} - -h3 { - color: gray; -} - -button { - font-family: 'sitewide-sans-serif', sans-serif; -} - -.error { - border: 1px solid #bd2a2a !important; - background-color: rgba(189, 42, 42, 0.1) !important; -} - -#join-error, #name-error, #size-error, #some-error { - color: #bd2a2a; - font-size: 0.9em; - height: 2em; - margin: 0; - font-weight: bold; -} - -#join-game-container span { - display: flex; - flex-direction: column; -} - -#join-game-container div { - width: 100%; - display: flex; - justify-content: center; -} - -#join-game-container form { - margin-bottom: 2em; -} - -#join-game-container input[type=text], #create-game-container input[type=text] { - margin-right: 0.5em; - margin-bottom: 0; -} - -.app-btn { - background-color: #992626; - box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.4); - color: #bfb8b8; - border: none; - width: 10em; - padding: 1em; - border-radius: 3px; - margin-bottom: 1em; -} - -#create-game-container .app-btn { - display: flex; - align-items: center; - justify-content: center; -} - -.app-btn img, .app-btn-secondary img { - width: 15px; -} - -img.custom-role-button { - width: 25px; -} - -.custom-role-edit { - display: flex; - width: 100%; - flex-direction: column; - justify-content: space-around; - align-items: center; - background-color: black; - border-radius: 5px; - margin: 0.3em; -} - -.edit-role-form { - background-color: #1a1a1a; - padding: 1em; -} - -.custom-role-edit > div:nth-child(1) { - display: flex; - width: 100%; - justify-content: space-around; -} - -.custom-role-edit > div:nth-child(1) div { - display: flex; - align-items: center; -} - -.custom-role-edit > div:nth-child(2) { - display: flex; - width: 100%; -} - -.custom-role-edit p { - text-overflow: ellipsis; - overflow-x: hidden; - white-space: nowrap; - max-width: 7em; -} - -.custom-role-edit div > img { - margin: 0 1em; - cursor: pointer; - user-select: none; -} - -.custom-role-edit div > img:hover { - filter: brightness(70%); -} - -#import-file-input { - display: none; -} - -.card, .compact-card { - text-align: center; - cursor: pointer; - position: relative; - margin: 0.3em; - background-color: #393a40; - color: gray; - box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4); - border-radius: 3px; - user-select: none; -} - -.compact-card { - display: flex; - height: max-content; - position: relative; -} - -.compact-card h1 { - display: flex; - align-items: center; - font-size: 14px; - margin: 0 10px 0 10px; -} - -.compact-card .card-role { - color: #bfb8b8; - margin: 0; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - max-width: 8em; -} - -.compact-card-right p { - font-size: 40px; - margin: 0 10px 0 0; - display: flex; - justify-content: flex-end; -} - -.compact-card-left p { - font-size: 40px; - margin: 0 0 0 10px; - display: flex; - justify-content: flex-start; -} - -.compact-card-left, .compact-card-right { - width: 50%; -} - -.compact-card .card-quantity { - text-align: center; - margin: 0; -} - -.compact-card-header { - position: absolute; - flex-direction: column; - align-items: center; - justify-content: center; - display: flex; - top: 0; - right: 0; - pointer-events: none; - text-align: center; -} - -.card-werewolf { - border: 1px solid red; -} - -.custom-card { - border: 1px dashed whitesmoke; - background-color: transparent; -} - -.custom-card div { - font-size: 40px; - color: whitesmoke; - margin-right: 5px; -} - -.custom-card h1 { - color: whitesmoke; -} - -.card:hover, .compact-card:hover { - background-color: #55565c; -} - -.card-top { - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: space-between; - height: 50%; -} - -.card-bottom { - display: flex; - display: -webkit-flex; - justify-content: flex-end; - height: 50%; - align-items: flex-end; -} - -.card-top p { - margin: 0; - font-size: 2.5em; - pointer-events: none; - line-height: 1; - color: #bfb8b8; -} - -.card-top p.card-role { - font-size: 1em; - height: 1.2em; - pointer-events: none; - max-width: 7em; - white-space: nowrap; - overflow-x: hidden; - text-overflow: ellipsis; - overflow-y: visible; -} - -.card-header { - display: flex; - width: 100%; - justify-content: space-between; - align-items: flex-start; - pointer-events: none; -} - -.card-header > p { - position: absolute; -} - -.card-bottom p { - pointer-events: none; - line-height: 1; - font-size: 3em; - margin: 0; - color: #bfb8b8; -} - -.card-image { - position: absolute; - pointer-events: none; -} - -.card-image-custom { - width: 50px; - height: 50px; - padding: 25px; -} - -.card-quantity { - pointer-events: none; - font-weight: bold; - text-align: left; - color: #bd2a2a; - font-size: 1.5em; - margin: 0 0 0 0.2em; - width: 1.5em; -} - -.card-role { - color: #bfb8b8; - margin: 0; -} - -#card-select { - margin-bottom: 2em; -} - -#card-select-good, #card-select-evil { - display: flex; - display: -webkit-flex; - -webkit-flex-wrap: wrap; -} - -#card-select > h2:nth-child(1) { - color: #4a6bff; -} - -#card-select > h2:nth-child(3) { - color: #bd2a2a; -} - - -.app-btn-secondary { - display: flex; - justify-content: space-around; - align-items: center; - background-color: lightgray; - border-radius: 3px; - color: black; - border: none; - width: 10em; - padding: 0.5em; - margin-right: 1em; -} - -@keyframes press-down { - from { box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4); } - to { box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5); } -} - -.app-btn:hover, .app-btn:focus { - cursor: pointer; - background-color: #333243 !important; -} - -#main-buttons .app-btn:hover, #main-buttons .app-btn:focus { - box-shadow: none !important; - cursor: pointer; - background-color: #333243; - animation: press-down 0.2s; - animation-fill-mode: forwards; - animation-direction: normal; -} - -.app-btn-secondary:hover, .app-btn-secondary:focus { - cursor: pointer; - filter: brightness(70%); -} - -#main-buttons { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - max-width: 18em; - margin: 0 auto; - overflow: hidden; -} - -#main-buttons button { - width: 100%; - padding: 1em; - font-size: 0.9em; - box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.4); - background-color: #992626; - color: #bfb8b8; -} - -#main-buttons a { - width: 100%; -} - -#game-mode-select { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - position: absolute; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} - -#landing-container .slide-in { - animation: slide-fade 0.25s; - animation-delay: 0.125s; - animation-fill-mode: both; -} - -#landing-container .slide-out { - animation: slide-fade-remove 0.25s; -} - - -#game-mode-select .game-mode { - width: 7em; - background-color: transparent; - color: whitesmoke; - border: 1px solid whitesmoke; - font-size: 30px; - font-weight: bold; - padding: 5px; - margin-bottom: 0.5em; - border-radius: 5px; -} - -#game-mode-select .game-mode:hover { - cursor: pointer; - background-color: #494f52; -} - -#game-mode-select span { - font-size: 50px; - font-weight: bold; - cursor: pointer; - margin-bottom: 0.2em; - text-align: left; - width: 100%; -} - -#game-mode-select span:hover { - color: #333243; -} - -#card-select-header { - display: flex; - width: 100%; - justify-content: center; - align-items: flex-start; - margin-bottom: 0.5em; - flex-direction: column; -} - -#card-select-header a, #landing-container #game-mode-select a:nth-child(2) { - text-decoration: underline; - color: #b8c4ff; -} - -#landing-container #game-mode-select a:nth-child(2) { - text-decoration: underline; - color: #b8c4ff; - text-align: left; - width: 100%; - margin-bottom: 1em; -} - -#card-select-header span > div { - display: flex; - align-items: center; -} - -#card-select-header #role-view-changer img { - margin-left: 15px; -} - -#role-view-changer div { - display: flex; - justify-content: space-around; - width: max-content; - margin: 0 15px 0 0; - padding: 5px; - border-radius: 3px; -} - -.selected { - background: #494f52; -} - -#role-view-changer div:hover { - cursor: pointer; - background-color: #494f52; -} - -#role-view-changer { - margin: 15px 0 0 0; -} - -#role-view-changer p { - margin: 0; -} - -#card-select-header h3 { - margin: 0; - font-size: 1.2em; - color: #bfb8b8; -} - -#create-game-container button { - padding: 0.8em; - height: 3em; - width: max-content; -} - -#edit-role-btn > img { - margin-left: 0.5em; -} - -#import-role-btn > img { - margin-left: 0.5em; -} - -#game-start a button { - width: 100%; -} - -#game-start { - display: flex; - width: 100%; -} - -#game-start a { - margin-right: 0.3em; -} - -#game-start > button { - background-color: #8EA604; - color: black; - margin-left: 0.3em; - width: 12em; -} - -#game-start a button { - margin-right: 0.3em; - margin-left: 0; - width: 12em; -} - -#card-select-header button:nth-child(1) { - margin-right: 0.3em; -} - -#card-select-header button:nth-child(2) { - margin-left: 0.3em; -} - -#card-select-header span { - display: flex; - align-items: center; -} - -#reset-btn { - /*background-color: transparent;*/ - /*color: #bd2a2a;*/ - /*border-radius: 5px;*/ - /*border: 1px solid #bd2a2a;*/ - /*width: 8em;*/ - /*padding: 0.5em;*/ - /*margin: 0 1em 0 0;*/ - /*cursor: pointer;*/ -} - -#create-game-container, #join-game-container { - text-align: left; - margin: 1em 0.5em 2em 0.5em; -} - -#game-size { - border-radius: 5px; - padding: 0.3em 0.5em; - margin-right: 0.5em !important; -} - -#create-game-container { - display: flex; - flex-direction: column; - align-items: flex-start; - animation: slide-fade 0.5s; -} - -#create-game-container #werewolf-key { - width: 25px; - height: 25px; - border: 1px solid red; - border-radius: 3px; - margin-right: 10px; -} - - -#join-game-container { - display: flex; - flex-direction: column; - align-items: center; - animation: slide-fade 0.5s; -} - -a { - text-decoration: none; - color: inherit; -} - -input[type=text] { - background-color: transparent; - border: 1px solid #464552; - caret-color: gray; - margin: 0.5em 0 1em 0; - color: gray; - padding: 0.9em; - height: 1.2em; - width: 12em; - border-radius: 5px; - font-size: 1.1em; -} - -textarea { - resize: none; - background-color: transparent; - border: 1px solid #464552; - caret-color: gray; - font-family: inherit; - margin: 0.5em 0 1em 0; - color: gray; - padding: 0.9em; - border-radius: 5px; -} - -.checkbox label::before{ - content: ""; - display: inline-block; - height: 30px; - left: -42px; - width: 30px; - border: 1px solid whitesmoke; - border-radius: 3px; -} - -.checkbox input[type=checkbox] { - opacity: 0; -} - -.checkbox label::after { - display: inline-block; - height: 8px; - width: 16px; - left: -35px; - top: 8px; - border-left: 3px solid; - border-bottom: 3px solid; - transform: rotate(-55deg); -} - -.checkbox { - display: flex; - width: 100%; - margin: 1em 0; -} - -.checkbox label { - position: relative; - margin: 1em 0 1em 1.5em; -} - -.checkbox label::before, -.checkbox label::after { - position: absolute; -} - -.checkbox input[type="checkbox"] + label::after { - content: none; -} - -.checkbox input[type="checkbox"]:checked + label::after { - content: ""; -} - -.checkbox input[type="checkbox"]:focus + label::before { - outline: rgb(59, 153, 252) auto 5px; -} - -.checkbox label:hover::before { - border: 1px solid #333243 !important; - cursor: pointer; -} - -.checkbox label:hover { - cursor: pointer; -} - - -.disclaimer { - color: #bd2a2a; -} - -select { - border-radius: 5px; - padding: 10px 20px; - font-size: 20px; - font-family: inherit; - background-color: transparent; - color: whitesmoke; -} - -select option { - background: rgb(35,40,43); -} - -input[type=number] { - background-color: transparent; - border: 1px solid #464552; - border-radius: 5px; - caret-color: gray; - margin: 0.5em 0 1em 0; - color: gray; - padding: 0.9em; - height: 1.2em; - width: 5em; - font-size: 1.1em; -} - -input[type=text]:hover, input[type=number]:hover { - background-color: rgba(51, 50, 67, 0.35); -} - -label { - margin-bottom: 1em; - font-size: 1em; - display: flex; - flex-direction: column; -} - -#message-box { - height: 2em; - max-width: 25em; - margin: 1em auto; - border-bottom: 1px solid #992626; - padding: 0.5em; -} - -.import-failure { - display: flex; - width: 100%; - flex-direction: row; - justify-content: space-between; - background-color: black; - border-radius: 5px; - margin: 0.3em; -} - -.import-failure-label { - display: flex; - flex-direction: row; - width: 33%; -} - -.import-failure-label p { - text-overflow: ellipsis; - overflow-x: hidden; - white-space: nowrap; - max-width: 20em; -} - -.import-failure-data { - display: flex; - flex: 1 1 auto; - flex-direction: row; - justify-content: center; -} - -.import-failure-data ul { - max-width: 40em; -} - -.triangle { - width: 0; - height: 0; - border-style: solid; - border-width: 8px; - float: left; - position: relative; - z-index: 1; - } - -div.import-failure.warning .triangle { - border-color: #dbec3b transparent transparent #dbec3b; -} - -div.import-failure.error .triangle { - border-color: #c7360a transparent transparent #c7360a; -} - -/* lobby */ - -#lobby-container { - padding: 1em; - max-width: 26em; - margin: 0 auto; -} - -.lobby-player { - color: #bfb8b8; - border-radius: 3px; - font-size: 1em; - background-color: rgba(51, 50, 67, 0.35); - padding: 0.3em; - margin: 0.5em 0; - text-align: left; - box-shadow: 2px 2px 7px rgba(0, 0, 0, 0.3); -} - -#game-code { - font-family: "Courier New", serif; -} - -.highlighted { - border: 2px solid #bd2a2a; -} - -.disabled { - opacity: 0.5; - color: gray; - background-color: white; - pointer-events: none; - border: none; -} - -.hidden { - display: none !important; -} - -#lobby-subheader { - text-align: left; - margin-bottom: 2em; -} - -#join-count, #deck-size { - font-size: 1.5em; -} - -.lobby-player p { - margin: 0; -} - -#launch-btn { - margin-top: 2em; -} - -/* GAME */ - -@keyframes flip-up { - 0% { - transform: rotateY(0deg); - } - 100% { - transform: rotateY(-180deg); - } -} - -@keyframes flip-slide { - 0% { - transform: rotateY(0deg); - transform: translateX(-100px); - } - 100% { - transform: rotateY(-90deg); - transform: translateX(0px); - } -} - -@keyframes flip-down { - 0% { - transform: rotateY(0deg); - } - 100% { - transform: rotateY(180deg); - } -} - - -#game-card { - background-color: transparent; - display: flex; - flex-direction: column; - cursor: pointer; - justify-content: space-between; - max-width: 17em; - border-radius: 3px; - height: 23em; - margin: 0 auto 2em auto; - width: 100%; - box-shadow: 0 13px 17px rgba(0,0,0,0.6); - perspective: 1000px; - transform-style: preserve-3d; -} - -#game-card img { - width: 215px; - top: 35px; - position: absolute; - z-index: 4; - user-drag: none; - user-select: none; - -moz-user-select: none; - -webkit-user-drag: none; - -webkit-user-select: none; - -ms-user-select: none; -} - -.placeholder { - width: 150px; - height: 150px; -} - -.village h2 { - color: #4a6bff; -} - -.wolf h2 { - color: #bd2a2a; -} - -.flip-up { - animation: flip-up 0.7s; - animation-fill-mode: forwards; - animation-direction: reverse; -} - -.flip-down { - animation: flip-down 0.7s; - animation-fill-mode: forwards; -} - -.flip-slide{ - animation: flip-slide 1s; - animation-fill-mode: forwards; -} - - -#game-card h2 { - font-size: 1.7em; - font-family: 'diavlo', sans-serif; - margin: 0.3em 0 0.4em 0; -} - -#game-card p { - padding: 0.5em; - font-size: 0.8em; - color: #464552; - max-height: 68px; - overflow: auto; -} - -.game-container { - margin-top: 1em; -} - -/* This container is needed to position the front and back side */ -.game-card-inner { - position: relative; - width: 95%; - height: 97%; - margin: auto auto; - border-radius: 5px; - text-align: center; - border: 3px solid #9c9c9c; -} - -/* Position the front and back side */ -.game-card-front, .game-card-back { - background-color: #dedede; - position: absolute; - display: flex; - border-radius: 3px; - flex-direction: column; - justify-content: space-between; - align-items: center; - width: 100%; - height: 100%; - transform: rotateX(0deg); - -webkit-perspective: 0; - -webkit-backface-visibility: hidden; - -webkit-transform: translate3d(0,0,0); - -moz-backface-visibility: hidden; - -moz-transform: translate3d(0, 0, 0); - -moz-perspective: 0; - visibility:visible; - backface-visibility: hidden; -} - -.game-card-back { - transform: rotateY(180deg); -} - -.game-card-front p:first-of-type { - margin: 0.7em; - border: 1px solid gray; - border-radius: 3px; -} - -.killed-btn { - border-radius: 5px; - width: 13em; - font-size: 1em; - margin: 0 -} - -#players-remaining { - font-size: 1.5em; - color: #bfb8b8; - width: 6em; - margin-bottom: 0.5em; -} - -#clock { - font-size: 1.5em; - width: 3.8em; - margin: 0 0.5em 0.5em 0; -} - -#flip-instruction { - color: gray; - margin: 0; -} - -#game-header { - display: flex; - margin: 0 auto; - max-width: 35em; - justify-content: center; -} - -#game-container { - display: flex; - justify-content: center; - align-items: center; -} - -#game-container .killed-player, #game-container .alive-player { - background-color: black; - border-radius: 5px; - padding: 5px; - display: flex; - align-items: center; - justify-content: space-between; - box-shadow: 3px 10px 10px rgba(0,0,0,0.6); - margin: 0.3em; - position: relative; -} - -#game-container .killed-player p, #game-container .alive-player p { - margin: 0; -} - -#play-pause { - width: 2.5em; - height: 2.5em; - cursor: pointer; -} - -#play-pause:hover { - opacity: 0.5; -} - -#play-pause:hover { -} - -#play-pause:active, #play-pause:focus { - opacity: 0.4; - transform: scale(0.90); -} - -/* end splash */ - -#end-container { - margin: 0 auto; - display: inline-block; - text-align: left; - width: 100%; -} - -#end-container #roster { - width: 100%; - flex-wrap: wrap; - display: flex; -} - -#end-container .winner-header { - display: flex; - align-items: center; - margin: 0; - font-size: 30px; - margin: 10px 0 30px 0; -} - -#end-container .evil-subheader { - font-family: 'diavlo', sans-serif; - color: #bd2a2a; - margin: 0 0.3em; - font-size: 1.5em; -} - -#end-container .roster-list-item { - background-color: #40464a; - padding: 10px; - border-radius: 5px; - display: flex; - align-items: center; - font-size: 20px; - width: 33%; - min-width: 13em; - margin: 0.3em; -} - -#end-container .roster-header { - font-size: 25px; - margin-bottom: 1em; - -} - -#end-container .roster-list-item img { - margin-right: 0.5em; -} - -#end-container .evil-header { - display: flex; - align-items: center; - font-size: 20px; - margin-bottom: 2em; -} - - -#end-container p { - font-weight: bold; - margin: 0 0.3em 0 0; - font-size: 70px; -} - -#end-container button { - margin-top: 3em; -} - -#end-container .winner-village { - font-family: 'diavlo', sans-serif; - color: #4a6bff; -} - -#end-container .winner-wolf { - font-family: 'diavlo', sans-serif; - color: #bd2a2a; -} - -#learn-container h2, #faq-container h2 { - font-family: 'diavlo', sans-serif; - color: #bd2a2a; - font-size: 40px; -} - -.faq-question { - max-width: 60em; -} - -#learn-container button, #faq-container button { - margin-top: 1em; -} - -#roles { - display: flex; - flex-wrap: wrap; -} - -.modal-role { - width: 22em; - position: relative; - border-bottom: 1px solid #494f52; - padding-bottom: 0.5em; -} - -.modal-role div { - display: flex; - justify-content: center; - align-items: center; -} - -.modal-role div div { - display: flex; - flex-direction: column; - align-items: flex-start; -} - -.modal-role p:first-of-type { - margin: 0; - color: #bfb8b8; -} - -.modal-role h2 { - margin: 0; -} - -.modal { - position: fixed; - z-index: 1; - left: 0; - top: 0; - width: 100%; - height: 100%; - overflow: auto; - -webkit-overflow-scrolling: touch; - background-color: rgb(0,0,0); - background-color: rgba(0,0,0,0.4); -} - -.modal-header { - border-radius: 5px; - display: flex; - justify-content: flex-end; - background-color: #23282b; - color: #bfb8b8; -} - -.modal-header h2 { - margin-top: 2em; - margin-bottom: 0; - color: #bfb8b8; -} - -.modal-footer { - padding: 1em; - background-color: #23282b; - color: #bfb8b8; -} - -.modal-content { - position: relative; - color: #bfb8b8; - background-color: #23282b; - margin: 1em auto; - padding: 0; - border: none; - box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); - animation-name: animatetop; - animation-duration: 0.4s -} - -.role-wolf { - color: #bd2a2a; - font-family: 'diavlo', sans-serif; -} - -.role-village { - color: #4a6bff; - font-family: 'diavlo', sans-serif; -} - -.quantity-village, .alive-player-village, .dead-player-village { - color: #4a6bff; -} - -.quantity-wolf, .alive-player-evil, .dead-player-evil { - color: #bd2a2a; -} - -.dead-player-no-reveals { - color: whitesmoke !important; -} - -.alive-player-wolf, .dead-player-wolf { - border: 2px solid #bd2a2a; -} - -#overlay { - position: fixed; - user-select: none; - display: none; - flex-direction: column; - width: 100%; - height: 100%; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(0,0,0,0.9); - z-index: 3; -} - -#killed-name { - display: none; - color: #bfb8b8; -} - -#killed-role { - display: none; - margin: 0 auto; -} - -.killed-role-custom { - width: 190px; - padding: 95px; -} - -.killed-role-hidden { - padding-top: 3em; -} - -@keyframes slide-fade-in-top { - 0% { - opacity: 0; - transform: translateY(-150px) - - } - 100% { - opacity: 1; - transform: translateY(0); - } -} - -@keyframes slide-fade-out-top { - 0% { - opacity: 1; - transform: translateY(0px) - - } - 100% { - opacity: 0; - transform: translateY(-150px); - } -} - -@keyframes slide-fade-in-bottom { - 0% { - opacity: 0; - transform: translateY(150px) - - } - 100% { - opacity: 1; - transform: translateY(0); - } -} - -@keyframes slide-fade-out-bottom { - 0% { - opacity: 1; - transform: translateY(0); - } - 100% { - opacity: 0; - transform: translateY(150px) - - } -} - -@keyframes fade-overlay-in { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -@keyframes fade-overlay-out { - 0% { - opacity: 1; - } - 100% { - opacity: 0; - } -} - -.animate-overlay-in { - animation: fade-overlay-in 5s; - animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - animation-fill-mode: forwards; - -webkit-animation: fade-overlay-in 5s; - -webkit-animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - -webkit-animation-fill-mode: forwards; -} - -.animate-overlay-out { - animation: fade-overlay-out 1s; - animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - animation-fill-mode: forwards; - -webkit-animation: fade-overlay-out 1s; - -webkit-animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - -webkit-animation-fill-mode: forwards; -} - -.animate-name-in { - animation: slide-fade-in-top 5s; - animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - animation-fill-mode: forwards; - -webkit-animation: slide-fade-in-top 5s; - -webkit-animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - -webkit-animation-fill-mode: forwards; -} - -.animate-name-out { - animation: slide-fade-out-top 1s; - animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - animation-fill-mode: forwards; - -webkit-animation: slide-fade-out-top 1s; - -webkit-animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - -webkit-animation-fill-mode: forwards; -} - -.animate-role-in { - animation: slide-fade-in-bottom 5s; - animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - animation-fill-mode: forwards; - -webkit-animation: slide-fade-in-bottom 5s; - -webkit-animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1); - -webkit-animation-fill-mode: forwards; -} - -.animate-role-out { - animation: slide-fade-out-bottom 1s; - animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - animation-fill-mode: forwards; - -webkit-animation: slide-fade-out-bottom 1s; - -webkit-animation-timing-function: cubic-bezier(0.95, 0.05, 0.795, 0.035); - -webkit-animation-fill-mode: forwards; -} - -@keyframes animatetop { - from {top: -300px; opacity: 0} - to {top: 0; opacity: 1} -} - -.close { - margin-top: 0.2em; - color: #bfb8b8; - float: right; - font-size: 46px; - height: 1em; - display: flex; - align-items: center; - font-weight: bold; -} - -.close:hover, -.close:focus { -color: #333243; -text-decoration: none; -cursor: pointer; -} - -/*Tooltip styles. Taken from w3schools*/ -#game-container .alive-player .tooltiptext { - visibility: hidden; - background-color: black; - color: #fff; - text-align: left; - border-radius: 6px; - padding: 5px; - position: absolute; - z-index: 1; -} - -#game-container .alive-player img { - width: 25px; - height: 25px; -} - -#game-container .alive-player:hover .tooltiptext, #game-container .alive-player:focus .tooltiptext { - visibility: visible; - opacity: 1; -} diff --git a/views/create_game.html b/views/create_game.html deleted file mode 100644 index 344201f..0000000 --- a/views/create_game.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - Werewolf - - - - - - - - - - - - -
-
-

Create A Game

- - -
- - - - - -
-

0 Players

- - -
-
-
-
= Werewolf role (counts for parity)
-
-
- - -
-

Condensed View

- -
-
-
-
-

Good Roles

-
-

Evil Roles

-
-
-
- - - - -
-

-
-
- - - diff --git a/views/faq.html b/views/faq.html deleted file mode 100644 index a063c55..0000000 --- a/views/faq.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Title - - - - - - -
- -

FAQ

-
-

What is Parity?

-

Parity means equal, and in the context of the game, this refers to an equal number of wolves and villagers. - This is a victory condition for the wolves, because if at any time during the day parity is reached, it is certain that the wolves - will be able to kill all the remaining villagers. Thus, if a standard or custom role is marked as a Werewolf, it will be considered - when the game determines if parity has been reached. -

-
-
-

What does it mean when a game is "Reveal" or "No-Reveal"?

-

If you are playing a game with "reveals," players' roles will be revealed when they die. Otherwise, they remain a mystery.

-
-
- - - diff --git a/views/game.html b/views/game.html deleted file mode 100644 index 03de719..0000000 --- a/views/game.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - Werewolf - - - - - - - -
-
-

- -
-
-
-
-
-
-
-
-
- - - diff --git a/views/index.html b/views/index.html deleted file mode 100644 index 4340696..0000000 --- a/views/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - Werewolf - - - - - - - - - - - diff --git a/views/join_game.html b/views/join_game.html deleted file mode 100644 index 8b99d5d..0000000 --- a/views/join_game.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - Werewolf - - - - - - - -
-
-

Join a Game

-
- - -
-
- - - - -
-
-
- - - diff --git a/views/learn.html b/views/learn.html deleted file mode 100644 index e5d0b54..0000000 --- a/views/learn.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - Title - - - - - - -
- -

Introduction

-

This is a social strategy game involving deception, deduction, cooperation, and any number of clever tactics. - There are two teams - the village and the werewolves. The village has the objective of finding and killing all - the wolves, and the wolves are trying to eat all the villagers. The game is divided into two phases: day and - night. At night is when the werewolves operate, deciding together which villager to kill off. The daytime is when - the village is active, deciding which among them seem evil and killing them to end the day. During the day, everyone - is disguised as a villager - even those that are actually wolves. -

-

Setup

-

At least 5 players are needed for a sensible game. Players can decide on which cards should go in the deck to create - a balanced experience. For example, a 7 player game might involve 2 werewolves, 3 villagers, a hunter, and a seer. - For larger games, this can be a bit trickier, but the goal is to create a game that isn't too easy for the wolves - or the villagers. Once the deck is chosen, the deck is dealt, and players see only their card. -

-

Gameplay

-

Play begins with the Night One. Everyone "goes to sleep," closing their eyes and creating some sort of white - noise (commonly a patting of the hand on the thigh). At this point, the moderator will ask the Werewolves to wake - up and see each other. If you do not have a designated moderator, choose someone arbitrarily for the first night, - and then the first player to die can moderate the rest of the game.

- - First, The Werewolves will wake up and see the other wolves, giving them the knowledge that will guide the game. - Then, the werewolves go back to sleep. If you are playing with a Minion, next the Werewolves will raise their - hands (but not awake), and the Minion will awake to spot the wolves. You can also play with a "double-blind" - minion, who does not know who the wolves are, but is still playing on the same team as the wolves. This is all - that needs to happen on the first night.

- - At this point, everyone wakes up, and Day One begins. This is an open debate between everyone in the circle about - who they should kill in suspicion of being a wolf. This can take any amount of time, but watch out, because the - wolves win if time expires! You should have some system for exhibiting votes to kill another player. If a player - receives a majority vote, they should press the "I'm dead" button on their screen, and everyone else will have - that player's role revealed to them. At this point, everyone immediately goes to sleep, and the next night begins.

- - On every night after the first, wolves will, in silence, agree on someone in the circle (other than themselves) - to eat during the night. After this concludes, and everyone wakes up, the player that was killed will be revealed - by the moderator, and they will reveal their role. Then, of course, Day Two begins.

- - The game continues in this alternating fashion until an endgame is reached. If a day ends with the same number of - wolves as villagers, the wolves win (as they can kill a villager at night, and then have the majority to kill the - remaining villager during the day). If the village manages to kill every wolf, then they win. In the scenario - where there is one villager and one wolf remaining, if the remaining villager is a Hunter, then the village wins. - There are several "power cards" such as the Hunter, which can help the village or the wolves. If you are a power - role, you can read the description on your card to find out what your special ability is. -

- -
- -